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
,
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();
112 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
114 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
120 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
121 if (ovs
<> gVSync
) then
122 sys_EnableVSync(gVSync
);
124 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
125 glLegacyNPOT
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
127 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
129 g_Sound_SetupAllVolumes(
130 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
131 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
134 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
135 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
136 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
137 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
138 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
140 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
142 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
143 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
144 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
145 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
147 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
152 else gGibsCount
:= 48;
155 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
156 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
157 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
158 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
159 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
160 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
161 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
162 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
163 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
164 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
165 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
166 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
168 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
169 g_dbg_scale
:= TempScale
+ 1;
172 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
176 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
177 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
178 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
179 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
180 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
181 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
182 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
183 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
186 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
189 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
190 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
191 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
193 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
194 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
195 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
196 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
197 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
198 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
199 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
200 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
203 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
204 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
205 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext', '-p1_weapnext');
206 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev', '-p1_weapprev');
207 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
208 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
210 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
211 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
212 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
213 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
214 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
215 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
216 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
217 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
218 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
219 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
220 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
221 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
224 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext', '-p1_weapnext');
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev', '-p1_weapprev');
228 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
229 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
232 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
235 for i
:= WP_FIRST
to WP_LAST
do
237 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
238 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
239 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
240 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
244 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
247 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
248 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
249 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
250 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
251 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
252 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
253 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
254 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
255 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
256 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
257 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
258 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
259 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
260 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
261 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
262 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
263 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p2_weapnext', '-p2_weapnext');
264 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev', '-p2_weapprev');
265 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
266 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
268 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
269 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
270 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
271 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
272 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
273 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
274 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
275 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
276 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
277 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
278 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
279 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
282 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
283 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
284 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext', '-p2_weapnext');
285 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev', '-p2_weapprev');
286 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
287 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
290 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
293 for i
:= WP_FIRST
to WP_LAST
do
295 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
296 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
297 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
298 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
302 if e_HasJoysticks
then
304 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
307 for i
:= 0 to e_MaxJoys
- 1 do
308 if e_JoystickAvailable
[i
] then
309 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
313 if g_touch_enabled
then
315 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
316 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
317 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
318 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
319 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
322 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
324 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
325 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
326 TEAM_RED
, TEAM_BLUE
);
328 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
330 gPlayer1Settings
.Model
:= Model
.Name
;
331 gPlayer1Settings
.Color
:= Model
.Color
;
334 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
336 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
337 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
338 TEAM_RED
, TEAM_BLUE
);
339 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
341 gPlayer2Settings
.Model
:= Model
.Name
;
342 gPlayer2Settings
.Color
:= Model
.Color
;
345 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
346 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
348 if g_Game_IsServer
then
350 if gPlayer1
<> nil then
352 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
353 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
354 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
355 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
357 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
360 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
363 if gPlayer2
<> nil then
365 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
366 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
367 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
368 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
370 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
375 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
377 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
378 g_Console_WriteGameConfig();
381 procedure ReadOptions();
386 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
388 with TGUISwitch(menu
.GetControl('swBPP')) do
394 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
395 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
397 with TGUISwitch(menu
.GetControl('swVSync')) do
398 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
400 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
401 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
403 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
405 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
406 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
407 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
409 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
410 if gMuteWhenInactive
then
415 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
417 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
418 if gSoundEffectsDF
then
423 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
424 if gUseChatSounds
then
429 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
432 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
433 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
434 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
435 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
436 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
437 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
438 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
439 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
440 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
441 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
443 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
445 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
446 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
447 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
448 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
449 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
450 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
451 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
452 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
455 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
458 for i
:= WP_FIRST
to WP_LAST
do
460 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
461 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
465 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
468 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
469 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
470 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
471 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
472 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
473 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
474 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
476 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
477 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
481 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
482 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
488 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
491 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
494 for i
:= WP_FIRST
to WP_LAST
do
496 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
497 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
501 if e_HasJoysticks
then
503 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
506 for i
:= 0 to e_MaxJoys
- 1 do
507 if e_JoystickAvailable
[i
] then
508 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
512 if g_touch_enabled
then
514 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
515 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
516 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
517 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
518 with TGUISwitch(menu
.GetControl('swTouchFire')) do
519 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
520 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
523 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
526 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
527 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
528 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
529 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
532 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
534 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
535 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
536 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
537 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
538 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
540 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
543 with TGUISwitch(menu
.GetControl('swBloodType')) do
544 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
546 with TGUISwitch(menu
.GetControl('swCorpseType')) do
547 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
549 with TGUISwitch(menu
.GetControl('swGibsType')) do
550 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
552 with TGUISwitch(menu
.GetControl('swGibsCount')) do
561 with TGUISwitch(menu
.GetControl('swBackGround')) do
562 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
564 with TGUISwitch(menu
.GetControl('swMessages')) do
565 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
567 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
568 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
570 with TGUISwitch(menu
.GetControl('swChatBubble')) do
571 ItemIndex
:= gChatBubble
;
573 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
574 ItemIndex
:= gPlayerIndicator
;
576 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
577 ItemIndex
:= gPlayerIndicatorStyle
;
579 TempScale
:= Round(g_dbg_scale
- 1);
580 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
582 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
584 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
585 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
587 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
588 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
590 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
591 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
592 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
594 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
596 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
597 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
599 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
600 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
602 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
603 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
604 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
606 ProcSelectModel(nil);
609 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
611 // don't turn off monsters in DM
613 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
614 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
615 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
617 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
620 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
621 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
622 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
623 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
627 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
629 // don't turn off monsters in DM
631 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
632 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
633 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
635 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
638 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
639 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
640 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
641 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
645 procedure ProcStartCustomGame();
651 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
653 Map
:= TGUILabel(GetControl('lbMap')).Text;
656 if not isWadPath(Map
) then
659 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
660 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
661 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
662 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
663 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
665 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
666 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
667 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
668 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
671 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
673 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
675 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
677 Options
:= Options
or GAME_OPTION_MONSTERS
;
678 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
680 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
682 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
683 gcBotsVS
:= 'Monsters';
686 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
687 gcBotsVS
:= 'Everybody';
690 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
691 gcBotsVS
:= 'Players';
698 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
700 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
701 gcMaxLives
, Options
, gcPlayers
);
705 procedure ProcStartNetGame();
711 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
713 Map
:= TGUILabel(GetControl('lbMap')).Text;
716 if not isWadPath(Map
) then
719 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
720 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
721 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
722 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
723 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
724 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
726 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
727 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
728 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
729 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
732 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
734 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
736 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
738 Options
:= Options
or GAME_OPTION_MONSTERS
;
739 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
741 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
743 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
744 gnBotsVS
:= 'Monsters';
747 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
748 gnBotsVS
:= 'Everybody';
751 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
752 gnBotsVS
:= 'Players';
757 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
758 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
759 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
760 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
761 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
764 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
765 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
767 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
768 Options
, gnPlayers
, 0, NetPort
);
771 procedure ProcConnectNetGame();
775 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
777 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
778 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
779 PW
:= TGUIEdit(GetControl('edPW')).Text;
782 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
783 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
786 procedure ProcEnterPassword();
790 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
792 NetClientIP
:= PromptIP
;
793 NetClientPort
:= PromptPort
;
794 PW
:= TGUIEdit(GetControl('edPW')).Text;
797 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
798 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
801 procedure ProcServerlist();
803 if not NetInitDone
then
805 if (not g_Net_Init()) then
807 g_Console_Add('NET: ERROR: Failed to init ENet!');
814 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
816 gState
:= STATE_SLIST
;
817 g_ActiveWindow
:= nil;
819 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
824 slReturnPressed
:= True;
825 if g_Net_Slist_Fetch(slCurrent
) then
827 if slCurrent
= nil then
828 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
831 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
832 g_Serverlist_GenerateTable(slCurrent
, slTable
);
835 procedure ProcStartCampaign();
841 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
843 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
844 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
851 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
854 procedure ProcSelectMap(Sender
: TGUIControl
);
858 wad
, map
, res
: String;
860 win
:= g_GUI_GetWindow('SelectMapMenu');
861 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
863 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
864 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
866 if (wad
= '') or (map
= '') then
867 begin // Ýòî íå êàðòà
868 TGUILabel(GetControl('lbMapName')).Text := '';
869 TGUILabel(GetControl('lbMapAuthor')).Text := '';
870 TGUILabel(GetControl('lbMapSize')).Text := '';
871 TGUIMemo(GetControl('meMapDescription')).SetText('');
872 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
873 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
879 a
:= g_Map_GetMapInfo(res
);
881 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
882 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
883 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
884 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
885 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
886 TGUILabel(win
.GetControl('lbMapScale')).Text :=
887 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
892 procedure ProcSelectWAD(Sender
: TGUIControl
);
897 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
899 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
901 with TGUIListBox(GetControl('lsMapRes')) do
907 list
:= g_Map_GetMapsList(wad
);
921 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
927 win
:= g_GUI_GetWindow('CampaignMenu');
928 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
930 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
934 TGUILabel(GetControl('lbWADName')).Text := '';
935 TGUILabel(GetControl('lbWADAuthor')).Text := '';
936 TGUIMemo(GetControl('meWADDescription')).SetText('');
939 a
:= g_Game_GetMegaWADInfo(wad
);
941 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
942 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
943 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
945 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
949 fn
:= g_ExtractWadName(a
.pic
);
951 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
953 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
958 procedure ProcChangeColor(Sender
: TGUIControl
);
962 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
963 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
964 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
965 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
966 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
967 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
969 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
970 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
971 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
972 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
973 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
974 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
977 procedure ProcSelectModel(Sender
: TGUIControl
);
982 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
983 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
984 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
986 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
987 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
988 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
990 ProcChangeColor(nil);
993 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
1005 wad
:= TWADFile
.Create
;
1006 if wad
.ReadFile(GameWAD
) then
1007 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
1012 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
1014 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1015 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1016 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1017 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1019 if g_Texture_Get('FONT_STD', ID
) then
1020 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
1025 if cfglen
<> 0 then FreeMem(cfgdata
);
1028 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
1034 cfgdata
, fntdata
: Pointer;
1035 cfglen
, fntlen
: Integer;
1043 wad
:= TWADFile
.Create
;
1044 if wad
.ReadFile(GameWAD
) then
1046 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1047 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1053 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1054 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1055 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1057 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1058 FontID
:= e_CharFont_Create(spc
);
1060 for a
:= 0 to 255 do
1062 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1063 if chrwidth
= 0 then Continue
;
1065 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1067 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1073 if cfglen
<> 0 then FreeMem(cfgdata
);
1074 if fntlen
<> 0 then FreeMem(fntdata
);
1077 procedure MenuLoadData();
1079 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1081 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1082 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1083 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1084 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1085 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1086 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1087 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1088 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1089 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1090 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1091 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1092 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1093 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1094 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1095 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1096 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1097 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1098 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1099 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1100 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1101 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1102 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1103 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1104 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1105 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1107 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1108 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1109 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1110 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1111 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1112 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1113 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1116 procedure MenuFreeData();
1118 e_CharFont_Remove(gMenuFont
);
1119 e_CharFont_Remove(gMenuSmallFont
);
1121 g_Texture_Delete('MAINMENU_LOGO');
1122 g_Texture_Delete('MAINMENU_MARKER1');
1123 g_Texture_Delete('MAINMENU_MARKER2');
1124 g_Texture_Delete('SCROLL_LEFT');
1125 g_Texture_Delete('SCROLL_RIGHT');
1126 g_Texture_Delete('SCROLL_MIDDLE');
1127 g_Texture_Delete('SCROLL_MARKER');
1128 g_Texture_Delete('EDIT_LEFT');
1129 g_Texture_Delete('EDIT_RIGHT');
1130 g_Texture_Delete('EDIT_MIDDLE');
1131 g_Texture_Delete('BOX1');
1132 g_Texture_Delete('BOX2');
1133 g_Texture_Delete('BOX3');
1134 g_Texture_Delete('BOX4');
1135 g_Texture_Delete('BOX5');
1136 g_Texture_Delete('BOX6');
1137 g_Texture_Delete('BOX7');
1138 g_Texture_Delete('BOX8');
1139 g_Texture_Delete('BOX9');
1140 g_Texture_Delete('BSCROLL_UP_A');
1141 g_Texture_Delete('BSCROLL_UP_U');
1142 g_Texture_Delete('BSCROLL_DOWN_A');
1143 g_Texture_Delete('BSCROLL_DOWN_U');
1144 g_Texture_Delete('BSCROLL_MIDDLE');
1145 g_Texture_Delete('NOPIC');
1147 g_Sound_Delete('MENU_SELECT');
1148 g_Sound_Delete('MENU_OPEN');
1149 g_Sound_Delete('MENU_CLOSE');
1150 g_Sound_Delete('MENU_CHANGE');
1151 g_Sound_Delete('SCROLL_ADD');
1152 g_Sound_Delete('SCROLL_SUB');
1153 g_Sound_Delete('SOUND_PLAYER_FALL');
1156 procedure ProcAuthorsMenu();
1158 gMusic
.SetByName('MUSIC_INTERMUS');
1162 procedure ProcExitMenuKeyDown (yes
: Boolean);
1165 snd
: TPlayableSound
;
1170 g_Game_StopAllSounds(True);
1171 case (Random(18)) of
1172 0: s
:= 'SOUND_MONSTER_PAIN';
1173 1: s
:= 'SOUND_MONSTER_DIE_3';
1174 2: s
:= 'SOUND_MONSTER_SLOP';
1175 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1176 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1177 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1178 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1179 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1180 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1181 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1182 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1183 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1184 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1185 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1186 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1187 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1188 else s
:= 'SOUND_PLAYER_FALL';
1190 snd
:= TPlayableSound
.Create();
1191 res
:= snd
.SetByName(s
);
1192 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1196 while snd
.IsPlaying() do begin end;
1204 procedure ProcLoadMenu();
1211 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1212 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1213 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1217 procedure ProcSaveMenu();
1225 name
:= g_GetSaveName(a
, valid
);
1226 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1227 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1231 procedure ProcSaveGame(Sender
: TGUIControl
);
1235 if g_Game_IsNet
then Exit
;
1236 if g_Game_IsTestMap
then Exit
;
1237 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1238 g_Game_PauseAllSounds(True);
1239 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1241 g_ActiveWindow
:= nil;
1242 g_Game_Pause(False);
1245 procedure ProcLoadGame(Sender
: TGUIControl
);
1249 if g_Game_IsNet
then Exit
;
1250 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1251 if g_LoadGame(a
) then
1253 g_Game_PauseAllSounds(False)
1255 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1257 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1258 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1259 //g_ActiveWindow := nil;
1263 procedure ProcSingle1Player();
1265 g_Game_StartSingle(gDefaultMegawadStart
, False, 1);
1268 procedure ProcSingle2Players();
1270 g_Game_StartSingle(gDefaultMegawadStart
, True, 2);
1273 procedure ProcSelectMapMenu();
1276 wad_lb
: TGUIFileListBox
;
1277 map_lb
: TGUIListBox
;
1280 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1281 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1282 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1284 if wad_lb
.SelectedItem() <> '' then
1285 map
:= map_lb
.SelectedItem()
1289 wad_lb
.UpdateFileList();
1292 if wad_lb
.SelectedItem() <> '' then
1295 map_lb
.SelectItem(map
);
1297 if map_lb
.SelectedItem() <> '' then
1301 g_GUI_ShowWindow('SelectMapMenu');
1304 procedure ProcSelectCampaignMenu();
1307 wad_lb
: TGUIFileListBox
;
1309 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1310 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1312 wad_lb
.UpdateFileList();
1314 if wad_lb
.SelectedItem() <> '' then
1315 ProcSelectCampaignWAD(nil);
1318 procedure ProcSetMap();
1320 wad
, map
, res
: String;
1322 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1324 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1325 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1328 if (wad
= '') or (map
= '') then
1331 res
:= wad
+':\'+map
;
1333 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1334 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1337 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1341 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1343 g_Sound_SetupAllVolumes(
1344 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1345 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1349 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1353 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1354 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1356 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1357 g_dbg_scale
:= TempScale
+ 1;
1361 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1365 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1366 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1367 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1368 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1371 procedure ProcOptionsPlayersMIMenu();
1376 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1378 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1380 if a
= '' then Exit
;
1382 b
:= g_PlayerModel_GetInfo(a
);
1384 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1386 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1387 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1388 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1390 if b
.HaveWeapon
then
1391 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1393 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1396 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1399 procedure ProcOptionsPlayersAnim();
1403 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1408 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1411 Model
.GetCurrentAnimation
.Loop
:= True;
1412 Model
.GetCurrentAnimationMask
.Loop
:= True;
1416 procedure ProcOptionsPlayersWeap();
1420 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1425 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1429 procedure ProcOptionsPlayersRot();
1433 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1434 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1436 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1440 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1444 g_Options_SetDefault();
1450 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1452 if yes
then ReadOptions();
1456 procedure ProcAuthorsClose();
1458 gMusic
.SetByName('MUSIC_MENU');
1460 gState
:= STATE_MENU
;
1463 procedure ProcGMClose();
1465 g_Game_InGameMenu(False);
1468 procedure ProcGMShow();
1473 if (gGameSettings
.GameType
= GT_SINGLE
) and
1474 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1475 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1476 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1478 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1479 if g_Game_IsTestMap
then
1480 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1481 TGUIMainMenu(g_ActiveWindow
.GetControl(
1482 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1485 procedure ProcChangePlayers();
1487 TeamGame
, Spectator
, AddTwo
: Boolean;
1488 P1Team
{, P2Team}: Byte;
1489 bP2
: TGUITextButton
;
1491 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1492 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1493 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1494 P1Team
:= TEAM_NONE
;
1495 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1497 //P2Team := TEAM_NONE;
1498 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1500 TGUIMainMenu(g_ActiveWindow
.GetControl(
1501 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1502 TGUIMainMenu(g_ActiveWindow
.GetControl(
1503 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1504 TGUIMainMenu(g_ActiveWindow
.GetControl(
1505 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1507 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1508 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1509 bP2
.Enabled
:= AddTwo
and not Spectator
;
1511 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1513 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1514 if gPlayer2
= nil then
1515 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1517 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1519 TGUIMainMenu(g_ActiveWindow
.GetControl(
1520 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1523 procedure ProcJoinRed();
1525 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1527 if g_Game_IsServer
then
1529 if gPlayer1
= nil then
1530 g_Game_AddPlayer(TEAM_RED
)
1533 if gPlayer1
.Team
<> TEAM_RED
then
1535 gPlayer1
.SwitchTeam
;
1536 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1539 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1544 gPlayer1Settings
.Team
:= TEAM_RED
;
1545 MC_SEND_PlayerSettings
;
1546 if gPlayer1
= nil then
1547 g_Game_AddPlayer(TEAM_RED
);
1549 g_ActiveWindow
:= nil;
1550 g_Game_Pause(False);
1553 procedure ProcJoinBlue();
1555 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1557 if g_Game_IsServer
then
1559 if gPlayer1
= nil then
1560 g_Game_AddPlayer(TEAM_BLUE
)
1563 if gPlayer1
.Team
<> TEAM_BLUE
then
1565 gPlayer1
.SwitchTeam
;
1566 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1569 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1574 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1575 MC_SEND_PlayerSettings
;
1576 if gPlayer1
= nil then
1577 g_Game_AddPlayer(TEAM_BLUE
);
1579 g_ActiveWindow
:= nil;
1580 g_Game_Pause(False);
1583 procedure ProcJoinGame();
1585 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1587 if gPlayer1
= nil then
1589 g_ActiveWindow
:= nil;
1590 g_Game_Pause(False);
1593 procedure ProcSwitchP2();
1595 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1597 if gPlayer1
= nil then
1599 if gPlayer2
= nil then
1602 g_Game_RemovePlayer();
1603 g_ActiveWindow
:= nil;
1604 g_Game_Pause(False);
1607 procedure ProcSpectate();
1609 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1612 g_ActiveWindow
:= nil;
1613 g_Game_Pause(False);
1616 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1618 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1621 procedure ProcEndMenuKeyDown (yes
: Boolean);
1623 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1626 procedure ProcSetRussianLanguage();
1628 if gLanguage
<> LANGUAGE_RUSSIAN
then
1630 gLanguage
:= LANGUAGE_RUSSIAN
;
1631 gLanguageChange
:= True;
1632 gAskLanguage
:= False;
1634 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1636 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1641 procedure ProcSetEnglishLanguage();
1643 if gLanguage
<> LANGUAGE_ENGLISH
then
1645 gLanguage
:= LANGUAGE_ENGLISH
;
1646 gLanguageChange
:= True;
1647 gAskLanguage
:= False;
1649 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1651 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1656 procedure ReadGameSettings();
1660 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1662 with gGameSettings
do
1664 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1665 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1670 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1671 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1672 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1674 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1675 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1676 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1679 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1684 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1686 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1687 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1688 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1689 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1690 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1691 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1692 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1693 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1697 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1698 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1703 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1704 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1709 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1710 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1715 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1716 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1721 procedure ProcApplyGameSet();
1725 stat
: TPlayerStatArray
;
1727 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1729 if not g_Game_IsServer
then Exit
;
1731 with gGameSettings
do
1733 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1735 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1736 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1738 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1741 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1743 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1749 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1751 TimeLimit
:= Max(n
, b
);
1755 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1757 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1764 if GameMode
= GM_DM
then
1766 stat
:= g_Player_GetStats();
1768 for a
:= 0 to High(stat
) do
1769 if stat
[a
].Frags
> b
then
1773 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1775 GoalLimit
:= Max(n
, b
);
1779 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1781 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1782 if n
< 0 then n
:= 0;
1783 if n
> 255 then n
:= 255;
1789 stat
:= g_Player_GetStats();
1791 for a
:= 0 to High(stat
) do
1792 if stat
[a
].Lives
> b
then
1795 MaxLives
:= Max(n
, b
);
1799 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1801 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1804 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1805 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1809 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1810 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1814 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1815 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1821 if g_Game_IsNet
then MH_SEND_GameSettings
;
1824 procedure ProcVideoOptionsRes();
1829 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1831 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1832 IntToStr(gScreenWidth
) +
1833 ' x ' + IntToStr(gScreenHeight
) +
1834 ', ' + IntToStr(gBPP
) + ' bpp';
1836 with TGUIListBox(menu
.GetControl('lsResolution')) do
1838 list
:= sys_GetDispalyModes(gBPP
);
1842 ItemIndex
:= Length(list
)
1850 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1857 procedure ProcApplyVideoOptions();
1860 Fullscreen
: Boolean;
1861 SWidth
, SHeight
: Integer;
1864 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1866 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1867 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1869 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1871 if (SWidth
<> gScreenWidth
) or
1872 (SHeight
<> gScreenHeight
) or
1873 (Fullscreen
<> gFullscreen
) then
1875 gResolutionChange
:= True;
1876 gRC_Width
:= SWidth
;
1877 gRC_Height
:= SHeight
;
1878 gRC_FullScreen
:= Fullscreen
;
1879 gRC_Maximized
:= gWinMaximized
;
1882 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1886 procedure ProcSetFirstRussianLanguage();
1888 gLanguage
:= LANGUAGE_RUSSIAN
;
1889 gLanguageChange
:= True;
1890 gAskLanguage
:= False;
1892 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1895 procedure ProcSetFirstEnglishLanguage();
1897 gLanguage
:= LANGUAGE_ENGLISH
;
1898 gLanguageChange
:= True;
1899 gAskLanguage
:= False;
1901 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1904 procedure ProcRecallAddress();
1906 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1908 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1909 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1913 procedure CreateFirstLanguageMenu();
1917 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1919 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1921 Name
:= 'mmFirstLanguageMenu';
1922 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1923 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1926 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1927 Menu
.MainWindow
:= True;
1928 g_GUI_AddWindow(Menu
);
1931 procedure g_Menu_AskLanguage();
1933 CreateFirstLanguageMenu();
1934 g_GUI_ShowWindow('FirstLanguageMenu');
1937 procedure CreatePlayerOptionsMenu(s
: String);
1942 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1944 a
:= _lc
[I_MENU_PLAYER_1
]
1946 a
:= _lc
[I_MENU_PLAYER_2
];
1947 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1949 Name
:= 'mOptionsPlayers'+s
+'Menu';
1950 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1952 Name
:= 'ed'+s
+'Name';
1956 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1958 Name
:= 'sw'+s
+'Team';
1959 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1960 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1962 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1964 Name
:= 'ls'+s
+'Model';
1966 Items
:= g_PlayerModel_GetNames();
1967 OnChange
:= ProcSelectModel
;
1969 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1971 Name
:= 'sc'+s
+'Red';
1973 OnChange
:= ProcChangeColor
;
1975 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1977 Name
:= 'sc'+s
+'Green';
1979 OnChange
:= ProcChangeColor
;
1981 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1983 Name
:= 'sc'+s
+'Blue';
1985 OnChange
:= ProcChangeColor
;
1988 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1989 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1990 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1991 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1993 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1995 Name
:= 'mv'+s
+'Model';
1996 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1997 Y
:= GetControl('ls'+s
+'Model').Y
;
2000 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2001 g_GUI_AddWindow(Menu
);
2004 procedure CreateAllMenus();
2008 a
, cx
, _y
, i
: Integer;
2011 Menu
:= TGUIWindow
.Create('MainMenu');
2012 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2014 Name
:= 'mmMainMenu';
2015 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2016 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2017 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2018 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2019 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2020 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2022 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2024 Color
:= _RGB(255, 255, 255);
2025 X
:= gScreenWidth
-GetWidth
-8;
2026 Y
:= gScreenHeight
-GetHeight
-8;
2028 Menu
.DefControl
:= 'mmMainMenu';
2029 Menu
.MainWindow
:= True;
2030 g_GUI_AddWindow(Menu
);
2032 Menu
:= TGUIWindow
.Create('NewGameMenu');
2033 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2035 Name
:= 'mmNewGameMenu';
2036 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2037 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2038 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2039 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2041 Menu
.DefControl
:= 'mmNewGameMenu';
2042 g_GUI_AddWindow(Menu
);
2044 Menu
:= TGUIWindow
.Create('NetGameMenu');
2045 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2047 Name
:= 'mmNetGameMenu';
2048 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2049 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2051 Menu
.DefControl
:= 'mmNetGameMenu';
2052 g_GUI_AddWindow(Menu
);
2054 Menu
:= TGUIWindow
.Create('NetServerMenu');
2055 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2057 Name
:= 'mNetServerMenu';
2058 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2060 Name
:= 'edSrvName';
2061 OnlyDigits
:= False;
2064 Text := NetServerName
;
2066 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2068 Name
:= 'edSrvPassword';
2069 OnlyDigits
:= False;
2072 Text := NetPassword
;
2074 with AddEdit(_lc
[I_NET_PORT
]) do
2080 Text := IntToStr(NetPort
);
2082 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2084 Name
:= 'edMaxPlayers';
2088 Text := IntToStr(NetMaxClients
);
2090 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2092 Name
:= 'swUseMaster';
2093 AddItem(_lc
[I_MENU_YES
]);
2094 AddItem(_lc
[I_MENU_NO
]);
2095 if NetUseMaster
then
2101 with AddLabel(_lc
[I_MENU_MAP
]) do
2106 OnClick
:= @ProcSelectMapMenu
;
2108 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2110 Name
:= 'swGameMode';
2111 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2112 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2113 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2114 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2115 case g_Game_TextToMode(gnGameMode
) of
2117 GM_DM
: ItemIndex
:= 0;
2118 GM_TDM
: ItemIndex
:= 1;
2119 GM_CTF
: ItemIndex
:= 2;
2121 GM_COOP
: ItemIndex
:= 3;
2123 OnChange
:= ProcSwitchMonstersNet
;
2125 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2127 Name
:= 'edTimeLimit';
2131 if gnTimeLimit
> 0 then
2132 Text := IntToStr(gnTimeLimit
);
2134 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2136 Name
:= 'edGoalLimit';
2140 if gnGoalLimit
> 0 then
2141 Text := IntToStr(gnGoalLimit
);
2143 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2145 Name
:= 'edMaxLives';
2149 if gnMaxLives
> 0 then
2150 Text := IntToStr(gnMaxLives
);
2152 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2154 Name
:= 'swPlayers';
2155 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2156 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2157 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2158 ItemIndex
:= gnPlayers
;
2160 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2162 Name
:= 'swTeamDamage';
2163 AddItem(_lc
[I_MENU_YES
]);
2164 AddItem(_lc
[I_MENU_NO
]);
2165 if gnTeamDamage
then
2170 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2172 Name
:= 'swEnableExits';
2173 AddItem(_lc
[I_MENU_YES
]);
2174 AddItem(_lc
[I_MENU_NO
]);
2180 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2182 Name
:= 'swWeaponStay';
2183 AddItem(_lc
[I_MENU_YES
]);
2184 AddItem(_lc
[I_MENU_NO
]);
2185 if gnWeaponStay
then
2190 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2192 Name
:= 'swMonsters';
2193 AddItem(_lc
[I_MENU_YES
]);
2194 AddItem(_lc
[I_MENU_NO
]);
2200 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2203 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2204 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2205 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2207 if gnBotsVS
= 'Players' then
2209 if gnBotsVS
= 'Monsters' then
2213 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2217 Menu
.DefControl
:= 'mNetServerMenu';
2218 g_GUI_AddWindow(Menu
);
2220 Menu
:= TGUIWindow
.Create('NetClientMenu');
2221 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2223 Name
:= 'mNetClientMenu';
2225 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2228 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2234 Text := 'localhost';
2236 with AddEdit(_lc
[I_NET_PORT
]) do
2244 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2247 OnlyDigits
:= False;
2254 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2258 Menu
.DefControl
:= 'mNetClientMenu';
2259 g_GUI_AddWindow(Menu
);
2261 Menu
:= TGUIWindow
.Create('LoadMenu');
2262 Menu
.OnShow
:= ProcLoadMenu
;
2263 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2265 Name
:= 'mmLoadMenu';
2270 Name
:= 'edSlot'+IntToStr(a
);
2273 OnEnter
:= ProcLoadGame
;
2276 Menu
.DefControl
:= 'mmLoadMenu';
2277 g_GUI_AddWindow(Menu
);
2279 Menu
:= TGUIWindow
.Create('SaveMenu');
2280 Menu
.OnShow
:= ProcSaveMenu
;
2281 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2283 Name
:= 'mmSaveMenu';
2288 Name
:= 'edSlot'+IntToStr(a
);
2291 OnChange
:= ProcSaveGame
;
2294 Menu
.DefControl
:= 'mmSaveMenu';
2295 g_GUI_AddWindow(Menu
);
2297 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2298 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2300 Name
:= 'mCustomGameMenu';
2301 with AddLabel(_lc
[I_MENU_MAP
]) do
2306 OnClick
:= @ProcSelectMapMenu
;
2308 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2310 Name
:= 'swGameMode';
2311 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2312 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2313 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2314 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2315 case g_Game_TextToMode(gcGameMode
) of
2317 GM_DM
: ItemIndex
:= 0;
2318 GM_TDM
: ItemIndex
:= 1;
2319 GM_CTF
: ItemIndex
:= 2;
2321 GM_COOP
: ItemIndex
:= 3;
2323 OnChange
:= ProcSwitchMonstersCustom
;
2325 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2327 Name
:= 'edTimeLimit';
2331 if gcTimeLimit
> 0 then
2332 Text := IntToStr(gcTimeLimit
);
2334 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2336 Name
:= 'edGoalLimit';
2340 if gcGoalLimit
> 0 then
2341 Text := IntToStr(gcGoalLimit
);
2343 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2345 Name
:= 'edMaxLives';
2349 if gcMaxLives
> 0 then
2350 Text := IntToStr(gcMaxLives
);
2352 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2354 Name
:= 'swPlayers';
2355 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2356 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2357 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2358 ItemIndex
:= gcPlayers
;
2360 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2362 Name
:= 'swTeamDamage';
2363 AddItem(_lc
[I_MENU_YES
]);
2364 AddItem(_lc
[I_MENU_NO
]);
2365 if gcTeamDamage
then
2370 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2372 Name
:= 'swEnableExits';
2373 AddItem(_lc
[I_MENU_YES
]);
2374 AddItem(_lc
[I_MENU_NO
]);
2380 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2382 Name
:= 'swWeaponStay';
2383 AddItem(_lc
[I_MENU_YES
]);
2384 AddItem(_lc
[I_MENU_NO
]);
2385 if gcWeaponStay
then
2390 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2392 Name
:= 'swMonsters';
2393 AddItem(_lc
[I_MENU_YES
]);
2394 AddItem(_lc
[I_MENU_NO
]);
2400 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2403 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2404 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2405 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2407 if gcBotsVS
= 'Players' then
2409 if gcBotsVS
= 'Monsters' then
2413 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2417 Menu
.DefControl
:= 'mCustomGameMenu';
2418 g_GUI_AddWindow(Menu
);
2420 Menu
:= TGUIWindow
.Create('CampaignMenu');
2421 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2423 Name
:= 'mCampaignMenu';
2432 with AddFileList('', 15, 4) do
2435 OnChange
:= ProcSelectCampaignWAD
;
2439 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2440 SetBase(MapsDir
+'megawads/');
2443 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2445 Name
:= 'lbWADName';
2449 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2451 Name
:= 'lbWADAuthor';
2455 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2456 with AddMemo('', 15, 3) do
2458 Name
:= 'meWADDescription';
2459 Color
:= MENU_ITEMSCTRL_COLOR
;
2461 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2463 Name
:= 'swPlayers';
2464 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2465 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2468 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2472 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2474 Name
:= 'mpWADImage';
2475 DefaultRes
:= 'NOPIC';
2476 X
:= GetControl('lsWAD').X
+4;
2477 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2480 Menu
.DefControl
:= 'mCampaignMenu';
2481 g_GUI_AddWindow(Menu
);
2483 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2484 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2486 Name
:= 'mSelectMapMenu';
2487 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2490 OnChange
:= ProcSelectWAD
;
2494 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2497 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2501 OnChange
:= ProcSelectMap
;
2504 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2506 Name
:= 'lbMapName';
2510 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2512 Name
:= 'lbMapAuthor';
2516 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2518 Name
:= 'lbMapSize';
2522 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2524 Name
:= 'meMapDescription';
2529 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2531 Name
:= 'mpMapPreview';
2532 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2533 Y
:= GetControl('lsMapWAD').Y
;
2535 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2537 Name
:= 'lbMapScale';
2540 Color
:= MENU_ITEMSCTRL_COLOR
;
2541 X
:= GetControl('lsMapWAD').X
+
2542 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2543 2 + MAPPREVIEW_WIDTH
*4;
2544 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2547 Menu
.OnClose
:= ProcSetMap
;
2548 Menu
.DefControl
:= 'mSelectMapMenu';
2549 g_GUI_AddWindow(Menu
);
2551 Menu
:= TGUIWindow
.Create('OptionsMenu');
2552 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2554 Name
:= 'mmOptionsMenu';
2555 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2556 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2557 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2558 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2559 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2560 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2562 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2563 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2565 Menu
.OnClose
:= ProcApplyOptions
;
2566 Menu
.DefControl
:= 'mmOptionsMenu';
2567 g_GUI_AddWindow(Menu
);
2569 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2570 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2571 g_GUI_AddWindow(Menu
);
2573 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2574 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2576 Name
:= 'mOptionsVideoMenu';
2577 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2578 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2584 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2587 AddItem(_lc
[I_MENU_YES
]);
2588 AddItem(_lc
[I_MENU_NO
]);
2590 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2592 Name
:= 'swTextureFilter';
2593 AddItem(_lc
[I_MENU_YES
]);
2594 AddItem(_lc
[I_MENU_NO
]);
2596 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2598 Name
:= 'swLegacyNPOT';
2599 AddItem(_lc
[I_MENU_NO
]);
2600 AddItem(_lc
[I_MENU_YES
]);
2603 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2606 Menu
.DefControl
:= 'mOptionsVideoMenu';
2607 g_GUI_AddWindow(Menu
);
2609 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2610 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2612 Name
:= 'mOptionsVideoResMenu';
2613 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2615 Name
:= 'lbCurrentRes';
2619 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2621 Name
:= 'lsResolution';
2624 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2626 Name
:= 'swFullScreen';
2627 AddItem(_lc
[I_MENU_YES
]);
2628 AddItem(_lc
[I_MENU_NO
]);
2631 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2634 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2635 g_GUI_AddWindow(Menu
);
2637 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2638 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2640 Name
:= 'mOptionsSoundMenu';
2641 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2643 Name
:= 'scMusicLevel';
2645 OnChange
:= ProcChangeSoundSettings
;
2647 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2649 Name
:= 'scSoundLevel';
2651 OnChange
:= ProcChangeSoundSettings
;
2653 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2655 Name
:= 'scMaxSimSounds';
2658 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2660 Name
:= 'swAnnouncer';
2661 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2662 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2663 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2664 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2666 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2667 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2669 Name
:= 'swSoundEffects';
2670 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2671 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2673 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2674 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2676 Name
:= 'swChatSpeech';
2677 AddItem(_lc
[I_MENU_YES
]);
2678 AddItem(_lc
[I_MENU_NO
]);
2680 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2682 Name
:= 'swInactiveSounds';
2683 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2684 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2688 Menu
.DefControl
:= 'mOptionsSoundMenu';
2689 g_GUI_AddWindow(Menu
);
2691 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2692 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2694 Name
:= 'mOptionsGameMenu';
2695 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2697 Name
:= 'scParticlesCount';
2700 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2702 Name
:= 'swBloodCount';
2703 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2704 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2705 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2706 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2707 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2709 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2711 Name
:= 'scShellsMax';
2714 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2716 Name
:= 'scGibsMax';
2719 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2721 Name
:= 'scCorpsesMax';
2724 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2726 Name
:= 'swGibsCount';
2727 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2728 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2729 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2730 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2731 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2733 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2735 Name
:= 'swCorpseType';
2736 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2737 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2739 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2741 Name
:= 'swGibsType';
2742 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2743 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2745 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2747 Name
:= 'swBloodType';
2748 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2749 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2751 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2753 Name
:= 'swScreenFlash';
2754 AddItem(_lc
[I_MENU_NO
]);
2755 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2756 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2758 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2760 Name
:= 'swBackground';
2761 AddItem(_lc
[I_MENU_YES
]);
2762 AddItem(_lc
[I_MENU_NO
]);
2764 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2766 Name
:= 'swMessages';
2767 AddItem(_lc
[I_MENU_YES
]);
2768 AddItem(_lc
[I_MENU_NO
]);
2770 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2772 Name
:= 'swRevertPlayers';
2773 AddItem(_lc
[I_MENU_YES
]);
2774 AddItem(_lc
[I_MENU_NO
]);
2776 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2778 Name
:= 'swChatBubble';
2779 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2780 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2781 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2782 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2783 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2785 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2787 Name
:= 'swPlayerIndicator';
2788 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2789 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2790 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2792 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2794 Name
:= 'swPlayerIndicatorStyle';
2795 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2796 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2798 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2800 Name
:= 'scScaleFactor';
2802 OnChange
:= ProcChangeGameSettings
;
2806 Menu
.DefControl
:= 'mOptionsGameMenu';
2807 g_GUI_AddWindow(Menu
);
2809 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2810 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2812 Name
:= 'mOptionsControlsMenu';
2813 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2814 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2815 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2816 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2817 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2819 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2820 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2821 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2822 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2823 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2824 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2825 if e_HasJoysticks
then
2828 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2830 if g_touch_enabled
then
2833 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2836 Menu
.DefControl
:= 'mOptionsControlsMenu';
2837 g_GUI_AddWindow(Menu
);
2839 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2840 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2842 Name
:= 'mOptionsControlsP1Menu';
2843 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2844 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2845 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2846 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2847 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2848 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2849 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2850 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2851 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2852 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2854 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2855 g_GUI_AddWindow(Menu
);
2857 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2858 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2860 Name
:= 'mOptionsControlsP1MenuWeapons';
2861 for i
:= WP_FIRST
to WP_LAST
do
2862 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2863 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2865 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2866 g_GUI_AddWindow(Menu
);
2868 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2869 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2871 Name
:= 'mOptionsControlsP2Menu';
2872 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2873 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2874 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2875 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2876 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2877 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2878 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2879 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2880 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2881 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2883 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2884 g_GUI_AddWindow(Menu
);
2886 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2887 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2889 Name
:= 'mOptionsControlsP2MenuWeapons';
2890 for i
:= WP_FIRST
to WP_LAST
do
2891 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2892 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2894 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2895 g_GUI_AddWindow(Menu
);
2897 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2898 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2900 Name
:= 'mOptionsControlsJoystickMenu';
2901 for i
:= 0 to e_MaxJoys
- 1 do
2902 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2904 Name
:= 'scDeadzone' + IntToStr(i
);
2908 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2909 g_GUI_AddWindow(Menu
);
2911 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
2912 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
2914 Name
:= 'mOptionsControlsTouchMenu';
2915 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
2917 Name
:= 'swTouchAlt';
2918 AddItem(_lc
[I_MENU_NO
]);
2919 AddItem(_lc
[I_MENU_YES
]);
2920 OnChange
:= ProcChangeTouchSettings
;
2922 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
2924 Name
:= 'scTouchSize';
2926 OnChange
:= ProcChangeTouchSettings
;
2928 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
2930 Name
:= 'swTouchFire';
2931 AddItem(_lc
[I_MENU_NO
]);
2932 AddItem(_lc
[I_MENU_YES
]);
2934 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
2936 Name
:= 'scTouchOffset';
2938 OnChange
:= ProcChangeTouchSettings
;
2941 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
2942 g_GUI_AddWindow(Menu
);
2944 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2945 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2947 Name
:= 'mOptionsPlayersMenu';
2948 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2949 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2951 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2952 g_GUI_AddWindow(Menu
);
2954 CreatePlayerOptionsMenu('P1');
2955 CreatePlayerOptionsMenu('P2');
2957 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2958 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2960 Name
:= 'mOptionsPlayersMIMenu';
2961 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2966 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2971 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2973 Name
:= 'meComment';
2976 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2977 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2980 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2984 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2985 g_GUI_AddWindow(Menu
);
2987 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2988 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2990 Name
:= 'mOptionsLanguageMenu';
2991 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2992 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2995 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2996 g_GUI_AddWindow(Menu
);
2998 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2999 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3000 g_GUI_AddWindow(Menu
);
3002 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3003 Menu
.BackTexture
:= 'INTER';
3004 Menu
.OnClose
:= ProcAuthorsClose
;
3008 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3010 Color
:= _RGB(255, 0, 0);
3011 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3013 _y
:= _y
+GetHeight();
3015 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3017 Color
:= _RGB(255, 0, 0);
3018 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3020 _y
:= _y
+GetHeight()+32;
3022 // ×òî äåëàë: Êòî äåëàë
3023 cx
:= gScreenWidth
div 2 - 320 + 64;
3024 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3026 Color
:= _RGB(255, 0, 0);
3031 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3033 Color
:= _RGB(255, 255, 255);
3038 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3040 Color
:= _RGB(255, 0, 0);
3045 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3047 Color
:= _RGB(255, 255, 255);
3052 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3054 Color
:= _RGB(255, 255, 255);
3059 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3061 Color
:= _RGB(255, 0, 0);
3066 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3068 Color
:= _RGB(255, 255, 255);
3073 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3075 Color
:= _RGB(255, 0, 0);
3080 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3082 Color
:= _RGB(255, 255, 255);
3085 _y
:= gScreenHeight
- 128;
3088 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3090 Color
:= _RGB(255, 0, 0);
3095 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3097 Color
:= _RGB(255, 255, 255);
3100 _y
:= _y
+GetHeight();
3102 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3104 Color
:= _RGB(255, 255, 255);
3107 _y
:= _y
+GetHeight();
3109 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3111 Color
:= _RGB(255, 255, 255);
3114 _y
:= gScreenHeight
- 32;
3116 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3118 Color
:= _RGB(255, 0, 0);
3119 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3122 g_GUI_AddWindow(Menu
);
3124 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3125 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3126 g_GUI_AddWindow(Menu
);
3128 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3129 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3131 Name
:= 'mmGameSingleMenu';
3132 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3133 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3134 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3135 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3136 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3137 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3139 Menu
.DefControl
:= 'mmGameSingleMenu';
3140 Menu
.MainWindow
:= True;
3141 Menu
.OnClose
:= ProcGMClose
;
3142 Menu
.OnShow
:= ProcGMShow
;
3143 g_GUI_AddWindow(Menu
);
3145 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3146 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3147 g_GUI_AddWindow(Menu
);
3149 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3150 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3151 g_GUI_AddWindow(Menu
);
3153 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3154 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3156 Name
:= 'mmGameCustomMenu';
3157 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3158 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3159 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3160 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3161 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3162 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3163 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3165 Menu
.DefControl
:= 'mmGameCustomMenu';
3166 Menu
.MainWindow
:= True;
3167 Menu
.OnClose
:= ProcGMClose
;
3168 Menu
.OnShow
:= ProcGMShow
;
3169 g_GUI_AddWindow(Menu
);
3171 Menu
:= TGUIWindow
.Create('GameServerMenu');
3172 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3174 Name
:= 'mmGameServerMenu';
3175 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3176 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3177 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3178 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3179 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3181 Menu
.DefControl
:= 'mmGameServerMenu';
3182 Menu
.MainWindow
:= True;
3183 Menu
.OnClose
:= ProcGMClose
;
3184 Menu
.OnShow
:= ProcGMShow
;
3185 g_GUI_AddWindow(Menu
);
3187 Menu
:= TGUIWindow
.Create('GameClientMenu');
3188 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3190 Name
:= 'mmGameClientMenu';
3191 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3192 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3193 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3195 Menu
.DefControl
:= 'mmGameClientMenu';
3196 Menu
.MainWindow
:= True;
3197 Menu
.OnClose
:= ProcGMClose
;
3198 Menu
.OnShow
:= ProcGMShow
;
3199 g_GUI_AddWindow(Menu
);
3201 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3202 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3204 Name
:= 'mClientPasswordMenu';
3205 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3213 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3216 Menu
.DefControl
:= 'mClientPasswordMenu';
3217 g_GUI_AddWindow(Menu
);
3219 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3220 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3222 Name
:= 'mGameSetGameMenu';
3223 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3225 Name
:= 'swTeamDamage';
3226 AddItem(_lc
[I_MENU_YES
]);
3227 AddItem(_lc
[I_MENU_NO
]);
3230 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3232 Name
:= 'edTimeLimit';
3237 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3239 Name
:= 'edGoalLimit';
3244 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3246 Name
:= 'edMaxLives';
3251 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3254 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3255 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3256 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3262 Menu
.DefControl
:= 'mGameSetGameMenu';
3263 Menu
.OnClose
:= ProcApplyGameSet
;
3264 g_GUI_AddWindow(Menu
);
3266 Menu
:= TGUIWindow
.Create('TeamMenu');
3267 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3269 Name
:= 'mmTeamMenu';
3270 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3271 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3272 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3273 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3274 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3276 Menu
.DefControl
:= 'mmTeamMenu';
3277 Menu
.OnShow
:= ProcChangePlayers
;
3278 g_GUI_AddWindow(Menu
);
3281 procedure g_Menu_Show_SaveMenu();
3283 if g_Game_IsTestMap
then
3285 if gGameSettings
.GameType
= GT_SINGLE
then
3286 g_GUI_ShowWindow('GameSingleMenu')
3289 if g_Game_IsClient
then
3292 if g_Game_IsNet
then
3295 g_GUI_ShowWindow('GameCustomMenu');
3297 g_GUI_ShowWindow('SaveMenu');
3298 g_Sound_PlayEx('MENU_OPEN');
3301 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3303 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3304 if gGameSettings
.GameType
= GT_SINGLE
then
3306 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3310 if g_Game_IsClient
then exit
;
3311 if g_Game_IsNet
then exit
;
3312 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3314 g_GUI_ShowWindow('LoadMenu');
3315 g_Sound_PlayEx('MENU_OPEN');
3318 procedure g_Menu_Show_GameSetGame();
3320 if gGameSettings
.GameType
= GT_SINGLE
then
3321 g_GUI_ShowWindow('GameSingleMenu')
3324 if g_Game_IsClient
then
3327 if g_Game_IsNet
then
3328 g_GUI_ShowWindow('GameServerMenu')
3330 g_GUI_ShowWindow('GameCustomMenu');
3333 g_GUI_ShowWindow('GameSetGameMenu');
3334 g_Sound_PlayEx('MENU_OPEN');
3337 procedure g_Menu_Show_OptionsVideo();
3339 if gGameSettings
.GameType
= GT_SINGLE
then
3340 g_GUI_ShowWindow('GameSingleMenu')
3343 if g_Game_IsClient
then
3344 g_GUI_ShowWindow('GameClientMenu')
3346 if g_Game_IsNet
then
3347 g_GUI_ShowWindow('GameServerMenu')
3349 g_GUI_ShowWindow('GameCustomMenu');
3352 g_GUI_ShowWindow('OptionsMenu');
3353 g_GUI_ShowWindow('OptionsVideoMenu');
3354 g_Sound_PlayEx('MENU_OPEN');
3357 procedure g_Menu_Show_OptionsSound();
3359 if gGameSettings
.GameType
= GT_SINGLE
then
3360 g_GUI_ShowWindow('GameSingleMenu')
3363 if g_Game_IsClient
then
3364 g_GUI_ShowWindow('GameClientMenu')
3366 if g_Game_IsNet
then
3367 g_GUI_ShowWindow('GameServerMenu')
3369 g_GUI_ShowWindow('GameCustomMenu');
3372 g_GUI_ShowWindow('OptionsMenu');
3373 g_GUI_ShowWindow('OptionsSoundMenu');
3374 g_Sound_PlayEx('MENU_OPEN');
3377 procedure g_Menu_Show_EndGameMenu();
3379 g_GUI_ShowWindow('EndGameMenu');
3380 g_Sound_PlayEx('MENU_OPEN');
3383 procedure g_Menu_Show_QuitGameMenu();
3385 g_GUI_ShowWindow('ExitMenu');
3386 g_Sound_PlayEx('MENU_OPEN');
3389 procedure g_Menu_Init();
3396 procedure g_Menu_Free();
3400 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3405 procedure g_Menu_Reset();
3409 g_GUI_SaveMenuPos();
3410 ex
:= g_GUI_Destroy();
3414 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3419 g_Game_SetDebugMode();
3421 g_GUI_LoadMenuPos();