1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../shared/a_modes.inc}
20 procedure g_Menu_Init();
21 procedure g_Menu_Free();
22 procedure g_Menu_Reset();
23 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
24 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
25 procedure g_Menu_AskLanguage();
27 procedure g_Menu_Show_SaveMenu();
28 procedure g_Menu_Show_LoadMenu(standalone
: Boolean=false);
29 procedure g_Menu_Show_GameSetGame();
30 procedure g_Menu_Show_OptionsVideo();
31 procedure g_Menu_Show_OptionsSound();
32 procedure g_Menu_Show_EndGameMenu();
33 procedure g_Menu_Show_QuitGameMenu();
37 gMenuSmallFont
: DWORD
;
40 TempScale
: Integer = -1;
41 TempResScale
: Integer = -1;
46 {$INCLUDE ../nogl/noGLuses.inc}
47 g_gui
, g_textures
, e_graphics
, g_main
, g_window
, g_game
, g_map
,
48 g_basic
, g_console
, g_sound
, g_gfx
, g_player
, g_options
, g_weapons
,
49 e_log
, SysUtils
, CONFIG
, g_playermodel
, DateUtils
,
50 MAPDEF
, Math
, g_saveload
,
51 e_texture
, g_language
, e_res
,
52 g_net
, g_netmsg
, g_netmaster
, g_items
, e_input
, g_touch
,
53 utils
, wadreader
, g_system
;
56 type TYNCallback
= procedure (yes
:Boolean);
58 procedure YNKeyDownProc (win
: TGUIWindow
; Key
: Byte);
60 if win
.UserData
= nil then exit
;
62 IK_Y
, IK_SPACE
: TYNCallback(win
.UserData
)(true);
63 IK_N
: TYNCallback(win
.UserData
)(false);
67 procedure YesButtonCB (ctl
: TGUITextButton
);
69 if ctl
.UserData
= nil then exit
;
70 TYNCallback(ctl
.UserData
)(true);
73 procedure NoButtonCB (ctl
: TGUITextButton
);
75 if ctl
.UserData
= nil then exit
;
76 TYNCallback(ctl
.UserData
)(false);
79 function CreateYNMenu (WinName
, Text: String; MaxLen
: Word; FontID
: DWORD
; ActionProc
: TYNCallback
): TGUIWindow
;
83 //if length(Text) = 0 then exit;
84 Result
:= TGUIWindow
.Create(WinName
);
87 //OnKeyDownEx := @YNKeyDownProc;
88 //UserData := @ActionProc;
89 menu
:= TGUIMenu(Result
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, '')));
92 Name
:= '__temp_yes_no_menu:'+WinName
;
94 AddText(Text, MaxLen
);
95 with AddButton(nil, _lc
[I_MENU_YES
]) do begin ProcEx
:= @YesButtonCB
; UserData
:= @ActionProc
; end;
96 with AddButton(nil, _lc
[I_MENU_NO
]) do begin ProcEx
:= @NoButtonCB
; UserData
:= @ActionProc
; end;
98 DefControl
:= '__temp_yes_no_menu:'+WinName
;
104 procedure ProcChangeColor(Sender
: TGUIControl
); forward;
105 procedure ProcSelectModel(Sender
: TGUIControl
); forward;
107 procedure ProcApplyOptions();
114 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
116 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
122 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
123 if (ovs
<> gVSync
) then
124 sys_EnableVSync(gVSync
);
126 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
127 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
129 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
131 g_Sound_SetupAllVolumes(
132 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
133 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
136 gMaxSimSounds
:= Max(Min(TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
*4+2, 66), 2);
137 gMuteWhenInactive
:= TGUISwitch(menu
.GetControl('swInactiveSounds')).ItemIndex
= 1;
138 gAnnouncer
:= TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
;
139 gSoundEffectsDF
:= TGUISwitch(menu
.GetControl('swSoundEffects')).ItemIndex
= 1;
140 gUseChatSounds
:= TGUISwitch(menu
.GetControl('swChatSpeech')).ItemIndex
= 0;
142 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
144 g_GFX_SetMax(TGUIScroll(menu
.GetControl('scParticlesCount')).Value
*1000);
145 g_Shells_SetMax(TGUIScroll(menu
.GetControl('scShellsMax')).Value
*30);
146 g_Gibs_SetMax(TGUIScroll(menu
.GetControl('scGibsMax')).Value
*25);
147 g_Corpses_SetMax(TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
*5);
149 case TGUISwitch(menu
.GetControl('swGibsCount')).ItemIndex
of
154 else gGibsCount
:= 48;
157 gBloodCount
:= TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
;
158 gFlash
:= TGUISwitch(menu
.GetControl('swScreenFlash')).ItemIndex
;
159 gAdvBlood
:= TGUISwitch(menu
.GetControl('swBloodType')).ItemIndex
= 1;
160 gAdvCorpses
:= TGUISwitch(menu
.GetControl('swCorpseType')).ItemIndex
= 1;
161 gAdvGibs
:= TGUISwitch(menu
.GetControl('swGibsType')).ItemIndex
= 1;
162 gDrawBackGround
:= TGUISwitch(menu
.GetControl('swBackGround')).ItemIndex
= 0;
163 gShowMessages
:= TGUISwitch(menu
.GetControl('swMessages')).ItemIndex
= 0;
164 gRevertPlayers
:= TGUISwitch(menu
.GetControl('swRevertPlayers')).ItemIndex
= 0;
165 gChatBubble
:= TGUISwitch(menu
.GetControl('swChatBubble')).ItemIndex
;
166 gPlayerIndicator
:= TGUISwitch(menu
.GetControl('swPlayerIndicator')).ItemIndex
;
167 gPlayerIndicatorStyle
:= TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')).ItemIndex
;
168 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
170 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
171 g_dbg_scale
:= TempScale
+ 1;
174 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
178 g_Console_BindKey(g_Console_FindBind(1, 'screenshot'), '');
179 g_Console_BindKey(g_Console_FindBind(1, '+p1_scores', '-p1_scores'), '');
180 g_Console_BindKey(g_Console_FindBind(1, 'togglechat'), '');
181 g_Console_BindKey(g_Console_FindBind(1, 'toggleteamchat'), '');
182 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
, 'screenshot');
183 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
, '+p1_scores', '-p1_scores');
184 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
, 'togglechat');
185 g_Console_BindKey(TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
, 'toggleteamchat');
188 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
191 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveright', '-p1_moveright'), '');
192 g_Console_BindKey(g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft'), '');
193 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookup', '-p1_lookup'), '');
194 g_Console_BindKey(g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown'), '');
195 g_Console_BindKey(g_Console_FindBind(1, '+p1_attack', '-p1_attack'), '');
196 g_Console_BindKey(g_Console_FindBind(1, '+p1_jump', '-p1_jump'), '');
197 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext'), '');
198 g_Console_BindKey(g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev'), '');
199 g_Console_BindKey(g_Console_FindBind(1, '+p1_activate', '-p1_activate'), '');
200 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
201 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
203 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
204 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
205 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
206 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
207 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p1_weapnext', '-p1_weapnext');
208 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p1_weapprev', '-p1_weapprev');
209 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
210 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
212 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
213 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
214 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
215 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
216 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
217 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
218 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext'), '');
219 g_Console_BindKey(g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev'), '');
220 g_Console_BindKey(g_Console_FindBind(2, '+p1_activate', '-p1_activate'), '');
221 g_Console_BindKey(g_Console_FindBind(2, '+p1_strafe', '-p1_strafe'), '');
222 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
223 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
224 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
228 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p1_weapnext', '-p1_weapnext');
229 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p1_weapprev', '-p1_weapprev');
230 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
231 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
234 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
237 for i
:= WP_FIRST
to WP_LAST
do
239 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
240 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
241 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
242 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
246 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
249 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
250 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
251 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
252 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
253 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
254 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
255 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext'), '');
256 g_Console_BindKey(g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev'), '');
257 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
258 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
259 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
260 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
261 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
262 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
263 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
264 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
265 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, '+p2_weapnext', '-p2_weapnext');
266 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, '+p2_weapprev', '-p2_weapprev');
267 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
268 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
270 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
271 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
272 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
273 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
274 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
275 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
276 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext'), '');
277 g_Console_BindKey(g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev'), '');
278 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
279 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
280 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
281 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
282 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
283 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
284 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
285 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
286 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, '+p2_weapnext', '-p2_weapnext');
287 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, '+p2_weapprev', '-p2_weapprev');
288 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
289 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
292 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
295 for i
:= WP_FIRST
to WP_LAST
do
297 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
298 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
299 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
300 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
304 if e_HasJoysticks
then
306 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
309 for i
:= 0 to e_MaxJoys
- 1 do
310 if e_JoystickAvailable
[i
] then
311 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
315 if g_touch_enabled
then
317 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
318 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
319 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
320 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
321 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
324 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
326 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
327 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
328 TEAM_RED
, TEAM_BLUE
);
330 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
332 gPlayer1Settings
.Model
:= Model
.Name
;
333 gPlayer1Settings
.Color
:= Model
.Color
;
336 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
338 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
339 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
340 TEAM_RED
, TEAM_BLUE
);
341 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
343 gPlayer2Settings
.Model
:= Model
.Name
;
344 gPlayer2Settings
.Color
:= Model
.Color
;
347 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
348 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
350 if g_Game_IsServer
then
352 if gPlayer1
<> nil then
354 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
355 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
356 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
357 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
359 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
362 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
365 if gPlayer2
<> nil then
367 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
368 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
369 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
370 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
372 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
377 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
379 s
:= e_GetWriteableDir(ConfigDirs
);
381 g_Options_Write(s
+ '/' + CONFIG_FILENAME
);
382 g_Console_WriteGameConfig
;
385 procedure ReadOptions();
390 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
392 with TGUISwitch(menu
.GetControl('swBPP')) do
398 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
399 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
401 with TGUISwitch(menu
.GetControl('swVSync')) do
402 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
404 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
405 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
407 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
409 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
410 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
411 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
413 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
414 if gMuteWhenInactive
then
419 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
421 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
422 if gSoundEffectsDF
then
427 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
428 if gUseChatSounds
then
433 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
436 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
437 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
438 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
439 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
440 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
441 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
442 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapnext', '-p1_weapnext');
443 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p1_weapprev', '-p1_weapprev');
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
445 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
447 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
448 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
449 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
450 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
451 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
452 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
453 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapnext', '-p1_weapnext');
454 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p1_weapprev', '-p1_weapprev');
455 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
456 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
459 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
462 for i
:= WP_FIRST
to WP_LAST
do
464 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
465 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
469 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
472 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
473 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
474 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
475 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
476 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
477 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
478 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapnext', '-p2_weapnext');
479 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, '+p2_weapprev', '-p2_weapprev');
480 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
481 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
488 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
489 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapnext', '-p2_weapnext');
490 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, '+p2_weapprev', '-p2_weapprev');
491 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
492 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
495 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
498 for i
:= WP_FIRST
to WP_LAST
do
500 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
501 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
505 if e_HasJoysticks
then
507 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
510 for i
:= 0 to e_MaxJoys
- 1 do
511 if e_JoystickAvailable
[i
] then
512 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
516 if g_touch_enabled
then
518 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
519 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
520 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
521 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
522 with TGUISwitch(menu
.GetControl('swTouchFire')) do
523 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
524 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
527 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
530 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
531 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
532 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
533 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
536 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
538 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
539 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
540 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
541 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
542 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
544 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
547 with TGUISwitch(menu
.GetControl('swBloodType')) do
548 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
550 with TGUISwitch(menu
.GetControl('swCorpseType')) do
551 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
553 with TGUISwitch(menu
.GetControl('swGibsType')) do
554 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
556 with TGUISwitch(menu
.GetControl('swGibsCount')) do
565 with TGUISwitch(menu
.GetControl('swBackGround')) do
566 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
568 with TGUISwitch(menu
.GetControl('swMessages')) do
569 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
571 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
572 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
574 with TGUISwitch(menu
.GetControl('swChatBubble')) do
575 ItemIndex
:= gChatBubble
;
577 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
578 ItemIndex
:= gPlayerIndicator
;
580 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
581 ItemIndex
:= gPlayerIndicatorStyle
;
583 TempScale
:= Round(g_dbg_scale
- 1);
584 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
586 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
588 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
589 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
591 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
592 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
594 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
595 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
596 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
598 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
600 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
601 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
603 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
604 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
606 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
607 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
608 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
610 ProcSelectModel(nil);
613 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
615 // don't turn off monsters in DM
617 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
618 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
619 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
621 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
624 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
625 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
626 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
627 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
631 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
633 // don't turn off monsters in DM
635 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
636 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
637 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
639 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
642 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
643 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
644 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
645 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
649 procedure ProcStartCustomGame();
656 with TGUIMenu(g_ActiveWindow
.GetControl('mCustomGameMenu')) do
658 Map
:= TGUILabel(GetControl('lbMap')).Text;
661 if not isWadPath(Map
) then
664 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
665 gcGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
666 gcTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
667 gcGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
668 gcMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
670 gcTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
671 gcDeathmatchKeys
:= TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0;
672 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
673 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
674 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
677 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
678 if gcDeathmatchKeys
then
679 Options
:= Options
or GAME_OPTION_DMKEYS
;
681 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
683 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
685 Options
:= Options
or GAME_OPTION_MONSTERS
;
686 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
688 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
690 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
691 gcBotsVS
:= 'Monsters';
694 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
695 gcBotsVS
:= 'Everybody';
698 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
699 gcBotsVS
:= 'Players';
706 s
:= e_GetWriteableDir(ConfigDirs
);
708 g_Options_Write_Gameplay_Custom(s
+ '/' + CONFIG_FILENAME
);
710 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
711 gcMaxLives
, Options
, gcPlayers
);
715 procedure ProcStartNetGame();
722 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
724 Map
:= TGUILabel(GetControl('lbMap')).Text;
727 if not isWadPath(Map
) then
730 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
731 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
732 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
733 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
734 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
735 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
737 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
738 gnDeathmatchKeys
:= TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0;
739 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
740 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
741 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
744 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
745 if gnDeathmatchKeys
then
746 Options
:= Options
or GAME_OPTION_DMKEYS
;
748 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
750 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
752 Options
:= Options
or GAME_OPTION_MONSTERS
;
753 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
755 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
757 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
758 gnBotsVS
:= 'Monsters';
761 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
762 gnBotsVS
:= 'Everybody';
765 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
766 gnBotsVS
:= 'Players';
771 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
772 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
773 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
774 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
775 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
778 s
:= e_GetWriteableDir(ConfigDirs
);
781 g_Options_Write_Net_Server(s
+ '/' + CONFIG_FILENAME
);
782 g_Options_Write_Gameplay_Net(s
+ '/' + CONFIG_FILENAME
)
785 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
786 Options
, gnPlayers
, 0, NetPort
);
789 procedure ProcConnectNetGame();
794 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
796 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
797 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
798 PW
:= TGUIEdit(GetControl('edPW')).Text;
801 s
:= e_GetWriteableDir(ConfigDirs
);
803 g_Options_Write_Net_Client(s
+ '/' + CONFIG_FILENAME
);
804 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
807 procedure ProcEnterPassword();
812 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
814 NetClientIP
:= PromptIP
;
815 NetClientPort
:= PromptPort
;
816 PW
:= TGUIEdit(GetControl('edPW')).Text;
819 s
:= e_GetWriteableDir(ConfigDirs
);
821 g_Options_Write_Net_Client(s
+ '/' + CONFIG_FILENAME
);
822 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
825 procedure ProcServerlist();
827 if not NetInitDone
then
829 if (not g_Net_Init()) then
831 g_Console_Add('NET: ERROR: Failed to init ENet!');
838 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
, NetSlistList
);
840 gState
:= STATE_SLIST
;
841 g_ActiveWindow
:= nil;
843 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
848 slReturnPressed
:= True;
849 if g_Net_Slist_Fetch(slCurrent
) then
851 if slCurrent
= nil then
852 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
855 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
856 g_Serverlist_GenerateTable(slCurrent
, slTable
);
859 procedure ProcStartCampaign();
865 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
867 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
868 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
870 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
876 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
879 procedure ProcSelectMap(Sender
: TGUIControl
);
883 wad
, map
, res
: String;
885 win
:= g_GUI_GetWindow('SelectMapMenu');
886 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
888 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
889 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
891 if (wad
= '') or (map
= '') then
892 begin // Ýòî íå êàðòà
893 TGUILabel(GetControl('lbMapName')).Text := '';
894 TGUILabel(GetControl('lbMapAuthor')).Text := '';
895 TGUILabel(GetControl('lbMapSize')).Text := '';
896 TGUIMemo(GetControl('meMapDescription')).SetText('');
897 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
898 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
904 a
:= g_Map_GetMapInfo(res
);
906 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
907 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
908 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
909 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
910 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
911 TGUILabel(win
.GetControl('lbMapScale')).Text :=
912 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
917 procedure ProcSelectWAD(Sender
: TGUIControl
);
922 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
924 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
926 with TGUIListBox(GetControl('lsMapRes')) do
932 list
:= g_Map_GetMapsList(wad
);
946 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
952 win
:= g_GUI_GetWindow('CampaignMenu');
953 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
955 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
959 TGUILabel(GetControl('lbWADName')).Text := '';
960 TGUILabel(GetControl('lbWADAuthor')).Text := '';
961 TGUIMemo(GetControl('meWADDescription')).SetText('');
964 a
:= g_Game_GetMegaWADInfo(wad
);
966 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
967 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
968 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
970 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
974 fn
:= g_ExtractWadName(a
.pic
);
976 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
978 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
983 procedure ProcChangeColor(Sender
: TGUIControl
);
987 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
988 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
989 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
990 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
991 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
992 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
994 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
995 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
996 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
997 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
998 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
999 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
1002 procedure ProcSelectModel(Sender
: TGUIControl
);
1007 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1008 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
1009 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
1011 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1012 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
1013 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
1015 ProcChangeColor(nil);
1018 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
1030 wad
:= TWADFile
.Create
;
1031 if wad
.ReadFile(GameWAD
) then
1032 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
1037 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
1039 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1040 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1041 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1042 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1044 if g_Texture_Get('FONT_STD', ID
) then
1045 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
1050 if cfglen
<> 0 then FreeMem(cfgdata
);
1053 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
1059 cfgdata
, fntdata
: Pointer;
1060 cfglen
, fntlen
: Integer;
1068 wad
:= TWADFile
.Create
;
1069 if wad
.ReadFile(GameWAD
) then
1071 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1072 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1078 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1079 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1080 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1082 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1083 FontID
:= e_CharFont_Create(spc
);
1085 for a
:= 0 to 255 do
1087 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1088 if chrwidth
= 0 then Continue
;
1090 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1092 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1098 if cfglen
<> 0 then FreeMem(cfgdata
);
1099 if fntlen
<> 0 then FreeMem(fntdata
);
1102 procedure MenuLoadData();
1104 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1106 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1107 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1108 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1109 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1110 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1111 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1112 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1113 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1114 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1115 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1116 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1117 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1118 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1119 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1120 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1121 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1122 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1123 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1124 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1125 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1126 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1127 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1128 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1129 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1130 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1132 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1133 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1134 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1135 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1136 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1137 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1138 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1141 procedure MenuFreeData();
1143 e_CharFont_Remove(gMenuFont
);
1144 e_CharFont_Remove(gMenuSmallFont
);
1146 g_Texture_Delete('MAINMENU_LOGO');
1147 g_Texture_Delete('MAINMENU_MARKER1');
1148 g_Texture_Delete('MAINMENU_MARKER2');
1149 g_Texture_Delete('SCROLL_LEFT');
1150 g_Texture_Delete('SCROLL_RIGHT');
1151 g_Texture_Delete('SCROLL_MIDDLE');
1152 g_Texture_Delete('SCROLL_MARKER');
1153 g_Texture_Delete('EDIT_LEFT');
1154 g_Texture_Delete('EDIT_RIGHT');
1155 g_Texture_Delete('EDIT_MIDDLE');
1156 g_Texture_Delete('BOX1');
1157 g_Texture_Delete('BOX2');
1158 g_Texture_Delete('BOX3');
1159 g_Texture_Delete('BOX4');
1160 g_Texture_Delete('BOX5');
1161 g_Texture_Delete('BOX6');
1162 g_Texture_Delete('BOX7');
1163 g_Texture_Delete('BOX8');
1164 g_Texture_Delete('BOX9');
1165 g_Texture_Delete('BSCROLL_UP_A');
1166 g_Texture_Delete('BSCROLL_UP_U');
1167 g_Texture_Delete('BSCROLL_DOWN_A');
1168 g_Texture_Delete('BSCROLL_DOWN_U');
1169 g_Texture_Delete('BSCROLL_MIDDLE');
1170 g_Texture_Delete('NOPIC');
1172 g_Sound_Delete('MENU_SELECT');
1173 g_Sound_Delete('MENU_OPEN');
1174 g_Sound_Delete('MENU_CLOSE');
1175 g_Sound_Delete('MENU_CHANGE');
1176 g_Sound_Delete('SCROLL_ADD');
1177 g_Sound_Delete('SCROLL_SUB');
1178 g_Sound_Delete('SOUND_PLAYER_FALL');
1181 procedure ProcAuthorsMenu();
1183 gMusic
.SetByName('MUSIC_INTERMUS');
1187 procedure ProcExitMenuKeyDown (yes
: Boolean);
1190 snd
: TPlayableSound
;
1195 g_Game_StopAllSounds(True);
1196 case (Random(18)) of
1197 0: s
:= 'SOUND_MONSTER_PAIN';
1198 1: s
:= 'SOUND_MONSTER_DIE_3';
1199 2: s
:= 'SOUND_MONSTER_SLOP';
1200 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1201 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1202 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1203 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1204 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1205 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1206 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1207 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1208 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1209 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1210 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1211 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1212 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1213 else s
:= 'SOUND_PLAYER_FALL';
1215 snd
:= TPlayableSound
.Create();
1216 res
:= snd
.SetByName(s
);
1217 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1221 while snd
.IsPlaying() do begin end;
1229 procedure ProcLoadMenu();
1236 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1237 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1238 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1242 procedure ProcSaveMenu();
1250 name
:= g_GetSaveName(a
, valid
);
1251 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1252 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1256 procedure ProcSaveGame(Sender
: TGUIControl
);
1260 if g_Game_IsNet
then Exit
;
1261 if g_Game_IsTestMap
then Exit
;
1262 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1263 g_Game_PauseAllSounds(True);
1264 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1266 g_ActiveWindow
:= nil;
1267 g_Game_Pause(False);
1270 procedure ProcLoadGame(Sender
: TGUIControl
);
1274 if g_Game_IsNet
then Exit
;
1275 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1276 if g_LoadGame(a
) then
1278 g_Game_PauseAllSounds(False)
1280 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1282 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1283 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1284 //g_ActiveWindow := nil;
1288 procedure ProcSinglePlayer (n
: Integer);
1289 var wad
, map
: AnsiString;
1292 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1293 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1294 if e_FindResource(AllMapDirs
, wad
) then
1296 wad
:= ExpandFileName(wad
);
1297 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1301 procedure ProcSingle1Player
;
1306 procedure ProcSingle2Players
;
1311 procedure ProcSelectMapMenu();
1314 wad_lb
: TGUIFileListBox
;
1315 map_lb
: TGUIListBox
;
1318 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1319 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1320 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1322 if wad_lb
.SelectedItem() <> '' then
1323 map
:= map_lb
.SelectedItem()
1327 wad_lb
.UpdateFileList();
1330 if wad_lb
.SelectedItem() <> '' then
1333 map_lb
.SelectItem(map
);
1335 if map_lb
.SelectedItem() <> '' then
1339 g_GUI_ShowWindow('SelectMapMenu');
1342 procedure ProcSelectCampaignMenu();
1345 wad_lb
: TGUIFileListBox
;
1347 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1348 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1350 wad_lb
.UpdateFileList();
1352 if wad_lb
.SelectedItem() <> '' then
1353 ProcSelectCampaignWAD(nil);
1356 procedure ProcSetMap();
1358 wad
, map
, res
: String;
1360 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1362 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1363 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1366 if (wad
= '') or (map
= '') then
1369 wad
:= e_FindWadRel(MapDirs
, WAD
);
1371 res
:= wad
+':\'+map
;
1373 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1374 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1377 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1381 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1383 g_Sound_SetupAllVolumes(
1384 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1385 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1389 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1393 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1394 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1396 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1397 g_dbg_scale
:= TempScale
+ 1;
1401 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1405 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1406 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1407 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1408 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1411 procedure ProcOptionsPlayersMIMenu();
1416 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1418 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1420 if a
= '' then Exit
;
1422 b
:= g_PlayerModel_GetInfo(a
);
1424 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1426 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1427 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1428 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1430 if b
.HaveWeapon
then
1431 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1433 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1436 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1439 procedure ProcOptionsPlayersAnim();
1443 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1448 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1451 Model
.GetCurrentAnimation
.Loop
:= True;
1452 Model
.GetCurrentAnimationMask
.Loop
:= True;
1456 procedure ProcOptionsPlayersWeap();
1460 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1465 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1469 procedure ProcOptionsPlayersRot();
1473 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1474 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1476 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1480 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1484 g_Options_SetDefault();
1490 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1492 if yes
then ReadOptions();
1496 procedure ProcAuthorsClose();
1498 gMusic
.SetByName('MUSIC_MENU');
1500 gState
:= STATE_MENU
;
1503 procedure ProcGMClose();
1505 g_Game_InGameMenu(False);
1508 procedure ProcGMShow();
1513 if (gGameSettings
.GameType
= GT_SINGLE
) and
1514 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1515 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1516 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1518 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1519 if g_Game_IsTestMap
then
1520 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1521 TGUIMainMenu(g_ActiveWindow
.GetControl(
1522 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1525 procedure ProcChangePlayers();
1527 TeamGame
, Spectator
, AddTwo
: Boolean;
1528 P1Team
{, P2Team}: Byte;
1529 bP2
: TGUITextButton
;
1531 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1532 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1533 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1534 P1Team
:= TEAM_NONE
;
1535 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1537 //P2Team := TEAM_NONE;
1538 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1540 TGUIMainMenu(g_ActiveWindow
.GetControl(
1541 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1542 TGUIMainMenu(g_ActiveWindow
.GetControl(
1543 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1544 TGUIMainMenu(g_ActiveWindow
.GetControl(
1545 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1547 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1548 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1549 bP2
.Enabled
:= AddTwo
and not Spectator
;
1551 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1553 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1554 if gPlayer2
= nil then
1555 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1557 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1559 TGUIMainMenu(g_ActiveWindow
.GetControl(
1560 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1563 procedure ProcJoinRed();
1565 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1567 if g_Game_IsServer
then
1569 if gPlayer1
= nil then
1570 g_Game_AddPlayer(TEAM_RED
)
1573 if gPlayer1
.Team
<> TEAM_RED
then
1575 gPlayer1
.SwitchTeam
;
1576 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1579 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1584 gPlayer1Settings
.Team
:= TEAM_RED
;
1585 MC_SEND_PlayerSettings
;
1586 if gPlayer1
= nil then
1587 g_Game_AddPlayer(TEAM_RED
);
1589 g_ActiveWindow
:= nil;
1590 g_Game_Pause(False);
1593 procedure ProcJoinBlue();
1595 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1597 if g_Game_IsServer
then
1599 if gPlayer1
= nil then
1600 g_Game_AddPlayer(TEAM_BLUE
)
1603 if gPlayer1
.Team
<> TEAM_BLUE
then
1605 gPlayer1
.SwitchTeam
;
1606 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1609 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1614 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1615 MC_SEND_PlayerSettings
;
1616 if gPlayer1
= nil then
1617 g_Game_AddPlayer(TEAM_BLUE
);
1619 g_ActiveWindow
:= nil;
1620 g_Game_Pause(False);
1623 procedure ProcJoinGame();
1625 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1627 if gPlayer1
= nil then
1629 g_ActiveWindow
:= nil;
1630 g_Game_Pause(False);
1633 procedure ProcSwitchP2();
1635 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1637 if gPlayer1
= nil then
1639 if gPlayer2
= nil then
1642 g_Game_RemovePlayer();
1643 g_ActiveWindow
:= nil;
1644 g_Game_Pause(False);
1647 procedure ProcSpectate();
1649 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1652 g_ActiveWindow
:= nil;
1653 g_Game_Pause(False);
1656 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1658 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1661 procedure ProcEndMenuKeyDown (yes
: Boolean);
1663 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1666 procedure ProcSetRussianLanguage
;
1668 if gLanguage
<> LANGUAGE_RUSSIAN
then
1670 gLanguage
:= LANGUAGE_RUSSIAN
;
1671 gLanguageChange
:= True;
1672 gAskLanguage
:= False;
1677 procedure ProcSetEnglishLanguage
;
1679 if gLanguage
<> LANGUAGE_ENGLISH
then
1681 gLanguage
:= LANGUAGE_ENGLISH
;
1682 gLanguageChange
:= True;
1683 gAskLanguage
:= False;
1688 procedure ReadGameSettings();
1692 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1694 with gGameSettings
do
1696 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1697 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1701 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1702 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1707 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1708 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1709 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1711 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1712 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1713 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1716 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1721 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1723 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1724 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1726 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1727 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1731 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1732 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1734 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1735 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1736 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1737 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1738 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1739 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1740 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1744 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1745 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1746 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1747 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1752 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1753 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1758 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1759 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1764 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1765 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1770 procedure ProcApplyGameSet();
1774 stat
: TPlayerStatArray
;
1776 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1778 if not g_Game_IsServer
then Exit
;
1780 with gGameSettings
do
1782 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1784 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1785 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1787 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1790 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1792 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1793 Options
:= Options
or GAME_OPTION_DMKEYS
1795 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1798 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1800 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1806 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1808 TimeLimit
:= Max(n
, b
);
1812 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1814 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1821 if GameMode
= GM_DM
then
1823 stat
:= g_Player_GetStats();
1825 for a
:= 0 to High(stat
) do
1826 if stat
[a
].Frags
> b
then
1830 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1832 GoalLimit
:= Max(n
, b
);
1836 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1838 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1839 if n
< 0 then n
:= 0;
1840 if n
> 255 then n
:= 255;
1846 stat
:= g_Player_GetStats();
1848 for a
:= 0 to High(stat
) do
1849 if stat
[a
].Lives
> b
then
1852 MaxLives
:= Max(n
, b
);
1856 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1858 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1861 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1862 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1866 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1867 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1871 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1872 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1878 if g_Game_IsNet
then MH_SEND_GameSettings
;
1881 procedure ProcVideoOptionsRes();
1886 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1888 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1889 IntToStr(gWinSizeX
) +
1890 ' x ' + IntToStr(gWinSizeY
) +
1891 ', ' + IntToStr(gBPP
) + ' bpp';
1893 with TGUIListBox(menu
.GetControl('lsResolution')) do
1895 list
:= sys_GetDisplayModes(gBPP
);
1899 ItemIndex
:= Length(list
)
1907 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1913 TempResScale
:= Round(r_pixel_scale
- 1);
1914 TGUIScroll(menu
.GetControl('scResFactor')).Value
:= TempResScale
;
1917 procedure ProcApplyVideoOptions();
1920 Fullscreen
: Boolean;
1921 SWidth
, SHeight
: Integer;
1922 ScaleChanged
: Boolean;
1925 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1927 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1929 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1932 SWidth
:= gWinSizeX
;
1933 SHeight
:= gWinSizeY
;
1936 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1938 ScaleChanged
:= False;
1939 if TGUIScroll(menu
.GetControl('scResFactor')).Value
<> TempResScale
then
1941 TempResScale
:= TGUIScroll(menu
.GetControl('scResFactor')).Value
;
1942 r_pixel_scale
:= TempResScale
+ 1;
1943 ScaleChanged
:= True;
1946 if (SWidth
<> gWinSizeX
) or
1947 (SHeight
<> gWinSizeY
) or
1948 (Fullscreen
<> gFullscreen
) or
1951 gResolutionChange
:= True;
1952 gRC_Width
:= SWidth
;
1953 gRC_Height
:= SHeight
;
1954 gRC_FullScreen
:= Fullscreen
;
1955 gRC_Maximized
:= gWinMaximized
;
1958 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1962 procedure ProcSetFirstRussianLanguage
;
1964 gLanguage
:= LANGUAGE_RUSSIAN
;
1965 gLanguageChange
:= True;
1966 gAskLanguage
:= False;
1969 procedure ProcSetFirstEnglishLanguage
;
1971 gLanguage
:= LANGUAGE_ENGLISH
;
1972 gLanguageChange
:= True;
1973 gAskLanguage
:= False;
1976 procedure ProcRecallAddress();
1978 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1980 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1981 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1985 procedure CreateFirstLanguageMenu();
1989 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1991 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1993 Name
:= 'mmFirstLanguageMenu';
1994 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
1995 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
1998 Menu
.DefControl
:= 'mmFirstLanguageMenu';
1999 Menu
.MainWindow
:= True;
2000 g_GUI_AddWindow(Menu
);
2003 procedure g_Menu_AskLanguage();
2005 CreateFirstLanguageMenu();
2006 g_GUI_ShowWindow('FirstLanguageMenu');
2009 procedure CreatePlayerOptionsMenu(s
: String);
2014 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
2016 a
:= _lc
[I_MENU_PLAYER_1
]
2018 a
:= _lc
[I_MENU_PLAYER_2
];
2019 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
2021 Name
:= 'mOptionsPlayers'+s
+'Menu';
2022 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
2024 Name
:= 'ed'+s
+'Name';
2028 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
2030 Name
:= 'sw'+s
+'Team';
2031 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
2032 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2034 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2036 Name
:= 'ls'+s
+'Model';
2038 Items
:= g_PlayerModel_GetNames();
2039 OnChange
:= ProcSelectModel
;
2041 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2043 Name
:= 'sc'+s
+'Red';
2045 OnChange
:= ProcChangeColor
;
2047 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2049 Name
:= 'sc'+s
+'Green';
2051 OnChange
:= ProcChangeColor
;
2053 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2055 Name
:= 'sc'+s
+'Blue';
2057 OnChange
:= ProcChangeColor
;
2060 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2061 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2062 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2063 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2065 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2067 Name
:= 'mv'+s
+'Model';
2068 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2069 Y
:= GetControl('ls'+s
+'Model').Y
;
2072 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2073 g_GUI_AddWindow(Menu
);
2076 procedure CreateAllMenus();
2080 a
, cx
, _y
, i
: Integer;
2083 Menu
:= TGUIWindow
.Create('MainMenu');
2084 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2086 Name
:= 'mmMainMenu';
2087 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2088 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2089 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2090 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2091 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2092 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2094 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2096 Color
:= _RGB(255, 255, 255);
2097 X
:= gScreenWidth
-GetWidth
-8;
2098 Y
:= gScreenHeight
-GetHeight
-8;
2100 Menu
.DefControl
:= 'mmMainMenu';
2101 Menu
.MainWindow
:= True;
2102 g_GUI_AddWindow(Menu
);
2104 Menu
:= TGUIWindow
.Create('NewGameMenu');
2105 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2107 Name
:= 'mmNewGameMenu';
2108 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2109 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2110 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2111 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2113 Menu
.DefControl
:= 'mmNewGameMenu';
2114 g_GUI_AddWindow(Menu
);
2116 Menu
:= TGUIWindow
.Create('NetGameMenu');
2117 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2119 Name
:= 'mmNetGameMenu';
2120 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2121 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2123 Menu
.DefControl
:= 'mmNetGameMenu';
2124 g_GUI_AddWindow(Menu
);
2126 Menu
:= TGUIWindow
.Create('NetServerMenu');
2127 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2129 Name
:= 'mNetServerMenu';
2130 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2132 Name
:= 'edSrvName';
2133 OnlyDigits
:= False;
2136 Text := NetServerName
;
2138 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2140 Name
:= 'edSrvPassword';
2141 OnlyDigits
:= False;
2144 Text := NetPassword
;
2146 with AddEdit(_lc
[I_NET_PORT
]) do
2152 Text := IntToStr(NetPort
);
2154 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2156 Name
:= 'edMaxPlayers';
2160 Text := IntToStr(NetMaxClients
);
2162 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2164 Name
:= 'swUseMaster';
2165 AddItem(_lc
[I_MENU_YES
]);
2166 AddItem(_lc
[I_MENU_NO
]);
2167 if NetUseMaster
then
2173 with AddLabel(_lc
[I_MENU_MAP
]) do
2178 OnClick
:= @ProcSelectMapMenu
;
2180 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2182 Name
:= 'swGameMode';
2183 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2184 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2185 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2186 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2187 case g_Game_TextToMode(gnGameMode
) of
2189 GM_DM
: ItemIndex
:= 0;
2190 GM_TDM
: ItemIndex
:= 1;
2191 GM_CTF
: ItemIndex
:= 2;
2193 GM_COOP
: ItemIndex
:= 3;
2195 OnChange
:= ProcSwitchMonstersNet
;
2197 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2199 Name
:= 'edTimeLimit';
2203 if gnTimeLimit
> 0 then
2204 Text := IntToStr(gnTimeLimit
);
2206 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2208 Name
:= 'edGoalLimit';
2212 if gnGoalLimit
> 0 then
2213 Text := IntToStr(gnGoalLimit
);
2215 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2217 Name
:= 'edMaxLives';
2221 if gnMaxLives
> 0 then
2222 Text := IntToStr(gnMaxLives
);
2224 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2226 Name
:= 'swPlayers';
2227 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2228 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2229 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2230 ItemIndex
:= gnPlayers
;
2232 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2234 Name
:= 'swTeamDamage';
2235 AddItem(_lc
[I_MENU_YES
]);
2236 AddItem(_lc
[I_MENU_NO
]);
2237 if gnTeamDamage
then
2242 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2244 Name
:= 'swDeathmatchKeys';
2245 AddItem(_lc
[I_MENU_YES
]);
2246 AddItem(_lc
[I_MENU_NO
]);
2247 if gnDeathmatchKeys
then
2252 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2254 Name
:= 'swEnableExits';
2255 AddItem(_lc
[I_MENU_YES
]);
2256 AddItem(_lc
[I_MENU_NO
]);
2262 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2264 Name
:= 'swWeaponStay';
2265 AddItem(_lc
[I_MENU_YES
]);
2266 AddItem(_lc
[I_MENU_NO
]);
2267 if gnWeaponStay
then
2272 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2274 Name
:= 'swMonsters';
2275 AddItem(_lc
[I_MENU_YES
]);
2276 AddItem(_lc
[I_MENU_NO
]);
2282 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2285 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2286 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2287 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2289 if gnBotsVS
= 'Players' then
2291 if gnBotsVS
= 'Monsters' then
2295 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2299 Menu
.DefControl
:= 'mNetServerMenu';
2300 g_GUI_AddWindow(Menu
);
2302 Menu
:= TGUIWindow
.Create('NetClientMenu');
2303 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2305 Name
:= 'mNetClientMenu';
2307 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2310 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2316 Text := 'localhost';
2318 with AddEdit(_lc
[I_NET_PORT
]) do
2326 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2329 OnlyDigits
:= False;
2336 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2340 Menu
.DefControl
:= 'mNetClientMenu';
2341 g_GUI_AddWindow(Menu
);
2343 Menu
:= TGUIWindow
.Create('LoadMenu');
2344 Menu
.OnShow
:= ProcLoadMenu
;
2345 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2347 Name
:= 'mmLoadMenu';
2352 Name
:= 'edSlot'+IntToStr(a
);
2355 OnEnter
:= ProcLoadGame
;
2358 Menu
.DefControl
:= 'mmLoadMenu';
2359 g_GUI_AddWindow(Menu
);
2361 Menu
:= TGUIWindow
.Create('SaveMenu');
2362 Menu
.OnShow
:= ProcSaveMenu
;
2363 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2365 Name
:= 'mmSaveMenu';
2370 Name
:= 'edSlot'+IntToStr(a
);
2373 OnChange
:= ProcSaveGame
;
2376 Menu
.DefControl
:= 'mmSaveMenu';
2377 g_GUI_AddWindow(Menu
);
2379 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2380 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2382 Name
:= 'mCustomGameMenu';
2383 with AddLabel(_lc
[I_MENU_MAP
]) do
2388 OnClick
:= @ProcSelectMapMenu
;
2390 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2392 Name
:= 'swGameMode';
2393 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2394 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2395 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2396 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2397 case g_Game_TextToMode(gcGameMode
) of
2399 GM_DM
: ItemIndex
:= 0;
2400 GM_TDM
: ItemIndex
:= 1;
2401 GM_CTF
: ItemIndex
:= 2;
2403 GM_COOP
: ItemIndex
:= 3;
2405 OnChange
:= ProcSwitchMonstersCustom
;
2407 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2409 Name
:= 'edTimeLimit';
2413 if gcTimeLimit
> 0 then
2414 Text := IntToStr(gcTimeLimit
);
2416 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2418 Name
:= 'edGoalLimit';
2422 if gcGoalLimit
> 0 then
2423 Text := IntToStr(gcGoalLimit
);
2425 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2427 Name
:= 'edMaxLives';
2431 if gcMaxLives
> 0 then
2432 Text := IntToStr(gcMaxLives
);
2434 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2436 Name
:= 'swPlayers';
2437 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2438 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2439 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2440 ItemIndex
:= gcPlayers
;
2442 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2444 Name
:= 'swTeamDamage';
2445 AddItem(_lc
[I_MENU_YES
]);
2446 AddItem(_lc
[I_MENU_NO
]);
2447 if gcTeamDamage
then
2452 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2454 Name
:= 'swDeathmatchKeys';
2455 AddItem(_lc
[I_MENU_YES
]);
2456 AddItem(_lc
[I_MENU_NO
]);
2457 if gcDeathmatchKeys
then
2462 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2464 Name
:= 'swEnableExits';
2465 AddItem(_lc
[I_MENU_YES
]);
2466 AddItem(_lc
[I_MENU_NO
]);
2472 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2474 Name
:= 'swWeaponStay';
2475 AddItem(_lc
[I_MENU_YES
]);
2476 AddItem(_lc
[I_MENU_NO
]);
2477 if gcWeaponStay
then
2482 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2484 Name
:= 'swMonsters';
2485 AddItem(_lc
[I_MENU_YES
]);
2486 AddItem(_lc
[I_MENU_NO
]);
2492 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2495 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2496 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2497 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2499 if gcBotsVS
= 'Players' then
2501 if gcBotsVS
= 'Monsters' then
2505 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2509 Menu
.DefControl
:= 'mCustomGameMenu';
2510 g_GUI_AddWindow(Menu
);
2512 Menu
:= TGUIWindow
.Create('CampaignMenu');
2513 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2515 Name
:= 'mCampaignMenu';
2524 with AddFileList('', 15, 4) do
2527 OnChange
:= ProcSelectCampaignWAD
;
2531 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2532 SetBase(MegawadDirs
);
2535 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2537 Name
:= 'lbWADName';
2541 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2543 Name
:= 'lbWADAuthor';
2547 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2548 with AddMemo('', 15, 3) do
2550 Name
:= 'meWADDescription';
2551 Color
:= MENU_ITEMSCTRL_COLOR
;
2553 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2555 Name
:= 'swPlayers';
2556 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2557 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2560 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2564 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2566 Name
:= 'mpWADImage';
2567 DefaultRes
:= 'NOPIC';
2568 X
:= GetControl('lsWAD').X
+4;
2569 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2572 Menu
.DefControl
:= 'mCampaignMenu';
2573 g_GUI_AddWindow(Menu
);
2575 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2576 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2578 Name
:= 'mSelectMapMenu';
2579 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2582 OnChange
:= ProcSelectWAD
;
2586 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2589 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2593 OnChange
:= ProcSelectMap
;
2596 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2598 Name
:= 'lbMapName';
2602 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2604 Name
:= 'lbMapAuthor';
2608 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2610 Name
:= 'lbMapSize';
2614 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2616 Name
:= 'meMapDescription';
2621 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2623 Name
:= 'mpMapPreview';
2624 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2625 Y
:= GetControl('lsMapWAD').Y
;
2627 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2629 Name
:= 'lbMapScale';
2632 Color
:= MENU_ITEMSCTRL_COLOR
;
2633 X
:= GetControl('lsMapWAD').X
+
2634 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2635 2 + MAPPREVIEW_WIDTH
*4;
2636 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2639 Menu
.OnClose
:= ProcSetMap
;
2640 Menu
.DefControl
:= 'mSelectMapMenu';
2641 g_GUI_AddWindow(Menu
);
2643 Menu
:= TGUIWindow
.Create('OptionsMenu');
2644 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2646 Name
:= 'mmOptionsMenu';
2647 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2648 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2649 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2650 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2651 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2652 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2654 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2655 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2657 Menu
.OnClose
:= ProcApplyOptions
;
2658 Menu
.DefControl
:= 'mmOptionsMenu';
2659 g_GUI_AddWindow(Menu
);
2661 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2662 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2663 g_GUI_AddWindow(Menu
);
2665 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2666 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2668 Name
:= 'mOptionsVideoMenu';
2669 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2670 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2676 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2679 AddItem(_lc
[I_MENU_YES
]);
2680 AddItem(_lc
[I_MENU_NO
]);
2682 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2684 Name
:= 'swTextureFilter';
2685 AddItem(_lc
[I_MENU_YES
]);
2686 AddItem(_lc
[I_MENU_NO
]);
2688 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2690 Name
:= 'swLegacyNPOT';
2691 AddItem(_lc
[I_MENU_NO
]);
2692 AddItem(_lc
[I_MENU_YES
]);
2695 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2698 Menu
.DefControl
:= 'mOptionsVideoMenu';
2699 g_GUI_AddWindow(Menu
);
2701 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2702 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2704 Name
:= 'mOptionsVideoResMenu';
2705 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2707 Name
:= 'lbCurrentRes';
2711 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2713 Name
:= 'lsResolution';
2716 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2718 Name
:= 'swFullScreen';
2719 AddItem(_lc
[I_MENU_YES
]);
2720 AddItem(_lc
[I_MENU_NO
]);
2722 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2724 Name
:= 'scResFactor';
2728 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2731 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2732 g_GUI_AddWindow(Menu
);
2734 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2735 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2737 Name
:= 'mOptionsSoundMenu';
2738 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2740 Name
:= 'scMusicLevel';
2742 OnChange
:= ProcChangeSoundSettings
;
2744 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2746 Name
:= 'scSoundLevel';
2748 OnChange
:= ProcChangeSoundSettings
;
2750 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2752 Name
:= 'scMaxSimSounds';
2755 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2757 Name
:= 'swAnnouncer';
2758 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2759 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2760 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2761 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2763 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2764 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2766 Name
:= 'swSoundEffects';
2767 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2768 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2770 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2771 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2773 Name
:= 'swChatSpeech';
2774 AddItem(_lc
[I_MENU_YES
]);
2775 AddItem(_lc
[I_MENU_NO
]);
2777 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2779 Name
:= 'swInactiveSounds';
2780 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2781 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2785 Menu
.DefControl
:= 'mOptionsSoundMenu';
2786 g_GUI_AddWindow(Menu
);
2788 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2789 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2791 Name
:= 'mOptionsGameMenu';
2792 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2794 Name
:= 'scParticlesCount';
2797 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2799 Name
:= 'swBloodCount';
2800 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2801 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2802 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2803 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2804 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2806 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2808 Name
:= 'scShellsMax';
2811 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2813 Name
:= 'scGibsMax';
2816 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2818 Name
:= 'scCorpsesMax';
2821 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2823 Name
:= 'swGibsCount';
2824 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2825 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2826 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2827 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2828 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2830 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2832 Name
:= 'swCorpseType';
2833 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2834 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2836 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2838 Name
:= 'swGibsType';
2839 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2840 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2842 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2844 Name
:= 'swBloodType';
2845 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2846 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2848 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2850 Name
:= 'swScreenFlash';
2851 AddItem(_lc
[I_MENU_NO
]);
2852 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2853 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2855 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2857 Name
:= 'swBackground';
2858 AddItem(_lc
[I_MENU_YES
]);
2859 AddItem(_lc
[I_MENU_NO
]);
2861 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2863 Name
:= 'swMessages';
2864 AddItem(_lc
[I_MENU_YES
]);
2865 AddItem(_lc
[I_MENU_NO
]);
2867 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2869 Name
:= 'swRevertPlayers';
2870 AddItem(_lc
[I_MENU_YES
]);
2871 AddItem(_lc
[I_MENU_NO
]);
2873 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2875 Name
:= 'swChatBubble';
2876 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2877 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2878 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2879 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2880 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2882 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2884 Name
:= 'swPlayerIndicator';
2885 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2886 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2887 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2889 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2891 Name
:= 'swPlayerIndicatorStyle';
2892 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2893 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2895 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2897 Name
:= 'scScaleFactor';
2899 OnChange
:= ProcChangeGameSettings
;
2903 Menu
.DefControl
:= 'mOptionsGameMenu';
2904 g_GUI_AddWindow(Menu
);
2906 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2907 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2909 Name
:= 'mOptionsControlsMenu';
2910 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2911 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2912 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2913 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2914 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2916 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2917 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2918 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2919 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2920 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2921 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2922 if e_HasJoysticks
then
2925 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2927 if g_touch_enabled
then
2930 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2933 Menu
.DefControl
:= 'mOptionsControlsMenu';
2934 g_GUI_AddWindow(Menu
);
2936 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2937 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2939 Name
:= 'mOptionsControlsP1Menu';
2940 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2941 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2942 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2943 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2944 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2945 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2946 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2947 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2948 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2949 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2951 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2952 g_GUI_AddWindow(Menu
);
2954 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2955 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2957 Name
:= 'mOptionsControlsP1MenuWeapons';
2958 for i
:= WP_FIRST
to WP_LAST
do
2959 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2960 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2962 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2963 g_GUI_AddWindow(Menu
);
2965 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2966 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2968 Name
:= 'mOptionsControlsP2Menu';
2969 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2970 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2971 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2972 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2973 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2974 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2975 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2976 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2977 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2978 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2980 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
2981 g_GUI_AddWindow(Menu
);
2983 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
2984 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
2986 Name
:= 'mOptionsControlsP2MenuWeapons';
2987 for i
:= WP_FIRST
to WP_LAST
do
2988 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2989 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2991 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
2992 g_GUI_AddWindow(Menu
);
2994 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
2995 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
2997 Name
:= 'mOptionsControlsJoystickMenu';
2998 for i
:= 0 to e_MaxJoys
- 1 do
2999 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3001 Name
:= 'scDeadzone' + IntToStr(i
);
3005 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3006 g_GUI_AddWindow(Menu
);
3008 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3009 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3011 Name
:= 'mOptionsControlsTouchMenu';
3012 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3014 Name
:= 'swTouchAlt';
3015 AddItem(_lc
[I_MENU_NO
]);
3016 AddItem(_lc
[I_MENU_YES
]);
3017 OnChange
:= ProcChangeTouchSettings
;
3019 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3021 Name
:= 'scTouchSize';
3023 OnChange
:= ProcChangeTouchSettings
;
3025 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3027 Name
:= 'swTouchFire';
3028 AddItem(_lc
[I_MENU_NO
]);
3029 AddItem(_lc
[I_MENU_YES
]);
3031 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3033 Name
:= 'scTouchOffset';
3035 OnChange
:= ProcChangeTouchSettings
;
3038 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3039 g_GUI_AddWindow(Menu
);
3041 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3042 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3044 Name
:= 'mOptionsPlayersMenu';
3045 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3046 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3048 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3049 g_GUI_AddWindow(Menu
);
3051 CreatePlayerOptionsMenu('P1');
3052 CreatePlayerOptionsMenu('P2');
3054 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3055 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3057 Name
:= 'mOptionsPlayersMIMenu';
3058 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3063 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3068 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3070 Name
:= 'meComment';
3073 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3074 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3077 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3081 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3082 g_GUI_AddWindow(Menu
);
3084 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3085 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3087 Name
:= 'mOptionsLanguageMenu';
3088 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3089 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3092 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3093 g_GUI_AddWindow(Menu
);
3095 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3096 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3097 g_GUI_AddWindow(Menu
);
3099 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3100 Menu
.BackTexture
:= 'INTER';
3101 Menu
.OnClose
:= ProcAuthorsClose
;
3105 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3107 Color
:= _RGB(255, 0, 0);
3108 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3110 _y
:= _y
+GetHeight();
3112 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3114 Color
:= _RGB(255, 0, 0);
3115 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3117 _y
:= _y
+GetHeight()+32;
3119 // ×òî äåëàë: Êòî äåëàë
3120 cx
:= gScreenWidth
div 2 - 320 + 64;
3121 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3123 Color
:= _RGB(255, 0, 0);
3128 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3130 Color
:= _RGB(255, 255, 255);
3135 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3137 Color
:= _RGB(255, 0, 0);
3142 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3144 Color
:= _RGB(255, 255, 255);
3149 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3151 Color
:= _RGB(255, 255, 255);
3156 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3158 Color
:= _RGB(255, 0, 0);
3163 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3165 Color
:= _RGB(255, 255, 255);
3170 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3172 Color
:= _RGB(255, 0, 0);
3177 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3179 Color
:= _RGB(255, 255, 255);
3182 _y
:= gScreenHeight
- 128;
3185 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3187 Color
:= _RGB(255, 0, 0);
3192 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3194 Color
:= _RGB(255, 255, 255);
3197 _y
:= _y
+GetHeight();
3199 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3201 Color
:= _RGB(255, 255, 255);
3204 _y
:= _y
+GetHeight();
3206 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3208 Color
:= _RGB(255, 255, 255);
3211 _y
:= gScreenHeight
- 32;
3213 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3215 Color
:= _RGB(255, 0, 0);
3216 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3219 g_GUI_AddWindow(Menu
);
3221 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3222 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3223 g_GUI_AddWindow(Menu
);
3225 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3226 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3228 Name
:= 'mmGameSingleMenu';
3229 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3230 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3231 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3232 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3233 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3234 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3236 Menu
.DefControl
:= 'mmGameSingleMenu';
3237 Menu
.MainWindow
:= True;
3238 Menu
.OnClose
:= ProcGMClose
;
3239 Menu
.OnShow
:= ProcGMShow
;
3240 g_GUI_AddWindow(Menu
);
3242 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3243 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3244 g_GUI_AddWindow(Menu
);
3246 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3247 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3248 g_GUI_AddWindow(Menu
);
3250 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3251 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3253 Name
:= 'mmGameCustomMenu';
3254 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3255 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3256 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3257 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3258 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3259 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3260 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3262 Menu
.DefControl
:= 'mmGameCustomMenu';
3263 Menu
.MainWindow
:= True;
3264 Menu
.OnClose
:= ProcGMClose
;
3265 Menu
.OnShow
:= ProcGMShow
;
3266 g_GUI_AddWindow(Menu
);
3268 Menu
:= TGUIWindow
.Create('GameServerMenu');
3269 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3271 Name
:= 'mmGameServerMenu';
3272 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3273 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3274 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3275 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3276 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3278 Menu
.DefControl
:= 'mmGameServerMenu';
3279 Menu
.MainWindow
:= True;
3280 Menu
.OnClose
:= ProcGMClose
;
3281 Menu
.OnShow
:= ProcGMShow
;
3282 g_GUI_AddWindow(Menu
);
3284 Menu
:= TGUIWindow
.Create('GameClientMenu');
3285 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3287 Name
:= 'mmGameClientMenu';
3288 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3289 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3290 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3292 Menu
.DefControl
:= 'mmGameClientMenu';
3293 Menu
.MainWindow
:= True;
3294 Menu
.OnClose
:= ProcGMClose
;
3295 Menu
.OnShow
:= ProcGMShow
;
3296 g_GUI_AddWindow(Menu
);
3298 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3299 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3301 Name
:= 'mClientPasswordMenu';
3302 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3310 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3313 Menu
.DefControl
:= 'mClientPasswordMenu';
3314 g_GUI_AddWindow(Menu
);
3316 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3317 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3319 Name
:= 'mGameSetGameMenu';
3320 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3322 Name
:= 'swTeamDamage';
3323 AddItem(_lc
[I_MENU_YES
]);
3324 AddItem(_lc
[I_MENU_NO
]);
3327 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3329 Name
:= 'swDeathmatchKeys';
3330 AddItem(_lc
[I_MENU_YES
]);
3331 AddItem(_lc
[I_MENU_NO
]);
3334 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3336 Name
:= 'edTimeLimit';
3341 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3343 Name
:= 'edGoalLimit';
3348 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3350 Name
:= 'edMaxLives';
3355 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3358 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3359 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3360 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3366 Menu
.DefControl
:= 'mGameSetGameMenu';
3367 Menu
.OnClose
:= ProcApplyGameSet
;
3368 g_GUI_AddWindow(Menu
);
3370 Menu
:= TGUIWindow
.Create('TeamMenu');
3371 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3373 Name
:= 'mmTeamMenu';
3374 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3375 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3376 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3377 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3378 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3380 Menu
.DefControl
:= 'mmTeamMenu';
3381 Menu
.OnShow
:= ProcChangePlayers
;
3382 g_GUI_AddWindow(Menu
);
3385 procedure g_Menu_Show_SaveMenu();
3387 if g_Game_IsTestMap
then
3389 if gGameSettings
.GameType
= GT_SINGLE
then
3390 g_GUI_ShowWindow('GameSingleMenu')
3393 if g_Game_IsClient
then
3396 if g_Game_IsNet
then
3399 g_GUI_ShowWindow('GameCustomMenu');
3401 g_GUI_ShowWindow('SaveMenu');
3402 g_Sound_PlayEx('MENU_OPEN');
3405 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3407 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3408 if gGameSettings
.GameType
= GT_SINGLE
then
3410 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3414 if g_Game_IsClient
then exit
;
3415 if g_Game_IsNet
then exit
;
3416 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3418 g_GUI_ShowWindow('LoadMenu');
3419 g_Sound_PlayEx('MENU_OPEN');
3422 procedure g_Menu_Show_GameSetGame();
3424 if gGameSettings
.GameType
= GT_SINGLE
then
3425 g_GUI_ShowWindow('GameSingleMenu')
3428 if g_Game_IsClient
then
3431 if g_Game_IsNet
then
3432 g_GUI_ShowWindow('GameServerMenu')
3434 g_GUI_ShowWindow('GameCustomMenu');
3437 g_GUI_ShowWindow('GameSetGameMenu');
3438 g_Sound_PlayEx('MENU_OPEN');
3441 procedure g_Menu_Show_OptionsVideo();
3443 if gGameSettings
.GameType
= GT_SINGLE
then
3444 g_GUI_ShowWindow('GameSingleMenu')
3447 if g_Game_IsClient
then
3448 g_GUI_ShowWindow('GameClientMenu')
3450 if g_Game_IsNet
then
3451 g_GUI_ShowWindow('GameServerMenu')
3453 g_GUI_ShowWindow('GameCustomMenu');
3456 g_GUI_ShowWindow('OptionsMenu');
3457 g_GUI_ShowWindow('OptionsVideoMenu');
3458 g_Sound_PlayEx('MENU_OPEN');
3461 procedure g_Menu_Show_OptionsSound();
3463 if gGameSettings
.GameType
= GT_SINGLE
then
3464 g_GUI_ShowWindow('GameSingleMenu')
3467 if g_Game_IsClient
then
3468 g_GUI_ShowWindow('GameClientMenu')
3470 if g_Game_IsNet
then
3471 g_GUI_ShowWindow('GameServerMenu')
3473 g_GUI_ShowWindow('GameCustomMenu');
3476 g_GUI_ShowWindow('OptionsMenu');
3477 g_GUI_ShowWindow('OptionsSoundMenu');
3478 g_Sound_PlayEx('MENU_OPEN');
3481 procedure g_Menu_Show_EndGameMenu();
3483 g_GUI_ShowWindow('EndGameMenu');
3484 g_Sound_PlayEx('MENU_OPEN');
3487 procedure g_Menu_Show_QuitGameMenu();
3489 g_GUI_ShowWindow('ExitMenu');
3490 g_Sound_PlayEx('MENU_OPEN');
3493 procedure g_Menu_Init();
3500 procedure g_Menu_Free();
3504 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3509 procedure g_Menu_Reset();
3513 g_GUI_SaveMenuPos();
3514 ex
:= g_GUI_Destroy();
3518 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3523 g_Game_SetDebugMode();
3525 g_GUI_LoadMenuPos();