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 g_Menu_AskLanguage();
25 procedure g_Menu_Show_SaveMenu();
26 procedure g_Menu_Show_LoadMenu(standalone
: Boolean=false);
27 procedure g_Menu_Show_GameSetGame();
28 procedure g_Menu_Show_OptionsVideo();
29 procedure g_Menu_Show_OptionsSound();
30 procedure g_Menu_Show_EndGameMenu();
31 procedure g_Menu_Show_QuitGameMenu();
36 TempScale
: Integer = -1;
37 TempResScale
: Integer = -1;
42 g_gui
, r_textures
, r_graphics
, g_game
, g_map
,
43 g_base
, g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
, g_weapons
,
44 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
45 MAPDEF
, Math
, g_saveload
,
47 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
,
48 utils
, wadreader
, g_system
, r_render
, r_game
;
51 type TYNCallback
= procedure (yes
:Boolean);
53 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
55 if win
.UserData
= nil then exit
;
57 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
58 IK_N
: TYNCallback(win
.UserData
)(false);
62 procedure YesButtonCB (ctl
: TGUITextButton
);
64 if ctl
.UserData
= nil then exit
;
65 TYNCallback(ctl
.UserData
)(true);
68 procedure NoButtonCB (ctl
: TGUITextButton
);
70 if ctl
.UserData
= nil then exit
;
71 TYNCallback(ctl
.UserData
)(false);
74 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
78 //if length(Text) = 0 then exit;
79 Result
:= TGUIWindow
.Create(WinName
);
82 //OnKeyDownEx := @YNKeyDownProc;
83 //UserData := @ActionProc;
84 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
87 Name
:= '__temp_yes_no_menu:'+WinName
;
89 AddText(Text, MaxLen
);
90 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
91 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
93 DefControl
:= '__temp_yes_no_menu:'+WinName
;
99 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
100 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
102 procedure ProcApplyOptions();
107 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
109 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
114 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
116 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
117 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
118 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).ItemIndex
= 0;
120 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
122 g_Sound_SetupAllVolumes(
123 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
124 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
127 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
128 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
129 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
130 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
131 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
133 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
135 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
136 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
137 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
138 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
140 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
145 else gGibsCount
:= 48;
148 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
149 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
150 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
151 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
152 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
153 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
154 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
155 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
156 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
157 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
158 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
159 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
161 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
162 g_dbg_scale
:= TempScale
+ 1;
165 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
169 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
170 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
171 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
172 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
173 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
174 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
175 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
176 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
179 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
182 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
183 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
184 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
185 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
186 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
187 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
188 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
189 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
190 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
191 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
192 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
193 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
194 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
195 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
196 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
197 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
198 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext', '-p1_weapnext');
199 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev', '-p1_weapprev');
200 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
203 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
204 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
205 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
206 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
207 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
208 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
209 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
210 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
211 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
212 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
213 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
214 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
215 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
216 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
217 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
218 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
219 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext', '-p1_weapnext');
220 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev', '-p1_weapprev');
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
225 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
228 for i
:= WP_FIRST
to WP_LAST
do
230 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
231 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
232 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
233 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
237 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
240 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
241 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
242 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
243 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
244 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
245 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
246 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
247 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
248 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
249 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
250 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
251 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
252 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
253 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
254 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
255 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
256 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p2_weapnext', '-p2_weapnext');
257 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev', '-p2_weapprev');
258 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
259 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
261 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
262 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
263 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
264 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
265 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
266 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
267 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
268 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
269 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
270 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
271 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
272 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
273 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
274 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
275 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
276 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
277 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext', '-p2_weapnext');
278 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev', '-p2_weapprev');
279 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
283 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
286 for i
:= WP_FIRST
to WP_LAST
do
288 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
289 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
290 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
291 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
295 if e_HasJoysticks
then
297 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
300 for i
:= 0 to e_MaxJoys
- 1 do
301 if e_JoystickAvailable
[i
] then
302 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
306 if g_touch_enabled
then
308 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
309 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
310 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
311 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
312 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
315 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
317 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
318 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
319 TEAM_RED
, TEAM_BLUE
);
321 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
323 gPlayer1Settings
.Model
:= Model
.GetName();
324 gPlayer1Settings
.Color
:= Model
.Color
;
327 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
329 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
330 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
331 TEAM_RED
, TEAM_BLUE
);
332 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
334 gPlayer2Settings
.Model
:= Model
.GetName();
335 gPlayer2Settings
.Color
:= Model
.Color
;
338 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
339 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
341 if g_Game_IsServer
then
343 if gPlayer1
<> nil then
345 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
346 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
347 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
348 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
350 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
353 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
356 if gPlayer2
<> nil then
358 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
359 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
360 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
361 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
363 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
368 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
370 g_Console_WriteGameConfig
;
373 procedure ReadOptions();
378 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
380 with TGUISwitch(menu
.GetControl('swBPP')) do
386 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
387 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
389 with TGUISwitch(menu
.GetControl('swVSync')) do
390 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
392 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
393 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
395 with TGUISwitch(menu
.GetControl('swInterp')) do
396 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
398 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
400 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
401 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
402 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
404 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
405 if gMuteWhenInactive
then
410 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
412 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
413 if gSoundEffectsDF
then
418 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
419 if gUseChatSounds
then
424 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
427 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
428 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
429 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
430 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
431 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
432 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
433 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
434 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
435 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
436 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
438 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
439 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
440 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
441 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
442 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
443 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
445 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
446 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
447 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
450 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
453 for i
:= WP_FIRST
to WP_LAST
do
455 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
456 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
460 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
463 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
464 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
465 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
466 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
467 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
468 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
469 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
470 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
471 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
472 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
474 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
476 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
477 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
478 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
481 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
482 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
486 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
489 for i
:= WP_FIRST
to WP_LAST
do
491 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
492 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
496 if e_HasJoysticks
then
498 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
501 for i
:= 0 to e_MaxJoys
- 1 do
502 if e_JoystickAvailable
[i
] then
503 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
507 if g_touch_enabled
then
509 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
510 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
511 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
512 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
513 with TGUISwitch(menu
.GetControl('swTouchFire')) do
514 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
515 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
518 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
521 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
522 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
523 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
524 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
527 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
529 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
530 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
531 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
532 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
533 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
535 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
538 with TGUISwitch(menu
.GetControl('swBloodType')) do
539 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
541 with TGUISwitch(menu
.GetControl('swCorpseType')) do
542 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
544 with TGUISwitch(menu
.GetControl('swGibsType')) do
545 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
547 with TGUISwitch(menu
.GetControl('swGibsCount')) do
556 with TGUISwitch(menu
.GetControl('swBackGround')) do
557 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
559 with TGUISwitch(menu
.GetControl('swMessages')) do
560 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
562 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
563 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
565 with TGUISwitch(menu
.GetControl('swChatBubble')) do
566 ItemIndex
:= gChatBubble
;
568 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
569 ItemIndex
:= gPlayerIndicator
;
571 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
572 ItemIndex
:= gPlayerIndicatorStyle
;
574 TempScale
:= Round(g_dbg_scale
- 1);
575 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
577 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
579 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
580 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
582 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
583 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
585 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
586 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
587 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
589 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
591 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
592 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
594 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
595 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
597 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
598 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
599 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
601 ProcSelectModel(nil);
604 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
606 // don't turn off monsters in DM
608 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
609 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
610 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
612 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
615 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
616 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
617 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
618 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
622 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
624 // don't turn off monsters in DM
626 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
627 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
628 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
630 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
633 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
634 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
635 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
636 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
640 function LatchGameOptions(const MenuName
: string): Byte;
646 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
648 Map
:= TGUILabel(GetControl('lbMap')).Text;
651 if not isWadPath(Map
) then
654 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
655 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
656 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
657 gsGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
658 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
659 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
660 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
664 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
665 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
666 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
667 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
668 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
669 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
670 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
671 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
672 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
673 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
675 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
676 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
677 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
678 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
681 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
682 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
683 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
684 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
687 // TODO: get this crap out of here
688 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
689 gGameSettings
.WarmupTime
:= gsWarmupTime
;
690 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
694 procedure ProcStartCustomGame();
698 GameMode
:= LatchGameOptions('mCustomGameMenu');
699 if GameMode
= GM_NONE
then Exit
;
701 g_Console_WriteGameConfig
;
702 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
,
703 gsMaxLives
, gsGameFlags
, gsPlayers
);
707 procedure ProcStartNetGame();
711 GameMode
:= LatchGameOptions('mNetServerMenu');
712 if GameMode
= GM_NONE
then Exit
;
714 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
716 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
717 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
718 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
719 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
720 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
721 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
724 g_Console_WriteGameConfig
;
725 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
, gsMaxLives
,
726 gsGameFlags
, gsPlayers
, 0, NetPort
);
729 procedure ProcConnectNetGame();
733 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
735 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
736 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
737 PW
:= TGUIEdit(GetControl('edPW')).Text;
740 g_Console_WriteGameConfig
;
741 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
744 procedure ProcEnterPassword();
748 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
750 NetClientIP
:= PromptIP
;
751 NetClientPort
:= PromptPort
;
752 PW
:= TGUIEdit(GetControl('edPW')).Text;
755 g_Console_WriteGameConfig
;
756 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
759 procedure ProcServerlist();
761 if not NetInitDone
then
763 if (not g_Net_Init()) then
765 g_Console_Add('NET: ERROR: Failed to init ENet!');
772 g_Net_Slist_Set(NetMasterList
);
774 gState
:= STATE_SLIST
;
775 g_ActiveWindow
:= nil;
777 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
782 slReturnPressed
:= True;
783 if g_Net_Slist_Fetch(slCurrent
) then
785 if slCurrent
= nil then
786 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
789 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
790 g_Serverlist_GenerateTable(slCurrent
, slTable
);
793 procedure ProcStartCampaign();
799 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
801 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
802 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
804 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
810 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
813 procedure ProcSelectMap(Sender
: TGUIControl
);
817 wad
, map
, res
: String;
819 win
:= g_GUI_GetWindow('SelectMapMenu');
820 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
822 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
823 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
825 if (wad
= '') or (map
= '') then
826 begin // Ýòî íå êàðòà
827 TGUILabel(GetControl('lbMapName')).Text := '';
828 TGUILabel(GetControl('lbMapAuthor')).Text := '';
829 TGUILabel(GetControl('lbMapSize')).Text := '';
830 TGUIMemo(GetControl('meMapDescription')).SetText('');
831 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
832 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
838 a
:= g_Map_GetMapInfo(res
);
840 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
841 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
842 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
843 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
844 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
845 TGUILabel(win
.GetControl('lbMapScale')).Text :=
846 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
851 procedure ProcSelectWAD(Sender
: TGUIControl
);
856 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
858 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
860 with TGUIListBox(GetControl('lsMapRes')) do
866 list
:= g_Map_GetMapsList(wad
);
880 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
886 win
:= g_GUI_GetWindow('CampaignMenu');
887 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
889 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
893 TGUILabel(GetControl('lbWADName')).Text := '';
894 TGUILabel(GetControl('lbWADAuthor')).Text := '';
895 TGUIMemo(GetControl('meWADDescription')).SetText('');
898 a
:= g_Game_GetMegaWADInfo(wad
);
900 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
901 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
902 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
904 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
908 fn
:= g_ExtractWadName(a
.pic
);
910 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
912 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
917 procedure ProcChangeColor(Sender
: TGUIControl
);
921 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
922 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
923 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
924 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
925 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
926 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
928 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
929 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
930 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
931 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
932 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
933 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
936 procedure ProcSelectModel(Sender
: TGUIControl
);
941 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
942 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
943 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
945 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
946 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
947 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
949 ProcChangeColor(nil);
952 procedure MenuLoadData();
954 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
956 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
957 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
958 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
959 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
960 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
961 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
962 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
963 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
964 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
965 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
966 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
967 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
968 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
969 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
970 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
971 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
972 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
973 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
974 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
975 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
976 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
977 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
978 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
979 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
980 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
982 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
983 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
984 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
985 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
986 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
987 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
988 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
991 procedure MenuFreeData();
993 e_CharFont_Remove(gMenuFont
);
994 e_CharFont_Remove(gMenuSmallFont
);
996 g_Texture_Delete('MAINMENU_LOGO');
997 g_Texture_Delete('MAINMENU_MARKER1');
998 g_Texture_Delete('MAINMENU_MARKER2');
999 g_Texture_Delete('SCROLL_LEFT');
1000 g_Texture_Delete('SCROLL_RIGHT');
1001 g_Texture_Delete('SCROLL_MIDDLE');
1002 g_Texture_Delete('SCROLL_MARKER');
1003 g_Texture_Delete('EDIT_LEFT');
1004 g_Texture_Delete('EDIT_RIGHT');
1005 g_Texture_Delete('EDIT_MIDDLE');
1006 g_Texture_Delete('BOX1');
1007 g_Texture_Delete('BOX2');
1008 g_Texture_Delete('BOX3');
1009 g_Texture_Delete('BOX4');
1010 g_Texture_Delete('BOX5');
1011 g_Texture_Delete('BOX6');
1012 g_Texture_Delete('BOX7');
1013 g_Texture_Delete('BOX8');
1014 g_Texture_Delete('BOX9');
1015 g_Texture_Delete('BSCROLL_UP_A');
1016 g_Texture_Delete('BSCROLL_UP_U');
1017 g_Texture_Delete('BSCROLL_DOWN_A');
1018 g_Texture_Delete('BSCROLL_DOWN_U');
1019 g_Texture_Delete('BSCROLL_MIDDLE');
1020 g_Texture_Delete('NOPIC');
1022 g_Sound_Delete('MENU_SELECT');
1023 g_Sound_Delete('MENU_OPEN');
1024 g_Sound_Delete('MENU_CLOSE');
1025 g_Sound_Delete('MENU_CHANGE');
1026 g_Sound_Delete('SCROLL_ADD');
1027 g_Sound_Delete('SCROLL_SUB');
1028 g_Sound_Delete('SOUND_PLAYER_FALL');
1031 procedure ProcAuthorsMenu();
1033 gMusic
.SetByName('MUSIC_INTERMUS');
1037 procedure ProcExitMenuKeyDown (yes
: Boolean);
1040 snd
: TPlayableSound
;
1045 g_Game_StopAllSounds(True);
1046 case (Random(18)) of
1047 0: s
:= 'SOUND_MONSTER_PAIN';
1048 1: s
:= 'SOUND_MONSTER_DIE_3';
1049 2: s
:= 'SOUND_MONSTER_SLOP';
1050 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1051 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1052 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1053 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1054 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1055 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1056 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1057 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1058 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1059 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1060 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1061 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1062 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1063 else s
:= 'SOUND_PLAYER_FALL';
1065 snd
:= TPlayableSound
.Create();
1066 res
:= snd
.SetByName(s
);
1067 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1071 while snd
.IsPlaying() do begin end;
1079 procedure ProcLoadMenu();
1086 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1087 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1088 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1092 procedure ProcSaveMenu();
1100 name
:= g_GetSaveName(a
, valid
);
1101 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1102 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1106 procedure ProcSaveGame(Sender
: TGUIControl
);
1110 if g_Game_IsNet
then Exit
;
1111 if g_Game_IsTestMap
then Exit
;
1112 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1113 g_Game_PauseAllSounds(True);
1114 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1116 g_ActiveWindow
:= nil;
1117 g_Game_Pause(False);
1120 procedure ProcLoadGame(Sender
: TGUIControl
);
1124 if g_Game_IsNet
then Exit
;
1125 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1126 if g_LoadGame(a
) then
1128 g_Game_PauseAllSounds(False)
1130 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1132 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1133 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1134 //g_ActiveWindow := nil;
1138 procedure ProcSinglePlayer (n
: Integer);
1139 var wad
, map
: AnsiString;
1142 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1143 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1144 if e_FindResource(AllMapDirs
, wad
) then
1146 wad
:= ExpandFileName(wad
);
1147 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1151 procedure ProcSingle1Player
;
1156 procedure ProcSingle2Players
;
1161 procedure ProcSelectMapMenu();
1164 wad_lb
: TGUIFileListBox
;
1165 map_lb
: TGUIListBox
;
1168 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1169 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1170 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1172 if wad_lb
.SelectedItem() <> '' then
1173 map
:= map_lb
.SelectedItem()
1177 wad_lb
.UpdateFileList();
1180 if wad_lb
.SelectedItem() <> '' then
1183 map_lb
.SelectItem(map
);
1185 if map_lb
.SelectedItem() <> '' then
1189 g_GUI_ShowWindow('SelectMapMenu');
1192 procedure ProcSelectCampaignMenu();
1195 wad_lb
: TGUIFileListBox
;
1197 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1198 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1200 wad_lb
.UpdateFileList();
1202 if wad_lb
.SelectedItem() <> '' then
1203 ProcSelectCampaignWAD(nil);
1206 procedure ProcSetMap();
1208 wad
, map
, res
: String;
1210 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1212 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1213 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1216 if (wad
= '') or (map
= '') then
1219 wad
:= e_FindWadRel(MapDirs
, WAD
);
1221 res
:= wad
+':\'+map
;
1223 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1224 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1227 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1231 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1233 g_Sound_SetupAllVolumes(
1234 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1235 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1239 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1243 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1244 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1246 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1247 g_dbg_scale
:= TempScale
+ 1;
1251 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1255 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1256 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1257 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1258 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1261 procedure ProcOptionsPlayersMIMenu();
1266 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1268 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1270 if a
= '' then Exit
;
1272 i
:= g_PlayerModel_GetIndex(a
);
1273 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1275 TGUILabel(GetControl('lbName')).Text := PlayerModelsArray
[i
].Name
;
1276 TGUILabel(GetControl('lbAuthor')).Text := PlayerModelsArray
[i
].Author
;
1277 TGUIMemo(GetControl('meComment')).SetText(PlayerModelsArray
[i
].Description
);
1279 if PlayerModelsArray
[i
].HaveWeapon
then
1280 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1282 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1285 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1288 procedure ProcOptionsPlayersAnim();
1292 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1297 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1300 Model
.AnimState
.Loop
:= True;
1304 procedure ProcOptionsPlayersWeap();
1308 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1313 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1317 procedure ProcOptionsPlayersRot();
1321 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1322 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1324 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1328 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1332 g_Options_SetDefault();
1338 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1340 if yes
then ReadOptions();
1344 procedure ProcAuthorsClose();
1346 gMusic
.SetByName('MUSIC_MENU');
1348 gState
:= STATE_MENU
;
1351 procedure ProcGMClose();
1353 g_Game_InGameMenu(False);
1356 procedure ProcGMShow();
1361 if (gGameSettings
.GameType
= GT_SINGLE
) and
1362 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1363 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1364 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1366 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1367 if g_Game_IsTestMap
then
1368 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1369 TGUIMainMenu(g_ActiveWindow
.GetControl(
1370 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1373 procedure ProcChangePlayers();
1375 TeamGame
, Spectator
, AddTwo
: Boolean;
1376 P1Team
{, P2Team}: Byte;
1377 bP2
: TGUITextButton
;
1379 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1380 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1381 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1382 P1Team
:= TEAM_NONE
;
1383 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1385 //P2Team := TEAM_NONE;
1386 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1388 TGUIMainMenu(g_ActiveWindow
.GetControl(
1389 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1390 TGUIMainMenu(g_ActiveWindow
.GetControl(
1391 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1392 TGUIMainMenu(g_ActiveWindow
.GetControl(
1393 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1395 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1396 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1397 bP2
.Enabled
:= AddTwo
and not Spectator
;
1399 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1401 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1402 if gPlayer2
= nil then
1403 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1405 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1407 TGUIMainMenu(g_ActiveWindow
.GetControl(
1408 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1411 procedure ProcJoinRed();
1413 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1415 if g_Game_IsServer
then
1417 if gPlayer1
= nil then
1418 g_Game_AddPlayer(TEAM_RED
)
1421 if gPlayer1
.Team
<> TEAM_RED
then
1423 gPlayer1
.SwitchTeam
;
1424 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1427 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1432 gPlayer1Settings
.Team
:= TEAM_RED
;
1433 MC_SEND_PlayerSettings
;
1434 if gPlayer1
= nil then
1435 g_Game_AddPlayer(TEAM_RED
);
1437 g_ActiveWindow
:= nil;
1438 g_Game_Pause(False);
1441 procedure ProcJoinBlue();
1443 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1445 if g_Game_IsServer
then
1447 if gPlayer1
= nil then
1448 g_Game_AddPlayer(TEAM_BLUE
)
1451 if gPlayer1
.Team
<> TEAM_BLUE
then
1453 gPlayer1
.SwitchTeam
;
1454 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1457 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1462 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1463 MC_SEND_PlayerSettings
;
1464 if gPlayer1
= nil then
1465 g_Game_AddPlayer(TEAM_BLUE
);
1467 g_ActiveWindow
:= nil;
1468 g_Game_Pause(False);
1471 procedure ProcJoinGame();
1473 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1475 if gPlayer1
= nil then
1477 g_ActiveWindow
:= nil;
1478 g_Game_Pause(False);
1481 procedure ProcSwitchP2();
1483 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1485 if gPlayer1
= nil then
1487 if gPlayer2
= nil then
1490 g_Game_RemovePlayer();
1491 g_ActiveWindow
:= nil;
1492 g_Game_Pause(False);
1495 procedure ProcSpectate();
1497 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1500 g_ActiveWindow
:= nil;
1501 g_Game_Pause(False);
1504 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1506 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1509 procedure ProcEndMenuKeyDown (yes
: Boolean);
1511 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1514 procedure ProcSetRussianLanguage
;
1516 if gLanguage
<> LANGUAGE_RUSSIAN
then
1518 gLanguage
:= LANGUAGE_RUSSIAN
;
1519 gLanguageChange
:= True;
1520 gAskLanguage
:= False;
1525 procedure ProcSetEnglishLanguage
;
1527 if gLanguage
<> LANGUAGE_ENGLISH
then
1529 gLanguage
:= LANGUAGE_ENGLISH
;
1530 gLanguageChange
:= True;
1531 gAskLanguage
:= False;
1536 procedure ReadGameSettings();
1540 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1542 with gGameSettings
do
1544 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1545 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1549 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1550 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1552 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1554 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1558 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1559 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1564 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1565 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1566 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1568 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1569 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1570 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1573 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1578 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1580 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1581 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1582 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1584 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1585 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1589 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1590 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1592 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1593 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1594 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1595 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1596 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1597 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1598 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1602 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1603 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1604 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1605 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1606 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1611 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1612 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1617 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1618 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1623 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1624 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1629 procedure ProcApplyGameSet();
1633 stat
: TPlayerStatArray
;
1635 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1637 if not g_Game_IsServer
then Exit
;
1639 with gGameSettings
do
1641 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1643 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1644 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1646 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1649 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1651 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1652 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1653 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1654 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1655 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1659 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1661 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1662 Options
:= Options
or GAME_OPTION_DMKEYS
1664 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1667 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1669 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1675 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1677 TimeLimit
:= Max(n
, b
);
1681 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1683 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1690 if GameMode
= GM_DM
then
1692 stat
:= g_Player_GetStats();
1694 for a
:= 0 to High(stat
) do
1695 if stat
[a
].Frags
> b
then
1699 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1701 GoalLimit
:= Max(n
, b
);
1705 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1707 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1708 if n
< 0 then n
:= 0;
1709 if n
> 255 then n
:= 255;
1715 stat
:= g_Player_GetStats();
1717 for a
:= 0 to High(stat
) do
1718 if stat
[a
].Lives
> b
then
1721 MaxLives
:= Max(n
, b
);
1725 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1727 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1730 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1731 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1735 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1736 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1740 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1741 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1746 // don't forget to latch this shit
1747 gsGameFlags
:= Options
;
1748 gsMaxLives
:= MaxLives
;
1749 gsGoalLimit
:= GoalLimit
;
1750 gsTimeLimit
:= TimeLimit
;
1753 if g_Game_IsNet
then MH_SEND_GameSettings
;
1756 procedure ProcVideoOptionsRes();
1761 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1763 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1764 IntToStr(gWinSizeX
) +
1765 ' x ' + IntToStr(gWinSizeY
) +
1766 ', ' + IntToStr(gBPP
) + ' bpp';
1768 with TGUIListBox(menu
.GetControl('lsResolution')) do
1770 list
:= sys_GetDisplayModes(gBPP
);
1774 ItemIndex
:= Length(list
)
1782 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1788 TempResScale
:= Round(r_pixel_scale
- 1);
1789 with TGUISwitch(menu
.GetControl('swResFactor')) do
1790 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1793 procedure ProcApplyVideoOptions();
1796 Fullscreen
: Boolean;
1797 SWidth
, SHeight
: Integer;
1798 ScaleChanged
: Boolean;
1801 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1803 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1805 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1808 SWidth
:= gWinSizeX
;
1809 SHeight
:= gWinSizeY
;
1810 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1813 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1815 ScaleChanged
:= False;
1816 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1818 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1819 r_pixel_scale
:= TempResScale
+ 1;
1820 ScaleChanged
:= True;
1823 if (SWidth
<> gWinSizeX
) or
1824 (SHeight
<> gWinSizeY
) or
1825 (Fullscreen
<> gFullscreen
) or
1828 gResolutionChange
:= True;
1829 gRC_Width
:= SWidth
;
1830 gRC_Height
:= SHeight
;
1831 gRC_FullScreen
:= Fullscreen
;
1832 gRC_Maximized
:= gWinMaximized
;
1835 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1839 procedure ProcSetFirstRussianLanguage
;
1841 gLanguage
:= LANGUAGE_RUSSIAN
;
1842 gLanguageChange
:= True;
1843 gAskLanguage
:= False;
1846 procedure ProcSetFirstEnglishLanguage
;
1848 gLanguage
:= LANGUAGE_ENGLISH
;
1849 gLanguageChange
:= True;
1850 gAskLanguage
:= False;
1853 procedure ProcRecallAddress();
1855 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1857 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1858 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1862 procedure CreateFirstLanguageMenu();
1866 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1868 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1870 Name
:= 'mmFirstLanguageMenu';
1871 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1872 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1875 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1876 Menu
.MainWindow
:= True;
1877 g_GUI_AddWindow(Menu
);
1880 procedure g_Menu_AskLanguage();
1882 CreateFirstLanguageMenu();
1883 g_GUI_ShowWindow('FirstLanguageMenu');
1886 procedure CreatePlayerOptionsMenu(s
: String);
1891 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1893 a
:= _lc
[I_MENU_PLAYER_1
]
1895 a
:= _lc
[I_MENU_PLAYER_2
];
1896 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1898 Name
:= 'mOptionsPlayers'+s
+'Menu';
1899 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1901 Name
:= 'ed'+s
+'Name';
1905 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1907 Name
:= 'sw'+s
+'Team';
1908 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1909 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1911 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1913 Name
:= 'ls'+s
+'Model';
1915 Items
:= g_PlayerModel_GetNames();
1916 OnChange
:= ProcSelectModel
;
1918 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1920 Name
:= 'sc'+s
+'Red';
1922 OnChange
:= ProcChangeColor
;
1924 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1926 Name
:= 'sc'+s
+'Green';
1928 OnChange
:= ProcChangeColor
;
1930 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1932 Name
:= 'sc'+s
+'Blue';
1934 OnChange
:= ProcChangeColor
;
1937 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1938 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1939 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1940 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1942 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1944 Name
:= 'mv'+s
+'Model';
1945 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1946 Y
:= GetControl('ls'+s
+'Model').Y
;
1949 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1950 g_GUI_AddWindow(Menu
);
1953 procedure CreateAllMenus();
1957 a
, cx
, _y
, i
: Integer;
1960 Menu
:= TGUIWindow
.Create('MainMenu');
1961 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
1963 Name
:= 'mmMainMenu';
1964 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1965 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1966 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1967 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1968 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1969 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1971 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1973 Color
:= _RGB(255, 255, 255);
1974 X
:= gScreenWidth
-GetWidth
-8;
1975 Y
:= gScreenHeight
-GetHeight
-8;
1977 Menu
.DefControl
:= 'mmMainMenu';
1978 Menu
.MainWindow
:= True;
1979 g_GUI_AddWindow(Menu
);
1981 Menu
:= TGUIWindow
.Create('NewGameMenu');
1982 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
1984 Name
:= 'mmNewGameMenu';
1985 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1986 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1987 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1988 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1990 Menu
.DefControl
:= 'mmNewGameMenu';
1991 g_GUI_AddWindow(Menu
);
1993 Menu
:= TGUIWindow
.Create('NetGameMenu');
1994 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
1996 Name
:= 'mmNetGameMenu';
1997 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1998 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2000 Menu
.DefControl
:= 'mmNetGameMenu';
2001 g_GUI_AddWindow(Menu
);
2003 Menu
:= TGUIWindow
.Create('NetServerMenu');
2004 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2006 Name
:= 'mNetServerMenu';
2007 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2009 Name
:= 'edSrvName';
2010 OnlyDigits
:= False;
2013 Text := NetServerName
;
2015 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2017 Name
:= 'edSrvPassword';
2018 OnlyDigits
:= False;
2021 Text := NetPassword
;
2023 with AddEdit(_lc
[I_NET_PORT
]) do
2029 Text := IntToStr(NetPort
);
2031 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2033 Name
:= 'edMaxPlayers';
2037 Text := IntToStr(NetMaxClients
);
2039 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2041 Name
:= 'swUseMaster';
2042 AddItem(_lc
[I_MENU_YES
]);
2043 AddItem(_lc
[I_MENU_NO
]);
2044 if NetUseMaster
then
2050 with AddLabel(_lc
[I_MENU_MAP
]) do
2055 OnClick
:= @ProcSelectMapMenu
;
2057 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2059 Name
:= 'swGameMode';
2060 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2061 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2062 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2063 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2064 case g_Game_TextToMode(gsGameMode
) of
2066 GM_DM
: ItemIndex
:= 0;
2067 GM_TDM
: ItemIndex
:= 1;
2068 GM_CTF
: ItemIndex
:= 2;
2070 GM_COOP
: ItemIndex
:= 3;
2072 OnChange
:= ProcSwitchMonstersCustom
;
2074 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2076 Name
:= 'edTimeLimit';
2080 if gsTimeLimit
> 0 then
2081 Text := IntToStr(gsTimeLimit
);
2083 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2085 Name
:= 'edGoalLimit';
2089 if gsGoalLimit
> 0 then
2090 Text := IntToStr(gsGoalLimit
);
2092 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2094 Name
:= 'edMaxLives';
2098 if gsMaxLives
> 0 then
2099 Text := IntToStr(gsMaxLives
);
2101 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2103 Name
:= 'edItemRespawnTime';
2107 if gsItemRespawnTime
> 0 then
2108 Text := IntToStr(gsItemRespawnTime
);
2110 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2112 Name
:= 'swPlayers';
2113 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2114 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2115 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2116 ItemIndex
:= gsPlayers
;
2118 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2120 Name
:= 'swTeamDamage';
2121 AddItem(_lc
[I_MENU_YES
]);
2122 AddItem(_lc
[I_MENU_NO
]);
2123 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2128 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2130 Name
:= 'swTeamHit';
2131 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2132 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2133 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2134 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2135 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2137 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2139 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2144 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2146 Name
:= 'swDeathmatchKeys';
2147 AddItem(_lc
[I_MENU_YES
]);
2148 AddItem(_lc
[I_MENU_NO
]);
2149 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2154 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2156 Name
:= 'swEnableExits';
2157 AddItem(_lc
[I_MENU_YES
]);
2158 AddItem(_lc
[I_MENU_NO
]);
2159 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2164 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2166 Name
:= 'swWeaponStay';
2167 AddItem(_lc
[I_MENU_YES
]);
2168 AddItem(_lc
[I_MENU_NO
]);
2169 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2174 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2176 Name
:= 'swMonsters';
2177 AddItem(_lc
[I_MENU_YES
]);
2178 AddItem(_lc
[I_MENU_NO
]);
2179 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2184 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2187 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2188 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2189 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2191 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2193 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2197 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2201 Menu
.DefControl
:= 'mNetServerMenu';
2202 g_GUI_AddWindow(Menu
);
2204 Menu
:= TGUIWindow
.Create('NetClientMenu');
2205 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2207 Name
:= 'mNetClientMenu';
2209 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2212 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2218 Text := 'localhost';
2220 with AddEdit(_lc
[I_NET_PORT
]) do
2228 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2231 OnlyDigits
:= False;
2238 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2242 Menu
.DefControl
:= 'mNetClientMenu';
2243 g_GUI_AddWindow(Menu
);
2245 Menu
:= TGUIWindow
.Create('LoadMenu');
2246 Menu
.OnShow
:= ProcLoadMenu
;
2247 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2249 Name
:= 'mmLoadMenu';
2254 Name
:= 'edSlot'+IntToStr(a
);
2257 OnEnter
:= ProcLoadGame
;
2260 Menu
.DefControl
:= 'mmLoadMenu';
2261 g_GUI_AddWindow(Menu
);
2263 Menu
:= TGUIWindow
.Create('SaveMenu');
2264 Menu
.OnShow
:= ProcSaveMenu
;
2265 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2267 Name
:= 'mmSaveMenu';
2272 Name
:= 'edSlot'+IntToStr(a
);
2275 OnChange
:= ProcSaveGame
;
2278 Menu
.DefControl
:= 'mmSaveMenu';
2279 g_GUI_AddWindow(Menu
);
2281 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2282 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2284 Name
:= 'mCustomGameMenu';
2285 with AddLabel(_lc
[I_MENU_MAP
]) do
2290 OnClick
:= @ProcSelectMapMenu
;
2292 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2294 Name
:= 'swGameMode';
2295 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2296 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2297 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2298 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2299 case g_Game_TextToMode(gsGameMode
) of
2301 GM_DM
: ItemIndex
:= 0;
2302 GM_TDM
: ItemIndex
:= 1;
2303 GM_CTF
: ItemIndex
:= 2;
2305 GM_COOP
: ItemIndex
:= 3;
2307 OnChange
:= ProcSwitchMonstersCustom
;
2309 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2311 Name
:= 'edTimeLimit';
2315 if gsTimeLimit
> 0 then
2316 Text := IntToStr(gsTimeLimit
);
2318 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2320 Name
:= 'edGoalLimit';
2324 if gsGoalLimit
> 0 then
2325 Text := IntToStr(gsGoalLimit
);
2327 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2329 Name
:= 'edMaxLives';
2333 if gsMaxLives
> 0 then
2334 Text := IntToStr(gsMaxLives
);
2336 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2338 Name
:= 'edItemRespawnTime';
2342 if gsItemRespawnTime
> 0 then
2343 Text := IntToStr(gsItemRespawnTime
);
2345 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2347 Name
:= 'swPlayers';
2348 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2349 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2350 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2351 ItemIndex
:= gsPlayers
;
2353 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2355 Name
:= 'swTeamDamage';
2356 AddItem(_lc
[I_MENU_YES
]);
2357 AddItem(_lc
[I_MENU_NO
]);
2358 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2363 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2365 Name
:= 'swTeamHit';
2366 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2367 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2368 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2369 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2370 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2372 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2374 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2379 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2381 Name
:= 'swDeathmatchKeys';
2382 AddItem(_lc
[I_MENU_YES
]);
2383 AddItem(_lc
[I_MENU_NO
]);
2384 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2389 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2391 Name
:= 'swEnableExits';
2392 AddItem(_lc
[I_MENU_YES
]);
2393 AddItem(_lc
[I_MENU_NO
]);
2394 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2399 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2401 Name
:= 'swWeaponStay';
2402 AddItem(_lc
[I_MENU_YES
]);
2403 AddItem(_lc
[I_MENU_NO
]);
2404 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2409 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2411 Name
:= 'swMonsters';
2412 AddItem(_lc
[I_MENU_YES
]);
2413 AddItem(_lc
[I_MENU_NO
]);
2414 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2419 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2422 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2423 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2424 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2426 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2428 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2432 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2436 Menu
.DefControl
:= 'mCustomGameMenu';
2437 g_GUI_AddWindow(Menu
);
2439 Menu
:= TGUIWindow
.Create('CampaignMenu');
2440 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2442 Name
:= 'mCampaignMenu';
2451 with AddFileList('', 15, 4) do
2454 OnChange
:= ProcSelectCampaignWAD
;
2458 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2459 SetBase(MegawadDirs
);
2462 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2464 Name
:= 'lbWADName';
2468 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2470 Name
:= 'lbWADAuthor';
2474 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2475 with AddMemo('', 15, 3) do
2477 Name
:= 'meWADDescription';
2478 Color
:= MENU_ITEMSCTRL_COLOR
;
2480 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2482 Name
:= 'swPlayers';
2483 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2484 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2487 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2491 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2493 Name
:= 'mpWADImage';
2494 DefaultRes
:= 'NOPIC';
2495 X
:= GetControl('lsWAD').X
+4;
2496 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2499 Menu
.DefControl
:= 'mCampaignMenu';
2500 g_GUI_AddWindow(Menu
);
2502 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2503 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2505 Name
:= 'mSelectMapMenu';
2506 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2509 OnChange
:= ProcSelectWAD
;
2513 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2516 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2520 OnChange
:= ProcSelectMap
;
2523 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2525 Name
:= 'lbMapName';
2529 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2531 Name
:= 'lbMapAuthor';
2535 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2537 Name
:= 'lbMapSize';
2541 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2543 Name
:= 'meMapDescription';
2548 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2550 Name
:= 'mpMapPreview';
2551 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2552 Y
:= GetControl('lsMapWAD').Y
;
2554 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2556 Name
:= 'lbMapScale';
2559 Color
:= MENU_ITEMSCTRL_COLOR
;
2560 X
:= GetControl('lsMapWAD').X
+
2561 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2562 2 + MAPPREVIEW_WIDTH
*4;
2563 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2566 Menu
.OnClose
:= ProcSetMap
;
2567 Menu
.DefControl
:= 'mSelectMapMenu';
2568 g_GUI_AddWindow(Menu
);
2570 Menu
:= TGUIWindow
.Create('OptionsMenu');
2571 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2573 Name
:= 'mmOptionsMenu';
2574 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2575 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2576 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2577 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2578 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2579 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2581 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2582 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2584 Menu
.OnClose
:= ProcApplyOptions
;
2585 Menu
.DefControl
:= 'mmOptionsMenu';
2586 g_GUI_AddWindow(Menu
);
2588 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2589 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2590 g_GUI_AddWindow(Menu
);
2592 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2593 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2595 Name
:= 'mOptionsVideoMenu';
2596 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2597 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2603 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2606 AddItem(_lc
[I_MENU_YES
]);
2607 AddItem(_lc
[I_MENU_NO
]);
2609 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2611 Name
:= 'swTextureFilter';
2612 AddItem(_lc
[I_MENU_YES
]);
2613 AddItem(_lc
[I_MENU_NO
]);
2615 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2618 AddItem(_lc
[I_MENU_YES
]);
2619 AddItem(_lc
[I_MENU_NO
]);
2621 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2623 Name
:= 'swLegacyNPOT';
2624 AddItem(_lc
[I_MENU_NO
]);
2625 AddItem(_lc
[I_MENU_YES
]);
2628 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2631 Menu
.DefControl
:= 'mOptionsVideoMenu';
2632 g_GUI_AddWindow(Menu
);
2634 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2635 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2637 Name
:= 'mOptionsVideoResMenu';
2638 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2640 Name
:= 'lbCurrentRes';
2644 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2646 Name
:= 'lsResolution';
2649 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2651 Name
:= 'swFullScreen';
2652 AddItem(_lc
[I_MENU_YES
]);
2653 AddItem(_lc
[I_MENU_NO
]);
2655 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2657 Name
:= 'swResFactor';
2659 for i
:= 2 to gRC_Width
div 640 do
2660 AddItem(IntToStr(i
) + 'x');
2663 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2666 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2667 g_GUI_AddWindow(Menu
);
2669 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2670 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2672 Name
:= 'mOptionsSoundMenu';
2673 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2675 Name
:= 'scMusicLevel';
2677 OnChange
:= ProcChangeSoundSettings
;
2679 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2681 Name
:= 'scSoundLevel';
2683 OnChange
:= ProcChangeSoundSettings
;
2685 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2687 Name
:= 'scMaxSimSounds';
2690 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2692 Name
:= 'swAnnouncer';
2693 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2694 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2695 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2696 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2698 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2699 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2701 Name
:= 'swSoundEffects';
2702 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2703 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2705 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2706 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2708 Name
:= 'swChatSpeech';
2709 AddItem(_lc
[I_MENU_YES
]);
2710 AddItem(_lc
[I_MENU_NO
]);
2712 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2714 Name
:= 'swInactiveSounds';
2715 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2716 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2720 Menu
.DefControl
:= 'mOptionsSoundMenu';
2721 g_GUI_AddWindow(Menu
);
2723 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2724 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2726 Name
:= 'mOptionsGameMenu';
2727 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2729 Name
:= 'scParticlesCount';
2732 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2734 Name
:= 'swBloodCount';
2735 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2736 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2737 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2738 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2739 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2741 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2743 Name
:= 'scShellsMax';
2746 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2748 Name
:= 'scGibsMax';
2751 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2753 Name
:= 'scCorpsesMax';
2756 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2758 Name
:= 'swGibsCount';
2759 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2760 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2761 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2762 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2763 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2765 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2767 Name
:= 'swCorpseType';
2768 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2769 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2771 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2773 Name
:= 'swGibsType';
2774 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2775 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2777 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2779 Name
:= 'swBloodType';
2780 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2781 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2783 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2785 Name
:= 'swScreenFlash';
2786 AddItem(_lc
[I_MENU_NO
]);
2787 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2788 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2790 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2792 Name
:= 'swBackground';
2793 AddItem(_lc
[I_MENU_YES
]);
2794 AddItem(_lc
[I_MENU_NO
]);
2796 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2798 Name
:= 'swMessages';
2799 AddItem(_lc
[I_MENU_YES
]);
2800 AddItem(_lc
[I_MENU_NO
]);
2802 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2804 Name
:= 'swRevertPlayers';
2805 AddItem(_lc
[I_MENU_YES
]);
2806 AddItem(_lc
[I_MENU_NO
]);
2808 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2810 Name
:= 'swChatBubble';
2811 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2812 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2813 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2814 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2815 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2817 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2819 Name
:= 'swPlayerIndicator';
2820 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2821 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2822 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2824 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2826 Name
:= 'swPlayerIndicatorStyle';
2827 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2828 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2830 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2832 Name
:= 'scScaleFactor';
2834 OnChange
:= ProcChangeGameSettings
;
2838 Menu
.DefControl
:= 'mOptionsGameMenu';
2839 g_GUI_AddWindow(Menu
);
2841 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2842 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2844 Name
:= 'mOptionsControlsMenu';
2845 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2846 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2847 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2848 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2849 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2851 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2852 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2853 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2854 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2855 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2856 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2857 if e_HasJoysticks
then
2860 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2862 if g_touch_enabled
then
2865 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2868 Menu
.DefControl
:= 'mOptionsControlsMenu';
2869 g_GUI_AddWindow(Menu
);
2871 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2872 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2874 Name
:= 'mOptionsControlsP1Menu';
2875 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2876 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2877 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2878 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2879 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2880 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2881 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2882 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2883 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2884 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2886 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2887 g_GUI_AddWindow(Menu
);
2889 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2890 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2892 Name
:= 'mOptionsControlsP1MenuWeapons';
2893 for i
:= WP_FIRST
to WP_LAST
do
2894 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2895 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2897 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2898 g_GUI_AddWindow(Menu
);
2900 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2901 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2903 Name
:= 'mOptionsControlsP2Menu';
2904 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2905 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2906 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2907 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2908 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2909 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2910 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2911 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2912 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2913 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2915 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2916 g_GUI_AddWindow(Menu
);
2918 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2919 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2921 Name
:= 'mOptionsControlsP2MenuWeapons';
2922 for i
:= WP_FIRST
to WP_LAST
do
2923 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2924 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2926 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2927 g_GUI_AddWindow(Menu
);
2929 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2930 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2932 Name
:= 'mOptionsControlsJoystickMenu';
2933 for i
:= 0 to e_MaxJoys
- 1 do
2934 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2936 Name
:= 'scDeadzone' + IntToStr(i
);
2940 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2941 g_GUI_AddWindow(Menu
);
2943 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2944 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2946 Name
:= 'mOptionsControlsTouchMenu';
2947 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
2949 Name
:= 'swTouchAlt';
2950 AddItem(_lc
[I_MENU_NO
]);
2951 AddItem(_lc
[I_MENU_YES
]);
2952 OnChange
:= ProcChangeTouchSettings
;
2954 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2956 Name
:= 'scTouchSize';
2958 OnChange
:= ProcChangeTouchSettings
;
2960 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2962 Name
:= 'swTouchFire';
2963 AddItem(_lc
[I_MENU_NO
]);
2964 AddItem(_lc
[I_MENU_YES
]);
2966 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
2968 Name
:= 'scTouchOffset';
2970 OnChange
:= ProcChangeTouchSettings
;
2973 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
2974 g_GUI_AddWindow(Menu
);
2976 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2977 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2979 Name
:= 'mOptionsPlayersMenu';
2980 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2981 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2983 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2984 g_GUI_AddWindow(Menu
);
2986 CreatePlayerOptionsMenu('P1');
2987 CreatePlayerOptionsMenu('P2');
2989 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2990 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2992 Name
:= 'mOptionsPlayersMIMenu';
2993 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2998 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3003 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3005 Name
:= 'meComment';
3008 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3009 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3012 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3016 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3017 g_GUI_AddWindow(Menu
);
3019 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3020 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3022 Name
:= 'mOptionsLanguageMenu';
3023 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3024 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3027 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3028 g_GUI_AddWindow(Menu
);
3030 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3031 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3032 g_GUI_AddWindow(Menu
);
3034 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3035 Menu
.BackTexture
:= 'INTER';
3036 Menu
.OnClose
:= ProcAuthorsClose
;
3040 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3042 Color
:= _RGB(255, 0, 0);
3043 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3045 _y
:= _y
+GetHeight();
3047 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3049 Color
:= _RGB(255, 0, 0);
3050 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3052 _y
:= _y
+GetHeight()+32;
3054 // ×òî äåëàë: Êòî äåëàë
3055 cx
:= gScreenWidth
div 2 - 320 + 64;
3056 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3058 Color
:= _RGB(255, 0, 0);
3063 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3065 Color
:= _RGB(255, 255, 255);
3070 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3072 Color
:= _RGB(255, 0, 0);
3077 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3079 Color
:= _RGB(255, 255, 255);
3084 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3086 Color
:= _RGB(255, 255, 255);
3091 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3093 Color
:= _RGB(255, 0, 0);
3098 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3100 Color
:= _RGB(255, 255, 255);
3105 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3107 Color
:= _RGB(255, 0, 0);
3112 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3114 Color
:= _RGB(255, 255, 255);
3117 _y
:= gScreenHeight
- 128;
3120 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3122 Color
:= _RGB(255, 0, 0);
3127 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3129 Color
:= _RGB(255, 255, 255);
3132 _y
:= _y
+GetHeight();
3134 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3136 Color
:= _RGB(255, 255, 255);
3139 _y
:= _y
+GetHeight();
3141 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3143 Color
:= _RGB(255, 255, 255);
3146 _y
:= gScreenHeight
- 32;
3148 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3150 Color
:= _RGB(255, 0, 0);
3151 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3154 g_GUI_AddWindow(Menu
);
3156 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3157 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3158 g_GUI_AddWindow(Menu
);
3160 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3161 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3163 Name
:= 'mmGameSingleMenu';
3164 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3165 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3166 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3167 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3168 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3169 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3171 Menu
.DefControl
:= 'mmGameSingleMenu';
3172 Menu
.MainWindow
:= True;
3173 Menu
.OnClose
:= ProcGMClose
;
3174 Menu
.OnShow
:= ProcGMShow
;
3175 g_GUI_AddWindow(Menu
);
3177 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3178 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3179 g_GUI_AddWindow(Menu
);
3181 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3182 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3183 g_GUI_AddWindow(Menu
);
3185 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3186 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3188 Name
:= 'mmGameCustomMenu';
3189 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3190 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3191 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3192 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3193 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3194 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3195 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3197 Menu
.DefControl
:= 'mmGameCustomMenu';
3198 Menu
.MainWindow
:= True;
3199 Menu
.OnClose
:= ProcGMClose
;
3200 Menu
.OnShow
:= ProcGMShow
;
3201 g_GUI_AddWindow(Menu
);
3203 Menu
:= TGUIWindow
.Create('GameServerMenu');
3204 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3206 Name
:= 'mmGameServerMenu';
3207 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3208 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3209 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3210 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3211 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3213 Menu
.DefControl
:= 'mmGameServerMenu';
3214 Menu
.MainWindow
:= True;
3215 Menu
.OnClose
:= ProcGMClose
;
3216 Menu
.OnShow
:= ProcGMShow
;
3217 g_GUI_AddWindow(Menu
);
3219 Menu
:= TGUIWindow
.Create('GameClientMenu');
3220 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3222 Name
:= 'mmGameClientMenu';
3223 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3224 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3225 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3227 Menu
.DefControl
:= 'mmGameClientMenu';
3228 Menu
.MainWindow
:= True;
3229 Menu
.OnClose
:= ProcGMClose
;
3230 Menu
.OnShow
:= ProcGMShow
;
3231 g_GUI_AddWindow(Menu
);
3233 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3234 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3236 Name
:= 'mClientPasswordMenu';
3237 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3245 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3248 Menu
.DefControl
:= 'mClientPasswordMenu';
3249 g_GUI_AddWindow(Menu
);
3251 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3252 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3254 Name
:= 'mGameSetGameMenu';
3255 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3257 Name
:= 'swTeamDamage';
3258 AddItem(_lc
[I_MENU_YES
]);
3259 AddItem(_lc
[I_MENU_NO
]);
3262 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3264 Name
:= 'swTeamHit';
3265 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3266 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3267 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3268 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3271 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3273 Name
:= 'swDeathmatchKeys';
3274 AddItem(_lc
[I_MENU_YES
]);
3275 AddItem(_lc
[I_MENU_NO
]);
3278 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3280 Name
:= 'edTimeLimit';
3285 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3287 Name
:= 'edGoalLimit';
3292 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3294 Name
:= 'edMaxLives';
3299 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3302 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3303 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3304 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3310 Menu
.DefControl
:= 'mGameSetGameMenu';
3311 Menu
.OnClose
:= ProcApplyGameSet
;
3312 g_GUI_AddWindow(Menu
);
3314 Menu
:= TGUIWindow
.Create('TeamMenu');
3315 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3317 Name
:= 'mmTeamMenu';
3318 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3319 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3320 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3321 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3322 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3324 Menu
.DefControl
:= 'mmTeamMenu';
3325 Menu
.OnShow
:= ProcChangePlayers
;
3326 g_GUI_AddWindow(Menu
);
3329 procedure g_Menu_Show_SaveMenu();
3331 if g_Game_IsTestMap
then
3333 if gGameSettings
.GameType
= GT_SINGLE
then
3334 g_GUI_ShowWindow('GameSingleMenu')
3337 if g_Game_IsClient
then
3340 if g_Game_IsNet
then
3343 g_GUI_ShowWindow('GameCustomMenu');
3345 g_GUI_ShowWindow('SaveMenu');
3346 g_Sound_PlayEx('MENU_OPEN');
3349 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3351 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3352 if gGameSettings
.GameType
= GT_SINGLE
then
3354 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3358 if g_Game_IsClient
then exit
;
3359 if g_Game_IsNet
then exit
;
3360 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3362 g_GUI_ShowWindow('LoadMenu');
3363 g_Sound_PlayEx('MENU_OPEN');
3366 procedure g_Menu_Show_GameSetGame();
3368 if gGameSettings
.GameType
= GT_SINGLE
then
3369 g_GUI_ShowWindow('GameSingleMenu')
3372 if g_Game_IsClient
then
3375 if g_Game_IsNet
then
3376 g_GUI_ShowWindow('GameServerMenu')
3378 g_GUI_ShowWindow('GameCustomMenu');
3381 g_GUI_ShowWindow('GameSetGameMenu');
3382 g_Sound_PlayEx('MENU_OPEN');
3385 procedure g_Menu_Show_OptionsVideo();
3387 if gGameSettings
.GameType
= GT_SINGLE
then
3388 g_GUI_ShowWindow('GameSingleMenu')
3391 if g_Game_IsClient
then
3392 g_GUI_ShowWindow('GameClientMenu')
3394 if g_Game_IsNet
then
3395 g_GUI_ShowWindow('GameServerMenu')
3397 g_GUI_ShowWindow('GameCustomMenu');
3400 g_GUI_ShowWindow('OptionsMenu');
3401 g_GUI_ShowWindow('OptionsVideoMenu');
3402 g_Sound_PlayEx('MENU_OPEN');
3405 procedure g_Menu_Show_OptionsSound();
3407 if gGameSettings
.GameType
= GT_SINGLE
then
3408 g_GUI_ShowWindow('GameSingleMenu')
3411 if g_Game_IsClient
then
3412 g_GUI_ShowWindow('GameClientMenu')
3414 if g_Game_IsNet
then
3415 g_GUI_ShowWindow('GameServerMenu')
3417 g_GUI_ShowWindow('GameCustomMenu');
3420 g_GUI_ShowWindow('OptionsMenu');
3421 g_GUI_ShowWindow('OptionsSoundMenu');
3422 g_Sound_PlayEx('MENU_OPEN');
3425 procedure g_Menu_Show_EndGameMenu();
3427 g_GUI_ShowWindow('EndGameMenu');
3428 g_Sound_PlayEx('MENU_OPEN');
3431 procedure g_Menu_Show_QuitGameMenu();
3433 g_GUI_ShowWindow('ExitMenu');
3434 g_Sound_PlayEx('MENU_OPEN');
3437 procedure g_Menu_Init();
3443 procedure g_Menu_Free();
3448 procedure g_Menu_Reset();
3452 g_GUI_SaveMenuPos();
3453 ex
:= g_GUI_Destroy();
3457 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3462 g_Game_SetDebugMode();
3464 g_GUI_LoadMenuPos();