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
, 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
1149 g_Game_PauseAllSounds(False)
1151 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1153 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1154 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1155 //g_ActiveWindow := nil;
1159 procedure ProcSingle1Player();
1161 g_Game_StartSingle(gDefaultMegawadStart
, False, 1);
1164 procedure ProcSingle2Players();
1166 g_Game_StartSingle(gDefaultMegawadStart
, True, 2);
1169 procedure ProcSelectMapMenu();
1172 wad_lb
: TGUIFileListBox
;
1173 map_lb
: TGUIListBox
;
1176 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1177 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1178 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1180 if wad_lb
.SelectedItem() <> '' then
1181 map
:= map_lb
.SelectedItem()
1185 wad_lb
.UpdateFileList();
1188 if wad_lb
.SelectedItem() <> '' then
1191 map_lb
.SelectItem(map
);
1193 if map_lb
.SelectedItem() <> '' then
1197 g_GUI_ShowWindow('SelectMapMenu');
1200 procedure ProcSelectCampaignMenu();
1203 wad_lb
: TGUIFileListBox
;
1205 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1206 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1208 wad_lb
.UpdateFileList();
1210 if wad_lb
.SelectedItem() <> '' then
1211 ProcSelectCampaignWAD(nil);
1214 procedure ProcSetMap();
1216 wad
, map
, res
: String;
1218 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1220 wad
:= ExtractRelativePath(MapsDir
, TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem());
1221 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1224 if (wad
= '') or (map
= '') then
1227 res
:= wad
+':\'+map
;
1229 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1230 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1233 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1237 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1239 g_Sound_SetupAllVolumes(
1240 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1241 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1245 procedure ProcOptionsPlayersMIMenu();
1250 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1252 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1254 if a
= '' then Exit
;
1256 b
:= g_PlayerModel_GetInfo(a
);
1258 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1260 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1261 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1262 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1264 if b
.HaveWeapon
then
1265 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1267 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1270 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1273 procedure ProcOptionsPlayersAnim();
1277 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1282 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1285 Model
.GetCurrentAnimation
.Loop
:= True;
1286 Model
.GetCurrentAnimationMask
.Loop
:= True;
1290 procedure ProcOptionsPlayersWeap();
1294 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1299 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1303 procedure ProcOptionsPlayersRot();
1307 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1308 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1310 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1314 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1318 g_Options_SetDefault();
1324 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1326 if yes
then ReadOptions();
1330 procedure ProcAuthorsClose();
1332 gMusic
.SetByName('MUSIC_MENU');
1334 gState
:= STATE_MENU
;
1337 procedure ProcGMClose();
1339 g_Game_InGameMenu(False);
1342 procedure ProcGMShow();
1347 if (gGameSettings
.GameType
= GT_SINGLE
) and
1348 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1349 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1350 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1352 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1353 if g_Game_IsTestMap
then
1354 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1355 TGUIMainMenu(g_ActiveWindow
.GetControl(
1356 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1359 procedure ProcChangePlayers();
1361 TeamGame
, Spectator
, AddTwo
: Boolean;
1362 P1Team
{, P2Team}: Byte;
1363 bP2
: TGUITextButton
;
1365 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1366 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1367 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1368 P1Team
:= TEAM_NONE
;
1369 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1371 //P2Team := TEAM_NONE;
1372 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1374 TGUIMainMenu(g_ActiveWindow
.GetControl(
1375 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1376 TGUIMainMenu(g_ActiveWindow
.GetControl(
1377 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1378 TGUIMainMenu(g_ActiveWindow
.GetControl(
1379 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1381 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1382 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1383 bP2
.Enabled
:= AddTwo
and not Spectator
;
1385 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1387 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1388 if gPlayer2
= nil then
1389 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1391 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1393 TGUIMainMenu(g_ActiveWindow
.GetControl(
1394 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1397 procedure ProcJoinRed();
1399 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1401 if g_Game_IsServer
then
1403 if gPlayer1
= nil then
1404 g_Game_AddPlayer(TEAM_RED
)
1407 if gPlayer1
.Team
<> TEAM_RED
then
1409 gPlayer1
.SwitchTeam
;
1410 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1413 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1418 gPlayer1Settings
.Team
:= TEAM_RED
;
1419 MC_SEND_PlayerSettings
;
1420 if gPlayer1
= nil then
1421 g_Game_AddPlayer(TEAM_RED
);
1423 g_ActiveWindow
:= nil;
1424 g_Game_Pause(False);
1427 procedure ProcJoinBlue();
1429 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1431 if g_Game_IsServer
then
1433 if gPlayer1
= nil then
1434 g_Game_AddPlayer(TEAM_BLUE
)
1437 if gPlayer1
.Team
<> TEAM_BLUE
then
1439 gPlayer1
.SwitchTeam
;
1440 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1443 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1448 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1449 MC_SEND_PlayerSettings
;
1450 if gPlayer1
= nil then
1451 g_Game_AddPlayer(TEAM_BLUE
);
1453 g_ActiveWindow
:= nil;
1454 g_Game_Pause(False);
1457 procedure ProcJoinGame();
1459 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1461 if gPlayer1
= nil then
1463 g_ActiveWindow
:= nil;
1464 g_Game_Pause(False);
1467 procedure ProcSwitchP2();
1469 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1471 if gPlayer1
= nil then
1473 if gPlayer2
= nil then
1476 g_Game_RemovePlayer();
1477 g_ActiveWindow
:= nil;
1478 g_Game_Pause(False);
1481 procedure ProcSpectate();
1483 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1486 g_ActiveWindow
:= nil;
1487 g_Game_Pause(False);
1490 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1492 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1495 procedure ProcEndMenuKeyDown (yes
: Boolean);
1497 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1500 procedure ProcSetRussianLanguage();
1502 if gLanguage
<> LANGUAGE_RUSSIAN
then
1504 gLanguage
:= LANGUAGE_RUSSIAN
;
1505 gLanguageChange
:= True;
1506 gAskLanguage
:= False;
1508 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1510 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1515 procedure ProcSetEnglishLanguage();
1517 if gLanguage
<> LANGUAGE_ENGLISH
then
1519 gLanguage
:= LANGUAGE_ENGLISH
;
1520 gLanguageChange
:= True;
1521 gAskLanguage
:= False;
1523 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1525 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1530 procedure ReadGameSettings();
1534 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1536 with gGameSettings
do
1538 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1539 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1544 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1545 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1546 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1548 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1549 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1550 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1553 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1558 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1560 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1561 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1562 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1563 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1564 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1565 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1566 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1567 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1571 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1572 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1577 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1578 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1583 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1584 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1589 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1590 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1595 procedure ProcApplyGameSet();
1599 stat
: TPlayerStatArray
;
1601 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1603 if not g_Game_IsServer
then Exit
;
1605 with gGameSettings
do
1607 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1609 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1610 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1612 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1615 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1617 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1623 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1625 TimeLimit
:= Max(n
, b
);
1629 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1631 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1638 if GameMode
= GM_DM
then
1640 stat
:= g_Player_GetStats();
1642 for a
:= 0 to High(stat
) do
1643 if stat
[a
].Frags
> b
then
1647 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1649 GoalLimit
:= Max(n
, b
);
1653 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1655 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1656 if n
< 0 then n
:= 0;
1657 if n
> 255 then n
:= 255;
1663 stat
:= g_Player_GetStats();
1665 for a
:= 0 to High(stat
) do
1666 if stat
[a
].Lives
> b
then
1669 MaxLives
:= Max(n
, b
);
1673 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1675 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1678 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1679 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1683 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1684 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1688 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1689 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1695 if g_Game_IsNet
then MH_SEND_GameSettings
;
1698 procedure ProcVideoOptionsRes();
1704 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1706 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1707 IntToStr(gScreenWidth
) +
1708 ' x ' + IntToStr(gScreenHeight
) +
1709 ', ' + IntToStr(gBPP
) + ' bpp';
1711 with TGUIListBox(menu
.GetControl('lsResolution')) do
1713 list
:= GetDisplayModes(gBPP
, SR
);
1724 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1731 procedure ProcApplyVideoOptions();
1734 Fullscreen
: Boolean;
1735 SWidth
, SHeight
: Integer;
1738 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1740 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1741 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
]);
1743 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1745 if (SWidth
<> gScreenWidth
) or
1746 (SHeight
<> gScreenHeight
) or
1747 (Fullscreen
<> gFullscreen
) then
1749 gResolutionChange
:= True;
1750 gRC_Width
:= SWidth
;
1751 gRC_Height
:= SHeight
;
1752 gRC_FullScreen
:= Fullscreen
;
1753 gRC_Maximized
:= gWinMaximized
;
1756 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1760 procedure ProcSetFirstRussianLanguage();
1762 gLanguage
:= LANGUAGE_RUSSIAN
;
1763 gLanguageChange
:= True;
1764 gAskLanguage
:= False;
1766 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1769 procedure ProcSetFirstEnglishLanguage();
1771 gLanguage
:= LANGUAGE_ENGLISH
;
1772 gLanguageChange
:= True;
1773 gAskLanguage
:= False;
1775 g_Options_Write_Language(GameDir
+'/'+CONFIG_FILENAME
);
1778 procedure ProcRecallAddress();
1780 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1782 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1783 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1787 procedure CreateFirstLanguageMenu();
1791 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1793 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, ' '))) do
1795 Name
:= 'mmFirstLanguageMenu';
1796 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1797 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1800 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1801 Menu
.MainWindow
:= True;
1802 g_GUI_AddWindow(Menu
);
1805 procedure g_Menu_AskLanguage();
1807 CreateFirstLanguageMenu();
1808 g_GUI_ShowWindow('FirstLanguageMenu');
1811 procedure CreatePlayerOptionsMenu(s
: String);
1816 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
1818 a
:= _lc
[I_MENU_PLAYER_1
]
1820 a
:= _lc
[I_MENU_PLAYER_2
];
1821 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
1823 Name
:= 'mOptionsPlayers'+s
+'Menu';
1824 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
1826 Name
:= 'ed'+s
+'Name';
1830 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
1832 Name
:= 'sw'+s
+'Team';
1833 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
1834 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
1836 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
1838 Name
:= 'ls'+s
+'Model';
1840 Items
:= g_PlayerModel_GetNames();
1841 OnChange
:= ProcSelectModel
;
1843 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
1845 Name
:= 'sc'+s
+'Red';
1847 OnChange
:= ProcChangeColor
;
1849 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
1851 Name
:= 'sc'+s
+'Green';
1853 OnChange
:= ProcChangeColor
;
1855 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
1857 Name
:= 'sc'+s
+'Blue';
1859 OnChange
:= ProcChangeColor
;
1862 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
1863 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
1864 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
1865 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
1867 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
1869 Name
:= 'mv'+s
+'Model';
1870 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
1871 Y
:= GetControl('ls'+s
+'Model').Y
;
1874 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
1875 g_GUI_AddWindow(Menu
);
1878 procedure CreateAllMenus();
1882 a
, cx
, _y
, i
: Integer;
1885 Menu
:= TGUIWindow
.Create('MainMenu');
1886 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
1888 Name
:= 'mmMainMenu';
1889 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
1890 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
1891 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
1892 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
1893 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
1894 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
1896 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
1898 Color
:= _RGB(255, 255, 255);
1899 X
:= gScreenWidth
-GetWidth
-8;
1900 Y
:= gScreenHeight
-GetHeight
-8;
1902 Menu
.DefControl
:= 'mmMainMenu';
1903 Menu
.MainWindow
:= True;
1904 g_GUI_AddWindow(Menu
);
1906 Menu
:= TGUIWindow
.Create('NewGameMenu');
1907 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_NEW_GAME
]))) do
1909 Name
:= 'mmNewGameMenu';
1910 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
1911 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
1912 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
1913 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
1915 Menu
.DefControl
:= 'mmNewGameMenu';
1916 g_GUI_AddWindow(Menu
);
1918 Menu
:= TGUIWindow
.Create('NetGameMenu');
1919 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MULTIPLAYER
]))) do
1921 Name
:= 'mmNetGameMenu';
1922 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
1923 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
1925 Menu
.DefControl
:= 'mmNetGameMenu';
1926 g_GUI_AddWindow(Menu
);
1928 Menu
:= TGUIWindow
.Create('NetServerMenu');
1929 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
1931 Name
:= 'mNetServerMenu';
1932 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
1934 Name
:= 'edSrvName';
1935 OnlyDigits
:= False;
1938 Text := NetServerName
;
1940 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
1942 Name
:= 'edSrvPassword';
1943 OnlyDigits
:= False;
1946 Text := NetPassword
;
1948 with AddEdit(_lc
[I_NET_PORT
]) do
1954 Text := IntToStr(NetPort
);
1956 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
1958 Name
:= 'edMaxPlayers';
1962 Text := IntToStr(NetMaxClients
);
1964 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
1966 Name
:= 'swUseMaster';
1967 AddItem(_lc
[I_MENU_YES
]);
1968 AddItem(_lc
[I_MENU_NO
]);
1969 if NetUseMaster
then
1975 with AddLabel(_lc
[I_MENU_MAP
]) do
1980 OnClick
:= @ProcSelectMapMenu
;
1982 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
1984 Name
:= 'swGameMode';
1985 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
1986 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
1987 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
1988 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
1989 case g_Game_TextToMode(gnGameMode
) of
1991 GM_DM
: ItemIndex
:= 0;
1992 GM_TDM
: ItemIndex
:= 1;
1993 GM_CTF
: ItemIndex
:= 2;
1995 GM_COOP
: ItemIndex
:= 3;
1997 OnChange
:= ProcSwitchMonstersNet
;
1999 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2001 Name
:= 'edTimeLimit';
2005 if gnTimeLimit
> 0 then
2006 Text := IntToStr(gnTimeLimit
);
2008 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2010 Name
:= 'edGoalLimit';
2014 if gnGoalLimit
> 0 then
2015 Text := IntToStr(gnGoalLimit
);
2017 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2019 Name
:= 'edMaxLives';
2023 if gnMaxLives
> 0 then
2024 Text := IntToStr(gnMaxLives
);
2026 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2028 Name
:= 'swPlayers';
2029 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2030 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2031 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2032 ItemIndex
:= gnPlayers
;
2034 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2036 Name
:= 'swTeamDamage';
2037 AddItem(_lc
[I_MENU_YES
]);
2038 AddItem(_lc
[I_MENU_NO
]);
2039 if gnTeamDamage
then
2044 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2046 Name
:= 'swEnableExits';
2047 AddItem(_lc
[I_MENU_YES
]);
2048 AddItem(_lc
[I_MENU_NO
]);
2054 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2056 Name
:= 'swWeaponStay';
2057 AddItem(_lc
[I_MENU_YES
]);
2058 AddItem(_lc
[I_MENU_NO
]);
2059 if gnWeaponStay
then
2064 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2066 Name
:= 'swMonsters';
2067 AddItem(_lc
[I_MENU_YES
]);
2068 AddItem(_lc
[I_MENU_NO
]);
2074 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2077 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2078 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2079 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2081 if gnBotsVS
= 'Players' then
2083 if gnBotsVS
= 'Monsters' then
2087 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2091 Menu
.DefControl
:= 'mNetServerMenu';
2092 g_GUI_AddWindow(Menu
);
2094 Menu
:= TGUIWindow
.Create('NetClientMenu');
2095 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2097 Name
:= 'mNetClientMenu';
2099 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2102 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2108 Text := 'localhost';
2110 with AddEdit(_lc
[I_NET_PORT
]) do
2118 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2121 OnlyDigits
:= False;
2128 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2132 Menu
.DefControl
:= 'mNetClientMenu';
2133 g_GUI_AddWindow(Menu
);
2135 Menu
:= TGUIWindow
.Create('LoadMenu');
2136 Menu
.OnShow
:= ProcLoadMenu
;
2137 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2139 Name
:= 'mmLoadMenu';
2144 Name
:= 'edSlot'+IntToStr(a
);
2147 OnEnter
:= ProcLoadGame
;
2150 Menu
.DefControl
:= 'mmLoadMenu';
2151 g_GUI_AddWindow(Menu
);
2153 Menu
:= TGUIWindow
.Create('SaveMenu');
2154 Menu
.OnShow
:= ProcSaveMenu
;
2155 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2157 Name
:= 'mmSaveMenu';
2162 Name
:= 'edSlot'+IntToStr(a
);
2165 OnChange
:= ProcSaveGame
;
2168 Menu
.DefControl
:= 'mmSaveMenu';
2169 g_GUI_AddWindow(Menu
);
2171 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2172 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2174 Name
:= 'mCustomGameMenu';
2175 with AddLabel(_lc
[I_MENU_MAP
]) do
2180 OnClick
:= @ProcSelectMapMenu
;
2182 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2184 Name
:= 'swGameMode';
2185 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2186 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2187 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2188 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2189 case g_Game_TextToMode(gcGameMode
) of
2191 GM_DM
: ItemIndex
:= 0;
2192 GM_TDM
: ItemIndex
:= 1;
2193 GM_CTF
: ItemIndex
:= 2;
2195 GM_COOP
: ItemIndex
:= 3;
2197 OnChange
:= ProcSwitchMonstersCustom
;
2199 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2201 Name
:= 'edTimeLimit';
2205 if gcTimeLimit
> 0 then
2206 Text := IntToStr(gcTimeLimit
);
2208 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2210 Name
:= 'edGoalLimit';
2214 if gcGoalLimit
> 0 then
2215 Text := IntToStr(gcGoalLimit
);
2217 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2219 Name
:= 'edMaxLives';
2223 if gcMaxLives
> 0 then
2224 Text := IntToStr(gcMaxLives
);
2226 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2228 Name
:= 'swPlayers';
2229 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2230 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2231 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2232 ItemIndex
:= gcPlayers
;
2234 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2236 Name
:= 'swTeamDamage';
2237 AddItem(_lc
[I_MENU_YES
]);
2238 AddItem(_lc
[I_MENU_NO
]);
2239 if gcTeamDamage
then
2244 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2246 Name
:= 'swEnableExits';
2247 AddItem(_lc
[I_MENU_YES
]);
2248 AddItem(_lc
[I_MENU_NO
]);
2254 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2256 Name
:= 'swWeaponStay';
2257 AddItem(_lc
[I_MENU_YES
]);
2258 AddItem(_lc
[I_MENU_NO
]);
2259 if gcWeaponStay
then
2264 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2266 Name
:= 'swMonsters';
2267 AddItem(_lc
[I_MENU_YES
]);
2268 AddItem(_lc
[I_MENU_NO
]);
2274 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2277 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2278 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2279 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2281 if gcBotsVS
= 'Players' then
2283 if gcBotsVS
= 'Monsters' then
2287 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2291 Menu
.DefControl
:= 'mCustomGameMenu';
2292 g_GUI_AddWindow(Menu
);
2294 Menu
:= TGUIWindow
.Create('CampaignMenu');
2295 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2297 Name
:= 'mCampaignMenu';
2306 with AddFileList('', 15, 4) do
2309 OnChange
:= ProcSelectCampaignWAD
;
2313 FileMask
:= '*.wad|*.pk3|*.zip';
2314 SetBase(MapsDir
+'megawads/');
2317 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2319 Name
:= 'lbWADName';
2323 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2325 Name
:= 'lbWADAuthor';
2329 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2330 with AddMemo('', 15, 3) do
2332 Name
:= 'meWADDescription';
2333 Color
:= MENU_ITEMSCTRL_COLOR
;
2335 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2337 Name
:= 'swPlayers';
2338 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2339 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2342 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2346 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2348 Name
:= 'mpWADImage';
2349 DefaultRes
:= 'NOPIC';
2350 X
:= GetControl('lsWAD').X
+4;
2351 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2354 Menu
.DefControl
:= 'mCampaignMenu';
2355 g_GUI_AddWindow(Menu
);
2357 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2358 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2360 Name
:= 'mSelectMapMenu';
2361 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2364 OnChange
:= ProcSelectWAD
;
2368 FileMask
:= '*.wad|*.pk3|*.zip';
2371 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2375 OnChange
:= ProcSelectMap
;
2378 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2380 Name
:= 'lbMapName';
2384 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2386 Name
:= 'lbMapAuthor';
2390 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2392 Name
:= 'lbMapSize';
2396 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2398 Name
:= 'meMapDescription';
2403 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2405 Name
:= 'mpMapPreview';
2406 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2407 Y
:= GetControl('lsMapWAD').Y
;
2409 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2411 Name
:= 'lbMapScale';
2414 Color
:= MENU_ITEMSCTRL_COLOR
;
2415 X
:= GetControl('lsMapWAD').X
+
2416 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2417 2 + MAPPREVIEW_WIDTH
*4;
2418 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2421 Menu
.OnClose
:= ProcSetMap
;
2422 Menu
.DefControl
:= 'mSelectMapMenu';
2423 g_GUI_AddWindow(Menu
);
2425 Menu
:= TGUIWindow
.Create('OptionsMenu');
2426 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_OPTIONS
]))) do
2428 Name
:= 'mmOptionsMenu';
2429 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2430 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2431 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2432 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2433 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2434 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2436 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2437 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2439 Menu
.OnClose
:= ProcApplyOptions
;
2440 Menu
.DefControl
:= 'mmOptionsMenu';
2441 g_GUI_AddWindow(Menu
);
2443 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2444 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2445 g_GUI_AddWindow(Menu
);
2447 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2448 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2450 Name
:= 'mOptionsVideoMenu';
2451 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2452 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2458 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2461 AddItem(_lc
[I_MENU_YES
]);
2462 AddItem(_lc
[I_MENU_NO
]);
2464 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2466 Name
:= 'swTextureFilter';
2467 AddItem(_lc
[I_MENU_YES
]);
2468 AddItem(_lc
[I_MENU_NO
]);
2470 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2472 Name
:= 'swLegacyNPOT';
2473 AddItem(_lc
[I_MENU_NO
]);
2474 AddItem(_lc
[I_MENU_YES
]);
2477 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2480 Menu
.DefControl
:= 'mOptionsVideoMenu';
2481 g_GUI_AddWindow(Menu
);
2483 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2484 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2486 Name
:= 'mOptionsVideoResMenu';
2487 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2489 Name
:= 'lbCurrentRes';
2493 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2495 Name
:= 'lsResolution';
2498 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2500 Name
:= 'swFullScreen';
2501 AddItem(_lc
[I_MENU_YES
]);
2502 AddItem(_lc
[I_MENU_NO
]);
2505 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2508 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2509 g_GUI_AddWindow(Menu
);
2511 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2512 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2514 Name
:= 'mOptionsSoundMenu';
2515 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2517 Name
:= 'scMusicLevel';
2519 OnChange
:= ProcChangeSoundSettings
;
2521 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2523 Name
:= 'scSoundLevel';
2525 OnChange
:= ProcChangeSoundSettings
;
2527 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2529 Name
:= 'scMaxSimSounds';
2532 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2534 Name
:= 'swAnnouncer';
2535 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2536 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2537 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2538 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2540 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2541 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2543 Name
:= 'swSoundEffects';
2544 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2545 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2547 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2549 Name
:= 'swInactiveSounds';
2550 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2551 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2555 Menu
.DefControl
:= 'mOptionsSoundMenu';
2556 g_GUI_AddWindow(Menu
);
2558 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2559 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2561 Name
:= 'mOptionsGameMenu';
2562 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2564 Name
:= 'scParticlesCount';
2567 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2569 Name
:= 'swBloodCount';
2570 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2571 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2572 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2573 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2574 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2576 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2578 Name
:= 'scShellsMax';
2581 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2583 Name
:= 'scGibsMax';
2586 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2588 Name
:= 'scCorpsesMax';
2591 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2593 Name
:= 'swGibsCount';
2594 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2595 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2596 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2597 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2598 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2600 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2602 Name
:= 'swCorpseType';
2603 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2604 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2606 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2608 Name
:= 'swGibsType';
2609 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2610 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2612 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2614 Name
:= 'swBloodType';
2615 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2616 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2618 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2620 Name
:= 'swScreenFlash';
2621 AddItem(_lc
[I_MENU_NO
]);
2622 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2623 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2625 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2627 Name
:= 'swBackground';
2628 AddItem(_lc
[I_MENU_YES
]);
2629 AddItem(_lc
[I_MENU_NO
]);
2631 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2633 Name
:= 'swMessages';
2634 AddItem(_lc
[I_MENU_YES
]);
2635 AddItem(_lc
[I_MENU_NO
]);
2637 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2639 Name
:= 'swRevertPlayers';
2640 AddItem(_lc
[I_MENU_YES
]);
2641 AddItem(_lc
[I_MENU_NO
]);
2643 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2645 Name
:= 'swChatBubble';
2646 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2647 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2648 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2649 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2650 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2654 Menu
.DefControl
:= 'mOptionsGameMenu';
2655 g_GUI_AddWindow(Menu
);
2657 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2658 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2660 Name
:= 'mOptionsControlsMenu';
2661 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2662 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2663 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2664 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2665 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2667 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2668 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2669 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2670 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2671 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2672 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2674 if e_JoysticksAvailable
<> 0 then
2675 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2677 Menu
.DefControl
:= 'mOptionsControlsMenu';
2678 g_GUI_AddWindow(Menu
);
2680 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2681 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2683 Name
:= 'mOptionsControlsP1Menu';
2684 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2685 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2686 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2687 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2688 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2689 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2690 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2691 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2692 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2693 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2695 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2696 g_GUI_AddWindow(Menu
);
2698 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2699 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2701 Name
:= 'mOptionsControlsP1MenuWeapons';
2702 for i
:= WP_FIRST
to WP_LAST
do
2703 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2704 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2706 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2707 g_GUI_AddWindow(Menu
);
2709 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2710 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2712 Name
:= 'mOptionsControlsP2Menu';
2713 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2714 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2715 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2716 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2717 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2718 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2719 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2720 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2721 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2722 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2724 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2725 g_GUI_AddWindow(Menu
);
2727 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2728 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2730 Name
:= 'mOptionsControlsP2MenuWeapons';
2731 for i
:= WP_FIRST
to WP_LAST
do
2732 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2733 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2735 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2736 g_GUI_AddWindow(Menu
);
2738 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2739 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2741 Name
:= 'mOptionsControlsJoystickMenu';
2742 for i
:= 0 to e_JoysticksAvailable
-1 do
2743 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
2745 Name
:= 'scDeadzone' + IntToStr(i
);
2749 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
2750 g_GUI_AddWindow(Menu
);
2752 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
2753 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
2755 Name
:= 'mOptionsPlayersMenu';
2756 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
2757 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
2759 Menu
.DefControl
:= 'mOptionsPlayersMenu';
2760 g_GUI_AddWindow(Menu
);
2762 CreatePlayerOptionsMenu('P1');
2763 CreatePlayerOptionsMenu('P2');
2765 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
2766 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
2768 Name
:= 'mOptionsPlayersMIMenu';
2769 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
2774 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
2779 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
2781 Name
:= 'meComment';
2784 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
2785 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
2788 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
2792 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
2793 g_GUI_AddWindow(Menu
);
2795 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
2796 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
2798 Name
:= 'mOptionsLanguageMenu';
2799 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
2800 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
2803 Menu
.DefControl
:= 'mOptionsLanguageMenu';
2804 g_GUI_AddWindow(Menu
);
2806 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
2807 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
2808 g_GUI_AddWindow(Menu
);
2810 Menu
:= TGUIWindow
.Create('AuthorsMenu');
2811 Menu
.BackTexture
:= 'INTER';
2812 Menu
.OnClose
:= ProcAuthorsClose
;
2816 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
2818 Color
:= _RGB(255, 0, 0);
2819 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2821 _y
:= _y
+GetHeight();
2823 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
2825 Color
:= _RGB(255, 0, 0);
2826 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
2828 _y
:= _y
+GetHeight()+32;
2830 // ×òî äåëàë: Êòî äåëàë
2831 cx
:= gScreenWidth
div 2 - 320 + 64;
2832 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
2834 Color
:= _RGB(255, 0, 0);
2839 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
2841 Color
:= _RGB(255, 255, 255);
2846 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
2848 Color
:= _RGB(255, 0, 0);
2853 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
2855 Color
:= _RGB(255, 255, 255);
2860 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
2862 Color
:= _RGB(255, 255, 255);
2867 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
2869 Color
:= _RGB(255, 0, 0);
2874 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
2876 Color
:= _RGB(255, 255, 255);
2881 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
2883 Color
:= _RGB(255, 0, 0);
2888 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
2890 Color
:= _RGB(255, 255, 255);
2893 _y
:= gScreenHeight
- 128;
2896 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
2898 Color
:= _RGB(255, 0, 0);
2903 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
2905 Color
:= _RGB(255, 255, 255);
2908 _y
:= _y
+GetHeight();
2910 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
2912 Color
:= _RGB(255, 255, 255);
2915 _y
:= _y
+GetHeight();
2917 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
2919 Color
:= _RGB(255, 255, 255);
2922 _y
:= gScreenHeight
- 32;
2924 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
2926 Color
:= _RGB(255, 0, 0);
2927 X
:= gScreenWidth
div 2 - GetWidth() div 2;
2930 g_GUI_AddWindow(Menu
);
2932 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
2933 gMenuSmallFont
, @ProcExitMenuKeyDown
);
2934 g_GUI_AddWindow(Menu
);
2936 Menu
:= TGUIWindow
.Create('GameSingleMenu');
2937 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2939 Name
:= 'mmGameSingleMenu';
2940 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2941 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2942 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2943 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2944 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2945 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2947 Menu
.DefControl
:= 'mmGameSingleMenu';
2948 Menu
.MainWindow
:= True;
2949 Menu
.OnClose
:= ProcGMClose
;
2950 Menu
.OnShow
:= ProcGMShow
;
2951 g_GUI_AddWindow(Menu
);
2953 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
2954 gMenuSmallFont
, @ProcEndMenuKeyDown
);
2955 g_GUI_AddWindow(Menu
);
2957 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
2958 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
2959 g_GUI_AddWindow(Menu
);
2961 Menu
:= TGUIWindow
.Create('GameCustomMenu');
2962 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2964 Name
:= 'mmGameCustomMenu';
2965 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2966 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2967 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
2968 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2969 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2970 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2971 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2973 Menu
.DefControl
:= 'mmGameCustomMenu';
2974 Menu
.MainWindow
:= True;
2975 Menu
.OnClose
:= ProcGMClose
;
2976 Menu
.OnShow
:= ProcGMShow
;
2977 g_GUI_AddWindow(Menu
);
2979 Menu
:= TGUIWindow
.Create('GameServerMenu');
2980 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2982 Name
:= 'mmGameServerMenu';
2983 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
2984 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
2985 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2986 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
2987 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
2989 Menu
.DefControl
:= 'mmGameServerMenu';
2990 Menu
.MainWindow
:= True;
2991 Menu
.OnClose
:= ProcGMClose
;
2992 Menu
.OnShow
:= ProcGMShow
;
2993 g_GUI_AddWindow(Menu
);
2995 Menu
:= TGUIWindow
.Create('GameClientMenu');
2996 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_MAIN_MENU
]))) do
2998 Name
:= 'mmGameClientMenu';
2999 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3000 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3001 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3003 Menu
.DefControl
:= 'mmGameClientMenu';
3004 Menu
.MainWindow
:= True;
3005 Menu
.OnClose
:= ProcGMClose
;
3006 Menu
.OnShow
:= ProcGMShow
;
3007 g_GUI_AddWindow(Menu
);
3009 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3010 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3012 Name
:= 'mClientPasswordMenu';
3013 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3021 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3024 Menu
.DefControl
:= 'mClientPasswordMenu';
3025 g_GUI_AddWindow(Menu
);
3027 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3028 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3030 Name
:= 'mGameSetGameMenu';
3031 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3033 Name
:= 'swTeamDamage';
3034 AddItem(_lc
[I_MENU_YES
]);
3035 AddItem(_lc
[I_MENU_NO
]);
3038 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3040 Name
:= 'edTimeLimit';
3045 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3047 Name
:= 'edGoalLimit';
3052 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3054 Name
:= 'edMaxLives';
3059 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3062 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3063 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3064 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3070 Menu
.DefControl
:= 'mGameSetGameMenu';
3071 Menu
.OnClose
:= ProcApplyGameSet
;
3072 g_GUI_AddWindow(Menu
);
3074 Menu
:= TGUIWindow
.Create('TeamMenu');
3075 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3077 Name
:= 'mmTeamMenu';
3078 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3079 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3080 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3081 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3082 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3084 Menu
.DefControl
:= 'mmTeamMenu';
3085 Menu
.OnShow
:= ProcChangePlayers
;
3086 g_GUI_AddWindow(Menu
);
3089 procedure g_Menu_Show_SaveMenu();
3091 if g_Game_IsTestMap
then
3093 if gGameSettings
.GameType
= GT_SINGLE
then
3094 g_GUI_ShowWindow('GameSingleMenu')
3097 if g_Game_IsClient
then
3100 if g_Game_IsNet
then
3103 g_GUI_ShowWindow('GameCustomMenu');
3105 g_GUI_ShowWindow('SaveMenu');
3106 g_Sound_PlayEx('MENU_OPEN');
3109 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3111 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3112 if gGameSettings
.GameType
= GT_SINGLE
then
3114 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3118 if g_Game_IsClient
then exit
;
3119 if g_Game_IsNet
then exit
;
3120 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3122 g_GUI_ShowWindow('LoadMenu');
3123 g_Sound_PlayEx('MENU_OPEN');
3126 procedure g_Menu_Show_GameSetGame();
3128 if gGameSettings
.GameType
= GT_SINGLE
then
3129 g_GUI_ShowWindow('GameSingleMenu')
3132 if g_Game_IsClient
then
3135 if g_Game_IsNet
then
3136 g_GUI_ShowWindow('GameServerMenu')
3138 g_GUI_ShowWindow('GameCustomMenu');
3141 g_GUI_ShowWindow('GameSetGameMenu');
3142 g_Sound_PlayEx('MENU_OPEN');
3145 procedure g_Menu_Show_OptionsVideo();
3147 if gGameSettings
.GameType
= GT_SINGLE
then
3148 g_GUI_ShowWindow('GameSingleMenu')
3151 if g_Game_IsClient
then
3152 g_GUI_ShowWindow('GameClientMenu')
3154 if g_Game_IsNet
then
3155 g_GUI_ShowWindow('GameServerMenu')
3157 g_GUI_ShowWindow('GameCustomMenu');
3160 g_GUI_ShowWindow('OptionsMenu');
3161 g_GUI_ShowWindow('OptionsVideoMenu');
3162 g_Sound_PlayEx('MENU_OPEN');
3165 procedure g_Menu_Show_OptionsSound();
3167 if gGameSettings
.GameType
= GT_SINGLE
then
3168 g_GUI_ShowWindow('GameSingleMenu')
3171 if g_Game_IsClient
then
3172 g_GUI_ShowWindow('GameClientMenu')
3174 if g_Game_IsNet
then
3175 g_GUI_ShowWindow('GameServerMenu')
3177 g_GUI_ShowWindow('GameCustomMenu');
3180 g_GUI_ShowWindow('OptionsMenu');
3181 g_GUI_ShowWindow('OptionsSoundMenu');
3182 g_Sound_PlayEx('MENU_OPEN');
3185 procedure g_Menu_Show_EndGameMenu();
3187 g_GUI_ShowWindow('EndGameMenu');
3188 g_Sound_PlayEx('MENU_OPEN');
3191 procedure g_Menu_Show_QuitGameMenu();
3193 g_GUI_ShowWindow('ExitMenu');
3194 g_Sound_PlayEx('MENU_OPEN');
3197 procedure g_Menu_Init();
3204 procedure g_Menu_Free();
3208 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3213 procedure g_Menu_Reset();
3217 g_GUI_SaveMenuPos();
3218 ex
:= g_GUI_Destroy();
3222 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3227 g_Game_SetDebugMode();
3229 g_GUI_LoadMenuPos();