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, either version 3 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 {$INCLUDE ../shared/a_modes.inc}
21 procedure g_Menu_Init();
22 procedure g_Menu_Free();
23 procedure g_Menu_Reset();
24 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
25 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
26 procedure g_Menu_AskLanguage();
28 procedure g_Menu_Show_SaveMenu();
29 procedure g_Menu_Show_LoadMenu(standalone
: Boolean=false);
30 procedure g_Menu_Show_GameSetGame();
31 procedure g_Menu_Show_OptionsVideo();
32 procedure g_Menu_Show_OptionsSound();
33 procedure g_Menu_Show_EndGameMenu();
34 procedure g_Menu_Show_QuitGameMenu();
38 gMenuSmallFont
: DWORD
;
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
, sdl2
,
49 MAPDEF
, Math
, g_saveload
,
50 e_texture
, g_language
,
51 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
, g_touch
,
55 type TYNCallback
= procedure (yes
:Boolean);
57 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
59 if win
.UserData
= nil then exit
;
61 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
62 IK_N
: TYNCallback(win
.UserData
)(false);
66 procedure YesButtonCB (ctl
: TGUITextButton
);
68 if ctl
.UserData
= nil then exit
;
69 TYNCallback(ctl
.UserData
)(true);
72 procedure NoButtonCB (ctl
: TGUITextButton
);
74 if ctl
.UserData
= nil then exit
;
75 TYNCallback(ctl
.UserData
)(false);
78 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
82 //if length(Text) = 0 then exit;
83 Result
:= TGUIWindow
.Create(WinName
);
86 //OnKeyDownEx := @YNKeyDownProc;
87 //UserData := @ActionProc;
88 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
91 Name
:= '__temp_yes_no_menu:'+WinName
;
93 AddText(Text, MaxLen
);
94 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
95 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
97 DefControl
:= '__temp_yes_no_menu:'+WinName
;
103 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
104 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
106 procedure ProcApplyOptions();
112 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
114 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
120 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
121 if (ovs
<> gVSync
) then g_SetVSync(gVSync
);
123 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
124 glLegacyNPOT
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
126 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
128 g_Sound_SetupAllVolumes(
129 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
130 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
133 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
134 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
135 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
136 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
137 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
139 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
141 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
142 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
143 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
144 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
146 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
151 else gGibsCount
:= 48;
154 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
155 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
156 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
157 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
158 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
159 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
160 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
161 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
162 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
163 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
= 0;
164 g_dbg_scale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
+ 1;
166 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
170 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
171 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
172 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
173 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
174 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
175 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
176 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
177 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
180 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
183 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
184 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
185 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
186 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
187 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
188 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
189 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
190 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
191 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
193 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
194 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
195 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
196 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
197 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
198 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
199 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext', '-p1_weapnext');
200 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev', '-p1_weapprev');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
204 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
205 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
206 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
207 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
208 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
209 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
210 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
211 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
212 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
213 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
214 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
215 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
216 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
217 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
218 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
219 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
220 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext', '-p1_weapnext');
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev', '-p1_weapprev');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
226 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
229 for i
:= WP_FIRST
to WP_LAST
do
231 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
232 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
233 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
234 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
238 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
241 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
242 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
243 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
244 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
245 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
246 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
247 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
248 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
249 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
250 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
251 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
252 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
253 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
254 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
255 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
256 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
257 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p2_weapnext', '-p2_weapnext');
258 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev', '-p2_weapprev');
259 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
260 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
262 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
263 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
264 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
265 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
266 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
267 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
268 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
269 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
270 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
271 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
272 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
273 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
274 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
275 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
276 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
277 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
278 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext', '-p2_weapnext');
279 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev', '-p2_weapprev');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
284 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
287 for i
:= WP_FIRST
to WP_LAST
do
289 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
290 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
291 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
292 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
296 if e_HasJoysticks
then
298 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
301 for i
:= 0 to e_MaxJoys
- 1 do
302 if e_JoystickAvailable
[i
] then
303 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
307 if g_touch_enabled
then
309 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
310 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
311 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
312 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
313 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
316 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
318 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
319 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
320 TEAM_RED
, TEAM_BLUE
);
322 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
324 gPlayer1Settings
.Model
:= Model
.Name
;
325 gPlayer1Settings
.Color
:= Model
.Color
;
328 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
330 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
331 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
332 TEAM_RED
, TEAM_BLUE
);
333 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
335 gPlayer2Settings
.Model
:= Model
.Name
;
336 gPlayer2Settings
.Color
:= Model
.Color
;
339 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
340 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
342 if g_Game_IsServer
then
344 if gPlayer1
<> nil then
346 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
347 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
348 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
349 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
351 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
354 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
357 if gPlayer2
<> nil then
359 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
360 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
361 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
362 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
364 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
369 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
371 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
372 g_Console_WriteConfig(GameDir
+ '/dfconfig.cfg');
375 procedure ReadOptions();
380 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
382 with TGUISwitch(menu
.GetControl('swBPP')) do
388 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
389 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
391 with TGUISwitch(menu
.GetControl('swVSync')) do
392 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
394 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
395 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
397 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
399 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
400 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
401 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
403 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
404 if gMuteWhenInactive
then
409 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
411 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
412 if gSoundEffectsDF
then
417 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
418 if gUseChatSounds
then
423 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
426 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
427 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
428 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
429 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
430 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
431 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
432 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
433 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
434 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
435 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
437 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
438 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
439 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
440 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
441 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
442 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
443 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
445 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
446 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
449 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
452 for i
:= WP_FIRST
to WP_LAST
do
454 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
455 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
459 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
462 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
463 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
464 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
465 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
466 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
467 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
468 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
469 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
470 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
471 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
473 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
474 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
476 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
477 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
478 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
481 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
482 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
485 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
488 for i
:= WP_FIRST
to WP_LAST
do
490 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
491 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
495 if e_HasJoysticks
then
497 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
500 for i
:= 0 to e_MaxJoys
- 1 do
501 if e_JoystickAvailable
[i
] then
502 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
506 if g_touch_enabled
then
508 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
509 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
510 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
511 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
512 with TGUISwitch(menu
.GetControl('swTouchFire')) do
513 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
514 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
517 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
520 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
521 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
522 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
523 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
526 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
528 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
529 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
530 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
531 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
532 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
534 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
537 with TGUISwitch(menu
.GetControl('swBloodType')) do
538 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
540 with TGUISwitch(menu
.GetControl('swCorpseType')) do
541 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
543 with TGUISwitch(menu
.GetControl('swGibsType')) do
544 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
546 with TGUISwitch(menu
.GetControl('swGibsCount')) do
555 with TGUISwitch(menu
.GetControl('swBackGround')) do
556 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
558 with TGUISwitch(menu
.GetControl('swMessages')) do
559 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
561 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
562 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
564 with TGUISwitch(menu
.GetControl('swChatBubble')) do
565 ItemIndex
:= gChatBubble
;
567 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
568 if gPlayerIndicator
then ItemIndex
:= 0 else ItemIndex
:= 1;
570 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= Round(g_dbg_scale
- 1);
572 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
574 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
575 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
577 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
578 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
580 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
581 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
582 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
584 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
586 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
587 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
589 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
590 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
592 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
593 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
594 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
596 ProcSelectModel(nil);
599 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
601 // don't turn off monsters in DM
603 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
604 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
605 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
607 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
610 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
611 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
612 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
613 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
617 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
619 // don't turn off monsters in DM
621 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
622 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
623 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
625 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
628 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
629 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
630 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
631 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
635 procedure ProcStartCustomGame();
641 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
643 Map
:= TGUILabel(GetControl('lbMap')).Text;
646 if not isWadPath(Map
) then
649 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
650 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
651 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
652 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
653 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
655 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
656 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
657 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
658 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
661 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
663 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
665 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
667 Options
:= Options
or GAME_OPTION_MONSTERS
;
668 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
670 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
672 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
673 gcBotsVS
:= 'Monsters';
676 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
677 gcBotsVS
:= 'Everybody';
680 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
681 gcBotsVS
:= 'Players';
688 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
690 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
691 gcMaxLives
, Options
, gcPlayers
);
695 procedure ProcStartNetGame();
701 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
703 Map
:= TGUILabel(GetControl('lbMap')).Text;
706 if not isWadPath(Map
) then
709 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
710 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
711 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
712 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
713 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
714 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
716 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
717 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
718 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
719 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
722 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
724 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
726 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
728 Options
:= Options
or GAME_OPTION_MONSTERS
;
729 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
731 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
733 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
734 gnBotsVS
:= 'Monsters';
737 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
738 gnBotsVS
:= 'Everybody';
741 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
742 gnBotsVS
:= 'Players';
747 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
748 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
749 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
750 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
751 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
754 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
755 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
757 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
758 Options
, gnPlayers
, 0, NetPort
);
761 procedure ProcConnectNetGame();
765 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
767 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
768 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
769 PW
:= TGUIEdit(GetControl('edPW')).Text;
772 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
773 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
776 procedure ProcEnterPassword();
780 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
782 NetClientIP
:= PromptIP
;
783 NetClientPort
:= PromptPort
;
784 PW
:= TGUIEdit(GetControl('edPW')).Text;
787 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
788 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
791 procedure ProcServerlist();
793 if not NetInitDone
then
795 if (not g_Net_Init()) then
797 g_Console_Add('NET: ERROR: Failed to init ENet!');
804 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
806 gState
:= STATE_SLIST
;
807 g_ActiveWindow
:= nil;
809 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
814 slReturnPressed
:= True;
815 if g_Net_Slist_Fetch(slCurrent
) then
817 if slCurrent
= nil then
818 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
821 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
822 g_Serverlist_GenerateTable(slCurrent
, slTable
);
825 procedure ProcStartCampaign();
831 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
833 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
834 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
841 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
844 procedure ProcSelectMap(Sender
: TGUIControl
);
848 wad
, map
, res
: String;
850 win
:= g_GUI_GetWindow('SelectMapMenu');
851 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
853 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
854 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
856 if (wad
= '') or (map
= '') then
857 begin // Ýòî íå êàðòà
858 TGUILabel(GetControl('lbMapName')).Text := '';
859 TGUILabel(GetControl('lbMapAuthor')).Text := '';
860 TGUILabel(GetControl('lbMapSize')).Text := '';
861 TGUIMemo(GetControl('meMapDescription')).SetText('');
862 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
863 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
869 a
:= g_Map_GetMapInfo(res
);
871 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
872 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
873 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
874 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
875 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
876 TGUILabel(win
.GetControl('lbMapScale')).Text :=
877 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
882 procedure ProcSelectWAD(Sender
: TGUIControl
);
887 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
889 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
891 with TGUIListBox(GetControl('lsMapRes')) do
897 list
:= g_Map_GetMapsList(wad
);
911 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
917 win
:= g_GUI_GetWindow('CampaignMenu');
918 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
920 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
924 TGUILabel(GetControl('lbWADName')).Text := '';
925 TGUILabel(GetControl('lbWADAuthor')).Text := '';
926 TGUIMemo(GetControl('meWADDescription')).SetText('');
929 a
:= g_Game_GetMegaWADInfo(wad
);
931 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
932 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
933 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
935 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
939 fn
:= g_ExtractWadName(a
.pic
);
941 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
943 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
948 procedure ProcChangeColor(Sender
: TGUIControl
);
952 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
953 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
954 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
955 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
956 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
957 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
959 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
960 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
961 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
962 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
963 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
964 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
967 procedure ProcSelectModel(Sender
: TGUIControl
);
972 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
973 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
974 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
976 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
977 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
978 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
980 ProcChangeColor(nil);
983 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
995 wad
:= TWADFile
.Create
;
996 if wad
.ReadFile(GameWAD
) then
997 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
1002 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
1004 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1005 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1006 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1007 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1009 if g_Texture_Get('FONT_STD', ID
) then
1010 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
1015 if cfglen
<> 0 then FreeMem(cfgdata
);
1018 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
1024 cfgdata
, fntdata
: Pointer;
1025 cfglen
, fntlen
: Integer;
1033 wad
:= TWADFile
.Create
;
1034 if wad
.ReadFile(GameWAD
) then
1036 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1037 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1043 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1044 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1045 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1047 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1048 FontID
:= e_CharFont_Create(spc
);
1050 for a
:= 0 to 255 do
1052 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1053 if chrwidth
= 0 then Continue
;
1055 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1057 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1063 if cfglen
<> 0 then FreeMem(cfgdata
);
1064 if fntlen
<> 0 then FreeMem(fntdata
);
1067 procedure MenuLoadData();
1069 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1071 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1072 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1073 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1074 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1075 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1076 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1077 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1078 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1079 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1080 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1081 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1082 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1083 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1084 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1085 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1086 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1087 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1088 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1089 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1090 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1091 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1092 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1093 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1094 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1096 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1097 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1098 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1099 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1100 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1101 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1102 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1105 procedure MenuFreeData();
1107 e_CharFont_Remove(gMenuFont
);
1108 e_CharFont_Remove(gMenuSmallFont
);
1110 g_Texture_Delete('MAINMENU_MARKER1');
1111 g_Texture_Delete('MAINMENU_MARKER2');
1112 g_Texture_Delete('SCROLL_LEFT');
1113 g_Texture_Delete('SCROLL_RIGHT');
1114 g_Texture_Delete('SCROLL_MIDDLE');
1115 g_Texture_Delete('SCROLL_MARKER');
1116 g_Texture_Delete('EDIT_LEFT');
1117 g_Texture_Delete('EDIT_RIGHT');
1118 g_Texture_Delete('EDIT_MIDDLE');
1119 g_Texture_Delete('BOX1');
1120 g_Texture_Delete('BOX2');
1121 g_Texture_Delete('BOX3');
1122 g_Texture_Delete('BOX4');
1123 g_Texture_Delete('BOX5');
1124 g_Texture_Delete('BOX6');
1125 g_Texture_Delete('BOX7');
1126 g_Texture_Delete('BOX8');
1127 g_Texture_Delete('BOX9');
1128 g_Texture_Delete('BSCROLL_UP_A');
1129 g_Texture_Delete('BSCROLL_UP_U');
1130 g_Texture_Delete('BSCROLL_DOWN_A');
1131 g_Texture_Delete('BSCROLL_DOWN_U');
1132 g_Texture_Delete('BSCROLL_MIDDLE');
1133 g_Texture_Delete('NOPIC');
1135 g_Sound_Delete('MENU_SELECT');
1136 g_Sound_Delete('MENU_OPEN');
1137 g_Sound_Delete('MENU_CLOSE');
1138 g_Sound_Delete('MENU_CHANGE');
1139 g_Sound_Delete('SCROLL_ADD');
1140 g_Sound_Delete('SCROLL_SUB');
1141 g_Sound_Delete('SOUND_PLAYER_FALL');
1144 procedure ProcAuthorsMenu();
1146 gMusic
.SetByName('MUSIC_INTERMUS');
1150 procedure ProcExitMenuKeyDown (yes
: Boolean);
1153 snd
: TPlayableSound
;
1158 g_Game_StopAllSounds(True);
1159 case (Random(18)) of
1160 0: s
:= 'SOUND_MONSTER_PAIN';
1161 1: s
:= 'SOUND_MONSTER_DIE_3';
1162 2: s
:= 'SOUND_MONSTER_SLOP';
1163 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1164 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1165 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1166 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1167 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1168 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1169 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1170 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1171 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1172 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1173 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1174 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1175 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1176 else s
:= 'SOUND_PLAYER_FALL';
1178 snd
:= TPlayableSound
.Create();
1179 res
:= snd
.SetByName(s
);
1180 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1184 while snd
.IsPlaying() do begin end;
1192 procedure ProcLoadMenu();
1199 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1200 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1201 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1205 procedure ProcSaveMenu();
1213 name
:= g_GetSaveName(a
, valid
);
1214 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1215 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1219 procedure ProcSaveGame(Sender
: TGUIControl
);
1223 if g_Game_IsNet
then Exit
;
1224 if g_Game_IsTestMap
then Exit
;
1225 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1226 g_Game_PauseAllSounds(True);
1227 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1229 g_ActiveWindow
:= nil;
1230 g_Game_Pause(False);
1233 procedure ProcLoadGame(Sender
: TGUIControl
);
1237 if g_Game_IsNet
then Exit
;
1238 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1239 if g_LoadGame(a
) then
1241 g_Game_PauseAllSounds(False)
1243 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1245 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1246 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1247 //g_ActiveWindow := nil;
1251 procedure ProcSingle1Player();
1253 g_Game_StartSingle(gDefaultMegawadStart
, False, 1);
1256 procedure ProcSingle2Players();
1258 g_Game_StartSingle(gDefaultMegawadStart
, True, 2);
1261 procedure ProcSelectMapMenu();
1264 wad_lb
: TGUIFileListBox
;
1265 map_lb
: TGUIListBox
;
1268 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1269 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1270 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1272 if wad_lb
.SelectedItem() <> '' then
1273 map
:= map_lb
.SelectedItem()
1277 wad_lb
.UpdateFileList();
1280 if wad_lb
.SelectedItem() <> '' then
1283 map_lb
.SelectItem(map
);
1285 if map_lb
.SelectedItem() <> '' then
1289 g_GUI_ShowWindow('SelectMapMenu');
1292 procedure ProcSelectCampaignMenu();
1295 wad_lb
: TGUIFileListBox
;
1297 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1298 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1300 wad_lb
.UpdateFileList();
1302 if wad_lb
.SelectedItem() <> '' then
1303 ProcSelectCampaignWAD(nil);
1306 procedure ProcSetMap();
1308 wad
, map
, res
: String;
1310 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1312 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1313 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1316 if (wad
= '') or (map
= '') then
1319 res
:= wad
+':\'+map
;
1321 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1322 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1325 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1329 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1331 g_Sound_SetupAllVolumes(
1332 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1333 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1337 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1341 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1342 g_dbg_scale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
+ 1;
1345 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1349 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1350 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1351 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1352 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1355 procedure ProcOptionsPlayersMIMenu();
1360 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1362 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1364 if a
= '' then Exit
;
1366 b
:= g_PlayerModel_GetInfo(a
);
1368 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1370 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1371 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1372 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1374 if b
.HaveWeapon
then
1375 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1377 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1380 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1383 procedure ProcOptionsPlayersAnim();
1387 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1392 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1395 Model
.GetCurrentAnimation
.Loop
:= True;
1396 Model
.GetCurrentAnimationMask
.Loop
:= True;
1400 procedure ProcOptionsPlayersWeap();
1404 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1409 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1413 procedure ProcOptionsPlayersRot();
1417 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1418 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1420 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1424 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1428 g_Options_SetDefault();
1434 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1436 if yes
then ReadOptions();
1440 procedure ProcAuthorsClose();
1442 gMusic
.SetByName('MUSIC_MENU');
1444 gState
:= STATE_MENU
;
1447 procedure ProcGMClose();
1449 g_Game_InGameMenu(False);
1452 procedure ProcGMShow();
1457 if (gGameSettings
.GameType
= GT_SINGLE
) and
1458 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1459 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1460 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1462 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1463 if g_Game_IsTestMap
then
1464 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1465 TGUIMainMenu(g_ActiveWindow
.GetControl(
1466 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1469 procedure ProcChangePlayers();
1471 TeamGame
, Spectator
, AddTwo
: Boolean;
1472 P1Team
{, P2Team}: Byte;
1473 bP2
: TGUITextButton
;
1475 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1476 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1477 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1478 P1Team
:= TEAM_NONE
;
1479 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1481 //P2Team := TEAM_NONE;
1482 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1484 TGUIMainMenu(g_ActiveWindow
.GetControl(
1485 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1486 TGUIMainMenu(g_ActiveWindow
.GetControl(
1487 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1488 TGUIMainMenu(g_ActiveWindow
.GetControl(
1489 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1491 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1492 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1493 bP2
.Enabled
:= AddTwo
and not Spectator
;
1495 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1497 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1498 if gPlayer2
= nil then
1499 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1501 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1503 TGUIMainMenu(g_ActiveWindow
.GetControl(
1504 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1507 procedure ProcJoinRed();
1509 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1511 if g_Game_IsServer
then
1513 if gPlayer1
= nil then
1514 g_Game_AddPlayer(TEAM_RED
)
1517 if gPlayer1
.Team
<> TEAM_RED
then
1519 gPlayer1
.SwitchTeam
;
1520 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1523 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1528 gPlayer1Settings
.Team
:= TEAM_RED
;
1529 MC_SEND_PlayerSettings
;
1530 if gPlayer1
= nil then
1531 g_Game_AddPlayer(TEAM_RED
);
1533 g_ActiveWindow
:= nil;
1534 g_Game_Pause(False);
1537 procedure ProcJoinBlue();
1539 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1541 if g_Game_IsServer
then
1543 if gPlayer1
= nil then
1544 g_Game_AddPlayer(TEAM_BLUE
)
1547 if gPlayer1
.Team
<> TEAM_BLUE
then
1549 gPlayer1
.SwitchTeam
;
1550 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1553 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1558 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1559 MC_SEND_PlayerSettings
;
1560 if gPlayer1
= nil then
1561 g_Game_AddPlayer(TEAM_BLUE
);
1563 g_ActiveWindow
:= nil;
1564 g_Game_Pause(False);
1567 procedure ProcJoinGame();
1569 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1571 if gPlayer1
= nil then
1573 g_ActiveWindow
:= nil;
1574 g_Game_Pause(False);
1577 procedure ProcSwitchP2();
1579 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1581 if gPlayer1
= nil then
1583 if gPlayer2
= nil then
1586 g_Game_RemovePlayer();
1587 g_ActiveWindow
:= nil;
1588 g_Game_Pause(False);
1591 procedure ProcSpectate();
1593 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1596 g_ActiveWindow
:= nil;
1597 g_Game_Pause(False);
1600 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1602 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1605 procedure ProcEndMenuKeyDown (yes
: Boolean);
1607 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1610 procedure ProcSetRussianLanguage();
1612 if gLanguage
<> LANGUAGE_RUSSIAN
then
1614 gLanguage
:= LANGUAGE_RUSSIAN
;
1615 gLanguageChange
:= True;
1616 gAskLanguage
:= False;
1618 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1620 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1625 procedure ProcSetEnglishLanguage();
1627 if gLanguage
<> LANGUAGE_ENGLISH
then
1629 gLanguage
:= LANGUAGE_ENGLISH
;
1630 gLanguageChange
:= True;
1631 gAskLanguage
:= False;
1633 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1635 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1640 procedure ReadGameSettings();
1644 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1646 with gGameSettings
do
1648 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1649 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1654 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1655 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1656 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1658 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1659 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1660 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1663 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1668 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1670 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1671 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1672 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1673 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1674 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1675 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1676 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1677 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1681 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1682 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1687 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1688 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1693 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1694 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1699 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1700 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1705 procedure ProcApplyGameSet();
1709 stat
: TPlayerStatArray
;
1711 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1713 if not g_Game_IsServer
then Exit
;
1715 with gGameSettings
do
1717 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1719 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1720 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1722 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1725 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1727 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1733 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1735 TimeLimit
:= Max(n
, b
);
1739 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1741 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1748 if GameMode
= GM_DM
then
1750 stat
:= g_Player_GetStats();
1752 for a
:= 0 to High(stat
) do
1753 if stat
[a
].Frags
> b
then
1757 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1759 GoalLimit
:= Max(n
, b
);
1763 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1765 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1766 if n
< 0 then n
:= 0;
1767 if n
> 255 then n
:= 255;
1773 stat
:= g_Player_GetStats();
1775 for a
:= 0 to High(stat
) do
1776 if stat
[a
].Lives
> b
then
1779 MaxLives
:= Max(n
, b
);
1783 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1785 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1788 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1789 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1793 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1794 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1798 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1799 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1805 if g_Game_IsNet
then MH_SEND_GameSettings
;
1808 procedure ProcVideoOptionsRes();
1814 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1816 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1817 IntToStr(gScreenWidth
) +
1818 ' x ' + IntToStr(gScreenHeight
) +
1819 ', ' + IntToStr(gBPP
) + ' bpp';
1821 with TGUIListBox(menu
.GetControl('lsResolution')) do
1823 list
:= GetDisplayModes(gBPP
, SR
);
1834 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1841 procedure ProcApplyVideoOptions();
1844 Fullscreen
: Boolean;
1845 SWidth
, SHeight
: Integer;
1848 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1850 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1851 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1853 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1855 if (SWidth
<> gScreenWidth
) or
1856 (SHeight
<> gScreenHeight
) or
1857 (Fullscreen
<> gFullscreen
) then
1859 gResolutionChange
:= True;
1860 gRC_Width
:= SWidth
;
1861 gRC_Height
:= SHeight
;
1862 gRC_FullScreen
:= Fullscreen
;
1863 gRC_Maximized
:= gWinMaximized
;
1866 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1870 procedure ProcSetFirstRussianLanguage();
1872 gLanguage
:= LANGUAGE_RUSSIAN
;
1873 gLanguageChange
:= True;
1874 gAskLanguage
:= False;
1876 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1879 procedure ProcSetFirstEnglishLanguage();
1881 gLanguage
:= LANGUAGE_ENGLISH
;
1882 gLanguageChange
:= True;
1883 gAskLanguage
:= False;
1885 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1888 procedure ProcRecallAddress();
1890 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1892 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1893 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1897 procedure CreateFirstLanguageMenu();
1901 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1903 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1905 Name
:= 'mmFirstLanguageMenu';
1906 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1907 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1910 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1911 Menu
.MainWindow
:= True;
1912 g_GUI_AddWindow(Menu
);
1915 procedure g_Menu_AskLanguage();
1917 CreateFirstLanguageMenu();
1918 g_GUI_ShowWindow('FirstLanguageMenu');
1921 procedure CreatePlayerOptionsMenu(s
: String);
1926 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1928 a
:= _lc
[I_MENU_PLAYER_1
]
1930 a
:= _lc
[I_MENU_PLAYER_2
];
1931 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1933 Name
:= 'mOptionsPlayers'+s
+'Menu';
1934 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1936 Name
:= 'ed'+s
+'Name';
1940 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1942 Name
:= 'sw'+s
+'Team';
1943 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1944 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1946 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1948 Name
:= 'ls'+s
+'Model';
1950 Items
:= g_PlayerModel_GetNames();
1951 OnChange
:= ProcSelectModel
;
1953 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1955 Name
:= 'sc'+s
+'Red';
1957 OnChange
:= ProcChangeColor
;
1959 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1961 Name
:= 'sc'+s
+'Green';
1963 OnChange
:= ProcChangeColor
;
1965 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1967 Name
:= 'sc'+s
+'Blue';
1969 OnChange
:= ProcChangeColor
;
1972 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1973 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1974 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1975 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1977 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1979 Name
:= 'mv'+s
+'Model';
1980 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1981 Y
:= GetControl('ls'+s
+'Model').Y
;
1984 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1985 g_GUI_AddWindow(Menu
);
1988 procedure CreateAllMenus();
1992 a
, cx
, _y
, i
: Integer;
1995 Menu
:= TGUIWindow
.Create('MainMenu');
1996 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1998 Name
:= 'mmMainMenu';
1999 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2000 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2001 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2002 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2003 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2004 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2006 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2008 Color
:= _RGB(255, 255, 255);
2009 X
:= gScreenWidth
-GetWidth
-8;
2010 Y
:= gScreenHeight
-GetHeight
-8;
2012 Menu
.DefControl
:= 'mmMainMenu';
2013 Menu
.MainWindow
:= True;
2014 g_GUI_AddWindow(Menu
);
2016 Menu
:= TGUIWindow
.Create('NewGameMenu');
2017 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
2019 Name
:= 'mmNewGameMenu';
2020 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2021 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2022 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2023 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2025 Menu
.DefControl
:= 'mmNewGameMenu';
2026 g_GUI_AddWindow(Menu
);
2028 Menu
:= TGUIWindow
.Create('NetGameMenu');
2029 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
2031 Name
:= 'mmNetGameMenu';
2032 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2033 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2035 Menu
.DefControl
:= 'mmNetGameMenu';
2036 g_GUI_AddWindow(Menu
);
2038 Menu
:= TGUIWindow
.Create('NetServerMenu');
2039 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2041 Name
:= 'mNetServerMenu';
2042 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2044 Name
:= 'edSrvName';
2045 OnlyDigits
:= False;
2048 Text := NetServerName
;
2050 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2052 Name
:= 'edSrvPassword';
2053 OnlyDigits
:= False;
2056 Text := NetPassword
;
2058 with AddEdit(_lc
[I_NET_PORT
]) do
2064 Text := IntToStr(NetPort
);
2066 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2068 Name
:= 'edMaxPlayers';
2072 Text := IntToStr(NetMaxClients
);
2074 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2076 Name
:= 'swUseMaster';
2077 AddItem(_lc
[I_MENU_YES
]);
2078 AddItem(_lc
[I_MENU_NO
]);
2079 if NetUseMaster
then
2085 with AddLabel(_lc
[I_MENU_MAP
]) do
2090 OnClick
:= @ProcSelectMapMenu
;
2092 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2094 Name
:= 'swGameMode';
2095 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2096 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2097 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2098 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2099 case g_Game_TextToMode(gnGameMode
) of
2101 GM_DM
: ItemIndex
:= 0;
2102 GM_TDM
: ItemIndex
:= 1;
2103 GM_CTF
: ItemIndex
:= 2;
2105 GM_COOP
: ItemIndex
:= 3;
2107 OnChange
:= ProcSwitchMonstersNet
;
2109 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2111 Name
:= 'edTimeLimit';
2115 if gnTimeLimit
> 0 then
2116 Text := IntToStr(gnTimeLimit
);
2118 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2120 Name
:= 'edGoalLimit';
2124 if gnGoalLimit
> 0 then
2125 Text := IntToStr(gnGoalLimit
);
2127 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2129 Name
:= 'edMaxLives';
2133 if gnMaxLives
> 0 then
2134 Text := IntToStr(gnMaxLives
);
2136 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2138 Name
:= 'swPlayers';
2139 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2140 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2141 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2142 ItemIndex
:= gnPlayers
;
2144 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2146 Name
:= 'swTeamDamage';
2147 AddItem(_lc
[I_MENU_YES
]);
2148 AddItem(_lc
[I_MENU_NO
]);
2149 if gnTeamDamage
then
2154 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2156 Name
:= 'swEnableExits';
2157 AddItem(_lc
[I_MENU_YES
]);
2158 AddItem(_lc
[I_MENU_NO
]);
2164 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2166 Name
:= 'swWeaponStay';
2167 AddItem(_lc
[I_MENU_YES
]);
2168 AddItem(_lc
[I_MENU_NO
]);
2169 if gnWeaponStay
then
2174 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2176 Name
:= 'swMonsters';
2177 AddItem(_lc
[I_MENU_YES
]);
2178 AddItem(_lc
[I_MENU_NO
]);
2184 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2187 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2188 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2189 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2191 if gnBotsVS
= 'Players' then
2193 if gnBotsVS
= 'Monsters' then
2197 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2201 Menu
.DefControl
:= 'mNetServerMenu';
2202 g_GUI_AddWindow(Menu
);
2204 Menu
:= TGUIWindow
.Create('NetClientMenu');
2205 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2207 Name
:= 'mNetClientMenu';
2209 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2212 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2218 Text := 'localhost';
2220 with AddEdit(_lc
[I_NET_PORT
]) do
2228 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2231 OnlyDigits
:= False;
2238 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2242 Menu
.DefControl
:= 'mNetClientMenu';
2243 g_GUI_AddWindow(Menu
);
2245 Menu
:= TGUIWindow
.Create('LoadMenu');
2246 Menu
.OnShow
:= ProcLoadMenu
;
2247 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2249 Name
:= 'mmLoadMenu';
2254 Name
:= 'edSlot'+IntToStr(a
);
2257 OnEnter
:= ProcLoadGame
;
2260 Menu
.DefControl
:= 'mmLoadMenu';
2261 g_GUI_AddWindow(Menu
);
2263 Menu
:= TGUIWindow
.Create('SaveMenu');
2264 Menu
.OnShow
:= ProcSaveMenu
;
2265 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2267 Name
:= 'mmSaveMenu';
2272 Name
:= 'edSlot'+IntToStr(a
);
2275 OnChange
:= ProcSaveGame
;
2278 Menu
.DefControl
:= 'mmSaveMenu';
2279 g_GUI_AddWindow(Menu
);
2281 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2282 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2284 Name
:= 'mCustomGameMenu';
2285 with AddLabel(_lc
[I_MENU_MAP
]) do
2290 OnClick
:= @ProcSelectMapMenu
;
2292 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2294 Name
:= 'swGameMode';
2295 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2296 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2297 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2298 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2299 case g_Game_TextToMode(gcGameMode
) of
2301 GM_DM
: ItemIndex
:= 0;
2302 GM_TDM
: ItemIndex
:= 1;
2303 GM_CTF
: ItemIndex
:= 2;
2305 GM_COOP
: ItemIndex
:= 3;
2307 OnChange
:= ProcSwitchMonstersCustom
;
2309 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2311 Name
:= 'edTimeLimit';
2315 if gcTimeLimit
> 0 then
2316 Text := IntToStr(gcTimeLimit
);
2318 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2320 Name
:= 'edGoalLimit';
2324 if gcGoalLimit
> 0 then
2325 Text := IntToStr(gcGoalLimit
);
2327 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2329 Name
:= 'edMaxLives';
2333 if gcMaxLives
> 0 then
2334 Text := IntToStr(gcMaxLives
);
2336 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2338 Name
:= 'swPlayers';
2339 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2340 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2341 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2342 ItemIndex
:= gcPlayers
;
2344 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2346 Name
:= 'swTeamDamage';
2347 AddItem(_lc
[I_MENU_YES
]);
2348 AddItem(_lc
[I_MENU_NO
]);
2349 if gcTeamDamage
then
2354 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2356 Name
:= 'swEnableExits';
2357 AddItem(_lc
[I_MENU_YES
]);
2358 AddItem(_lc
[I_MENU_NO
]);
2364 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2366 Name
:= 'swWeaponStay';
2367 AddItem(_lc
[I_MENU_YES
]);
2368 AddItem(_lc
[I_MENU_NO
]);
2369 if gcWeaponStay
then
2374 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2376 Name
:= 'swMonsters';
2377 AddItem(_lc
[I_MENU_YES
]);
2378 AddItem(_lc
[I_MENU_NO
]);
2384 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2387 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2388 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2389 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2391 if gcBotsVS
= 'Players' then
2393 if gcBotsVS
= 'Monsters' then
2397 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2401 Menu
.DefControl
:= 'mCustomGameMenu';
2402 g_GUI_AddWindow(Menu
);
2404 Menu
:= TGUIWindow
.Create('CampaignMenu');
2405 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2407 Name
:= 'mCampaignMenu';
2416 with AddFileList('', 15, 4) do
2419 OnChange
:= ProcSelectCampaignWAD
;
2423 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2424 SetBase(MapsDir
+'megawads/');
2427 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2429 Name
:= 'lbWADName';
2433 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2435 Name
:= 'lbWADAuthor';
2439 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2440 with AddMemo('', 15, 3) do
2442 Name
:= 'meWADDescription';
2443 Color
:= MENU_ITEMSCTRL_COLOR
;
2445 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2447 Name
:= 'swPlayers';
2448 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2449 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2452 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2456 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2458 Name
:= 'mpWADImage';
2459 DefaultRes
:= 'NOPIC';
2460 X
:= GetControl('lsWAD').X
+4;
2461 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2464 Menu
.DefControl
:= 'mCampaignMenu';
2465 g_GUI_AddWindow(Menu
);
2467 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2468 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2470 Name
:= 'mSelectMapMenu';
2471 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2474 OnChange
:= ProcSelectWAD
;
2478 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2481 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2485 OnChange
:= ProcSelectMap
;
2488 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2490 Name
:= 'lbMapName';
2494 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2496 Name
:= 'lbMapAuthor';
2500 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2502 Name
:= 'lbMapSize';
2506 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2508 Name
:= 'meMapDescription';
2513 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2515 Name
:= 'mpMapPreview';
2516 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2517 Y
:= GetControl('lsMapWAD').Y
;
2519 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2521 Name
:= 'lbMapScale';
2524 Color
:= MENU_ITEMSCTRL_COLOR
;
2525 X
:= GetControl('lsMapWAD').X
+
2526 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2527 2 + MAPPREVIEW_WIDTH
*4;
2528 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2531 Menu
.OnClose
:= ProcSetMap
;
2532 Menu
.DefControl
:= 'mSelectMapMenu';
2533 g_GUI_AddWindow(Menu
);
2535 Menu
:= TGUIWindow
.Create('OptionsMenu');
2536 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2538 Name
:= 'mmOptionsMenu';
2539 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2540 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2541 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2542 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2543 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2544 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2546 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2547 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2549 Menu
.OnClose
:= ProcApplyOptions
;
2550 Menu
.DefControl
:= 'mmOptionsMenu';
2551 g_GUI_AddWindow(Menu
);
2553 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2554 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2555 g_GUI_AddWindow(Menu
);
2557 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2558 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2560 Name
:= 'mOptionsVideoMenu';
2561 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2562 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2568 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2571 AddItem(_lc
[I_MENU_YES
]);
2572 AddItem(_lc
[I_MENU_NO
]);
2574 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2576 Name
:= 'swTextureFilter';
2577 AddItem(_lc
[I_MENU_YES
]);
2578 AddItem(_lc
[I_MENU_NO
]);
2580 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2582 Name
:= 'swLegacyNPOT';
2583 AddItem(_lc
[I_MENU_NO
]);
2584 AddItem(_lc
[I_MENU_YES
]);
2587 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2590 Menu
.DefControl
:= 'mOptionsVideoMenu';
2591 g_GUI_AddWindow(Menu
);
2593 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2594 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2596 Name
:= 'mOptionsVideoResMenu';
2597 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2599 Name
:= 'lbCurrentRes';
2603 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2605 Name
:= 'lsResolution';
2608 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2610 Name
:= 'swFullScreen';
2611 AddItem(_lc
[I_MENU_YES
]);
2612 AddItem(_lc
[I_MENU_NO
]);
2615 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2618 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2619 g_GUI_AddWindow(Menu
);
2621 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2622 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2624 Name
:= 'mOptionsSoundMenu';
2625 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2627 Name
:= 'scMusicLevel';
2629 OnChange
:= ProcChangeSoundSettings
;
2631 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2633 Name
:= 'scSoundLevel';
2635 OnChange
:= ProcChangeSoundSettings
;
2637 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2639 Name
:= 'scMaxSimSounds';
2642 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2644 Name
:= 'swAnnouncer';
2645 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2646 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2647 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2648 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2650 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2651 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2653 Name
:= 'swSoundEffects';
2654 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2655 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2657 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2658 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2660 Name
:= 'swChatSpeech';
2661 AddItem(_lc
[I_MENU_YES
]);
2662 AddItem(_lc
[I_MENU_NO
]);
2664 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2666 Name
:= 'swInactiveSounds';
2667 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2668 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2672 Menu
.DefControl
:= 'mOptionsSoundMenu';
2673 g_GUI_AddWindow(Menu
);
2675 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2676 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2678 Name
:= 'mOptionsGameMenu';
2679 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2681 Name
:= 'scParticlesCount';
2684 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2686 Name
:= 'swBloodCount';
2687 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2688 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2689 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2690 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2691 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2693 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2695 Name
:= 'scShellsMax';
2698 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2700 Name
:= 'scGibsMax';
2703 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2705 Name
:= 'scCorpsesMax';
2708 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2710 Name
:= 'swGibsCount';
2711 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2712 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2713 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2714 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2715 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2717 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2719 Name
:= 'swCorpseType';
2720 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2721 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2723 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2725 Name
:= 'swGibsType';
2726 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2727 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2729 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2731 Name
:= 'swBloodType';
2732 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2733 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2735 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2737 Name
:= 'swScreenFlash';
2738 AddItem(_lc
[I_MENU_NO
]);
2739 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2740 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2742 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2744 Name
:= 'swBackground';
2745 AddItem(_lc
[I_MENU_YES
]);
2746 AddItem(_lc
[I_MENU_NO
]);
2748 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2750 Name
:= 'swMessages';
2751 AddItem(_lc
[I_MENU_YES
]);
2752 AddItem(_lc
[I_MENU_NO
]);
2754 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2756 Name
:= 'swRevertPlayers';
2757 AddItem(_lc
[I_MENU_YES
]);
2758 AddItem(_lc
[I_MENU_NO
]);
2760 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2762 Name
:= 'swChatBubble';
2763 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2764 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2765 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2766 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2767 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2769 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2771 Name
:= 'swPlayerIndicator';
2772 AddItem(_lc
[I_MENU_YES
]);
2773 AddItem(_lc
[I_MENU_NO
]);
2775 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2777 Name
:= 'scScaleFactor';
2779 OnChange
:= ProcChangeGameSettings
;
2783 Menu
.DefControl
:= 'mOptionsGameMenu';
2784 g_GUI_AddWindow(Menu
);
2786 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2787 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2789 Name
:= 'mOptionsControlsMenu';
2790 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2791 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2792 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2793 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2794 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2796 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2797 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2798 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2799 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2800 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2801 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2802 if e_HasJoysticks
then
2805 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2807 if g_touch_enabled
then
2810 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2813 Menu
.DefControl
:= 'mOptionsControlsMenu';
2814 g_GUI_AddWindow(Menu
);
2816 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2817 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2819 Name
:= 'mOptionsControlsP1Menu';
2820 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2821 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2822 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2823 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2824 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2825 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2826 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2827 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2828 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2829 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2831 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2832 g_GUI_AddWindow(Menu
);
2834 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2835 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2837 Name
:= 'mOptionsControlsP1MenuWeapons';
2838 for i
:= WP_FIRST
to WP_LAST
do
2839 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2840 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2842 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2843 g_GUI_AddWindow(Menu
);
2845 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2846 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2848 Name
:= 'mOptionsControlsP2Menu';
2849 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2850 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2851 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2852 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2853 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2854 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2855 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2856 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2857 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2858 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2860 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2861 g_GUI_AddWindow(Menu
);
2863 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2864 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2866 Name
:= 'mOptionsControlsP2MenuWeapons';
2867 for i
:= WP_FIRST
to WP_LAST
do
2868 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2869 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2871 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2872 g_GUI_AddWindow(Menu
);
2874 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2875 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2877 Name
:= 'mOptionsControlsJoystickMenu';
2878 for i
:= 0 to e_MaxJoys
- 1 do
2879 if e_JoystickAvailable
[i
] then
2880 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2882 Name
:= 'scDeadzone' + IntToStr(i
);
2886 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2887 g_GUI_AddWindow(Menu
);
2889 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2890 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2892 Name
:= 'mOptionsControlsTouchMenu';
2893 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
2895 Name
:= 'swTouchAlt';
2896 AddItem(_lc
[I_MENU_NO
]);
2897 AddItem(_lc
[I_MENU_YES
]);
2898 OnChange
:= ProcChangeTouchSettings
;
2900 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2902 Name
:= 'scTouchSize';
2904 OnChange
:= ProcChangeTouchSettings
;
2906 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2908 Name
:= 'swTouchFire';
2909 AddItem(_lc
[I_MENU_NO
]);
2910 AddItem(_lc
[I_MENU_YES
]);
2912 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
2914 Name
:= 'scTouchOffset';
2916 OnChange
:= ProcChangeTouchSettings
;
2919 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
2920 g_GUI_AddWindow(Menu
);
2922 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2923 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2925 Name
:= 'mOptionsPlayersMenu';
2926 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2927 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2929 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2930 g_GUI_AddWindow(Menu
);
2932 CreatePlayerOptionsMenu('P1');
2933 CreatePlayerOptionsMenu('P2');
2935 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2936 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2938 Name
:= 'mOptionsPlayersMIMenu';
2939 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2944 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2949 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2951 Name
:= 'meComment';
2954 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2955 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2958 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2962 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2963 g_GUI_AddWindow(Menu
);
2965 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2966 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2968 Name
:= 'mOptionsLanguageMenu';
2969 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2970 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2973 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2974 g_GUI_AddWindow(Menu
);
2976 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2977 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2978 g_GUI_AddWindow(Menu
);
2980 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2981 Menu
.BackTexture
:= 'INTER';
2982 Menu
.OnClose
:= ProcAuthorsClose
;
2986 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2988 Color
:= _RGB(255, 0, 0);
2989 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2991 _y
:= _y
+GetHeight();
2993 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2995 Color
:= _RGB(255, 0, 0);
2996 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2998 _y
:= _y
+GetHeight()+32;
3000 // ×òî äåëàë: Êòî äåëàë
3001 cx
:= gScreenWidth
div 2 - 320 + 64;
3002 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3004 Color
:= _RGB(255, 0, 0);
3009 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3011 Color
:= _RGB(255, 255, 255);
3016 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3018 Color
:= _RGB(255, 0, 0);
3023 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3025 Color
:= _RGB(255, 255, 255);
3030 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3032 Color
:= _RGB(255, 255, 255);
3037 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3039 Color
:= _RGB(255, 0, 0);
3044 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3046 Color
:= _RGB(255, 255, 255);
3051 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3053 Color
:= _RGB(255, 0, 0);
3058 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3060 Color
:= _RGB(255, 255, 255);
3063 _y
:= gScreenHeight
- 128;
3066 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3068 Color
:= _RGB(255, 0, 0);
3073 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3075 Color
:= _RGB(255, 255, 255);
3078 _y
:= _y
+GetHeight();
3080 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3082 Color
:= _RGB(255, 255, 255);
3085 _y
:= _y
+GetHeight();
3087 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3089 Color
:= _RGB(255, 255, 255);
3092 _y
:= gScreenHeight
- 32;
3094 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3096 Color
:= _RGB(255, 0, 0);
3097 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3100 g_GUI_AddWindow(Menu
);
3102 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3103 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3104 g_GUI_AddWindow(Menu
);
3106 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3107 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3109 Name
:= 'mmGameSingleMenu';
3110 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3111 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3112 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3113 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3114 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3115 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3117 Menu
.DefControl
:= 'mmGameSingleMenu';
3118 Menu
.MainWindow
:= True;
3119 Menu
.OnClose
:= ProcGMClose
;
3120 Menu
.OnShow
:= ProcGMShow
;
3121 g_GUI_AddWindow(Menu
);
3123 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3124 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3125 g_GUI_AddWindow(Menu
);
3127 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3128 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3129 g_GUI_AddWindow(Menu
);
3131 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3132 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3134 Name
:= 'mmGameCustomMenu';
3135 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3136 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3137 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3138 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3139 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3140 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3141 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3143 Menu
.DefControl
:= 'mmGameCustomMenu';
3144 Menu
.MainWindow
:= True;
3145 Menu
.OnClose
:= ProcGMClose
;
3146 Menu
.OnShow
:= ProcGMShow
;
3147 g_GUI_AddWindow(Menu
);
3149 Menu
:= TGUIWindow
.Create('GameServerMenu');
3150 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3152 Name
:= 'mmGameServerMenu';
3153 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
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
:= 'mmGameServerMenu';
3160 Menu
.MainWindow
:= True;
3161 Menu
.OnClose
:= ProcGMClose
;
3162 Menu
.OnShow
:= ProcGMShow
;
3163 g_GUI_AddWindow(Menu
);
3165 Menu
:= TGUIWindow
.Create('GameClientMenu');
3166 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
3168 Name
:= 'mmGameClientMenu';
3169 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3170 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3171 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3173 Menu
.DefControl
:= 'mmGameClientMenu';
3174 Menu
.MainWindow
:= True;
3175 Menu
.OnClose
:= ProcGMClose
;
3176 Menu
.OnShow
:= ProcGMShow
;
3177 g_GUI_AddWindow(Menu
);
3179 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3180 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3182 Name
:= 'mClientPasswordMenu';
3183 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3191 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3194 Menu
.DefControl
:= 'mClientPasswordMenu';
3195 g_GUI_AddWindow(Menu
);
3197 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3198 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3200 Name
:= 'mGameSetGameMenu';
3201 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3203 Name
:= 'swTeamDamage';
3204 AddItem(_lc
[I_MENU_YES
]);
3205 AddItem(_lc
[I_MENU_NO
]);
3208 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3210 Name
:= 'edTimeLimit';
3215 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3217 Name
:= 'edGoalLimit';
3222 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3224 Name
:= 'edMaxLives';
3229 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3232 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3233 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3234 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3240 Menu
.DefControl
:= 'mGameSetGameMenu';
3241 Menu
.OnClose
:= ProcApplyGameSet
;
3242 g_GUI_AddWindow(Menu
);
3244 Menu
:= TGUIWindow
.Create('TeamMenu');
3245 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3247 Name
:= 'mmTeamMenu';
3248 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3249 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3250 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3251 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3252 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3254 Menu
.DefControl
:= 'mmTeamMenu';
3255 Menu
.OnShow
:= ProcChangePlayers
;
3256 g_GUI_AddWindow(Menu
);
3259 procedure g_Menu_Show_SaveMenu();
3261 if g_Game_IsTestMap
then
3263 if gGameSettings
.GameType
= GT_SINGLE
then
3264 g_GUI_ShowWindow('GameSingleMenu')
3267 if g_Game_IsClient
then
3270 if g_Game_IsNet
then
3273 g_GUI_ShowWindow('GameCustomMenu');
3275 g_GUI_ShowWindow('SaveMenu');
3276 g_Sound_PlayEx('MENU_OPEN');
3279 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3281 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3282 if gGameSettings
.GameType
= GT_SINGLE
then
3284 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3288 if g_Game_IsClient
then exit
;
3289 if g_Game_IsNet
then exit
;
3290 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3292 g_GUI_ShowWindow('LoadMenu');
3293 g_Sound_PlayEx('MENU_OPEN');
3296 procedure g_Menu_Show_GameSetGame();
3298 if gGameSettings
.GameType
= GT_SINGLE
then
3299 g_GUI_ShowWindow('GameSingleMenu')
3302 if g_Game_IsClient
then
3305 if g_Game_IsNet
then
3306 g_GUI_ShowWindow('GameServerMenu')
3308 g_GUI_ShowWindow('GameCustomMenu');
3311 g_GUI_ShowWindow('GameSetGameMenu');
3312 g_Sound_PlayEx('MENU_OPEN');
3315 procedure g_Menu_Show_OptionsVideo();
3317 if gGameSettings
.GameType
= GT_SINGLE
then
3318 g_GUI_ShowWindow('GameSingleMenu')
3321 if g_Game_IsClient
then
3322 g_GUI_ShowWindow('GameClientMenu')
3324 if g_Game_IsNet
then
3325 g_GUI_ShowWindow('GameServerMenu')
3327 g_GUI_ShowWindow('GameCustomMenu');
3330 g_GUI_ShowWindow('OptionsMenu');
3331 g_GUI_ShowWindow('OptionsVideoMenu');
3332 g_Sound_PlayEx('MENU_OPEN');
3335 procedure g_Menu_Show_OptionsSound();
3337 if gGameSettings
.GameType
= GT_SINGLE
then
3338 g_GUI_ShowWindow('GameSingleMenu')
3341 if g_Game_IsClient
then
3342 g_GUI_ShowWindow('GameClientMenu')
3344 if g_Game_IsNet
then
3345 g_GUI_ShowWindow('GameServerMenu')
3347 g_GUI_ShowWindow('GameCustomMenu');
3350 g_GUI_ShowWindow('OptionsMenu');
3351 g_GUI_ShowWindow('OptionsSoundMenu');
3352 g_Sound_PlayEx('MENU_OPEN');
3355 procedure g_Menu_Show_EndGameMenu();
3357 g_GUI_ShowWindow('EndGameMenu');
3358 g_Sound_PlayEx('MENU_OPEN');
3361 procedure g_Menu_Show_QuitGameMenu();
3363 g_GUI_ShowWindow('ExitMenu');
3364 g_Sound_PlayEx('MENU_OPEN');
3367 procedure g_Menu_Init();
3374 procedure g_Menu_Free();
3378 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3383 procedure g_Menu_Reset();
3387 g_GUI_SaveMenuPos();
3388 ex
:= g_GUI_Destroy();
3392 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3397 g_Game_SetDebugMode();
3399 g_GUI_LoadMenuPos();