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 g_gui
, g_textures
, e_graphics
, g_main
, g_window
, g_game
, g_map
,
47 g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
, g_weapons
,
48 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
49 MAPDEF
, Math
, g_saveload
,
50 e_texture
, g_language
, e_res
,
51 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
, g_touch
,
52 utils
, wadreader
, g_system
, r_game
;
55 type TYNCallback
= procedure (yes
:Boolean);
57 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
59 if win
.UserData
= nil then exit
;
61 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
62 IK_N
: TYNCallback(win
.UserData
)(false);
66 procedure YesButtonCB (ctl
: TGUITextButton
);
68 if ctl
.UserData
= nil then exit
;
69 TYNCallback(ctl
.UserData
)(true);
72 procedure NoButtonCB (ctl
: TGUITextButton
);
74 if ctl
.UserData
= nil then exit
;
75 TYNCallback(ctl
.UserData
)(false);
78 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
82 //if length(Text) = 0 then exit;
83 Result
:= TGUIWindow
.Create(WinName
);
86 //OnKeyDownEx := @YNKeyDownProc;
87 //UserData := @ActionProc;
88 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
91 Name
:= '__temp_yes_no_menu:'+WinName
;
93 AddText(Text, MaxLen
);
94 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
95 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
97 DefControl
:= '__temp_yes_no_menu:'+WinName
;
103 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
104 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
106 procedure ProcApplyOptions();
112 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
114 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
120 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
121 if (ovs
<> gVSync
) then
122 sys_EnableVSync(gVSync
);
124 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
125 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
126 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).ItemIndex
= 0;
128 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
130 g_Sound_SetupAllVolumes(
131 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
132 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
135 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
136 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
137 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
138 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
139 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
141 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
143 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
144 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
145 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
146 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
148 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
153 else gGibsCount
:= 48;
156 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
157 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
158 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
159 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
160 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
161 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
162 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
163 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
164 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
165 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
166 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
167 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
169 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
170 g_dbg_scale
:= TempScale
+ 1;
173 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
177 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
178 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
179 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
180 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
181 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
182 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
183 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
184 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
187 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
190 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
191 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
193 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
194 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
195 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
196 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
197 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
198 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
199 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
200 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
203 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
204 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
205 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
206 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext', '-p1_weapnext');
207 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev', '-p1_weapprev');
208 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
209 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
211 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
212 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
213 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
214 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
215 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
216 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
217 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
218 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
219 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
220 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
224 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext', '-p1_weapnext');
228 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev', '-p1_weapprev');
229 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
230 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
233 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
236 for i
:= WP_FIRST
to WP_LAST
do
238 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
239 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
240 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
241 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
245 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
248 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
249 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
250 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
251 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
252 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
253 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
254 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
255 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
256 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
257 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
258 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
259 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
260 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
261 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
262 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
263 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
264 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p2_weapnext', '-p2_weapnext');
265 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev', '-p2_weapprev');
266 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
267 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
269 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
270 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
271 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
272 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
273 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
274 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
275 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
276 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
277 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
278 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
279 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
282 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
283 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
284 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
285 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext', '-p2_weapnext');
286 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev', '-p2_weapprev');
287 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
288 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
291 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
294 for i
:= WP_FIRST
to WP_LAST
do
296 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
297 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
298 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
299 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
303 if e_HasJoysticks
then
305 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
308 for i
:= 0 to e_MaxJoys
- 1 do
309 if e_JoystickAvailable
[i
] then
310 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
314 if g_touch_enabled
then
316 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
317 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
318 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
319 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
320 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
323 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
325 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
326 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
327 TEAM_RED
, TEAM_BLUE
);
329 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
331 gPlayer1Settings
.Model
:= Model
.Name
;
332 gPlayer1Settings
.Color
:= Model
.Color
;
335 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
337 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
338 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
339 TEAM_RED
, TEAM_BLUE
);
340 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
342 gPlayer2Settings
.Model
:= Model
.Name
;
343 gPlayer2Settings
.Color
:= Model
.Color
;
346 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
347 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
349 if g_Game_IsServer
then
351 if gPlayer1
<> nil then
353 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
354 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
355 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
356 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
358 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
361 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
364 if gPlayer2
<> nil then
366 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
367 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
368 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
369 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
371 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
376 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
378 g_Console_WriteGameConfig
;
381 procedure ReadOptions();
386 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
388 with TGUISwitch(menu
.GetControl('swBPP')) do
394 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
395 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
397 with TGUISwitch(menu
.GetControl('swVSync')) do
398 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
400 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
401 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
403 with TGUISwitch(menu
.GetControl('swInterp')) do
404 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
406 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
408 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
409 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
410 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
412 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
413 if gMuteWhenInactive
then
418 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
420 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
421 if gSoundEffectsDF
then
426 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
427 if gUseChatSounds
then
432 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
435 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
436 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
437 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
438 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
439 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
440 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
441 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
442 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
443 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
446 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
447 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
448 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
449 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
450 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
451 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
452 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
453 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
454 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
455 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
458 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
461 for i
:= WP_FIRST
to WP_LAST
do
463 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
464 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
468 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
471 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
472 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
473 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
474 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
476 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
477 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
478 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
482 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
488 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
489 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
490 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
491 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
494 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
497 for i
:= WP_FIRST
to WP_LAST
do
499 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
500 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
504 if e_HasJoysticks
then
506 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
509 for i
:= 0 to e_MaxJoys
- 1 do
510 if e_JoystickAvailable
[i
] then
511 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
515 if g_touch_enabled
then
517 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
518 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
519 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
520 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
521 with TGUISwitch(menu
.GetControl('swTouchFire')) do
522 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
523 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
526 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
529 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
530 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
531 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
532 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
535 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
537 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
538 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
539 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
540 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
541 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
543 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
546 with TGUISwitch(menu
.GetControl('swBloodType')) do
547 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
549 with TGUISwitch(menu
.GetControl('swCorpseType')) do
550 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
552 with TGUISwitch(menu
.GetControl('swGibsType')) do
553 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
555 with TGUISwitch(menu
.GetControl('swGibsCount')) do
564 with TGUISwitch(menu
.GetControl('swBackGround')) do
565 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
567 with TGUISwitch(menu
.GetControl('swMessages')) do
568 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
570 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
571 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
573 with TGUISwitch(menu
.GetControl('swChatBubble')) do
574 ItemIndex
:= gChatBubble
;
576 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
577 ItemIndex
:= gPlayerIndicator
;
579 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
580 ItemIndex
:= gPlayerIndicatorStyle
;
582 TempScale
:= Round(g_dbg_scale
- 1);
583 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
585 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
587 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
588 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
590 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
591 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
593 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
594 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
595 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
597 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
599 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
600 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
602 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
603 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
605 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
606 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
607 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
609 ProcSelectModel(nil);
612 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
614 // don't turn off monsters in DM
616 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
617 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
618 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
620 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
623 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
624 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
625 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
626 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
630 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
632 // don't turn off monsters in DM
634 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
635 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
636 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
638 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
641 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
642 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
643 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
644 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
648 function LatchGameOptions(const MenuName
: string): Byte;
654 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
656 Map
:= TGUILabel(GetControl('lbMap')).Text;
659 if not isWadPath(Map
) then
662 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
663 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
664 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
665 gsGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
666 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
667 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
668 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
672 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
673 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
674 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
675 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
676 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
677 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
678 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
679 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
680 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
681 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
683 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
684 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
685 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
686 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
689 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
690 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
691 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
692 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
695 // TODO: get this crap out of here
696 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
697 gGameSettings
.WarmupTime
:= gsWarmupTime
;
698 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
702 procedure ProcStartCustomGame();
706 GameMode
:= LatchGameOptions('mCustomGameMenu');
707 if GameMode
= GM_NONE
then Exit
;
709 g_Console_WriteGameConfig
;
710 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
,
711 gsMaxLives
, gsGameFlags
, gsPlayers
);
715 procedure ProcStartNetGame();
719 GameMode
:= LatchGameOptions('mNetServerMenu');
720 if GameMode
= GM_NONE
then Exit
;
722 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
724 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
725 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
726 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
727 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
728 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
729 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
732 g_Console_WriteGameConfig
;
733 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
, gsMaxLives
,
734 gsGameFlags
, gsPlayers
, 0, NetPort
);
737 procedure ProcConnectNetGame();
741 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
743 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
744 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
745 PW
:= TGUIEdit(GetControl('edPW')).Text;
748 g_Console_WriteGameConfig
;
749 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
752 procedure ProcEnterPassword();
756 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
758 NetClientIP
:= PromptIP
;
759 NetClientPort
:= PromptPort
;
760 PW
:= TGUIEdit(GetControl('edPW')).Text;
763 g_Console_WriteGameConfig
;
764 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
767 procedure ProcServerlist();
769 if not NetInitDone
then
771 if (not g_Net_Init()) then
773 g_Console_Add('NET: ERROR: Failed to init ENet!');
780 g_Net_Slist_Set(NetMasterList
);
782 gState
:= STATE_SLIST
;
783 g_ActiveWindow
:= nil;
785 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
790 slReturnPressed
:= True;
791 if g_Net_Slist_Fetch(slCurrent
) then
793 if slCurrent
= nil then
794 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
797 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
798 g_Serverlist_GenerateTable(slCurrent
, slTable
);
801 procedure ProcStartCampaign();
807 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
809 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
810 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
812 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
818 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
821 procedure ProcSelectMap(Sender
: TGUIControl
);
825 wad
, map
, res
: String;
827 win
:= g_GUI_GetWindow('SelectMapMenu');
828 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
830 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
831 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
833 if (wad
= '') or (map
= '') then
834 begin // Ýòî íå êàðòà
835 TGUILabel(GetControl('lbMapName')).Text := '';
836 TGUILabel(GetControl('lbMapAuthor')).Text := '';
837 TGUILabel(GetControl('lbMapSize')).Text := '';
838 TGUIMemo(GetControl('meMapDescription')).SetText('');
839 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
840 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
846 a
:= g_Map_GetMapInfo(res
);
848 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
849 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
850 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
851 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
852 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
853 TGUILabel(win
.GetControl('lbMapScale')).Text :=
854 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
859 procedure ProcSelectWAD(Sender
: TGUIControl
);
864 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
866 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
868 with TGUIListBox(GetControl('lsMapRes')) do
874 list
:= g_Map_GetMapsList(wad
);
888 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
894 win
:= g_GUI_GetWindow('CampaignMenu');
895 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
897 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
901 TGUILabel(GetControl('lbWADName')).Text := '';
902 TGUILabel(GetControl('lbWADAuthor')).Text := '';
903 TGUIMemo(GetControl('meWADDescription')).SetText('');
906 a
:= g_Game_GetMegaWADInfo(wad
);
908 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
909 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
910 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
912 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
916 fn
:= g_ExtractWadName(a
.pic
);
918 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
920 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
925 procedure ProcChangeColor(Sender
: TGUIControl
);
929 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
930 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
931 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
932 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
933 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
934 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
936 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
937 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
938 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
939 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
940 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
941 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
944 procedure ProcSelectModel(Sender
: TGUIControl
);
949 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
950 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
951 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
953 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
954 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
955 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
957 ProcChangeColor(nil);
960 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
972 wad
:= TWADFile
.Create
;
973 if wad
.ReadFile(GameWAD
) then
974 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
979 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
981 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
982 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
983 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
984 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
986 if g_Texture_Get('FONT_STD', ID
) then
987 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
992 if cfglen
<> 0 then FreeMem(cfgdata
);
995 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
1001 cfgdata
, fntdata
: Pointer;
1002 cfglen
, fntlen
: Integer;
1010 wad
:= TWADFile
.Create
;
1011 if wad
.ReadFile(GameWAD
) then
1013 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1014 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1020 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1021 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1022 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1024 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1025 FontID
:= e_CharFont_Create(spc
);
1027 for a
:= 0 to 255 do
1029 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1030 if chrwidth
= 0 then Continue
;
1032 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1034 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1040 if cfglen
<> 0 then FreeMem(cfgdata
);
1041 if fntlen
<> 0 then FreeMem(fntdata
);
1044 procedure MenuLoadData();
1046 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1048 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1049 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1050 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1051 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1052 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1053 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1054 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1055 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1056 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1057 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1058 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1059 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1060 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1061 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1062 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1063 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1064 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1065 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1066 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1067 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1068 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1069 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1070 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1071 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1072 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1074 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1075 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1076 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1077 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1078 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1079 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1080 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1083 procedure MenuFreeData();
1085 e_CharFont_Remove(gMenuFont
);
1086 e_CharFont_Remove(gMenuSmallFont
);
1088 g_Texture_Delete('MAINMENU_LOGO');
1089 g_Texture_Delete('MAINMENU_MARKER1');
1090 g_Texture_Delete('MAINMENU_MARKER2');
1091 g_Texture_Delete('SCROLL_LEFT');
1092 g_Texture_Delete('SCROLL_RIGHT');
1093 g_Texture_Delete('SCROLL_MIDDLE');
1094 g_Texture_Delete('SCROLL_MARKER');
1095 g_Texture_Delete('EDIT_LEFT');
1096 g_Texture_Delete('EDIT_RIGHT');
1097 g_Texture_Delete('EDIT_MIDDLE');
1098 g_Texture_Delete('BOX1');
1099 g_Texture_Delete('BOX2');
1100 g_Texture_Delete('BOX3');
1101 g_Texture_Delete('BOX4');
1102 g_Texture_Delete('BOX5');
1103 g_Texture_Delete('BOX6');
1104 g_Texture_Delete('BOX7');
1105 g_Texture_Delete('BOX8');
1106 g_Texture_Delete('BOX9');
1107 g_Texture_Delete('BSCROLL_UP_A');
1108 g_Texture_Delete('BSCROLL_UP_U');
1109 g_Texture_Delete('BSCROLL_DOWN_A');
1110 g_Texture_Delete('BSCROLL_DOWN_U');
1111 g_Texture_Delete('BSCROLL_MIDDLE');
1112 g_Texture_Delete('NOPIC');
1114 g_Sound_Delete('MENU_SELECT');
1115 g_Sound_Delete('MENU_OPEN');
1116 g_Sound_Delete('MENU_CLOSE');
1117 g_Sound_Delete('MENU_CHANGE');
1118 g_Sound_Delete('SCROLL_ADD');
1119 g_Sound_Delete('SCROLL_SUB');
1120 g_Sound_Delete('SOUND_PLAYER_FALL');
1123 procedure ProcAuthorsMenu();
1125 gMusic
.SetByName('MUSIC_INTERMUS');
1129 procedure ProcExitMenuKeyDown (yes
: Boolean);
1132 snd
: TPlayableSound
;
1137 g_Game_StopAllSounds(True);
1138 case (Random(18)) of
1139 0: s
:= 'SOUND_MONSTER_PAIN';
1140 1: s
:= 'SOUND_MONSTER_DIE_3';
1141 2: s
:= 'SOUND_MONSTER_SLOP';
1142 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1143 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1144 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1145 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1146 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1147 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1148 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1149 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1150 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1151 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1152 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1153 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1154 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1155 else s
:= 'SOUND_PLAYER_FALL';
1157 snd
:= TPlayableSound
.Create();
1158 res
:= snd
.SetByName(s
);
1159 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1163 while snd
.IsPlaying() do begin end;
1171 procedure ProcLoadMenu();
1178 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1179 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1180 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1184 procedure ProcSaveMenu();
1192 name
:= g_GetSaveName(a
, valid
);
1193 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1194 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1198 procedure ProcSaveGame(Sender
: TGUIControl
);
1202 if g_Game_IsNet
then Exit
;
1203 if g_Game_IsTestMap
then Exit
;
1204 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1205 g_Game_PauseAllSounds(True);
1206 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1208 g_ActiveWindow
:= nil;
1209 g_Game_Pause(False);
1212 procedure ProcLoadGame(Sender
: TGUIControl
);
1216 if g_Game_IsNet
then Exit
;
1217 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1218 if g_LoadGame(a
) then
1220 g_Game_PauseAllSounds(False)
1222 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1224 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1225 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1226 //g_ActiveWindow := nil;
1230 procedure ProcSinglePlayer (n
: Integer);
1231 var wad
, map
: AnsiString;
1234 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1235 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1236 if e_FindResource(AllMapDirs
, wad
) then
1238 wad
:= ExpandFileName(wad
);
1239 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1243 procedure ProcSingle1Player
;
1248 procedure ProcSingle2Players
;
1253 procedure ProcSelectMapMenu();
1256 wad_lb
: TGUIFileListBox
;
1257 map_lb
: TGUIListBox
;
1260 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1261 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1262 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1264 if wad_lb
.SelectedItem() <> '' then
1265 map
:= map_lb
.SelectedItem()
1269 wad_lb
.UpdateFileList();
1272 if wad_lb
.SelectedItem() <> '' then
1275 map_lb
.SelectItem(map
);
1277 if map_lb
.SelectedItem() <> '' then
1281 g_GUI_ShowWindow('SelectMapMenu');
1284 procedure ProcSelectCampaignMenu();
1287 wad_lb
: TGUIFileListBox
;
1289 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1290 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1292 wad_lb
.UpdateFileList();
1294 if wad_lb
.SelectedItem() <> '' then
1295 ProcSelectCampaignWAD(nil);
1298 procedure ProcSetMap();
1300 wad
, map
, res
: String;
1302 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1304 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1305 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1308 if (wad
= '') or (map
= '') then
1311 wad
:= e_FindWadRel(MapDirs
, WAD
);
1313 res
:= wad
+':\'+map
;
1315 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1316 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1319 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1323 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1325 g_Sound_SetupAllVolumes(
1326 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1327 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1331 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1335 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1336 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1338 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1339 g_dbg_scale
:= TempScale
+ 1;
1343 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1347 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1348 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1349 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1350 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1353 procedure ProcOptionsPlayersMIMenu();
1358 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1360 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1362 if a
= '' then Exit
;
1364 b
:= g_PlayerModel_GetInfo(a
);
1366 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1368 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1369 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1370 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1372 if b
.HaveWeapon
then
1373 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1375 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1378 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1381 procedure ProcOptionsPlayersAnim();
1385 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1390 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1393 Model
.GetCurrentAnimation
.Loop
:= True;
1394 Model
.GetCurrentAnimationMask
.Loop
:= True;
1398 procedure ProcOptionsPlayersWeap();
1402 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1407 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1411 procedure ProcOptionsPlayersRot();
1415 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1416 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1418 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1422 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1426 g_Options_SetDefault();
1432 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1434 if yes
then ReadOptions();
1438 procedure ProcAuthorsClose();
1440 gMusic
.SetByName('MUSIC_MENU');
1442 gState
:= STATE_MENU
;
1445 procedure ProcGMClose();
1447 g_Game_InGameMenu(False);
1450 procedure ProcGMShow();
1455 if (gGameSettings
.GameType
= GT_SINGLE
) and
1456 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1457 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1458 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1460 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1461 if g_Game_IsTestMap
then
1462 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1463 TGUIMainMenu(g_ActiveWindow
.GetControl(
1464 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1467 procedure ProcChangePlayers();
1469 TeamGame
, Spectator
, AddTwo
: Boolean;
1470 P1Team
{, P2Team}: Byte;
1471 bP2
: TGUITextButton
;
1473 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1474 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1475 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1476 P1Team
:= TEAM_NONE
;
1477 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1479 //P2Team := TEAM_NONE;
1480 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1482 TGUIMainMenu(g_ActiveWindow
.GetControl(
1483 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1484 TGUIMainMenu(g_ActiveWindow
.GetControl(
1485 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1486 TGUIMainMenu(g_ActiveWindow
.GetControl(
1487 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1489 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1490 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1491 bP2
.Enabled
:= AddTwo
and not Spectator
;
1493 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1495 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1496 if gPlayer2
= nil then
1497 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1499 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1501 TGUIMainMenu(g_ActiveWindow
.GetControl(
1502 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1505 procedure ProcJoinRed();
1507 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1509 if g_Game_IsServer
then
1511 if gPlayer1
= nil then
1512 g_Game_AddPlayer(TEAM_RED
)
1515 if gPlayer1
.Team
<> TEAM_RED
then
1517 gPlayer1
.SwitchTeam
;
1518 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1521 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1526 gPlayer1Settings
.Team
:= TEAM_RED
;
1527 MC_SEND_PlayerSettings
;
1528 if gPlayer1
= nil then
1529 g_Game_AddPlayer(TEAM_RED
);
1531 g_ActiveWindow
:= nil;
1532 g_Game_Pause(False);
1535 procedure ProcJoinBlue();
1537 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1539 if g_Game_IsServer
then
1541 if gPlayer1
= nil then
1542 g_Game_AddPlayer(TEAM_BLUE
)
1545 if gPlayer1
.Team
<> TEAM_BLUE
then
1547 gPlayer1
.SwitchTeam
;
1548 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1551 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1556 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1557 MC_SEND_PlayerSettings
;
1558 if gPlayer1
= nil then
1559 g_Game_AddPlayer(TEAM_BLUE
);
1561 g_ActiveWindow
:= nil;
1562 g_Game_Pause(False);
1565 procedure ProcJoinGame();
1567 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1569 if gPlayer1
= nil then
1571 g_ActiveWindow
:= nil;
1572 g_Game_Pause(False);
1575 procedure ProcSwitchP2();
1577 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1579 if gPlayer1
= nil then
1581 if gPlayer2
= nil then
1584 g_Game_RemovePlayer();
1585 g_ActiveWindow
:= nil;
1586 g_Game_Pause(False);
1589 procedure ProcSpectate();
1591 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1594 g_ActiveWindow
:= nil;
1595 g_Game_Pause(False);
1598 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1600 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1603 procedure ProcEndMenuKeyDown (yes
: Boolean);
1605 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1608 procedure ProcSetRussianLanguage
;
1610 if gLanguage
<> LANGUAGE_RUSSIAN
then
1612 gLanguage
:= LANGUAGE_RUSSIAN
;
1613 gLanguageChange
:= True;
1614 gAskLanguage
:= False;
1619 procedure ProcSetEnglishLanguage
;
1621 if gLanguage
<> LANGUAGE_ENGLISH
then
1623 gLanguage
:= LANGUAGE_ENGLISH
;
1624 gLanguageChange
:= True;
1625 gAskLanguage
:= False;
1630 procedure ReadGameSettings();
1634 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1636 with gGameSettings
do
1638 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1639 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1643 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1644 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1646 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1648 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1652 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1653 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1658 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1659 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1660 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1662 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1663 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1664 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1667 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1672 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1674 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1675 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1676 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1678 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1679 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1683 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1684 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1686 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1687 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1688 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1689 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1690 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1691 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1692 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1696 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1697 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1698 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1699 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1700 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1705 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1706 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1711 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1712 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1717 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1718 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1723 procedure ProcApplyGameSet();
1727 stat
: TPlayerStatArray
;
1729 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1731 if not g_Game_IsServer
then Exit
;
1733 with gGameSettings
do
1735 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1737 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1738 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1740 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1743 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1745 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1746 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1747 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1748 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1749 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1753 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1755 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1756 Options
:= Options
or GAME_OPTION_DMKEYS
1758 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1761 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1763 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1769 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1771 TimeLimit
:= Max(n
, b
);
1775 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1777 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1784 if GameMode
= GM_DM
then
1786 stat
:= g_Player_GetStats();
1788 for a
:= 0 to High(stat
) do
1789 if stat
[a
].Frags
> b
then
1793 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1795 GoalLimit
:= Max(n
, b
);
1799 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1801 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1802 if n
< 0 then n
:= 0;
1803 if n
> 255 then n
:= 255;
1809 stat
:= g_Player_GetStats();
1811 for a
:= 0 to High(stat
) do
1812 if stat
[a
].Lives
> b
then
1815 MaxLives
:= Max(n
, b
);
1819 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1821 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1824 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1825 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1829 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1830 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1834 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1835 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1840 // don't forget to latch this shit
1841 gsGameFlags
:= Options
;
1842 gsMaxLives
:= MaxLives
;
1843 gsGoalLimit
:= GoalLimit
;
1844 gsTimeLimit
:= TimeLimit
;
1847 if g_Game_IsNet
then MH_SEND_GameSettings
;
1850 procedure ProcVideoOptionsRes();
1855 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1857 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1858 IntToStr(gWinSizeX
) +
1859 ' x ' + IntToStr(gWinSizeY
) +
1860 ', ' + IntToStr(gBPP
) + ' bpp';
1862 with TGUIListBox(menu
.GetControl('lsResolution')) do
1864 list
:= sys_GetDisplayModes(gBPP
);
1868 ItemIndex
:= Length(list
)
1876 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1882 TempResScale
:= Round(r_pixel_scale
- 1);
1883 with TGUISwitch(menu
.GetControl('swResFactor')) do
1884 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1887 procedure ProcApplyVideoOptions();
1890 Fullscreen
: Boolean;
1891 SWidth
, SHeight
: Integer;
1892 ScaleChanged
: Boolean;
1895 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1897 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1899 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1902 SWidth
:= gWinSizeX
;
1903 SHeight
:= gWinSizeY
;
1904 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1907 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1909 ScaleChanged
:= False;
1910 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1912 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1913 r_pixel_scale
:= TempResScale
+ 1;
1914 ScaleChanged
:= True;
1917 if (SWidth
<> gWinSizeX
) or
1918 (SHeight
<> gWinSizeY
) or
1919 (Fullscreen
<> gFullscreen
) or
1922 gResolutionChange
:= True;
1923 gRC_Width
:= SWidth
;
1924 gRC_Height
:= SHeight
;
1925 gRC_FullScreen
:= Fullscreen
;
1926 gRC_Maximized
:= gWinMaximized
;
1929 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1933 procedure ProcSetFirstRussianLanguage
;
1935 gLanguage
:= LANGUAGE_RUSSIAN
;
1936 gLanguageChange
:= True;
1937 gAskLanguage
:= False;
1940 procedure ProcSetFirstEnglishLanguage
;
1942 gLanguage
:= LANGUAGE_ENGLISH
;
1943 gLanguageChange
:= True;
1944 gAskLanguage
:= False;
1947 procedure ProcRecallAddress();
1949 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1951 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1952 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1956 procedure CreateFirstLanguageMenu();
1960 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1962 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1964 Name
:= 'mmFirstLanguageMenu';
1965 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1966 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1969 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1970 Menu
.MainWindow
:= True;
1971 g_GUI_AddWindow(Menu
);
1974 procedure g_Menu_AskLanguage();
1976 CreateFirstLanguageMenu();
1977 g_GUI_ShowWindow('FirstLanguageMenu');
1980 procedure CreatePlayerOptionsMenu(s
: String);
1985 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1987 a
:= _lc
[I_MENU_PLAYER_1
]
1989 a
:= _lc
[I_MENU_PLAYER_2
];
1990 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1992 Name
:= 'mOptionsPlayers'+s
+'Menu';
1993 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1995 Name
:= 'ed'+s
+'Name';
1999 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
2001 Name
:= 'sw'+s
+'Team';
2002 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
2003 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2005 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2007 Name
:= 'ls'+s
+'Model';
2009 Items
:= g_PlayerModel_GetNames();
2010 OnChange
:= ProcSelectModel
;
2012 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2014 Name
:= 'sc'+s
+'Red';
2016 OnChange
:= ProcChangeColor
;
2018 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2020 Name
:= 'sc'+s
+'Green';
2022 OnChange
:= ProcChangeColor
;
2024 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2026 Name
:= 'sc'+s
+'Blue';
2028 OnChange
:= ProcChangeColor
;
2031 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2032 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2033 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2034 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2036 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2038 Name
:= 'mv'+s
+'Model';
2039 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2040 Y
:= GetControl('ls'+s
+'Model').Y
;
2043 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2044 g_GUI_AddWindow(Menu
);
2047 procedure CreateAllMenus();
2051 a
, cx
, _y
, i
: Integer;
2054 Menu
:= TGUIWindow
.Create('MainMenu');
2055 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2057 Name
:= 'mmMainMenu';
2058 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2059 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2060 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2061 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2062 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2063 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2065 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2067 Color
:= _RGB(255, 255, 255);
2068 X
:= gScreenWidth
-GetWidth
-8;
2069 Y
:= gScreenHeight
-GetHeight
-8;
2071 Menu
.DefControl
:= 'mmMainMenu';
2072 Menu
.MainWindow
:= True;
2073 g_GUI_AddWindow(Menu
);
2075 Menu
:= TGUIWindow
.Create('NewGameMenu');
2076 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2078 Name
:= 'mmNewGameMenu';
2079 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2080 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2081 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2082 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2084 Menu
.DefControl
:= 'mmNewGameMenu';
2085 g_GUI_AddWindow(Menu
);
2087 Menu
:= TGUIWindow
.Create('NetGameMenu');
2088 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2090 Name
:= 'mmNetGameMenu';
2091 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2092 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2094 Menu
.DefControl
:= 'mmNetGameMenu';
2095 g_GUI_AddWindow(Menu
);
2097 Menu
:= TGUIWindow
.Create('NetServerMenu');
2098 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2100 Name
:= 'mNetServerMenu';
2101 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2103 Name
:= 'edSrvName';
2104 OnlyDigits
:= False;
2107 Text := NetServerName
;
2109 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2111 Name
:= 'edSrvPassword';
2112 OnlyDigits
:= False;
2115 Text := NetPassword
;
2117 with AddEdit(_lc
[I_NET_PORT
]) do
2123 Text := IntToStr(NetPort
);
2125 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2127 Name
:= 'edMaxPlayers';
2131 Text := IntToStr(NetMaxClients
);
2133 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2135 Name
:= 'swUseMaster';
2136 AddItem(_lc
[I_MENU_YES
]);
2137 AddItem(_lc
[I_MENU_NO
]);
2138 if NetUseMaster
then
2144 with AddLabel(_lc
[I_MENU_MAP
]) do
2149 OnClick
:= @ProcSelectMapMenu
;
2151 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2153 Name
:= 'swGameMode';
2154 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2155 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2156 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2157 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2158 case g_Game_TextToMode(gsGameMode
) of
2160 GM_DM
: ItemIndex
:= 0;
2161 GM_TDM
: ItemIndex
:= 1;
2162 GM_CTF
: ItemIndex
:= 2;
2164 GM_COOP
: ItemIndex
:= 3;
2166 OnChange
:= ProcSwitchMonstersCustom
;
2168 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2170 Name
:= 'edTimeLimit';
2174 if gsTimeLimit
> 0 then
2175 Text := IntToStr(gsTimeLimit
);
2177 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2179 Name
:= 'edGoalLimit';
2183 if gsGoalLimit
> 0 then
2184 Text := IntToStr(gsGoalLimit
);
2186 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2188 Name
:= 'edMaxLives';
2192 if gsMaxLives
> 0 then
2193 Text := IntToStr(gsMaxLives
);
2195 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2197 Name
:= 'edItemRespawnTime';
2201 if gsItemRespawnTime
> 0 then
2202 Text := IntToStr(gsItemRespawnTime
);
2204 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2206 Name
:= 'swPlayers';
2207 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2208 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2209 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2210 ItemIndex
:= gsPlayers
;
2212 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2214 Name
:= 'swTeamDamage';
2215 AddItem(_lc
[I_MENU_YES
]);
2216 AddItem(_lc
[I_MENU_NO
]);
2217 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2222 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2224 Name
:= 'swTeamHit';
2225 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2226 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2227 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2228 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2229 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2231 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2233 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2238 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2240 Name
:= 'swDeathmatchKeys';
2241 AddItem(_lc
[I_MENU_YES
]);
2242 AddItem(_lc
[I_MENU_NO
]);
2243 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2248 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2250 Name
:= 'swEnableExits';
2251 AddItem(_lc
[I_MENU_YES
]);
2252 AddItem(_lc
[I_MENU_NO
]);
2253 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2258 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2260 Name
:= 'swWeaponStay';
2261 AddItem(_lc
[I_MENU_YES
]);
2262 AddItem(_lc
[I_MENU_NO
]);
2263 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2268 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2270 Name
:= 'swMonsters';
2271 AddItem(_lc
[I_MENU_YES
]);
2272 AddItem(_lc
[I_MENU_NO
]);
2273 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2278 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2281 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2282 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2283 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2285 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2287 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2291 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2295 Menu
.DefControl
:= 'mNetServerMenu';
2296 g_GUI_AddWindow(Menu
);
2298 Menu
:= TGUIWindow
.Create('NetClientMenu');
2299 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2301 Name
:= 'mNetClientMenu';
2303 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2306 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2312 Text := 'localhost';
2314 with AddEdit(_lc
[I_NET_PORT
]) do
2322 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2325 OnlyDigits
:= False;
2332 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2336 Menu
.DefControl
:= 'mNetClientMenu';
2337 g_GUI_AddWindow(Menu
);
2339 Menu
:= TGUIWindow
.Create('LoadMenu');
2340 Menu
.OnShow
:= ProcLoadMenu
;
2341 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2343 Name
:= 'mmLoadMenu';
2348 Name
:= 'edSlot'+IntToStr(a
);
2351 OnEnter
:= ProcLoadGame
;
2354 Menu
.DefControl
:= 'mmLoadMenu';
2355 g_GUI_AddWindow(Menu
);
2357 Menu
:= TGUIWindow
.Create('SaveMenu');
2358 Menu
.OnShow
:= ProcSaveMenu
;
2359 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2361 Name
:= 'mmSaveMenu';
2366 Name
:= 'edSlot'+IntToStr(a
);
2369 OnChange
:= ProcSaveGame
;
2372 Menu
.DefControl
:= 'mmSaveMenu';
2373 g_GUI_AddWindow(Menu
);
2375 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2376 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2378 Name
:= 'mCustomGameMenu';
2379 with AddLabel(_lc
[I_MENU_MAP
]) do
2384 OnClick
:= @ProcSelectMapMenu
;
2386 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2388 Name
:= 'swGameMode';
2389 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2390 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2391 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2392 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2393 case g_Game_TextToMode(gsGameMode
) of
2395 GM_DM
: ItemIndex
:= 0;
2396 GM_TDM
: ItemIndex
:= 1;
2397 GM_CTF
: ItemIndex
:= 2;
2399 GM_COOP
: ItemIndex
:= 3;
2401 OnChange
:= ProcSwitchMonstersCustom
;
2403 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2405 Name
:= 'edTimeLimit';
2409 if gsTimeLimit
> 0 then
2410 Text := IntToStr(gsTimeLimit
);
2412 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2414 Name
:= 'edGoalLimit';
2418 if gsGoalLimit
> 0 then
2419 Text := IntToStr(gsGoalLimit
);
2421 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2423 Name
:= 'edMaxLives';
2427 if gsMaxLives
> 0 then
2428 Text := IntToStr(gsMaxLives
);
2430 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2432 Name
:= 'edItemRespawnTime';
2436 if gsItemRespawnTime
> 0 then
2437 Text := IntToStr(gsItemRespawnTime
);
2439 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2441 Name
:= 'swPlayers';
2442 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2443 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2444 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2445 ItemIndex
:= gsPlayers
;
2447 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2449 Name
:= 'swTeamDamage';
2450 AddItem(_lc
[I_MENU_YES
]);
2451 AddItem(_lc
[I_MENU_NO
]);
2452 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2457 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2459 Name
:= 'swTeamHit';
2460 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2461 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2462 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2463 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2464 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2466 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2468 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2473 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2475 Name
:= 'swDeathmatchKeys';
2476 AddItem(_lc
[I_MENU_YES
]);
2477 AddItem(_lc
[I_MENU_NO
]);
2478 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2483 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2485 Name
:= 'swEnableExits';
2486 AddItem(_lc
[I_MENU_YES
]);
2487 AddItem(_lc
[I_MENU_NO
]);
2488 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2493 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2495 Name
:= 'swWeaponStay';
2496 AddItem(_lc
[I_MENU_YES
]);
2497 AddItem(_lc
[I_MENU_NO
]);
2498 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2503 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2505 Name
:= 'swMonsters';
2506 AddItem(_lc
[I_MENU_YES
]);
2507 AddItem(_lc
[I_MENU_NO
]);
2508 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2513 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2516 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2517 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2518 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2520 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2522 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2526 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2530 Menu
.DefControl
:= 'mCustomGameMenu';
2531 g_GUI_AddWindow(Menu
);
2533 Menu
:= TGUIWindow
.Create('CampaignMenu');
2534 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2536 Name
:= 'mCampaignMenu';
2545 with AddFileList('', 15, 4) do
2548 OnChange
:= ProcSelectCampaignWAD
;
2552 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2553 SetBase(MegawadDirs
);
2556 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2558 Name
:= 'lbWADName';
2562 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2564 Name
:= 'lbWADAuthor';
2568 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2569 with AddMemo('', 15, 3) do
2571 Name
:= 'meWADDescription';
2572 Color
:= MENU_ITEMSCTRL_COLOR
;
2574 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2576 Name
:= 'swPlayers';
2577 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2578 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2581 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2585 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2587 Name
:= 'mpWADImage';
2588 DefaultRes
:= 'NOPIC';
2589 X
:= GetControl('lsWAD').X
+4;
2590 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2593 Menu
.DefControl
:= 'mCampaignMenu';
2594 g_GUI_AddWindow(Menu
);
2596 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2597 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2599 Name
:= 'mSelectMapMenu';
2600 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2603 OnChange
:= ProcSelectWAD
;
2607 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2610 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2614 OnChange
:= ProcSelectMap
;
2617 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2619 Name
:= 'lbMapName';
2623 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2625 Name
:= 'lbMapAuthor';
2629 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2631 Name
:= 'lbMapSize';
2635 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2637 Name
:= 'meMapDescription';
2642 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2644 Name
:= 'mpMapPreview';
2645 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2646 Y
:= GetControl('lsMapWAD').Y
;
2648 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2650 Name
:= 'lbMapScale';
2653 Color
:= MENU_ITEMSCTRL_COLOR
;
2654 X
:= GetControl('lsMapWAD').X
+
2655 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2656 2 + MAPPREVIEW_WIDTH
*4;
2657 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2660 Menu
.OnClose
:= ProcSetMap
;
2661 Menu
.DefControl
:= 'mSelectMapMenu';
2662 g_GUI_AddWindow(Menu
);
2664 Menu
:= TGUIWindow
.Create('OptionsMenu');
2665 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2667 Name
:= 'mmOptionsMenu';
2668 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2669 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2670 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2671 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2672 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2673 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2675 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2676 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2678 Menu
.OnClose
:= ProcApplyOptions
;
2679 Menu
.DefControl
:= 'mmOptionsMenu';
2680 g_GUI_AddWindow(Menu
);
2682 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2683 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2684 g_GUI_AddWindow(Menu
);
2686 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2687 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2689 Name
:= 'mOptionsVideoMenu';
2690 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2691 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2697 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2700 AddItem(_lc
[I_MENU_YES
]);
2701 AddItem(_lc
[I_MENU_NO
]);
2703 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2705 Name
:= 'swTextureFilter';
2706 AddItem(_lc
[I_MENU_YES
]);
2707 AddItem(_lc
[I_MENU_NO
]);
2709 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2712 AddItem(_lc
[I_MENU_YES
]);
2713 AddItem(_lc
[I_MENU_NO
]);
2715 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2717 Name
:= 'swLegacyNPOT';
2718 AddItem(_lc
[I_MENU_NO
]);
2719 AddItem(_lc
[I_MENU_YES
]);
2722 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2725 Menu
.DefControl
:= 'mOptionsVideoMenu';
2726 g_GUI_AddWindow(Menu
);
2728 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2729 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2731 Name
:= 'mOptionsVideoResMenu';
2732 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2734 Name
:= 'lbCurrentRes';
2738 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2740 Name
:= 'lsResolution';
2743 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2745 Name
:= 'swFullScreen';
2746 AddItem(_lc
[I_MENU_YES
]);
2747 AddItem(_lc
[I_MENU_NO
]);
2749 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2751 Name
:= 'swResFactor';
2753 for i
:= 2 to gRC_Width
div 640 do
2754 AddItem(IntToStr(i
) + 'x');
2757 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2760 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2761 g_GUI_AddWindow(Menu
);
2763 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2764 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2766 Name
:= 'mOptionsSoundMenu';
2767 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2769 Name
:= 'scMusicLevel';
2771 OnChange
:= ProcChangeSoundSettings
;
2773 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2775 Name
:= 'scSoundLevel';
2777 OnChange
:= ProcChangeSoundSettings
;
2779 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2781 Name
:= 'scMaxSimSounds';
2784 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2786 Name
:= 'swAnnouncer';
2787 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2788 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2789 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2790 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2792 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2793 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2795 Name
:= 'swSoundEffects';
2796 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2797 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2799 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2800 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2802 Name
:= 'swChatSpeech';
2803 AddItem(_lc
[I_MENU_YES
]);
2804 AddItem(_lc
[I_MENU_NO
]);
2806 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2808 Name
:= 'swInactiveSounds';
2809 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2810 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2814 Menu
.DefControl
:= 'mOptionsSoundMenu';
2815 g_GUI_AddWindow(Menu
);
2817 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2818 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2820 Name
:= 'mOptionsGameMenu';
2821 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2823 Name
:= 'scParticlesCount';
2826 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2828 Name
:= 'swBloodCount';
2829 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2830 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2831 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2832 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2833 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2835 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2837 Name
:= 'scShellsMax';
2840 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2842 Name
:= 'scGibsMax';
2845 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2847 Name
:= 'scCorpsesMax';
2850 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2852 Name
:= 'swGibsCount';
2853 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2854 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2855 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2856 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2857 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2859 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2861 Name
:= 'swCorpseType';
2862 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2863 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2865 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2867 Name
:= 'swGibsType';
2868 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2869 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2871 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2873 Name
:= 'swBloodType';
2874 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2875 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2877 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2879 Name
:= 'swScreenFlash';
2880 AddItem(_lc
[I_MENU_NO
]);
2881 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2882 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2884 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2886 Name
:= 'swBackground';
2887 AddItem(_lc
[I_MENU_YES
]);
2888 AddItem(_lc
[I_MENU_NO
]);
2890 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2892 Name
:= 'swMessages';
2893 AddItem(_lc
[I_MENU_YES
]);
2894 AddItem(_lc
[I_MENU_NO
]);
2896 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2898 Name
:= 'swRevertPlayers';
2899 AddItem(_lc
[I_MENU_YES
]);
2900 AddItem(_lc
[I_MENU_NO
]);
2902 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2904 Name
:= 'swChatBubble';
2905 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2906 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2907 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2908 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2909 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2911 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2913 Name
:= 'swPlayerIndicator';
2914 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2915 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2916 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2918 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2920 Name
:= 'swPlayerIndicatorStyle';
2921 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2922 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2924 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2926 Name
:= 'scScaleFactor';
2928 OnChange
:= ProcChangeGameSettings
;
2932 Menu
.DefControl
:= 'mOptionsGameMenu';
2933 g_GUI_AddWindow(Menu
);
2935 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2936 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2938 Name
:= 'mOptionsControlsMenu';
2939 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2940 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2941 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2942 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2943 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2945 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2946 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2947 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2948 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2949 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2950 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2951 if e_HasJoysticks
then
2954 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2956 if g_touch_enabled
then
2959 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2962 Menu
.DefControl
:= 'mOptionsControlsMenu';
2963 g_GUI_AddWindow(Menu
);
2965 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2966 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2968 Name
:= 'mOptionsControlsP1Menu';
2969 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2970 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2971 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2972 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2973 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2974 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2975 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2976 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2977 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2978 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2980 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2981 g_GUI_AddWindow(Menu
);
2983 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2984 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2986 Name
:= 'mOptionsControlsP1MenuWeapons';
2987 for i
:= WP_FIRST
to WP_LAST
do
2988 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2989 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2991 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2992 g_GUI_AddWindow(Menu
);
2994 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2995 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2997 Name
:= 'mOptionsControlsP2Menu';
2998 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2999 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3000 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3001 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3002 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3003 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3004 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3005 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3006 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3007 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3009 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3010 g_GUI_AddWindow(Menu
);
3012 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3013 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3015 Name
:= 'mOptionsControlsP2MenuWeapons';
3016 for i
:= WP_FIRST
to WP_LAST
do
3017 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3018 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3020 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3021 g_GUI_AddWindow(Menu
);
3023 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3024 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3026 Name
:= 'mOptionsControlsJoystickMenu';
3027 for i
:= 0 to e_MaxJoys
- 1 do
3028 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3030 Name
:= 'scDeadzone' + IntToStr(i
);
3034 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3035 g_GUI_AddWindow(Menu
);
3037 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3038 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3040 Name
:= 'mOptionsControlsTouchMenu';
3041 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3043 Name
:= 'swTouchAlt';
3044 AddItem(_lc
[I_MENU_NO
]);
3045 AddItem(_lc
[I_MENU_YES
]);
3046 OnChange
:= ProcChangeTouchSettings
;
3048 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3050 Name
:= 'scTouchSize';
3052 OnChange
:= ProcChangeTouchSettings
;
3054 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3056 Name
:= 'swTouchFire';
3057 AddItem(_lc
[I_MENU_NO
]);
3058 AddItem(_lc
[I_MENU_YES
]);
3060 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3062 Name
:= 'scTouchOffset';
3064 OnChange
:= ProcChangeTouchSettings
;
3067 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3068 g_GUI_AddWindow(Menu
);
3070 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3071 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3073 Name
:= 'mOptionsPlayersMenu';
3074 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3075 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3077 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3078 g_GUI_AddWindow(Menu
);
3080 CreatePlayerOptionsMenu('P1');
3081 CreatePlayerOptionsMenu('P2');
3083 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3084 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3086 Name
:= 'mOptionsPlayersMIMenu';
3087 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3092 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3097 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3099 Name
:= 'meComment';
3102 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3103 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3106 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3110 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3111 g_GUI_AddWindow(Menu
);
3113 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3114 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3116 Name
:= 'mOptionsLanguageMenu';
3117 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3118 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3121 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3122 g_GUI_AddWindow(Menu
);
3124 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3125 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3126 g_GUI_AddWindow(Menu
);
3128 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3129 Menu
.BackTexture
:= 'INTER';
3130 Menu
.OnClose
:= ProcAuthorsClose
;
3134 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3136 Color
:= _RGB(255, 0, 0);
3137 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3139 _y
:= _y
+GetHeight();
3141 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3143 Color
:= _RGB(255, 0, 0);
3144 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3146 _y
:= _y
+GetHeight()+32;
3148 // ×òî äåëàë: Êòî äåëàë
3149 cx
:= gScreenWidth
div 2 - 320 + 64;
3150 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3152 Color
:= _RGB(255, 0, 0);
3157 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3159 Color
:= _RGB(255, 255, 255);
3164 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3166 Color
:= _RGB(255, 0, 0);
3171 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3173 Color
:= _RGB(255, 255, 255);
3178 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3180 Color
:= _RGB(255, 255, 255);
3185 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3187 Color
:= _RGB(255, 0, 0);
3192 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3194 Color
:= _RGB(255, 255, 255);
3199 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3201 Color
:= _RGB(255, 0, 0);
3206 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3208 Color
:= _RGB(255, 255, 255);
3211 _y
:= gScreenHeight
- 128;
3214 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3216 Color
:= _RGB(255, 0, 0);
3221 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3223 Color
:= _RGB(255, 255, 255);
3226 _y
:= _y
+GetHeight();
3228 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3230 Color
:= _RGB(255, 255, 255);
3233 _y
:= _y
+GetHeight();
3235 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3237 Color
:= _RGB(255, 255, 255);
3240 _y
:= gScreenHeight
- 32;
3242 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3244 Color
:= _RGB(255, 0, 0);
3245 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3248 g_GUI_AddWindow(Menu
);
3250 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3251 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3252 g_GUI_AddWindow(Menu
);
3254 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3255 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3257 Name
:= 'mmGameSingleMenu';
3258 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3259 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3260 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3261 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3262 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3263 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3265 Menu
.DefControl
:= 'mmGameSingleMenu';
3266 Menu
.MainWindow
:= True;
3267 Menu
.OnClose
:= ProcGMClose
;
3268 Menu
.OnShow
:= ProcGMShow
;
3269 g_GUI_AddWindow(Menu
);
3271 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3272 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3273 g_GUI_AddWindow(Menu
);
3275 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3276 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3277 g_GUI_AddWindow(Menu
);
3279 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3280 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3282 Name
:= 'mmGameCustomMenu';
3283 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3284 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3285 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3286 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3287 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3288 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3289 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3291 Menu
.DefControl
:= 'mmGameCustomMenu';
3292 Menu
.MainWindow
:= True;
3293 Menu
.OnClose
:= ProcGMClose
;
3294 Menu
.OnShow
:= ProcGMShow
;
3295 g_GUI_AddWindow(Menu
);
3297 Menu
:= TGUIWindow
.Create('GameServerMenu');
3298 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3300 Name
:= 'mmGameServerMenu';
3301 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3302 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3303 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3304 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3305 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3307 Menu
.DefControl
:= 'mmGameServerMenu';
3308 Menu
.MainWindow
:= True;
3309 Menu
.OnClose
:= ProcGMClose
;
3310 Menu
.OnShow
:= ProcGMShow
;
3311 g_GUI_AddWindow(Menu
);
3313 Menu
:= TGUIWindow
.Create('GameClientMenu');
3314 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3316 Name
:= 'mmGameClientMenu';
3317 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3318 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3319 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3321 Menu
.DefControl
:= 'mmGameClientMenu';
3322 Menu
.MainWindow
:= True;
3323 Menu
.OnClose
:= ProcGMClose
;
3324 Menu
.OnShow
:= ProcGMShow
;
3325 g_GUI_AddWindow(Menu
);
3327 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3328 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3330 Name
:= 'mClientPasswordMenu';
3331 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3339 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3342 Menu
.DefControl
:= 'mClientPasswordMenu';
3343 g_GUI_AddWindow(Menu
);
3345 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3346 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3348 Name
:= 'mGameSetGameMenu';
3349 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3351 Name
:= 'swTeamDamage';
3352 AddItem(_lc
[I_MENU_YES
]);
3353 AddItem(_lc
[I_MENU_NO
]);
3356 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3358 Name
:= 'swTeamHit';
3359 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3360 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3361 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3362 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3365 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3367 Name
:= 'swDeathmatchKeys';
3368 AddItem(_lc
[I_MENU_YES
]);
3369 AddItem(_lc
[I_MENU_NO
]);
3372 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3374 Name
:= 'edTimeLimit';
3379 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3381 Name
:= 'edGoalLimit';
3386 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3388 Name
:= 'edMaxLives';
3393 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3396 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3397 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3398 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3404 Menu
.DefControl
:= 'mGameSetGameMenu';
3405 Menu
.OnClose
:= ProcApplyGameSet
;
3406 g_GUI_AddWindow(Menu
);
3408 Menu
:= TGUIWindow
.Create('TeamMenu');
3409 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3411 Name
:= 'mmTeamMenu';
3412 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3413 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3414 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3415 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3416 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3418 Menu
.DefControl
:= 'mmTeamMenu';
3419 Menu
.OnShow
:= ProcChangePlayers
;
3420 g_GUI_AddWindow(Menu
);
3423 procedure g_Menu_Show_SaveMenu();
3425 if g_Game_IsTestMap
then
3427 if gGameSettings
.GameType
= GT_SINGLE
then
3428 g_GUI_ShowWindow('GameSingleMenu')
3431 if g_Game_IsClient
then
3434 if g_Game_IsNet
then
3437 g_GUI_ShowWindow('GameCustomMenu');
3439 g_GUI_ShowWindow('SaveMenu');
3440 g_Sound_PlayEx('MENU_OPEN');
3443 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3445 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3446 if gGameSettings
.GameType
= GT_SINGLE
then
3448 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3452 if g_Game_IsClient
then exit
;
3453 if g_Game_IsNet
then exit
;
3454 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3456 g_GUI_ShowWindow('LoadMenu');
3457 g_Sound_PlayEx('MENU_OPEN');
3460 procedure g_Menu_Show_GameSetGame();
3462 if gGameSettings
.GameType
= GT_SINGLE
then
3463 g_GUI_ShowWindow('GameSingleMenu')
3466 if g_Game_IsClient
then
3469 if g_Game_IsNet
then
3470 g_GUI_ShowWindow('GameServerMenu')
3472 g_GUI_ShowWindow('GameCustomMenu');
3475 g_GUI_ShowWindow('GameSetGameMenu');
3476 g_Sound_PlayEx('MENU_OPEN');
3479 procedure g_Menu_Show_OptionsVideo();
3481 if gGameSettings
.GameType
= GT_SINGLE
then
3482 g_GUI_ShowWindow('GameSingleMenu')
3485 if g_Game_IsClient
then
3486 g_GUI_ShowWindow('GameClientMenu')
3488 if g_Game_IsNet
then
3489 g_GUI_ShowWindow('GameServerMenu')
3491 g_GUI_ShowWindow('GameCustomMenu');
3494 g_GUI_ShowWindow('OptionsMenu');
3495 g_GUI_ShowWindow('OptionsVideoMenu');
3496 g_Sound_PlayEx('MENU_OPEN');
3499 procedure g_Menu_Show_OptionsSound();
3501 if gGameSettings
.GameType
= GT_SINGLE
then
3502 g_GUI_ShowWindow('GameSingleMenu')
3505 if g_Game_IsClient
then
3506 g_GUI_ShowWindow('GameClientMenu')
3508 if g_Game_IsNet
then
3509 g_GUI_ShowWindow('GameServerMenu')
3511 g_GUI_ShowWindow('GameCustomMenu');
3514 g_GUI_ShowWindow('OptionsMenu');
3515 g_GUI_ShowWindow('OptionsSoundMenu');
3516 g_Sound_PlayEx('MENU_OPEN');
3519 procedure g_Menu_Show_EndGameMenu();
3521 g_GUI_ShowWindow('EndGameMenu');
3522 g_Sound_PlayEx('MENU_OPEN');
3525 procedure g_Menu_Show_QuitGameMenu();
3527 g_GUI_ShowWindow('ExitMenu');
3528 g_Sound_PlayEx('MENU_OPEN');
3531 procedure g_Menu_Init();
3538 procedure g_Menu_Free();
3542 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3547 procedure g_Menu_Reset();
3551 g_GUI_SaveMenuPos();
3552 ex
:= g_GUI_Destroy();
3556 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3561 g_Game_SetDebugMode();
3563 g_GUI_LoadMenuPos();