1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../shared/a_modes.inc}
20 procedure g_Menu_Init();
21 procedure g_Menu_Free();
22 procedure g_Menu_Reset();
23 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
24 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
25 procedure g_Menu_AskLanguage();
27 procedure g_Menu_Show_SaveMenu();
28 procedure g_Menu_Show_LoadMenu(standalone
: Boolean=false);
29 procedure g_Menu_Show_GameSetGame();
30 procedure g_Menu_Show_OptionsVideo();
31 procedure g_Menu_Show_OptionsSound();
32 procedure g_Menu_Show_EndGameMenu();
33 procedure g_Menu_Show_QuitGameMenu();
37 gMenuSmallFont
: DWORD
;
40 TempScale
: Integer = -1;
41 TempResScale
: Integer = -1;
46 {$INCLUDE ../nogl/noGLuses.inc}
47 g_gui
, g_textures
, e_graphics
, g_main
, g_window
, g_game
, g_map
,
48 g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
, g_weapons
,
49 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
50 MAPDEF
, Math
, g_saveload
,
51 e_texture
, g_language
, e_res
,
52 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
, g_touch
,
53 utils
, wadreader
, g_system
;
56 type TYNCallback
= procedure (yes
:Boolean);
58 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
60 if win
.UserData
= nil then exit
;
62 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
63 IK_N
: TYNCallback(win
.UserData
)(false);
67 procedure YesButtonCB (ctl
: TGUITextButton
);
69 if ctl
.UserData
= nil then exit
;
70 TYNCallback(ctl
.UserData
)(true);
73 procedure NoButtonCB (ctl
: TGUITextButton
);
75 if ctl
.UserData
= nil then exit
;
76 TYNCallback(ctl
.UserData
)(false);
79 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
83 //if length(Text) = 0 then exit;
84 Result
:= TGUIWindow
.Create(WinName
);
87 //OnKeyDownEx := @YNKeyDownProc;
88 //UserData := @ActionProc;
89 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
92 Name
:= '__temp_yes_no_menu:'+WinName
;
94 AddText(Text, MaxLen
);
95 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
96 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
98 DefControl
:= '__temp_yes_no_menu:'+WinName
;
104 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
105 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
107 procedure ProcApplyOptions();
113 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
115 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
121 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
122 if (ovs
<> gVSync
) then
123 sys_EnableVSync(gVSync
);
125 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
126 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
127 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).ItemIndex
= 0;
129 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
131 g_Sound_SetupAllVolumes(
132 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
133 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
136 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
137 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
138 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
139 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
140 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
142 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
144 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
145 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
146 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
147 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
149 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
154 else gGibsCount
:= 48;
157 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
158 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
159 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
160 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
161 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
162 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
163 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
164 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
165 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
166 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
167 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
168 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
170 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
171 g_dbg_scale
:= TempScale
+ 1;
174 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
178 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
179 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
180 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
181 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
182 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
183 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
184 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
185 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
188 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
191 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
193 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
194 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
195 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
196 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
197 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
198 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
199 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
200 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
203 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
204 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
205 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
206 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
207 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext', '-p1_weapnext');
208 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev', '-p1_weapprev');
209 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
210 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
212 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
213 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
214 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
215 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
216 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
217 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
218 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
219 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
220 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
221 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
224 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
228 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext', '-p1_weapnext');
229 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev', '-p1_weapprev');
230 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
231 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
234 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
237 for i
:= WP_FIRST
to WP_LAST
do
239 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
240 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
241 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
242 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
246 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
249 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
250 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
251 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
252 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
253 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
254 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
255 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
256 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
257 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
258 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
259 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
260 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
261 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
262 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
263 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
264 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
265 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p2_weapnext', '-p2_weapnext');
266 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev', '-p2_weapprev');
267 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
268 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
270 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
271 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
272 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
273 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
274 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
275 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
276 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
277 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
278 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
279 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
282 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
283 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
284 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
285 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
286 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext', '-p2_weapnext');
287 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev', '-p2_weapprev');
288 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
289 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
292 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
295 for i
:= WP_FIRST
to WP_LAST
do
297 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
298 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
299 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
300 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
304 if e_HasJoysticks
then
306 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
309 for i
:= 0 to e_MaxJoys
- 1 do
310 if e_JoystickAvailable
[i
] then
311 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
315 if g_touch_enabled
then
317 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
318 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
319 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
320 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
321 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
324 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
326 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
327 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
328 TEAM_RED
, TEAM_BLUE
);
330 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
332 gPlayer1Settings
.Model
:= Model
.Name
;
333 gPlayer1Settings
.Color
:= Model
.Color
;
336 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
338 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
339 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
340 TEAM_RED
, TEAM_BLUE
);
341 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
343 gPlayer2Settings
.Model
:= Model
.Name
;
344 gPlayer2Settings
.Color
:= Model
.Color
;
347 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
348 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
350 if g_Game_IsServer
then
352 if gPlayer1
<> nil then
354 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
355 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
356 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
357 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
359 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
362 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
365 if gPlayer2
<> nil then
367 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
368 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
369 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
370 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
372 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
377 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
379 g_Console_WriteGameConfig
;
382 procedure ReadOptions();
387 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
389 with TGUISwitch(menu
.GetControl('swBPP')) do
395 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
396 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
398 with TGUISwitch(menu
.GetControl('swVSync')) do
399 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
401 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
402 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
404 with TGUISwitch(menu
.GetControl('swInterp')) do
405 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
407 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
409 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
410 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
411 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
413 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
414 if gMuteWhenInactive
then
419 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
421 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
422 if gSoundEffectsDF
then
427 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
428 if gUseChatSounds
then
433 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
436 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
437 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
438 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
439 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
440 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
441 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
442 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
443 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
445 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
447 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
448 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
449 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
450 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
451 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
452 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
453 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
454 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
455 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
456 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
459 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
462 for i
:= WP_FIRST
to WP_LAST
do
464 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
465 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
469 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
472 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
473 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
474 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
476 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
477 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
478 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
481 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
488 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
489 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
490 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
491 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
492 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
495 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
498 for i
:= WP_FIRST
to WP_LAST
do
500 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
501 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
505 if e_HasJoysticks
then
507 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
510 for i
:= 0 to e_MaxJoys
- 1 do
511 if e_JoystickAvailable
[i
] then
512 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
516 if g_touch_enabled
then
518 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
519 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
520 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
521 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
522 with TGUISwitch(menu
.GetControl('swTouchFire')) do
523 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
524 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
527 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
530 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
531 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
532 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
533 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
536 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
538 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
539 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
540 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
541 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
542 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
544 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
547 with TGUISwitch(menu
.GetControl('swBloodType')) do
548 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
550 with TGUISwitch(menu
.GetControl('swCorpseType')) do
551 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
553 with TGUISwitch(menu
.GetControl('swGibsType')) do
554 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
556 with TGUISwitch(menu
.GetControl('swGibsCount')) do
565 with TGUISwitch(menu
.GetControl('swBackGround')) do
566 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
568 with TGUISwitch(menu
.GetControl('swMessages')) do
569 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
571 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
572 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
574 with TGUISwitch(menu
.GetControl('swChatBubble')) do
575 ItemIndex
:= gChatBubble
;
577 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
578 ItemIndex
:= gPlayerIndicator
;
580 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
581 ItemIndex
:= gPlayerIndicatorStyle
;
583 TempScale
:= Round(g_dbg_scale
- 1);
584 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
586 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
588 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
589 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
591 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
592 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
594 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
595 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
596 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
598 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
600 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
601 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
603 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
604 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
606 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
607 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
608 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
610 ProcSelectModel(nil);
613 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
615 // don't turn off monsters in DM
617 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
618 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
619 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
621 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
624 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
625 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
626 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
627 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
631 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
633 // don't turn off monsters in DM
635 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
636 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
637 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
639 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
642 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
643 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
644 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
645 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
649 function LatchGameOptions(const MenuName
: string): Byte;
655 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
657 Map
:= TGUILabel(GetControl('lbMap')).Text;
660 if not isWadPath(Map
) then
663 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
664 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
665 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
666 gsGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
667 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
668 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
669 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
673 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
674 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
675 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
676 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
677 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
678 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
679 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
680 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
681 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
682 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
684 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
685 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
686 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
687 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
690 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
691 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
692 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
693 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
696 // TODO: get this crap out of here
697 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
698 gGameSettings
.WarmupTime
:= gsWarmupTime
;
699 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
703 procedure ProcStartCustomGame();
707 GameMode
:= LatchGameOptions('mCustomGameMenu');
708 if GameMode
= GM_NONE
then Exit
;
710 g_Console_WriteGameConfig
;
711 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
,
712 gsMaxLives
, gsGameFlags
, gsPlayers
);
716 procedure ProcStartNetGame();
720 GameMode
:= LatchGameOptions('mNetServerMenu');
721 if GameMode
= GM_NONE
then Exit
;
723 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
725 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
726 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
727 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
728 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
729 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
730 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
733 g_Console_WriteGameConfig
;
734 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
, gsMaxLives
,
735 gsGameFlags
, gsPlayers
, 0, NetPort
);
738 procedure ProcConnectNetGame();
742 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
744 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
745 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
746 PW
:= TGUIEdit(GetControl('edPW')).Text;
749 g_Console_WriteGameConfig
;
750 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
753 procedure ProcEnterPassword();
757 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
759 NetClientIP
:= PromptIP
;
760 NetClientPort
:= PromptPort
;
761 PW
:= TGUIEdit(GetControl('edPW')).Text;
764 g_Console_WriteGameConfig
;
765 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
768 procedure ProcServerlist();
770 if not NetInitDone
then
772 if (not g_Net_Init()) then
774 g_Console_Add('NET: ERROR: Failed to init ENet!');
781 g_Net_Slist_Set(NetMasterList
);
783 gState
:= STATE_SLIST
;
784 g_ActiveWindow
:= nil;
786 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
791 slReturnPressed
:= True;
792 if g_Net_Slist_Fetch(slCurrent
) then
794 if slCurrent
= nil then
795 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
798 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
799 g_Serverlist_GenerateTable(slCurrent
, slTable
);
802 procedure ProcStartCampaign();
808 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
810 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
811 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
813 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
819 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
822 procedure ProcSelectMap(Sender
: TGUIControl
);
826 wad
, map
, res
: String;
828 win
:= g_GUI_GetWindow('SelectMapMenu');
829 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
831 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
832 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
834 if (wad
= '') or (map
= '') then
835 begin // Ýòî íå êàðòà
836 TGUILabel(GetControl('lbMapName')).Text := '';
837 TGUILabel(GetControl('lbMapAuthor')).Text := '';
838 TGUILabel(GetControl('lbMapSize')).Text := '';
839 TGUIMemo(GetControl('meMapDescription')).SetText('');
840 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
841 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
847 a
:= g_Map_GetMapInfo(res
);
849 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
850 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
851 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
852 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
853 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
854 TGUILabel(win
.GetControl('lbMapScale')).Text :=
855 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
860 procedure ProcSelectWAD(Sender
: TGUIControl
);
865 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
867 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
869 with TGUIListBox(GetControl('lsMapRes')) do
875 list
:= g_Map_GetMapsList(wad
);
889 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
895 win
:= g_GUI_GetWindow('CampaignMenu');
896 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
898 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
902 TGUILabel(GetControl('lbWADName')).Text := '';
903 TGUILabel(GetControl('lbWADAuthor')).Text := '';
904 TGUIMemo(GetControl('meWADDescription')).SetText('');
907 a
:= g_Game_GetMegaWADInfo(wad
);
909 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
910 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
911 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
913 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
917 fn
:= g_ExtractWadName(a
.pic
);
919 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
921 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
926 procedure ProcChangeColor(Sender
: TGUIControl
);
930 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
931 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
932 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
933 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
934 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
935 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
937 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
938 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
939 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
940 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
941 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
942 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
945 procedure ProcSelectModel(Sender
: TGUIControl
);
950 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
951 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
952 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
954 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
955 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
956 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
958 ProcChangeColor(nil);
961 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
973 wad
:= TWADFile
.Create
;
974 if wad
.ReadFile(GameWAD
) then
975 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
980 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
982 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
983 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
984 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
985 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
987 if g_Texture_Get('FONT_STD', ID
) then
988 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
993 if cfglen
<> 0 then FreeMem(cfgdata
);
996 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
1002 cfgdata
, fntdata
: Pointer;
1003 cfglen
, fntlen
: Integer;
1011 wad
:= TWADFile
.Create
;
1012 if wad
.ReadFile(GameWAD
) then
1014 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1015 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1021 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1022 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1023 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1025 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1026 FontID
:= e_CharFont_Create(spc
);
1028 for a
:= 0 to 255 do
1030 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1031 if chrwidth
= 0 then Continue
;
1033 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1035 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1041 if cfglen
<> 0 then FreeMem(cfgdata
);
1042 if fntlen
<> 0 then FreeMem(fntdata
);
1045 procedure MenuLoadData();
1047 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1049 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1050 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1051 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1052 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1053 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1054 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1055 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1056 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1057 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1058 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1059 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1060 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1061 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1062 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1063 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1064 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1065 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1066 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1067 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1068 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1069 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1070 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1071 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1072 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1073 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1075 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1076 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1077 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1078 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1079 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1080 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1081 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1084 procedure MenuFreeData();
1086 e_CharFont_Remove(gMenuFont
);
1087 e_CharFont_Remove(gMenuSmallFont
);
1089 g_Texture_Delete('MAINMENU_LOGO');
1090 g_Texture_Delete('MAINMENU_MARKER1');
1091 g_Texture_Delete('MAINMENU_MARKER2');
1092 g_Texture_Delete('SCROLL_LEFT');
1093 g_Texture_Delete('SCROLL_RIGHT');
1094 g_Texture_Delete('SCROLL_MIDDLE');
1095 g_Texture_Delete('SCROLL_MARKER');
1096 g_Texture_Delete('EDIT_LEFT');
1097 g_Texture_Delete('EDIT_RIGHT');
1098 g_Texture_Delete('EDIT_MIDDLE');
1099 g_Texture_Delete('BOX1');
1100 g_Texture_Delete('BOX2');
1101 g_Texture_Delete('BOX3');
1102 g_Texture_Delete('BOX4');
1103 g_Texture_Delete('BOX5');
1104 g_Texture_Delete('BOX6');
1105 g_Texture_Delete('BOX7');
1106 g_Texture_Delete('BOX8');
1107 g_Texture_Delete('BOX9');
1108 g_Texture_Delete('BSCROLL_UP_A');
1109 g_Texture_Delete('BSCROLL_UP_U');
1110 g_Texture_Delete('BSCROLL_DOWN_A');
1111 g_Texture_Delete('BSCROLL_DOWN_U');
1112 g_Texture_Delete('BSCROLL_MIDDLE');
1113 g_Texture_Delete('NOPIC');
1115 g_Sound_Delete('MENU_SELECT');
1116 g_Sound_Delete('MENU_OPEN');
1117 g_Sound_Delete('MENU_CLOSE');
1118 g_Sound_Delete('MENU_CHANGE');
1119 g_Sound_Delete('SCROLL_ADD');
1120 g_Sound_Delete('SCROLL_SUB');
1121 g_Sound_Delete('SOUND_PLAYER_FALL');
1124 procedure ProcAuthorsMenu();
1126 gMusic
.SetByName('MUSIC_INTERMUS');
1130 procedure ProcExitMenuKeyDown (yes
: Boolean);
1133 snd
: TPlayableSound
;
1138 g_Game_StopAllSounds(True);
1139 case (Random(18)) of
1140 0: s
:= 'SOUND_MONSTER_PAIN';
1141 1: s
:= 'SOUND_MONSTER_DIE_3';
1142 2: s
:= 'SOUND_MONSTER_SLOP';
1143 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1144 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1145 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1146 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1147 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1148 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1149 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1150 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1151 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1152 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1153 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1154 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1155 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1156 else s
:= 'SOUND_PLAYER_FALL';
1158 snd
:= TPlayableSound
.Create();
1159 res
:= snd
.SetByName(s
);
1160 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1164 while snd
.IsPlaying() do begin end;
1172 procedure ProcLoadMenu();
1179 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1180 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1181 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1185 procedure ProcSaveMenu();
1193 name
:= g_GetSaveName(a
, valid
);
1194 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1195 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1199 procedure ProcSaveGame(Sender
: TGUIControl
);
1203 if g_Game_IsNet
then Exit
;
1204 if g_Game_IsTestMap
then Exit
;
1205 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1206 g_Game_PauseAllSounds(True);
1207 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1209 g_ActiveWindow
:= nil;
1210 g_Game_Pause(False);
1213 procedure ProcLoadGame(Sender
: TGUIControl
);
1217 if g_Game_IsNet
then Exit
;
1218 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1219 if g_LoadGame(a
) then
1221 g_Game_PauseAllSounds(False)
1223 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1225 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1226 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1227 //g_ActiveWindow := nil;
1231 procedure ProcSinglePlayer (n
: Integer);
1232 var wad
, map
: AnsiString;
1235 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1236 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1237 if e_FindResource(AllMapDirs
, wad
) then
1239 wad
:= ExpandFileName(wad
);
1240 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1244 procedure ProcSingle1Player
;
1249 procedure ProcSingle2Players
;
1254 procedure ProcSelectMapMenu();
1257 wad_lb
: TGUIFileListBox
;
1258 map_lb
: TGUIListBox
;
1261 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1262 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1263 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1265 if wad_lb
.SelectedItem() <> '' then
1266 map
:= map_lb
.SelectedItem()
1270 wad_lb
.UpdateFileList();
1273 if wad_lb
.SelectedItem() <> '' then
1276 map_lb
.SelectItem(map
);
1278 if map_lb
.SelectedItem() <> '' then
1282 g_GUI_ShowWindow('SelectMapMenu');
1285 procedure ProcSelectCampaignMenu();
1288 wad_lb
: TGUIFileListBox
;
1290 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1291 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1293 wad_lb
.UpdateFileList();
1295 if wad_lb
.SelectedItem() <> '' then
1296 ProcSelectCampaignWAD(nil);
1299 procedure ProcSetMap();
1301 wad
, map
, res
: String;
1303 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1305 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1306 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1309 if (wad
= '') or (map
= '') then
1312 wad
:= e_FindWadRel(MapDirs
, WAD
);
1314 res
:= wad
+':\'+map
;
1316 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1317 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1320 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1324 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1326 g_Sound_SetupAllVolumes(
1327 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1328 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1332 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1336 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1337 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1339 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1340 g_dbg_scale
:= TempScale
+ 1;
1344 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1348 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1349 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1350 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1351 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1354 procedure ProcOptionsPlayersMIMenu();
1359 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1361 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1363 if a
= '' then Exit
;
1365 b
:= g_PlayerModel_GetInfo(a
);
1367 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1369 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1370 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1371 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1373 if b
.HaveWeapon
then
1374 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1376 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1379 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1382 procedure ProcOptionsPlayersAnim();
1386 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1391 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1394 Model
.GetCurrentAnimation
.Loop
:= True;
1395 Model
.GetCurrentAnimationMask
.Loop
:= True;
1399 procedure ProcOptionsPlayersWeap();
1403 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1408 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1412 procedure ProcOptionsPlayersRot();
1416 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1417 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1419 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1423 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1427 g_Options_SetDefault();
1433 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1435 if yes
then ReadOptions();
1439 procedure ProcAuthorsClose();
1441 gMusic
.SetByName('MUSIC_MENU');
1443 gState
:= STATE_MENU
;
1446 procedure ProcGMClose();
1448 g_Game_InGameMenu(False);
1451 procedure ProcGMShow();
1456 if (gGameSettings
.GameType
= GT_SINGLE
) and
1457 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1458 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1459 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1461 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1462 if g_Game_IsTestMap
then
1463 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1464 TGUIMainMenu(g_ActiveWindow
.GetControl(
1465 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1468 procedure ProcChangePlayers();
1470 TeamGame
, Spectator
, AddTwo
: Boolean;
1471 P1Team
{, P2Team}: Byte;
1472 bP2
: TGUITextButton
;
1474 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1475 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1476 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1477 P1Team
:= TEAM_NONE
;
1478 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1480 //P2Team := TEAM_NONE;
1481 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1483 TGUIMainMenu(g_ActiveWindow
.GetControl(
1484 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1485 TGUIMainMenu(g_ActiveWindow
.GetControl(
1486 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1487 TGUIMainMenu(g_ActiveWindow
.GetControl(
1488 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1490 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1491 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1492 bP2
.Enabled
:= AddTwo
and not Spectator
;
1494 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1496 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1497 if gPlayer2
= nil then
1498 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1500 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1502 TGUIMainMenu(g_ActiveWindow
.GetControl(
1503 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1506 procedure ProcJoinRed();
1508 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1510 if g_Game_IsServer
then
1512 if gPlayer1
= nil then
1513 g_Game_AddPlayer(TEAM_RED
)
1516 if gPlayer1
.Team
<> TEAM_RED
then
1518 gPlayer1
.SwitchTeam
;
1519 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1522 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1527 gPlayer1Settings
.Team
:= TEAM_RED
;
1528 MC_SEND_PlayerSettings
;
1529 if gPlayer1
= nil then
1530 g_Game_AddPlayer(TEAM_RED
);
1532 g_ActiveWindow
:= nil;
1533 g_Game_Pause(False);
1536 procedure ProcJoinBlue();
1538 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1540 if g_Game_IsServer
then
1542 if gPlayer1
= nil then
1543 g_Game_AddPlayer(TEAM_BLUE
)
1546 if gPlayer1
.Team
<> TEAM_BLUE
then
1548 gPlayer1
.SwitchTeam
;
1549 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1552 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1557 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1558 MC_SEND_PlayerSettings
;
1559 if gPlayer1
= nil then
1560 g_Game_AddPlayer(TEAM_BLUE
);
1562 g_ActiveWindow
:= nil;
1563 g_Game_Pause(False);
1566 procedure ProcJoinGame();
1568 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1570 if gPlayer1
= nil then
1572 g_ActiveWindow
:= nil;
1573 g_Game_Pause(False);
1576 procedure ProcSwitchP2();
1578 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1580 if gPlayer1
= nil then
1582 if gPlayer2
= nil then
1585 g_Game_RemovePlayer();
1586 g_ActiveWindow
:= nil;
1587 g_Game_Pause(False);
1590 procedure ProcSpectate();
1592 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1595 g_ActiveWindow
:= nil;
1596 g_Game_Pause(False);
1599 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1601 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1604 procedure ProcEndMenuKeyDown (yes
: Boolean);
1606 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1609 procedure ProcSetRussianLanguage
;
1611 if gLanguage
<> LANGUAGE_RUSSIAN
then
1613 gLanguage
:= LANGUAGE_RUSSIAN
;
1614 gLanguageChange
:= True;
1615 gAskLanguage
:= False;
1620 procedure ProcSetEnglishLanguage
;
1622 if gLanguage
<> LANGUAGE_ENGLISH
then
1624 gLanguage
:= LANGUAGE_ENGLISH
;
1625 gLanguageChange
:= True;
1626 gAskLanguage
:= False;
1631 procedure ReadGameSettings();
1635 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1637 with gGameSettings
do
1639 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1640 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1644 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1645 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1647 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1649 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1653 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1654 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1659 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1660 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1661 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1663 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1664 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1665 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1668 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1673 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1675 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1676 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1677 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1679 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1680 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1684 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1685 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1687 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1688 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1689 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1690 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1691 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1692 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1693 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1697 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1698 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1699 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1700 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1701 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1706 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1707 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1712 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1713 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1718 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1719 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1724 procedure ProcApplyGameSet();
1728 stat
: TPlayerStatArray
;
1730 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1732 if not g_Game_IsServer
then Exit
;
1734 with gGameSettings
do
1736 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1738 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1739 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1741 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1744 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1746 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1747 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1748 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1749 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1750 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1754 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1756 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1757 Options
:= Options
or GAME_OPTION_DMKEYS
1759 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1762 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1764 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1770 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1772 TimeLimit
:= Max(n
, b
);
1776 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1778 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1785 if GameMode
= GM_DM
then
1787 stat
:= g_Player_GetStats();
1789 for a
:= 0 to High(stat
) do
1790 if stat
[a
].Frags
> b
then
1794 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1796 GoalLimit
:= Max(n
, b
);
1800 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1802 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1803 if n
< 0 then n
:= 0;
1804 if n
> 255 then n
:= 255;
1810 stat
:= g_Player_GetStats();
1812 for a
:= 0 to High(stat
) do
1813 if stat
[a
].Lives
> b
then
1816 MaxLives
:= Max(n
, b
);
1820 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1822 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1825 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1826 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1830 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1831 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1835 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1836 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1841 // don't forget to latch this shit
1842 gsGameFlags
:= Options
;
1843 gsMaxLives
:= MaxLives
;
1844 gsGoalLimit
:= GoalLimit
;
1845 gsTimeLimit
:= TimeLimit
;
1848 if g_Game_IsNet
then MH_SEND_GameSettings
;
1851 procedure ProcVideoOptionsRes();
1856 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1858 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1859 IntToStr(gWinSizeX
) +
1860 ' x ' + IntToStr(gWinSizeY
) +
1861 ', ' + IntToStr(gBPP
) + ' bpp';
1863 with TGUIListBox(menu
.GetControl('lsResolution')) do
1865 list
:= sys_GetDisplayModes(gBPP
);
1869 ItemIndex
:= Length(list
)
1877 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1883 TempResScale
:= Round(r_pixel_scale
- 1);
1884 with TGUISwitch(menu
.GetControl('swResFactor')) do
1885 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1888 procedure ProcApplyVideoOptions();
1891 Fullscreen
: Boolean;
1892 SWidth
, SHeight
: Integer;
1893 ScaleChanged
: Boolean;
1896 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1898 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1900 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1903 SWidth
:= gWinSizeX
;
1904 SHeight
:= gWinSizeY
;
1905 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1908 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1910 ScaleChanged
:= False;
1911 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1913 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1914 r_pixel_scale
:= TempResScale
+ 1;
1915 ScaleChanged
:= True;
1918 if (SWidth
<> gWinSizeX
) or
1919 (SHeight
<> gWinSizeY
) or
1920 (Fullscreen
<> gFullscreen
) or
1923 gResolutionChange
:= True;
1924 gRC_Width
:= SWidth
;
1925 gRC_Height
:= SHeight
;
1926 gRC_FullScreen
:= Fullscreen
;
1927 gRC_Maximized
:= gWinMaximized
;
1930 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1934 procedure ProcSetFirstRussianLanguage
;
1936 gLanguage
:= LANGUAGE_RUSSIAN
;
1937 gLanguageChange
:= True;
1938 gAskLanguage
:= False;
1941 procedure ProcSetFirstEnglishLanguage
;
1943 gLanguage
:= LANGUAGE_ENGLISH
;
1944 gLanguageChange
:= True;
1945 gAskLanguage
:= False;
1948 procedure ProcRecallAddress();
1950 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1952 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1953 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1957 procedure CreateFirstLanguageMenu();
1961 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1963 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1965 Name
:= 'mmFirstLanguageMenu';
1966 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1967 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1970 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1971 Menu
.MainWindow
:= True;
1972 g_GUI_AddWindow(Menu
);
1975 procedure g_Menu_AskLanguage();
1977 CreateFirstLanguageMenu();
1978 g_GUI_ShowWindow('FirstLanguageMenu');
1981 procedure CreatePlayerOptionsMenu(s
: String);
1986 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1988 a
:= _lc
[I_MENU_PLAYER_1
]
1990 a
:= _lc
[I_MENU_PLAYER_2
];
1991 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1993 Name
:= 'mOptionsPlayers'+s
+'Menu';
1994 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1996 Name
:= 'ed'+s
+'Name';
2000 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
2002 Name
:= 'sw'+s
+'Team';
2003 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
2004 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2006 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2008 Name
:= 'ls'+s
+'Model';
2010 Items
:= g_PlayerModel_GetNames();
2011 OnChange
:= ProcSelectModel
;
2013 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2015 Name
:= 'sc'+s
+'Red';
2017 OnChange
:= ProcChangeColor
;
2019 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2021 Name
:= 'sc'+s
+'Green';
2023 OnChange
:= ProcChangeColor
;
2025 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2027 Name
:= 'sc'+s
+'Blue';
2029 OnChange
:= ProcChangeColor
;
2032 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2033 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2034 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2035 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2037 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2039 Name
:= 'mv'+s
+'Model';
2040 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2041 Y
:= GetControl('ls'+s
+'Model').Y
;
2044 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2045 g_GUI_AddWindow(Menu
);
2048 procedure CreateAllMenus();
2052 a
, cx
, _y
, i
: Integer;
2055 Menu
:= TGUIWindow
.Create('MainMenu');
2056 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2058 Name
:= 'mmMainMenu';
2059 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2060 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2061 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2062 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2063 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2064 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2066 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2068 Color
:= _RGB(255, 255, 255);
2069 X
:= gScreenWidth
-GetWidth
-8;
2070 Y
:= gScreenHeight
-GetHeight
-8;
2072 Menu
.DefControl
:= 'mmMainMenu';
2073 Menu
.MainWindow
:= True;
2074 g_GUI_AddWindow(Menu
);
2076 Menu
:= TGUIWindow
.Create('NewGameMenu');
2077 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2079 Name
:= 'mmNewGameMenu';
2080 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2081 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2082 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2083 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2085 Menu
.DefControl
:= 'mmNewGameMenu';
2086 g_GUI_AddWindow(Menu
);
2088 Menu
:= TGUIWindow
.Create('NetGameMenu');
2089 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2091 Name
:= 'mmNetGameMenu';
2092 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2093 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2095 Menu
.DefControl
:= 'mmNetGameMenu';
2096 g_GUI_AddWindow(Menu
);
2098 Menu
:= TGUIWindow
.Create('NetServerMenu');
2099 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2101 Name
:= 'mNetServerMenu';
2102 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2104 Name
:= 'edSrvName';
2105 OnlyDigits
:= False;
2108 Text := NetServerName
;
2110 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2112 Name
:= 'edSrvPassword';
2113 OnlyDigits
:= False;
2116 Text := NetPassword
;
2118 with AddEdit(_lc
[I_NET_PORT
]) do
2124 Text := IntToStr(NetPort
);
2126 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2128 Name
:= 'edMaxPlayers';
2132 Text := IntToStr(NetMaxClients
);
2134 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2136 Name
:= 'swUseMaster';
2137 AddItem(_lc
[I_MENU_YES
]);
2138 AddItem(_lc
[I_MENU_NO
]);
2139 if NetUseMaster
then
2145 with AddLabel(_lc
[I_MENU_MAP
]) do
2150 OnClick
:= @ProcSelectMapMenu
;
2152 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2154 Name
:= 'swGameMode';
2155 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2156 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2157 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2158 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2159 case g_Game_TextToMode(gsGameMode
) of
2161 GM_DM
: ItemIndex
:= 0;
2162 GM_TDM
: ItemIndex
:= 1;
2163 GM_CTF
: ItemIndex
:= 2;
2165 GM_COOP
: ItemIndex
:= 3;
2167 OnChange
:= ProcSwitchMonstersCustom
;
2169 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2171 Name
:= 'edTimeLimit';
2175 if gsTimeLimit
> 0 then
2176 Text := IntToStr(gsTimeLimit
);
2178 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2180 Name
:= 'edGoalLimit';
2184 if gsGoalLimit
> 0 then
2185 Text := IntToStr(gsGoalLimit
);
2187 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2189 Name
:= 'edMaxLives';
2193 if gsMaxLives
> 0 then
2194 Text := IntToStr(gsMaxLives
);
2196 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2198 Name
:= 'edItemRespawnTime';
2202 if gsItemRespawnTime
> 0 then
2203 Text := IntToStr(gsItemRespawnTime
);
2205 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2207 Name
:= 'swPlayers';
2208 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2209 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2210 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2211 ItemIndex
:= gsPlayers
;
2213 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2215 Name
:= 'swTeamDamage';
2216 AddItem(_lc
[I_MENU_YES
]);
2217 AddItem(_lc
[I_MENU_NO
]);
2218 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2223 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2225 Name
:= 'swTeamHit';
2226 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2227 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2228 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2229 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2230 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2232 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2234 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2239 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2241 Name
:= 'swDeathmatchKeys';
2242 AddItem(_lc
[I_MENU_YES
]);
2243 AddItem(_lc
[I_MENU_NO
]);
2244 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2249 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2251 Name
:= 'swEnableExits';
2252 AddItem(_lc
[I_MENU_YES
]);
2253 AddItem(_lc
[I_MENU_NO
]);
2254 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2259 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2261 Name
:= 'swWeaponStay';
2262 AddItem(_lc
[I_MENU_YES
]);
2263 AddItem(_lc
[I_MENU_NO
]);
2264 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2269 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2271 Name
:= 'swMonsters';
2272 AddItem(_lc
[I_MENU_YES
]);
2273 AddItem(_lc
[I_MENU_NO
]);
2274 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2279 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2282 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2283 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2284 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2286 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2288 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2292 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2296 Menu
.DefControl
:= 'mNetServerMenu';
2297 g_GUI_AddWindow(Menu
);
2299 Menu
:= TGUIWindow
.Create('NetClientMenu');
2300 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2302 Name
:= 'mNetClientMenu';
2304 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2307 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2313 Text := 'localhost';
2315 with AddEdit(_lc
[I_NET_PORT
]) do
2323 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2326 OnlyDigits
:= False;
2333 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2337 Menu
.DefControl
:= 'mNetClientMenu';
2338 g_GUI_AddWindow(Menu
);
2340 Menu
:= TGUIWindow
.Create('LoadMenu');
2341 Menu
.OnShow
:= ProcLoadMenu
;
2342 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2344 Name
:= 'mmLoadMenu';
2349 Name
:= 'edSlot'+IntToStr(a
);
2352 OnEnter
:= ProcLoadGame
;
2355 Menu
.DefControl
:= 'mmLoadMenu';
2356 g_GUI_AddWindow(Menu
);
2358 Menu
:= TGUIWindow
.Create('SaveMenu');
2359 Menu
.OnShow
:= ProcSaveMenu
;
2360 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2362 Name
:= 'mmSaveMenu';
2367 Name
:= 'edSlot'+IntToStr(a
);
2370 OnChange
:= ProcSaveGame
;
2373 Menu
.DefControl
:= 'mmSaveMenu';
2374 g_GUI_AddWindow(Menu
);
2376 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2377 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2379 Name
:= 'mCustomGameMenu';
2380 with AddLabel(_lc
[I_MENU_MAP
]) do
2385 OnClick
:= @ProcSelectMapMenu
;
2387 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2389 Name
:= 'swGameMode';
2390 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2391 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2392 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2393 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2394 case g_Game_TextToMode(gsGameMode
) of
2396 GM_DM
: ItemIndex
:= 0;
2397 GM_TDM
: ItemIndex
:= 1;
2398 GM_CTF
: ItemIndex
:= 2;
2400 GM_COOP
: ItemIndex
:= 3;
2402 OnChange
:= ProcSwitchMonstersCustom
;
2404 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2406 Name
:= 'edTimeLimit';
2410 if gsTimeLimit
> 0 then
2411 Text := IntToStr(gsTimeLimit
);
2413 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2415 Name
:= 'edGoalLimit';
2419 if gsGoalLimit
> 0 then
2420 Text := IntToStr(gsGoalLimit
);
2422 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2424 Name
:= 'edMaxLives';
2428 if gsMaxLives
> 0 then
2429 Text := IntToStr(gsMaxLives
);
2431 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2433 Name
:= 'edItemRespawnTime';
2437 if gsItemRespawnTime
> 0 then
2438 Text := IntToStr(gsItemRespawnTime
);
2440 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2442 Name
:= 'swPlayers';
2443 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2444 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2445 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2446 ItemIndex
:= gsPlayers
;
2448 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2450 Name
:= 'swTeamDamage';
2451 AddItem(_lc
[I_MENU_YES
]);
2452 AddItem(_lc
[I_MENU_NO
]);
2453 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2458 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2460 Name
:= 'swTeamHit';
2461 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2462 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2463 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2464 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2465 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2467 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2469 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2474 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2476 Name
:= 'swDeathmatchKeys';
2477 AddItem(_lc
[I_MENU_YES
]);
2478 AddItem(_lc
[I_MENU_NO
]);
2479 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2484 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2486 Name
:= 'swEnableExits';
2487 AddItem(_lc
[I_MENU_YES
]);
2488 AddItem(_lc
[I_MENU_NO
]);
2489 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2494 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2496 Name
:= 'swWeaponStay';
2497 AddItem(_lc
[I_MENU_YES
]);
2498 AddItem(_lc
[I_MENU_NO
]);
2499 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2504 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2506 Name
:= 'swMonsters';
2507 AddItem(_lc
[I_MENU_YES
]);
2508 AddItem(_lc
[I_MENU_NO
]);
2509 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2514 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2517 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2518 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2519 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2521 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2523 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2527 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2531 Menu
.DefControl
:= 'mCustomGameMenu';
2532 g_GUI_AddWindow(Menu
);
2534 Menu
:= TGUIWindow
.Create('CampaignMenu');
2535 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2537 Name
:= 'mCampaignMenu';
2546 with AddFileList('', 15, 4) do
2549 OnChange
:= ProcSelectCampaignWAD
;
2553 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2554 SetBase(MegawadDirs
);
2557 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2559 Name
:= 'lbWADName';
2563 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2565 Name
:= 'lbWADAuthor';
2569 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2570 with AddMemo('', 15, 3) do
2572 Name
:= 'meWADDescription';
2573 Color
:= MENU_ITEMSCTRL_COLOR
;
2575 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2577 Name
:= 'swPlayers';
2578 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2579 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2582 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2586 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2588 Name
:= 'mpWADImage';
2589 DefaultRes
:= 'NOPIC';
2590 X
:= GetControl('lsWAD').X
+4;
2591 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2594 Menu
.DefControl
:= 'mCampaignMenu';
2595 g_GUI_AddWindow(Menu
);
2597 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2598 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2600 Name
:= 'mSelectMapMenu';
2601 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2604 OnChange
:= ProcSelectWAD
;
2608 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2611 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2615 OnChange
:= ProcSelectMap
;
2618 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2620 Name
:= 'lbMapName';
2624 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2626 Name
:= 'lbMapAuthor';
2630 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2632 Name
:= 'lbMapSize';
2636 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2638 Name
:= 'meMapDescription';
2643 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2645 Name
:= 'mpMapPreview';
2646 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2647 Y
:= GetControl('lsMapWAD').Y
;
2649 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2651 Name
:= 'lbMapScale';
2654 Color
:= MENU_ITEMSCTRL_COLOR
;
2655 X
:= GetControl('lsMapWAD').X
+
2656 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2657 2 + MAPPREVIEW_WIDTH
*4;
2658 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2661 Menu
.OnClose
:= ProcSetMap
;
2662 Menu
.DefControl
:= 'mSelectMapMenu';
2663 g_GUI_AddWindow(Menu
);
2665 Menu
:= TGUIWindow
.Create('OptionsMenu');
2666 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2668 Name
:= 'mmOptionsMenu';
2669 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2670 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2671 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2672 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2673 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2674 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2676 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2677 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2679 Menu
.OnClose
:= ProcApplyOptions
;
2680 Menu
.DefControl
:= 'mmOptionsMenu';
2681 g_GUI_AddWindow(Menu
);
2683 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2684 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2685 g_GUI_AddWindow(Menu
);
2687 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2688 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2690 Name
:= 'mOptionsVideoMenu';
2691 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2692 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2698 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2701 AddItem(_lc
[I_MENU_YES
]);
2702 AddItem(_lc
[I_MENU_NO
]);
2704 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2706 Name
:= 'swTextureFilter';
2707 AddItem(_lc
[I_MENU_YES
]);
2708 AddItem(_lc
[I_MENU_NO
]);
2710 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2713 AddItem(_lc
[I_MENU_YES
]);
2714 AddItem(_lc
[I_MENU_NO
]);
2716 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2718 Name
:= 'swLegacyNPOT';
2719 AddItem(_lc
[I_MENU_NO
]);
2720 AddItem(_lc
[I_MENU_YES
]);
2723 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2726 Menu
.DefControl
:= 'mOptionsVideoMenu';
2727 g_GUI_AddWindow(Menu
);
2729 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2730 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2732 Name
:= 'mOptionsVideoResMenu';
2733 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2735 Name
:= 'lbCurrentRes';
2739 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2741 Name
:= 'lsResolution';
2744 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2746 Name
:= 'swFullScreen';
2747 AddItem(_lc
[I_MENU_YES
]);
2748 AddItem(_lc
[I_MENU_NO
]);
2750 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2752 Name
:= 'swResFactor';
2754 for i
:= 2 to gRC_Width
div 640 do
2755 AddItem(IntToStr(i
) + 'x');
2758 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2761 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2762 g_GUI_AddWindow(Menu
);
2764 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2765 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2767 Name
:= 'mOptionsSoundMenu';
2768 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2770 Name
:= 'scMusicLevel';
2772 OnChange
:= ProcChangeSoundSettings
;
2774 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2776 Name
:= 'scSoundLevel';
2778 OnChange
:= ProcChangeSoundSettings
;
2780 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2782 Name
:= 'scMaxSimSounds';
2785 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2787 Name
:= 'swAnnouncer';
2788 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2789 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2790 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2791 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2793 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2794 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2796 Name
:= 'swSoundEffects';
2797 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2798 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2800 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2801 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2803 Name
:= 'swChatSpeech';
2804 AddItem(_lc
[I_MENU_YES
]);
2805 AddItem(_lc
[I_MENU_NO
]);
2807 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2809 Name
:= 'swInactiveSounds';
2810 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2811 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2815 Menu
.DefControl
:= 'mOptionsSoundMenu';
2816 g_GUI_AddWindow(Menu
);
2818 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2819 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2821 Name
:= 'mOptionsGameMenu';
2822 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2824 Name
:= 'scParticlesCount';
2827 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2829 Name
:= 'swBloodCount';
2830 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2831 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2832 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2833 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2834 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2836 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2838 Name
:= 'scShellsMax';
2841 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2843 Name
:= 'scGibsMax';
2846 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2848 Name
:= 'scCorpsesMax';
2851 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2853 Name
:= 'swGibsCount';
2854 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2855 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2856 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2857 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2858 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2860 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2862 Name
:= 'swCorpseType';
2863 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2864 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2866 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2868 Name
:= 'swGibsType';
2869 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2870 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2872 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2874 Name
:= 'swBloodType';
2875 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2876 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2878 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2880 Name
:= 'swScreenFlash';
2881 AddItem(_lc
[I_MENU_NO
]);
2882 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2883 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2885 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2887 Name
:= 'swBackground';
2888 AddItem(_lc
[I_MENU_YES
]);
2889 AddItem(_lc
[I_MENU_NO
]);
2891 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2893 Name
:= 'swMessages';
2894 AddItem(_lc
[I_MENU_YES
]);
2895 AddItem(_lc
[I_MENU_NO
]);
2897 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2899 Name
:= 'swRevertPlayers';
2900 AddItem(_lc
[I_MENU_YES
]);
2901 AddItem(_lc
[I_MENU_NO
]);
2903 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2905 Name
:= 'swChatBubble';
2906 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2907 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2908 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2909 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2910 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2912 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2914 Name
:= 'swPlayerIndicator';
2915 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2916 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2917 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2919 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2921 Name
:= 'swPlayerIndicatorStyle';
2922 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2923 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2925 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2927 Name
:= 'scScaleFactor';
2929 OnChange
:= ProcChangeGameSettings
;
2933 Menu
.DefControl
:= 'mOptionsGameMenu';
2934 g_GUI_AddWindow(Menu
);
2936 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2937 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2939 Name
:= 'mOptionsControlsMenu';
2940 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2941 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2942 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2943 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2944 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2946 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2947 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2948 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2949 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2950 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2951 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2952 if e_HasJoysticks
then
2955 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2957 if g_touch_enabled
then
2960 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2963 Menu
.DefControl
:= 'mOptionsControlsMenu';
2964 g_GUI_AddWindow(Menu
);
2966 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2967 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2969 Name
:= 'mOptionsControlsP1Menu';
2970 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2971 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2972 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2973 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2974 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2975 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2976 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2977 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2978 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2979 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2981 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2982 g_GUI_AddWindow(Menu
);
2984 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2985 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2987 Name
:= 'mOptionsControlsP1MenuWeapons';
2988 for i
:= WP_FIRST
to WP_LAST
do
2989 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2990 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2992 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2993 g_GUI_AddWindow(Menu
);
2995 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2996 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2998 Name
:= 'mOptionsControlsP2Menu';
2999 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3000 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3001 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3002 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3003 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3004 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3005 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3006 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3007 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3008 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3010 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3011 g_GUI_AddWindow(Menu
);
3013 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3014 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3016 Name
:= 'mOptionsControlsP2MenuWeapons';
3017 for i
:= WP_FIRST
to WP_LAST
do
3018 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3019 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3021 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3022 g_GUI_AddWindow(Menu
);
3024 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3025 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3027 Name
:= 'mOptionsControlsJoystickMenu';
3028 for i
:= 0 to e_MaxJoys
- 1 do
3029 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3031 Name
:= 'scDeadzone' + IntToStr(i
);
3035 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3036 g_GUI_AddWindow(Menu
);
3038 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3039 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3041 Name
:= 'mOptionsControlsTouchMenu';
3042 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3044 Name
:= 'swTouchAlt';
3045 AddItem(_lc
[I_MENU_NO
]);
3046 AddItem(_lc
[I_MENU_YES
]);
3047 OnChange
:= ProcChangeTouchSettings
;
3049 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3051 Name
:= 'scTouchSize';
3053 OnChange
:= ProcChangeTouchSettings
;
3055 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3057 Name
:= 'swTouchFire';
3058 AddItem(_lc
[I_MENU_NO
]);
3059 AddItem(_lc
[I_MENU_YES
]);
3061 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3063 Name
:= 'scTouchOffset';
3065 OnChange
:= ProcChangeTouchSettings
;
3068 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3069 g_GUI_AddWindow(Menu
);
3071 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3072 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3074 Name
:= 'mOptionsPlayersMenu';
3075 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3076 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3078 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3079 g_GUI_AddWindow(Menu
);
3081 CreatePlayerOptionsMenu('P1');
3082 CreatePlayerOptionsMenu('P2');
3084 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3085 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3087 Name
:= 'mOptionsPlayersMIMenu';
3088 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3093 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3098 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3100 Name
:= 'meComment';
3103 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3104 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3107 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3111 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3112 g_GUI_AddWindow(Menu
);
3114 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3115 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3117 Name
:= 'mOptionsLanguageMenu';
3118 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3119 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3122 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3123 g_GUI_AddWindow(Menu
);
3125 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3126 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3127 g_GUI_AddWindow(Menu
);
3129 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3130 Menu
.BackTexture
:= 'INTER';
3131 Menu
.OnClose
:= ProcAuthorsClose
;
3135 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3137 Color
:= _RGB(255, 0, 0);
3138 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3140 _y
:= _y
+GetHeight();
3142 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3144 Color
:= _RGB(255, 0, 0);
3145 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3147 _y
:= _y
+GetHeight()+32;
3149 // ×òî äåëàë: Êòî äåëàë
3150 cx
:= gScreenWidth
div 2 - 320 + 64;
3151 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3153 Color
:= _RGB(255, 0, 0);
3158 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3160 Color
:= _RGB(255, 255, 255);
3165 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3167 Color
:= _RGB(255, 0, 0);
3172 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3174 Color
:= _RGB(255, 255, 255);
3179 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3181 Color
:= _RGB(255, 255, 255);
3186 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3188 Color
:= _RGB(255, 0, 0);
3193 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3195 Color
:= _RGB(255, 255, 255);
3200 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3202 Color
:= _RGB(255, 0, 0);
3207 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3209 Color
:= _RGB(255, 255, 255);
3212 _y
:= gScreenHeight
- 128;
3215 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3217 Color
:= _RGB(255, 0, 0);
3222 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3224 Color
:= _RGB(255, 255, 255);
3227 _y
:= _y
+GetHeight();
3229 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3231 Color
:= _RGB(255, 255, 255);
3234 _y
:= _y
+GetHeight();
3236 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3238 Color
:= _RGB(255, 255, 255);
3241 _y
:= gScreenHeight
- 32;
3243 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3245 Color
:= _RGB(255, 0, 0);
3246 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3249 g_GUI_AddWindow(Menu
);
3251 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3252 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3253 g_GUI_AddWindow(Menu
);
3255 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3256 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3258 Name
:= 'mmGameSingleMenu';
3259 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3260 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3261 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3262 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3263 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3264 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3266 Menu
.DefControl
:= 'mmGameSingleMenu';
3267 Menu
.MainWindow
:= True;
3268 Menu
.OnClose
:= ProcGMClose
;
3269 Menu
.OnShow
:= ProcGMShow
;
3270 g_GUI_AddWindow(Menu
);
3272 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3273 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3274 g_GUI_AddWindow(Menu
);
3276 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3277 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3278 g_GUI_AddWindow(Menu
);
3280 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3281 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3283 Name
:= 'mmGameCustomMenu';
3284 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3285 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3286 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3287 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3288 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3289 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3290 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3292 Menu
.DefControl
:= 'mmGameCustomMenu';
3293 Menu
.MainWindow
:= True;
3294 Menu
.OnClose
:= ProcGMClose
;
3295 Menu
.OnShow
:= ProcGMShow
;
3296 g_GUI_AddWindow(Menu
);
3298 Menu
:= TGUIWindow
.Create('GameServerMenu');
3299 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3301 Name
:= 'mmGameServerMenu';
3302 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3303 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3304 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3305 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3306 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3308 Menu
.DefControl
:= 'mmGameServerMenu';
3309 Menu
.MainWindow
:= True;
3310 Menu
.OnClose
:= ProcGMClose
;
3311 Menu
.OnShow
:= ProcGMShow
;
3312 g_GUI_AddWindow(Menu
);
3314 Menu
:= TGUIWindow
.Create('GameClientMenu');
3315 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3317 Name
:= 'mmGameClientMenu';
3318 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3319 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3320 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3322 Menu
.DefControl
:= 'mmGameClientMenu';
3323 Menu
.MainWindow
:= True;
3324 Menu
.OnClose
:= ProcGMClose
;
3325 Menu
.OnShow
:= ProcGMShow
;
3326 g_GUI_AddWindow(Menu
);
3328 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3329 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3331 Name
:= 'mClientPasswordMenu';
3332 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3340 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3343 Menu
.DefControl
:= 'mClientPasswordMenu';
3344 g_GUI_AddWindow(Menu
);
3346 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3347 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3349 Name
:= 'mGameSetGameMenu';
3350 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3352 Name
:= 'swTeamDamage';
3353 AddItem(_lc
[I_MENU_YES
]);
3354 AddItem(_lc
[I_MENU_NO
]);
3357 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3359 Name
:= 'swTeamHit';
3360 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3361 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3362 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3363 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3366 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3368 Name
:= 'swDeathmatchKeys';
3369 AddItem(_lc
[I_MENU_YES
]);
3370 AddItem(_lc
[I_MENU_NO
]);
3373 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3375 Name
:= 'edTimeLimit';
3380 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3382 Name
:= 'edGoalLimit';
3387 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3389 Name
:= 'edMaxLives';
3394 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3397 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3398 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3399 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3405 Menu
.DefControl
:= 'mGameSetGameMenu';
3406 Menu
.OnClose
:= ProcApplyGameSet
;
3407 g_GUI_AddWindow(Menu
);
3409 Menu
:= TGUIWindow
.Create('TeamMenu');
3410 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3412 Name
:= 'mmTeamMenu';
3413 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3414 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3415 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3416 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3417 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3419 Menu
.DefControl
:= 'mmTeamMenu';
3420 Menu
.OnShow
:= ProcChangePlayers
;
3421 g_GUI_AddWindow(Menu
);
3424 procedure g_Menu_Show_SaveMenu();
3426 if g_Game_IsTestMap
then
3428 if gGameSettings
.GameType
= GT_SINGLE
then
3429 g_GUI_ShowWindow('GameSingleMenu')
3432 if g_Game_IsClient
then
3435 if g_Game_IsNet
then
3438 g_GUI_ShowWindow('GameCustomMenu');
3440 g_GUI_ShowWindow('SaveMenu');
3441 g_Sound_PlayEx('MENU_OPEN');
3444 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3446 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3447 if gGameSettings
.GameType
= GT_SINGLE
then
3449 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3453 if g_Game_IsClient
then exit
;
3454 if g_Game_IsNet
then exit
;
3455 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3457 g_GUI_ShowWindow('LoadMenu');
3458 g_Sound_PlayEx('MENU_OPEN');
3461 procedure g_Menu_Show_GameSetGame();
3463 if gGameSettings
.GameType
= GT_SINGLE
then
3464 g_GUI_ShowWindow('GameSingleMenu')
3467 if g_Game_IsClient
then
3470 if g_Game_IsNet
then
3471 g_GUI_ShowWindow('GameServerMenu')
3473 g_GUI_ShowWindow('GameCustomMenu');
3476 g_GUI_ShowWindow('GameSetGameMenu');
3477 g_Sound_PlayEx('MENU_OPEN');
3480 procedure g_Menu_Show_OptionsVideo();
3482 if gGameSettings
.GameType
= GT_SINGLE
then
3483 g_GUI_ShowWindow('GameSingleMenu')
3486 if g_Game_IsClient
then
3487 g_GUI_ShowWindow('GameClientMenu')
3489 if g_Game_IsNet
then
3490 g_GUI_ShowWindow('GameServerMenu')
3492 g_GUI_ShowWindow('GameCustomMenu');
3495 g_GUI_ShowWindow('OptionsMenu');
3496 g_GUI_ShowWindow('OptionsVideoMenu');
3497 g_Sound_PlayEx('MENU_OPEN');
3500 procedure g_Menu_Show_OptionsSound();
3502 if gGameSettings
.GameType
= GT_SINGLE
then
3503 g_GUI_ShowWindow('GameSingleMenu')
3506 if g_Game_IsClient
then
3507 g_GUI_ShowWindow('GameClientMenu')
3509 if g_Game_IsNet
then
3510 g_GUI_ShowWindow('GameServerMenu')
3512 g_GUI_ShowWindow('GameCustomMenu');
3515 g_GUI_ShowWindow('OptionsMenu');
3516 g_GUI_ShowWindow('OptionsSoundMenu');
3517 g_Sound_PlayEx('MENU_OPEN');
3520 procedure g_Menu_Show_EndGameMenu();
3522 g_GUI_ShowWindow('EndGameMenu');
3523 g_Sound_PlayEx('MENU_OPEN');
3526 procedure g_Menu_Show_QuitGameMenu();
3528 g_GUI_ShowWindow('ExitMenu');
3529 g_Sound_PlayEx('MENU_OPEN');
3532 procedure g_Menu_Init();
3539 procedure g_Menu_Free();
3543 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3548 procedure g_Menu_Reset();
3552 g_GUI_SaveMenuPos();
3553 ex
:= g_GUI_Destroy();
3557 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3562 g_Game_SetDebugMode();
3564 g_GUI_LoadMenuPos();