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;
45 {$INCLUDE ../nogl/noGLuses.inc}
46 g_gui
, g_textures
, e_graphics
, g_main
, g_window
, g_game
, g_map
,
47 g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
, g_weapons
,
48 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
49 MAPDEF
, Math
, g_saveload
,
50 e_texture
, g_language
, e_res
,
51 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
, g_touch
,
52 utils
, wadreader
, g_system
;
55 type TYNCallback
= procedure (yes
:Boolean);
57 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
59 if win
.UserData
= nil then exit
;
61 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
62 IK_N
: TYNCallback(win
.UserData
)(false);
66 procedure YesButtonCB (ctl
: TGUITextButton
);
68 if ctl
.UserData
= nil then exit
;
69 TYNCallback(ctl
.UserData
)(true);
72 procedure NoButtonCB (ctl
: TGUITextButton
);
74 if ctl
.UserData
= nil then exit
;
75 TYNCallback(ctl
.UserData
)(false);
78 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
82 //if length(Text) = 0 then exit;
83 Result
:= TGUIWindow
.Create(WinName
);
86 //OnKeyDownEx := @YNKeyDownProc;
87 //UserData := @ActionProc;
88 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
91 Name
:= '__temp_yes_no_menu:'+WinName
;
93 AddText(Text, MaxLen
);
94 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
95 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
97 DefControl
:= '__temp_yes_no_menu:'+WinName
;
103 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
104 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
106 procedure ProcApplyOptions();
113 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
115 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
121 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
122 if (ovs
<> gVSync
) then
123 sys_EnableVSync(gVSync
);
125 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
126 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
128 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
130 g_Sound_SetupAllVolumes(
131 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
132 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
135 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
136 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
137 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
138 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
139 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
141 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
143 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
144 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
145 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
146 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
148 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
153 else gGibsCount
:= 48;
156 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
157 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
158 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
159 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
160 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
161 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
162 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
163 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
164 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
165 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
166 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
167 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
169 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
170 g_dbg_scale
:= TempScale
+ 1;
173 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
177 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
178 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
179 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
180 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
181 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
182 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
183 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
184 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
187 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
190 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
191 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
193 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
194 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
195 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
196 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
197 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
198 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
199 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
200 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
203 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
204 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
205 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
206 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext', '-p1_weapnext');
207 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev', '-p1_weapprev');
208 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
209 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
211 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
212 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
213 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
214 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
215 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
216 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
217 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
218 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
219 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
220 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
224 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext', '-p1_weapnext');
228 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev', '-p1_weapprev');
229 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
230 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
233 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
236 for i
:= WP_FIRST
to WP_LAST
do
238 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
239 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
240 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
241 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
245 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
248 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
249 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
250 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
251 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
252 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
253 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
254 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
255 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
256 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
257 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
258 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
259 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
260 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
261 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
262 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
263 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
264 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p2_weapnext', '-p2_weapnext');
265 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev', '-p2_weapprev');
266 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
267 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
269 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
270 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
271 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
272 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
273 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
274 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
275 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
276 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
277 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
278 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
279 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
282 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
283 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
284 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
285 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext', '-p2_weapnext');
286 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev', '-p2_weapprev');
287 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
288 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
291 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
294 for i
:= WP_FIRST
to WP_LAST
do
296 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
297 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
298 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
299 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
303 if e_HasJoysticks
then
305 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
308 for i
:= 0 to e_MaxJoys
- 1 do
309 if e_JoystickAvailable
[i
] then
310 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
314 if g_touch_enabled
then
316 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
317 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
318 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
319 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
320 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
323 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
325 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
326 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
327 TEAM_RED
, TEAM_BLUE
);
329 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
331 gPlayer1Settings
.Model
:= Model
.Name
;
332 gPlayer1Settings
.Color
:= Model
.Color
;
335 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
337 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
338 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
339 TEAM_RED
, TEAM_BLUE
);
340 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
342 gPlayer2Settings
.Model
:= Model
.Name
;
343 gPlayer2Settings
.Color
:= Model
.Color
;
346 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
347 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
349 if g_Game_IsServer
then
351 if gPlayer1
<> nil then
353 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
354 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
355 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
356 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
358 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
361 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
364 if gPlayer2
<> nil then
366 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
367 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
368 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
369 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
371 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
376 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
378 s
:= e_GetWriteableDir(ConfigDirs
);
380 g_Options_Write(s
+ '/' + CONFIG_FILENAME
);
381 g_Console_WriteGameConfig
;
384 procedure ReadOptions();
389 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
391 with TGUISwitch(menu
.GetControl('swBPP')) do
397 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
398 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
400 with TGUISwitch(menu
.GetControl('swVSync')) do
401 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
403 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
404 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
406 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
408 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
409 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
410 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
412 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
413 if gMuteWhenInactive
then
418 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
420 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
421 if gSoundEffectsDF
then
426 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
427 if gUseChatSounds
then
432 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
435 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
436 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
437 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
438 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
439 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
440 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
441 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
442 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
443 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
446 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
447 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
448 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
449 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
450 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
451 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
452 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
453 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
454 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
455 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
458 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
461 for i
:= WP_FIRST
to WP_LAST
do
463 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
464 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
468 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
471 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
472 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
473 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
474 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
476 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
477 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
478 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
482 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
488 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
489 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
490 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
491 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
494 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
497 for i
:= WP_FIRST
to WP_LAST
do
499 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
500 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
504 if e_HasJoysticks
then
506 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
509 for i
:= 0 to e_MaxJoys
- 1 do
510 if e_JoystickAvailable
[i
] then
511 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
515 if g_touch_enabled
then
517 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
518 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
519 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
520 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
521 with TGUISwitch(menu
.GetControl('swTouchFire')) do
522 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
523 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
526 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
529 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
530 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
531 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
532 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
535 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
537 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
538 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
539 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
540 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
541 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
543 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
546 with TGUISwitch(menu
.GetControl('swBloodType')) do
547 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
549 with TGUISwitch(menu
.GetControl('swCorpseType')) do
550 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
552 with TGUISwitch(menu
.GetControl('swGibsType')) do
553 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
555 with TGUISwitch(menu
.GetControl('swGibsCount')) do
564 with TGUISwitch(menu
.GetControl('swBackGround')) do
565 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
567 with TGUISwitch(menu
.GetControl('swMessages')) do
568 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
570 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
571 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
573 with TGUISwitch(menu
.GetControl('swChatBubble')) do
574 ItemIndex
:= gChatBubble
;
576 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
577 ItemIndex
:= gPlayerIndicator
;
579 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
580 ItemIndex
:= gPlayerIndicatorStyle
;
582 TempScale
:= Round(g_dbg_scale
- 1);
583 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
585 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
587 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
588 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
590 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
591 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
593 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
594 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
595 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
597 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
599 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
600 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
602 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
603 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
605 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
606 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
607 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
609 ProcSelectModel(nil);
612 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
614 // don't turn off monsters in DM
616 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
617 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
618 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
620 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
623 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
624 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
625 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
626 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
630 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
632 // don't turn off monsters in DM
634 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
635 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
636 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
638 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
641 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
642 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
643 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
644 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
648 procedure ProcStartCustomGame();
655 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
657 Map
:= TGUILabel(GetControl('lbMap')).Text;
660 if not isWadPath(Map
) then
663 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
664 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
665 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
666 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
667 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
669 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
670 gcRespawnItems
:= TGUISwitch(GetControl('swRespawnItems')).ItemIndex
= 0;
671 gcDeathmatchKeys
:= TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0;
672 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
673 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
674 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
677 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
678 if gcRespawnItems
then
679 Options
:= Options
or GAME_OPTION_RESPAWNITEMS
;
680 if gcDeathmatchKeys
then
681 Options
:= Options
or GAME_OPTION_DMKEYS
;
683 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
685 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
687 Options
:= Options
or GAME_OPTION_MONSTERS
;
688 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
690 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
692 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
693 gcBotsVS
:= 'Monsters';
696 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
697 gcBotsVS
:= 'Everybody';
700 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
701 gcBotsVS
:= 'Players';
708 s
:= e_GetWriteableDir(ConfigDirs
);
710 g_Options_Write_Gameplay_Custom(s
+ '/' + CONFIG_FILENAME
);
712 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
713 gcMaxLives
, Options
, gcPlayers
);
717 procedure ProcStartNetGame();
724 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
726 Map
:= TGUILabel(GetControl('lbMap')).Text;
729 if not isWadPath(Map
) then
732 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
733 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
734 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
735 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
736 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
737 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
739 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
740 gnRespawnItems
:= TGUISwitch(GetControl('swRespawnItems')).ItemIndex
= 0;
741 gnDeathmatchKeys
:= TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0;
742 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
743 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
744 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
747 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
748 if gnRespawnItems
then
749 Options
:= Options
or GAME_OPTION_RESPAWNITEMS
;
750 if gnDeathmatchKeys
then
751 Options
:= Options
or GAME_OPTION_DMKEYS
;
753 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
755 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
757 Options
:= Options
or GAME_OPTION_MONSTERS
;
758 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
760 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
762 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
763 gnBotsVS
:= 'Monsters';
766 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
767 gnBotsVS
:= 'Everybody';
770 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
771 gnBotsVS
:= 'Players';
776 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
777 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
778 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
779 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
780 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
783 s
:= e_GetWriteableDir(ConfigDirs
);
786 g_Options_Write_Net_Server(s
+ '/' + CONFIG_FILENAME
);
787 g_Options_Write_Gameplay_Net(s
+ '/' + CONFIG_FILENAME
)
790 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
791 Options
, gnPlayers
, 0, NetPort
);
794 procedure ProcConnectNetGame();
799 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
801 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
802 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
803 PW
:= TGUIEdit(GetControl('edPW')).Text;
806 s
:= e_GetWriteableDir(ConfigDirs
);
808 g_Options_Write_Net_Client(s
+ '/' + CONFIG_FILENAME
);
809 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
812 procedure ProcEnterPassword();
817 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
819 NetClientIP
:= PromptIP
;
820 NetClientPort
:= PromptPort
;
821 PW
:= TGUIEdit(GetControl('edPW')).Text;
824 s
:= e_GetWriteableDir(ConfigDirs
);
826 g_Options_Write_Net_Client(s
+ '/' + CONFIG_FILENAME
);
827 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
830 procedure ProcServerlist();
832 if not NetInitDone
then
834 if (not g_Net_Init()) then
836 g_Console_Add('NET: ERROR: Failed to init ENet!');
843 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
, NetSlistList
);
845 gState
:= STATE_SLIST
;
846 g_ActiveWindow
:= nil;
848 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
853 slReturnPressed
:= True;
854 if g_Net_Slist_Fetch(slCurrent
) then
856 if slCurrent
= nil then
857 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
860 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
861 g_Serverlist_GenerateTable(slCurrent
, slTable
);
864 procedure ProcStartCampaign();
870 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
872 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
873 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
875 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
881 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
884 procedure ProcSelectMap(Sender
: TGUIControl
);
888 wad
, map
, res
: String;
890 win
:= g_GUI_GetWindow('SelectMapMenu');
891 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
893 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
894 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
896 if (wad
= '') or (map
= '') then
897 begin // Ýòî íå êàðòà
898 TGUILabel(GetControl('lbMapName')).Text := '';
899 TGUILabel(GetControl('lbMapAuthor')).Text := '';
900 TGUILabel(GetControl('lbMapSize')).Text := '';
901 TGUIMemo(GetControl('meMapDescription')).SetText('');
902 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
903 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
909 a
:= g_Map_GetMapInfo(res
);
911 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
912 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
913 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
914 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
915 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
916 TGUILabel(win
.GetControl('lbMapScale')).Text :=
917 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
922 procedure ProcSelectWAD(Sender
: TGUIControl
);
927 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
929 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
931 with TGUIListBox(GetControl('lsMapRes')) do
937 list
:= g_Map_GetMapsList(wad
);
951 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
957 win
:= g_GUI_GetWindow('CampaignMenu');
958 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
960 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
964 TGUILabel(GetControl('lbWADName')).Text := '';
965 TGUILabel(GetControl('lbWADAuthor')).Text := '';
966 TGUIMemo(GetControl('meWADDescription')).SetText('');
969 a
:= g_Game_GetMegaWADInfo(wad
);
971 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
972 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
973 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
975 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
979 fn
:= g_ExtractWadName(a
.pic
);
981 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
983 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
988 procedure ProcChangeColor(Sender
: TGUIControl
);
992 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
993 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
994 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
995 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
996 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
997 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
999 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1000 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
1001 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
1002 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
1003 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
1004 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
1007 procedure ProcSelectModel(Sender
: TGUIControl
);
1012 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1013 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
1014 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
1016 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1017 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
1018 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
1020 ProcChangeColor(nil);
1023 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
1035 wad
:= TWADFile
.Create
;
1036 if wad
.ReadFile(GameWAD
) then
1037 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
1042 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
1044 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1045 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1046 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1047 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1049 if g_Texture_Get('FONT_STD', ID
) then
1050 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
1055 if cfglen
<> 0 then FreeMem(cfgdata
);
1058 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
1064 cfgdata
, fntdata
: Pointer;
1065 cfglen
, fntlen
: Integer;
1073 wad
:= TWADFile
.Create
;
1074 if wad
.ReadFile(GameWAD
) then
1076 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1077 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1083 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1084 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1085 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1087 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1088 FontID
:= e_CharFont_Create(spc
);
1090 for a
:= 0 to 255 do
1092 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1093 if chrwidth
= 0 then Continue
;
1095 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1097 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1103 if cfglen
<> 0 then FreeMem(cfgdata
);
1104 if fntlen
<> 0 then FreeMem(fntdata
);
1107 procedure MenuLoadData();
1109 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1111 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1112 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1113 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1114 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1115 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1116 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1117 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1118 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1119 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1120 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1121 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1122 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1123 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1124 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1125 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1126 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1127 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1128 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1129 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1130 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1131 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1132 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1133 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1134 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1135 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1137 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1138 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1139 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1140 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1141 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1142 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1143 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1146 procedure MenuFreeData();
1148 e_CharFont_Remove(gMenuFont
);
1149 e_CharFont_Remove(gMenuSmallFont
);
1151 g_Texture_Delete('MAINMENU_LOGO');
1152 g_Texture_Delete('MAINMENU_MARKER1');
1153 g_Texture_Delete('MAINMENU_MARKER2');
1154 g_Texture_Delete('SCROLL_LEFT');
1155 g_Texture_Delete('SCROLL_RIGHT');
1156 g_Texture_Delete('SCROLL_MIDDLE');
1157 g_Texture_Delete('SCROLL_MARKER');
1158 g_Texture_Delete('EDIT_LEFT');
1159 g_Texture_Delete('EDIT_RIGHT');
1160 g_Texture_Delete('EDIT_MIDDLE');
1161 g_Texture_Delete('BOX1');
1162 g_Texture_Delete('BOX2');
1163 g_Texture_Delete('BOX3');
1164 g_Texture_Delete('BOX4');
1165 g_Texture_Delete('BOX5');
1166 g_Texture_Delete('BOX6');
1167 g_Texture_Delete('BOX7');
1168 g_Texture_Delete('BOX8');
1169 g_Texture_Delete('BOX9');
1170 g_Texture_Delete('BSCROLL_UP_A');
1171 g_Texture_Delete('BSCROLL_UP_U');
1172 g_Texture_Delete('BSCROLL_DOWN_A');
1173 g_Texture_Delete('BSCROLL_DOWN_U');
1174 g_Texture_Delete('BSCROLL_MIDDLE');
1175 g_Texture_Delete('NOPIC');
1177 g_Sound_Delete('MENU_SELECT');
1178 g_Sound_Delete('MENU_OPEN');
1179 g_Sound_Delete('MENU_CLOSE');
1180 g_Sound_Delete('MENU_CHANGE');
1181 g_Sound_Delete('SCROLL_ADD');
1182 g_Sound_Delete('SCROLL_SUB');
1183 g_Sound_Delete('SOUND_PLAYER_FALL');
1186 procedure ProcAuthorsMenu();
1188 gMusic
.SetByName('MUSIC_INTERMUS');
1192 procedure ProcExitMenuKeyDown (yes
: Boolean);
1195 snd
: TPlayableSound
;
1200 g_Game_StopAllSounds(True);
1201 case (Random(18)) of
1202 0: s
:= 'SOUND_MONSTER_PAIN';
1203 1: s
:= 'SOUND_MONSTER_DIE_3';
1204 2: s
:= 'SOUND_MONSTER_SLOP';
1205 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1206 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1207 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1208 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1209 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1210 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1211 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1212 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1213 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1214 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1215 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1216 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1217 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1218 else s
:= 'SOUND_PLAYER_FALL';
1220 snd
:= TPlayableSound
.Create();
1221 res
:= snd
.SetByName(s
);
1222 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1226 while snd
.IsPlaying() do begin end;
1234 procedure ProcLoadMenu();
1241 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1242 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1243 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1247 procedure ProcSaveMenu();
1255 name
:= g_GetSaveName(a
, valid
);
1256 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1257 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1261 procedure ProcSaveGame(Sender
: TGUIControl
);
1265 if g_Game_IsNet
then Exit
;
1266 if g_Game_IsTestMap
then Exit
;
1267 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1268 g_Game_PauseAllSounds(True);
1269 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1271 g_ActiveWindow
:= nil;
1272 g_Game_Pause(False);
1275 procedure ProcLoadGame(Sender
: TGUIControl
);
1279 if g_Game_IsNet
then Exit
;
1280 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1281 if g_LoadGame(a
) then
1283 g_Game_PauseAllSounds(False)
1285 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1287 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1288 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1289 //g_ActiveWindow := nil;
1293 procedure ProcSinglePlayer (n
: Integer);
1294 var wad
, map
: AnsiString;
1297 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1298 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1299 if e_FindResource(AllMapDirs
, wad
) then
1301 wad
:= ExpandFileName(wad
);
1302 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1306 procedure ProcSingle1Player
;
1311 procedure ProcSingle2Players
;
1316 procedure ProcSelectMapMenu();
1319 wad_lb
: TGUIFileListBox
;
1320 map_lb
: TGUIListBox
;
1323 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1324 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1325 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1327 if wad_lb
.SelectedItem() <> '' then
1328 map
:= map_lb
.SelectedItem()
1332 wad_lb
.UpdateFileList();
1335 if wad_lb
.SelectedItem() <> '' then
1338 map_lb
.SelectItem(map
);
1340 if map_lb
.SelectedItem() <> '' then
1344 g_GUI_ShowWindow('SelectMapMenu');
1347 procedure ProcSelectCampaignMenu();
1350 wad_lb
: TGUIFileListBox
;
1352 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1353 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1355 wad_lb
.UpdateFileList();
1357 if wad_lb
.SelectedItem() <> '' then
1358 ProcSelectCampaignWAD(nil);
1361 procedure ProcSetMap();
1363 wad
, map
, res
: String;
1365 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1367 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1368 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1371 if (wad
= '') or (map
= '') then
1374 wad
:= e_FindWadRel(MapDirs
, WAD
);
1376 res
:= wad
+':\'+map
;
1378 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1379 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1382 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1386 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1388 g_Sound_SetupAllVolumes(
1389 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1390 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1394 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1398 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1399 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1401 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1402 g_dbg_scale
:= TempScale
+ 1;
1406 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1410 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1411 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1412 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1413 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1416 procedure ProcOptionsPlayersMIMenu();
1421 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1423 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1425 if a
= '' then Exit
;
1427 b
:= g_PlayerModel_GetInfo(a
);
1429 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1431 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1432 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1433 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1435 if b
.HaveWeapon
then
1436 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1438 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1441 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1444 procedure ProcOptionsPlayersAnim();
1448 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1453 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1456 Model
.GetCurrentAnimation
.Loop
:= True;
1457 Model
.GetCurrentAnimationMask
.Loop
:= True;
1461 procedure ProcOptionsPlayersWeap();
1465 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1470 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1474 procedure ProcOptionsPlayersRot();
1478 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1479 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1481 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1485 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1489 g_Options_SetDefault();
1495 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1497 if yes
then ReadOptions();
1501 procedure ProcAuthorsClose();
1503 gMusic
.SetByName('MUSIC_MENU');
1505 gState
:= STATE_MENU
;
1508 procedure ProcGMClose();
1510 g_Game_InGameMenu(False);
1513 procedure ProcGMShow();
1518 if (gGameSettings
.GameType
= GT_SINGLE
) and
1519 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1520 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1521 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1523 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1524 if g_Game_IsTestMap
then
1525 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1526 TGUIMainMenu(g_ActiveWindow
.GetControl(
1527 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1530 procedure ProcChangePlayers();
1532 TeamGame
, Spectator
, AddTwo
: Boolean;
1533 P1Team
{, P2Team}: Byte;
1534 bP2
: TGUITextButton
;
1536 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1537 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1538 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1539 P1Team
:= TEAM_NONE
;
1540 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1542 //P2Team := TEAM_NONE;
1543 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1545 TGUIMainMenu(g_ActiveWindow
.GetControl(
1546 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1547 TGUIMainMenu(g_ActiveWindow
.GetControl(
1548 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1549 TGUIMainMenu(g_ActiveWindow
.GetControl(
1550 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1552 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1553 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1554 bP2
.Enabled
:= AddTwo
and not Spectator
;
1556 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1558 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1559 if gPlayer2
= nil then
1560 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1562 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1564 TGUIMainMenu(g_ActiveWindow
.GetControl(
1565 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1568 procedure ProcJoinRed();
1570 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1572 if g_Game_IsServer
then
1574 if gPlayer1
= nil then
1575 g_Game_AddPlayer(TEAM_RED
)
1578 if gPlayer1
.Team
<> TEAM_RED
then
1580 gPlayer1
.SwitchTeam
;
1581 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1584 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1589 gPlayer1Settings
.Team
:= TEAM_RED
;
1590 MC_SEND_PlayerSettings
;
1591 if gPlayer1
= nil then
1592 g_Game_AddPlayer(TEAM_RED
);
1594 g_ActiveWindow
:= nil;
1595 g_Game_Pause(False);
1598 procedure ProcJoinBlue();
1600 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1602 if g_Game_IsServer
then
1604 if gPlayer1
= nil then
1605 g_Game_AddPlayer(TEAM_BLUE
)
1608 if gPlayer1
.Team
<> TEAM_BLUE
then
1610 gPlayer1
.SwitchTeam
;
1611 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1614 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1619 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1620 MC_SEND_PlayerSettings
;
1621 if gPlayer1
= nil then
1622 g_Game_AddPlayer(TEAM_BLUE
);
1624 g_ActiveWindow
:= nil;
1625 g_Game_Pause(False);
1628 procedure ProcJoinGame();
1630 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1632 if gPlayer1
= nil then
1634 g_ActiveWindow
:= nil;
1635 g_Game_Pause(False);
1638 procedure ProcSwitchP2();
1640 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1642 if gPlayer1
= nil then
1644 if gPlayer2
= nil then
1647 g_Game_RemovePlayer();
1648 g_ActiveWindow
:= nil;
1649 g_Game_Pause(False);
1652 procedure ProcSpectate();
1654 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1657 g_ActiveWindow
:= nil;
1658 g_Game_Pause(False);
1661 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1663 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1666 procedure ProcEndMenuKeyDown (yes
: Boolean);
1668 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1671 procedure ProcSetRussianLanguage
;
1673 if gLanguage
<> LANGUAGE_RUSSIAN
then
1675 gLanguage
:= LANGUAGE_RUSSIAN
;
1676 gLanguageChange
:= True;
1677 gAskLanguage
:= False;
1682 procedure ProcSetEnglishLanguage
;
1684 if gLanguage
<> LANGUAGE_ENGLISH
then
1686 gLanguage
:= LANGUAGE_ENGLISH
;
1687 gLanguageChange
:= True;
1688 gAskLanguage
:= False;
1693 procedure ReadGameSettings();
1697 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1699 with gGameSettings
do
1701 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1702 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1706 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1707 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1712 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1713 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1714 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1716 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1717 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1718 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1721 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1726 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1728 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1729 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]);
1730 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1731 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1732 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1733 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1734 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1735 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1736 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1740 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1741 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1742 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1747 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1748 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1753 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1754 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1759 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1760 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1765 procedure ProcApplyGameSet();
1769 stat
: TPlayerStatArray
;
1771 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1773 if not g_Game_IsServer
then Exit
;
1775 with gGameSettings
do
1777 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1779 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1780 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1782 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1785 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1787 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1788 Options
:= Options
or GAME_OPTION_DMKEYS
1790 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1793 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1795 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1801 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1803 TimeLimit
:= Max(n
, b
);
1807 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1809 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1816 if GameMode
= GM_DM
then
1818 stat
:= g_Player_GetStats();
1820 for a
:= 0 to High(stat
) do
1821 if stat
[a
].Frags
> b
then
1825 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1827 GoalLimit
:= Max(n
, b
);
1831 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1833 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1834 if n
< 0 then n
:= 0;
1835 if n
> 255 then n
:= 255;
1841 stat
:= g_Player_GetStats();
1843 for a
:= 0 to High(stat
) do
1844 if stat
[a
].Lives
> b
then
1847 MaxLives
:= Max(n
, b
);
1851 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1853 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1856 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1857 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1861 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1862 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1866 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1867 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1873 if g_Game_IsNet
then MH_SEND_GameSettings
;
1876 procedure ProcVideoOptionsRes();
1881 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1883 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1884 IntToStr(gScreenWidth
) +
1885 ' x ' + IntToStr(gScreenHeight
) +
1886 ', ' + IntToStr(gBPP
) + ' bpp';
1888 with TGUIListBox(menu
.GetControl('lsResolution')) do
1890 list
:= sys_GetDisplayModes(gBPP
);
1894 ItemIndex
:= Length(list
)
1902 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1909 procedure ProcApplyVideoOptions();
1912 Fullscreen
: Boolean;
1913 SWidth
, SHeight
: Integer;
1916 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1918 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1919 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1921 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1923 if (SWidth
<> gScreenWidth
) or
1924 (SHeight
<> gScreenHeight
) or
1925 (Fullscreen
<> gFullscreen
) then
1927 gResolutionChange
:= True;
1928 gRC_Width
:= SWidth
;
1929 gRC_Height
:= SHeight
;
1930 gRC_FullScreen
:= Fullscreen
;
1931 gRC_Maximized
:= gWinMaximized
;
1934 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1938 procedure ProcSetFirstRussianLanguage
;
1940 gLanguage
:= LANGUAGE_RUSSIAN
;
1941 gLanguageChange
:= True;
1942 gAskLanguage
:= False;
1945 procedure ProcSetFirstEnglishLanguage
;
1947 gLanguage
:= LANGUAGE_ENGLISH
;
1948 gLanguageChange
:= True;
1949 gAskLanguage
:= False;
1952 procedure ProcRecallAddress();
1954 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1956 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1957 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1961 procedure CreateFirstLanguageMenu();
1965 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1967 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1969 Name
:= 'mmFirstLanguageMenu';
1970 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1971 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1974 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1975 Menu
.MainWindow
:= True;
1976 g_GUI_AddWindow(Menu
);
1979 procedure g_Menu_AskLanguage();
1981 CreateFirstLanguageMenu();
1982 g_GUI_ShowWindow('FirstLanguageMenu');
1985 procedure CreatePlayerOptionsMenu(s
: String);
1990 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1992 a
:= _lc
[I_MENU_PLAYER_1
]
1994 a
:= _lc
[I_MENU_PLAYER_2
];
1995 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1997 Name
:= 'mOptionsPlayers'+s
+'Menu';
1998 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
2000 Name
:= 'ed'+s
+'Name';
2004 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
2006 Name
:= 'sw'+s
+'Team';
2007 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
2008 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2010 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2012 Name
:= 'ls'+s
+'Model';
2014 Items
:= g_PlayerModel_GetNames();
2015 OnChange
:= ProcSelectModel
;
2017 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2019 Name
:= 'sc'+s
+'Red';
2021 OnChange
:= ProcChangeColor
;
2023 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2025 Name
:= 'sc'+s
+'Green';
2027 OnChange
:= ProcChangeColor
;
2029 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2031 Name
:= 'sc'+s
+'Blue';
2033 OnChange
:= ProcChangeColor
;
2036 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2037 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2038 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2039 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2041 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2043 Name
:= 'mv'+s
+'Model';
2044 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2045 Y
:= GetControl('ls'+s
+'Model').Y
;
2048 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2049 g_GUI_AddWindow(Menu
);
2052 procedure CreateAllMenus();
2056 a
, cx
, _y
, i
: Integer;
2059 Menu
:= TGUIWindow
.Create('MainMenu');
2060 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2062 Name
:= 'mmMainMenu';
2063 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2064 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2065 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2066 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2067 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2068 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2070 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2072 Color
:= _RGB(255, 255, 255);
2073 X
:= gScreenWidth
-GetWidth
-8;
2074 Y
:= gScreenHeight
-GetHeight
-8;
2076 Menu
.DefControl
:= 'mmMainMenu';
2077 Menu
.MainWindow
:= True;
2078 g_GUI_AddWindow(Menu
);
2080 Menu
:= TGUIWindow
.Create('NewGameMenu');
2081 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2083 Name
:= 'mmNewGameMenu';
2084 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2085 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2086 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2087 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2089 Menu
.DefControl
:= 'mmNewGameMenu';
2090 g_GUI_AddWindow(Menu
);
2092 Menu
:= TGUIWindow
.Create('NetGameMenu');
2093 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2095 Name
:= 'mmNetGameMenu';
2096 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2097 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2099 Menu
.DefControl
:= 'mmNetGameMenu';
2100 g_GUI_AddWindow(Menu
);
2102 Menu
:= TGUIWindow
.Create('NetServerMenu');
2103 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2105 Name
:= 'mNetServerMenu';
2106 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2108 Name
:= 'edSrvName';
2109 OnlyDigits
:= False;
2112 Text := NetServerName
;
2114 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2116 Name
:= 'edSrvPassword';
2117 OnlyDigits
:= False;
2120 Text := NetPassword
;
2122 with AddEdit(_lc
[I_NET_PORT
]) do
2128 Text := IntToStr(NetPort
);
2130 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2132 Name
:= 'edMaxPlayers';
2136 Text := IntToStr(NetMaxClients
);
2138 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2140 Name
:= 'swUseMaster';
2141 AddItem(_lc
[I_MENU_YES
]);
2142 AddItem(_lc
[I_MENU_NO
]);
2143 if NetUseMaster
then
2149 with AddLabel(_lc
[I_MENU_MAP
]) do
2154 OnClick
:= @ProcSelectMapMenu
;
2156 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2158 Name
:= 'swGameMode';
2159 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2160 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2161 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2162 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2163 case g_Game_TextToMode(gnGameMode
) of
2165 GM_DM
: ItemIndex
:= 0;
2166 GM_TDM
: ItemIndex
:= 1;
2167 GM_CTF
: ItemIndex
:= 2;
2169 GM_COOP
: ItemIndex
:= 3;
2171 OnChange
:= ProcSwitchMonstersNet
;
2173 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2175 Name
:= 'edTimeLimit';
2179 if gnTimeLimit
> 0 then
2180 Text := IntToStr(gnTimeLimit
);
2182 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2184 Name
:= 'edGoalLimit';
2188 if gnGoalLimit
> 0 then
2189 Text := IntToStr(gnGoalLimit
);
2191 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2193 Name
:= 'edMaxLives';
2197 if gnMaxLives
> 0 then
2198 Text := IntToStr(gnMaxLives
);
2200 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2202 Name
:= 'swPlayers';
2203 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2204 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2205 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2206 ItemIndex
:= gnPlayers
;
2208 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2210 Name
:= 'swTeamDamage';
2211 AddItem(_lc
[I_MENU_YES
]);
2212 AddItem(_lc
[I_MENU_NO
]);
2213 if gnTeamDamage
then
2218 with AddSwitch(_lc
[I_MENU_RESPAWN_ITEMS
]) do
2220 Name
:= 'swRespawnItems';
2221 AddItem(_lc
[I_MENU_YES
]);
2222 AddItem(_lc
[I_MENU_NO
]);
2223 if gnRespawnItems
then
2228 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2230 Name
:= 'swDeathmatchKeys';
2231 AddItem(_lc
[I_MENU_YES
]);
2232 AddItem(_lc
[I_MENU_NO
]);
2233 if gnDeathmatchKeys
then
2238 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2240 Name
:= 'swEnableExits';
2241 AddItem(_lc
[I_MENU_YES
]);
2242 AddItem(_lc
[I_MENU_NO
]);
2248 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2250 Name
:= 'swWeaponStay';
2251 AddItem(_lc
[I_MENU_YES
]);
2252 AddItem(_lc
[I_MENU_NO
]);
2253 if gnWeaponStay
then
2258 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2260 Name
:= 'swMonsters';
2261 AddItem(_lc
[I_MENU_YES
]);
2262 AddItem(_lc
[I_MENU_NO
]);
2268 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2271 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2272 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2273 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2275 if gnBotsVS
= 'Players' then
2277 if gnBotsVS
= 'Monsters' then
2281 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2285 Menu
.DefControl
:= 'mNetServerMenu';
2286 g_GUI_AddWindow(Menu
);
2288 Menu
:= TGUIWindow
.Create('NetClientMenu');
2289 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2291 Name
:= 'mNetClientMenu';
2293 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2296 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2302 Text := 'localhost';
2304 with AddEdit(_lc
[I_NET_PORT
]) do
2312 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2315 OnlyDigits
:= False;
2322 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2326 Menu
.DefControl
:= 'mNetClientMenu';
2327 g_GUI_AddWindow(Menu
);
2329 Menu
:= TGUIWindow
.Create('LoadMenu');
2330 Menu
.OnShow
:= ProcLoadMenu
;
2331 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2333 Name
:= 'mmLoadMenu';
2338 Name
:= 'edSlot'+IntToStr(a
);
2341 OnEnter
:= ProcLoadGame
;
2344 Menu
.DefControl
:= 'mmLoadMenu';
2345 g_GUI_AddWindow(Menu
);
2347 Menu
:= TGUIWindow
.Create('SaveMenu');
2348 Menu
.OnShow
:= ProcSaveMenu
;
2349 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2351 Name
:= 'mmSaveMenu';
2356 Name
:= 'edSlot'+IntToStr(a
);
2359 OnChange
:= ProcSaveGame
;
2362 Menu
.DefControl
:= 'mmSaveMenu';
2363 g_GUI_AddWindow(Menu
);
2365 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2366 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2368 Name
:= 'mCustomGameMenu';
2369 with AddLabel(_lc
[I_MENU_MAP
]) do
2374 OnClick
:= @ProcSelectMapMenu
;
2376 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2378 Name
:= 'swGameMode';
2379 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2380 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2381 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2382 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2383 case g_Game_TextToMode(gcGameMode
) of
2385 GM_DM
: ItemIndex
:= 0;
2386 GM_TDM
: ItemIndex
:= 1;
2387 GM_CTF
: ItemIndex
:= 2;
2389 GM_COOP
: ItemIndex
:= 3;
2391 OnChange
:= ProcSwitchMonstersCustom
;
2393 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2395 Name
:= 'edTimeLimit';
2399 if gcTimeLimit
> 0 then
2400 Text := IntToStr(gcTimeLimit
);
2402 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2404 Name
:= 'edGoalLimit';
2408 if gcGoalLimit
> 0 then
2409 Text := IntToStr(gcGoalLimit
);
2411 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2413 Name
:= 'edMaxLives';
2417 if gcMaxLives
> 0 then
2418 Text := IntToStr(gcMaxLives
);
2420 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2422 Name
:= 'swPlayers';
2423 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2424 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2425 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2426 ItemIndex
:= gcPlayers
;
2428 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2430 Name
:= 'swTeamDamage';
2431 AddItem(_lc
[I_MENU_YES
]);
2432 AddItem(_lc
[I_MENU_NO
]);
2433 if gcTeamDamage
then
2438 with AddSwitch(_lc
[I_MENU_RESPAWN_ITEMS
]) do
2440 Name
:= 'swRespawnItems';
2441 AddItem(_lc
[I_MENU_YES
]);
2442 AddItem(_lc
[I_MENU_NO
]);
2443 if gcRespawnItems
then
2448 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2450 Name
:= 'swDeathmatchKeys';
2451 AddItem(_lc
[I_MENU_YES
]);
2452 AddItem(_lc
[I_MENU_NO
]);
2453 if gcDeathmatchKeys
then
2458 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2460 Name
:= 'swEnableExits';
2461 AddItem(_lc
[I_MENU_YES
]);
2462 AddItem(_lc
[I_MENU_NO
]);
2468 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2470 Name
:= 'swWeaponStay';
2471 AddItem(_lc
[I_MENU_YES
]);
2472 AddItem(_lc
[I_MENU_NO
]);
2473 if gcWeaponStay
then
2478 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2480 Name
:= 'swMonsters';
2481 AddItem(_lc
[I_MENU_YES
]);
2482 AddItem(_lc
[I_MENU_NO
]);
2488 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2491 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2492 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2493 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2495 if gcBotsVS
= 'Players' then
2497 if gcBotsVS
= 'Monsters' then
2501 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2505 Menu
.DefControl
:= 'mCustomGameMenu';
2506 g_GUI_AddWindow(Menu
);
2508 Menu
:= TGUIWindow
.Create('CampaignMenu');
2509 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2511 Name
:= 'mCampaignMenu';
2520 with AddFileList('', 15, 4) do
2523 OnChange
:= ProcSelectCampaignWAD
;
2527 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2528 SetBase(MegawadDirs
);
2531 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2533 Name
:= 'lbWADName';
2537 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2539 Name
:= 'lbWADAuthor';
2543 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2544 with AddMemo('', 15, 3) do
2546 Name
:= 'meWADDescription';
2547 Color
:= MENU_ITEMSCTRL_COLOR
;
2549 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2551 Name
:= 'swPlayers';
2552 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2553 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2556 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2560 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2562 Name
:= 'mpWADImage';
2563 DefaultRes
:= 'NOPIC';
2564 X
:= GetControl('lsWAD').X
+4;
2565 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2568 Menu
.DefControl
:= 'mCampaignMenu';
2569 g_GUI_AddWindow(Menu
);
2571 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2572 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2574 Name
:= 'mSelectMapMenu';
2575 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2578 OnChange
:= ProcSelectWAD
;
2582 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2585 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2589 OnChange
:= ProcSelectMap
;
2592 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2594 Name
:= 'lbMapName';
2598 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2600 Name
:= 'lbMapAuthor';
2604 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2606 Name
:= 'lbMapSize';
2610 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2612 Name
:= 'meMapDescription';
2617 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2619 Name
:= 'mpMapPreview';
2620 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2621 Y
:= GetControl('lsMapWAD').Y
;
2623 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2625 Name
:= 'lbMapScale';
2628 Color
:= MENU_ITEMSCTRL_COLOR
;
2629 X
:= GetControl('lsMapWAD').X
+
2630 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2631 2 + MAPPREVIEW_WIDTH
*4;
2632 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2635 Menu
.OnClose
:= ProcSetMap
;
2636 Menu
.DefControl
:= 'mSelectMapMenu';
2637 g_GUI_AddWindow(Menu
);
2639 Menu
:= TGUIWindow
.Create('OptionsMenu');
2640 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2642 Name
:= 'mmOptionsMenu';
2643 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2644 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2645 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2646 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2647 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2648 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2650 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2651 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2653 Menu
.OnClose
:= ProcApplyOptions
;
2654 Menu
.DefControl
:= 'mmOptionsMenu';
2655 g_GUI_AddWindow(Menu
);
2657 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2658 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2659 g_GUI_AddWindow(Menu
);
2661 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2662 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2664 Name
:= 'mOptionsVideoMenu';
2665 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2666 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2672 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2675 AddItem(_lc
[I_MENU_YES
]);
2676 AddItem(_lc
[I_MENU_NO
]);
2678 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2680 Name
:= 'swTextureFilter';
2681 AddItem(_lc
[I_MENU_YES
]);
2682 AddItem(_lc
[I_MENU_NO
]);
2684 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2686 Name
:= 'swLegacyNPOT';
2687 AddItem(_lc
[I_MENU_NO
]);
2688 AddItem(_lc
[I_MENU_YES
]);
2691 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2694 Menu
.DefControl
:= 'mOptionsVideoMenu';
2695 g_GUI_AddWindow(Menu
);
2697 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2698 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2700 Name
:= 'mOptionsVideoResMenu';
2701 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2703 Name
:= 'lbCurrentRes';
2707 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2709 Name
:= 'lsResolution';
2712 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2714 Name
:= 'swFullScreen';
2715 AddItem(_lc
[I_MENU_YES
]);
2716 AddItem(_lc
[I_MENU_NO
]);
2719 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2722 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2723 g_GUI_AddWindow(Menu
);
2725 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2726 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2728 Name
:= 'mOptionsSoundMenu';
2729 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2731 Name
:= 'scMusicLevel';
2733 OnChange
:= ProcChangeSoundSettings
;
2735 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2737 Name
:= 'scSoundLevel';
2739 OnChange
:= ProcChangeSoundSettings
;
2741 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2743 Name
:= 'scMaxSimSounds';
2746 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2748 Name
:= 'swAnnouncer';
2749 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2750 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2751 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2752 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2754 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2755 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2757 Name
:= 'swSoundEffects';
2758 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2759 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2761 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2762 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2764 Name
:= 'swChatSpeech';
2765 AddItem(_lc
[I_MENU_YES
]);
2766 AddItem(_lc
[I_MENU_NO
]);
2768 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2770 Name
:= 'swInactiveSounds';
2771 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2772 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2776 Menu
.DefControl
:= 'mOptionsSoundMenu';
2777 g_GUI_AddWindow(Menu
);
2779 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2780 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2782 Name
:= 'mOptionsGameMenu';
2783 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2785 Name
:= 'scParticlesCount';
2788 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2790 Name
:= 'swBloodCount';
2791 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2792 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2793 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2794 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2795 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2797 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2799 Name
:= 'scShellsMax';
2802 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2804 Name
:= 'scGibsMax';
2807 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2809 Name
:= 'scCorpsesMax';
2812 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2814 Name
:= 'swGibsCount';
2815 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2816 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2817 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2818 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2819 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2821 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2823 Name
:= 'swCorpseType';
2824 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2825 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2827 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2829 Name
:= 'swGibsType';
2830 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2831 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2833 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2835 Name
:= 'swBloodType';
2836 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2837 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2839 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2841 Name
:= 'swScreenFlash';
2842 AddItem(_lc
[I_MENU_NO
]);
2843 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2844 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2846 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2848 Name
:= 'swBackground';
2849 AddItem(_lc
[I_MENU_YES
]);
2850 AddItem(_lc
[I_MENU_NO
]);
2852 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2854 Name
:= 'swMessages';
2855 AddItem(_lc
[I_MENU_YES
]);
2856 AddItem(_lc
[I_MENU_NO
]);
2858 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2860 Name
:= 'swRevertPlayers';
2861 AddItem(_lc
[I_MENU_YES
]);
2862 AddItem(_lc
[I_MENU_NO
]);
2864 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2866 Name
:= 'swChatBubble';
2867 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2868 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2869 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2870 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2871 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2873 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2875 Name
:= 'swPlayerIndicator';
2876 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2877 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2878 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2880 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2882 Name
:= 'swPlayerIndicatorStyle';
2883 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2884 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2886 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2888 Name
:= 'scScaleFactor';
2890 OnChange
:= ProcChangeGameSettings
;
2894 Menu
.DefControl
:= 'mOptionsGameMenu';
2895 g_GUI_AddWindow(Menu
);
2897 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2898 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2900 Name
:= 'mOptionsControlsMenu';
2901 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2902 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2903 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2904 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2905 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2907 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2908 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2909 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2910 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2911 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2912 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2913 if e_HasJoysticks
then
2916 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2918 if g_touch_enabled
then
2921 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2924 Menu
.DefControl
:= 'mOptionsControlsMenu';
2925 g_GUI_AddWindow(Menu
);
2927 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2928 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2930 Name
:= 'mOptionsControlsP1Menu';
2931 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2932 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2933 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2934 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2935 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2936 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2937 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2938 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2939 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2940 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2942 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2943 g_GUI_AddWindow(Menu
);
2945 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2946 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2948 Name
:= 'mOptionsControlsP1MenuWeapons';
2949 for i
:= WP_FIRST
to WP_LAST
do
2950 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2951 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2953 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2954 g_GUI_AddWindow(Menu
);
2956 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2957 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2959 Name
:= 'mOptionsControlsP2Menu';
2960 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2961 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2962 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2963 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2964 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2965 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2966 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2967 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2968 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2969 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2971 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2972 g_GUI_AddWindow(Menu
);
2974 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2975 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2977 Name
:= 'mOptionsControlsP2MenuWeapons';
2978 for i
:= WP_FIRST
to WP_LAST
do
2979 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2980 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2982 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2983 g_GUI_AddWindow(Menu
);
2985 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2986 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2988 Name
:= 'mOptionsControlsJoystickMenu';
2989 for i
:= 0 to e_MaxJoys
- 1 do
2990 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2992 Name
:= 'scDeadzone' + IntToStr(i
);
2996 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2997 g_GUI_AddWindow(Menu
);
2999 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3000 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3002 Name
:= 'mOptionsControlsTouchMenu';
3003 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3005 Name
:= 'swTouchAlt';
3006 AddItem(_lc
[I_MENU_NO
]);
3007 AddItem(_lc
[I_MENU_YES
]);
3008 OnChange
:= ProcChangeTouchSettings
;
3010 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3012 Name
:= 'scTouchSize';
3014 OnChange
:= ProcChangeTouchSettings
;
3016 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3018 Name
:= 'swTouchFire';
3019 AddItem(_lc
[I_MENU_NO
]);
3020 AddItem(_lc
[I_MENU_YES
]);
3022 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3024 Name
:= 'scTouchOffset';
3026 OnChange
:= ProcChangeTouchSettings
;
3029 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3030 g_GUI_AddWindow(Menu
);
3032 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3033 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3035 Name
:= 'mOptionsPlayersMenu';
3036 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3037 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3039 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3040 g_GUI_AddWindow(Menu
);
3042 CreatePlayerOptionsMenu('P1');
3043 CreatePlayerOptionsMenu('P2');
3045 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3046 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3048 Name
:= 'mOptionsPlayersMIMenu';
3049 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3054 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3059 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3061 Name
:= 'meComment';
3064 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3065 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3068 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3072 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3073 g_GUI_AddWindow(Menu
);
3075 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3076 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3078 Name
:= 'mOptionsLanguageMenu';
3079 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3080 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3083 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3084 g_GUI_AddWindow(Menu
);
3086 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3087 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3088 g_GUI_AddWindow(Menu
);
3090 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3091 Menu
.BackTexture
:= 'INTER';
3092 Menu
.OnClose
:= ProcAuthorsClose
;
3096 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3098 Color
:= _RGB(255, 0, 0);
3099 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3101 _y
:= _y
+GetHeight();
3103 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3105 Color
:= _RGB(255, 0, 0);
3106 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3108 _y
:= _y
+GetHeight()+32;
3110 // ×òî äåëàë: Êòî äåëàë
3111 cx
:= gScreenWidth
div 2 - 320 + 64;
3112 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3114 Color
:= _RGB(255, 0, 0);
3119 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3121 Color
:= _RGB(255, 255, 255);
3126 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3128 Color
:= _RGB(255, 0, 0);
3133 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3135 Color
:= _RGB(255, 255, 255);
3140 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3142 Color
:= _RGB(255, 255, 255);
3147 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3149 Color
:= _RGB(255, 0, 0);
3154 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3156 Color
:= _RGB(255, 255, 255);
3161 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3163 Color
:= _RGB(255, 0, 0);
3168 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3170 Color
:= _RGB(255, 255, 255);
3173 _y
:= gScreenHeight
- 128;
3176 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3178 Color
:= _RGB(255, 0, 0);
3183 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3185 Color
:= _RGB(255, 255, 255);
3188 _y
:= _y
+GetHeight();
3190 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3192 Color
:= _RGB(255, 255, 255);
3195 _y
:= _y
+GetHeight();
3197 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3199 Color
:= _RGB(255, 255, 255);
3202 _y
:= gScreenHeight
- 32;
3204 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3206 Color
:= _RGB(255, 0, 0);
3207 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3210 g_GUI_AddWindow(Menu
);
3212 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3213 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3214 g_GUI_AddWindow(Menu
);
3216 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3217 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3219 Name
:= 'mmGameSingleMenu';
3220 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3221 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3222 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3223 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3224 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3225 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3227 Menu
.DefControl
:= 'mmGameSingleMenu';
3228 Menu
.MainWindow
:= True;
3229 Menu
.OnClose
:= ProcGMClose
;
3230 Menu
.OnShow
:= ProcGMShow
;
3231 g_GUI_AddWindow(Menu
);
3233 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3234 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3235 g_GUI_AddWindow(Menu
);
3237 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3238 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3239 g_GUI_AddWindow(Menu
);
3241 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3242 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3244 Name
:= 'mmGameCustomMenu';
3245 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3246 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3247 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3248 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3249 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3250 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3251 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3253 Menu
.DefControl
:= 'mmGameCustomMenu';
3254 Menu
.MainWindow
:= True;
3255 Menu
.OnClose
:= ProcGMClose
;
3256 Menu
.OnShow
:= ProcGMShow
;
3257 g_GUI_AddWindow(Menu
);
3259 Menu
:= TGUIWindow
.Create('GameServerMenu');
3260 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3262 Name
:= 'mmGameServerMenu';
3263 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3264 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3265 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3266 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3267 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3269 Menu
.DefControl
:= 'mmGameServerMenu';
3270 Menu
.MainWindow
:= True;
3271 Menu
.OnClose
:= ProcGMClose
;
3272 Menu
.OnShow
:= ProcGMShow
;
3273 g_GUI_AddWindow(Menu
);
3275 Menu
:= TGUIWindow
.Create('GameClientMenu');
3276 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3278 Name
:= 'mmGameClientMenu';
3279 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3280 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3281 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3283 Menu
.DefControl
:= 'mmGameClientMenu';
3284 Menu
.MainWindow
:= True;
3285 Menu
.OnClose
:= ProcGMClose
;
3286 Menu
.OnShow
:= ProcGMShow
;
3287 g_GUI_AddWindow(Menu
);
3289 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3290 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3292 Name
:= 'mClientPasswordMenu';
3293 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3301 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3304 Menu
.DefControl
:= 'mClientPasswordMenu';
3305 g_GUI_AddWindow(Menu
);
3307 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3308 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3310 Name
:= 'mGameSetGameMenu';
3311 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3313 Name
:= 'swTeamDamage';
3314 AddItem(_lc
[I_MENU_YES
]);
3315 AddItem(_lc
[I_MENU_NO
]);
3318 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3320 Name
:= 'swDeathmatchKeys';
3321 AddItem(_lc
[I_MENU_YES
]);
3322 AddItem(_lc
[I_MENU_NO
]);
3325 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3327 Name
:= 'edTimeLimit';
3332 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3334 Name
:= 'edGoalLimit';
3339 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3341 Name
:= 'edMaxLives';
3346 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3349 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3350 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3351 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3357 Menu
.DefControl
:= 'mGameSetGameMenu';
3358 Menu
.OnClose
:= ProcApplyGameSet
;
3359 g_GUI_AddWindow(Menu
);
3361 Menu
:= TGUIWindow
.Create('TeamMenu');
3362 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3364 Name
:= 'mmTeamMenu';
3365 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3366 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3367 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3368 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3369 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3371 Menu
.DefControl
:= 'mmTeamMenu';
3372 Menu
.OnShow
:= ProcChangePlayers
;
3373 g_GUI_AddWindow(Menu
);
3376 procedure g_Menu_Show_SaveMenu();
3378 if g_Game_IsTestMap
then
3380 if gGameSettings
.GameType
= GT_SINGLE
then
3381 g_GUI_ShowWindow('GameSingleMenu')
3384 if g_Game_IsClient
then
3387 if g_Game_IsNet
then
3390 g_GUI_ShowWindow('GameCustomMenu');
3392 g_GUI_ShowWindow('SaveMenu');
3393 g_Sound_PlayEx('MENU_OPEN');
3396 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3398 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3399 if gGameSettings
.GameType
= GT_SINGLE
then
3401 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3405 if g_Game_IsClient
then exit
;
3406 if g_Game_IsNet
then exit
;
3407 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3409 g_GUI_ShowWindow('LoadMenu');
3410 g_Sound_PlayEx('MENU_OPEN');
3413 procedure g_Menu_Show_GameSetGame();
3415 if gGameSettings
.GameType
= GT_SINGLE
then
3416 g_GUI_ShowWindow('GameSingleMenu')
3419 if g_Game_IsClient
then
3422 if g_Game_IsNet
then
3423 g_GUI_ShowWindow('GameServerMenu')
3425 g_GUI_ShowWindow('GameCustomMenu');
3428 g_GUI_ShowWindow('GameSetGameMenu');
3429 g_Sound_PlayEx('MENU_OPEN');
3432 procedure g_Menu_Show_OptionsVideo();
3434 if gGameSettings
.GameType
= GT_SINGLE
then
3435 g_GUI_ShowWindow('GameSingleMenu')
3438 if g_Game_IsClient
then
3439 g_GUI_ShowWindow('GameClientMenu')
3441 if g_Game_IsNet
then
3442 g_GUI_ShowWindow('GameServerMenu')
3444 g_GUI_ShowWindow('GameCustomMenu');
3447 g_GUI_ShowWindow('OptionsMenu');
3448 g_GUI_ShowWindow('OptionsVideoMenu');
3449 g_Sound_PlayEx('MENU_OPEN');
3452 procedure g_Menu_Show_OptionsSound();
3454 if gGameSettings
.GameType
= GT_SINGLE
then
3455 g_GUI_ShowWindow('GameSingleMenu')
3458 if g_Game_IsClient
then
3459 g_GUI_ShowWindow('GameClientMenu')
3461 if g_Game_IsNet
then
3462 g_GUI_ShowWindow('GameServerMenu')
3464 g_GUI_ShowWindow('GameCustomMenu');
3467 g_GUI_ShowWindow('OptionsMenu');
3468 g_GUI_ShowWindow('OptionsSoundMenu');
3469 g_Sound_PlayEx('MENU_OPEN');
3472 procedure g_Menu_Show_EndGameMenu();
3474 g_GUI_ShowWindow('EndGameMenu');
3475 g_Sound_PlayEx('MENU_OPEN');
3478 procedure g_Menu_Show_QuitGameMenu();
3480 g_GUI_ShowWindow('ExitMenu');
3481 g_Sound_PlayEx('MENU_OPEN');
3484 procedure g_Menu_Init();
3491 procedure g_Menu_Free();
3495 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3500 procedure g_Menu_Reset();
3504 g_GUI_SaveMenuPos();
3505 ex
:= g_GUI_Destroy();
3509 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3514 g_Game_SetDebugMode();
3516 g_GUI_LoadMenuPos();