1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../shared/a_modes.inc}
20 procedure g_Menu_Init();
21 procedure g_Menu_Free();
22 procedure g_Menu_Reset();
23 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
24 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
25 procedure g_Menu_AskLanguage();
27 procedure g_Menu_Show_SaveMenu();
28 procedure g_Menu_Show_LoadMenu(standalone
: Boolean=false);
29 procedure g_Menu_Show_GameSetGame();
30 procedure g_Menu_Show_OptionsVideo();
31 procedure g_Menu_Show_OptionsSound();
32 procedure g_Menu_Show_EndGameMenu();
33 procedure g_Menu_Show_QuitGameMenu();
37 gMenuSmallFont
: DWORD
;
40 TempScale
: Integer = -1;
41 TempResScale
: Integer = -1;
46 {$INCLUDE ../nogl/noGLuses.inc}
47 g_gui
, g_textures
, e_graphics
, g_main
, g_window
, g_game
, g_map
,
48 g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
, g_weapons
,
49 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
50 MAPDEF
, Math
, g_saveload
,
51 e_texture
, g_language
, e_res
,
52 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
, g_touch
,
53 utils
, wadreader
, g_system
;
56 type TYNCallback
= procedure (yes
:Boolean);
58 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
60 if win
.UserData
= nil then exit
;
62 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
63 IK_N
: TYNCallback(win
.UserData
)(false);
67 procedure YesButtonCB (ctl
: TGUITextButton
);
69 if ctl
.UserData
= nil then exit
;
70 TYNCallback(ctl
.UserData
)(true);
73 procedure NoButtonCB (ctl
: TGUITextButton
);
75 if ctl
.UserData
= nil then exit
;
76 TYNCallback(ctl
.UserData
)(false);
79 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
83 //if length(Text) = 0 then exit;
84 Result
:= TGUIWindow
.Create(WinName
);
87 //OnKeyDownEx := @YNKeyDownProc;
88 //UserData := @ActionProc;
89 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
92 Name
:= '__temp_yes_no_menu:'+WinName
;
94 AddText(Text, MaxLen
);
95 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
96 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
98 DefControl
:= '__temp_yes_no_menu:'+WinName
;
104 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
105 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
107 procedure ProcApplyOptions();
113 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
115 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
121 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
122 if (ovs
<> gVSync
) then
123 sys_EnableVSync(gVSync
);
125 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
126 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
127 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).ItemIndex
= 0;
129 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
131 g_Sound_SetupAllVolumes(
132 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
133 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
136 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
137 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
138 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
139 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
140 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
142 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
144 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
145 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
146 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
147 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
149 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
154 else gGibsCount
:= 48;
157 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
158 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
159 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
160 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
161 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
162 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
163 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
164 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
165 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
166 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
167 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
168 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
170 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
171 g_dbg_scale
:= TempScale
+ 1;
174 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
178 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
179 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
180 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
181 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
182 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
183 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
184 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
185 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
188 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
191 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
193 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
194 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
195 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
196 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
197 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
198 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
199 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
200 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
203 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
204 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
205 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
206 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
207 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext', '-p1_weapnext');
208 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev', '-p1_weapprev');
209 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
210 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
212 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
213 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
214 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
215 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
216 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
217 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
218 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
219 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
220 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
221 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
224 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
228 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext', '-p1_weapnext');
229 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev', '-p1_weapprev');
230 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
231 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
234 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
237 for i
:= WP_FIRST
to WP_LAST
do
239 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
240 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
241 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
242 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
246 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
249 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
250 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
251 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
252 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
253 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
254 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
255 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
256 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
257 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
258 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
259 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
260 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
261 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
262 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
263 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
264 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
265 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p2_weapnext', '-p2_weapnext');
266 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev', '-p2_weapprev');
267 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
268 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
270 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
271 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
272 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
273 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
274 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
275 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
276 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
277 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
278 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
279 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
282 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
283 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
284 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
285 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
286 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext', '-p2_weapnext');
287 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev', '-p2_weapprev');
288 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
289 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
292 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
295 for i
:= WP_FIRST
to WP_LAST
do
297 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
298 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
299 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
300 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
304 if e_HasJoysticks
then
306 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
309 for i
:= 0 to e_MaxJoys
- 1 do
310 if e_JoystickAvailable
[i
] then
311 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
315 if g_touch_enabled
then
317 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
318 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
319 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
320 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
321 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
324 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
326 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
327 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
328 TEAM_RED
, TEAM_BLUE
);
330 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
332 gPlayer1Settings
.Model
:= Model
.Name
;
333 gPlayer1Settings
.Color
:= Model
.Color
;
336 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
338 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
339 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
340 TEAM_RED
, TEAM_BLUE
);
341 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
343 gPlayer2Settings
.Model
:= Model
.Name
;
344 gPlayer2Settings
.Color
:= Model
.Color
;
347 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
348 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
350 if g_Game_IsServer
then
352 if gPlayer1
<> nil then
354 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
355 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
356 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
357 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
359 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
362 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
365 if gPlayer2
<> nil then
367 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
368 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
369 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
370 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
372 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
377 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
379 g_Console_WriteGameConfig
;
382 procedure ReadOptions();
387 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
389 with TGUISwitch(menu
.GetControl('swBPP')) do
395 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
396 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
398 with TGUISwitch(menu
.GetControl('swVSync')) do
399 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
401 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
402 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
404 with TGUISwitch(menu
.GetControl('swInterp')) do
405 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
407 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
409 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
410 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
411 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
413 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
414 if gMuteWhenInactive
then
419 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
421 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
422 if gSoundEffectsDF
then
427 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
428 if gUseChatSounds
then
433 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
436 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
437 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
438 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
439 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
440 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
441 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
442 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
443 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
445 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
447 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
448 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
449 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
450 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
451 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
452 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
453 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
454 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
455 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
456 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
459 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
462 for i
:= WP_FIRST
to WP_LAST
do
464 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
465 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
469 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
472 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
473 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
474 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
476 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
477 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
478 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
481 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
488 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
489 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
490 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
491 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
492 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
495 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
498 for i
:= WP_FIRST
to WP_LAST
do
500 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
501 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
505 if e_HasJoysticks
then
507 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
510 for i
:= 0 to e_MaxJoys
- 1 do
511 if e_JoystickAvailable
[i
] then
512 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
516 if g_touch_enabled
then
518 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
519 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
520 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
521 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
522 with TGUISwitch(menu
.GetControl('swTouchFire')) do
523 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
524 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
527 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
530 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
531 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
532 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
533 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
536 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
538 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
539 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
540 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
541 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
542 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
544 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
547 with TGUISwitch(menu
.GetControl('swBloodType')) do
548 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
550 with TGUISwitch(menu
.GetControl('swCorpseType')) do
551 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
553 with TGUISwitch(menu
.GetControl('swGibsType')) do
554 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
556 with TGUISwitch(menu
.GetControl('swGibsCount')) do
565 with TGUISwitch(menu
.GetControl('swBackGround')) do
566 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
568 with TGUISwitch(menu
.GetControl('swMessages')) do
569 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
571 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
572 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
574 with TGUISwitch(menu
.GetControl('swChatBubble')) do
575 ItemIndex
:= gChatBubble
;
577 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
578 ItemIndex
:= gPlayerIndicator
;
580 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
581 ItemIndex
:= gPlayerIndicatorStyle
;
583 TempScale
:= Round(g_dbg_scale
- 1);
584 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
586 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
588 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
589 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
591 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
592 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
594 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
595 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
596 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
598 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
600 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
601 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
603 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
604 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
606 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
607 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
608 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
610 ProcSelectModel(nil);
613 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
615 // don't turn off monsters in DM
617 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
618 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
619 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
621 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
624 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
625 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
626 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
627 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
631 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
633 // don't turn off monsters in DM
635 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
636 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
637 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
639 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
642 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
643 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
644 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
645 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
649 function LatchGameOptions(const MenuName
: string): Byte;
655 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
657 Map
:= TGUILabel(GetControl('lbMap')).Text;
660 if not isWadPath(Map
) then
663 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
664 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
665 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
666 gsGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
667 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
668 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
669 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
673 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
674 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
675 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
676 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
677 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
678 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
679 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
680 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
681 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
682 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
684 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
685 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
686 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
687 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
690 // TODO: get this crap out of here
691 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
692 gGameSettings
.WarmupTime
:= gsWarmupTime
;
693 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
697 procedure ProcStartCustomGame();
701 GameMode
:= LatchGameOptions('mCustomGameMenu');
702 if GameMode
= GM_NONE
then Exit
;
704 g_Console_WriteGameConfig
;
705 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
,
706 gsMaxLives
, gsGameFlags
, gsPlayers
);
710 procedure ProcStartNetGame();
714 GameMode
:= LatchGameOptions('mNetServerMenu');
715 if GameMode
= GM_NONE
then Exit
;
717 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
719 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
720 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
721 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
722 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
723 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
724 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
727 g_Console_WriteGameConfig
;
728 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
, gsMaxLives
,
729 gsGameFlags
, gsPlayers
, 0, NetPort
);
732 procedure ProcConnectNetGame();
736 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
738 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
739 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
740 PW
:= TGUIEdit(GetControl('edPW')).Text;
743 g_Console_WriteGameConfig
;
744 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
747 procedure ProcEnterPassword();
751 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
753 NetClientIP
:= PromptIP
;
754 NetClientPort
:= PromptPort
;
755 PW
:= TGUIEdit(GetControl('edPW')).Text;
758 g_Console_WriteGameConfig
;
759 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
762 procedure ProcServerlist();
764 if not NetInitDone
then
766 if (not g_Net_Init()) then
768 g_Console_Add('NET: ERROR: Failed to init ENet!');
775 g_Net_Slist_Set(NetMasterList
);
777 gState
:= STATE_SLIST
;
778 g_ActiveWindow
:= nil;
780 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
785 slReturnPressed
:= True;
786 if g_Net_Slist_Fetch(slCurrent
) then
788 if slCurrent
= nil then
789 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
792 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
793 g_Serverlist_GenerateTable(slCurrent
, slTable
);
796 procedure ProcStartCampaign();
802 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
804 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
805 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
807 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
813 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
816 procedure ProcSelectMap(Sender
: TGUIControl
);
820 wad
, map
, res
: String;
822 win
:= g_GUI_GetWindow('SelectMapMenu');
823 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
825 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
826 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
828 if (wad
= '') or (map
= '') then
829 begin // Ýòî íå êàðòà
830 TGUILabel(GetControl('lbMapName')).Text := '';
831 TGUILabel(GetControl('lbMapAuthor')).Text := '';
832 TGUILabel(GetControl('lbMapSize')).Text := '';
833 TGUIMemo(GetControl('meMapDescription')).SetText('');
834 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
835 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
841 a
:= g_Map_GetMapInfo(res
);
843 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
844 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
845 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
846 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
847 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
848 TGUILabel(win
.GetControl('lbMapScale')).Text :=
849 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
854 procedure ProcSelectWAD(Sender
: TGUIControl
);
859 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
861 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
863 with TGUIListBox(GetControl('lsMapRes')) do
869 list
:= g_Map_GetMapsList(wad
);
883 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
889 win
:= g_GUI_GetWindow('CampaignMenu');
890 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
892 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
896 TGUILabel(GetControl('lbWADName')).Text := '';
897 TGUILabel(GetControl('lbWADAuthor')).Text := '';
898 TGUIMemo(GetControl('meWADDescription')).SetText('');
901 a
:= g_Game_GetMegaWADInfo(wad
);
903 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
904 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
905 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
907 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
911 fn
:= g_ExtractWadName(a
.pic
);
913 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
915 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
920 procedure ProcChangeColor(Sender
: TGUIControl
);
924 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
925 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
926 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
927 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
928 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
929 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
931 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
932 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
933 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
934 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
935 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
936 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
939 procedure ProcSelectModel(Sender
: TGUIControl
);
944 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
945 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
946 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
948 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
949 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
950 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
952 ProcChangeColor(nil);
955 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
967 wad
:= TWADFile
.Create
;
968 if wad
.ReadFile(GameWAD
) then
969 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
974 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
976 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
977 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
978 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
979 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
981 if g_Texture_Get('FONT_STD', ID
) then
982 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
987 if cfglen
<> 0 then FreeMem(cfgdata
);
990 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
996 cfgdata
, fntdata
: Pointer;
997 cfglen
, fntlen
: Integer;
1005 wad
:= TWADFile
.Create
;
1006 if wad
.ReadFile(GameWAD
) then
1008 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1009 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1015 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1016 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1017 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1019 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1020 FontID
:= e_CharFont_Create(spc
);
1022 for a
:= 0 to 255 do
1024 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1025 if chrwidth
= 0 then Continue
;
1027 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1029 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1035 if cfglen
<> 0 then FreeMem(cfgdata
);
1036 if fntlen
<> 0 then FreeMem(fntdata
);
1039 procedure MenuLoadData();
1041 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1043 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1044 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1045 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1046 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1047 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1048 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1049 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1050 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1051 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1052 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1053 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1054 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1055 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1056 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1057 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1058 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1059 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1060 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1061 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1062 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1063 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1064 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1065 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1066 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1067 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1069 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1070 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1071 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1072 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1073 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1074 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1075 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1078 procedure MenuFreeData();
1080 e_CharFont_Remove(gMenuFont
);
1081 e_CharFont_Remove(gMenuSmallFont
);
1083 g_Texture_Delete('MAINMENU_LOGO');
1084 g_Texture_Delete('MAINMENU_MARKER1');
1085 g_Texture_Delete('MAINMENU_MARKER2');
1086 g_Texture_Delete('SCROLL_LEFT');
1087 g_Texture_Delete('SCROLL_RIGHT');
1088 g_Texture_Delete('SCROLL_MIDDLE');
1089 g_Texture_Delete('SCROLL_MARKER');
1090 g_Texture_Delete('EDIT_LEFT');
1091 g_Texture_Delete('EDIT_RIGHT');
1092 g_Texture_Delete('EDIT_MIDDLE');
1093 g_Texture_Delete('BOX1');
1094 g_Texture_Delete('BOX2');
1095 g_Texture_Delete('BOX3');
1096 g_Texture_Delete('BOX4');
1097 g_Texture_Delete('BOX5');
1098 g_Texture_Delete('BOX6');
1099 g_Texture_Delete('BOX7');
1100 g_Texture_Delete('BOX8');
1101 g_Texture_Delete('BOX9');
1102 g_Texture_Delete('BSCROLL_UP_A');
1103 g_Texture_Delete('BSCROLL_UP_U');
1104 g_Texture_Delete('BSCROLL_DOWN_A');
1105 g_Texture_Delete('BSCROLL_DOWN_U');
1106 g_Texture_Delete('BSCROLL_MIDDLE');
1107 g_Texture_Delete('NOPIC');
1109 g_Sound_Delete('MENU_SELECT');
1110 g_Sound_Delete('MENU_OPEN');
1111 g_Sound_Delete('MENU_CLOSE');
1112 g_Sound_Delete('MENU_CHANGE');
1113 g_Sound_Delete('SCROLL_ADD');
1114 g_Sound_Delete('SCROLL_SUB');
1115 g_Sound_Delete('SOUND_PLAYER_FALL');
1118 procedure ProcAuthorsMenu();
1120 gMusic
.SetByName('MUSIC_INTERMUS');
1124 procedure ProcExitMenuKeyDown (yes
: Boolean);
1127 snd
: TPlayableSound
;
1132 g_Game_StopAllSounds(True);
1133 case (Random(18)) of
1134 0: s
:= 'SOUND_MONSTER_PAIN';
1135 1: s
:= 'SOUND_MONSTER_DIE_3';
1136 2: s
:= 'SOUND_MONSTER_SLOP';
1137 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1138 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1139 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1140 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1141 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1142 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1143 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1144 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1145 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1146 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1147 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1148 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1149 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1150 else s
:= 'SOUND_PLAYER_FALL';
1152 snd
:= TPlayableSound
.Create();
1153 res
:= snd
.SetByName(s
);
1154 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1158 while snd
.IsPlaying() do begin end;
1166 procedure ProcLoadMenu();
1173 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1174 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1175 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1179 procedure ProcSaveMenu();
1187 name
:= g_GetSaveName(a
, valid
);
1188 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1189 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1193 procedure ProcSaveGame(Sender
: TGUIControl
);
1197 if g_Game_IsNet
then Exit
;
1198 if g_Game_IsTestMap
then Exit
;
1199 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1200 g_Game_PauseAllSounds(True);
1201 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1203 g_ActiveWindow
:= nil;
1204 g_Game_Pause(False);
1207 procedure ProcLoadGame(Sender
: TGUIControl
);
1211 if g_Game_IsNet
then Exit
;
1212 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1213 if g_LoadGame(a
) then
1215 g_Game_PauseAllSounds(False)
1217 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1219 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1220 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1221 //g_ActiveWindow := nil;
1225 procedure ProcSinglePlayer (n
: Integer);
1226 var wad
, map
: AnsiString;
1229 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1230 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1231 if e_FindResource(AllMapDirs
, wad
) then
1233 wad
:= ExpandFileName(wad
);
1234 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1238 procedure ProcSingle1Player
;
1243 procedure ProcSingle2Players
;
1248 procedure ProcSelectMapMenu();
1251 wad_lb
: TGUIFileListBox
;
1252 map_lb
: TGUIListBox
;
1255 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1256 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1257 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1259 if wad_lb
.SelectedItem() <> '' then
1260 map
:= map_lb
.SelectedItem()
1264 wad_lb
.UpdateFileList();
1267 if wad_lb
.SelectedItem() <> '' then
1270 map_lb
.SelectItem(map
);
1272 if map_lb
.SelectedItem() <> '' then
1276 g_GUI_ShowWindow('SelectMapMenu');
1279 procedure ProcSelectCampaignMenu();
1282 wad_lb
: TGUIFileListBox
;
1284 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1285 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1287 wad_lb
.UpdateFileList();
1289 if wad_lb
.SelectedItem() <> '' then
1290 ProcSelectCampaignWAD(nil);
1293 procedure ProcSetMap();
1295 wad
, map
, res
: String;
1297 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1299 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1300 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1303 if (wad
= '') or (map
= '') then
1306 wad
:= e_FindWadRel(MapDirs
, WAD
);
1308 res
:= wad
+':\'+map
;
1310 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1311 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1314 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1318 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1320 g_Sound_SetupAllVolumes(
1321 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1322 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1326 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1330 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1331 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1333 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1334 g_dbg_scale
:= TempScale
+ 1;
1338 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1342 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1343 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1344 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1345 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1348 procedure ProcOptionsPlayersMIMenu();
1353 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1355 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1357 if a
= '' then Exit
;
1359 b
:= g_PlayerModel_GetInfo(a
);
1361 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1363 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1364 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1365 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1367 if b
.HaveWeapon
then
1368 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1370 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1373 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1376 procedure ProcOptionsPlayersAnim();
1380 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1385 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1388 Model
.GetCurrentAnimation
.Loop
:= True;
1389 Model
.GetCurrentAnimationMask
.Loop
:= True;
1393 procedure ProcOptionsPlayersWeap();
1397 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1402 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1406 procedure ProcOptionsPlayersRot();
1410 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1411 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1413 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1417 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1421 g_Options_SetDefault();
1427 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1429 if yes
then ReadOptions();
1433 procedure ProcAuthorsClose();
1435 gMusic
.SetByName('MUSIC_MENU');
1437 gState
:= STATE_MENU
;
1440 procedure ProcGMClose();
1442 g_Game_InGameMenu(False);
1445 procedure ProcGMShow();
1450 if (gGameSettings
.GameType
= GT_SINGLE
) and
1451 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1452 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1453 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1455 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1456 if g_Game_IsTestMap
then
1457 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1458 TGUIMainMenu(g_ActiveWindow
.GetControl(
1459 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1462 procedure ProcChangePlayers();
1464 TeamGame
, Spectator
, AddTwo
: Boolean;
1465 P1Team
{, P2Team}: Byte;
1466 bP2
: TGUITextButton
;
1468 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1469 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1470 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1471 P1Team
:= TEAM_NONE
;
1472 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1474 //P2Team := TEAM_NONE;
1475 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1477 TGUIMainMenu(g_ActiveWindow
.GetControl(
1478 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1479 TGUIMainMenu(g_ActiveWindow
.GetControl(
1480 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1481 TGUIMainMenu(g_ActiveWindow
.GetControl(
1482 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1484 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1485 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1486 bP2
.Enabled
:= AddTwo
and not Spectator
;
1488 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1490 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1491 if gPlayer2
= nil then
1492 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1494 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1496 TGUIMainMenu(g_ActiveWindow
.GetControl(
1497 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1500 procedure ProcJoinRed();
1502 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1504 if g_Game_IsServer
then
1506 if gPlayer1
= nil then
1507 g_Game_AddPlayer(TEAM_RED
)
1510 if gPlayer1
.Team
<> TEAM_RED
then
1512 gPlayer1
.SwitchTeam
;
1513 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1516 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1521 gPlayer1Settings
.Team
:= TEAM_RED
;
1522 MC_SEND_PlayerSettings
;
1523 if gPlayer1
= nil then
1524 g_Game_AddPlayer(TEAM_RED
);
1526 g_ActiveWindow
:= nil;
1527 g_Game_Pause(False);
1530 procedure ProcJoinBlue();
1532 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1534 if g_Game_IsServer
then
1536 if gPlayer1
= nil then
1537 g_Game_AddPlayer(TEAM_BLUE
)
1540 if gPlayer1
.Team
<> TEAM_BLUE
then
1542 gPlayer1
.SwitchTeam
;
1543 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1546 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1551 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1552 MC_SEND_PlayerSettings
;
1553 if gPlayer1
= nil then
1554 g_Game_AddPlayer(TEAM_BLUE
);
1556 g_ActiveWindow
:= nil;
1557 g_Game_Pause(False);
1560 procedure ProcJoinGame();
1562 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1564 if gPlayer1
= nil then
1566 g_ActiveWindow
:= nil;
1567 g_Game_Pause(False);
1570 procedure ProcSwitchP2();
1572 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1574 if gPlayer1
= nil then
1576 if gPlayer2
= nil then
1579 g_Game_RemovePlayer();
1580 g_ActiveWindow
:= nil;
1581 g_Game_Pause(False);
1584 procedure ProcSpectate();
1586 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1589 g_ActiveWindow
:= nil;
1590 g_Game_Pause(False);
1593 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1595 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1598 procedure ProcEndMenuKeyDown (yes
: Boolean);
1600 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1603 procedure ProcSetRussianLanguage
;
1605 if gLanguage
<> LANGUAGE_RUSSIAN
then
1607 gLanguage
:= LANGUAGE_RUSSIAN
;
1608 gLanguageChange
:= True;
1609 gAskLanguage
:= False;
1614 procedure ProcSetEnglishLanguage
;
1616 if gLanguage
<> LANGUAGE_ENGLISH
then
1618 gLanguage
:= LANGUAGE_ENGLISH
;
1619 gLanguageChange
:= True;
1620 gAskLanguage
:= False;
1625 procedure ReadGameSettings();
1629 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1631 with gGameSettings
do
1633 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1634 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1638 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1639 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1644 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1645 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1646 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1648 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1649 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1650 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1653 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1658 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1660 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1661 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1663 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1664 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1668 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1669 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1671 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1672 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1673 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1674 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1675 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1676 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1677 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1681 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1682 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1683 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1684 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1689 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1690 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1695 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1696 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1701 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1702 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1707 procedure ProcApplyGameSet();
1711 stat
: TPlayerStatArray
;
1713 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1715 if not g_Game_IsServer
then Exit
;
1717 with gGameSettings
do
1719 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1721 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1722 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1724 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1727 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1729 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1730 Options
:= Options
or GAME_OPTION_DMKEYS
1732 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1735 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1737 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1743 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1745 TimeLimit
:= Max(n
, b
);
1749 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1751 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1758 if GameMode
= GM_DM
then
1760 stat
:= g_Player_GetStats();
1762 for a
:= 0 to High(stat
) do
1763 if stat
[a
].Frags
> b
then
1767 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1769 GoalLimit
:= Max(n
, b
);
1773 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1775 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1776 if n
< 0 then n
:= 0;
1777 if n
> 255 then n
:= 255;
1783 stat
:= g_Player_GetStats();
1785 for a
:= 0 to High(stat
) do
1786 if stat
[a
].Lives
> b
then
1789 MaxLives
:= Max(n
, b
);
1793 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1795 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1798 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1799 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1803 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1804 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1808 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1809 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1814 // don't forget to latch this shit
1815 gsGameFlags
:= Options
;
1816 gsMaxLives
:= MaxLives
;
1817 gsGoalLimit
:= GoalLimit
;
1818 gsTimeLimit
:= TimeLimit
;
1821 if g_Game_IsNet
then MH_SEND_GameSettings
;
1824 procedure ProcVideoOptionsRes();
1829 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1831 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1832 IntToStr(gWinSizeX
) +
1833 ' x ' + IntToStr(gWinSizeY
) +
1834 ', ' + IntToStr(gBPP
) + ' bpp';
1836 with TGUIListBox(menu
.GetControl('lsResolution')) do
1838 list
:= sys_GetDisplayModes(gBPP
);
1842 ItemIndex
:= Length(list
)
1850 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1856 TempResScale
:= Round(r_pixel_scale
- 1);
1857 with TGUISwitch(menu
.GetControl('swResFactor')) do
1858 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1861 procedure ProcApplyVideoOptions();
1864 Fullscreen
: Boolean;
1865 SWidth
, SHeight
: Integer;
1866 ScaleChanged
: Boolean;
1869 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1871 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1873 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1876 SWidth
:= gWinSizeX
;
1877 SHeight
:= gWinSizeY
;
1878 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1881 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1883 ScaleChanged
:= False;
1884 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1886 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1887 r_pixel_scale
:= TempResScale
+ 1;
1888 ScaleChanged
:= True;
1891 if (SWidth
<> gWinSizeX
) or
1892 (SHeight
<> gWinSizeY
) or
1893 (Fullscreen
<> gFullscreen
) or
1896 gResolutionChange
:= True;
1897 gRC_Width
:= SWidth
;
1898 gRC_Height
:= SHeight
;
1899 gRC_FullScreen
:= Fullscreen
;
1900 gRC_Maximized
:= gWinMaximized
;
1903 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1907 procedure ProcSetFirstRussianLanguage
;
1909 gLanguage
:= LANGUAGE_RUSSIAN
;
1910 gLanguageChange
:= True;
1911 gAskLanguage
:= False;
1914 procedure ProcSetFirstEnglishLanguage
;
1916 gLanguage
:= LANGUAGE_ENGLISH
;
1917 gLanguageChange
:= True;
1918 gAskLanguage
:= False;
1921 procedure ProcRecallAddress();
1923 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1925 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1926 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1930 procedure CreateFirstLanguageMenu();
1934 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1936 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1938 Name
:= 'mmFirstLanguageMenu';
1939 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1940 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1943 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1944 Menu
.MainWindow
:= True;
1945 g_GUI_AddWindow(Menu
);
1948 procedure g_Menu_AskLanguage();
1950 CreateFirstLanguageMenu();
1951 g_GUI_ShowWindow('FirstLanguageMenu');
1954 procedure CreatePlayerOptionsMenu(s
: String);
1959 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1961 a
:= _lc
[I_MENU_PLAYER_1
]
1963 a
:= _lc
[I_MENU_PLAYER_2
];
1964 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1966 Name
:= 'mOptionsPlayers'+s
+'Menu';
1967 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1969 Name
:= 'ed'+s
+'Name';
1973 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1975 Name
:= 'sw'+s
+'Team';
1976 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1977 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1979 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1981 Name
:= 'ls'+s
+'Model';
1983 Items
:= g_PlayerModel_GetNames();
1984 OnChange
:= ProcSelectModel
;
1986 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1988 Name
:= 'sc'+s
+'Red';
1990 OnChange
:= ProcChangeColor
;
1992 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1994 Name
:= 'sc'+s
+'Green';
1996 OnChange
:= ProcChangeColor
;
1998 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2000 Name
:= 'sc'+s
+'Blue';
2002 OnChange
:= ProcChangeColor
;
2005 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2006 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2007 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2008 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2010 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2012 Name
:= 'mv'+s
+'Model';
2013 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2014 Y
:= GetControl('ls'+s
+'Model').Y
;
2017 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2018 g_GUI_AddWindow(Menu
);
2021 procedure CreateAllMenus();
2025 a
, cx
, _y
, i
: Integer;
2028 Menu
:= TGUIWindow
.Create('MainMenu');
2029 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2031 Name
:= 'mmMainMenu';
2032 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2033 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2034 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2035 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2036 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2037 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2039 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2041 Color
:= _RGB(255, 255, 255);
2042 X
:= gScreenWidth
-GetWidth
-8;
2043 Y
:= gScreenHeight
-GetHeight
-8;
2045 Menu
.DefControl
:= 'mmMainMenu';
2046 Menu
.MainWindow
:= True;
2047 g_GUI_AddWindow(Menu
);
2049 Menu
:= TGUIWindow
.Create('NewGameMenu');
2050 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2052 Name
:= 'mmNewGameMenu';
2053 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2054 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2055 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2056 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2058 Menu
.DefControl
:= 'mmNewGameMenu';
2059 g_GUI_AddWindow(Menu
);
2061 Menu
:= TGUIWindow
.Create('NetGameMenu');
2062 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2064 Name
:= 'mmNetGameMenu';
2065 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2066 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2068 Menu
.DefControl
:= 'mmNetGameMenu';
2069 g_GUI_AddWindow(Menu
);
2071 Menu
:= TGUIWindow
.Create('NetServerMenu');
2072 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2074 Name
:= 'mNetServerMenu';
2075 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2077 Name
:= 'edSrvName';
2078 OnlyDigits
:= False;
2081 Text := NetServerName
;
2083 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2085 Name
:= 'edSrvPassword';
2086 OnlyDigits
:= False;
2089 Text := NetPassword
;
2091 with AddEdit(_lc
[I_NET_PORT
]) do
2097 Text := IntToStr(NetPort
);
2099 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2101 Name
:= 'edMaxPlayers';
2105 Text := IntToStr(NetMaxClients
);
2107 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2109 Name
:= 'swUseMaster';
2110 AddItem(_lc
[I_MENU_YES
]);
2111 AddItem(_lc
[I_MENU_NO
]);
2112 if NetUseMaster
then
2118 with AddLabel(_lc
[I_MENU_MAP
]) do
2123 OnClick
:= @ProcSelectMapMenu
;
2125 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2127 Name
:= 'swGameMode';
2128 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2129 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2130 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2131 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2132 case g_Game_TextToMode(gsGameMode
) of
2134 GM_DM
: ItemIndex
:= 0;
2135 GM_TDM
: ItemIndex
:= 1;
2136 GM_CTF
: ItemIndex
:= 2;
2138 GM_COOP
: ItemIndex
:= 3;
2140 OnChange
:= ProcSwitchMonstersCustom
;
2142 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2144 Name
:= 'edTimeLimit';
2148 if gsTimeLimit
> 0 then
2149 Text := IntToStr(gsTimeLimit
);
2151 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2153 Name
:= 'edGoalLimit';
2157 if gsGoalLimit
> 0 then
2158 Text := IntToStr(gsGoalLimit
);
2160 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2162 Name
:= 'edMaxLives';
2166 if gsMaxLives
> 0 then
2167 Text := IntToStr(gsMaxLives
);
2169 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2171 Name
:= 'edItemRespawnTime';
2175 if gsItemRespawnTime
> 0 then
2176 Text := IntToStr(gsItemRespawnTime
);
2178 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2180 Name
:= 'swPlayers';
2181 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2182 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2183 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2184 ItemIndex
:= gsPlayers
;
2186 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2188 Name
:= 'swTeamDamage';
2189 AddItem(_lc
[I_MENU_YES
]);
2190 AddItem(_lc
[I_MENU_NO
]);
2191 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2196 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2198 Name
:= 'swDeathmatchKeys';
2199 AddItem(_lc
[I_MENU_YES
]);
2200 AddItem(_lc
[I_MENU_NO
]);
2201 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2206 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2208 Name
:= 'swEnableExits';
2209 AddItem(_lc
[I_MENU_YES
]);
2210 AddItem(_lc
[I_MENU_NO
]);
2211 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2216 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2218 Name
:= 'swWeaponStay';
2219 AddItem(_lc
[I_MENU_YES
]);
2220 AddItem(_lc
[I_MENU_NO
]);
2221 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2226 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2228 Name
:= 'swMonsters';
2229 AddItem(_lc
[I_MENU_YES
]);
2230 AddItem(_lc
[I_MENU_NO
]);
2231 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2236 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2239 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2240 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2241 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2243 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2245 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2249 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2253 Menu
.DefControl
:= 'mNetServerMenu';
2254 g_GUI_AddWindow(Menu
);
2256 Menu
:= TGUIWindow
.Create('NetClientMenu');
2257 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2259 Name
:= 'mNetClientMenu';
2261 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2264 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2270 Text := 'localhost';
2272 with AddEdit(_lc
[I_NET_PORT
]) do
2280 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2283 OnlyDigits
:= False;
2290 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2294 Menu
.DefControl
:= 'mNetClientMenu';
2295 g_GUI_AddWindow(Menu
);
2297 Menu
:= TGUIWindow
.Create('LoadMenu');
2298 Menu
.OnShow
:= ProcLoadMenu
;
2299 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2301 Name
:= 'mmLoadMenu';
2306 Name
:= 'edSlot'+IntToStr(a
);
2309 OnEnter
:= ProcLoadGame
;
2312 Menu
.DefControl
:= 'mmLoadMenu';
2313 g_GUI_AddWindow(Menu
);
2315 Menu
:= TGUIWindow
.Create('SaveMenu');
2316 Menu
.OnShow
:= ProcSaveMenu
;
2317 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2319 Name
:= 'mmSaveMenu';
2324 Name
:= 'edSlot'+IntToStr(a
);
2327 OnChange
:= ProcSaveGame
;
2330 Menu
.DefControl
:= 'mmSaveMenu';
2331 g_GUI_AddWindow(Menu
);
2333 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2334 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2336 Name
:= 'mCustomGameMenu';
2337 with AddLabel(_lc
[I_MENU_MAP
]) do
2342 OnClick
:= @ProcSelectMapMenu
;
2344 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2346 Name
:= 'swGameMode';
2347 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2348 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2349 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2350 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2351 case g_Game_TextToMode(gsGameMode
) of
2353 GM_DM
: ItemIndex
:= 0;
2354 GM_TDM
: ItemIndex
:= 1;
2355 GM_CTF
: ItemIndex
:= 2;
2357 GM_COOP
: ItemIndex
:= 3;
2359 OnChange
:= ProcSwitchMonstersCustom
;
2361 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2363 Name
:= 'edTimeLimit';
2367 if gsTimeLimit
> 0 then
2368 Text := IntToStr(gsTimeLimit
);
2370 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2372 Name
:= 'edGoalLimit';
2376 if gsGoalLimit
> 0 then
2377 Text := IntToStr(gsGoalLimit
);
2379 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2381 Name
:= 'edMaxLives';
2385 if gsMaxLives
> 0 then
2386 Text := IntToStr(gsMaxLives
);
2388 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2390 Name
:= 'edItemRespawnTime';
2394 if gsItemRespawnTime
> 0 then
2395 Text := IntToStr(gsItemRespawnTime
);
2397 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2399 Name
:= 'swPlayers';
2400 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2401 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2402 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2403 ItemIndex
:= gsPlayers
;
2405 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2407 Name
:= 'swTeamDamage';
2408 AddItem(_lc
[I_MENU_YES
]);
2409 AddItem(_lc
[I_MENU_NO
]);
2410 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2415 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2417 Name
:= 'swDeathmatchKeys';
2418 AddItem(_lc
[I_MENU_YES
]);
2419 AddItem(_lc
[I_MENU_NO
]);
2420 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2425 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2427 Name
:= 'swEnableExits';
2428 AddItem(_lc
[I_MENU_YES
]);
2429 AddItem(_lc
[I_MENU_NO
]);
2430 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2435 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2437 Name
:= 'swWeaponStay';
2438 AddItem(_lc
[I_MENU_YES
]);
2439 AddItem(_lc
[I_MENU_NO
]);
2440 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2445 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2447 Name
:= 'swMonsters';
2448 AddItem(_lc
[I_MENU_YES
]);
2449 AddItem(_lc
[I_MENU_NO
]);
2450 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2455 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2458 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2459 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2460 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2462 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2464 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2468 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2472 Menu
.DefControl
:= 'mCustomGameMenu';
2473 g_GUI_AddWindow(Menu
);
2475 Menu
:= TGUIWindow
.Create('CampaignMenu');
2476 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2478 Name
:= 'mCampaignMenu';
2487 with AddFileList('', 15, 4) do
2490 OnChange
:= ProcSelectCampaignWAD
;
2494 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2495 SetBase(MegawadDirs
);
2498 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2500 Name
:= 'lbWADName';
2504 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2506 Name
:= 'lbWADAuthor';
2510 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2511 with AddMemo('', 15, 3) do
2513 Name
:= 'meWADDescription';
2514 Color
:= MENU_ITEMSCTRL_COLOR
;
2516 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2518 Name
:= 'swPlayers';
2519 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2520 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2523 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2527 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2529 Name
:= 'mpWADImage';
2530 DefaultRes
:= 'NOPIC';
2531 X
:= GetControl('lsWAD').X
+4;
2532 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2535 Menu
.DefControl
:= 'mCampaignMenu';
2536 g_GUI_AddWindow(Menu
);
2538 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2539 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2541 Name
:= 'mSelectMapMenu';
2542 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2545 OnChange
:= ProcSelectWAD
;
2549 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2552 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2556 OnChange
:= ProcSelectMap
;
2559 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2561 Name
:= 'lbMapName';
2565 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2567 Name
:= 'lbMapAuthor';
2571 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2573 Name
:= 'lbMapSize';
2577 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2579 Name
:= 'meMapDescription';
2584 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2586 Name
:= 'mpMapPreview';
2587 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2588 Y
:= GetControl('lsMapWAD').Y
;
2590 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2592 Name
:= 'lbMapScale';
2595 Color
:= MENU_ITEMSCTRL_COLOR
;
2596 X
:= GetControl('lsMapWAD').X
+
2597 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2598 2 + MAPPREVIEW_WIDTH
*4;
2599 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2602 Menu
.OnClose
:= ProcSetMap
;
2603 Menu
.DefControl
:= 'mSelectMapMenu';
2604 g_GUI_AddWindow(Menu
);
2606 Menu
:= TGUIWindow
.Create('OptionsMenu');
2607 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2609 Name
:= 'mmOptionsMenu';
2610 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2611 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2612 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2613 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2614 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2615 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2617 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2618 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2620 Menu
.OnClose
:= ProcApplyOptions
;
2621 Menu
.DefControl
:= 'mmOptionsMenu';
2622 g_GUI_AddWindow(Menu
);
2624 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2625 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2626 g_GUI_AddWindow(Menu
);
2628 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2629 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2631 Name
:= 'mOptionsVideoMenu';
2632 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2633 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2639 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2642 AddItem(_lc
[I_MENU_YES
]);
2643 AddItem(_lc
[I_MENU_NO
]);
2645 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2647 Name
:= 'swTextureFilter';
2648 AddItem(_lc
[I_MENU_YES
]);
2649 AddItem(_lc
[I_MENU_NO
]);
2651 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2654 AddItem(_lc
[I_MENU_YES
]);
2655 AddItem(_lc
[I_MENU_NO
]);
2657 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2659 Name
:= 'swLegacyNPOT';
2660 AddItem(_lc
[I_MENU_NO
]);
2661 AddItem(_lc
[I_MENU_YES
]);
2664 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2667 Menu
.DefControl
:= 'mOptionsVideoMenu';
2668 g_GUI_AddWindow(Menu
);
2670 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2671 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2673 Name
:= 'mOptionsVideoResMenu';
2674 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2676 Name
:= 'lbCurrentRes';
2680 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2682 Name
:= 'lsResolution';
2685 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2687 Name
:= 'swFullScreen';
2688 AddItem(_lc
[I_MENU_YES
]);
2689 AddItem(_lc
[I_MENU_NO
]);
2691 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2693 Name
:= 'swResFactor';
2695 for i
:= 2 to gRC_Width
div 640 do
2696 AddItem(IntToStr(i
) + 'x');
2699 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2702 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2703 g_GUI_AddWindow(Menu
);
2705 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2706 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2708 Name
:= 'mOptionsSoundMenu';
2709 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2711 Name
:= 'scMusicLevel';
2713 OnChange
:= ProcChangeSoundSettings
;
2715 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2717 Name
:= 'scSoundLevel';
2719 OnChange
:= ProcChangeSoundSettings
;
2721 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2723 Name
:= 'scMaxSimSounds';
2726 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2728 Name
:= 'swAnnouncer';
2729 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2730 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2731 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2732 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2734 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2735 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2737 Name
:= 'swSoundEffects';
2738 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2739 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2741 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2742 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2744 Name
:= 'swChatSpeech';
2745 AddItem(_lc
[I_MENU_YES
]);
2746 AddItem(_lc
[I_MENU_NO
]);
2748 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2750 Name
:= 'swInactiveSounds';
2751 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2752 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2756 Menu
.DefControl
:= 'mOptionsSoundMenu';
2757 g_GUI_AddWindow(Menu
);
2759 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2760 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2762 Name
:= 'mOptionsGameMenu';
2763 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2765 Name
:= 'scParticlesCount';
2768 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2770 Name
:= 'swBloodCount';
2771 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2772 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2773 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2774 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2775 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2777 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2779 Name
:= 'scShellsMax';
2782 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2784 Name
:= 'scGibsMax';
2787 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2789 Name
:= 'scCorpsesMax';
2792 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2794 Name
:= 'swGibsCount';
2795 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2796 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2797 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2798 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2799 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2801 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2803 Name
:= 'swCorpseType';
2804 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2805 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2807 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2809 Name
:= 'swGibsType';
2810 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2811 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2813 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2815 Name
:= 'swBloodType';
2816 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2817 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2819 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2821 Name
:= 'swScreenFlash';
2822 AddItem(_lc
[I_MENU_NO
]);
2823 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2824 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2826 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2828 Name
:= 'swBackground';
2829 AddItem(_lc
[I_MENU_YES
]);
2830 AddItem(_lc
[I_MENU_NO
]);
2832 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2834 Name
:= 'swMessages';
2835 AddItem(_lc
[I_MENU_YES
]);
2836 AddItem(_lc
[I_MENU_NO
]);
2838 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2840 Name
:= 'swRevertPlayers';
2841 AddItem(_lc
[I_MENU_YES
]);
2842 AddItem(_lc
[I_MENU_NO
]);
2844 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2846 Name
:= 'swChatBubble';
2847 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2848 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2849 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2850 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2851 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2853 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2855 Name
:= 'swPlayerIndicator';
2856 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2857 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2858 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2860 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2862 Name
:= 'swPlayerIndicatorStyle';
2863 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2864 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2866 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2868 Name
:= 'scScaleFactor';
2870 OnChange
:= ProcChangeGameSettings
;
2874 Menu
.DefControl
:= 'mOptionsGameMenu';
2875 g_GUI_AddWindow(Menu
);
2877 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2878 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2880 Name
:= 'mOptionsControlsMenu';
2881 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2882 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2883 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2884 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2885 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2887 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2888 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2889 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2890 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2891 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2892 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2893 if e_HasJoysticks
then
2896 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2898 if g_touch_enabled
then
2901 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2904 Menu
.DefControl
:= 'mOptionsControlsMenu';
2905 g_GUI_AddWindow(Menu
);
2907 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2908 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2910 Name
:= 'mOptionsControlsP1Menu';
2911 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2912 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2913 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2914 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2915 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2916 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2917 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2918 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2919 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2920 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2922 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2923 g_GUI_AddWindow(Menu
);
2925 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2926 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2928 Name
:= 'mOptionsControlsP1MenuWeapons';
2929 for i
:= WP_FIRST
to WP_LAST
do
2930 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2931 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2933 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2934 g_GUI_AddWindow(Menu
);
2936 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2937 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2939 Name
:= 'mOptionsControlsP2Menu';
2940 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2941 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2942 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2943 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2944 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2945 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2946 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2947 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2948 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2949 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2951 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2952 g_GUI_AddWindow(Menu
);
2954 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2955 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2957 Name
:= 'mOptionsControlsP2MenuWeapons';
2958 for i
:= WP_FIRST
to WP_LAST
do
2959 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2960 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2962 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2963 g_GUI_AddWindow(Menu
);
2965 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2966 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2968 Name
:= 'mOptionsControlsJoystickMenu';
2969 for i
:= 0 to e_MaxJoys
- 1 do
2970 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2972 Name
:= 'scDeadzone' + IntToStr(i
);
2976 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2977 g_GUI_AddWindow(Menu
);
2979 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2980 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2982 Name
:= 'mOptionsControlsTouchMenu';
2983 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
2985 Name
:= 'swTouchAlt';
2986 AddItem(_lc
[I_MENU_NO
]);
2987 AddItem(_lc
[I_MENU_YES
]);
2988 OnChange
:= ProcChangeTouchSettings
;
2990 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2992 Name
:= 'scTouchSize';
2994 OnChange
:= ProcChangeTouchSettings
;
2996 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2998 Name
:= 'swTouchFire';
2999 AddItem(_lc
[I_MENU_NO
]);
3000 AddItem(_lc
[I_MENU_YES
]);
3002 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3004 Name
:= 'scTouchOffset';
3006 OnChange
:= ProcChangeTouchSettings
;
3009 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3010 g_GUI_AddWindow(Menu
);
3012 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3013 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3015 Name
:= 'mOptionsPlayersMenu';
3016 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3017 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3019 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3020 g_GUI_AddWindow(Menu
);
3022 CreatePlayerOptionsMenu('P1');
3023 CreatePlayerOptionsMenu('P2');
3025 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3026 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3028 Name
:= 'mOptionsPlayersMIMenu';
3029 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3034 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3039 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3041 Name
:= 'meComment';
3044 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3045 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3048 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3052 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3053 g_GUI_AddWindow(Menu
);
3055 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3056 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3058 Name
:= 'mOptionsLanguageMenu';
3059 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3060 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3063 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3064 g_GUI_AddWindow(Menu
);
3066 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3067 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3068 g_GUI_AddWindow(Menu
);
3070 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3071 Menu
.BackTexture
:= 'INTER';
3072 Menu
.OnClose
:= ProcAuthorsClose
;
3076 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3078 Color
:= _RGB(255, 0, 0);
3079 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3081 _y
:= _y
+GetHeight();
3083 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3085 Color
:= _RGB(255, 0, 0);
3086 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3088 _y
:= _y
+GetHeight()+32;
3090 // ×òî äåëàë: Êòî äåëàë
3091 cx
:= gScreenWidth
div 2 - 320 + 64;
3092 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3094 Color
:= _RGB(255, 0, 0);
3099 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3101 Color
:= _RGB(255, 255, 255);
3106 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3108 Color
:= _RGB(255, 0, 0);
3113 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3115 Color
:= _RGB(255, 255, 255);
3120 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3122 Color
:= _RGB(255, 255, 255);
3127 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3129 Color
:= _RGB(255, 0, 0);
3134 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3136 Color
:= _RGB(255, 255, 255);
3141 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3143 Color
:= _RGB(255, 0, 0);
3148 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3150 Color
:= _RGB(255, 255, 255);
3153 _y
:= gScreenHeight
- 128;
3156 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3158 Color
:= _RGB(255, 0, 0);
3163 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3165 Color
:= _RGB(255, 255, 255);
3168 _y
:= _y
+GetHeight();
3170 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3172 Color
:= _RGB(255, 255, 255);
3175 _y
:= _y
+GetHeight();
3177 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3179 Color
:= _RGB(255, 255, 255);
3182 _y
:= gScreenHeight
- 32;
3184 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3186 Color
:= _RGB(255, 0, 0);
3187 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3190 g_GUI_AddWindow(Menu
);
3192 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3193 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3194 g_GUI_AddWindow(Menu
);
3196 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3197 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3199 Name
:= 'mmGameSingleMenu';
3200 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3201 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3202 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3203 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3204 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3205 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3207 Menu
.DefControl
:= 'mmGameSingleMenu';
3208 Menu
.MainWindow
:= True;
3209 Menu
.OnClose
:= ProcGMClose
;
3210 Menu
.OnShow
:= ProcGMShow
;
3211 g_GUI_AddWindow(Menu
);
3213 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3214 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3215 g_GUI_AddWindow(Menu
);
3217 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3218 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3219 g_GUI_AddWindow(Menu
);
3221 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3222 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3224 Name
:= 'mmGameCustomMenu';
3225 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3226 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3227 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3228 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3229 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3230 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3231 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3233 Menu
.DefControl
:= 'mmGameCustomMenu';
3234 Menu
.MainWindow
:= True;
3235 Menu
.OnClose
:= ProcGMClose
;
3236 Menu
.OnShow
:= ProcGMShow
;
3237 g_GUI_AddWindow(Menu
);
3239 Menu
:= TGUIWindow
.Create('GameServerMenu');
3240 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3242 Name
:= 'mmGameServerMenu';
3243 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3244 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3245 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3246 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3247 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3249 Menu
.DefControl
:= 'mmGameServerMenu';
3250 Menu
.MainWindow
:= True;
3251 Menu
.OnClose
:= ProcGMClose
;
3252 Menu
.OnShow
:= ProcGMShow
;
3253 g_GUI_AddWindow(Menu
);
3255 Menu
:= TGUIWindow
.Create('GameClientMenu');
3256 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3258 Name
:= 'mmGameClientMenu';
3259 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3260 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3261 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3263 Menu
.DefControl
:= 'mmGameClientMenu';
3264 Menu
.MainWindow
:= True;
3265 Menu
.OnClose
:= ProcGMClose
;
3266 Menu
.OnShow
:= ProcGMShow
;
3267 g_GUI_AddWindow(Menu
);
3269 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3270 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3272 Name
:= 'mClientPasswordMenu';
3273 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3281 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3284 Menu
.DefControl
:= 'mClientPasswordMenu';
3285 g_GUI_AddWindow(Menu
);
3287 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3288 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3290 Name
:= 'mGameSetGameMenu';
3291 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3293 Name
:= 'swTeamDamage';
3294 AddItem(_lc
[I_MENU_YES
]);
3295 AddItem(_lc
[I_MENU_NO
]);
3298 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3300 Name
:= 'swDeathmatchKeys';
3301 AddItem(_lc
[I_MENU_YES
]);
3302 AddItem(_lc
[I_MENU_NO
]);
3305 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3307 Name
:= 'edTimeLimit';
3312 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3314 Name
:= 'edGoalLimit';
3319 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3321 Name
:= 'edMaxLives';
3326 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3329 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3330 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3331 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3337 Menu
.DefControl
:= 'mGameSetGameMenu';
3338 Menu
.OnClose
:= ProcApplyGameSet
;
3339 g_GUI_AddWindow(Menu
);
3341 Menu
:= TGUIWindow
.Create('TeamMenu');
3342 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3344 Name
:= 'mmTeamMenu';
3345 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3346 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3347 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3348 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3349 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3351 Menu
.DefControl
:= 'mmTeamMenu';
3352 Menu
.OnShow
:= ProcChangePlayers
;
3353 g_GUI_AddWindow(Menu
);
3356 procedure g_Menu_Show_SaveMenu();
3358 if g_Game_IsTestMap
then
3360 if gGameSettings
.GameType
= GT_SINGLE
then
3361 g_GUI_ShowWindow('GameSingleMenu')
3364 if g_Game_IsClient
then
3367 if g_Game_IsNet
then
3370 g_GUI_ShowWindow('GameCustomMenu');
3372 g_GUI_ShowWindow('SaveMenu');
3373 g_Sound_PlayEx('MENU_OPEN');
3376 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3378 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3379 if gGameSettings
.GameType
= GT_SINGLE
then
3381 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3385 if g_Game_IsClient
then exit
;
3386 if g_Game_IsNet
then exit
;
3387 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3389 g_GUI_ShowWindow('LoadMenu');
3390 g_Sound_PlayEx('MENU_OPEN');
3393 procedure g_Menu_Show_GameSetGame();
3395 if gGameSettings
.GameType
= GT_SINGLE
then
3396 g_GUI_ShowWindow('GameSingleMenu')
3399 if g_Game_IsClient
then
3402 if g_Game_IsNet
then
3403 g_GUI_ShowWindow('GameServerMenu')
3405 g_GUI_ShowWindow('GameCustomMenu');
3408 g_GUI_ShowWindow('GameSetGameMenu');
3409 g_Sound_PlayEx('MENU_OPEN');
3412 procedure g_Menu_Show_OptionsVideo();
3414 if gGameSettings
.GameType
= GT_SINGLE
then
3415 g_GUI_ShowWindow('GameSingleMenu')
3418 if g_Game_IsClient
then
3419 g_GUI_ShowWindow('GameClientMenu')
3421 if g_Game_IsNet
then
3422 g_GUI_ShowWindow('GameServerMenu')
3424 g_GUI_ShowWindow('GameCustomMenu');
3427 g_GUI_ShowWindow('OptionsMenu');
3428 g_GUI_ShowWindow('OptionsVideoMenu');
3429 g_Sound_PlayEx('MENU_OPEN');
3432 procedure g_Menu_Show_OptionsSound();
3434 if gGameSettings
.GameType
= GT_SINGLE
then
3435 g_GUI_ShowWindow('GameSingleMenu')
3438 if g_Game_IsClient
then
3439 g_GUI_ShowWindow('GameClientMenu')
3441 if g_Game_IsNet
then
3442 g_GUI_ShowWindow('GameServerMenu')
3444 g_GUI_ShowWindow('GameCustomMenu');
3447 g_GUI_ShowWindow('OptionsMenu');
3448 g_GUI_ShowWindow('OptionsSoundMenu');
3449 g_Sound_PlayEx('MENU_OPEN');
3452 procedure g_Menu_Show_EndGameMenu();
3454 g_GUI_ShowWindow('EndGameMenu');
3455 g_Sound_PlayEx('MENU_OPEN');
3458 procedure g_Menu_Show_QuitGameMenu();
3460 g_GUI_ShowWindow('ExitMenu');
3461 g_Sound_PlayEx('MENU_OPEN');
3464 procedure g_Menu_Init();
3471 procedure g_Menu_Free();
3475 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3480 procedure g_Menu_Reset();
3484 g_GUI_SaveMenuPos();
3485 ex
:= g_GUI_Destroy();
3489 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3494 g_Game_SetDebugMode();
3496 g_GUI_LoadMenuPos();