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, either version 3 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 {$INCLUDE ../shared/a_modes.inc}
21 procedure g_Menu_Init();
22 procedure g_Menu_Free();
23 procedure g_Menu_Reset();
24 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
25 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
26 procedure g_Menu_AskLanguage();
28 procedure g_Menu_Show_SaveMenu();
29 procedure g_Menu_Show_LoadMenu(standalone
: Boolean=false);
30 procedure g_Menu_Show_GameSetGame();
31 procedure g_Menu_Show_OptionsVideo();
32 procedure g_Menu_Show_OptionsSound();
33 procedure g_Menu_Show_EndGameMenu();
34 procedure g_Menu_Show_QuitGameMenu();
38 gMenuSmallFont
: DWORD
;
45 g_gui
, g_textures
, e_graphics
, g_main
, g_window
, g_game
, g_map
,
46 g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
, g_weapons
,
47 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
48 MAPDEF
, wadreader
, Math
, g_saveload
,
49 e_texture
, GL
, GLExt
, g_language
,
50 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
,
54 type TYNCallback
= procedure (yes
:Boolean);
56 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
58 if win
.UserData
= nil then exit
;
60 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
61 IK_N
: TYNCallback(win
.UserData
)(false);
65 procedure YesButtonCB (ctl
: TGUITextButton
);
67 if ctl
.UserData
= nil then exit
;
68 TYNCallback(ctl
.UserData
)(true);
71 procedure NoButtonCB (ctl
: TGUITextButton
);
73 if ctl
.UserData
= nil then exit
;
74 TYNCallback(ctl
.UserData
)(false);
77 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
81 //if length(Text) = 0 then exit;
82 Result
:= TGUIWindow
.Create(WinName
);
85 //OnKeyDownEx := @YNKeyDownProc;
86 //UserData := @ActionProc;
87 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
90 Name
:= '__temp_yes_no_menu:'+WinName
;
92 AddText(Text, MaxLen
);
93 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
94 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
96 DefControl
:= '__temp_yes_no_menu:'+WinName
;
102 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
103 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
105 procedure ProcApplyOptions();
110 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
112 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
116 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
117 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
118 glLegacyNPOT
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
120 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
122 g_Sound_SetupAllVolumes(
123 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
124 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
127 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
128 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
129 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
130 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
132 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
134 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
135 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
136 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
137 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
139 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
144 else gGibsCount
:= 48;
147 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
148 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
149 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
150 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
151 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
152 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
153 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
154 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
155 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
157 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
159 with menu
, gGameControls
.GameControls
do
161 TakeScreenshot
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
;
162 Stat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
;
163 Chat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
;
164 TeamChat
:= TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
;
167 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
168 with menu
, gGameControls
.P1Control
do
170 KeyRight
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
;
171 KeyLeft
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
;
172 KeyUp
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
;
173 KeyDown
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
;
174 KeyFire
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
;
175 KeyJump
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
;
176 KeyNextWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
;
177 KeyPrevWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
;
178 KeyOpen
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
;
179 KeyStrafe
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
;
181 KeyRight2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
;
182 KeyLeft2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
;
183 KeyUp2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
;
184 KeyDown2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
;
185 KeyFire2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
;
186 KeyJump2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
;
187 KeyNextWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
;
188 KeyPrevWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
;
189 KeyOpen2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
;
190 KeyStrafe2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
;
193 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
194 with menu
, gGameControls
.P1Control
do
196 for i
:= WP_FIRST
to WP_LAST
do
198 KeyWeapon
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
;
199 KeyWeapon2
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
;
203 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
204 with menu
, gGameControls
.P2Control
do
206 KeyRight
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
;
207 KeyLeft
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
;
208 KeyUp
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
;
209 KeyDown
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
;
210 KeyFire
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
;
211 KeyJump
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
;
212 KeyNextWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
;
213 KeyPrevWeapon
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
;
214 KeyOpen
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
;
215 KeyStrafe
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
;
217 KeyRight2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
;
218 KeyLeft2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
;
219 KeyUp2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
;
220 KeyDown2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
;
221 KeyFire2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
;
222 KeyJump2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
;
223 KeyNextWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
;
224 KeyPrevWeapon2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
;
225 KeyOpen2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
;
226 KeyStrafe2
:= TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
;
229 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
230 with menu
, gGameControls
.P2Control
do
232 for i
:= WP_FIRST
to WP_LAST
do
234 KeyWeapon
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
;
235 KeyWeapon2
[i
] := TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
;
239 if e_JoysticksAvailable
> 0 then
241 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
244 for i
:= 0 to e_JoysticksAvailable
-1 do
245 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20);
249 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
251 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
252 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
253 TEAM_RED
, TEAM_BLUE
);
255 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
257 gPlayer1Settings
.Model
:= Model
.Name
;
258 gPlayer1Settings
.Color
:= Model
.Color
;
261 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
263 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
264 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
265 TEAM_RED
, TEAM_BLUE
);
266 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
268 gPlayer2Settings
.Model
:= Model
.Name
;
269 gPlayer2Settings
.Color
:= Model
.Color
;
272 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= 'Player1';
273 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= 'Player2';
275 if g_Game_IsServer
then
277 if gPlayer1
<> nil then
279 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
280 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
281 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
282 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
284 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
287 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
290 if gPlayer2
<> nil then
292 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
293 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
294 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
295 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
297 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
302 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
304 g_Options_Write(GameDir
+'/'+CONFIG_FILENAME
);
307 procedure ReadOptions();
312 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
314 with TGUISwitch(menu
.GetControl('swBPP')) do
320 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
321 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
323 with TGUISwitch(menu
.GetControl('swVSync')) do
324 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
326 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
327 if not glLegacyNPOT
then ItemIndex
:= 0 else ItemIndex
:= 1;
329 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
331 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
332 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
333 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
335 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
336 if gMuteWhenInactive
then
341 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
343 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
344 if gSoundEffectsDF
then
349 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
350 with menu
, gGameControls
.P1Control
do
352 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
353 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
354 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
355 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
356 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
357 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
358 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
359 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
360 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
361 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
363 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
364 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
365 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
366 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
367 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
368 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
369 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
370 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
371 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
372 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
375 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
376 with menu
, gGameControls
.P1Control
do
378 for i
:= WP_FIRST
to WP_LAST
do
380 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
381 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
385 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
386 with menu
, gGameControls
.P2Control
do
388 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= KeyRight
;
389 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= KeyLeft
;
390 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= KeyUp
;
391 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= KeyDown
;
392 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= KeyFire
;
393 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= KeyJump
;
394 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= KeyNextWeapon
;
395 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= KeyPrevWeapon
;
396 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= KeyOpen
;
397 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= KeyStrafe
;
399 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= KeyRight2
;
400 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= KeyLeft2
;
401 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= KeyUp2
;
402 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= KeyDown2
;
403 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= KeyFire2
;
404 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= KeyJump2
;
405 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= KeyNextWeapon2
;
406 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= KeyPrevWeapon2
;
407 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= KeyOpen2
;
408 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= KeyStrafe2
;
411 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
412 with menu
, gGameControls
.P2Control
do
414 for i
:= WP_FIRST
to WP_LAST
do
416 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= KeyWeapon
[i
];
417 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= KeyWeapon2
[i
];
421 if e_JoysticksAvailable
> 0 then
423 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
426 for i
:= 0 to e_JoysticksAvailable
-1 do
427 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20);
431 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
432 with menu
, gGameControls
.GameControls
do
434 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= TakeScreenshot
;
435 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= Stat
;
436 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= Chat
;
437 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= TeamChat
;
440 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
442 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
443 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
444 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
445 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
446 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
448 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
451 with TGUISwitch(menu
.GetControl('swBloodType')) do
452 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
454 with TGUISwitch(menu
.GetControl('swCorpseType')) do
455 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
457 with TGUISwitch(menu
.GetControl('swGibsType')) do
458 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
460 with TGUISwitch(menu
.GetControl('swGibsCount')) do
469 with TGUISwitch(menu
.GetControl('swBackGround')) do
470 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
472 with TGUISwitch(menu
.GetControl('swMessages')) do
473 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
475 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
476 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
478 with TGUISwitch(menu
.GetControl('swChatBubble')) do
479 ItemIndex
:= gChatBubble
;
481 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
483 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
484 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
486 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
487 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
489 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
490 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
491 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
493 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
495 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
496 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
498 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
499 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
501 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
502 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
503 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
505 ProcSelectModel(nil);
508 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
510 // don't turn off monsters in DM
512 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
513 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
514 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
516 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
519 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
520 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
521 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
522 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
526 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
528 // don't turn off monsters in DM
530 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
531 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
532 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
534 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
537 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
538 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
539 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
540 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
544 procedure ProcStartCustomGame();
550 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
552 Map
:= TGUILabel(GetControl('lbMap')).Text;
555 if not isWadPath(Map
) then
558 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
559 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
560 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
561 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
562 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
564 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
565 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
566 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
567 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
570 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
572 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
574 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
576 Options
:= Options
or GAME_OPTION_MONSTERS
;
577 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
579 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
581 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
582 gcBotsVS
:= 'Monsters';
585 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
586 gcBotsVS
:= 'Everybody';
589 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
590 gcBotsVS
:= 'Players';
597 g_Options_Write_Gameplay_Custom(GameDir
+'/'+CONFIG_FILENAME
);
599 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
600 gcMaxLives
, Options
, gcPlayers
);
604 procedure ProcStartNetGame();
610 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
612 Map
:= TGUILabel(GetControl('lbMap')).Text;
615 if not isWadPath(Map
) then
618 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
619 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
620 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
621 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
622 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
623 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
625 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
626 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
627 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
628 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
631 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
633 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
635 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
637 Options
:= Options
or GAME_OPTION_MONSTERS
;
638 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
640 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
642 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
643 gnBotsVS
:= 'Monsters';
646 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
647 gnBotsVS
:= 'Everybody';
650 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
651 gnBotsVS
:= 'Players';
656 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
657 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
658 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
659 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
660 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
663 g_Options_Write_Net_Server(GameDir
+'/'+CONFIG_FILENAME
);
664 g_Options_Write_Gameplay_Net(GameDir
+'/'+CONFIG_FILENAME
);
666 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
667 Options
, gnPlayers
, 0, NetPort
);
670 procedure ProcConnectNetGame();
674 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
676 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
677 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
678 PW
:= TGUIEdit(GetControl('edPW')).Text;
681 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
682 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
685 procedure ProcEnterPassword();
689 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
691 NetClientIP
:= PromptIP
;
692 NetClientPort
:= PromptPort
;
693 PW
:= TGUIEdit(GetControl('edPW')).Text;
696 g_Options_Write_Net_Client(GameDir
+'/'+CONFIG_FILENAME
);
697 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
700 procedure ProcServerlist();
702 if not NetInitDone
then
704 if (not g_Net_Init()) then
706 g_Console_Add('NET: ERROR: Failed to init ENet!');
713 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
);
715 gState
:= STATE_SLIST
;
716 g_ActiveWindow
:= nil;
718 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
723 slReturnPressed
:= True;
724 if g_Net_Slist_Fetch(slCurrent
) then
726 if slCurrent
= nil then
727 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
730 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
733 procedure ProcStartCampaign();
739 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
741 WAD
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsWAD')).SelectedItem());
742 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
749 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
752 procedure ProcSelectMap(Sender
: TGUIControl
);
756 wad
, map
, res
: String;
758 win
:= g_GUI_GetWindow('SelectMapMenu');
759 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
761 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
762 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
764 if (wad
= '') or (map
= '') then
765 begin // Ýòî íå êàðòà
766 TGUILabel(GetControl('lbMapName')).Text := '';
767 TGUILabel(GetControl('lbMapAuthor')).Text := '';
768 TGUILabel(GetControl('lbMapSize')).Text := '';
769 TGUIMemo(GetControl('meMapDescription')).SetText('');
770 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
771 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
777 a
:= g_Map_GetMapInfo(res
);
779 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
780 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
781 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
782 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
783 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
784 TGUILabel(win
.GetControl('lbMapScale')).Text :=
785 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
790 procedure ProcSelectWAD(Sender
: TGUIControl
);
795 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
797 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
799 with TGUIListBox(GetControl('lsMapRes')) do
805 list
:= g_Map_GetMapsList(wad
);
819 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
825 win
:= g_GUI_GetWindow('CampaignMenu');
826 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
828 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
832 TGUILabel(GetControl('lbWADName')).Text := '';
833 TGUILabel(GetControl('lbWADAuthor')).Text := '';
834 TGUIMemo(GetControl('meWADDescription')).SetText('');
837 a
:= g_Game_GetMegaWADInfo(wad
);
839 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
840 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
841 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
843 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
847 fn
:= g_ExtractWadName(a
.pic
);
849 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
851 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
856 procedure ProcChangeColor(Sender
: TGUIControl
);
860 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
861 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
862 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
863 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
864 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
865 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
867 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
868 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
869 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
870 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
871 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
872 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
875 procedure ProcSelectModel(Sender
: TGUIControl
);
880 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
881 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
882 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
884 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
885 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
886 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
888 ProcChangeColor(nil);
891 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
903 wad
:= TWADFile
.Create
;
904 if wad
.ReadFile(GameWAD
) then
905 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
910 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
912 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
913 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
914 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
915 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
917 if g_Texture_Get('FONT_STD', ID
) then
918 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
923 if cfglen
<> 0 then FreeMem(cfgdata
);
926 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
932 cfgdata
, fntdata
: Pointer;
933 cfglen
, fntlen
: Integer;
941 wad
:= TWADFile
.Create
;
942 if wad
.ReadFile(GameWAD
) then
944 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
945 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
951 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
952 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
953 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
955 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
956 FontID
:= e_CharFont_Create(spc
);
960 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
961 if chrwidth
= 0 then Continue
;
963 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
965 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
971 if cfglen
<> 0 then FreeMem(cfgdata
);
972 if fntlen
<> 0 then FreeMem(fntdata
);
975 procedure MenuLoadData();
977 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
979 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
980 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
981 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
982 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
983 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
984 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
985 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
986 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
987 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
988 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
989 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
990 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
991 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
992 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
993 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
994 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
995 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
996 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
997 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
998 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
999 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1000 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1001 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1002 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1004 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1005 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1006 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1007 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1008 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1009 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1010 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1013 procedure MenuFreeData();
1015 e_CharFont_Remove(gMenuFont
);
1016 e_CharFont_Remove(gMenuSmallFont
);
1018 g_Texture_Delete('MAINMENU_MARKER1');
1019 g_Texture_Delete('MAINMENU_MARKER2');
1020 g_Texture_Delete('SCROLL_LEFT');
1021 g_Texture_Delete('SCROLL_RIGHT');
1022 g_Texture_Delete('SCROLL_MIDDLE');
1023 g_Texture_Delete('SCROLL_MARKER');
1024 g_Texture_Delete('EDIT_LEFT');
1025 g_Texture_Delete('EDIT_RIGHT');
1026 g_Texture_Delete('EDIT_MIDDLE');
1027 g_Texture_Delete('BOX1');
1028 g_Texture_Delete('BOX2');
1029 g_Texture_Delete('BOX3');
1030 g_Texture_Delete('BOX4');
1031 g_Texture_Delete('BOX5');
1032 g_Texture_Delete('BOX6');
1033 g_Texture_Delete('BOX7');
1034 g_Texture_Delete('BOX8');
1035 g_Texture_Delete('BOX9');
1036 g_Texture_Delete('BSCROLL_UP_A');
1037 g_Texture_Delete('BSCROLL_UP_U');
1038 g_Texture_Delete('BSCROLL_DOWN_A');
1039 g_Texture_Delete('BSCROLL_DOWN_U');
1040 g_Texture_Delete('BSCROLL_MIDDLE');
1041 g_Texture_Delete('NOPIC');
1043 g_Sound_Delete('MENU_SELECT');
1044 g_Sound_Delete('MENU_OPEN');
1045 g_Sound_Delete('MENU_CLOSE');
1046 g_Sound_Delete('MENU_CHANGE');
1047 g_Sound_Delete('SCROLL_ADD');
1048 g_Sound_Delete('SCROLL_SUB');
1049 g_Sound_Delete('SOUND_PLAYER_FALL');
1052 procedure ProcAuthorsMenu();
1054 gMusic
.SetByName('MUSIC_INTERMUS');
1058 procedure ProcExitMenuKeyDown (yes
: Boolean);
1061 snd
: TPlayableSound
;
1066 g_Game_StopAllSounds(True);
1067 case (Random(18)) of
1068 0: s
:= 'SOUND_MONSTER_PAIN';
1069 1: s
:= 'SOUND_MONSTER_DIE_3';
1070 2: s
:= 'SOUND_MONSTER_SLOP';
1071 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1072 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1073 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1074 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1075 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1076 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1077 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1078 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1079 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1080 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1081 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1082 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1083 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1084 else s
:= 'SOUND_PLAYER_FALL';
1086 snd
:= TPlayableSound
.Create();
1087 res
:= snd
.SetByName(s
);
1088 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1092 while snd
.IsPlaying() do begin end;
1100 procedure ProcLoadMenu();
1107 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1108 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1109 TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
)).Enabled
:= valid
;
1113 procedure ProcSaveMenu();
1121 name
:= g_GetSaveName(a
, valid
);
1122 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1123 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1127 procedure ProcSaveGame(Sender
: TGUIControl
);
1131 if g_Game_IsNet
then Exit
;
1132 if g_Game_IsTestMap
then Exit
;
1133 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1134 g_Game_PauseAllSounds(True);
1135 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1137 g_ActiveWindow
:= nil;
1138 g_Game_Pause(False);
1141 procedure ProcLoadGame(Sender
: TGUIControl
);
1145 if g_Game_IsNet
then Exit
;
1146 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1147 if g_LoadGame(a
) then
1148 g_Game_PauseAllSounds(False)
1149 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1150 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1153 procedure ProcSingle1Player();
1155 g_Game_StartSingle(gDefaultMegawadStart
, False, 1);
1158 procedure ProcSingle2Players();
1160 g_Game_StartSingle(gDefaultMegawadStart
, True, 2);
1163 procedure ProcSelectMapMenu();
1166 wad_lb
: TGUIFileListBox
;
1167 map_lb
: TGUIListBox
;
1170 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1171 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1172 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1174 if wad_lb
.SelectedItem() <> '' then
1175 map
:= map_lb
.SelectedItem()
1179 wad_lb
.UpdateFileList();
1182 if wad_lb
.SelectedItem() <> '' then
1185 map_lb
.SelectItem(map
);
1187 if map_lb
.SelectedItem() <> '' then
1191 g_GUI_ShowWindow('SelectMapMenu');
1194 procedure ProcSelectCampaignMenu();
1197 wad_lb
: TGUIFileListBox
;
1199 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1200 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1202 wad_lb
.UpdateFileList();
1204 if wad_lb
.SelectedItem() <> '' then
1205 ProcSelectCampaignWAD(nil);
1208 procedure ProcSetMap();
1210 wad
, map
, res
: String;
1212 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1214 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1215 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1218 if (wad
= '') or (map
= '') then
1221 res
:= wad
+':\'+map
;
1223 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1224 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1227 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1231 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1233 g_Sound_SetupAllVolumes(
1234 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1235 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1239 procedure ProcOptionsPlayersMIMenu();
1244 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1246 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1248 if a
= '' then Exit
;
1250 b
:= g_PlayerModel_GetInfo(a
);
1252 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1254 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1255 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1256 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1258 if b
.HaveWeapon
then
1259 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1261 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1264 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1267 procedure ProcOptionsPlayersAnim();
1271 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1276 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1279 Model
.GetCurrentAnimation
.Loop
:= True;
1280 Model
.GetCurrentAnimationMask
.Loop
:= True;
1284 procedure ProcOptionsPlayersWeap();
1288 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1293 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1297 procedure ProcOptionsPlayersRot();
1301 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1302 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1304 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1308 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1312 g_Options_SetDefault();
1318 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1320 if yes
then ReadOptions();
1324 procedure ProcAuthorsClose();
1326 gMusic
.SetByName('MUSIC_MENU');
1328 gState
:= STATE_MENU
;
1331 procedure ProcGMClose();
1333 g_Game_InGameMenu(False);
1336 procedure ProcGMShow();
1341 if (gGameSettings
.GameType
= GT_SINGLE
) and
1342 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1343 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1344 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1346 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1347 if g_Game_IsTestMap
then
1348 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1349 TGUIMainMenu(g_ActiveWindow
.GetControl(
1350 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1353 procedure ProcChangePlayers();
1355 TeamGame
, Spectator
, AddTwo
: Boolean;
1356 P1Team
{, P2Team}: Byte;
1357 bP2
: TGUITextButton
;
1359 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1360 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1361 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1362 P1Team
:= TEAM_NONE
;
1363 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1365 //P2Team := TEAM_NONE;
1366 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1368 TGUIMainMenu(g_ActiveWindow
.GetControl(
1369 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1370 TGUIMainMenu(g_ActiveWindow
.GetControl(
1371 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1372 TGUIMainMenu(g_ActiveWindow
.GetControl(
1373 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1375 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1376 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1377 bP2
.Enabled
:= AddTwo
and not Spectator
;
1379 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1381 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1382 if gPlayer2
= nil then
1383 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1385 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1387 TGUIMainMenu(g_ActiveWindow
.GetControl(
1388 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1391 procedure ProcJoinRed();
1393 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1395 if g_Game_IsServer
then
1397 if gPlayer1
= nil then
1398 g_Game_AddPlayer(TEAM_RED
)
1401 if gPlayer1
.Team
<> TEAM_RED
then
1403 gPlayer1
.SwitchTeam
;
1404 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1407 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1412 gPlayer1Settings
.Team
:= TEAM_RED
;
1413 MC_SEND_PlayerSettings
;
1414 if gPlayer1
= nil then
1415 g_Game_AddPlayer(TEAM_RED
);
1417 g_ActiveWindow
:= nil;
1418 g_Game_Pause(False);
1421 procedure ProcJoinBlue();
1423 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1425 if g_Game_IsServer
then
1427 if gPlayer1
= nil then
1428 g_Game_AddPlayer(TEAM_BLUE
)
1431 if gPlayer1
.Team
<> TEAM_BLUE
then
1433 gPlayer1
.SwitchTeam
;
1434 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1437 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1442 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1443 MC_SEND_PlayerSettings
;
1444 if gPlayer1
= nil then
1445 g_Game_AddPlayer(TEAM_BLUE
);
1447 g_ActiveWindow
:= nil;
1448 g_Game_Pause(False);
1451 procedure ProcJoinGame();
1453 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1455 if gPlayer1
= nil then
1457 g_ActiveWindow
:= nil;
1458 g_Game_Pause(False);
1461 procedure ProcSwitchP2();
1463 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1465 if gPlayer1
= nil then
1467 if gPlayer2
= nil then
1470 g_Game_RemovePlayer();
1471 g_ActiveWindow
:= nil;
1472 g_Game_Pause(False);
1475 procedure ProcSpectate();
1477 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1480 g_ActiveWindow
:= nil;
1481 g_Game_Pause(False);
1484 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1486 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1489 procedure ProcEndMenuKeyDown (yes
: Boolean);
1491 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1494 procedure ProcSetRussianLanguage();
1496 if gLanguage
<> LANGUAGE_RUSSIAN
then
1498 gLanguage
:= LANGUAGE_RUSSIAN
;
1499 gLanguageChange
:= True;
1500 gAskLanguage
:= False;
1502 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1504 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1509 procedure ProcSetEnglishLanguage();
1511 if gLanguage
<> LANGUAGE_ENGLISH
then
1513 gLanguage
:= LANGUAGE_ENGLISH
;
1514 gLanguageChange
:= True;
1515 gAskLanguage
:= False;
1517 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1519 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1524 procedure ReadGameSettings();
1528 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1530 with gGameSettings
do
1532 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1533 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1538 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1539 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1540 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1542 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1543 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1544 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1547 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1552 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1554 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1555 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1556 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1557 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1558 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1559 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1560 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1561 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1565 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1566 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1571 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1572 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1577 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1578 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1583 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1584 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1589 procedure ProcApplyGameSet();
1593 stat
: TPlayerStatArray
;
1595 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1597 if not g_Game_IsServer
then Exit
;
1599 with gGameSettings
do
1601 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1603 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1604 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1606 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1609 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1611 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1617 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1619 TimeLimit
:= Max(n
, b
);
1623 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1625 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1632 if GameMode
= GM_DM
then
1634 stat
:= g_Player_GetStats();
1636 for a
:= 0 to High(stat
) do
1637 if stat
[a
].Frags
> b
then
1641 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1643 GoalLimit
:= Max(n
, b
);
1647 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1649 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1650 if n
< 0 then n
:= 0;
1651 if n
> 255 then n
:= 255;
1657 stat
:= g_Player_GetStats();
1659 for a
:= 0 to High(stat
) do
1660 if stat
[a
].Lives
> b
then
1663 MaxLives
:= Max(n
, b
);
1667 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1669 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1672 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1673 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1677 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1678 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1682 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1683 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1689 if g_Game_IsNet
then MH_SEND_GameSettings
;
1692 procedure ProcVideoOptionsRes();
1698 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1700 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1701 IntToStr(gScreenWidth
) +
1702 ' x ' + IntToStr(gScreenHeight
) +
1703 ', ' + IntToStr(gBPP
) + ' bpp';
1705 with TGUIListBox(menu
.GetControl('lsResolution')) do
1707 list
:= GetDisplayModes(gBPP
, SR
);
1718 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1725 procedure ProcApplyVideoOptions();
1728 Fullscreen
: Boolean;
1729 SWidth
, SHeight
: Integer;
1732 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1734 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1735 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1737 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1739 if (SWidth
<> gScreenWidth
) or
1740 (SHeight
<> gScreenHeight
) or
1741 (Fullscreen
<> gFullscreen
) then
1743 gResolutionChange
:= True;
1744 gRC_Width
:= SWidth
;
1745 gRC_Height
:= SHeight
;
1746 gRC_FullScreen
:= Fullscreen
;
1747 gRC_Maximized
:= gWinMaximized
;
1750 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1754 procedure ProcSetFirstRussianLanguage();
1756 gLanguage
:= LANGUAGE_RUSSIAN
;
1757 gLanguageChange
:= True;
1758 gAskLanguage
:= False;
1760 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1763 procedure ProcSetFirstEnglishLanguage();
1765 gLanguage
:= LANGUAGE_ENGLISH
;
1766 gLanguageChange
:= True;
1767 gAskLanguage
:= False;
1769 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1772 procedure ProcRecallAddress();
1774 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1776 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1777 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1781 procedure CreateFirstLanguageMenu();
1785 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1787 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1789 Name
:= 'mmFirstLanguageMenu';
1790 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1791 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1794 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1795 Menu
.MainWindow
:= True;
1796 g_GUI_AddWindow(Menu
);
1799 procedure g_Menu_AskLanguage();
1801 CreateFirstLanguageMenu();
1802 g_GUI_ShowWindow('FirstLanguageMenu');
1805 procedure CreatePlayerOptionsMenu(s
: String);
1810 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1812 a
:= _lc
[I_MENU_PLAYER_1
]
1814 a
:= _lc
[I_MENU_PLAYER_2
];
1815 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1817 Name
:= 'mOptionsPlayers'+s
+'Menu';
1818 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1820 Name
:= 'ed'+s
+'Name';
1824 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1826 Name
:= 'sw'+s
+'Team';
1827 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1828 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1830 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1832 Name
:= 'ls'+s
+'Model';
1834 Items
:= g_PlayerModel_GetNames();
1835 OnChange
:= ProcSelectModel
;
1837 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1839 Name
:= 'sc'+s
+'Red';
1841 OnChange
:= ProcChangeColor
;
1843 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1845 Name
:= 'sc'+s
+'Green';
1847 OnChange
:= ProcChangeColor
;
1849 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1851 Name
:= 'sc'+s
+'Blue';
1853 OnChange
:= ProcChangeColor
;
1856 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1857 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1858 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1859 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1861 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1863 Name
:= 'mv'+s
+'Model';
1864 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1865 Y
:= GetControl('ls'+s
+'Model').Y
;
1868 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1869 g_GUI_AddWindow(Menu
);
1872 procedure CreateAllMenus();
1876 a
, cx
, _y
, i
: Integer;
1879 Menu
:= TGUIWindow
.Create('MainMenu');
1880 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1882 Name
:= 'mmMainMenu';
1883 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1884 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1885 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1886 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1887 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1888 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1890 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1892 Color
:= _RGB(255, 255, 255);
1893 X
:= gScreenWidth
-GetWidth
-8;
1894 Y
:= gScreenHeight
-GetHeight
-8;
1896 Menu
.DefControl
:= 'mmMainMenu';
1897 Menu
.MainWindow
:= True;
1898 g_GUI_AddWindow(Menu
);
1900 Menu
:= TGUIWindow
.Create('NewGameMenu');
1901 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1903 Name
:= 'mmNewGameMenu';
1904 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1905 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1906 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1907 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1909 Menu
.DefControl
:= 'mmNewGameMenu';
1910 g_GUI_AddWindow(Menu
);
1912 Menu
:= TGUIWindow
.Create('NetGameMenu');
1913 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1915 Name
:= 'mmNetGameMenu';
1916 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1917 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1919 Menu
.DefControl
:= 'mmNetGameMenu';
1920 g_GUI_AddWindow(Menu
);
1922 Menu
:= TGUIWindow
.Create('NetServerMenu');
1923 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1925 Name
:= 'mNetServerMenu';
1926 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1928 Name
:= 'edSrvName';
1929 OnlyDigits
:= False;
1932 Text := NetServerName
;
1934 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
1936 Name
:= 'edSrvPassword';
1937 OnlyDigits
:= False;
1940 Text := NetPassword
;
1942 with AddEdit(_lc
[I_NET_PORT
]) do
1948 Text := IntToStr(NetPort
);
1950 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
1952 Name
:= 'edMaxPlayers';
1956 Text := IntToStr(NetMaxClients
);
1958 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
1960 Name
:= 'swUseMaster';
1961 AddItem(_lc
[I_MENU_YES
]);
1962 AddItem(_lc
[I_MENU_NO
]);
1963 if NetUseMaster
then
1969 with AddLabel(_lc
[I_MENU_MAP
]) do
1974 OnClick
:= @ProcSelectMapMenu
;
1976 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
1978 Name
:= 'swGameMode';
1979 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
1980 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
1981 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
1982 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
1983 case g_Game_TextToMode(gnGameMode
) of
1985 GM_DM
: ItemIndex
:= 0;
1986 GM_TDM
: ItemIndex
:= 1;
1987 GM_CTF
: ItemIndex
:= 2;
1989 GM_COOP
: ItemIndex
:= 3;
1991 OnChange
:= ProcSwitchMonstersNet
;
1993 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
1995 Name
:= 'edTimeLimit';
1999 if gnTimeLimit
> 0 then
2000 Text := IntToStr(gnTimeLimit
);
2002 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2004 Name
:= 'edGoalLimit';
2008 if gnGoalLimit
> 0 then
2009 Text := IntToStr(gnGoalLimit
);
2011 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2013 Name
:= 'edMaxLives';
2017 if gnMaxLives
> 0 then
2018 Text := IntToStr(gnMaxLives
);
2020 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2022 Name
:= 'swPlayers';
2023 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2024 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2025 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2026 ItemIndex
:= gnPlayers
;
2028 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2030 Name
:= 'swTeamDamage';
2031 AddItem(_lc
[I_MENU_YES
]);
2032 AddItem(_lc
[I_MENU_NO
]);
2033 if gnTeamDamage
then
2038 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2040 Name
:= 'swEnableExits';
2041 AddItem(_lc
[I_MENU_YES
]);
2042 AddItem(_lc
[I_MENU_NO
]);
2048 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2050 Name
:= 'swWeaponStay';
2051 AddItem(_lc
[I_MENU_YES
]);
2052 AddItem(_lc
[I_MENU_NO
]);
2053 if gnWeaponStay
then
2058 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2060 Name
:= 'swMonsters';
2061 AddItem(_lc
[I_MENU_YES
]);
2062 AddItem(_lc
[I_MENU_NO
]);
2068 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2071 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2072 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2073 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2075 if gnBotsVS
= 'Players' then
2077 if gnBotsVS
= 'Monsters' then
2081 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2085 Menu
.DefControl
:= 'mNetServerMenu';
2086 g_GUI_AddWindow(Menu
);
2088 Menu
:= TGUIWindow
.Create('NetClientMenu');
2089 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2091 Name
:= 'mNetClientMenu';
2093 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2096 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2102 Text := 'localhost';
2104 with AddEdit(_lc
[I_NET_PORT
]) do
2112 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2115 OnlyDigits
:= False;
2122 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2126 Menu
.DefControl
:= 'mNetClientMenu';
2127 g_GUI_AddWindow(Menu
);
2129 Menu
:= TGUIWindow
.Create('LoadMenu');
2130 Menu
.OnShow
:= ProcLoadMenu
;
2131 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2133 Name
:= 'mmLoadMenu';
2138 Name
:= 'edSlot'+IntToStr(a
);
2141 OnEnter
:= ProcLoadGame
;
2144 Menu
.DefControl
:= 'mmLoadMenu';
2145 g_GUI_AddWindow(Menu
);
2147 Menu
:= TGUIWindow
.Create('SaveMenu');
2148 Menu
.OnShow
:= ProcSaveMenu
;
2149 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2151 Name
:= 'mmSaveMenu';
2156 Name
:= 'edSlot'+IntToStr(a
);
2159 OnChange
:= ProcSaveGame
;
2162 Menu
.DefControl
:= 'mmSaveMenu';
2163 g_GUI_AddWindow(Menu
);
2165 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2166 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2168 Name
:= 'mCustomGameMenu';
2169 with AddLabel(_lc
[I_MENU_MAP
]) do
2174 OnClick
:= @ProcSelectMapMenu
;
2176 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2178 Name
:= 'swGameMode';
2179 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2180 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2181 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2182 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2183 case g_Game_TextToMode(gcGameMode
) of
2185 GM_DM
: ItemIndex
:= 0;
2186 GM_TDM
: ItemIndex
:= 1;
2187 GM_CTF
: ItemIndex
:= 2;
2189 GM_COOP
: ItemIndex
:= 3;
2191 OnChange
:= ProcSwitchMonstersCustom
;
2193 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2195 Name
:= 'edTimeLimit';
2199 if gcTimeLimit
> 0 then
2200 Text := IntToStr(gcTimeLimit
);
2202 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2204 Name
:= 'edGoalLimit';
2208 if gcGoalLimit
> 0 then
2209 Text := IntToStr(gcGoalLimit
);
2211 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2213 Name
:= 'edMaxLives';
2217 if gcMaxLives
> 0 then
2218 Text := IntToStr(gcMaxLives
);
2220 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2222 Name
:= 'swPlayers';
2223 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2224 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2225 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2226 ItemIndex
:= gcPlayers
;
2228 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2230 Name
:= 'swTeamDamage';
2231 AddItem(_lc
[I_MENU_YES
]);
2232 AddItem(_lc
[I_MENU_NO
]);
2233 if gcTeamDamage
then
2238 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2240 Name
:= 'swEnableExits';
2241 AddItem(_lc
[I_MENU_YES
]);
2242 AddItem(_lc
[I_MENU_NO
]);
2248 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2250 Name
:= 'swWeaponStay';
2251 AddItem(_lc
[I_MENU_YES
]);
2252 AddItem(_lc
[I_MENU_NO
]);
2253 if gcWeaponStay
then
2258 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2260 Name
:= 'swMonsters';
2261 AddItem(_lc
[I_MENU_YES
]);
2262 AddItem(_lc
[I_MENU_NO
]);
2268 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2271 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2272 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2273 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2275 if gcBotsVS
= 'Players' then
2277 if gcBotsVS
= 'Monsters' then
2281 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2285 Menu
.DefControl
:= 'mCustomGameMenu';
2286 g_GUI_AddWindow(Menu
);
2288 Menu
:= TGUIWindow
.Create('CampaignMenu');
2289 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2291 Name
:= 'mCampaignMenu';
2300 with AddFileList('', 15, 4) do
2303 OnChange
:= ProcSelectCampaignWAD
;
2307 FileMask
:= '*.wad|*.pk3|*.zip';
2308 SetBase(MapsDir
+'megawads/');
2311 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2313 Name
:= 'lbWADName';
2317 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2319 Name
:= 'lbWADAuthor';
2323 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2324 with AddMemo('', 15, 3) do
2326 Name
:= 'meWADDescription';
2327 Color
:= MENU_ITEMSCTRL_COLOR
;
2329 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2331 Name
:= 'swPlayers';
2332 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2333 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2336 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2340 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2342 Name
:= 'mpWADImage';
2343 DefaultRes
:= 'NOPIC';
2344 X
:= GetControl('lsWAD').X
+4;
2345 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2348 Menu
.DefControl
:= 'mCampaignMenu';
2349 g_GUI_AddWindow(Menu
);
2351 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2352 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2354 Name
:= 'mSelectMapMenu';
2355 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2358 OnChange
:= ProcSelectWAD
;
2362 FileMask
:= '*.wad|*.pk3|*.zip';
2365 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2369 OnChange
:= ProcSelectMap
;
2372 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2374 Name
:= 'lbMapName';
2378 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2380 Name
:= 'lbMapAuthor';
2384 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2386 Name
:= 'lbMapSize';
2390 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2392 Name
:= 'meMapDescription';
2397 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2399 Name
:= 'mpMapPreview';
2400 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2401 Y
:= GetControl('lsMapWAD').Y
;
2403 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2405 Name
:= 'lbMapScale';
2408 Color
:= MENU_ITEMSCTRL_COLOR
;
2409 X
:= GetControl('lsMapWAD').X
+
2410 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2411 2 + MAPPREVIEW_WIDTH
*4;
2412 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2415 Menu
.OnClose
:= ProcSetMap
;
2416 Menu
.DefControl
:= 'mSelectMapMenu';
2417 g_GUI_AddWindow(Menu
);
2419 Menu
:= TGUIWindow
.Create('OptionsMenu');
2420 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2422 Name
:= 'mmOptionsMenu';
2423 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2424 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2425 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2426 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2427 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2428 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2430 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2431 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2433 Menu
.OnClose
:= ProcApplyOptions
;
2434 Menu
.DefControl
:= 'mmOptionsMenu';
2435 g_GUI_AddWindow(Menu
);
2437 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2438 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2439 g_GUI_AddWindow(Menu
);
2441 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2442 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2444 Name
:= 'mOptionsVideoMenu';
2445 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2446 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2452 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2455 AddItem(_lc
[I_MENU_YES
]);
2456 AddItem(_lc
[I_MENU_NO
]);
2458 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2460 Name
:= 'swTextureFilter';
2461 AddItem(_lc
[I_MENU_YES
]);
2462 AddItem(_lc
[I_MENU_NO
]);
2464 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2466 Name
:= 'swLegacyNPOT';
2467 AddItem(_lc
[I_MENU_NO
]);
2468 AddItem(_lc
[I_MENU_YES
]);
2471 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2474 Menu
.DefControl
:= 'mOptionsVideoMenu';
2475 g_GUI_AddWindow(Menu
);
2477 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2478 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2480 Name
:= 'mOptionsVideoResMenu';
2481 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2483 Name
:= 'lbCurrentRes';
2487 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2489 Name
:= 'lsResolution';
2492 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2494 Name
:= 'swFullScreen';
2495 AddItem(_lc
[I_MENU_YES
]);
2496 AddItem(_lc
[I_MENU_NO
]);
2499 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2502 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2503 g_GUI_AddWindow(Menu
);
2505 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2506 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2508 Name
:= 'mOptionsSoundMenu';
2509 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2511 Name
:= 'scMusicLevel';
2513 OnChange
:= ProcChangeSoundSettings
;
2515 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2517 Name
:= 'scSoundLevel';
2519 OnChange
:= ProcChangeSoundSettings
;
2521 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2523 Name
:= 'scMaxSimSounds';
2526 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2528 Name
:= 'swAnnouncer';
2529 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2530 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2531 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2532 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2534 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2535 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2537 Name
:= 'swSoundEffects';
2538 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2539 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2541 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2543 Name
:= 'swInactiveSounds';
2544 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2545 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2549 Menu
.DefControl
:= 'mOptionsSoundMenu';
2550 g_GUI_AddWindow(Menu
);
2552 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2553 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2555 Name
:= 'mOptionsGameMenu';
2556 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2558 Name
:= 'scParticlesCount';
2561 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2563 Name
:= 'swBloodCount';
2564 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2565 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2566 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2567 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2568 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2570 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2572 Name
:= 'scShellsMax';
2575 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2577 Name
:= 'scGibsMax';
2580 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2582 Name
:= 'scCorpsesMax';
2585 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2587 Name
:= 'swGibsCount';
2588 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2589 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2590 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2591 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2592 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2594 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2596 Name
:= 'swCorpseType';
2597 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2598 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2600 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2602 Name
:= 'swGibsType';
2603 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2604 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2606 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2608 Name
:= 'swBloodType';
2609 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2610 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2612 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2614 Name
:= 'swScreenFlash';
2615 AddItem(_lc
[I_MENU_NO
]);
2616 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2617 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2619 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2621 Name
:= 'swBackground';
2622 AddItem(_lc
[I_MENU_YES
]);
2623 AddItem(_lc
[I_MENU_NO
]);
2625 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2627 Name
:= 'swMessages';
2628 AddItem(_lc
[I_MENU_YES
]);
2629 AddItem(_lc
[I_MENU_NO
]);
2631 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2633 Name
:= 'swRevertPlayers';
2634 AddItem(_lc
[I_MENU_YES
]);
2635 AddItem(_lc
[I_MENU_NO
]);
2637 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2639 Name
:= 'swChatBubble';
2640 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2641 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2642 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2643 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2644 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2648 Menu
.DefControl
:= 'mOptionsGameMenu';
2649 g_GUI_AddWindow(Menu
);
2651 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2652 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2654 Name
:= 'mOptionsControlsMenu';
2655 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2656 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2657 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2658 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2659 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2661 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2662 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2663 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2664 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2665 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2666 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2668 if e_JoysticksAvailable
<> 0 then
2669 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2671 Menu
.DefControl
:= 'mOptionsControlsMenu';
2672 g_GUI_AddWindow(Menu
);
2674 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2675 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2677 Name
:= 'mOptionsControlsP1Menu';
2678 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2679 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2680 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2681 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2682 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2683 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2684 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2685 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2686 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2687 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2689 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2690 g_GUI_AddWindow(Menu
);
2692 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2693 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2695 Name
:= 'mOptionsControlsP1MenuWeapons';
2696 for i
:= WP_FIRST
to WP_LAST
do
2697 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2698 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2700 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2701 g_GUI_AddWindow(Menu
);
2703 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2704 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2706 Name
:= 'mOptionsControlsP2Menu';
2707 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2708 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2709 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2710 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2711 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2712 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2713 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2714 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2715 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2716 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2718 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2719 g_GUI_AddWindow(Menu
);
2721 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2722 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2724 Name
:= 'mOptionsControlsP2MenuWeapons';
2725 for i
:= WP_FIRST
to WP_LAST
do
2726 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2727 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2729 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2730 g_GUI_AddWindow(Menu
);
2732 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2733 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2735 Name
:= 'mOptionsControlsJoystickMenu';
2736 for i
:= 0 to e_JoysticksAvailable
-1 do
2737 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2739 Name
:= 'scDeadzone' + IntToStr(i
);
2743 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2744 g_GUI_AddWindow(Menu
);
2746 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2747 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2749 Name
:= 'mOptionsPlayersMenu';
2750 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2751 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2753 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2754 g_GUI_AddWindow(Menu
);
2756 CreatePlayerOptionsMenu('P1');
2757 CreatePlayerOptionsMenu('P2');
2759 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2760 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2762 Name
:= 'mOptionsPlayersMIMenu';
2763 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2768 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2773 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2775 Name
:= 'meComment';
2778 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2779 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2782 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2786 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2787 g_GUI_AddWindow(Menu
);
2789 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2790 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2792 Name
:= 'mOptionsLanguageMenu';
2793 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2794 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2797 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2798 g_GUI_AddWindow(Menu
);
2800 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2801 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2802 g_GUI_AddWindow(Menu
);
2804 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2805 Menu
.BackTexture
:= 'INTER';
2806 Menu
.OnClose
:= ProcAuthorsClose
;
2810 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2812 Color
:= _RGB(255, 0, 0);
2813 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2815 _y
:= _y
+GetHeight();
2817 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2819 Color
:= _RGB(255, 0, 0);
2820 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2822 _y
:= _y
+GetHeight()+32;
2824 // ×òî äåëàë: Êòî äåëàë
2825 cx
:= gScreenWidth
div 2 - 320 + 64;
2826 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
2828 Color
:= _RGB(255, 0, 0);
2833 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
2835 Color
:= _RGB(255, 255, 255);
2840 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
2842 Color
:= _RGB(255, 0, 0);
2847 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
2849 Color
:= _RGB(255, 255, 255);
2854 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
2856 Color
:= _RGB(255, 255, 255);
2861 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
2863 Color
:= _RGB(255, 0, 0);
2868 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
2870 Color
:= _RGB(255, 255, 255);
2875 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
2877 Color
:= _RGB(255, 0, 0);
2882 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
2884 Color
:= _RGB(255, 255, 255);
2887 _y
:= gScreenHeight
- 128;
2890 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
2892 Color
:= _RGB(255, 0, 0);
2897 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
2899 Color
:= _RGB(255, 255, 255);
2902 _y
:= _y
+GetHeight();
2904 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
2906 Color
:= _RGB(255, 255, 255);
2909 _y
:= _y
+GetHeight();
2911 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
2913 Color
:= _RGB(255, 255, 255);
2916 _y
:= gScreenHeight
- 32;
2918 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
2920 Color
:= _RGB(255, 0, 0);
2921 X
:= gScreenWidth
div 2 - GetWidth() div 2;
2924 g_GUI_AddWindow(Menu
);
2926 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
2927 gMenuSmallFont
, @ProcExitMenuKeyDown
);
2928 g_GUI_AddWindow(Menu
);
2930 Menu
:= TGUIWindow
.Create('GameSingleMenu');
2931 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2933 Name
:= 'mmGameSingleMenu';
2934 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2935 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2936 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2937 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2938 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2939 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2941 Menu
.DefControl
:= 'mmGameSingleMenu';
2942 Menu
.MainWindow
:= True;
2943 Menu
.OnClose
:= ProcGMClose
;
2944 Menu
.OnShow
:= ProcGMShow
;
2945 g_GUI_AddWindow(Menu
);
2947 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
2948 gMenuSmallFont
, @ProcEndMenuKeyDown
);
2949 g_GUI_AddWindow(Menu
);
2951 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
2952 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
2953 g_GUI_AddWindow(Menu
);
2955 Menu
:= TGUIWindow
.Create('GameCustomMenu');
2956 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2958 Name
:= 'mmGameCustomMenu';
2959 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2960 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2961 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2962 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2963 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2964 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2965 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2967 Menu
.DefControl
:= 'mmGameCustomMenu';
2968 Menu
.MainWindow
:= True;
2969 Menu
.OnClose
:= ProcGMClose
;
2970 Menu
.OnShow
:= ProcGMShow
;
2971 g_GUI_AddWindow(Menu
);
2973 Menu
:= TGUIWindow
.Create('GameServerMenu');
2974 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2976 Name
:= 'mmGameServerMenu';
2977 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2978 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2979 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2980 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2981 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2983 Menu
.DefControl
:= 'mmGameServerMenu';
2984 Menu
.MainWindow
:= True;
2985 Menu
.OnClose
:= ProcGMClose
;
2986 Menu
.OnShow
:= ProcGMShow
;
2987 g_GUI_AddWindow(Menu
);
2989 Menu
:= TGUIWindow
.Create('GameClientMenu');
2990 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2992 Name
:= 'mmGameClientMenu';
2993 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2994 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2995 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2997 Menu
.DefControl
:= 'mmGameClientMenu';
2998 Menu
.MainWindow
:= True;
2999 Menu
.OnClose
:= ProcGMClose
;
3000 Menu
.OnShow
:= ProcGMShow
;
3001 g_GUI_AddWindow(Menu
);
3003 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3004 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3006 Name
:= 'mClientPasswordMenu';
3007 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3015 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3018 Menu
.DefControl
:= 'mClientPasswordMenu';
3019 g_GUI_AddWindow(Menu
);
3021 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3022 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3024 Name
:= 'mGameSetGameMenu';
3025 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3027 Name
:= 'swTeamDamage';
3028 AddItem(_lc
[I_MENU_YES
]);
3029 AddItem(_lc
[I_MENU_NO
]);
3032 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3034 Name
:= 'edTimeLimit';
3039 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3041 Name
:= 'edGoalLimit';
3046 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3048 Name
:= 'edMaxLives';
3053 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3056 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3057 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3058 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3064 Menu
.DefControl
:= 'mGameSetGameMenu';
3065 Menu
.OnClose
:= ProcApplyGameSet
;
3066 g_GUI_AddWindow(Menu
);
3068 Menu
:= TGUIWindow
.Create('TeamMenu');
3069 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3071 Name
:= 'mmTeamMenu';
3072 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3073 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3074 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3075 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3076 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3078 Menu
.DefControl
:= 'mmTeamMenu';
3079 Menu
.OnShow
:= ProcChangePlayers
;
3080 g_GUI_AddWindow(Menu
);
3083 procedure g_Menu_Show_SaveMenu();
3085 if g_Game_IsTestMap
then
3087 if gGameSettings
.GameType
= GT_SINGLE
then
3088 g_GUI_ShowWindow('GameSingleMenu')
3091 if g_Game_IsClient
then
3094 if g_Game_IsNet
then
3097 g_GUI_ShowWindow('GameCustomMenu');
3099 g_GUI_ShowWindow('SaveMenu');
3100 g_Sound_PlayEx('MENU_OPEN');
3103 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3105 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3106 if gGameSettings
.GameType
= GT_SINGLE
then
3108 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3112 if g_Game_IsClient
then exit
;
3113 if g_Game_IsNet
then exit
;
3114 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3116 g_GUI_ShowWindow('LoadMenu');
3117 g_Sound_PlayEx('MENU_OPEN');
3120 procedure g_Menu_Show_GameSetGame();
3122 if gGameSettings
.GameType
= GT_SINGLE
then
3123 g_GUI_ShowWindow('GameSingleMenu')
3126 if g_Game_IsClient
then
3129 if g_Game_IsNet
then
3130 g_GUI_ShowWindow('GameServerMenu')
3132 g_GUI_ShowWindow('GameCustomMenu');
3135 g_GUI_ShowWindow('GameSetGameMenu');
3136 g_Sound_PlayEx('MENU_OPEN');
3139 procedure g_Menu_Show_OptionsVideo();
3141 if gGameSettings
.GameType
= GT_SINGLE
then
3142 g_GUI_ShowWindow('GameSingleMenu')
3145 if g_Game_IsClient
then
3146 g_GUI_ShowWindow('GameClientMenu')
3148 if g_Game_IsNet
then
3149 g_GUI_ShowWindow('GameServerMenu')
3151 g_GUI_ShowWindow('GameCustomMenu');
3154 g_GUI_ShowWindow('OptionsMenu');
3155 g_GUI_ShowWindow('OptionsVideoMenu');
3156 g_Sound_PlayEx('MENU_OPEN');
3159 procedure g_Menu_Show_OptionsSound();
3161 if gGameSettings
.GameType
= GT_SINGLE
then
3162 g_GUI_ShowWindow('GameSingleMenu')
3165 if g_Game_IsClient
then
3166 g_GUI_ShowWindow('GameClientMenu')
3168 if g_Game_IsNet
then
3169 g_GUI_ShowWindow('GameServerMenu')
3171 g_GUI_ShowWindow('GameCustomMenu');
3174 g_GUI_ShowWindow('OptionsMenu');
3175 g_GUI_ShowWindow('OptionsSoundMenu');
3176 g_Sound_PlayEx('MENU_OPEN');
3179 procedure g_Menu_Show_EndGameMenu();
3181 g_GUI_ShowWindow('EndGameMenu');
3182 g_Sound_PlayEx('MENU_OPEN');
3185 procedure g_Menu_Show_QuitGameMenu();
3187 g_GUI_ShowWindow('ExitMenu');
3188 g_Sound_PlayEx('MENU_OPEN');
3191 procedure g_Menu_Init();
3198 procedure g_Menu_Free();
3202 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3207 procedure g_Menu_Reset();
3211 g_GUI_SaveMenuPos();
3212 ex
:= g_GUI_Destroy();
3216 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3221 g_Game_SetDebugMode();
3223 g_GUI_LoadMenuPos();