1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../shared/a_modes.inc}
20 procedure g_Menu_Init();
21 procedure g_Menu_Free();
22 procedure g_Menu_Reset();
23 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
24 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
25 procedure g_Menu_AskLanguage();
27 procedure g_Menu_Show_SaveMenu();
28 procedure g_Menu_Show_LoadMenu(standalone
: Boolean=false);
29 procedure g_Menu_Show_GameSetGame();
30 procedure g_Menu_Show_OptionsVideo();
31 procedure g_Menu_Show_OptionsSound();
32 procedure g_Menu_Show_EndGameMenu();
33 procedure g_Menu_Show_QuitGameMenu();
37 gMenuSmallFont
: DWORD
;
40 TempScale
: Integer = -1;
41 TempResScale
: Integer = -1;
46 {$INCLUDE ../nogl/noGLuses.inc}
47 g_gui
, g_textures
, e_graphics
, g_main
, g_window
, g_game
, g_map
,
48 g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
, g_weapons
,
49 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
50 MAPDEF
, Math
, g_saveload
,
51 e_texture
, g_language
, e_res
,
52 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
, g_touch
,
53 utils
, wadreader
, g_system
;
56 type TYNCallback
= procedure (yes
:Boolean);
58 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
60 if win
.UserData
= nil then exit
;
62 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
63 IK_N
: TYNCallback(win
.UserData
)(false);
67 procedure YesButtonCB (ctl
: TGUITextButton
);
69 if ctl
.UserData
= nil then exit
;
70 TYNCallback(ctl
.UserData
)(true);
73 procedure NoButtonCB (ctl
: TGUITextButton
);
75 if ctl
.UserData
= nil then exit
;
76 TYNCallback(ctl
.UserData
)(false);
79 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
83 //if length(Text) = 0 then exit;
84 Result
:= TGUIWindow
.Create(WinName
);
87 //OnKeyDownEx := @YNKeyDownProc;
88 //UserData := @ActionProc;
89 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
92 Name
:= '__temp_yes_no_menu:'+WinName
;
94 AddText(Text, MaxLen
);
95 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
96 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
98 DefControl
:= '__temp_yes_no_menu:'+WinName
;
104 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
105 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
107 procedure ProcApplyOptions();
113 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
115 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
121 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
122 if (ovs
<> gVSync
) then
123 sys_EnableVSync(gVSync
);
125 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
126 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
128 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
130 g_Sound_SetupAllVolumes(
131 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
132 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
135 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
136 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
137 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
138 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
139 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
141 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
143 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
144 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
145 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
146 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
148 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
153 else gGibsCount
:= 48;
156 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
157 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
158 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
159 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
160 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
161 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
162 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
163 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
164 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
165 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
166 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
167 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
169 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
170 g_dbg_scale
:= TempScale
+ 1;
173 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
177 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
178 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
179 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
180 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
181 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
182 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
183 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
184 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
187 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
190 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
191 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
193 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
194 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
195 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
196 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
197 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
198 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
199 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
200 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
203 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
204 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
205 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
206 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext', '-p1_weapnext');
207 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev', '-p1_weapprev');
208 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
209 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
211 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
212 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
213 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
214 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
215 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
216 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
217 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
218 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
219 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
220 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
224 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext', '-p1_weapnext');
228 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev', '-p1_weapprev');
229 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
230 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
233 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
236 for i
:= WP_FIRST
to WP_LAST
do
238 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
239 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
240 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
241 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
245 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
248 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
249 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
250 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
251 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
252 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
253 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
254 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
255 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
256 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
257 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
258 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
259 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
260 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
261 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
262 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
263 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
264 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p2_weapnext', '-p2_weapnext');
265 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev', '-p2_weapprev');
266 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
267 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
269 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
270 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
271 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
272 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
273 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
274 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
275 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
276 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
277 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
278 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
279 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
282 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
283 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
284 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
285 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext', '-p2_weapnext');
286 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev', '-p2_weapprev');
287 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
288 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
291 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
294 for i
:= WP_FIRST
to WP_LAST
do
296 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
297 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
298 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
299 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
303 if e_HasJoysticks
then
305 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
308 for i
:= 0 to e_MaxJoys
- 1 do
309 if e_JoystickAvailable
[i
] then
310 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
314 if g_touch_enabled
then
316 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
317 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
318 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
319 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
320 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
323 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
325 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
326 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
327 TEAM_RED
, TEAM_BLUE
);
329 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
331 gPlayer1Settings
.Model
:= Model
.Name
;
332 gPlayer1Settings
.Color
:= Model
.Color
;
335 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
337 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
338 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
339 TEAM_RED
, TEAM_BLUE
);
340 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
342 gPlayer2Settings
.Model
:= Model
.Name
;
343 gPlayer2Settings
.Color
:= Model
.Color
;
346 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
347 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
349 if g_Game_IsServer
then
351 if gPlayer1
<> nil then
353 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
354 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
355 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
356 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
358 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
361 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
364 if gPlayer2
<> nil then
366 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
367 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
368 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
369 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
371 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
376 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
378 g_Console_WriteGameConfig
;
381 procedure ReadOptions();
386 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
388 with TGUISwitch(menu
.GetControl('swBPP')) do
394 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
395 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
397 with TGUISwitch(menu
.GetControl('swVSync')) do
398 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
400 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
401 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
403 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
405 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
406 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
407 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
409 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
410 if gMuteWhenInactive
then
415 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
417 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
418 if gSoundEffectsDF
then
423 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
424 if gUseChatSounds
then
429 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
432 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
433 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
434 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
435 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
436 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
437 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
438 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
439 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
440 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
441 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
443 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
445 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
446 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
447 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
448 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
449 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
450 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
451 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
452 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
455 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
458 for i
:= WP_FIRST
to WP_LAST
do
460 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
461 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
465 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
468 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
469 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
470 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
471 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
472 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
473 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
474 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
476 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
477 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
481 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
482 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
488 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
491 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
494 for i
:= WP_FIRST
to WP_LAST
do
496 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
497 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
501 if e_HasJoysticks
then
503 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
506 for i
:= 0 to e_MaxJoys
- 1 do
507 if e_JoystickAvailable
[i
] then
508 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
512 if g_touch_enabled
then
514 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
515 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
516 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
517 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
518 with TGUISwitch(menu
.GetControl('swTouchFire')) do
519 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
520 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
523 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
526 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
527 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
528 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
529 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
532 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
534 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
535 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
536 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
537 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
538 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
540 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
543 with TGUISwitch(menu
.GetControl('swBloodType')) do
544 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
546 with TGUISwitch(menu
.GetControl('swCorpseType')) do
547 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
549 with TGUISwitch(menu
.GetControl('swGibsType')) do
550 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
552 with TGUISwitch(menu
.GetControl('swGibsCount')) do
561 with TGUISwitch(menu
.GetControl('swBackGround')) do
562 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
564 with TGUISwitch(menu
.GetControl('swMessages')) do
565 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
567 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
568 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
570 with TGUISwitch(menu
.GetControl('swChatBubble')) do
571 ItemIndex
:= gChatBubble
;
573 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
574 ItemIndex
:= gPlayerIndicator
;
576 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
577 ItemIndex
:= gPlayerIndicatorStyle
;
579 TempScale
:= Round(g_dbg_scale
- 1);
580 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
582 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
584 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
585 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
587 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
588 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
590 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
591 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
592 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
594 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
596 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
597 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
599 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
600 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
602 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
603 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
604 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
606 ProcSelectModel(nil);
609 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
611 // don't turn off monsters in DM
613 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
614 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
615 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
617 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
620 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
621 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
622 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
623 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
627 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
629 // don't turn off monsters in DM
631 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
632 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
633 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
635 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
638 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
639 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
640 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
641 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
645 function LatchGameOptions(const MenuName
: string): Byte;
651 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
653 Map
:= TGUILabel(GetControl('lbMap')).Text;
656 if not isWadPath(Map
) then
659 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
660 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
661 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
662 gsGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
663 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
664 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
665 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
669 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
670 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
671 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
672 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
673 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
674 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
675 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
676 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
677 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
678 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
680 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
681 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
682 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
683 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
686 // TODO: get this crap out of here
687 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
688 gGameSettings
.WarmupTime
:= gsWarmupTime
;
689 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
693 procedure ProcStartCustomGame();
697 GameMode
:= LatchGameOptions('mCustomGameMenu');
698 if GameMode
= GM_NONE
then Exit
;
700 g_Console_WriteGameConfig
;
701 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
,
702 gsMaxLives
, gsGameFlags
, gsPlayers
);
706 procedure ProcStartNetGame();
710 GameMode
:= LatchGameOptions('mNetServerMenu');
711 if GameMode
= GM_NONE
then Exit
;
713 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
715 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
716 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
717 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
718 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
719 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
720 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
723 g_Console_WriteGameConfig
;
724 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
, gsMaxLives
,
725 gsGameFlags
, gsPlayers
, 0, NetPort
);
728 procedure ProcConnectNetGame();
732 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
734 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
735 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
736 PW
:= TGUIEdit(GetControl('edPW')).Text;
739 g_Console_WriteGameConfig
;
740 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
743 procedure ProcEnterPassword();
747 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
749 NetClientIP
:= PromptIP
;
750 NetClientPort
:= PromptPort
;
751 PW
:= TGUIEdit(GetControl('edPW')).Text;
754 g_Console_WriteGameConfig
;
755 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
758 procedure ProcServerlist();
760 if not NetInitDone
then
762 if (not g_Net_Init()) then
764 g_Console_Add('NET: ERROR: Failed to init ENet!');
771 g_Net_Slist_Set(NetMasterList
);
773 gState
:= STATE_SLIST
;
774 g_ActiveWindow
:= nil;
776 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
781 slReturnPressed
:= True;
782 if g_Net_Slist_Fetch(slCurrent
) then
784 if slCurrent
= nil then
785 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
788 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
789 g_Serverlist_GenerateTable(slCurrent
, slTable
);
792 procedure ProcStartCampaign();
798 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
800 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
801 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
803 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
809 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
812 procedure ProcSelectMap(Sender
: TGUIControl
);
816 wad
, map
, res
: String;
818 win
:= g_GUI_GetWindow('SelectMapMenu');
819 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
821 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
822 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
824 if (wad
= '') or (map
= '') then
825 begin // Ýòî íå êàðòà
826 TGUILabel(GetControl('lbMapName')).Text := '';
827 TGUILabel(GetControl('lbMapAuthor')).Text := '';
828 TGUILabel(GetControl('lbMapSize')).Text := '';
829 TGUIMemo(GetControl('meMapDescription')).SetText('');
830 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
831 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
837 a
:= g_Map_GetMapInfo(res
);
839 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
840 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
841 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
842 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
843 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
844 TGUILabel(win
.GetControl('lbMapScale')).Text :=
845 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
850 procedure ProcSelectWAD(Sender
: TGUIControl
);
855 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
857 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
859 with TGUIListBox(GetControl('lsMapRes')) do
865 list
:= g_Map_GetMapsList(wad
);
879 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
885 win
:= g_GUI_GetWindow('CampaignMenu');
886 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
888 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
892 TGUILabel(GetControl('lbWADName')).Text := '';
893 TGUILabel(GetControl('lbWADAuthor')).Text := '';
894 TGUIMemo(GetControl('meWADDescription')).SetText('');
897 a
:= g_Game_GetMegaWADInfo(wad
);
899 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
900 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
901 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
903 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
907 fn
:= g_ExtractWadName(a
.pic
);
909 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
911 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
916 procedure ProcChangeColor(Sender
: TGUIControl
);
920 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
921 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
922 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
923 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
924 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
925 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
927 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
928 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
929 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
930 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
931 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
932 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
935 procedure ProcSelectModel(Sender
: TGUIControl
);
940 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
941 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
942 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
944 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
945 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
946 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
948 ProcChangeColor(nil);
951 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
963 wad
:= TWADFile
.Create
;
964 if wad
.ReadFile(GameWAD
) then
965 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
970 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
972 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
973 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
974 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
975 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
977 if g_Texture_Get('FONT_STD', ID
) then
978 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
983 if cfglen
<> 0 then FreeMem(cfgdata
);
986 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
992 cfgdata
, fntdata
: Pointer;
993 cfglen
, fntlen
: Integer;
1001 wad
:= TWADFile
.Create
;
1002 if wad
.ReadFile(GameWAD
) then
1004 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1005 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1011 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1012 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1013 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1015 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1016 FontID
:= e_CharFont_Create(spc
);
1018 for a
:= 0 to 255 do
1020 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1021 if chrwidth
= 0 then Continue
;
1023 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1025 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1031 if cfglen
<> 0 then FreeMem(cfgdata
);
1032 if fntlen
<> 0 then FreeMem(fntdata
);
1035 procedure MenuLoadData();
1037 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1039 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1040 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1041 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1042 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1043 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1044 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1045 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1046 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1047 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1048 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1049 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1050 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1051 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1052 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1053 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1054 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1055 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1056 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1057 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1058 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1059 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1060 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1061 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1062 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1063 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1065 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1066 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1067 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1068 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1069 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1070 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1071 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1074 procedure MenuFreeData();
1076 e_CharFont_Remove(gMenuFont
);
1077 e_CharFont_Remove(gMenuSmallFont
);
1079 g_Texture_Delete('MAINMENU_LOGO');
1080 g_Texture_Delete('MAINMENU_MARKER1');
1081 g_Texture_Delete('MAINMENU_MARKER2');
1082 g_Texture_Delete('SCROLL_LEFT');
1083 g_Texture_Delete('SCROLL_RIGHT');
1084 g_Texture_Delete('SCROLL_MIDDLE');
1085 g_Texture_Delete('SCROLL_MARKER');
1086 g_Texture_Delete('EDIT_LEFT');
1087 g_Texture_Delete('EDIT_RIGHT');
1088 g_Texture_Delete('EDIT_MIDDLE');
1089 g_Texture_Delete('BOX1');
1090 g_Texture_Delete('BOX2');
1091 g_Texture_Delete('BOX3');
1092 g_Texture_Delete('BOX4');
1093 g_Texture_Delete('BOX5');
1094 g_Texture_Delete('BOX6');
1095 g_Texture_Delete('BOX7');
1096 g_Texture_Delete('BOX8');
1097 g_Texture_Delete('BOX9');
1098 g_Texture_Delete('BSCROLL_UP_A');
1099 g_Texture_Delete('BSCROLL_UP_U');
1100 g_Texture_Delete('BSCROLL_DOWN_A');
1101 g_Texture_Delete('BSCROLL_DOWN_U');
1102 g_Texture_Delete('BSCROLL_MIDDLE');
1103 g_Texture_Delete('NOPIC');
1105 g_Sound_Delete('MENU_SELECT');
1106 g_Sound_Delete('MENU_OPEN');
1107 g_Sound_Delete('MENU_CLOSE');
1108 g_Sound_Delete('MENU_CHANGE');
1109 g_Sound_Delete('SCROLL_ADD');
1110 g_Sound_Delete('SCROLL_SUB');
1111 g_Sound_Delete('SOUND_PLAYER_FALL');
1114 procedure ProcAuthorsMenu();
1116 gMusic
.SetByName('MUSIC_INTERMUS');
1120 procedure ProcExitMenuKeyDown (yes
: Boolean);
1123 snd
: TPlayableSound
;
1128 g_Game_StopAllSounds(True);
1129 case (Random(18)) of
1130 0: s
:= 'SOUND_MONSTER_PAIN';
1131 1: s
:= 'SOUND_MONSTER_DIE_3';
1132 2: s
:= 'SOUND_MONSTER_SLOP';
1133 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1134 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1135 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1136 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1137 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1138 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1139 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1140 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1141 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1142 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1143 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1144 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1145 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1146 else s
:= 'SOUND_PLAYER_FALL';
1148 snd
:= TPlayableSound
.Create();
1149 res
:= snd
.SetByName(s
);
1150 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1154 while snd
.IsPlaying() do begin end;
1162 procedure ProcLoadMenu();
1169 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1170 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1171 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1175 procedure ProcSaveMenu();
1183 name
:= g_GetSaveName(a
, valid
);
1184 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1185 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1189 procedure ProcSaveGame(Sender
: TGUIControl
);
1193 if g_Game_IsNet
then Exit
;
1194 if g_Game_IsTestMap
then Exit
;
1195 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1196 g_Game_PauseAllSounds(True);
1197 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1199 g_ActiveWindow
:= nil;
1200 g_Game_Pause(False);
1203 procedure ProcLoadGame(Sender
: TGUIControl
);
1207 if g_Game_IsNet
then Exit
;
1208 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1209 if g_LoadGame(a
) then
1211 g_Game_PauseAllSounds(False)
1213 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1215 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1216 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1217 //g_ActiveWindow := nil;
1221 procedure ProcSinglePlayer (n
: Integer);
1222 var wad
, map
: AnsiString;
1225 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1226 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1227 if e_FindResource(AllMapDirs
, wad
) then
1229 wad
:= ExpandFileName(wad
);
1230 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1234 procedure ProcSingle1Player
;
1239 procedure ProcSingle2Players
;
1244 procedure ProcSelectMapMenu();
1247 wad_lb
: TGUIFileListBox
;
1248 map_lb
: TGUIListBox
;
1251 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1252 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1253 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1255 if wad_lb
.SelectedItem() <> '' then
1256 map
:= map_lb
.SelectedItem()
1260 wad_lb
.UpdateFileList();
1263 if wad_lb
.SelectedItem() <> '' then
1266 map_lb
.SelectItem(map
);
1268 if map_lb
.SelectedItem() <> '' then
1272 g_GUI_ShowWindow('SelectMapMenu');
1275 procedure ProcSelectCampaignMenu();
1278 wad_lb
: TGUIFileListBox
;
1280 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1281 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1283 wad_lb
.UpdateFileList();
1285 if wad_lb
.SelectedItem() <> '' then
1286 ProcSelectCampaignWAD(nil);
1289 procedure ProcSetMap();
1291 wad
, map
, res
: String;
1293 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1295 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1296 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1299 if (wad
= '') or (map
= '') then
1302 wad
:= e_FindWadRel(MapDirs
, WAD
);
1304 res
:= wad
+':\'+map
;
1306 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1307 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1310 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1314 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1316 g_Sound_SetupAllVolumes(
1317 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1318 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1322 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1326 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1327 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1329 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1330 g_dbg_scale
:= TempScale
+ 1;
1334 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1338 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1339 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1340 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1341 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1344 procedure ProcOptionsPlayersMIMenu();
1349 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1351 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1353 if a
= '' then Exit
;
1355 b
:= g_PlayerModel_GetInfo(a
);
1357 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1359 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1360 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1361 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1363 if b
.HaveWeapon
then
1364 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1366 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1369 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1372 procedure ProcOptionsPlayersAnim();
1376 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1381 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1384 Model
.GetCurrentAnimation
.Loop
:= True;
1385 Model
.GetCurrentAnimationMask
.Loop
:= True;
1389 procedure ProcOptionsPlayersWeap();
1393 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1398 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1402 procedure ProcOptionsPlayersRot();
1406 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1407 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1409 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1413 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1417 g_Options_SetDefault();
1423 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1425 if yes
then ReadOptions();
1429 procedure ProcAuthorsClose();
1431 gMusic
.SetByName('MUSIC_MENU');
1433 gState
:= STATE_MENU
;
1436 procedure ProcGMClose();
1438 g_Game_InGameMenu(False);
1441 procedure ProcGMShow();
1446 if (gGameSettings
.GameType
= GT_SINGLE
) and
1447 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1448 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1449 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1451 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1452 if g_Game_IsTestMap
then
1453 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1454 TGUIMainMenu(g_ActiveWindow
.GetControl(
1455 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1458 procedure ProcChangePlayers();
1460 TeamGame
, Spectator
, AddTwo
: Boolean;
1461 P1Team
{, P2Team}: Byte;
1462 bP2
: TGUITextButton
;
1464 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1465 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1466 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1467 P1Team
:= TEAM_NONE
;
1468 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1470 //P2Team := TEAM_NONE;
1471 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1473 TGUIMainMenu(g_ActiveWindow
.GetControl(
1474 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1475 TGUIMainMenu(g_ActiveWindow
.GetControl(
1476 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1477 TGUIMainMenu(g_ActiveWindow
.GetControl(
1478 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1480 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1481 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1482 bP2
.Enabled
:= AddTwo
and not Spectator
;
1484 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1486 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1487 if gPlayer2
= nil then
1488 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1490 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1492 TGUIMainMenu(g_ActiveWindow
.GetControl(
1493 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1496 procedure ProcJoinRed();
1498 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1500 if g_Game_IsServer
then
1502 if gPlayer1
= nil then
1503 g_Game_AddPlayer(TEAM_RED
)
1506 if gPlayer1
.Team
<> TEAM_RED
then
1508 gPlayer1
.SwitchTeam
;
1509 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1512 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1517 gPlayer1Settings
.Team
:= TEAM_RED
;
1518 MC_SEND_PlayerSettings
;
1519 if gPlayer1
= nil then
1520 g_Game_AddPlayer(TEAM_RED
);
1522 g_ActiveWindow
:= nil;
1523 g_Game_Pause(False);
1526 procedure ProcJoinBlue();
1528 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1530 if g_Game_IsServer
then
1532 if gPlayer1
= nil then
1533 g_Game_AddPlayer(TEAM_BLUE
)
1536 if gPlayer1
.Team
<> TEAM_BLUE
then
1538 gPlayer1
.SwitchTeam
;
1539 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1542 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1547 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1548 MC_SEND_PlayerSettings
;
1549 if gPlayer1
= nil then
1550 g_Game_AddPlayer(TEAM_BLUE
);
1552 g_ActiveWindow
:= nil;
1553 g_Game_Pause(False);
1556 procedure ProcJoinGame();
1558 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1560 if gPlayer1
= nil then
1562 g_ActiveWindow
:= nil;
1563 g_Game_Pause(False);
1566 procedure ProcSwitchP2();
1568 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1570 if gPlayer1
= nil then
1572 if gPlayer2
= nil then
1575 g_Game_RemovePlayer();
1576 g_ActiveWindow
:= nil;
1577 g_Game_Pause(False);
1580 procedure ProcSpectate();
1582 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1585 g_ActiveWindow
:= nil;
1586 g_Game_Pause(False);
1589 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1591 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1594 procedure ProcEndMenuKeyDown (yes
: Boolean);
1596 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1599 procedure ProcSetRussianLanguage
;
1601 if gLanguage
<> LANGUAGE_RUSSIAN
then
1603 gLanguage
:= LANGUAGE_RUSSIAN
;
1604 gLanguageChange
:= True;
1605 gAskLanguage
:= False;
1610 procedure ProcSetEnglishLanguage
;
1612 if gLanguage
<> LANGUAGE_ENGLISH
then
1614 gLanguage
:= LANGUAGE_ENGLISH
;
1615 gLanguageChange
:= True;
1616 gAskLanguage
:= False;
1621 procedure ReadGameSettings();
1625 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1627 with gGameSettings
do
1629 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1630 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1634 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1635 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1640 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1641 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1642 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1644 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1645 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1646 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1649 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1654 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1656 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1657 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1659 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1660 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1664 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1665 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1667 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1668 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1669 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1670 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1671 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1672 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1673 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1677 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1678 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1679 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1680 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1685 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1686 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1691 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1692 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1697 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1698 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1703 procedure ProcApplyGameSet();
1707 stat
: TPlayerStatArray
;
1709 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1711 if not g_Game_IsServer
then Exit
;
1713 with gGameSettings
do
1715 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1717 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1718 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1720 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1723 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1725 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1726 Options
:= Options
or GAME_OPTION_DMKEYS
1728 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1731 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1733 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1739 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1741 TimeLimit
:= Max(n
, b
);
1745 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1747 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1754 if GameMode
= GM_DM
then
1756 stat
:= g_Player_GetStats();
1758 for a
:= 0 to High(stat
) do
1759 if stat
[a
].Frags
> b
then
1763 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1765 GoalLimit
:= Max(n
, b
);
1769 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1771 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1772 if n
< 0 then n
:= 0;
1773 if n
> 255 then n
:= 255;
1779 stat
:= g_Player_GetStats();
1781 for a
:= 0 to High(stat
) do
1782 if stat
[a
].Lives
> b
then
1785 MaxLives
:= Max(n
, b
);
1789 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1791 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1794 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1795 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1799 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1800 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1804 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1805 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1810 // don't forget to latch this shit
1811 gsGameFlags
:= Options
;
1812 gsMaxLives
:= MaxLives
;
1813 gsGoalLimit
:= GoalLimit
;
1814 gsTimeLimit
:= TimeLimit
;
1817 if g_Game_IsNet
then MH_SEND_GameSettings
;
1820 procedure ProcVideoOptionsRes();
1825 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1827 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1828 IntToStr(gWinSizeX
) +
1829 ' x ' + IntToStr(gWinSizeY
) +
1830 ', ' + IntToStr(gBPP
) + ' bpp';
1832 with TGUIListBox(menu
.GetControl('lsResolution')) do
1834 list
:= sys_GetDisplayModes(gBPP
);
1838 ItemIndex
:= Length(list
)
1846 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1852 TempResScale
:= Round(r_pixel_scale
- 1);
1853 TGUIScroll(menu
.GetControl('scResFactor')).Value
:= TempResScale
;
1856 procedure ProcApplyVideoOptions();
1859 Fullscreen
: Boolean;
1860 SWidth
, SHeight
: Integer;
1861 ScaleChanged
: Boolean;
1864 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1866 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1868 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1871 SWidth
:= gWinSizeX
;
1872 SHeight
:= gWinSizeY
;
1875 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1877 ScaleChanged
:= False;
1878 if TGUIScroll(menu
.GetControl('scResFactor')).Value
<> TempResScale
then
1880 TempResScale
:= TGUIScroll(menu
.GetControl('scResFactor')).Value
;
1881 r_pixel_scale
:= TempResScale
+ 1;
1882 ScaleChanged
:= True;
1885 if (SWidth
<> gWinSizeX
) or
1886 (SHeight
<> gWinSizeY
) or
1887 (Fullscreen
<> gFullscreen
) or
1890 gResolutionChange
:= True;
1891 gRC_Width
:= SWidth
;
1892 gRC_Height
:= SHeight
;
1893 gRC_FullScreen
:= Fullscreen
;
1894 gRC_Maximized
:= gWinMaximized
;
1897 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1901 procedure ProcSetFirstRussianLanguage
;
1903 gLanguage
:= LANGUAGE_RUSSIAN
;
1904 gLanguageChange
:= True;
1905 gAskLanguage
:= False;
1908 procedure ProcSetFirstEnglishLanguage
;
1910 gLanguage
:= LANGUAGE_ENGLISH
;
1911 gLanguageChange
:= True;
1912 gAskLanguage
:= False;
1915 procedure ProcRecallAddress();
1917 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1919 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1920 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1924 procedure CreateFirstLanguageMenu();
1928 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1930 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1932 Name
:= 'mmFirstLanguageMenu';
1933 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1934 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1937 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1938 Menu
.MainWindow
:= True;
1939 g_GUI_AddWindow(Menu
);
1942 procedure g_Menu_AskLanguage();
1944 CreateFirstLanguageMenu();
1945 g_GUI_ShowWindow('FirstLanguageMenu');
1948 procedure CreatePlayerOptionsMenu(s
: String);
1953 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1955 a
:= _lc
[I_MENU_PLAYER_1
]
1957 a
:= _lc
[I_MENU_PLAYER_2
];
1958 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1960 Name
:= 'mOptionsPlayers'+s
+'Menu';
1961 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1963 Name
:= 'ed'+s
+'Name';
1967 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1969 Name
:= 'sw'+s
+'Team';
1970 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1971 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1973 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1975 Name
:= 'ls'+s
+'Model';
1977 Items
:= g_PlayerModel_GetNames();
1978 OnChange
:= ProcSelectModel
;
1980 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1982 Name
:= 'sc'+s
+'Red';
1984 OnChange
:= ProcChangeColor
;
1986 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1988 Name
:= 'sc'+s
+'Green';
1990 OnChange
:= ProcChangeColor
;
1992 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1994 Name
:= 'sc'+s
+'Blue';
1996 OnChange
:= ProcChangeColor
;
1999 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2000 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2001 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2002 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2004 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2006 Name
:= 'mv'+s
+'Model';
2007 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2008 Y
:= GetControl('ls'+s
+'Model').Y
;
2011 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2012 g_GUI_AddWindow(Menu
);
2015 procedure CreateAllMenus();
2019 a
, cx
, _y
, i
: Integer;
2022 Menu
:= TGUIWindow
.Create('MainMenu');
2023 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2025 Name
:= 'mmMainMenu';
2026 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2027 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2028 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2029 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2030 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2031 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2033 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2035 Color
:= _RGB(255, 255, 255);
2036 X
:= gScreenWidth
-GetWidth
-8;
2037 Y
:= gScreenHeight
-GetHeight
-8;
2039 Menu
.DefControl
:= 'mmMainMenu';
2040 Menu
.MainWindow
:= True;
2041 g_GUI_AddWindow(Menu
);
2043 Menu
:= TGUIWindow
.Create('NewGameMenu');
2044 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2046 Name
:= 'mmNewGameMenu';
2047 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2048 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2049 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2050 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2052 Menu
.DefControl
:= 'mmNewGameMenu';
2053 g_GUI_AddWindow(Menu
);
2055 Menu
:= TGUIWindow
.Create('NetGameMenu');
2056 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2058 Name
:= 'mmNetGameMenu';
2059 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2060 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2062 Menu
.DefControl
:= 'mmNetGameMenu';
2063 g_GUI_AddWindow(Menu
);
2065 Menu
:= TGUIWindow
.Create('NetServerMenu');
2066 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2068 Name
:= 'mNetServerMenu';
2069 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2071 Name
:= 'edSrvName';
2072 OnlyDigits
:= False;
2075 Text := NetServerName
;
2077 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2079 Name
:= 'edSrvPassword';
2080 OnlyDigits
:= False;
2083 Text := NetPassword
;
2085 with AddEdit(_lc
[I_NET_PORT
]) do
2091 Text := IntToStr(NetPort
);
2093 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2095 Name
:= 'edMaxPlayers';
2099 Text := IntToStr(NetMaxClients
);
2101 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2103 Name
:= 'swUseMaster';
2104 AddItem(_lc
[I_MENU_YES
]);
2105 AddItem(_lc
[I_MENU_NO
]);
2106 if NetUseMaster
then
2112 with AddLabel(_lc
[I_MENU_MAP
]) do
2117 OnClick
:= @ProcSelectMapMenu
;
2119 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2121 Name
:= 'swGameMode';
2122 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2123 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2124 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2125 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2126 case g_Game_TextToMode(gsGameMode
) of
2128 GM_DM
: ItemIndex
:= 0;
2129 GM_TDM
: ItemIndex
:= 1;
2130 GM_CTF
: ItemIndex
:= 2;
2132 GM_COOP
: ItemIndex
:= 3;
2134 OnChange
:= ProcSwitchMonstersCustom
;
2136 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2138 Name
:= 'edTimeLimit';
2142 if gsTimeLimit
> 0 then
2143 Text := IntToStr(gsTimeLimit
);
2145 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2147 Name
:= 'edGoalLimit';
2151 if gsGoalLimit
> 0 then
2152 Text := IntToStr(gsGoalLimit
);
2154 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2156 Name
:= 'edMaxLives';
2160 if gsMaxLives
> 0 then
2161 Text := IntToStr(gsMaxLives
);
2163 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2165 Name
:= 'edItemRespawnTime';
2169 if gsItemRespawnTime
> 0 then
2170 Text := IntToStr(gsItemRespawnTime
);
2172 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2174 Name
:= 'swPlayers';
2175 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2176 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2177 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2178 ItemIndex
:= gsPlayers
;
2180 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2182 Name
:= 'swTeamDamage';
2183 AddItem(_lc
[I_MENU_YES
]);
2184 AddItem(_lc
[I_MENU_NO
]);
2185 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2190 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2192 Name
:= 'swDeathmatchKeys';
2193 AddItem(_lc
[I_MENU_YES
]);
2194 AddItem(_lc
[I_MENU_NO
]);
2195 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2200 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2202 Name
:= 'swEnableExits';
2203 AddItem(_lc
[I_MENU_YES
]);
2204 AddItem(_lc
[I_MENU_NO
]);
2205 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2210 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2212 Name
:= 'swWeaponStay';
2213 AddItem(_lc
[I_MENU_YES
]);
2214 AddItem(_lc
[I_MENU_NO
]);
2215 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2220 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2222 Name
:= 'swMonsters';
2223 AddItem(_lc
[I_MENU_YES
]);
2224 AddItem(_lc
[I_MENU_NO
]);
2225 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2230 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2233 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2234 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2235 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2237 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2239 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2243 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2247 Menu
.DefControl
:= 'mNetServerMenu';
2248 g_GUI_AddWindow(Menu
);
2250 Menu
:= TGUIWindow
.Create('NetClientMenu');
2251 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2253 Name
:= 'mNetClientMenu';
2255 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2258 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2264 Text := 'localhost';
2266 with AddEdit(_lc
[I_NET_PORT
]) do
2274 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2277 OnlyDigits
:= False;
2284 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2288 Menu
.DefControl
:= 'mNetClientMenu';
2289 g_GUI_AddWindow(Menu
);
2291 Menu
:= TGUIWindow
.Create('LoadMenu');
2292 Menu
.OnShow
:= ProcLoadMenu
;
2293 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2295 Name
:= 'mmLoadMenu';
2300 Name
:= 'edSlot'+IntToStr(a
);
2303 OnEnter
:= ProcLoadGame
;
2306 Menu
.DefControl
:= 'mmLoadMenu';
2307 g_GUI_AddWindow(Menu
);
2309 Menu
:= TGUIWindow
.Create('SaveMenu');
2310 Menu
.OnShow
:= ProcSaveMenu
;
2311 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2313 Name
:= 'mmSaveMenu';
2318 Name
:= 'edSlot'+IntToStr(a
);
2321 OnChange
:= ProcSaveGame
;
2324 Menu
.DefControl
:= 'mmSaveMenu';
2325 g_GUI_AddWindow(Menu
);
2327 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2328 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2330 Name
:= 'mCustomGameMenu';
2331 with AddLabel(_lc
[I_MENU_MAP
]) do
2336 OnClick
:= @ProcSelectMapMenu
;
2338 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2340 Name
:= 'swGameMode';
2341 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2342 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2343 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2344 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2345 case g_Game_TextToMode(gsGameMode
) of
2347 GM_DM
: ItemIndex
:= 0;
2348 GM_TDM
: ItemIndex
:= 1;
2349 GM_CTF
: ItemIndex
:= 2;
2351 GM_COOP
: ItemIndex
:= 3;
2353 OnChange
:= ProcSwitchMonstersCustom
;
2355 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2357 Name
:= 'edTimeLimit';
2361 if gsTimeLimit
> 0 then
2362 Text := IntToStr(gsTimeLimit
);
2364 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2366 Name
:= 'edGoalLimit';
2370 if gsGoalLimit
> 0 then
2371 Text := IntToStr(gsGoalLimit
);
2373 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2375 Name
:= 'edMaxLives';
2379 if gsMaxLives
> 0 then
2380 Text := IntToStr(gsMaxLives
);
2382 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2384 Name
:= 'edItemRespawnTime';
2388 if gsItemRespawnTime
> 0 then
2389 Text := IntToStr(gsItemRespawnTime
);
2391 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2393 Name
:= 'swPlayers';
2394 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2395 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2396 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2397 ItemIndex
:= gsPlayers
;
2399 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2401 Name
:= 'swTeamDamage';
2402 AddItem(_lc
[I_MENU_YES
]);
2403 AddItem(_lc
[I_MENU_NO
]);
2404 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2409 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2411 Name
:= 'swDeathmatchKeys';
2412 AddItem(_lc
[I_MENU_YES
]);
2413 AddItem(_lc
[I_MENU_NO
]);
2414 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2419 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2421 Name
:= 'swEnableExits';
2422 AddItem(_lc
[I_MENU_YES
]);
2423 AddItem(_lc
[I_MENU_NO
]);
2424 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2429 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2431 Name
:= 'swWeaponStay';
2432 AddItem(_lc
[I_MENU_YES
]);
2433 AddItem(_lc
[I_MENU_NO
]);
2434 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2439 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2441 Name
:= 'swMonsters';
2442 AddItem(_lc
[I_MENU_YES
]);
2443 AddItem(_lc
[I_MENU_NO
]);
2444 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2449 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2452 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2453 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2454 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2456 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2458 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2462 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2466 Menu
.DefControl
:= 'mCustomGameMenu';
2467 g_GUI_AddWindow(Menu
);
2469 Menu
:= TGUIWindow
.Create('CampaignMenu');
2470 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2472 Name
:= 'mCampaignMenu';
2481 with AddFileList('', 15, 4) do
2484 OnChange
:= ProcSelectCampaignWAD
;
2488 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2489 SetBase(MegawadDirs
);
2492 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2494 Name
:= 'lbWADName';
2498 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2500 Name
:= 'lbWADAuthor';
2504 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2505 with AddMemo('', 15, 3) do
2507 Name
:= 'meWADDescription';
2508 Color
:= MENU_ITEMSCTRL_COLOR
;
2510 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2512 Name
:= 'swPlayers';
2513 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2514 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2517 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2521 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2523 Name
:= 'mpWADImage';
2524 DefaultRes
:= 'NOPIC';
2525 X
:= GetControl('lsWAD').X
+4;
2526 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2529 Menu
.DefControl
:= 'mCampaignMenu';
2530 g_GUI_AddWindow(Menu
);
2532 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2533 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2535 Name
:= 'mSelectMapMenu';
2536 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2539 OnChange
:= ProcSelectWAD
;
2543 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2546 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2550 OnChange
:= ProcSelectMap
;
2553 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2555 Name
:= 'lbMapName';
2559 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2561 Name
:= 'lbMapAuthor';
2565 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2567 Name
:= 'lbMapSize';
2571 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2573 Name
:= 'meMapDescription';
2578 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2580 Name
:= 'mpMapPreview';
2581 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2582 Y
:= GetControl('lsMapWAD').Y
;
2584 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2586 Name
:= 'lbMapScale';
2589 Color
:= MENU_ITEMSCTRL_COLOR
;
2590 X
:= GetControl('lsMapWAD').X
+
2591 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2592 2 + MAPPREVIEW_WIDTH
*4;
2593 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2596 Menu
.OnClose
:= ProcSetMap
;
2597 Menu
.DefControl
:= 'mSelectMapMenu';
2598 g_GUI_AddWindow(Menu
);
2600 Menu
:= TGUIWindow
.Create('OptionsMenu');
2601 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2603 Name
:= 'mmOptionsMenu';
2604 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2605 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2606 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2607 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2608 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2609 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2611 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2612 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2614 Menu
.OnClose
:= ProcApplyOptions
;
2615 Menu
.DefControl
:= 'mmOptionsMenu';
2616 g_GUI_AddWindow(Menu
);
2618 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2619 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2620 g_GUI_AddWindow(Menu
);
2622 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2623 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2625 Name
:= 'mOptionsVideoMenu';
2626 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2627 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2633 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2636 AddItem(_lc
[I_MENU_YES
]);
2637 AddItem(_lc
[I_MENU_NO
]);
2639 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2641 Name
:= 'swTextureFilter';
2642 AddItem(_lc
[I_MENU_YES
]);
2643 AddItem(_lc
[I_MENU_NO
]);
2645 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2647 Name
:= 'swLegacyNPOT';
2648 AddItem(_lc
[I_MENU_NO
]);
2649 AddItem(_lc
[I_MENU_YES
]);
2652 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2655 Menu
.DefControl
:= 'mOptionsVideoMenu';
2656 g_GUI_AddWindow(Menu
);
2658 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2659 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2661 Name
:= 'mOptionsVideoResMenu';
2662 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2664 Name
:= 'lbCurrentRes';
2668 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2670 Name
:= 'lsResolution';
2673 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2675 Name
:= 'swFullScreen';
2676 AddItem(_lc
[I_MENU_YES
]);
2677 AddItem(_lc
[I_MENU_NO
]);
2679 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2681 Name
:= 'scResFactor';
2685 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2688 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2689 g_GUI_AddWindow(Menu
);
2691 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2692 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2694 Name
:= 'mOptionsSoundMenu';
2695 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2697 Name
:= 'scMusicLevel';
2699 OnChange
:= ProcChangeSoundSettings
;
2701 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2703 Name
:= 'scSoundLevel';
2705 OnChange
:= ProcChangeSoundSettings
;
2707 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2709 Name
:= 'scMaxSimSounds';
2712 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2714 Name
:= 'swAnnouncer';
2715 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2716 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2717 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2718 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2720 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2721 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2723 Name
:= 'swSoundEffects';
2724 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2725 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2727 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2728 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2730 Name
:= 'swChatSpeech';
2731 AddItem(_lc
[I_MENU_YES
]);
2732 AddItem(_lc
[I_MENU_NO
]);
2734 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2736 Name
:= 'swInactiveSounds';
2737 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2738 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2742 Menu
.DefControl
:= 'mOptionsSoundMenu';
2743 g_GUI_AddWindow(Menu
);
2745 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2746 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2748 Name
:= 'mOptionsGameMenu';
2749 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2751 Name
:= 'scParticlesCount';
2754 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2756 Name
:= 'swBloodCount';
2757 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2758 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2759 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2760 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2761 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2763 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2765 Name
:= 'scShellsMax';
2768 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2770 Name
:= 'scGibsMax';
2773 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2775 Name
:= 'scCorpsesMax';
2778 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2780 Name
:= 'swGibsCount';
2781 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2782 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2783 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2784 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2785 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2787 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2789 Name
:= 'swCorpseType';
2790 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2791 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2793 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2795 Name
:= 'swGibsType';
2796 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2797 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2799 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2801 Name
:= 'swBloodType';
2802 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2803 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2805 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2807 Name
:= 'swScreenFlash';
2808 AddItem(_lc
[I_MENU_NO
]);
2809 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2810 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2812 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2814 Name
:= 'swBackground';
2815 AddItem(_lc
[I_MENU_YES
]);
2816 AddItem(_lc
[I_MENU_NO
]);
2818 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2820 Name
:= 'swMessages';
2821 AddItem(_lc
[I_MENU_YES
]);
2822 AddItem(_lc
[I_MENU_NO
]);
2824 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2826 Name
:= 'swRevertPlayers';
2827 AddItem(_lc
[I_MENU_YES
]);
2828 AddItem(_lc
[I_MENU_NO
]);
2830 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2832 Name
:= 'swChatBubble';
2833 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2834 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2835 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2836 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2837 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2839 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2841 Name
:= 'swPlayerIndicator';
2842 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2843 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2844 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2846 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2848 Name
:= 'swPlayerIndicatorStyle';
2849 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2850 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2852 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2854 Name
:= 'scScaleFactor';
2856 OnChange
:= ProcChangeGameSettings
;
2860 Menu
.DefControl
:= 'mOptionsGameMenu';
2861 g_GUI_AddWindow(Menu
);
2863 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2864 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2866 Name
:= 'mOptionsControlsMenu';
2867 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2868 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2869 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2870 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2871 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2873 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2874 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2875 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2876 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2877 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2878 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2879 if e_HasJoysticks
then
2882 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2884 if g_touch_enabled
then
2887 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2890 Menu
.DefControl
:= 'mOptionsControlsMenu';
2891 g_GUI_AddWindow(Menu
);
2893 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2894 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2896 Name
:= 'mOptionsControlsP1Menu';
2897 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2898 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2899 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2900 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2901 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2902 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2903 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2904 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2905 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2906 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2908 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2909 g_GUI_AddWindow(Menu
);
2911 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2912 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2914 Name
:= 'mOptionsControlsP1MenuWeapons';
2915 for i
:= WP_FIRST
to WP_LAST
do
2916 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2917 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2919 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2920 g_GUI_AddWindow(Menu
);
2922 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2923 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2925 Name
:= 'mOptionsControlsP2Menu';
2926 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2927 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2928 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2929 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2930 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2931 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2932 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2933 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2934 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2935 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2937 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2938 g_GUI_AddWindow(Menu
);
2940 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2941 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2943 Name
:= 'mOptionsControlsP2MenuWeapons';
2944 for i
:= WP_FIRST
to WP_LAST
do
2945 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2946 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2948 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2949 g_GUI_AddWindow(Menu
);
2951 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2952 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2954 Name
:= 'mOptionsControlsJoystickMenu';
2955 for i
:= 0 to e_MaxJoys
- 1 do
2956 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2958 Name
:= 'scDeadzone' + IntToStr(i
);
2962 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2963 g_GUI_AddWindow(Menu
);
2965 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2966 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2968 Name
:= 'mOptionsControlsTouchMenu';
2969 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
2971 Name
:= 'swTouchAlt';
2972 AddItem(_lc
[I_MENU_NO
]);
2973 AddItem(_lc
[I_MENU_YES
]);
2974 OnChange
:= ProcChangeTouchSettings
;
2976 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2978 Name
:= 'scTouchSize';
2980 OnChange
:= ProcChangeTouchSettings
;
2982 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2984 Name
:= 'swTouchFire';
2985 AddItem(_lc
[I_MENU_NO
]);
2986 AddItem(_lc
[I_MENU_YES
]);
2988 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
2990 Name
:= 'scTouchOffset';
2992 OnChange
:= ProcChangeTouchSettings
;
2995 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
2996 g_GUI_AddWindow(Menu
);
2998 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2999 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3001 Name
:= 'mOptionsPlayersMenu';
3002 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3003 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3005 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3006 g_GUI_AddWindow(Menu
);
3008 CreatePlayerOptionsMenu('P1');
3009 CreatePlayerOptionsMenu('P2');
3011 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3012 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3014 Name
:= 'mOptionsPlayersMIMenu';
3015 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3020 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3025 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3027 Name
:= 'meComment';
3030 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3031 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3034 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3038 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3039 g_GUI_AddWindow(Menu
);
3041 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3042 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3044 Name
:= 'mOptionsLanguageMenu';
3045 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3046 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3049 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3050 g_GUI_AddWindow(Menu
);
3052 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3053 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3054 g_GUI_AddWindow(Menu
);
3056 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3057 Menu
.BackTexture
:= 'INTER';
3058 Menu
.OnClose
:= ProcAuthorsClose
;
3062 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3064 Color
:= _RGB(255, 0, 0);
3065 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3067 _y
:= _y
+GetHeight();
3069 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3071 Color
:= _RGB(255, 0, 0);
3072 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3074 _y
:= _y
+GetHeight()+32;
3076 // ×òî äåëàë: Êòî äåëàë
3077 cx
:= gScreenWidth
div 2 - 320 + 64;
3078 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3080 Color
:= _RGB(255, 0, 0);
3085 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3087 Color
:= _RGB(255, 255, 255);
3092 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3094 Color
:= _RGB(255, 0, 0);
3099 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3101 Color
:= _RGB(255, 255, 255);
3106 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3108 Color
:= _RGB(255, 255, 255);
3113 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3115 Color
:= _RGB(255, 0, 0);
3120 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3122 Color
:= _RGB(255, 255, 255);
3127 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3129 Color
:= _RGB(255, 0, 0);
3134 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3136 Color
:= _RGB(255, 255, 255);
3139 _y
:= gScreenHeight
- 128;
3142 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3144 Color
:= _RGB(255, 0, 0);
3149 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3151 Color
:= _RGB(255, 255, 255);
3154 _y
:= _y
+GetHeight();
3156 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3158 Color
:= _RGB(255, 255, 255);
3161 _y
:= _y
+GetHeight();
3163 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3165 Color
:= _RGB(255, 255, 255);
3168 _y
:= gScreenHeight
- 32;
3170 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3172 Color
:= _RGB(255, 0, 0);
3173 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3176 g_GUI_AddWindow(Menu
);
3178 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3179 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3180 g_GUI_AddWindow(Menu
);
3182 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3183 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3185 Name
:= 'mmGameSingleMenu';
3186 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3187 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3188 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3189 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3190 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3191 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3193 Menu
.DefControl
:= 'mmGameSingleMenu';
3194 Menu
.MainWindow
:= True;
3195 Menu
.OnClose
:= ProcGMClose
;
3196 Menu
.OnShow
:= ProcGMShow
;
3197 g_GUI_AddWindow(Menu
);
3199 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3200 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3201 g_GUI_AddWindow(Menu
);
3203 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3204 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3205 g_GUI_AddWindow(Menu
);
3207 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3208 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3210 Name
:= 'mmGameCustomMenu';
3211 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3212 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3213 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3214 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3215 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3216 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3217 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3219 Menu
.DefControl
:= 'mmGameCustomMenu';
3220 Menu
.MainWindow
:= True;
3221 Menu
.OnClose
:= ProcGMClose
;
3222 Menu
.OnShow
:= ProcGMShow
;
3223 g_GUI_AddWindow(Menu
);
3225 Menu
:= TGUIWindow
.Create('GameServerMenu');
3226 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3228 Name
:= 'mmGameServerMenu';
3229 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3230 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3231 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3232 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3233 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3235 Menu
.DefControl
:= 'mmGameServerMenu';
3236 Menu
.MainWindow
:= True;
3237 Menu
.OnClose
:= ProcGMClose
;
3238 Menu
.OnShow
:= ProcGMShow
;
3239 g_GUI_AddWindow(Menu
);
3241 Menu
:= TGUIWindow
.Create('GameClientMenu');
3242 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3244 Name
:= 'mmGameClientMenu';
3245 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3246 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3247 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3249 Menu
.DefControl
:= 'mmGameClientMenu';
3250 Menu
.MainWindow
:= True;
3251 Menu
.OnClose
:= ProcGMClose
;
3252 Menu
.OnShow
:= ProcGMShow
;
3253 g_GUI_AddWindow(Menu
);
3255 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3256 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3258 Name
:= 'mClientPasswordMenu';
3259 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3267 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3270 Menu
.DefControl
:= 'mClientPasswordMenu';
3271 g_GUI_AddWindow(Menu
);
3273 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3274 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3276 Name
:= 'mGameSetGameMenu';
3277 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3279 Name
:= 'swTeamDamage';
3280 AddItem(_lc
[I_MENU_YES
]);
3281 AddItem(_lc
[I_MENU_NO
]);
3284 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3286 Name
:= 'swDeathmatchKeys';
3287 AddItem(_lc
[I_MENU_YES
]);
3288 AddItem(_lc
[I_MENU_NO
]);
3291 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3293 Name
:= 'edTimeLimit';
3298 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3300 Name
:= 'edGoalLimit';
3305 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3307 Name
:= 'edMaxLives';
3312 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3315 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3316 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3317 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3323 Menu
.DefControl
:= 'mGameSetGameMenu';
3324 Menu
.OnClose
:= ProcApplyGameSet
;
3325 g_GUI_AddWindow(Menu
);
3327 Menu
:= TGUIWindow
.Create('TeamMenu');
3328 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3330 Name
:= 'mmTeamMenu';
3331 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3332 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3333 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3334 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3335 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3337 Menu
.DefControl
:= 'mmTeamMenu';
3338 Menu
.OnShow
:= ProcChangePlayers
;
3339 g_GUI_AddWindow(Menu
);
3342 procedure g_Menu_Show_SaveMenu();
3344 if g_Game_IsTestMap
then
3346 if gGameSettings
.GameType
= GT_SINGLE
then
3347 g_GUI_ShowWindow('GameSingleMenu')
3350 if g_Game_IsClient
then
3353 if g_Game_IsNet
then
3356 g_GUI_ShowWindow('GameCustomMenu');
3358 g_GUI_ShowWindow('SaveMenu');
3359 g_Sound_PlayEx('MENU_OPEN');
3362 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3364 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3365 if gGameSettings
.GameType
= GT_SINGLE
then
3367 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3371 if g_Game_IsClient
then exit
;
3372 if g_Game_IsNet
then exit
;
3373 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3375 g_GUI_ShowWindow('LoadMenu');
3376 g_Sound_PlayEx('MENU_OPEN');
3379 procedure g_Menu_Show_GameSetGame();
3381 if gGameSettings
.GameType
= GT_SINGLE
then
3382 g_GUI_ShowWindow('GameSingleMenu')
3385 if g_Game_IsClient
then
3388 if g_Game_IsNet
then
3389 g_GUI_ShowWindow('GameServerMenu')
3391 g_GUI_ShowWindow('GameCustomMenu');
3394 g_GUI_ShowWindow('GameSetGameMenu');
3395 g_Sound_PlayEx('MENU_OPEN');
3398 procedure g_Menu_Show_OptionsVideo();
3400 if gGameSettings
.GameType
= GT_SINGLE
then
3401 g_GUI_ShowWindow('GameSingleMenu')
3404 if g_Game_IsClient
then
3405 g_GUI_ShowWindow('GameClientMenu')
3407 if g_Game_IsNet
then
3408 g_GUI_ShowWindow('GameServerMenu')
3410 g_GUI_ShowWindow('GameCustomMenu');
3413 g_GUI_ShowWindow('OptionsMenu');
3414 g_GUI_ShowWindow('OptionsVideoMenu');
3415 g_Sound_PlayEx('MENU_OPEN');
3418 procedure g_Menu_Show_OptionsSound();
3420 if gGameSettings
.GameType
= GT_SINGLE
then
3421 g_GUI_ShowWindow('GameSingleMenu')
3424 if g_Game_IsClient
then
3425 g_GUI_ShowWindow('GameClientMenu')
3427 if g_Game_IsNet
then
3428 g_GUI_ShowWindow('GameServerMenu')
3430 g_GUI_ShowWindow('GameCustomMenu');
3433 g_GUI_ShowWindow('OptionsMenu');
3434 g_GUI_ShowWindow('OptionsSoundMenu');
3435 g_Sound_PlayEx('MENU_OPEN');
3438 procedure g_Menu_Show_EndGameMenu();
3440 g_GUI_ShowWindow('EndGameMenu');
3441 g_Sound_PlayEx('MENU_OPEN');
3444 procedure g_Menu_Show_QuitGameMenu();
3446 g_GUI_ShowWindow('ExitMenu');
3447 g_Sound_PlayEx('MENU_OPEN');
3450 procedure g_Menu_Init();
3457 procedure g_Menu_Free();
3461 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3466 procedure g_Menu_Reset();
3470 g_GUI_SaveMenuPos();
3471 ex
:= g_GUI_Destroy();
3475 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3480 g_Game_SetDebugMode();
3482 g_GUI_LoadMenuPos();