1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../shared/a_modes.inc}
20 procedure g_Menu_Init();
21 procedure g_Menu_Free();
22 procedure g_Menu_Reset();
23 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
24 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
25 procedure g_Menu_AskLanguage();
27 procedure g_Menu_Show_SaveMenu();
28 procedure g_Menu_Show_LoadMenu(standalone
: Boolean=false);
29 procedure g_Menu_Show_GameSetGame();
30 procedure g_Menu_Show_OptionsVideo();
31 procedure g_Menu_Show_OptionsSound();
32 procedure g_Menu_Show_EndGameMenu();
33 procedure g_Menu_Show_QuitGameMenu();
37 gMenuSmallFont
: DWORD
;
40 TempScale
: Integer = -1;
45 {$INCLUDE ../nogl/noGLuses.inc}
46 g_gui
, g_textures
, e_graphics
, g_main
, g_window
, g_game
, g_map
,
47 g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
, g_weapons
,
48 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
, 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
;
164 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
165 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
167 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
168 g_dbg_scale
:= TempScale
+ 1;
171 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
175 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
176 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
177 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
178 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
179 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
180 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
181 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
182 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
185 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
188 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
189 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
190 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
191 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
193 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
194 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
195 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
196 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
197 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
198 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
199 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
200 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
203 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
204 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext', '-p1_weapnext');
205 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev', '-p1_weapprev');
206 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
207 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
209 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
210 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
211 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
212 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
213 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
214 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
215 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
216 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
217 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
218 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
219 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
220 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
224 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext', '-p1_weapnext');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev', '-p1_weapprev');
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
228 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
231 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
234 for i
:= WP_FIRST
to WP_LAST
do
236 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
237 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
238 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
239 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
243 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
246 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
247 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
248 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
249 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
250 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
251 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
252 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
253 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
254 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
255 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
256 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
257 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
258 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
259 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
260 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
261 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
262 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p2_weapnext', '-p2_weapnext');
263 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev', '-p2_weapprev');
264 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
265 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
267 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
268 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
269 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
270 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
271 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
272 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
273 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
274 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
275 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
276 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
277 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
278 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
279 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
282 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
283 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext', '-p2_weapnext');
284 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev', '-p2_weapprev');
285 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
286 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
289 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
292 for i
:= WP_FIRST
to WP_LAST
do
294 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
295 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
296 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
297 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
301 if e_HasJoysticks
then
303 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
306 for i
:= 0 to e_MaxJoys
- 1 do
307 if e_JoystickAvailable
[i
] then
308 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
312 if g_touch_enabled
then
314 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
315 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
316 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
317 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
318 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
321 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
323 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
324 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
325 TEAM_RED
, TEAM_BLUE
);
327 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
329 gPlayer1Settings
.Model
:= Model
.Name
;
330 gPlayer1Settings
.Color
:= Model
.Color
;
333 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
335 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
336 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
337 TEAM_RED
, TEAM_BLUE
);
338 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
340 gPlayer2Settings
.Model
:= Model
.Name
;
341 gPlayer2Settings
.Color
:= Model
.Color
;
344 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
345 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
347 if g_Game_IsServer
then
349 if gPlayer1
<> nil then
351 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
352 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
353 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
354 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
356 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
359 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
362 if gPlayer2
<> nil then
364 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
365 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
366 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
367 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
369 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
374 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
376 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
377 g_Console_WriteGameConfig();
380 procedure ReadOptions();
385 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
387 with TGUISwitch(menu
.GetControl('swBPP')) do
393 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
394 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
396 with TGUISwitch(menu
.GetControl('swVSync')) do
397 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
399 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
400 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
402 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
404 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
405 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
406 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
408 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
409 if gMuteWhenInactive
then
414 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
416 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
417 if gSoundEffectsDF
then
422 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
423 if gUseChatSounds
then
428 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
431 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
432 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
433 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
434 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
435 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
436 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
437 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
438 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
439 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
440 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
442 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
443 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
445 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
446 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
447 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
448 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
449 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
450 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
451 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
454 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
457 for i
:= WP_FIRST
to WP_LAST
do
459 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
460 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
464 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
467 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
468 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
469 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
470 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
471 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
472 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
473 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
474 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
476 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
478 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
481 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
482 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
490 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
493 for i
:= WP_FIRST
to WP_LAST
do
495 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
496 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
500 if e_HasJoysticks
then
502 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
505 for i
:= 0 to e_MaxJoys
- 1 do
506 if e_JoystickAvailable
[i
] then
507 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
511 if g_touch_enabled
then
513 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
514 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
515 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
516 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
517 with TGUISwitch(menu
.GetControl('swTouchFire')) do
518 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
519 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
522 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
525 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
526 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
527 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
528 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
531 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
533 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
534 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
535 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
536 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
537 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
539 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
542 with TGUISwitch(menu
.GetControl('swBloodType')) do
543 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
545 with TGUISwitch(menu
.GetControl('swCorpseType')) do
546 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
548 with TGUISwitch(menu
.GetControl('swGibsType')) do
549 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
551 with TGUISwitch(menu
.GetControl('swGibsCount')) do
560 with TGUISwitch(menu
.GetControl('swBackGround')) do
561 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
563 with TGUISwitch(menu
.GetControl('swMessages')) do
564 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
566 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
567 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
569 with TGUISwitch(menu
.GetControl('swChatBubble')) do
570 ItemIndex
:= gChatBubble
;
572 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
573 ItemIndex
:= gPlayerIndicator
;
575 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
576 ItemIndex
:= gPlayerIndicatorStyle
;
578 TempScale
:= Round(g_dbg_scale
- 1);
579 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
581 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
583 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
584 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
586 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
587 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
589 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
590 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
591 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
593 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
595 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
596 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
598 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
599 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
601 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
602 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
603 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
605 ProcSelectModel(nil);
608 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
610 // don't turn off monsters in DM
612 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
613 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
614 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
616 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
619 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
620 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
621 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
622 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
626 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
628 // don't turn off monsters in DM
630 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
631 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
632 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
634 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
637 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
638 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
639 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
640 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
644 procedure ProcStartCustomGame();
650 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
652 Map
:= TGUILabel(GetControl('lbMap')).Text;
655 if not isWadPath(Map
) then
658 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
659 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
660 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
661 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
662 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
664 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
665 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
666 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
667 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
670 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
672 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
674 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
676 Options
:= Options
or GAME_OPTION_MONSTERS
;
677 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
679 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
681 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
682 gcBotsVS
:= 'Monsters';
685 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
686 gcBotsVS
:= 'Everybody';
689 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
690 gcBotsVS
:= 'Players';
697 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
699 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
700 gcMaxLives
, Options
, gcPlayers
);
704 procedure ProcStartNetGame();
710 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
712 Map
:= TGUILabel(GetControl('lbMap')).Text;
715 if not isWadPath(Map
) then
718 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
719 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
720 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
721 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
722 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
723 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
725 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
726 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
727 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
728 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
731 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
733 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
735 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
737 Options
:= Options
or GAME_OPTION_MONSTERS
;
738 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
740 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
742 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
743 gnBotsVS
:= 'Monsters';
746 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
747 gnBotsVS
:= 'Everybody';
750 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
751 gnBotsVS
:= 'Players';
756 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
757 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
758 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
759 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
760 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
763 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
764 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
766 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
767 Options
, gnPlayers
, 0, NetPort
);
770 procedure ProcConnectNetGame();
774 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
776 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
777 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
778 PW
:= TGUIEdit(GetControl('edPW')).Text;
781 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
782 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
785 procedure ProcEnterPassword();
789 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
791 NetClientIP
:= PromptIP
;
792 NetClientPort
:= PromptPort
;
793 PW
:= TGUIEdit(GetControl('edPW')).Text;
796 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
797 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
800 procedure ProcServerlist();
802 if not NetInitDone
then
804 if (not g_Net_Init()) then
806 g_Console_Add('NET: ERROR: Failed to init ENet!');
813 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
815 gState
:= STATE_SLIST
;
816 g_ActiveWindow
:= nil;
818 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
823 slReturnPressed
:= True;
824 if g_Net_Slist_Fetch(slCurrent
) then
826 if slCurrent
= nil then
827 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
830 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
831 g_Serverlist_GenerateTable(slCurrent
, slTable
);
834 procedure ProcStartCampaign();
840 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
842 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
843 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
850 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
853 procedure ProcSelectMap(Sender
: TGUIControl
);
857 wad
, map
, res
: String;
859 win
:= g_GUI_GetWindow('SelectMapMenu');
860 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
862 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
863 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
865 if (wad
= '') or (map
= '') then
866 begin // Ýòî íå êàðòà
867 TGUILabel(GetControl('lbMapName')).Text := '';
868 TGUILabel(GetControl('lbMapAuthor')).Text := '';
869 TGUILabel(GetControl('lbMapSize')).Text := '';
870 TGUIMemo(GetControl('meMapDescription')).SetText('');
871 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
872 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
878 a
:= g_Map_GetMapInfo(res
);
880 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
881 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
882 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
883 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
884 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
885 TGUILabel(win
.GetControl('lbMapScale')).Text :=
886 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
891 procedure ProcSelectWAD(Sender
: TGUIControl
);
896 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
898 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
900 with TGUIListBox(GetControl('lsMapRes')) do
906 list
:= g_Map_GetMapsList(wad
);
920 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
926 win
:= g_GUI_GetWindow('CampaignMenu');
927 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
929 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
933 TGUILabel(GetControl('lbWADName')).Text := '';
934 TGUILabel(GetControl('lbWADAuthor')).Text := '';
935 TGUIMemo(GetControl('meWADDescription')).SetText('');
938 a
:= g_Game_GetMegaWADInfo(wad
);
940 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
941 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
942 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
944 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
948 fn
:= g_ExtractWadName(a
.pic
);
950 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
952 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
957 procedure ProcChangeColor(Sender
: TGUIControl
);
961 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
962 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
963 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
964 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
965 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
966 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
968 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
969 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
970 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
971 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
972 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
973 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
976 procedure ProcSelectModel(Sender
: TGUIControl
);
981 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
982 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
983 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
985 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
986 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
987 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
989 ProcChangeColor(nil);
992 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
1004 wad
:= TWADFile
.Create
;
1005 if wad
.ReadFile(GameWAD
) then
1006 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
1011 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
1013 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1014 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1015 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1016 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1018 if g_Texture_Get('FONT_STD', ID
) then
1019 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
1024 if cfglen
<> 0 then FreeMem(cfgdata
);
1027 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
1033 cfgdata
, fntdata
: Pointer;
1034 cfglen
, fntlen
: Integer;
1042 wad
:= TWADFile
.Create
;
1043 if wad
.ReadFile(GameWAD
) then
1045 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1046 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1052 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1053 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1054 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1056 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1057 FontID
:= e_CharFont_Create(spc
);
1059 for a
:= 0 to 255 do
1061 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1062 if chrwidth
= 0 then Continue
;
1064 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1066 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1072 if cfglen
<> 0 then FreeMem(cfgdata
);
1073 if fntlen
<> 0 then FreeMem(fntdata
);
1076 procedure MenuLoadData();
1078 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1080 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1081 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1082 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1083 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1084 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1085 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1086 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1087 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1088 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1089 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1090 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1091 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1092 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1093 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1094 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1095 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1096 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1097 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1098 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1099 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1100 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1101 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1102 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1103 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1104 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1106 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1107 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1108 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1109 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1110 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1111 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1112 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1115 procedure MenuFreeData();
1117 e_CharFont_Remove(gMenuFont
);
1118 e_CharFont_Remove(gMenuSmallFont
);
1120 g_Texture_Delete('MAINMENU_LOGO');
1121 g_Texture_Delete('MAINMENU_MARKER1');
1122 g_Texture_Delete('MAINMENU_MARKER2');
1123 g_Texture_Delete('SCROLL_LEFT');
1124 g_Texture_Delete('SCROLL_RIGHT');
1125 g_Texture_Delete('SCROLL_MIDDLE');
1126 g_Texture_Delete('SCROLL_MARKER');
1127 g_Texture_Delete('EDIT_LEFT');
1128 g_Texture_Delete('EDIT_RIGHT');
1129 g_Texture_Delete('EDIT_MIDDLE');
1130 g_Texture_Delete('BOX1');
1131 g_Texture_Delete('BOX2');
1132 g_Texture_Delete('BOX3');
1133 g_Texture_Delete('BOX4');
1134 g_Texture_Delete('BOX5');
1135 g_Texture_Delete('BOX6');
1136 g_Texture_Delete('BOX7');
1137 g_Texture_Delete('BOX8');
1138 g_Texture_Delete('BOX9');
1139 g_Texture_Delete('BSCROLL_UP_A');
1140 g_Texture_Delete('BSCROLL_UP_U');
1141 g_Texture_Delete('BSCROLL_DOWN_A');
1142 g_Texture_Delete('BSCROLL_DOWN_U');
1143 g_Texture_Delete('BSCROLL_MIDDLE');
1144 g_Texture_Delete('NOPIC');
1146 g_Sound_Delete('MENU_SELECT');
1147 g_Sound_Delete('MENU_OPEN');
1148 g_Sound_Delete('MENU_CLOSE');
1149 g_Sound_Delete('MENU_CHANGE');
1150 g_Sound_Delete('SCROLL_ADD');
1151 g_Sound_Delete('SCROLL_SUB');
1152 g_Sound_Delete('SOUND_PLAYER_FALL');
1155 procedure ProcAuthorsMenu();
1157 gMusic
.SetByName('MUSIC_INTERMUS');
1161 procedure ProcExitMenuKeyDown (yes
: Boolean);
1164 snd
: TPlayableSound
;
1169 g_Game_StopAllSounds(True);
1170 case (Random(18)) of
1171 0: s
:= 'SOUND_MONSTER_PAIN';
1172 1: s
:= 'SOUND_MONSTER_DIE_3';
1173 2: s
:= 'SOUND_MONSTER_SLOP';
1174 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1175 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1176 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1177 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1178 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1179 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1180 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1181 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1182 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1183 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1184 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1185 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1186 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1187 else s
:= 'SOUND_PLAYER_FALL';
1189 snd
:= TPlayableSound
.Create();
1190 res
:= snd
.SetByName(s
);
1191 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1195 while snd
.IsPlaying() do begin end;
1203 procedure ProcLoadMenu();
1210 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1211 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1212 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1216 procedure ProcSaveMenu();
1224 name
:= g_GetSaveName(a
, valid
);
1225 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1226 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1230 procedure ProcSaveGame(Sender
: TGUIControl
);
1234 if g_Game_IsNet
then Exit
;
1235 if g_Game_IsTestMap
then Exit
;
1236 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1237 g_Game_PauseAllSounds(True);
1238 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1240 g_ActiveWindow
:= nil;
1241 g_Game_Pause(False);
1244 procedure ProcLoadGame(Sender
: TGUIControl
);
1248 if g_Game_IsNet
then Exit
;
1249 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1250 if g_LoadGame(a
) then
1252 g_Game_PauseAllSounds(False)
1254 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1256 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1257 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1258 //g_ActiveWindow := nil;
1262 procedure ProcSingle1Player();
1264 g_Game_StartSingle(gDefaultMegawadStart
, False, 1);
1267 procedure ProcSingle2Players();
1269 g_Game_StartSingle(gDefaultMegawadStart
, True, 2);
1272 procedure ProcSelectMapMenu();
1275 wad_lb
: TGUIFileListBox
;
1276 map_lb
: TGUIListBox
;
1279 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1280 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1281 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1283 if wad_lb
.SelectedItem() <> '' then
1284 map
:= map_lb
.SelectedItem()
1288 wad_lb
.UpdateFileList();
1291 if wad_lb
.SelectedItem() <> '' then
1294 map_lb
.SelectItem(map
);
1296 if map_lb
.SelectedItem() <> '' then
1300 g_GUI_ShowWindow('SelectMapMenu');
1303 procedure ProcSelectCampaignMenu();
1306 wad_lb
: TGUIFileListBox
;
1308 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1309 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1311 wad_lb
.UpdateFileList();
1313 if wad_lb
.SelectedItem() <> '' then
1314 ProcSelectCampaignWAD(nil);
1317 procedure ProcSetMap();
1319 wad
, map
, res
: String;
1321 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1323 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1324 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1327 if (wad
= '') or (map
= '') then
1330 res
:= wad
+':\'+map
;
1332 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1333 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1336 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1340 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1342 g_Sound_SetupAllVolumes(
1343 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1344 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1348 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1352 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1353 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1355 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1356 g_dbg_scale
:= TempScale
+ 1;
1360 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1364 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1365 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1366 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1367 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1370 procedure ProcOptionsPlayersMIMenu();
1375 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1377 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1379 if a
= '' then Exit
;
1381 b
:= g_PlayerModel_GetInfo(a
);
1383 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1385 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1386 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1387 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1389 if b
.HaveWeapon
then
1390 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1392 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1395 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1398 procedure ProcOptionsPlayersAnim();
1402 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1407 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1410 Model
.GetCurrentAnimation
.Loop
:= True;
1411 Model
.GetCurrentAnimationMask
.Loop
:= True;
1415 procedure ProcOptionsPlayersWeap();
1419 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1424 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1428 procedure ProcOptionsPlayersRot();
1432 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1433 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1435 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1439 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1443 g_Options_SetDefault();
1449 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1451 if yes
then ReadOptions();
1455 procedure ProcAuthorsClose();
1457 gMusic
.SetByName('MUSIC_MENU');
1459 gState
:= STATE_MENU
;
1462 procedure ProcGMClose();
1464 g_Game_InGameMenu(False);
1467 procedure ProcGMShow();
1472 if (gGameSettings
.GameType
= GT_SINGLE
) and
1473 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1474 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1475 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1477 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1478 if g_Game_IsTestMap
then
1479 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1480 TGUIMainMenu(g_ActiveWindow
.GetControl(
1481 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1484 procedure ProcChangePlayers();
1486 TeamGame
, Spectator
, AddTwo
: Boolean;
1487 P1Team
{, P2Team}: Byte;
1488 bP2
: TGUITextButton
;
1490 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1491 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1492 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1493 P1Team
:= TEAM_NONE
;
1494 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1496 //P2Team := TEAM_NONE;
1497 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1499 TGUIMainMenu(g_ActiveWindow
.GetControl(
1500 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1501 TGUIMainMenu(g_ActiveWindow
.GetControl(
1502 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1503 TGUIMainMenu(g_ActiveWindow
.GetControl(
1504 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1506 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1507 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1508 bP2
.Enabled
:= AddTwo
and not Spectator
;
1510 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1512 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1513 if gPlayer2
= nil then
1514 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1516 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1518 TGUIMainMenu(g_ActiveWindow
.GetControl(
1519 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1522 procedure ProcJoinRed();
1524 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1526 if g_Game_IsServer
then
1528 if gPlayer1
= nil then
1529 g_Game_AddPlayer(TEAM_RED
)
1532 if gPlayer1
.Team
<> TEAM_RED
then
1534 gPlayer1
.SwitchTeam
;
1535 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1538 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1543 gPlayer1Settings
.Team
:= TEAM_RED
;
1544 MC_SEND_PlayerSettings
;
1545 if gPlayer1
= nil then
1546 g_Game_AddPlayer(TEAM_RED
);
1548 g_ActiveWindow
:= nil;
1549 g_Game_Pause(False);
1552 procedure ProcJoinBlue();
1554 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1556 if g_Game_IsServer
then
1558 if gPlayer1
= nil then
1559 g_Game_AddPlayer(TEAM_BLUE
)
1562 if gPlayer1
.Team
<> TEAM_BLUE
then
1564 gPlayer1
.SwitchTeam
;
1565 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1568 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1573 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1574 MC_SEND_PlayerSettings
;
1575 if gPlayer1
= nil then
1576 g_Game_AddPlayer(TEAM_BLUE
);
1578 g_ActiveWindow
:= nil;
1579 g_Game_Pause(False);
1582 procedure ProcJoinGame();
1584 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1586 if gPlayer1
= nil then
1588 g_ActiveWindow
:= nil;
1589 g_Game_Pause(False);
1592 procedure ProcSwitchP2();
1594 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1596 if gPlayer1
= nil then
1598 if gPlayer2
= nil then
1601 g_Game_RemovePlayer();
1602 g_ActiveWindow
:= nil;
1603 g_Game_Pause(False);
1606 procedure ProcSpectate();
1608 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1611 g_ActiveWindow
:= nil;
1612 g_Game_Pause(False);
1615 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1617 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1620 procedure ProcEndMenuKeyDown (yes
: Boolean);
1622 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1625 procedure ProcSetRussianLanguage();
1627 if gLanguage
<> LANGUAGE_RUSSIAN
then
1629 gLanguage
:= LANGUAGE_RUSSIAN
;
1630 gLanguageChange
:= True;
1631 gAskLanguage
:= False;
1633 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1635 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1640 procedure ProcSetEnglishLanguage();
1642 if gLanguage
<> LANGUAGE_ENGLISH
then
1644 gLanguage
:= LANGUAGE_ENGLISH
;
1645 gLanguageChange
:= True;
1646 gAskLanguage
:= False;
1648 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1650 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1655 procedure ReadGameSettings();
1659 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1661 with gGameSettings
do
1663 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1664 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1669 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1670 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1671 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1673 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1674 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1675 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1678 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1683 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1685 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1686 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1687 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1688 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1689 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1690 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1691 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1692 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1696 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1697 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1702 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1703 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1708 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1709 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1714 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1715 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1720 procedure ProcApplyGameSet();
1724 stat
: TPlayerStatArray
;
1726 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1728 if not g_Game_IsServer
then Exit
;
1730 with gGameSettings
do
1732 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1734 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1735 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1737 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1740 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1742 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1748 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1750 TimeLimit
:= Max(n
, b
);
1754 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1756 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1763 if GameMode
= GM_DM
then
1765 stat
:= g_Player_GetStats();
1767 for a
:= 0 to High(stat
) do
1768 if stat
[a
].Frags
> b
then
1772 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1774 GoalLimit
:= Max(n
, b
);
1778 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1780 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1781 if n
< 0 then n
:= 0;
1782 if n
> 255 then n
:= 255;
1788 stat
:= g_Player_GetStats();
1790 for a
:= 0 to High(stat
) do
1791 if stat
[a
].Lives
> b
then
1794 MaxLives
:= Max(n
, b
);
1798 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1800 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1803 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1804 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1808 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1809 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1813 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1814 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1820 if g_Game_IsNet
then MH_SEND_GameSettings
;
1823 procedure ProcVideoOptionsRes();
1829 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1831 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1832 IntToStr(gScreenWidth
) +
1833 ' x ' + IntToStr(gScreenHeight
) +
1834 ', ' + IntToStr(gBPP
) + ' bpp';
1836 with TGUIListBox(menu
.GetControl('lsResolution')) do
1838 list
:= GetDisplayModes(gBPP
, SR
);
1849 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1856 procedure ProcApplyVideoOptions();
1859 Fullscreen
: Boolean;
1860 SWidth
, SHeight
: Integer;
1863 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1865 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1866 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1868 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1870 if (SWidth
<> gScreenWidth
) or
1871 (SHeight
<> gScreenHeight
) or
1872 (Fullscreen
<> gFullscreen
) then
1874 gResolutionChange
:= True;
1875 gRC_Width
:= SWidth
;
1876 gRC_Height
:= SHeight
;
1877 gRC_FullScreen
:= Fullscreen
;
1878 gRC_Maximized
:= gWinMaximized
;
1881 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1885 procedure ProcSetFirstRussianLanguage();
1887 gLanguage
:= LANGUAGE_RUSSIAN
;
1888 gLanguageChange
:= True;
1889 gAskLanguage
:= False;
1891 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1894 procedure ProcSetFirstEnglishLanguage();
1896 gLanguage
:= LANGUAGE_ENGLISH
;
1897 gLanguageChange
:= True;
1898 gAskLanguage
:= False;
1900 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1903 procedure ProcRecallAddress();
1905 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1907 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1908 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1912 procedure CreateFirstLanguageMenu();
1916 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1918 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1920 Name
:= 'mmFirstLanguageMenu';
1921 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1922 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1925 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1926 Menu
.MainWindow
:= True;
1927 g_GUI_AddWindow(Menu
);
1930 procedure g_Menu_AskLanguage();
1932 CreateFirstLanguageMenu();
1933 g_GUI_ShowWindow('FirstLanguageMenu');
1936 procedure CreatePlayerOptionsMenu(s
: String);
1941 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1943 a
:= _lc
[I_MENU_PLAYER_1
]
1945 a
:= _lc
[I_MENU_PLAYER_2
];
1946 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1948 Name
:= 'mOptionsPlayers'+s
+'Menu';
1949 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1951 Name
:= 'ed'+s
+'Name';
1955 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1957 Name
:= 'sw'+s
+'Team';
1958 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1959 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1961 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1963 Name
:= 'ls'+s
+'Model';
1965 Items
:= g_PlayerModel_GetNames();
1966 OnChange
:= ProcSelectModel
;
1968 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1970 Name
:= 'sc'+s
+'Red';
1972 OnChange
:= ProcChangeColor
;
1974 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1976 Name
:= 'sc'+s
+'Green';
1978 OnChange
:= ProcChangeColor
;
1980 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1982 Name
:= 'sc'+s
+'Blue';
1984 OnChange
:= ProcChangeColor
;
1987 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1988 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1989 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1990 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1992 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1994 Name
:= 'mv'+s
+'Model';
1995 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1996 Y
:= GetControl('ls'+s
+'Model').Y
;
1999 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2000 g_GUI_AddWindow(Menu
);
2003 procedure CreateAllMenus();
2007 a
, cx
, _y
, i
: Integer;
2010 Menu
:= TGUIWindow
.Create('MainMenu');
2011 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2013 Name
:= 'mmMainMenu';
2014 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2015 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2016 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2017 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2018 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2019 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2021 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2023 Color
:= _RGB(255, 255, 255);
2024 X
:= gScreenWidth
-GetWidth
-8;
2025 Y
:= gScreenHeight
-GetHeight
-8;
2027 Menu
.DefControl
:= 'mmMainMenu';
2028 Menu
.MainWindow
:= True;
2029 g_GUI_AddWindow(Menu
);
2031 Menu
:= TGUIWindow
.Create('NewGameMenu');
2032 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2034 Name
:= 'mmNewGameMenu';
2035 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2036 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2037 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2038 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2040 Menu
.DefControl
:= 'mmNewGameMenu';
2041 g_GUI_AddWindow(Menu
);
2043 Menu
:= TGUIWindow
.Create('NetGameMenu');
2044 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2046 Name
:= 'mmNetGameMenu';
2047 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2048 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2050 Menu
.DefControl
:= 'mmNetGameMenu';
2051 g_GUI_AddWindow(Menu
);
2053 Menu
:= TGUIWindow
.Create('NetServerMenu');
2054 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2056 Name
:= 'mNetServerMenu';
2057 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2059 Name
:= 'edSrvName';
2060 OnlyDigits
:= False;
2063 Text := NetServerName
;
2065 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2067 Name
:= 'edSrvPassword';
2068 OnlyDigits
:= False;
2071 Text := NetPassword
;
2073 with AddEdit(_lc
[I_NET_PORT
]) do
2079 Text := IntToStr(NetPort
);
2081 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2083 Name
:= 'edMaxPlayers';
2087 Text := IntToStr(NetMaxClients
);
2089 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2091 Name
:= 'swUseMaster';
2092 AddItem(_lc
[I_MENU_YES
]);
2093 AddItem(_lc
[I_MENU_NO
]);
2094 if NetUseMaster
then
2100 with AddLabel(_lc
[I_MENU_MAP
]) do
2105 OnClick
:= @ProcSelectMapMenu
;
2107 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2109 Name
:= 'swGameMode';
2110 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2111 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2112 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2113 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2114 case g_Game_TextToMode(gnGameMode
) of
2116 GM_DM
: ItemIndex
:= 0;
2117 GM_TDM
: ItemIndex
:= 1;
2118 GM_CTF
: ItemIndex
:= 2;
2120 GM_COOP
: ItemIndex
:= 3;
2122 OnChange
:= ProcSwitchMonstersNet
;
2124 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2126 Name
:= 'edTimeLimit';
2130 if gnTimeLimit
> 0 then
2131 Text := IntToStr(gnTimeLimit
);
2133 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2135 Name
:= 'edGoalLimit';
2139 if gnGoalLimit
> 0 then
2140 Text := IntToStr(gnGoalLimit
);
2142 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2144 Name
:= 'edMaxLives';
2148 if gnMaxLives
> 0 then
2149 Text := IntToStr(gnMaxLives
);
2151 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2153 Name
:= 'swPlayers';
2154 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2155 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2156 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2157 ItemIndex
:= gnPlayers
;
2159 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2161 Name
:= 'swTeamDamage';
2162 AddItem(_lc
[I_MENU_YES
]);
2163 AddItem(_lc
[I_MENU_NO
]);
2164 if gnTeamDamage
then
2169 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2171 Name
:= 'swEnableExits';
2172 AddItem(_lc
[I_MENU_YES
]);
2173 AddItem(_lc
[I_MENU_NO
]);
2179 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2181 Name
:= 'swWeaponStay';
2182 AddItem(_lc
[I_MENU_YES
]);
2183 AddItem(_lc
[I_MENU_NO
]);
2184 if gnWeaponStay
then
2189 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2191 Name
:= 'swMonsters';
2192 AddItem(_lc
[I_MENU_YES
]);
2193 AddItem(_lc
[I_MENU_NO
]);
2199 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2202 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2203 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2204 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2206 if gnBotsVS
= 'Players' then
2208 if gnBotsVS
= 'Monsters' then
2212 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2216 Menu
.DefControl
:= 'mNetServerMenu';
2217 g_GUI_AddWindow(Menu
);
2219 Menu
:= TGUIWindow
.Create('NetClientMenu');
2220 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2222 Name
:= 'mNetClientMenu';
2224 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2227 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2233 Text := 'localhost';
2235 with AddEdit(_lc
[I_NET_PORT
]) do
2243 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2246 OnlyDigits
:= False;
2253 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2257 Menu
.DefControl
:= 'mNetClientMenu';
2258 g_GUI_AddWindow(Menu
);
2260 Menu
:= TGUIWindow
.Create('LoadMenu');
2261 Menu
.OnShow
:= ProcLoadMenu
;
2262 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2264 Name
:= 'mmLoadMenu';
2269 Name
:= 'edSlot'+IntToStr(a
);
2272 OnEnter
:= ProcLoadGame
;
2275 Menu
.DefControl
:= 'mmLoadMenu';
2276 g_GUI_AddWindow(Menu
);
2278 Menu
:= TGUIWindow
.Create('SaveMenu');
2279 Menu
.OnShow
:= ProcSaveMenu
;
2280 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2282 Name
:= 'mmSaveMenu';
2287 Name
:= 'edSlot'+IntToStr(a
);
2290 OnChange
:= ProcSaveGame
;
2293 Menu
.DefControl
:= 'mmSaveMenu';
2294 g_GUI_AddWindow(Menu
);
2296 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2297 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2299 Name
:= 'mCustomGameMenu';
2300 with AddLabel(_lc
[I_MENU_MAP
]) do
2305 OnClick
:= @ProcSelectMapMenu
;
2307 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2309 Name
:= 'swGameMode';
2310 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2311 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2312 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2313 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2314 case g_Game_TextToMode(gcGameMode
) of
2316 GM_DM
: ItemIndex
:= 0;
2317 GM_TDM
: ItemIndex
:= 1;
2318 GM_CTF
: ItemIndex
:= 2;
2320 GM_COOP
: ItemIndex
:= 3;
2322 OnChange
:= ProcSwitchMonstersCustom
;
2324 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2326 Name
:= 'edTimeLimit';
2330 if gcTimeLimit
> 0 then
2331 Text := IntToStr(gcTimeLimit
);
2333 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2335 Name
:= 'edGoalLimit';
2339 if gcGoalLimit
> 0 then
2340 Text := IntToStr(gcGoalLimit
);
2342 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2344 Name
:= 'edMaxLives';
2348 if gcMaxLives
> 0 then
2349 Text := IntToStr(gcMaxLives
);
2351 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2353 Name
:= 'swPlayers';
2354 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2355 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2356 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2357 ItemIndex
:= gcPlayers
;
2359 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2361 Name
:= 'swTeamDamage';
2362 AddItem(_lc
[I_MENU_YES
]);
2363 AddItem(_lc
[I_MENU_NO
]);
2364 if gcTeamDamage
then
2369 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2371 Name
:= 'swEnableExits';
2372 AddItem(_lc
[I_MENU_YES
]);
2373 AddItem(_lc
[I_MENU_NO
]);
2379 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2381 Name
:= 'swWeaponStay';
2382 AddItem(_lc
[I_MENU_YES
]);
2383 AddItem(_lc
[I_MENU_NO
]);
2384 if gcWeaponStay
then
2389 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2391 Name
:= 'swMonsters';
2392 AddItem(_lc
[I_MENU_YES
]);
2393 AddItem(_lc
[I_MENU_NO
]);
2399 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2402 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2403 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2404 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2406 if gcBotsVS
= 'Players' then
2408 if gcBotsVS
= 'Monsters' then
2412 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2416 Menu
.DefControl
:= 'mCustomGameMenu';
2417 g_GUI_AddWindow(Menu
);
2419 Menu
:= TGUIWindow
.Create('CampaignMenu');
2420 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2422 Name
:= 'mCampaignMenu';
2431 with AddFileList('', 15, 4) do
2434 OnChange
:= ProcSelectCampaignWAD
;
2438 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2439 SetBase(MapsDir
+'megawads/');
2442 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2444 Name
:= 'lbWADName';
2448 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2450 Name
:= 'lbWADAuthor';
2454 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2455 with AddMemo('', 15, 3) do
2457 Name
:= 'meWADDescription';
2458 Color
:= MENU_ITEMSCTRL_COLOR
;
2460 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2462 Name
:= 'swPlayers';
2463 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2464 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2467 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2471 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2473 Name
:= 'mpWADImage';
2474 DefaultRes
:= 'NOPIC';
2475 X
:= GetControl('lsWAD').X
+4;
2476 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2479 Menu
.DefControl
:= 'mCampaignMenu';
2480 g_GUI_AddWindow(Menu
);
2482 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2483 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2485 Name
:= 'mSelectMapMenu';
2486 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2489 OnChange
:= ProcSelectWAD
;
2493 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2496 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2500 OnChange
:= ProcSelectMap
;
2503 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2505 Name
:= 'lbMapName';
2509 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2511 Name
:= 'lbMapAuthor';
2515 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2517 Name
:= 'lbMapSize';
2521 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2523 Name
:= 'meMapDescription';
2528 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2530 Name
:= 'mpMapPreview';
2531 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2532 Y
:= GetControl('lsMapWAD').Y
;
2534 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2536 Name
:= 'lbMapScale';
2539 Color
:= MENU_ITEMSCTRL_COLOR
;
2540 X
:= GetControl('lsMapWAD').X
+
2541 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2542 2 + MAPPREVIEW_WIDTH
*4;
2543 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2546 Menu
.OnClose
:= ProcSetMap
;
2547 Menu
.DefControl
:= 'mSelectMapMenu';
2548 g_GUI_AddWindow(Menu
);
2550 Menu
:= TGUIWindow
.Create('OptionsMenu');
2551 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2553 Name
:= 'mmOptionsMenu';
2554 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2555 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2556 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2557 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2558 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2559 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2561 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2562 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2564 Menu
.OnClose
:= ProcApplyOptions
;
2565 Menu
.DefControl
:= 'mmOptionsMenu';
2566 g_GUI_AddWindow(Menu
);
2568 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2569 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2570 g_GUI_AddWindow(Menu
);
2572 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2573 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2575 Name
:= 'mOptionsVideoMenu';
2576 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2577 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2583 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2586 AddItem(_lc
[I_MENU_YES
]);
2587 AddItem(_lc
[I_MENU_NO
]);
2589 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2591 Name
:= 'swTextureFilter';
2592 AddItem(_lc
[I_MENU_YES
]);
2593 AddItem(_lc
[I_MENU_NO
]);
2595 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2597 Name
:= 'swLegacyNPOT';
2598 AddItem(_lc
[I_MENU_NO
]);
2599 AddItem(_lc
[I_MENU_YES
]);
2602 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2605 Menu
.DefControl
:= 'mOptionsVideoMenu';
2606 g_GUI_AddWindow(Menu
);
2608 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2609 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2611 Name
:= 'mOptionsVideoResMenu';
2612 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2614 Name
:= 'lbCurrentRes';
2618 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2620 Name
:= 'lsResolution';
2623 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2625 Name
:= 'swFullScreen';
2626 AddItem(_lc
[I_MENU_YES
]);
2627 AddItem(_lc
[I_MENU_NO
]);
2630 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2633 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2634 g_GUI_AddWindow(Menu
);
2636 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2637 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2639 Name
:= 'mOptionsSoundMenu';
2640 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2642 Name
:= 'scMusicLevel';
2644 OnChange
:= ProcChangeSoundSettings
;
2646 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2648 Name
:= 'scSoundLevel';
2650 OnChange
:= ProcChangeSoundSettings
;
2652 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2654 Name
:= 'scMaxSimSounds';
2657 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2659 Name
:= 'swAnnouncer';
2660 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2661 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2662 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2663 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2665 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2666 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2668 Name
:= 'swSoundEffects';
2669 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2670 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2672 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2673 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2675 Name
:= 'swChatSpeech';
2676 AddItem(_lc
[I_MENU_YES
]);
2677 AddItem(_lc
[I_MENU_NO
]);
2679 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2681 Name
:= 'swInactiveSounds';
2682 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2683 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2687 Menu
.DefControl
:= 'mOptionsSoundMenu';
2688 g_GUI_AddWindow(Menu
);
2690 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2691 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2693 Name
:= 'mOptionsGameMenu';
2694 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2696 Name
:= 'scParticlesCount';
2699 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2701 Name
:= 'swBloodCount';
2702 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2703 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2704 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2705 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2706 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2708 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2710 Name
:= 'scShellsMax';
2713 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2715 Name
:= 'scGibsMax';
2718 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2720 Name
:= 'scCorpsesMax';
2723 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2725 Name
:= 'swGibsCount';
2726 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2727 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2728 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2729 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2730 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2732 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2734 Name
:= 'swCorpseType';
2735 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2736 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2738 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2740 Name
:= 'swGibsType';
2741 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2742 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2744 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2746 Name
:= 'swBloodType';
2747 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2748 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2750 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2752 Name
:= 'swScreenFlash';
2753 AddItem(_lc
[I_MENU_NO
]);
2754 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2755 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2757 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2759 Name
:= 'swBackground';
2760 AddItem(_lc
[I_MENU_YES
]);
2761 AddItem(_lc
[I_MENU_NO
]);
2763 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2765 Name
:= 'swMessages';
2766 AddItem(_lc
[I_MENU_YES
]);
2767 AddItem(_lc
[I_MENU_NO
]);
2769 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2771 Name
:= 'swRevertPlayers';
2772 AddItem(_lc
[I_MENU_YES
]);
2773 AddItem(_lc
[I_MENU_NO
]);
2775 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2777 Name
:= 'swChatBubble';
2778 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2779 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2780 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2781 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2782 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2784 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2786 Name
:= 'swPlayerIndicator';
2787 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2788 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2789 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2791 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2793 Name
:= 'swPlayerIndicatorStyle';
2794 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2795 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2797 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2799 Name
:= 'scScaleFactor';
2801 OnChange
:= ProcChangeGameSettings
;
2805 Menu
.DefControl
:= 'mOptionsGameMenu';
2806 g_GUI_AddWindow(Menu
);
2808 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2809 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2811 Name
:= 'mOptionsControlsMenu';
2812 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2813 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2814 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2815 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2816 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2818 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2819 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2820 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2821 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2822 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2823 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2824 if e_HasJoysticks
then
2827 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2829 if g_touch_enabled
then
2832 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2835 Menu
.DefControl
:= 'mOptionsControlsMenu';
2836 g_GUI_AddWindow(Menu
);
2838 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2839 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2841 Name
:= 'mOptionsControlsP1Menu';
2842 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2843 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2844 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2845 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2846 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2847 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2848 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2849 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2850 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2851 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2853 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2854 g_GUI_AddWindow(Menu
);
2856 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2857 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2859 Name
:= 'mOptionsControlsP1MenuWeapons';
2860 for i
:= WP_FIRST
to WP_LAST
do
2861 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2862 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2864 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2865 g_GUI_AddWindow(Menu
);
2867 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2868 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2870 Name
:= 'mOptionsControlsP2Menu';
2871 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2872 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2873 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2874 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2875 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2876 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2877 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2878 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2879 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2880 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2882 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2883 g_GUI_AddWindow(Menu
);
2885 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2886 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2888 Name
:= 'mOptionsControlsP2MenuWeapons';
2889 for i
:= WP_FIRST
to WP_LAST
do
2890 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2891 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2893 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2894 g_GUI_AddWindow(Menu
);
2896 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2897 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2899 Name
:= 'mOptionsControlsJoystickMenu';
2900 for i
:= 0 to e_MaxJoys
- 1 do
2901 if e_JoystickAvailable
[i
] then
2902 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2904 Name
:= 'scDeadzone' + IntToStr(i
);
2908 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2909 g_GUI_AddWindow(Menu
);
2911 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2912 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2914 Name
:= 'mOptionsControlsTouchMenu';
2915 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
2917 Name
:= 'swTouchAlt';
2918 AddItem(_lc
[I_MENU_NO
]);
2919 AddItem(_lc
[I_MENU_YES
]);
2920 OnChange
:= ProcChangeTouchSettings
;
2922 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2924 Name
:= 'scTouchSize';
2926 OnChange
:= ProcChangeTouchSettings
;
2928 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2930 Name
:= 'swTouchFire';
2931 AddItem(_lc
[I_MENU_NO
]);
2932 AddItem(_lc
[I_MENU_YES
]);
2934 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
2936 Name
:= 'scTouchOffset';
2938 OnChange
:= ProcChangeTouchSettings
;
2941 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
2942 g_GUI_AddWindow(Menu
);
2944 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2945 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2947 Name
:= 'mOptionsPlayersMenu';
2948 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2949 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2951 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2952 g_GUI_AddWindow(Menu
);
2954 CreatePlayerOptionsMenu('P1');
2955 CreatePlayerOptionsMenu('P2');
2957 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2958 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2960 Name
:= 'mOptionsPlayersMIMenu';
2961 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2966 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2971 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2973 Name
:= 'meComment';
2976 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2977 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2980 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2984 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2985 g_GUI_AddWindow(Menu
);
2987 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2988 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2990 Name
:= 'mOptionsLanguageMenu';
2991 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2992 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2995 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2996 g_GUI_AddWindow(Menu
);
2998 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2999 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3000 g_GUI_AddWindow(Menu
);
3002 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3003 Menu
.BackTexture
:= 'INTER';
3004 Menu
.OnClose
:= ProcAuthorsClose
;
3008 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3010 Color
:= _RGB(255, 0, 0);
3011 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3013 _y
:= _y
+GetHeight();
3015 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3017 Color
:= _RGB(255, 0, 0);
3018 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3020 _y
:= _y
+GetHeight()+32;
3022 // ×òî äåëàë: Êòî äåëàë
3023 cx
:= gScreenWidth
div 2 - 320 + 64;
3024 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3026 Color
:= _RGB(255, 0, 0);
3031 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3033 Color
:= _RGB(255, 255, 255);
3038 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3040 Color
:= _RGB(255, 0, 0);
3045 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3047 Color
:= _RGB(255, 255, 255);
3052 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3054 Color
:= _RGB(255, 255, 255);
3059 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3061 Color
:= _RGB(255, 0, 0);
3066 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3068 Color
:= _RGB(255, 255, 255);
3073 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3075 Color
:= _RGB(255, 0, 0);
3080 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3082 Color
:= _RGB(255, 255, 255);
3085 _y
:= gScreenHeight
- 128;
3088 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3090 Color
:= _RGB(255, 0, 0);
3095 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3097 Color
:= _RGB(255, 255, 255);
3100 _y
:= _y
+GetHeight();
3102 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3104 Color
:= _RGB(255, 255, 255);
3107 _y
:= _y
+GetHeight();
3109 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3111 Color
:= _RGB(255, 255, 255);
3114 _y
:= gScreenHeight
- 32;
3116 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3118 Color
:= _RGB(255, 0, 0);
3119 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3122 g_GUI_AddWindow(Menu
);
3124 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3125 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3126 g_GUI_AddWindow(Menu
);
3128 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3129 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3131 Name
:= 'mmGameSingleMenu';
3132 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3133 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3134 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3135 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3136 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3137 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3139 Menu
.DefControl
:= 'mmGameSingleMenu';
3140 Menu
.MainWindow
:= True;
3141 Menu
.OnClose
:= ProcGMClose
;
3142 Menu
.OnShow
:= ProcGMShow
;
3143 g_GUI_AddWindow(Menu
);
3145 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3146 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3147 g_GUI_AddWindow(Menu
);
3149 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3150 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3151 g_GUI_AddWindow(Menu
);
3153 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3154 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3156 Name
:= 'mmGameCustomMenu';
3157 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3158 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3159 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3160 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3161 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3162 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3163 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3165 Menu
.DefControl
:= 'mmGameCustomMenu';
3166 Menu
.MainWindow
:= True;
3167 Menu
.OnClose
:= ProcGMClose
;
3168 Menu
.OnShow
:= ProcGMShow
;
3169 g_GUI_AddWindow(Menu
);
3171 Menu
:= TGUIWindow
.Create('GameServerMenu');
3172 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3174 Name
:= 'mmGameServerMenu';
3175 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3176 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3177 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3178 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3179 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3181 Menu
.DefControl
:= 'mmGameServerMenu';
3182 Menu
.MainWindow
:= True;
3183 Menu
.OnClose
:= ProcGMClose
;
3184 Menu
.OnShow
:= ProcGMShow
;
3185 g_GUI_AddWindow(Menu
);
3187 Menu
:= TGUIWindow
.Create('GameClientMenu');
3188 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3190 Name
:= 'mmGameClientMenu';
3191 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3192 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3193 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3195 Menu
.DefControl
:= 'mmGameClientMenu';
3196 Menu
.MainWindow
:= True;
3197 Menu
.OnClose
:= ProcGMClose
;
3198 Menu
.OnShow
:= ProcGMShow
;
3199 g_GUI_AddWindow(Menu
);
3201 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3202 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3204 Name
:= 'mClientPasswordMenu';
3205 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3213 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3216 Menu
.DefControl
:= 'mClientPasswordMenu';
3217 g_GUI_AddWindow(Menu
);
3219 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3220 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3222 Name
:= 'mGameSetGameMenu';
3223 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3225 Name
:= 'swTeamDamage';
3226 AddItem(_lc
[I_MENU_YES
]);
3227 AddItem(_lc
[I_MENU_NO
]);
3230 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3232 Name
:= 'edTimeLimit';
3237 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3239 Name
:= 'edGoalLimit';
3244 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3246 Name
:= 'edMaxLives';
3251 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3254 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3255 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3256 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3262 Menu
.DefControl
:= 'mGameSetGameMenu';
3263 Menu
.OnClose
:= ProcApplyGameSet
;
3264 g_GUI_AddWindow(Menu
);
3266 Menu
:= TGUIWindow
.Create('TeamMenu');
3267 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3269 Name
:= 'mmTeamMenu';
3270 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3271 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3272 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3273 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3274 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3276 Menu
.DefControl
:= 'mmTeamMenu';
3277 Menu
.OnShow
:= ProcChangePlayers
;
3278 g_GUI_AddWindow(Menu
);
3281 procedure g_Menu_Show_SaveMenu();
3283 if g_Game_IsTestMap
then
3285 if gGameSettings
.GameType
= GT_SINGLE
then
3286 g_GUI_ShowWindow('GameSingleMenu')
3289 if g_Game_IsClient
then
3292 if g_Game_IsNet
then
3295 g_GUI_ShowWindow('GameCustomMenu');
3297 g_GUI_ShowWindow('SaveMenu');
3298 g_Sound_PlayEx('MENU_OPEN');
3301 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3303 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3304 if gGameSettings
.GameType
= GT_SINGLE
then
3306 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3310 if g_Game_IsClient
then exit
;
3311 if g_Game_IsNet
then exit
;
3312 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3314 g_GUI_ShowWindow('LoadMenu');
3315 g_Sound_PlayEx('MENU_OPEN');
3318 procedure g_Menu_Show_GameSetGame();
3320 if gGameSettings
.GameType
= GT_SINGLE
then
3321 g_GUI_ShowWindow('GameSingleMenu')
3324 if g_Game_IsClient
then
3327 if g_Game_IsNet
then
3328 g_GUI_ShowWindow('GameServerMenu')
3330 g_GUI_ShowWindow('GameCustomMenu');
3333 g_GUI_ShowWindow('GameSetGameMenu');
3334 g_Sound_PlayEx('MENU_OPEN');
3337 procedure g_Menu_Show_OptionsVideo();
3339 if gGameSettings
.GameType
= GT_SINGLE
then
3340 g_GUI_ShowWindow('GameSingleMenu')
3343 if g_Game_IsClient
then
3344 g_GUI_ShowWindow('GameClientMenu')
3346 if g_Game_IsNet
then
3347 g_GUI_ShowWindow('GameServerMenu')
3349 g_GUI_ShowWindow('GameCustomMenu');
3352 g_GUI_ShowWindow('OptionsMenu');
3353 g_GUI_ShowWindow('OptionsVideoMenu');
3354 g_Sound_PlayEx('MENU_OPEN');
3357 procedure g_Menu_Show_OptionsSound();
3359 if gGameSettings
.GameType
= GT_SINGLE
then
3360 g_GUI_ShowWindow('GameSingleMenu')
3363 if g_Game_IsClient
then
3364 g_GUI_ShowWindow('GameClientMenu')
3366 if g_Game_IsNet
then
3367 g_GUI_ShowWindow('GameServerMenu')
3369 g_GUI_ShowWindow('GameCustomMenu');
3372 g_GUI_ShowWindow('OptionsMenu');
3373 g_GUI_ShowWindow('OptionsSoundMenu');
3374 g_Sound_PlayEx('MENU_OPEN');
3377 procedure g_Menu_Show_EndGameMenu();
3379 g_GUI_ShowWindow('EndGameMenu');
3380 g_Sound_PlayEx('MENU_OPEN');
3383 procedure g_Menu_Show_QuitGameMenu();
3385 g_GUI_ShowWindow('ExitMenu');
3386 g_Sound_PlayEx('MENU_OPEN');
3389 procedure g_Menu_Init();
3396 procedure g_Menu_Free();
3400 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3405 procedure g_Menu_Reset();
3409 g_GUI_SaveMenuPos();
3410 ex
:= g_GUI_Destroy();
3414 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3419 g_Game_SetDebugMode();
3421 g_GUI_LoadMenuPos();