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
= 0;
164 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
166 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
167 g_dbg_scale
:= TempScale
+ 1;
170 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
174 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
175 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
176 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
177 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
178 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
179 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
180 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
181 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
184 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
187 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
188 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
189 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
190 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
191 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
193 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
194 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
195 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
196 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
197 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
198 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
199 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
200 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
203 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext', '-p1_weapnext');
204 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev', '-p1_weapprev');
205 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
206 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
208 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
209 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
210 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
211 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
212 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
213 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
214 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
215 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
216 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
217 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
218 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
219 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
220 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
224 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext', '-p1_weapnext');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev', '-p1_weapprev');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
230 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
233 for i
:= WP_FIRST
to WP_LAST
do
235 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
236 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
237 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
238 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
242 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
245 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
246 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
247 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
248 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
249 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
250 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
251 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
252 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
253 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
254 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
255 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
256 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
257 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
258 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
259 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
260 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
261 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p2_weapnext', '-p2_weapnext');
262 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev', '-p2_weapprev');
263 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
264 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
266 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
267 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
268 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
269 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
270 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
271 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
272 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
273 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
274 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
275 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
276 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
277 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
278 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
279 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
282 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext', '-p2_weapnext');
283 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev', '-p2_weapprev');
284 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
285 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
288 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
291 for i
:= WP_FIRST
to WP_LAST
do
293 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
294 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
295 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
296 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
300 if e_HasJoysticks
then
302 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
305 for i
:= 0 to e_MaxJoys
- 1 do
306 if e_JoystickAvailable
[i
] then
307 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
311 if g_touch_enabled
then
313 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
314 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
315 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
316 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
317 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
320 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
322 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
323 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
324 TEAM_RED
, TEAM_BLUE
);
326 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
328 gPlayer1Settings
.Model
:= Model
.Name
;
329 gPlayer1Settings
.Color
:= Model
.Color
;
332 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
334 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
335 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
336 TEAM_RED
, TEAM_BLUE
);
337 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
339 gPlayer2Settings
.Model
:= Model
.Name
;
340 gPlayer2Settings
.Color
:= Model
.Color
;
343 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
344 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
346 if g_Game_IsServer
then
348 if gPlayer1
<> nil then
350 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
351 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
352 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
353 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
355 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
358 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
361 if gPlayer2
<> nil then
363 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
364 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
365 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
366 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
368 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
373 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
375 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
376 g_Console_WriteGameConfig();
379 procedure ReadOptions();
384 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
386 with TGUISwitch(menu
.GetControl('swBPP')) do
392 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
393 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
395 with TGUISwitch(menu
.GetControl('swVSync')) do
396 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
398 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
399 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
401 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
403 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
404 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
405 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
407 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
408 if gMuteWhenInactive
then
413 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
415 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
416 if gSoundEffectsDF
then
421 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
422 if gUseChatSounds
then
427 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
430 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
431 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
432 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
433 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
434 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
435 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
436 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
437 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
438 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
439 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
441 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
442 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
443 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
445 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
446 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
447 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
448 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
449 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
450 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
453 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
456 for i
:= WP_FIRST
to WP_LAST
do
458 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
459 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
463 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
466 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
467 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
468 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
469 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
470 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
471 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
472 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
473 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
474 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
477 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
478 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
481 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
482 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
489 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
492 for i
:= WP_FIRST
to WP_LAST
do
494 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
495 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
499 if e_HasJoysticks
then
501 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
504 for i
:= 0 to e_MaxJoys
- 1 do
505 if e_JoystickAvailable
[i
] then
506 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
510 if g_touch_enabled
then
512 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
513 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
514 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
515 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
516 with TGUISwitch(menu
.GetControl('swTouchFire')) do
517 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
518 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
521 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
524 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
525 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
526 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
527 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
530 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
532 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
533 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
534 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
535 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
536 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
538 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
541 with TGUISwitch(menu
.GetControl('swBloodType')) do
542 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
544 with TGUISwitch(menu
.GetControl('swCorpseType')) do
545 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
547 with TGUISwitch(menu
.GetControl('swGibsType')) do
548 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
550 with TGUISwitch(menu
.GetControl('swGibsCount')) do
559 with TGUISwitch(menu
.GetControl('swBackGround')) do
560 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
562 with TGUISwitch(menu
.GetControl('swMessages')) do
563 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
565 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
566 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
568 with TGUISwitch(menu
.GetControl('swChatBubble')) do
569 ItemIndex
:= gChatBubble
;
571 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
572 if gPlayerIndicator
then ItemIndex
:= 0 else ItemIndex
:= 1;
574 TempScale
:= Round(g_dbg_scale
- 1);
575 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
577 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
579 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
580 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
582 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
583 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
585 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
586 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
587 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
589 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
591 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
592 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
594 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
595 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
597 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
598 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
599 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
601 ProcSelectModel(nil);
604 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
606 // don't turn off monsters in DM
608 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
609 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
610 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
612 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
615 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
616 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
617 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
618 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
622 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
624 // don't turn off monsters in DM
626 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
627 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
628 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
630 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
633 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
634 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
635 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
636 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
640 procedure ProcStartCustomGame();
646 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
648 Map
:= TGUILabel(GetControl('lbMap')).Text;
651 if not isWadPath(Map
) then
654 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
655 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
656 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
657 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
658 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
660 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
661 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
662 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
663 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
666 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
668 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
670 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
672 Options
:= Options
or GAME_OPTION_MONSTERS
;
673 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
675 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
677 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
678 gcBotsVS
:= 'Monsters';
681 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
682 gcBotsVS
:= 'Everybody';
685 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
686 gcBotsVS
:= 'Players';
693 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
695 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
696 gcMaxLives
, Options
, gcPlayers
);
700 procedure ProcStartNetGame();
706 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
708 Map
:= TGUILabel(GetControl('lbMap')).Text;
711 if not isWadPath(Map
) then
714 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
715 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
716 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
717 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
718 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
719 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
721 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
722 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
723 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
724 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
727 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
729 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
731 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
733 Options
:= Options
or GAME_OPTION_MONSTERS
;
734 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
736 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
738 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
739 gnBotsVS
:= 'Monsters';
742 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
743 gnBotsVS
:= 'Everybody';
746 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
747 gnBotsVS
:= 'Players';
752 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
753 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
754 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
755 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
756 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
759 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
760 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
762 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
763 Options
, gnPlayers
, 0, NetPort
);
766 procedure ProcConnectNetGame();
770 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
772 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
773 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
774 PW
:= TGUIEdit(GetControl('edPW')).Text;
777 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
778 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
781 procedure ProcEnterPassword();
785 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
787 NetClientIP
:= PromptIP
;
788 NetClientPort
:= PromptPort
;
789 PW
:= TGUIEdit(GetControl('edPW')).Text;
792 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
793 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
796 procedure ProcServerlist();
798 if not NetInitDone
then
800 if (not g_Net_Init()) then
802 g_Console_Add('NET: ERROR: Failed to init ENet!');
809 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
811 gState
:= STATE_SLIST
;
812 g_ActiveWindow
:= nil;
814 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
819 slReturnPressed
:= True;
820 if g_Net_Slist_Fetch(slCurrent
) then
822 if slCurrent
= nil then
823 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
826 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
827 g_Serverlist_GenerateTable(slCurrent
, slTable
);
830 procedure ProcStartCampaign();
836 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
838 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
839 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
846 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
849 procedure ProcSelectMap(Sender
: TGUIControl
);
853 wad
, map
, res
: String;
855 win
:= g_GUI_GetWindow('SelectMapMenu');
856 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
858 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
859 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
861 if (wad
= '') or (map
= '') then
862 begin // Ýòî íå êàðòà
863 TGUILabel(GetControl('lbMapName')).Text := '';
864 TGUILabel(GetControl('lbMapAuthor')).Text := '';
865 TGUILabel(GetControl('lbMapSize')).Text := '';
866 TGUIMemo(GetControl('meMapDescription')).SetText('');
867 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
868 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
874 a
:= g_Map_GetMapInfo(res
);
876 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
877 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
878 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
879 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
880 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
881 TGUILabel(win
.GetControl('lbMapScale')).Text :=
882 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
887 procedure ProcSelectWAD(Sender
: TGUIControl
);
892 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
894 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
896 with TGUIListBox(GetControl('lsMapRes')) do
902 list
:= g_Map_GetMapsList(wad
);
916 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
922 win
:= g_GUI_GetWindow('CampaignMenu');
923 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
925 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
929 TGUILabel(GetControl('lbWADName')).Text := '';
930 TGUILabel(GetControl('lbWADAuthor')).Text := '';
931 TGUIMemo(GetControl('meWADDescription')).SetText('');
934 a
:= g_Game_GetMegaWADInfo(wad
);
936 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
937 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
938 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
940 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
944 fn
:= g_ExtractWadName(a
.pic
);
946 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
948 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
953 procedure ProcChangeColor(Sender
: TGUIControl
);
957 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
958 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
959 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
960 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
961 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
962 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
964 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
965 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
966 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
967 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
968 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
969 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
972 procedure ProcSelectModel(Sender
: TGUIControl
);
977 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
978 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
979 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
981 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
982 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
983 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
985 ProcChangeColor(nil);
988 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
1000 wad
:= TWADFile
.Create
;
1001 if wad
.ReadFile(GameWAD
) then
1002 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
1007 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
1009 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1010 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1011 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1012 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1014 if g_Texture_Get('FONT_STD', ID
) then
1015 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
1020 if cfglen
<> 0 then FreeMem(cfgdata
);
1023 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
1029 cfgdata
, fntdata
: Pointer;
1030 cfglen
, fntlen
: Integer;
1038 wad
:= TWADFile
.Create
;
1039 if wad
.ReadFile(GameWAD
) then
1041 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1042 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1048 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1049 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1050 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1052 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1053 FontID
:= e_CharFont_Create(spc
);
1055 for a
:= 0 to 255 do
1057 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1058 if chrwidth
= 0 then Continue
;
1060 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1062 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1068 if cfglen
<> 0 then FreeMem(cfgdata
);
1069 if fntlen
<> 0 then FreeMem(fntdata
);
1072 procedure MenuLoadData();
1074 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1076 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1077 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1078 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1079 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1080 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1081 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1082 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1083 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1084 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1085 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1086 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1087 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1088 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1089 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1090 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1091 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1092 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1093 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1094 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1095 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1096 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1097 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1098 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1099 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1100 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1102 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1103 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1104 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1105 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1106 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1107 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1108 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1111 procedure MenuFreeData();
1113 e_CharFont_Remove(gMenuFont
);
1114 e_CharFont_Remove(gMenuSmallFont
);
1116 g_Texture_Delete('MAINMENU_LOGO');
1117 g_Texture_Delete('MAINMENU_MARKER1');
1118 g_Texture_Delete('MAINMENU_MARKER2');
1119 g_Texture_Delete('SCROLL_LEFT');
1120 g_Texture_Delete('SCROLL_RIGHT');
1121 g_Texture_Delete('SCROLL_MIDDLE');
1122 g_Texture_Delete('SCROLL_MARKER');
1123 g_Texture_Delete('EDIT_LEFT');
1124 g_Texture_Delete('EDIT_RIGHT');
1125 g_Texture_Delete('EDIT_MIDDLE');
1126 g_Texture_Delete('BOX1');
1127 g_Texture_Delete('BOX2');
1128 g_Texture_Delete('BOX3');
1129 g_Texture_Delete('BOX4');
1130 g_Texture_Delete('BOX5');
1131 g_Texture_Delete('BOX6');
1132 g_Texture_Delete('BOX7');
1133 g_Texture_Delete('BOX8');
1134 g_Texture_Delete('BOX9');
1135 g_Texture_Delete('BSCROLL_UP_A');
1136 g_Texture_Delete('BSCROLL_UP_U');
1137 g_Texture_Delete('BSCROLL_DOWN_A');
1138 g_Texture_Delete('BSCROLL_DOWN_U');
1139 g_Texture_Delete('BSCROLL_MIDDLE');
1140 g_Texture_Delete('NOPIC');
1142 g_Sound_Delete('MENU_SELECT');
1143 g_Sound_Delete('MENU_OPEN');
1144 g_Sound_Delete('MENU_CLOSE');
1145 g_Sound_Delete('MENU_CHANGE');
1146 g_Sound_Delete('SCROLL_ADD');
1147 g_Sound_Delete('SCROLL_SUB');
1148 g_Sound_Delete('SOUND_PLAYER_FALL');
1151 procedure ProcAuthorsMenu();
1153 gMusic
.SetByName('MUSIC_INTERMUS');
1157 procedure ProcExitMenuKeyDown (yes
: Boolean);
1160 snd
: TPlayableSound
;
1165 g_Game_StopAllSounds(True);
1166 case (Random(18)) of
1167 0: s
:= 'SOUND_MONSTER_PAIN';
1168 1: s
:= 'SOUND_MONSTER_DIE_3';
1169 2: s
:= 'SOUND_MONSTER_SLOP';
1170 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1171 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1172 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1173 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1174 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1175 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1176 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1177 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1178 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1179 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1180 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1181 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1182 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1183 else s
:= 'SOUND_PLAYER_FALL';
1185 snd
:= TPlayableSound
.Create();
1186 res
:= snd
.SetByName(s
);
1187 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1191 while snd
.IsPlaying() do begin end;
1199 procedure ProcLoadMenu();
1206 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1207 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1208 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1212 procedure ProcSaveMenu();
1220 name
:= g_GetSaveName(a
, valid
);
1221 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1222 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1226 procedure ProcSaveGame(Sender
: TGUIControl
);
1230 if g_Game_IsNet
then Exit
;
1231 if g_Game_IsTestMap
then Exit
;
1232 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1233 g_Game_PauseAllSounds(True);
1234 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1236 g_ActiveWindow
:= nil;
1237 g_Game_Pause(False);
1240 procedure ProcLoadGame(Sender
: TGUIControl
);
1244 if g_Game_IsNet
then Exit
;
1245 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1246 if g_LoadGame(a
) then
1248 g_Game_PauseAllSounds(False)
1250 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1252 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1253 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1254 //g_ActiveWindow := nil;
1258 procedure ProcSingle1Player();
1260 g_Game_StartSingle(gDefaultMegawadStart
, False, 1);
1263 procedure ProcSingle2Players();
1265 g_Game_StartSingle(gDefaultMegawadStart
, True, 2);
1268 procedure ProcSelectMapMenu();
1271 wad_lb
: TGUIFileListBox
;
1272 map_lb
: TGUIListBox
;
1275 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1276 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1277 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1279 if wad_lb
.SelectedItem() <> '' then
1280 map
:= map_lb
.SelectedItem()
1284 wad_lb
.UpdateFileList();
1287 if wad_lb
.SelectedItem() <> '' then
1290 map_lb
.SelectItem(map
);
1292 if map_lb
.SelectedItem() <> '' then
1296 g_GUI_ShowWindow('SelectMapMenu');
1299 procedure ProcSelectCampaignMenu();
1302 wad_lb
: TGUIFileListBox
;
1304 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1305 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1307 wad_lb
.UpdateFileList();
1309 if wad_lb
.SelectedItem() <> '' then
1310 ProcSelectCampaignWAD(nil);
1313 procedure ProcSetMap();
1315 wad
, map
, res
: String;
1317 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1319 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1320 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1323 if (wad
= '') or (map
= '') then
1326 res
:= wad
+':\'+map
;
1328 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1329 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1332 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1336 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1338 g_Sound_SetupAllVolumes(
1339 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1340 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1344 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1348 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1349 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1351 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1352 g_dbg_scale
:= TempScale
+ 1;
1356 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1360 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1361 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1362 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1363 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1366 procedure ProcOptionsPlayersMIMenu();
1371 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1373 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1375 if a
= '' then Exit
;
1377 b
:= g_PlayerModel_GetInfo(a
);
1379 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1381 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1382 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1383 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1385 if b
.HaveWeapon
then
1386 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1388 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1391 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1394 procedure ProcOptionsPlayersAnim();
1398 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1403 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1406 Model
.GetCurrentAnimation
.Loop
:= True;
1407 Model
.GetCurrentAnimationMask
.Loop
:= True;
1411 procedure ProcOptionsPlayersWeap();
1415 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1420 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1424 procedure ProcOptionsPlayersRot();
1428 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1429 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1431 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1435 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1439 g_Options_SetDefault();
1445 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1447 if yes
then ReadOptions();
1451 procedure ProcAuthorsClose();
1453 gMusic
.SetByName('MUSIC_MENU');
1455 gState
:= STATE_MENU
;
1458 procedure ProcGMClose();
1460 g_Game_InGameMenu(False);
1463 procedure ProcGMShow();
1468 if (gGameSettings
.GameType
= GT_SINGLE
) and
1469 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1470 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1471 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1473 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1474 if g_Game_IsTestMap
then
1475 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1476 TGUIMainMenu(g_ActiveWindow
.GetControl(
1477 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1480 procedure ProcChangePlayers();
1482 TeamGame
, Spectator
, AddTwo
: Boolean;
1483 P1Team
{, P2Team}: Byte;
1484 bP2
: TGUITextButton
;
1486 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1487 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1488 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1489 P1Team
:= TEAM_NONE
;
1490 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1492 //P2Team := TEAM_NONE;
1493 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1495 TGUIMainMenu(g_ActiveWindow
.GetControl(
1496 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1497 TGUIMainMenu(g_ActiveWindow
.GetControl(
1498 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1499 TGUIMainMenu(g_ActiveWindow
.GetControl(
1500 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1502 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1503 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1504 bP2
.Enabled
:= AddTwo
and not Spectator
;
1506 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1508 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1509 if gPlayer2
= nil then
1510 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1512 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1514 TGUIMainMenu(g_ActiveWindow
.GetControl(
1515 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1518 procedure ProcJoinRed();
1520 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1522 if g_Game_IsServer
then
1524 if gPlayer1
= nil then
1525 g_Game_AddPlayer(TEAM_RED
)
1528 if gPlayer1
.Team
<> TEAM_RED
then
1530 gPlayer1
.SwitchTeam
;
1531 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1534 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1539 gPlayer1Settings
.Team
:= TEAM_RED
;
1540 MC_SEND_PlayerSettings
;
1541 if gPlayer1
= nil then
1542 g_Game_AddPlayer(TEAM_RED
);
1544 g_ActiveWindow
:= nil;
1545 g_Game_Pause(False);
1548 procedure ProcJoinBlue();
1550 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1552 if g_Game_IsServer
then
1554 if gPlayer1
= nil then
1555 g_Game_AddPlayer(TEAM_BLUE
)
1558 if gPlayer1
.Team
<> TEAM_BLUE
then
1560 gPlayer1
.SwitchTeam
;
1561 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1564 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1569 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1570 MC_SEND_PlayerSettings
;
1571 if gPlayer1
= nil then
1572 g_Game_AddPlayer(TEAM_BLUE
);
1574 g_ActiveWindow
:= nil;
1575 g_Game_Pause(False);
1578 procedure ProcJoinGame();
1580 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1582 if gPlayer1
= nil then
1584 g_ActiveWindow
:= nil;
1585 g_Game_Pause(False);
1588 procedure ProcSwitchP2();
1590 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1592 if gPlayer1
= nil then
1594 if gPlayer2
= nil then
1597 g_Game_RemovePlayer();
1598 g_ActiveWindow
:= nil;
1599 g_Game_Pause(False);
1602 procedure ProcSpectate();
1604 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1607 g_ActiveWindow
:= nil;
1608 g_Game_Pause(False);
1611 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1613 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1616 procedure ProcEndMenuKeyDown (yes
: Boolean);
1618 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1621 procedure ProcSetRussianLanguage();
1623 if gLanguage
<> LANGUAGE_RUSSIAN
then
1625 gLanguage
:= LANGUAGE_RUSSIAN
;
1626 gLanguageChange
:= True;
1627 gAskLanguage
:= False;
1629 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1631 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1636 procedure ProcSetEnglishLanguage();
1638 if gLanguage
<> LANGUAGE_ENGLISH
then
1640 gLanguage
:= LANGUAGE_ENGLISH
;
1641 gLanguageChange
:= True;
1642 gAskLanguage
:= False;
1644 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1646 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1651 procedure ReadGameSettings();
1655 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1657 with gGameSettings
do
1659 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1660 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1665 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1666 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1667 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1669 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1670 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1671 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1674 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1679 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1681 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1682 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1683 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1684 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1685 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1686 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1687 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1688 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1692 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1693 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1698 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1699 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1704 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1705 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1710 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1711 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1716 procedure ProcApplyGameSet();
1720 stat
: TPlayerStatArray
;
1722 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1724 if not g_Game_IsServer
then Exit
;
1726 with gGameSettings
do
1728 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1730 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1731 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1733 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1736 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1738 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1744 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1746 TimeLimit
:= Max(n
, b
);
1750 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1752 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1759 if GameMode
= GM_DM
then
1761 stat
:= g_Player_GetStats();
1763 for a
:= 0 to High(stat
) do
1764 if stat
[a
].Frags
> b
then
1768 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1770 GoalLimit
:= Max(n
, b
);
1774 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1776 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1777 if n
< 0 then n
:= 0;
1778 if n
> 255 then n
:= 255;
1784 stat
:= g_Player_GetStats();
1786 for a
:= 0 to High(stat
) do
1787 if stat
[a
].Lives
> b
then
1790 MaxLives
:= Max(n
, b
);
1794 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1796 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1799 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1800 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1804 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1805 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1809 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1810 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1816 if g_Game_IsNet
then MH_SEND_GameSettings
;
1819 procedure ProcVideoOptionsRes();
1825 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1827 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1828 IntToStr(gScreenWidth
) +
1829 ' x ' + IntToStr(gScreenHeight
) +
1830 ', ' + IntToStr(gBPP
) + ' bpp';
1832 with TGUIListBox(menu
.GetControl('lsResolution')) do
1834 list
:= GetDisplayModes(gBPP
, SR
);
1845 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1852 procedure ProcApplyVideoOptions();
1855 Fullscreen
: Boolean;
1856 SWidth
, SHeight
: Integer;
1859 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1861 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1862 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1864 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1866 if (SWidth
<> gScreenWidth
) or
1867 (SHeight
<> gScreenHeight
) or
1868 (Fullscreen
<> gFullscreen
) then
1870 gResolutionChange
:= True;
1871 gRC_Width
:= SWidth
;
1872 gRC_Height
:= SHeight
;
1873 gRC_FullScreen
:= Fullscreen
;
1874 gRC_Maximized
:= gWinMaximized
;
1877 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1881 procedure ProcSetFirstRussianLanguage();
1883 gLanguage
:= LANGUAGE_RUSSIAN
;
1884 gLanguageChange
:= True;
1885 gAskLanguage
:= False;
1887 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1890 procedure ProcSetFirstEnglishLanguage();
1892 gLanguage
:= LANGUAGE_ENGLISH
;
1893 gLanguageChange
:= True;
1894 gAskLanguage
:= False;
1896 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1899 procedure ProcRecallAddress();
1901 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1903 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1904 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1908 procedure CreateFirstLanguageMenu();
1912 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1914 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1916 Name
:= 'mmFirstLanguageMenu';
1917 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1918 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1921 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1922 Menu
.MainWindow
:= True;
1923 g_GUI_AddWindow(Menu
);
1926 procedure g_Menu_AskLanguage();
1928 CreateFirstLanguageMenu();
1929 g_GUI_ShowWindow('FirstLanguageMenu');
1932 procedure CreatePlayerOptionsMenu(s
: String);
1937 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1939 a
:= _lc
[I_MENU_PLAYER_1
]
1941 a
:= _lc
[I_MENU_PLAYER_2
];
1942 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1944 Name
:= 'mOptionsPlayers'+s
+'Menu';
1945 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1947 Name
:= 'ed'+s
+'Name';
1951 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1953 Name
:= 'sw'+s
+'Team';
1954 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1955 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1957 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1959 Name
:= 'ls'+s
+'Model';
1961 Items
:= g_PlayerModel_GetNames();
1962 OnChange
:= ProcSelectModel
;
1964 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1966 Name
:= 'sc'+s
+'Red';
1968 OnChange
:= ProcChangeColor
;
1970 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1972 Name
:= 'sc'+s
+'Green';
1974 OnChange
:= ProcChangeColor
;
1976 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1978 Name
:= 'sc'+s
+'Blue';
1980 OnChange
:= ProcChangeColor
;
1983 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1984 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1985 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1986 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1988 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1990 Name
:= 'mv'+s
+'Model';
1991 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1992 Y
:= GetControl('ls'+s
+'Model').Y
;
1995 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1996 g_GUI_AddWindow(Menu
);
1999 procedure CreateAllMenus();
2003 a
, cx
, _y
, i
: Integer;
2006 Menu
:= TGUIWindow
.Create('MainMenu');
2007 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2009 Name
:= 'mmMainMenu';
2010 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2011 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2012 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2013 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2014 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2015 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2017 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2019 Color
:= _RGB(255, 255, 255);
2020 X
:= gScreenWidth
-GetWidth
-8;
2021 Y
:= gScreenHeight
-GetHeight
-8;
2023 Menu
.DefControl
:= 'mmMainMenu';
2024 Menu
.MainWindow
:= True;
2025 g_GUI_AddWindow(Menu
);
2027 Menu
:= TGUIWindow
.Create('NewGameMenu');
2028 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2030 Name
:= 'mmNewGameMenu';
2031 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2032 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2033 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2034 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2036 Menu
.DefControl
:= 'mmNewGameMenu';
2037 g_GUI_AddWindow(Menu
);
2039 Menu
:= TGUIWindow
.Create('NetGameMenu');
2040 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2042 Name
:= 'mmNetGameMenu';
2043 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2044 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2046 Menu
.DefControl
:= 'mmNetGameMenu';
2047 g_GUI_AddWindow(Menu
);
2049 Menu
:= TGUIWindow
.Create('NetServerMenu');
2050 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2052 Name
:= 'mNetServerMenu';
2053 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2055 Name
:= 'edSrvName';
2056 OnlyDigits
:= False;
2059 Text := NetServerName
;
2061 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2063 Name
:= 'edSrvPassword';
2064 OnlyDigits
:= False;
2067 Text := NetPassword
;
2069 with AddEdit(_lc
[I_NET_PORT
]) do
2075 Text := IntToStr(NetPort
);
2077 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2079 Name
:= 'edMaxPlayers';
2083 Text := IntToStr(NetMaxClients
);
2085 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2087 Name
:= 'swUseMaster';
2088 AddItem(_lc
[I_MENU_YES
]);
2089 AddItem(_lc
[I_MENU_NO
]);
2090 if NetUseMaster
then
2096 with AddLabel(_lc
[I_MENU_MAP
]) do
2101 OnClick
:= @ProcSelectMapMenu
;
2103 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2105 Name
:= 'swGameMode';
2106 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2107 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2108 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2109 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2110 case g_Game_TextToMode(gnGameMode
) of
2112 GM_DM
: ItemIndex
:= 0;
2113 GM_TDM
: ItemIndex
:= 1;
2114 GM_CTF
: ItemIndex
:= 2;
2116 GM_COOP
: ItemIndex
:= 3;
2118 OnChange
:= ProcSwitchMonstersNet
;
2120 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2122 Name
:= 'edTimeLimit';
2126 if gnTimeLimit
> 0 then
2127 Text := IntToStr(gnTimeLimit
);
2129 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2131 Name
:= 'edGoalLimit';
2135 if gnGoalLimit
> 0 then
2136 Text := IntToStr(gnGoalLimit
);
2138 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2140 Name
:= 'edMaxLives';
2144 if gnMaxLives
> 0 then
2145 Text := IntToStr(gnMaxLives
);
2147 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2149 Name
:= 'swPlayers';
2150 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2151 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2152 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2153 ItemIndex
:= gnPlayers
;
2155 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2157 Name
:= 'swTeamDamage';
2158 AddItem(_lc
[I_MENU_YES
]);
2159 AddItem(_lc
[I_MENU_NO
]);
2160 if gnTeamDamage
then
2165 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2167 Name
:= 'swEnableExits';
2168 AddItem(_lc
[I_MENU_YES
]);
2169 AddItem(_lc
[I_MENU_NO
]);
2175 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2177 Name
:= 'swWeaponStay';
2178 AddItem(_lc
[I_MENU_YES
]);
2179 AddItem(_lc
[I_MENU_NO
]);
2180 if gnWeaponStay
then
2185 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2187 Name
:= 'swMonsters';
2188 AddItem(_lc
[I_MENU_YES
]);
2189 AddItem(_lc
[I_MENU_NO
]);
2195 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2198 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2199 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2200 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2202 if gnBotsVS
= 'Players' then
2204 if gnBotsVS
= 'Monsters' then
2208 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2212 Menu
.DefControl
:= 'mNetServerMenu';
2213 g_GUI_AddWindow(Menu
);
2215 Menu
:= TGUIWindow
.Create('NetClientMenu');
2216 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2218 Name
:= 'mNetClientMenu';
2220 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2223 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2229 Text := 'localhost';
2231 with AddEdit(_lc
[I_NET_PORT
]) do
2239 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2242 OnlyDigits
:= False;
2249 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2253 Menu
.DefControl
:= 'mNetClientMenu';
2254 g_GUI_AddWindow(Menu
);
2256 Menu
:= TGUIWindow
.Create('LoadMenu');
2257 Menu
.OnShow
:= ProcLoadMenu
;
2258 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2260 Name
:= 'mmLoadMenu';
2265 Name
:= 'edSlot'+IntToStr(a
);
2268 OnEnter
:= ProcLoadGame
;
2271 Menu
.DefControl
:= 'mmLoadMenu';
2272 g_GUI_AddWindow(Menu
);
2274 Menu
:= TGUIWindow
.Create('SaveMenu');
2275 Menu
.OnShow
:= ProcSaveMenu
;
2276 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2278 Name
:= 'mmSaveMenu';
2283 Name
:= 'edSlot'+IntToStr(a
);
2286 OnChange
:= ProcSaveGame
;
2289 Menu
.DefControl
:= 'mmSaveMenu';
2290 g_GUI_AddWindow(Menu
);
2292 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2293 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2295 Name
:= 'mCustomGameMenu';
2296 with AddLabel(_lc
[I_MENU_MAP
]) do
2301 OnClick
:= @ProcSelectMapMenu
;
2303 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2305 Name
:= 'swGameMode';
2306 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2307 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2308 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2309 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2310 case g_Game_TextToMode(gcGameMode
) of
2312 GM_DM
: ItemIndex
:= 0;
2313 GM_TDM
: ItemIndex
:= 1;
2314 GM_CTF
: ItemIndex
:= 2;
2316 GM_COOP
: ItemIndex
:= 3;
2318 OnChange
:= ProcSwitchMonstersCustom
;
2320 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2322 Name
:= 'edTimeLimit';
2326 if gcTimeLimit
> 0 then
2327 Text := IntToStr(gcTimeLimit
);
2329 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2331 Name
:= 'edGoalLimit';
2335 if gcGoalLimit
> 0 then
2336 Text := IntToStr(gcGoalLimit
);
2338 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2340 Name
:= 'edMaxLives';
2344 if gcMaxLives
> 0 then
2345 Text := IntToStr(gcMaxLives
);
2347 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2349 Name
:= 'swPlayers';
2350 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2351 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2352 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2353 ItemIndex
:= gcPlayers
;
2355 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2357 Name
:= 'swTeamDamage';
2358 AddItem(_lc
[I_MENU_YES
]);
2359 AddItem(_lc
[I_MENU_NO
]);
2360 if gcTeamDamage
then
2365 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2367 Name
:= 'swEnableExits';
2368 AddItem(_lc
[I_MENU_YES
]);
2369 AddItem(_lc
[I_MENU_NO
]);
2375 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2377 Name
:= 'swWeaponStay';
2378 AddItem(_lc
[I_MENU_YES
]);
2379 AddItem(_lc
[I_MENU_NO
]);
2380 if gcWeaponStay
then
2385 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2387 Name
:= 'swMonsters';
2388 AddItem(_lc
[I_MENU_YES
]);
2389 AddItem(_lc
[I_MENU_NO
]);
2395 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2398 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2399 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2400 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2402 if gcBotsVS
= 'Players' then
2404 if gcBotsVS
= 'Monsters' then
2408 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2412 Menu
.DefControl
:= 'mCustomGameMenu';
2413 g_GUI_AddWindow(Menu
);
2415 Menu
:= TGUIWindow
.Create('CampaignMenu');
2416 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2418 Name
:= 'mCampaignMenu';
2427 with AddFileList('', 15, 4) do
2430 OnChange
:= ProcSelectCampaignWAD
;
2434 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2435 SetBase(MapsDir
+'megawads/');
2438 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2440 Name
:= 'lbWADName';
2444 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2446 Name
:= 'lbWADAuthor';
2450 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2451 with AddMemo('', 15, 3) do
2453 Name
:= 'meWADDescription';
2454 Color
:= MENU_ITEMSCTRL_COLOR
;
2456 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2458 Name
:= 'swPlayers';
2459 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2460 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2463 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2467 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2469 Name
:= 'mpWADImage';
2470 DefaultRes
:= 'NOPIC';
2471 X
:= GetControl('lsWAD').X
+4;
2472 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2475 Menu
.DefControl
:= 'mCampaignMenu';
2476 g_GUI_AddWindow(Menu
);
2478 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2479 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2481 Name
:= 'mSelectMapMenu';
2482 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2485 OnChange
:= ProcSelectWAD
;
2489 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2492 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2496 OnChange
:= ProcSelectMap
;
2499 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2501 Name
:= 'lbMapName';
2505 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2507 Name
:= 'lbMapAuthor';
2511 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2513 Name
:= 'lbMapSize';
2517 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2519 Name
:= 'meMapDescription';
2524 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2526 Name
:= 'mpMapPreview';
2527 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2528 Y
:= GetControl('lsMapWAD').Y
;
2530 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2532 Name
:= 'lbMapScale';
2535 Color
:= MENU_ITEMSCTRL_COLOR
;
2536 X
:= GetControl('lsMapWAD').X
+
2537 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2538 2 + MAPPREVIEW_WIDTH
*4;
2539 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2542 Menu
.OnClose
:= ProcSetMap
;
2543 Menu
.DefControl
:= 'mSelectMapMenu';
2544 g_GUI_AddWindow(Menu
);
2546 Menu
:= TGUIWindow
.Create('OptionsMenu');
2547 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2549 Name
:= 'mmOptionsMenu';
2550 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2551 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2552 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2553 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2554 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2555 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2557 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2558 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2560 Menu
.OnClose
:= ProcApplyOptions
;
2561 Menu
.DefControl
:= 'mmOptionsMenu';
2562 g_GUI_AddWindow(Menu
);
2564 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2565 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2566 g_GUI_AddWindow(Menu
);
2568 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2569 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2571 Name
:= 'mOptionsVideoMenu';
2572 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2573 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2579 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2582 AddItem(_lc
[I_MENU_YES
]);
2583 AddItem(_lc
[I_MENU_NO
]);
2585 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2587 Name
:= 'swTextureFilter';
2588 AddItem(_lc
[I_MENU_YES
]);
2589 AddItem(_lc
[I_MENU_NO
]);
2591 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2593 Name
:= 'swLegacyNPOT';
2594 AddItem(_lc
[I_MENU_NO
]);
2595 AddItem(_lc
[I_MENU_YES
]);
2598 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2601 Menu
.DefControl
:= 'mOptionsVideoMenu';
2602 g_GUI_AddWindow(Menu
);
2604 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2605 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2607 Name
:= 'mOptionsVideoResMenu';
2608 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2610 Name
:= 'lbCurrentRes';
2614 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2616 Name
:= 'lsResolution';
2619 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2621 Name
:= 'swFullScreen';
2622 AddItem(_lc
[I_MENU_YES
]);
2623 AddItem(_lc
[I_MENU_NO
]);
2626 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2629 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2630 g_GUI_AddWindow(Menu
);
2632 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2633 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2635 Name
:= 'mOptionsSoundMenu';
2636 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2638 Name
:= 'scMusicLevel';
2640 OnChange
:= ProcChangeSoundSettings
;
2642 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2644 Name
:= 'scSoundLevel';
2646 OnChange
:= ProcChangeSoundSettings
;
2648 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2650 Name
:= 'scMaxSimSounds';
2653 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2655 Name
:= 'swAnnouncer';
2656 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2657 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2658 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2659 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2661 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2662 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2664 Name
:= 'swSoundEffects';
2665 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2666 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2668 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2669 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2671 Name
:= 'swChatSpeech';
2672 AddItem(_lc
[I_MENU_YES
]);
2673 AddItem(_lc
[I_MENU_NO
]);
2675 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2677 Name
:= 'swInactiveSounds';
2678 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2679 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2683 Menu
.DefControl
:= 'mOptionsSoundMenu';
2684 g_GUI_AddWindow(Menu
);
2686 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2687 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2689 Name
:= 'mOptionsGameMenu';
2690 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2692 Name
:= 'scParticlesCount';
2695 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2697 Name
:= 'swBloodCount';
2698 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2699 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2700 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2701 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2702 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2704 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2706 Name
:= 'scShellsMax';
2709 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2711 Name
:= 'scGibsMax';
2714 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2716 Name
:= 'scCorpsesMax';
2719 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2721 Name
:= 'swGibsCount';
2722 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2723 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2724 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2725 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2726 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2728 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2730 Name
:= 'swCorpseType';
2731 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2732 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2734 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2736 Name
:= 'swGibsType';
2737 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2738 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2740 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2742 Name
:= 'swBloodType';
2743 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2744 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2746 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2748 Name
:= 'swScreenFlash';
2749 AddItem(_lc
[I_MENU_NO
]);
2750 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2751 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2753 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2755 Name
:= 'swBackground';
2756 AddItem(_lc
[I_MENU_YES
]);
2757 AddItem(_lc
[I_MENU_NO
]);
2759 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2761 Name
:= 'swMessages';
2762 AddItem(_lc
[I_MENU_YES
]);
2763 AddItem(_lc
[I_MENU_NO
]);
2765 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2767 Name
:= 'swRevertPlayers';
2768 AddItem(_lc
[I_MENU_YES
]);
2769 AddItem(_lc
[I_MENU_NO
]);
2771 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2773 Name
:= 'swChatBubble';
2774 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2775 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2776 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2777 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2778 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2780 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2782 Name
:= 'swPlayerIndicator';
2783 AddItem(_lc
[I_MENU_YES
]);
2784 AddItem(_lc
[I_MENU_NO
]);
2786 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2788 Name
:= 'scScaleFactor';
2790 OnChange
:= ProcChangeGameSettings
;
2794 Menu
.DefControl
:= 'mOptionsGameMenu';
2795 g_GUI_AddWindow(Menu
);
2797 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2798 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2800 Name
:= 'mOptionsControlsMenu';
2801 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2802 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2803 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2804 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2805 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2807 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2808 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2809 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2810 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2811 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2812 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2813 if e_HasJoysticks
then
2816 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2818 if g_touch_enabled
then
2821 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2824 Menu
.DefControl
:= 'mOptionsControlsMenu';
2825 g_GUI_AddWindow(Menu
);
2827 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2828 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2830 Name
:= 'mOptionsControlsP1Menu';
2831 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2832 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2833 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2834 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2835 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2836 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2837 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2838 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2839 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2840 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2842 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2843 g_GUI_AddWindow(Menu
);
2845 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2846 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2848 Name
:= 'mOptionsControlsP1MenuWeapons';
2849 for i
:= WP_FIRST
to WP_LAST
do
2850 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2851 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2853 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2854 g_GUI_AddWindow(Menu
);
2856 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2857 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2859 Name
:= 'mOptionsControlsP2Menu';
2860 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2861 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2862 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2863 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2864 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2865 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2866 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2867 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2868 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2869 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2871 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2872 g_GUI_AddWindow(Menu
);
2874 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2875 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2877 Name
:= 'mOptionsControlsP2MenuWeapons';
2878 for i
:= WP_FIRST
to WP_LAST
do
2879 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2880 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2882 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2883 g_GUI_AddWindow(Menu
);
2885 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2886 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2888 Name
:= 'mOptionsControlsJoystickMenu';
2889 for i
:= 0 to e_MaxJoys
- 1 do
2890 if e_JoystickAvailable
[i
] then
2891 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2893 Name
:= 'scDeadzone' + IntToStr(i
);
2897 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2898 g_GUI_AddWindow(Menu
);
2900 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2901 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2903 Name
:= 'mOptionsControlsTouchMenu';
2904 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
2906 Name
:= 'swTouchAlt';
2907 AddItem(_lc
[I_MENU_NO
]);
2908 AddItem(_lc
[I_MENU_YES
]);
2909 OnChange
:= ProcChangeTouchSettings
;
2911 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2913 Name
:= 'scTouchSize';
2915 OnChange
:= ProcChangeTouchSettings
;
2917 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2919 Name
:= 'swTouchFire';
2920 AddItem(_lc
[I_MENU_NO
]);
2921 AddItem(_lc
[I_MENU_YES
]);
2923 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
2925 Name
:= 'scTouchOffset';
2927 OnChange
:= ProcChangeTouchSettings
;
2930 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
2931 g_GUI_AddWindow(Menu
);
2933 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2934 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2936 Name
:= 'mOptionsPlayersMenu';
2937 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2938 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2940 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2941 g_GUI_AddWindow(Menu
);
2943 CreatePlayerOptionsMenu('P1');
2944 CreatePlayerOptionsMenu('P2');
2946 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2947 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2949 Name
:= 'mOptionsPlayersMIMenu';
2950 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2955 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2960 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2962 Name
:= 'meComment';
2965 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2966 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2969 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2973 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2974 g_GUI_AddWindow(Menu
);
2976 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2977 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2979 Name
:= 'mOptionsLanguageMenu';
2980 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2981 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2984 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2985 g_GUI_AddWindow(Menu
);
2987 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2988 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2989 g_GUI_AddWindow(Menu
);
2991 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2992 Menu
.BackTexture
:= 'INTER';
2993 Menu
.OnClose
:= ProcAuthorsClose
;
2997 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2999 Color
:= _RGB(255, 0, 0);
3000 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3002 _y
:= _y
+GetHeight();
3004 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3006 Color
:= _RGB(255, 0, 0);
3007 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3009 _y
:= _y
+GetHeight()+32;
3011 // ×òî äåëàë: Êòî äåëàë
3012 cx
:= gScreenWidth
div 2 - 320 + 64;
3013 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3015 Color
:= _RGB(255, 0, 0);
3020 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3022 Color
:= _RGB(255, 255, 255);
3027 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3029 Color
:= _RGB(255, 0, 0);
3034 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3036 Color
:= _RGB(255, 255, 255);
3041 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3043 Color
:= _RGB(255, 255, 255);
3048 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3050 Color
:= _RGB(255, 0, 0);
3055 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3057 Color
:= _RGB(255, 255, 255);
3062 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3064 Color
:= _RGB(255, 0, 0);
3069 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3071 Color
:= _RGB(255, 255, 255);
3074 _y
:= gScreenHeight
- 128;
3077 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3079 Color
:= _RGB(255, 0, 0);
3084 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3086 Color
:= _RGB(255, 255, 255);
3089 _y
:= _y
+GetHeight();
3091 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3093 Color
:= _RGB(255, 255, 255);
3096 _y
:= _y
+GetHeight();
3098 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3100 Color
:= _RGB(255, 255, 255);
3103 _y
:= gScreenHeight
- 32;
3105 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3107 Color
:= _RGB(255, 0, 0);
3108 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3111 g_GUI_AddWindow(Menu
);
3113 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3114 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3115 g_GUI_AddWindow(Menu
);
3117 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3118 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3120 Name
:= 'mmGameSingleMenu';
3121 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3122 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3123 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3124 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3125 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3126 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3128 Menu
.DefControl
:= 'mmGameSingleMenu';
3129 Menu
.MainWindow
:= True;
3130 Menu
.OnClose
:= ProcGMClose
;
3131 Menu
.OnShow
:= ProcGMShow
;
3132 g_GUI_AddWindow(Menu
);
3134 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3135 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3136 g_GUI_AddWindow(Menu
);
3138 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3139 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3140 g_GUI_AddWindow(Menu
);
3142 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3143 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3145 Name
:= 'mmGameCustomMenu';
3146 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3147 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3148 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3149 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3150 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3151 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3152 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3154 Menu
.DefControl
:= 'mmGameCustomMenu';
3155 Menu
.MainWindow
:= True;
3156 Menu
.OnClose
:= ProcGMClose
;
3157 Menu
.OnShow
:= ProcGMShow
;
3158 g_GUI_AddWindow(Menu
);
3160 Menu
:= TGUIWindow
.Create('GameServerMenu');
3161 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3163 Name
:= 'mmGameServerMenu';
3164 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3165 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3166 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3167 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3168 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3170 Menu
.DefControl
:= 'mmGameServerMenu';
3171 Menu
.MainWindow
:= True;
3172 Menu
.OnClose
:= ProcGMClose
;
3173 Menu
.OnShow
:= ProcGMShow
;
3174 g_GUI_AddWindow(Menu
);
3176 Menu
:= TGUIWindow
.Create('GameClientMenu');
3177 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3179 Name
:= 'mmGameClientMenu';
3180 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3181 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3182 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3184 Menu
.DefControl
:= 'mmGameClientMenu';
3185 Menu
.MainWindow
:= True;
3186 Menu
.OnClose
:= ProcGMClose
;
3187 Menu
.OnShow
:= ProcGMShow
;
3188 g_GUI_AddWindow(Menu
);
3190 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3191 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3193 Name
:= 'mClientPasswordMenu';
3194 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3202 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3205 Menu
.DefControl
:= 'mClientPasswordMenu';
3206 g_GUI_AddWindow(Menu
);
3208 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3209 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3211 Name
:= 'mGameSetGameMenu';
3212 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3214 Name
:= 'swTeamDamage';
3215 AddItem(_lc
[I_MENU_YES
]);
3216 AddItem(_lc
[I_MENU_NO
]);
3219 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3221 Name
:= 'edTimeLimit';
3226 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3228 Name
:= 'edGoalLimit';
3233 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3235 Name
:= 'edMaxLives';
3240 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3243 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3244 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3245 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3251 Menu
.DefControl
:= 'mGameSetGameMenu';
3252 Menu
.OnClose
:= ProcApplyGameSet
;
3253 g_GUI_AddWindow(Menu
);
3255 Menu
:= TGUIWindow
.Create('TeamMenu');
3256 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3258 Name
:= 'mmTeamMenu';
3259 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3260 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3261 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3262 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3263 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3265 Menu
.DefControl
:= 'mmTeamMenu';
3266 Menu
.OnShow
:= ProcChangePlayers
;
3267 g_GUI_AddWindow(Menu
);
3270 procedure g_Menu_Show_SaveMenu();
3272 if g_Game_IsTestMap
then
3274 if gGameSettings
.GameType
= GT_SINGLE
then
3275 g_GUI_ShowWindow('GameSingleMenu')
3278 if g_Game_IsClient
then
3281 if g_Game_IsNet
then
3284 g_GUI_ShowWindow('GameCustomMenu');
3286 g_GUI_ShowWindow('SaveMenu');
3287 g_Sound_PlayEx('MENU_OPEN');
3290 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3292 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3293 if gGameSettings
.GameType
= GT_SINGLE
then
3295 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3299 if g_Game_IsClient
then exit
;
3300 if g_Game_IsNet
then exit
;
3301 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3303 g_GUI_ShowWindow('LoadMenu');
3304 g_Sound_PlayEx('MENU_OPEN');
3307 procedure g_Menu_Show_GameSetGame();
3309 if gGameSettings
.GameType
= GT_SINGLE
then
3310 g_GUI_ShowWindow('GameSingleMenu')
3313 if g_Game_IsClient
then
3316 if g_Game_IsNet
then
3317 g_GUI_ShowWindow('GameServerMenu')
3319 g_GUI_ShowWindow('GameCustomMenu');
3322 g_GUI_ShowWindow('GameSetGameMenu');
3323 g_Sound_PlayEx('MENU_OPEN');
3326 procedure g_Menu_Show_OptionsVideo();
3328 if gGameSettings
.GameType
= GT_SINGLE
then
3329 g_GUI_ShowWindow('GameSingleMenu')
3332 if g_Game_IsClient
then
3333 g_GUI_ShowWindow('GameClientMenu')
3335 if g_Game_IsNet
then
3336 g_GUI_ShowWindow('GameServerMenu')
3338 g_GUI_ShowWindow('GameCustomMenu');
3341 g_GUI_ShowWindow('OptionsMenu');
3342 g_GUI_ShowWindow('OptionsVideoMenu');
3343 g_Sound_PlayEx('MENU_OPEN');
3346 procedure g_Menu_Show_OptionsSound();
3348 if gGameSettings
.GameType
= GT_SINGLE
then
3349 g_GUI_ShowWindow('GameSingleMenu')
3352 if g_Game_IsClient
then
3353 g_GUI_ShowWindow('GameClientMenu')
3355 if g_Game_IsNet
then
3356 g_GUI_ShowWindow('GameServerMenu')
3358 g_GUI_ShowWindow('GameCustomMenu');
3361 g_GUI_ShowWindow('OptionsMenu');
3362 g_GUI_ShowWindow('OptionsSoundMenu');
3363 g_Sound_PlayEx('MENU_OPEN');
3366 procedure g_Menu_Show_EndGameMenu();
3368 g_GUI_ShowWindow('EndGameMenu');
3369 g_Sound_PlayEx('MENU_OPEN');
3372 procedure g_Menu_Show_QuitGameMenu();
3374 g_GUI_ShowWindow('ExitMenu');
3375 g_Sound_PlayEx('MENU_OPEN');
3378 procedure g_Menu_Init();
3385 procedure g_Menu_Free();
3389 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3394 procedure g_Menu_Reset();
3398 g_GUI_SaveMenuPos();
3399 ex
:= g_GUI_Destroy();
3403 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3408 g_Game_SetDebugMode();
3410 g_GUI_LoadMenuPos();