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 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
; // TODO: get this crap out of here
690 procedure ProcStartCustomGame();
694 GameMode
:= LatchGameOptions('mCustomGameMenu');
695 if GameMode
= GM_NONE
then Exit
;
697 g_Console_WriteGameConfig
;
698 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
,
699 gsMaxLives
, gsGameFlags
, gsPlayers
);
703 procedure ProcStartNetGame();
707 GameMode
:= LatchGameOptions('mNetServerMenu');
708 if GameMode
= GM_NONE
then Exit
;
710 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
712 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
713 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
714 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
715 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
716 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
717 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
720 g_Console_WriteGameConfig
;
721 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
, gsMaxLives
,
722 gsGameFlags
, gsPlayers
, 0, NetPort
);
725 procedure ProcConnectNetGame();
729 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
731 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
732 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
733 PW
:= TGUIEdit(GetControl('edPW')).Text;
736 g_Console_WriteGameConfig
;
737 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
740 procedure ProcEnterPassword();
744 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
746 NetClientIP
:= PromptIP
;
747 NetClientPort
:= PromptPort
;
748 PW
:= TGUIEdit(GetControl('edPW')).Text;
751 g_Console_WriteGameConfig
;
752 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
755 procedure ProcServerlist();
757 if not NetInitDone
then
759 if (not g_Net_Init()) then
761 g_Console_Add('NET: ERROR: Failed to init ENet!');
768 g_Net_Slist_Set(NetMasterList
);
770 gState
:= STATE_SLIST
;
771 g_ActiveWindow
:= nil;
773 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
778 slReturnPressed
:= True;
779 if g_Net_Slist_Fetch(slCurrent
) then
781 if slCurrent
= nil then
782 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
785 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
786 g_Serverlist_GenerateTable(slCurrent
, slTable
);
789 procedure ProcStartCampaign();
795 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
797 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
798 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
800 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
806 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
809 procedure ProcSelectMap(Sender
: TGUIControl
);
813 wad
, map
, res
: String;
815 win
:= g_GUI_GetWindow('SelectMapMenu');
816 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
818 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
819 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
821 if (wad
= '') or (map
= '') then
822 begin // Ýòî íå êàðòà
823 TGUILabel(GetControl('lbMapName')).Text := '';
824 TGUILabel(GetControl('lbMapAuthor')).Text := '';
825 TGUILabel(GetControl('lbMapSize')).Text := '';
826 TGUIMemo(GetControl('meMapDescription')).SetText('');
827 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
828 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
834 a
:= g_Map_GetMapInfo(res
);
836 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
837 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
838 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
839 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
840 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
841 TGUILabel(win
.GetControl('lbMapScale')).Text :=
842 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
847 procedure ProcSelectWAD(Sender
: TGUIControl
);
852 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
854 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
856 with TGUIListBox(GetControl('lsMapRes')) do
862 list
:= g_Map_GetMapsList(wad
);
876 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
882 win
:= g_GUI_GetWindow('CampaignMenu');
883 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
885 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
889 TGUILabel(GetControl('lbWADName')).Text := '';
890 TGUILabel(GetControl('lbWADAuthor')).Text := '';
891 TGUIMemo(GetControl('meWADDescription')).SetText('');
894 a
:= g_Game_GetMegaWADInfo(wad
);
896 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
897 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
898 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
900 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
904 fn
:= g_ExtractWadName(a
.pic
);
906 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
908 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
913 procedure ProcChangeColor(Sender
: TGUIControl
);
917 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
918 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
919 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
920 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
921 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
922 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
924 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
925 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
926 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
927 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
928 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
929 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
932 procedure ProcSelectModel(Sender
: TGUIControl
);
937 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
938 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
939 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
941 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
942 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
943 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
945 ProcChangeColor(nil);
948 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
960 wad
:= TWADFile
.Create
;
961 if wad
.ReadFile(GameWAD
) then
962 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
967 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
969 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
970 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
971 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
972 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
974 if g_Texture_Get('FONT_STD', ID
) then
975 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
980 if cfglen
<> 0 then FreeMem(cfgdata
);
983 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
989 cfgdata
, fntdata
: Pointer;
990 cfglen
, fntlen
: Integer;
998 wad
:= TWADFile
.Create
;
999 if wad
.ReadFile(GameWAD
) then
1001 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1002 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1008 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1009 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1010 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1012 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1013 FontID
:= e_CharFont_Create(spc
);
1015 for a
:= 0 to 255 do
1017 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1018 if chrwidth
= 0 then Continue
;
1020 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1022 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1028 if cfglen
<> 0 then FreeMem(cfgdata
);
1029 if fntlen
<> 0 then FreeMem(fntdata
);
1032 procedure MenuLoadData();
1034 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1036 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1037 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1038 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1039 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1040 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1041 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1042 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1043 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1044 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1045 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1046 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1047 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1048 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1049 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1050 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1051 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1052 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1053 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1054 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1055 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1056 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1057 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1058 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1059 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1060 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1062 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1063 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1064 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1065 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1066 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1067 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1068 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1071 procedure MenuFreeData();
1073 e_CharFont_Remove(gMenuFont
);
1074 e_CharFont_Remove(gMenuSmallFont
);
1076 g_Texture_Delete('MAINMENU_LOGO');
1077 g_Texture_Delete('MAINMENU_MARKER1');
1078 g_Texture_Delete('MAINMENU_MARKER2');
1079 g_Texture_Delete('SCROLL_LEFT');
1080 g_Texture_Delete('SCROLL_RIGHT');
1081 g_Texture_Delete('SCROLL_MIDDLE');
1082 g_Texture_Delete('SCROLL_MARKER');
1083 g_Texture_Delete('EDIT_LEFT');
1084 g_Texture_Delete('EDIT_RIGHT');
1085 g_Texture_Delete('EDIT_MIDDLE');
1086 g_Texture_Delete('BOX1');
1087 g_Texture_Delete('BOX2');
1088 g_Texture_Delete('BOX3');
1089 g_Texture_Delete('BOX4');
1090 g_Texture_Delete('BOX5');
1091 g_Texture_Delete('BOX6');
1092 g_Texture_Delete('BOX7');
1093 g_Texture_Delete('BOX8');
1094 g_Texture_Delete('BOX9');
1095 g_Texture_Delete('BSCROLL_UP_A');
1096 g_Texture_Delete('BSCROLL_UP_U');
1097 g_Texture_Delete('BSCROLL_DOWN_A');
1098 g_Texture_Delete('BSCROLL_DOWN_U');
1099 g_Texture_Delete('BSCROLL_MIDDLE');
1100 g_Texture_Delete('NOPIC');
1102 g_Sound_Delete('MENU_SELECT');
1103 g_Sound_Delete('MENU_OPEN');
1104 g_Sound_Delete('MENU_CLOSE');
1105 g_Sound_Delete('MENU_CHANGE');
1106 g_Sound_Delete('SCROLL_ADD');
1107 g_Sound_Delete('SCROLL_SUB');
1108 g_Sound_Delete('SOUND_PLAYER_FALL');
1111 procedure ProcAuthorsMenu();
1113 gMusic
.SetByName('MUSIC_INTERMUS');
1117 procedure ProcExitMenuKeyDown (yes
: Boolean);
1120 snd
: TPlayableSound
;
1125 g_Game_StopAllSounds(True);
1126 case (Random(18)) of
1127 0: s
:= 'SOUND_MONSTER_PAIN';
1128 1: s
:= 'SOUND_MONSTER_DIE_3';
1129 2: s
:= 'SOUND_MONSTER_SLOP';
1130 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1131 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1132 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1133 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1134 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1135 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1136 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1137 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1138 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1139 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1140 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1141 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1142 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1143 else s
:= 'SOUND_PLAYER_FALL';
1145 snd
:= TPlayableSound
.Create();
1146 res
:= snd
.SetByName(s
);
1147 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1151 while snd
.IsPlaying() do begin end;
1159 procedure ProcLoadMenu();
1166 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1167 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1168 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1172 procedure ProcSaveMenu();
1180 name
:= g_GetSaveName(a
, valid
);
1181 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1182 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1186 procedure ProcSaveGame(Sender
: TGUIControl
);
1190 if g_Game_IsNet
then Exit
;
1191 if g_Game_IsTestMap
then Exit
;
1192 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1193 g_Game_PauseAllSounds(True);
1194 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1196 g_ActiveWindow
:= nil;
1197 g_Game_Pause(False);
1200 procedure ProcLoadGame(Sender
: TGUIControl
);
1204 if g_Game_IsNet
then Exit
;
1205 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1206 if g_LoadGame(a
) then
1208 g_Game_PauseAllSounds(False)
1210 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1212 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1213 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1214 //g_ActiveWindow := nil;
1218 procedure ProcSinglePlayer (n
: Integer);
1219 var wad
, map
: AnsiString;
1222 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1223 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1224 if e_FindResource(AllMapDirs
, wad
) then
1226 wad
:= ExpandFileName(wad
);
1227 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1231 procedure ProcSingle1Player
;
1236 procedure ProcSingle2Players
;
1241 procedure ProcSelectMapMenu();
1244 wad_lb
: TGUIFileListBox
;
1245 map_lb
: TGUIListBox
;
1248 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1249 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1250 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1252 if wad_lb
.SelectedItem() <> '' then
1253 map
:= map_lb
.SelectedItem()
1257 wad_lb
.UpdateFileList();
1260 if wad_lb
.SelectedItem() <> '' then
1263 map_lb
.SelectItem(map
);
1265 if map_lb
.SelectedItem() <> '' then
1269 g_GUI_ShowWindow('SelectMapMenu');
1272 procedure ProcSelectCampaignMenu();
1275 wad_lb
: TGUIFileListBox
;
1277 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1278 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1280 wad_lb
.UpdateFileList();
1282 if wad_lb
.SelectedItem() <> '' then
1283 ProcSelectCampaignWAD(nil);
1286 procedure ProcSetMap();
1288 wad
, map
, res
: String;
1290 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1292 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1293 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1296 if (wad
= '') or (map
= '') then
1299 wad
:= e_FindWadRel(MapDirs
, WAD
);
1301 res
:= wad
+':\'+map
;
1303 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1304 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1307 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1311 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1313 g_Sound_SetupAllVolumes(
1314 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1315 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1319 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1323 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1324 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1326 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1327 g_dbg_scale
:= TempScale
+ 1;
1331 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1335 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1336 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1337 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1338 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1341 procedure ProcOptionsPlayersMIMenu();
1346 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1348 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1350 if a
= '' then Exit
;
1352 b
:= g_PlayerModel_GetInfo(a
);
1354 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1356 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1357 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1358 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1360 if b
.HaveWeapon
then
1361 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1363 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1366 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1369 procedure ProcOptionsPlayersAnim();
1373 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1378 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1381 Model
.GetCurrentAnimation
.Loop
:= True;
1382 Model
.GetCurrentAnimationMask
.Loop
:= True;
1386 procedure ProcOptionsPlayersWeap();
1390 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1395 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1399 procedure ProcOptionsPlayersRot();
1403 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1404 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1406 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1410 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1414 g_Options_SetDefault();
1420 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1422 if yes
then ReadOptions();
1426 procedure ProcAuthorsClose();
1428 gMusic
.SetByName('MUSIC_MENU');
1430 gState
:= STATE_MENU
;
1433 procedure ProcGMClose();
1435 g_Game_InGameMenu(False);
1438 procedure ProcGMShow();
1443 if (gGameSettings
.GameType
= GT_SINGLE
) and
1444 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1445 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1446 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1448 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1449 if g_Game_IsTestMap
then
1450 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1451 TGUIMainMenu(g_ActiveWindow
.GetControl(
1452 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1455 procedure ProcChangePlayers();
1457 TeamGame
, Spectator
, AddTwo
: Boolean;
1458 P1Team
{, P2Team}: Byte;
1459 bP2
: TGUITextButton
;
1461 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1462 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1463 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1464 P1Team
:= TEAM_NONE
;
1465 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1467 //P2Team := TEAM_NONE;
1468 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1470 TGUIMainMenu(g_ActiveWindow
.GetControl(
1471 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1472 TGUIMainMenu(g_ActiveWindow
.GetControl(
1473 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1474 TGUIMainMenu(g_ActiveWindow
.GetControl(
1475 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1477 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1478 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1479 bP2
.Enabled
:= AddTwo
and not Spectator
;
1481 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1483 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1484 if gPlayer2
= nil then
1485 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1487 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1489 TGUIMainMenu(g_ActiveWindow
.GetControl(
1490 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1493 procedure ProcJoinRed();
1495 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1497 if g_Game_IsServer
then
1499 if gPlayer1
= nil then
1500 g_Game_AddPlayer(TEAM_RED
)
1503 if gPlayer1
.Team
<> TEAM_RED
then
1505 gPlayer1
.SwitchTeam
;
1506 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1509 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1514 gPlayer1Settings
.Team
:= TEAM_RED
;
1515 MC_SEND_PlayerSettings
;
1516 if gPlayer1
= nil then
1517 g_Game_AddPlayer(TEAM_RED
);
1519 g_ActiveWindow
:= nil;
1520 g_Game_Pause(False);
1523 procedure ProcJoinBlue();
1525 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1527 if g_Game_IsServer
then
1529 if gPlayer1
= nil then
1530 g_Game_AddPlayer(TEAM_BLUE
)
1533 if gPlayer1
.Team
<> TEAM_BLUE
then
1535 gPlayer1
.SwitchTeam
;
1536 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1539 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1544 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1545 MC_SEND_PlayerSettings
;
1546 if gPlayer1
= nil then
1547 g_Game_AddPlayer(TEAM_BLUE
);
1549 g_ActiveWindow
:= nil;
1550 g_Game_Pause(False);
1553 procedure ProcJoinGame();
1555 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1557 if gPlayer1
= nil then
1559 g_ActiveWindow
:= nil;
1560 g_Game_Pause(False);
1563 procedure ProcSwitchP2();
1565 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1567 if gPlayer1
= nil then
1569 if gPlayer2
= nil then
1572 g_Game_RemovePlayer();
1573 g_ActiveWindow
:= nil;
1574 g_Game_Pause(False);
1577 procedure ProcSpectate();
1579 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1582 g_ActiveWindow
:= nil;
1583 g_Game_Pause(False);
1586 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1588 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1591 procedure ProcEndMenuKeyDown (yes
: Boolean);
1593 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1596 procedure ProcSetRussianLanguage
;
1598 if gLanguage
<> LANGUAGE_RUSSIAN
then
1600 gLanguage
:= LANGUAGE_RUSSIAN
;
1601 gLanguageChange
:= True;
1602 gAskLanguage
:= False;
1607 procedure ProcSetEnglishLanguage
;
1609 if gLanguage
<> LANGUAGE_ENGLISH
then
1611 gLanguage
:= LANGUAGE_ENGLISH
;
1612 gLanguageChange
:= True;
1613 gAskLanguage
:= False;
1618 procedure ReadGameSettings();
1622 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1624 with gGameSettings
do
1626 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1627 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1631 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1632 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1637 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1638 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1639 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1641 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1642 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1643 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1646 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1651 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1653 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1654 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1656 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1657 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1661 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1662 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1664 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1665 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1666 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1667 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1668 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1669 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1670 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1674 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1675 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1676 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1677 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1682 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1683 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1688 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1689 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1694 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1695 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1700 procedure ProcApplyGameSet();
1704 stat
: TPlayerStatArray
;
1706 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1708 if not g_Game_IsServer
then Exit
;
1710 with gGameSettings
do
1712 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1714 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1715 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1717 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1720 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1722 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1723 Options
:= Options
or GAME_OPTION_DMKEYS
1725 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1728 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1730 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1736 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1738 TimeLimit
:= Max(n
, b
);
1742 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1744 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1751 if GameMode
= GM_DM
then
1753 stat
:= g_Player_GetStats();
1755 for a
:= 0 to High(stat
) do
1756 if stat
[a
].Frags
> b
then
1760 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1762 GoalLimit
:= Max(n
, b
);
1766 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1768 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1769 if n
< 0 then n
:= 0;
1770 if n
> 255 then n
:= 255;
1776 stat
:= g_Player_GetStats();
1778 for a
:= 0 to High(stat
) do
1779 if stat
[a
].Lives
> b
then
1782 MaxLives
:= Max(n
, b
);
1786 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1788 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1791 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1792 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1796 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1797 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1801 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1802 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1807 // don't forget to latch this shit
1808 gsGameFlags
:= Options
;
1809 gsMaxLives
:= MaxLives
;
1810 gsGoalLimit
:= GoalLimit
;
1811 gsTimeLimit
:= TimeLimit
;
1814 if g_Game_IsNet
then MH_SEND_GameSettings
;
1817 procedure ProcVideoOptionsRes();
1822 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1824 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1825 IntToStr(gWinSizeX
) +
1826 ' x ' + IntToStr(gWinSizeY
) +
1827 ', ' + IntToStr(gBPP
) + ' bpp';
1829 with TGUIListBox(menu
.GetControl('lsResolution')) do
1831 list
:= sys_GetDisplayModes(gBPP
);
1835 ItemIndex
:= Length(list
)
1843 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1849 TempResScale
:= Round(r_pixel_scale
- 1);
1850 TGUIScroll(menu
.GetControl('scResFactor')).Value
:= TempResScale
;
1853 procedure ProcApplyVideoOptions();
1856 Fullscreen
: Boolean;
1857 SWidth
, SHeight
: Integer;
1858 ScaleChanged
: Boolean;
1861 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1863 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1865 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1868 SWidth
:= gWinSizeX
;
1869 SHeight
:= gWinSizeY
;
1872 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1874 ScaleChanged
:= False;
1875 if TGUIScroll(menu
.GetControl('scResFactor')).Value
<> TempResScale
then
1877 TempResScale
:= TGUIScroll(menu
.GetControl('scResFactor')).Value
;
1878 r_pixel_scale
:= TempResScale
+ 1;
1879 ScaleChanged
:= True;
1882 if (SWidth
<> gWinSizeX
) or
1883 (SHeight
<> gWinSizeY
) or
1884 (Fullscreen
<> gFullscreen
) or
1887 gResolutionChange
:= True;
1888 gRC_Width
:= SWidth
;
1889 gRC_Height
:= SHeight
;
1890 gRC_FullScreen
:= Fullscreen
;
1891 gRC_Maximized
:= gWinMaximized
;
1894 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1898 procedure ProcSetFirstRussianLanguage
;
1900 gLanguage
:= LANGUAGE_RUSSIAN
;
1901 gLanguageChange
:= True;
1902 gAskLanguage
:= False;
1905 procedure ProcSetFirstEnglishLanguage
;
1907 gLanguage
:= LANGUAGE_ENGLISH
;
1908 gLanguageChange
:= True;
1909 gAskLanguage
:= False;
1912 procedure ProcRecallAddress();
1914 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1916 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1917 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1921 procedure CreateFirstLanguageMenu();
1925 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1927 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1929 Name
:= 'mmFirstLanguageMenu';
1930 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1931 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1934 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1935 Menu
.MainWindow
:= True;
1936 g_GUI_AddWindow(Menu
);
1939 procedure g_Menu_AskLanguage();
1941 CreateFirstLanguageMenu();
1942 g_GUI_ShowWindow('FirstLanguageMenu');
1945 procedure CreatePlayerOptionsMenu(s
: String);
1950 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1952 a
:= _lc
[I_MENU_PLAYER_1
]
1954 a
:= _lc
[I_MENU_PLAYER_2
];
1955 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1957 Name
:= 'mOptionsPlayers'+s
+'Menu';
1958 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1960 Name
:= 'ed'+s
+'Name';
1964 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1966 Name
:= 'sw'+s
+'Team';
1967 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1968 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1970 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1972 Name
:= 'ls'+s
+'Model';
1974 Items
:= g_PlayerModel_GetNames();
1975 OnChange
:= ProcSelectModel
;
1977 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1979 Name
:= 'sc'+s
+'Red';
1981 OnChange
:= ProcChangeColor
;
1983 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1985 Name
:= 'sc'+s
+'Green';
1987 OnChange
:= ProcChangeColor
;
1989 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1991 Name
:= 'sc'+s
+'Blue';
1993 OnChange
:= ProcChangeColor
;
1996 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1997 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1998 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1999 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2001 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2003 Name
:= 'mv'+s
+'Model';
2004 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2005 Y
:= GetControl('ls'+s
+'Model').Y
;
2008 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2009 g_GUI_AddWindow(Menu
);
2012 procedure CreateAllMenus();
2016 a
, cx
, _y
, i
: Integer;
2019 Menu
:= TGUIWindow
.Create('MainMenu');
2020 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2022 Name
:= 'mmMainMenu';
2023 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2024 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2025 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2026 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2027 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2028 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2030 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2032 Color
:= _RGB(255, 255, 255);
2033 X
:= gScreenWidth
-GetWidth
-8;
2034 Y
:= gScreenHeight
-GetHeight
-8;
2036 Menu
.DefControl
:= 'mmMainMenu';
2037 Menu
.MainWindow
:= True;
2038 g_GUI_AddWindow(Menu
);
2040 Menu
:= TGUIWindow
.Create('NewGameMenu');
2041 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2043 Name
:= 'mmNewGameMenu';
2044 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2045 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2046 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2047 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2049 Menu
.DefControl
:= 'mmNewGameMenu';
2050 g_GUI_AddWindow(Menu
);
2052 Menu
:= TGUIWindow
.Create('NetGameMenu');
2053 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2055 Name
:= 'mmNetGameMenu';
2056 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2057 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2059 Menu
.DefControl
:= 'mmNetGameMenu';
2060 g_GUI_AddWindow(Menu
);
2062 Menu
:= TGUIWindow
.Create('NetServerMenu');
2063 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2065 Name
:= 'mNetServerMenu';
2066 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2068 Name
:= 'edSrvName';
2069 OnlyDigits
:= False;
2072 Text := NetServerName
;
2074 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2076 Name
:= 'edSrvPassword';
2077 OnlyDigits
:= False;
2080 Text := NetPassword
;
2082 with AddEdit(_lc
[I_NET_PORT
]) do
2088 Text := IntToStr(NetPort
);
2090 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2092 Name
:= 'edMaxPlayers';
2096 Text := IntToStr(NetMaxClients
);
2098 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2100 Name
:= 'swUseMaster';
2101 AddItem(_lc
[I_MENU_YES
]);
2102 AddItem(_lc
[I_MENU_NO
]);
2103 if NetUseMaster
then
2109 with AddLabel(_lc
[I_MENU_MAP
]) do
2114 OnClick
:= @ProcSelectMapMenu
;
2116 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2118 Name
:= 'swGameMode';
2119 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2120 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2121 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2122 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2123 case g_Game_TextToMode(gsGameMode
) of
2125 GM_DM
: ItemIndex
:= 0;
2126 GM_TDM
: ItemIndex
:= 1;
2127 GM_CTF
: ItemIndex
:= 2;
2129 GM_COOP
: ItemIndex
:= 3;
2131 OnChange
:= ProcSwitchMonstersCustom
;
2133 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2135 Name
:= 'edTimeLimit';
2139 if gsTimeLimit
> 0 then
2140 Text := IntToStr(gsTimeLimit
);
2142 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2144 Name
:= 'edGoalLimit';
2148 if gsGoalLimit
> 0 then
2149 Text := IntToStr(gsGoalLimit
);
2151 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2153 Name
:= 'edMaxLives';
2157 if gsMaxLives
> 0 then
2158 Text := IntToStr(gsMaxLives
);
2160 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2162 Name
:= 'edItemRespawnTime';
2166 if gsItemRespawnTime
> 0 then
2167 Text := IntToStr(gsItemRespawnTime
);
2169 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2171 Name
:= 'swPlayers';
2172 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2173 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2174 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2175 ItemIndex
:= gsPlayers
;
2177 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2179 Name
:= 'swTeamDamage';
2180 AddItem(_lc
[I_MENU_YES
]);
2181 AddItem(_lc
[I_MENU_NO
]);
2182 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2187 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2189 Name
:= 'swDeathmatchKeys';
2190 AddItem(_lc
[I_MENU_YES
]);
2191 AddItem(_lc
[I_MENU_NO
]);
2192 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2197 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2199 Name
:= 'swEnableExits';
2200 AddItem(_lc
[I_MENU_YES
]);
2201 AddItem(_lc
[I_MENU_NO
]);
2202 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2207 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2209 Name
:= 'swWeaponStay';
2210 AddItem(_lc
[I_MENU_YES
]);
2211 AddItem(_lc
[I_MENU_NO
]);
2212 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2217 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2219 Name
:= 'swMonsters';
2220 AddItem(_lc
[I_MENU_YES
]);
2221 AddItem(_lc
[I_MENU_NO
]);
2222 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2227 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2230 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2231 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2232 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2234 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2236 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2240 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2244 Menu
.DefControl
:= 'mNetServerMenu';
2245 g_GUI_AddWindow(Menu
);
2247 Menu
:= TGUIWindow
.Create('NetClientMenu');
2248 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2250 Name
:= 'mNetClientMenu';
2252 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2255 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2261 Text := 'localhost';
2263 with AddEdit(_lc
[I_NET_PORT
]) do
2271 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2274 OnlyDigits
:= False;
2281 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2285 Menu
.DefControl
:= 'mNetClientMenu';
2286 g_GUI_AddWindow(Menu
);
2288 Menu
:= TGUIWindow
.Create('LoadMenu');
2289 Menu
.OnShow
:= ProcLoadMenu
;
2290 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2292 Name
:= 'mmLoadMenu';
2297 Name
:= 'edSlot'+IntToStr(a
);
2300 OnEnter
:= ProcLoadGame
;
2303 Menu
.DefControl
:= 'mmLoadMenu';
2304 g_GUI_AddWindow(Menu
);
2306 Menu
:= TGUIWindow
.Create('SaveMenu');
2307 Menu
.OnShow
:= ProcSaveMenu
;
2308 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2310 Name
:= 'mmSaveMenu';
2315 Name
:= 'edSlot'+IntToStr(a
);
2318 OnChange
:= ProcSaveGame
;
2321 Menu
.DefControl
:= 'mmSaveMenu';
2322 g_GUI_AddWindow(Menu
);
2324 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2325 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2327 Name
:= 'mCustomGameMenu';
2328 with AddLabel(_lc
[I_MENU_MAP
]) do
2333 OnClick
:= @ProcSelectMapMenu
;
2335 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2337 Name
:= 'swGameMode';
2338 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2339 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2340 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2341 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2342 case g_Game_TextToMode(gsGameMode
) of
2344 GM_DM
: ItemIndex
:= 0;
2345 GM_TDM
: ItemIndex
:= 1;
2346 GM_CTF
: ItemIndex
:= 2;
2348 GM_COOP
: ItemIndex
:= 3;
2350 OnChange
:= ProcSwitchMonstersCustom
;
2352 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2354 Name
:= 'edTimeLimit';
2358 if gsTimeLimit
> 0 then
2359 Text := IntToStr(gsTimeLimit
);
2361 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2363 Name
:= 'edGoalLimit';
2367 if gsGoalLimit
> 0 then
2368 Text := IntToStr(gsGoalLimit
);
2370 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2372 Name
:= 'edMaxLives';
2376 if gsMaxLives
> 0 then
2377 Text := IntToStr(gsMaxLives
);
2379 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2381 Name
:= 'edItemRespawnTime';
2385 if gsItemRespawnTime
> 0 then
2386 Text := IntToStr(gsItemRespawnTime
);
2388 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2390 Name
:= 'swPlayers';
2391 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2392 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2393 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2394 ItemIndex
:= gsPlayers
;
2396 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2398 Name
:= 'swTeamDamage';
2399 AddItem(_lc
[I_MENU_YES
]);
2400 AddItem(_lc
[I_MENU_NO
]);
2401 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2406 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2408 Name
:= 'swDeathmatchKeys';
2409 AddItem(_lc
[I_MENU_YES
]);
2410 AddItem(_lc
[I_MENU_NO
]);
2411 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2416 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2418 Name
:= 'swEnableExits';
2419 AddItem(_lc
[I_MENU_YES
]);
2420 AddItem(_lc
[I_MENU_NO
]);
2421 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2426 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2428 Name
:= 'swWeaponStay';
2429 AddItem(_lc
[I_MENU_YES
]);
2430 AddItem(_lc
[I_MENU_NO
]);
2431 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2436 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2438 Name
:= 'swMonsters';
2439 AddItem(_lc
[I_MENU_YES
]);
2440 AddItem(_lc
[I_MENU_NO
]);
2441 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2446 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2449 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2450 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2451 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2453 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2455 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2459 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2463 Menu
.DefControl
:= 'mCustomGameMenu';
2464 g_GUI_AddWindow(Menu
);
2466 Menu
:= TGUIWindow
.Create('CampaignMenu');
2467 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2469 Name
:= 'mCampaignMenu';
2478 with AddFileList('', 15, 4) do
2481 OnChange
:= ProcSelectCampaignWAD
;
2485 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2486 SetBase(MegawadDirs
);
2489 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2491 Name
:= 'lbWADName';
2495 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2497 Name
:= 'lbWADAuthor';
2501 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2502 with AddMemo('', 15, 3) do
2504 Name
:= 'meWADDescription';
2505 Color
:= MENU_ITEMSCTRL_COLOR
;
2507 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2509 Name
:= 'swPlayers';
2510 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2511 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2514 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2518 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2520 Name
:= 'mpWADImage';
2521 DefaultRes
:= 'NOPIC';
2522 X
:= GetControl('lsWAD').X
+4;
2523 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2526 Menu
.DefControl
:= 'mCampaignMenu';
2527 g_GUI_AddWindow(Menu
);
2529 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2530 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2532 Name
:= 'mSelectMapMenu';
2533 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2536 OnChange
:= ProcSelectWAD
;
2540 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2543 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2547 OnChange
:= ProcSelectMap
;
2550 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2552 Name
:= 'lbMapName';
2556 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2558 Name
:= 'lbMapAuthor';
2562 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2564 Name
:= 'lbMapSize';
2568 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2570 Name
:= 'meMapDescription';
2575 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2577 Name
:= 'mpMapPreview';
2578 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2579 Y
:= GetControl('lsMapWAD').Y
;
2581 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2583 Name
:= 'lbMapScale';
2586 Color
:= MENU_ITEMSCTRL_COLOR
;
2587 X
:= GetControl('lsMapWAD').X
+
2588 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2589 2 + MAPPREVIEW_WIDTH
*4;
2590 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2593 Menu
.OnClose
:= ProcSetMap
;
2594 Menu
.DefControl
:= 'mSelectMapMenu';
2595 g_GUI_AddWindow(Menu
);
2597 Menu
:= TGUIWindow
.Create('OptionsMenu');
2598 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2600 Name
:= 'mmOptionsMenu';
2601 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2602 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2603 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2604 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2605 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2606 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2608 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2609 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2611 Menu
.OnClose
:= ProcApplyOptions
;
2612 Menu
.DefControl
:= 'mmOptionsMenu';
2613 g_GUI_AddWindow(Menu
);
2615 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2616 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2617 g_GUI_AddWindow(Menu
);
2619 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2620 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2622 Name
:= 'mOptionsVideoMenu';
2623 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2624 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2630 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2633 AddItem(_lc
[I_MENU_YES
]);
2634 AddItem(_lc
[I_MENU_NO
]);
2636 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2638 Name
:= 'swTextureFilter';
2639 AddItem(_lc
[I_MENU_YES
]);
2640 AddItem(_lc
[I_MENU_NO
]);
2642 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2644 Name
:= 'swLegacyNPOT';
2645 AddItem(_lc
[I_MENU_NO
]);
2646 AddItem(_lc
[I_MENU_YES
]);
2649 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2652 Menu
.DefControl
:= 'mOptionsVideoMenu';
2653 g_GUI_AddWindow(Menu
);
2655 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2656 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2658 Name
:= 'mOptionsVideoResMenu';
2659 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2661 Name
:= 'lbCurrentRes';
2665 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2667 Name
:= 'lsResolution';
2670 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2672 Name
:= 'swFullScreen';
2673 AddItem(_lc
[I_MENU_YES
]);
2674 AddItem(_lc
[I_MENU_NO
]);
2676 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2678 Name
:= 'scResFactor';
2682 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2685 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2686 g_GUI_AddWindow(Menu
);
2688 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2689 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2691 Name
:= 'mOptionsSoundMenu';
2692 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2694 Name
:= 'scMusicLevel';
2696 OnChange
:= ProcChangeSoundSettings
;
2698 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2700 Name
:= 'scSoundLevel';
2702 OnChange
:= ProcChangeSoundSettings
;
2704 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2706 Name
:= 'scMaxSimSounds';
2709 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2711 Name
:= 'swAnnouncer';
2712 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2713 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2714 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2715 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2717 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2718 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2720 Name
:= 'swSoundEffects';
2721 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2722 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2724 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2725 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2727 Name
:= 'swChatSpeech';
2728 AddItem(_lc
[I_MENU_YES
]);
2729 AddItem(_lc
[I_MENU_NO
]);
2731 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2733 Name
:= 'swInactiveSounds';
2734 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2735 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2739 Menu
.DefControl
:= 'mOptionsSoundMenu';
2740 g_GUI_AddWindow(Menu
);
2742 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2743 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2745 Name
:= 'mOptionsGameMenu';
2746 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2748 Name
:= 'scParticlesCount';
2751 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2753 Name
:= 'swBloodCount';
2754 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2755 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2756 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2757 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2758 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2760 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2762 Name
:= 'scShellsMax';
2765 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2767 Name
:= 'scGibsMax';
2770 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2772 Name
:= 'scCorpsesMax';
2775 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2777 Name
:= 'swGibsCount';
2778 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2779 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2780 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2781 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2782 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2784 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2786 Name
:= 'swCorpseType';
2787 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2788 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2790 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2792 Name
:= 'swGibsType';
2793 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2794 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2796 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2798 Name
:= 'swBloodType';
2799 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2800 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2802 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2804 Name
:= 'swScreenFlash';
2805 AddItem(_lc
[I_MENU_NO
]);
2806 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2807 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2809 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2811 Name
:= 'swBackground';
2812 AddItem(_lc
[I_MENU_YES
]);
2813 AddItem(_lc
[I_MENU_NO
]);
2815 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2817 Name
:= 'swMessages';
2818 AddItem(_lc
[I_MENU_YES
]);
2819 AddItem(_lc
[I_MENU_NO
]);
2821 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2823 Name
:= 'swRevertPlayers';
2824 AddItem(_lc
[I_MENU_YES
]);
2825 AddItem(_lc
[I_MENU_NO
]);
2827 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2829 Name
:= 'swChatBubble';
2830 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2831 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2832 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2833 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2834 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2836 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2838 Name
:= 'swPlayerIndicator';
2839 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2840 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2841 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2843 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2845 Name
:= 'swPlayerIndicatorStyle';
2846 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2847 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2849 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2851 Name
:= 'scScaleFactor';
2853 OnChange
:= ProcChangeGameSettings
;
2857 Menu
.DefControl
:= 'mOptionsGameMenu';
2858 g_GUI_AddWindow(Menu
);
2860 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2861 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2863 Name
:= 'mOptionsControlsMenu';
2864 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2865 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2866 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2867 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2868 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2870 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2871 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2872 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2873 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2874 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2875 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2876 if e_HasJoysticks
then
2879 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2881 if g_touch_enabled
then
2884 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2887 Menu
.DefControl
:= 'mOptionsControlsMenu';
2888 g_GUI_AddWindow(Menu
);
2890 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2891 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2893 Name
:= 'mOptionsControlsP1Menu';
2894 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2895 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2896 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2897 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2898 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2899 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2900 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2901 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2902 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2903 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2905 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2906 g_GUI_AddWindow(Menu
);
2908 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2909 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2911 Name
:= 'mOptionsControlsP1MenuWeapons';
2912 for i
:= WP_FIRST
to WP_LAST
do
2913 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2914 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2916 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2917 g_GUI_AddWindow(Menu
);
2919 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2920 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2922 Name
:= 'mOptionsControlsP2Menu';
2923 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2924 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2925 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2926 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2927 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2928 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2929 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2930 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2931 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2932 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2934 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2935 g_GUI_AddWindow(Menu
);
2937 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2938 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2940 Name
:= 'mOptionsControlsP2MenuWeapons';
2941 for i
:= WP_FIRST
to WP_LAST
do
2942 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2943 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2945 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2946 g_GUI_AddWindow(Menu
);
2948 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2949 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2951 Name
:= 'mOptionsControlsJoystickMenu';
2952 for i
:= 0 to e_MaxJoys
- 1 do
2953 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2955 Name
:= 'scDeadzone' + IntToStr(i
);
2959 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2960 g_GUI_AddWindow(Menu
);
2962 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2963 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2965 Name
:= 'mOptionsControlsTouchMenu';
2966 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
2968 Name
:= 'swTouchAlt';
2969 AddItem(_lc
[I_MENU_NO
]);
2970 AddItem(_lc
[I_MENU_YES
]);
2971 OnChange
:= ProcChangeTouchSettings
;
2973 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2975 Name
:= 'scTouchSize';
2977 OnChange
:= ProcChangeTouchSettings
;
2979 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2981 Name
:= 'swTouchFire';
2982 AddItem(_lc
[I_MENU_NO
]);
2983 AddItem(_lc
[I_MENU_YES
]);
2985 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
2987 Name
:= 'scTouchOffset';
2989 OnChange
:= ProcChangeTouchSettings
;
2992 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
2993 g_GUI_AddWindow(Menu
);
2995 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2996 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2998 Name
:= 'mOptionsPlayersMenu';
2999 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3000 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3002 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3003 g_GUI_AddWindow(Menu
);
3005 CreatePlayerOptionsMenu('P1');
3006 CreatePlayerOptionsMenu('P2');
3008 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3009 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3011 Name
:= 'mOptionsPlayersMIMenu';
3012 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3017 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3022 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3024 Name
:= 'meComment';
3027 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3028 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3031 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3035 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3036 g_GUI_AddWindow(Menu
);
3038 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3039 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3041 Name
:= 'mOptionsLanguageMenu';
3042 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3043 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3046 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3047 g_GUI_AddWindow(Menu
);
3049 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3050 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3051 g_GUI_AddWindow(Menu
);
3053 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3054 Menu
.BackTexture
:= 'INTER';
3055 Menu
.OnClose
:= ProcAuthorsClose
;
3059 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3061 Color
:= _RGB(255, 0, 0);
3062 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3064 _y
:= _y
+GetHeight();
3066 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3068 Color
:= _RGB(255, 0, 0);
3069 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3071 _y
:= _y
+GetHeight()+32;
3073 // ×òî äåëàë: Êòî äåëàë
3074 cx
:= gScreenWidth
div 2 - 320 + 64;
3075 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3077 Color
:= _RGB(255, 0, 0);
3082 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3084 Color
:= _RGB(255, 255, 255);
3089 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3091 Color
:= _RGB(255, 0, 0);
3096 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3098 Color
:= _RGB(255, 255, 255);
3103 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3105 Color
:= _RGB(255, 255, 255);
3110 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3112 Color
:= _RGB(255, 0, 0);
3117 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3119 Color
:= _RGB(255, 255, 255);
3124 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3126 Color
:= _RGB(255, 0, 0);
3131 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3133 Color
:= _RGB(255, 255, 255);
3136 _y
:= gScreenHeight
- 128;
3139 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3141 Color
:= _RGB(255, 0, 0);
3146 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3148 Color
:= _RGB(255, 255, 255);
3151 _y
:= _y
+GetHeight();
3153 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3155 Color
:= _RGB(255, 255, 255);
3158 _y
:= _y
+GetHeight();
3160 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3162 Color
:= _RGB(255, 255, 255);
3165 _y
:= gScreenHeight
- 32;
3167 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3169 Color
:= _RGB(255, 0, 0);
3170 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3173 g_GUI_AddWindow(Menu
);
3175 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3176 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3177 g_GUI_AddWindow(Menu
);
3179 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3180 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3182 Name
:= 'mmGameSingleMenu';
3183 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3184 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3185 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3186 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3187 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3188 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3190 Menu
.DefControl
:= 'mmGameSingleMenu';
3191 Menu
.MainWindow
:= True;
3192 Menu
.OnClose
:= ProcGMClose
;
3193 Menu
.OnShow
:= ProcGMShow
;
3194 g_GUI_AddWindow(Menu
);
3196 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3197 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3198 g_GUI_AddWindow(Menu
);
3200 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3201 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3202 g_GUI_AddWindow(Menu
);
3204 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3205 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3207 Name
:= 'mmGameCustomMenu';
3208 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3209 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3210 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3211 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3212 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3213 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3214 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3216 Menu
.DefControl
:= 'mmGameCustomMenu';
3217 Menu
.MainWindow
:= True;
3218 Menu
.OnClose
:= ProcGMClose
;
3219 Menu
.OnShow
:= ProcGMShow
;
3220 g_GUI_AddWindow(Menu
);
3222 Menu
:= TGUIWindow
.Create('GameServerMenu');
3223 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3225 Name
:= 'mmGameServerMenu';
3226 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3227 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3228 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3229 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3230 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3232 Menu
.DefControl
:= 'mmGameServerMenu';
3233 Menu
.MainWindow
:= True;
3234 Menu
.OnClose
:= ProcGMClose
;
3235 Menu
.OnShow
:= ProcGMShow
;
3236 g_GUI_AddWindow(Menu
);
3238 Menu
:= TGUIWindow
.Create('GameClientMenu');
3239 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3241 Name
:= 'mmGameClientMenu';
3242 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3243 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3244 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3246 Menu
.DefControl
:= 'mmGameClientMenu';
3247 Menu
.MainWindow
:= True;
3248 Menu
.OnClose
:= ProcGMClose
;
3249 Menu
.OnShow
:= ProcGMShow
;
3250 g_GUI_AddWindow(Menu
);
3252 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3253 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3255 Name
:= 'mClientPasswordMenu';
3256 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3264 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3267 Menu
.DefControl
:= 'mClientPasswordMenu';
3268 g_GUI_AddWindow(Menu
);
3270 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3271 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3273 Name
:= 'mGameSetGameMenu';
3274 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3276 Name
:= 'swTeamDamage';
3277 AddItem(_lc
[I_MENU_YES
]);
3278 AddItem(_lc
[I_MENU_NO
]);
3281 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3283 Name
:= 'swDeathmatchKeys';
3284 AddItem(_lc
[I_MENU_YES
]);
3285 AddItem(_lc
[I_MENU_NO
]);
3288 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3290 Name
:= 'edTimeLimit';
3295 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3297 Name
:= 'edGoalLimit';
3302 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3304 Name
:= 'edMaxLives';
3309 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3312 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3313 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3314 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3320 Menu
.DefControl
:= 'mGameSetGameMenu';
3321 Menu
.OnClose
:= ProcApplyGameSet
;
3322 g_GUI_AddWindow(Menu
);
3324 Menu
:= TGUIWindow
.Create('TeamMenu');
3325 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3327 Name
:= 'mmTeamMenu';
3328 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3329 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3330 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3331 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3332 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3334 Menu
.DefControl
:= 'mmTeamMenu';
3335 Menu
.OnShow
:= ProcChangePlayers
;
3336 g_GUI_AddWindow(Menu
);
3339 procedure g_Menu_Show_SaveMenu();
3341 if g_Game_IsTestMap
then
3343 if gGameSettings
.GameType
= GT_SINGLE
then
3344 g_GUI_ShowWindow('GameSingleMenu')
3347 if g_Game_IsClient
then
3350 if g_Game_IsNet
then
3353 g_GUI_ShowWindow('GameCustomMenu');
3355 g_GUI_ShowWindow('SaveMenu');
3356 g_Sound_PlayEx('MENU_OPEN');
3359 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3361 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3362 if gGameSettings
.GameType
= GT_SINGLE
then
3364 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3368 if g_Game_IsClient
then exit
;
3369 if g_Game_IsNet
then exit
;
3370 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3372 g_GUI_ShowWindow('LoadMenu');
3373 g_Sound_PlayEx('MENU_OPEN');
3376 procedure g_Menu_Show_GameSetGame();
3378 if gGameSettings
.GameType
= GT_SINGLE
then
3379 g_GUI_ShowWindow('GameSingleMenu')
3382 if g_Game_IsClient
then
3385 if g_Game_IsNet
then
3386 g_GUI_ShowWindow('GameServerMenu')
3388 g_GUI_ShowWindow('GameCustomMenu');
3391 g_GUI_ShowWindow('GameSetGameMenu');
3392 g_Sound_PlayEx('MENU_OPEN');
3395 procedure g_Menu_Show_OptionsVideo();
3397 if gGameSettings
.GameType
= GT_SINGLE
then
3398 g_GUI_ShowWindow('GameSingleMenu')
3401 if g_Game_IsClient
then
3402 g_GUI_ShowWindow('GameClientMenu')
3404 if g_Game_IsNet
then
3405 g_GUI_ShowWindow('GameServerMenu')
3407 g_GUI_ShowWindow('GameCustomMenu');
3410 g_GUI_ShowWindow('OptionsMenu');
3411 g_GUI_ShowWindow('OptionsVideoMenu');
3412 g_Sound_PlayEx('MENU_OPEN');
3415 procedure g_Menu_Show_OptionsSound();
3417 if gGameSettings
.GameType
= GT_SINGLE
then
3418 g_GUI_ShowWindow('GameSingleMenu')
3421 if g_Game_IsClient
then
3422 g_GUI_ShowWindow('GameClientMenu')
3424 if g_Game_IsNet
then
3425 g_GUI_ShowWindow('GameServerMenu')
3427 g_GUI_ShowWindow('GameCustomMenu');
3430 g_GUI_ShowWindow('OptionsMenu');
3431 g_GUI_ShowWindow('OptionsSoundMenu');
3432 g_Sound_PlayEx('MENU_OPEN');
3435 procedure g_Menu_Show_EndGameMenu();
3437 g_GUI_ShowWindow('EndGameMenu');
3438 g_Sound_PlayEx('MENU_OPEN');
3441 procedure g_Menu_Show_QuitGameMenu();
3443 g_GUI_ShowWindow('ExitMenu');
3444 g_Sound_PlayEx('MENU_OPEN');
3447 procedure g_Menu_Init();
3454 procedure g_Menu_Free();
3458 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3463 procedure g_Menu_Reset();
3467 g_GUI_SaveMenuPos();
3468 ex
:= g_GUI_Destroy();
3472 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3477 g_Game_SetDebugMode();
3479 g_GUI_LoadMenuPos();