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 gcRespawnItems
:= TGUISwitch(GetControl('swRespawnItems')).ItemIndex
= 0;
672 gcDeathmatchKeys
:= TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0;
673 gcAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
674 gcWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
675 gcMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
678 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
679 if gcRespawnItems
then
680 Options
:= Options
or GAME_OPTION_RESPAWNITEMS
;
681 if gcDeathmatchKeys
then
682 Options
:= Options
or GAME_OPTION_DMKEYS
;
684 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
686 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
688 Options
:= Options
or GAME_OPTION_MONSTERS
;
689 gcPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
691 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
693 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
694 gcBotsVS
:= 'Monsters';
697 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
698 gcBotsVS
:= 'Everybody';
701 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
702 gcBotsVS
:= 'Players';
709 s
:= e_GetWriteableDir(ConfigDirs
);
711 g_Options_Write_Gameplay_Custom(s
+ '/' + CONFIG_FILENAME
);
713 g_Game_StartCustom(Map
, GameMode
, gcTimeLimit
, gcGoalLimit
,
714 gcMaxLives
, Options
, gcPlayers
);
718 procedure ProcStartNetGame();
725 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
727 Map
:= TGUILabel(GetControl('lbMap')).Text;
730 if not isWadPath(Map
) then
733 GameMode
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
734 gnGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
735 gnTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
736 gnGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
737 gnMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
738 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
740 gnTeamDamage
:= TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0;
741 gnRespawnItems
:= TGUISwitch(GetControl('swRespawnItems')).ItemIndex
= 0;
742 gnDeathmatchKeys
:= TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0;
743 gnAllowExit
:= TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0;
744 gnWeaponStay
:= TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0;
745 gnMonsters
:= TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0;
748 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
;
749 if gnRespawnItems
then
750 Options
:= Options
or GAME_OPTION_RESPAWNITEMS
;
751 if gnDeathmatchKeys
then
752 Options
:= Options
or GAME_OPTION_DMKEYS
;
754 Options
:= Options
or GAME_OPTION_ALLOWEXIT
;
756 Options
:= Options
or GAME_OPTION_WEAPONSTAY
;
758 Options
:= Options
or GAME_OPTION_MONSTERS
;
759 gnPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
761 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
763 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
764 gnBotsVS
:= 'Monsters';
767 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
768 gnBotsVS
:= 'Everybody';
771 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
772 gnBotsVS
:= 'Players';
777 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
778 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
779 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
780 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
781 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
784 s
:= e_GetWriteableDir(ConfigDirs
);
787 g_Options_Write_Net_Server(s
+ '/' + CONFIG_FILENAME
);
788 g_Options_Write_Gameplay_Net(s
+ '/' + CONFIG_FILENAME
)
791 g_Game_StartServer(Map
, GameMode
, gnTimeLimit
, gnGoalLimit
, gnMaxLives
,
792 Options
, gnPlayers
, 0, NetPort
);
795 procedure ProcConnectNetGame();
800 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
802 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
803 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
804 PW
:= TGUIEdit(GetControl('edPW')).Text;
807 s
:= e_GetWriteableDir(ConfigDirs
);
809 g_Options_Write_Net_Client(s
+ '/' + CONFIG_FILENAME
);
810 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
813 procedure ProcEnterPassword();
818 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
820 NetClientIP
:= PromptIP
;
821 NetClientPort
:= PromptPort
;
822 PW
:= TGUIEdit(GetControl('edPW')).Text;
825 s
:= e_GetWriteableDir(ConfigDirs
);
827 g_Options_Write_Net_Client(s
+ '/' + CONFIG_FILENAME
);
828 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
831 procedure ProcServerlist();
833 if not NetInitDone
then
835 if (not g_Net_Init()) then
837 g_Console_Add('NET: ERROR: Failed to init ENet!');
844 g_Net_Slist_Set(NetSlistIP
, NetSlistPort
, NetSlistList
);
846 gState
:= STATE_SLIST
;
847 g_ActiveWindow
:= nil;
849 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
854 slReturnPressed
:= True;
855 if g_Net_Slist_Fetch(slCurrent
) then
857 if slCurrent
= nil then
858 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
861 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
862 g_Serverlist_GenerateTable(slCurrent
, slTable
);
865 procedure ProcStartCampaign();
871 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
873 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
874 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
876 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
882 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
885 procedure ProcSelectMap(Sender
: TGUIControl
);
889 wad
, map
, res
: String;
891 win
:= g_GUI_GetWindow('SelectMapMenu');
892 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
894 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
895 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
897 if (wad
= '') or (map
= '') then
898 begin // Ýòî íå êàðòà
899 TGUILabel(GetControl('lbMapName')).Text := '';
900 TGUILabel(GetControl('lbMapAuthor')).Text := '';
901 TGUILabel(GetControl('lbMapSize')).Text := '';
902 TGUIMemo(GetControl('meMapDescription')).SetText('');
903 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
904 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
910 a
:= g_Map_GetMapInfo(res
);
912 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
913 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
914 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
915 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
916 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
917 TGUILabel(win
.GetControl('lbMapScale')).Text :=
918 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
923 procedure ProcSelectWAD(Sender
: TGUIControl
);
928 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
930 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
932 with TGUIListBox(GetControl('lsMapRes')) do
938 list
:= g_Map_GetMapsList(wad
);
952 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
958 win
:= g_GUI_GetWindow('CampaignMenu');
959 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
961 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
965 TGUILabel(GetControl('lbWADName')).Text := '';
966 TGUILabel(GetControl('lbWADAuthor')).Text := '';
967 TGUIMemo(GetControl('meWADDescription')).SetText('');
970 a
:= g_Game_GetMegaWADInfo(wad
);
972 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
973 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
974 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
976 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
980 fn
:= g_ExtractWadName(a
.pic
);
982 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
984 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
989 procedure ProcChangeColor(Sender
: TGUIControl
);
993 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
994 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
995 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
996 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
997 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
998 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
1000 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1001 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
1002 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
1003 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
1004 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
1005 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
1008 procedure ProcSelectModel(Sender
: TGUIControl
);
1013 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
1014 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
1015 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
1017 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
1018 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
1019 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
1021 ProcChangeColor(nil);
1024 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
1036 wad
:= TWADFile
.Create
;
1037 if wad
.ReadFile(GameWAD
) then
1038 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
1043 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
1045 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1046 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1047 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1048 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1050 if g_Texture_Get('FONT_STD', ID
) then
1051 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
1056 if cfglen
<> 0 then FreeMem(cfgdata
);
1059 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
1065 cfgdata
, fntdata
: Pointer;
1066 cfglen
, fntlen
: Integer;
1074 wad
:= TWADFile
.Create
;
1075 if wad
.ReadFile(GameWAD
) then
1077 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1078 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1084 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1085 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1086 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1088 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1089 FontID
:= e_CharFont_Create(spc
);
1091 for a
:= 0 to 255 do
1093 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1094 if chrwidth
= 0 then Continue
;
1096 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1098 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1104 if cfglen
<> 0 then FreeMem(cfgdata
);
1105 if fntlen
<> 0 then FreeMem(fntdata
);
1108 procedure MenuLoadData();
1110 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1112 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1113 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1114 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1115 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1116 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1117 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1118 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1119 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1120 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1121 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1122 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1123 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1124 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1125 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1126 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1127 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1128 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1129 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1130 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1131 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1132 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1133 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1134 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1135 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1136 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1138 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1139 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1140 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1141 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1142 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1143 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1144 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1147 procedure MenuFreeData();
1149 e_CharFont_Remove(gMenuFont
);
1150 e_CharFont_Remove(gMenuSmallFont
);
1152 g_Texture_Delete('MAINMENU_LOGO');
1153 g_Texture_Delete('MAINMENU_MARKER1');
1154 g_Texture_Delete('MAINMENU_MARKER2');
1155 g_Texture_Delete('SCROLL_LEFT');
1156 g_Texture_Delete('SCROLL_RIGHT');
1157 g_Texture_Delete('SCROLL_MIDDLE');
1158 g_Texture_Delete('SCROLL_MARKER');
1159 g_Texture_Delete('EDIT_LEFT');
1160 g_Texture_Delete('EDIT_RIGHT');
1161 g_Texture_Delete('EDIT_MIDDLE');
1162 g_Texture_Delete('BOX1');
1163 g_Texture_Delete('BOX2');
1164 g_Texture_Delete('BOX3');
1165 g_Texture_Delete('BOX4');
1166 g_Texture_Delete('BOX5');
1167 g_Texture_Delete('BOX6');
1168 g_Texture_Delete('BOX7');
1169 g_Texture_Delete('BOX8');
1170 g_Texture_Delete('BOX9');
1171 g_Texture_Delete('BSCROLL_UP_A');
1172 g_Texture_Delete('BSCROLL_UP_U');
1173 g_Texture_Delete('BSCROLL_DOWN_A');
1174 g_Texture_Delete('BSCROLL_DOWN_U');
1175 g_Texture_Delete('BSCROLL_MIDDLE');
1176 g_Texture_Delete('NOPIC');
1178 g_Sound_Delete('MENU_SELECT');
1179 g_Sound_Delete('MENU_OPEN');
1180 g_Sound_Delete('MENU_CLOSE');
1181 g_Sound_Delete('MENU_CHANGE');
1182 g_Sound_Delete('SCROLL_ADD');
1183 g_Sound_Delete('SCROLL_SUB');
1184 g_Sound_Delete('SOUND_PLAYER_FALL');
1187 procedure ProcAuthorsMenu();
1189 gMusic
.SetByName('MUSIC_INTERMUS');
1193 procedure ProcExitMenuKeyDown (yes
: Boolean);
1196 snd
: TPlayableSound
;
1201 g_Game_StopAllSounds(True);
1202 case (Random(18)) of
1203 0: s
:= 'SOUND_MONSTER_PAIN';
1204 1: s
:= 'SOUND_MONSTER_DIE_3';
1205 2: s
:= 'SOUND_MONSTER_SLOP';
1206 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1207 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1208 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1209 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1210 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1211 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1212 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1213 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1214 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1215 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1216 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1217 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1218 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1219 else s
:= 'SOUND_PLAYER_FALL';
1221 snd
:= TPlayableSound
.Create();
1222 res
:= snd
.SetByName(s
);
1223 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1227 while snd
.IsPlaying() do begin end;
1235 procedure ProcLoadMenu();
1242 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1243 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1244 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1248 procedure ProcSaveMenu();
1256 name
:= g_GetSaveName(a
, valid
);
1257 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1258 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1262 procedure ProcSaveGame(Sender
: TGUIControl
);
1266 if g_Game_IsNet
then Exit
;
1267 if g_Game_IsTestMap
then Exit
;
1268 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1269 g_Game_PauseAllSounds(True);
1270 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1272 g_ActiveWindow
:= nil;
1273 g_Game_Pause(False);
1276 procedure ProcLoadGame(Sender
: TGUIControl
);
1280 if g_Game_IsNet
then Exit
;
1281 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1282 if g_LoadGame(a
) then
1284 g_Game_PauseAllSounds(False)
1286 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1288 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1289 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1290 //g_ActiveWindow := nil;
1294 procedure ProcSinglePlayer (n
: Integer);
1295 var wad
, map
: AnsiString;
1298 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1299 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1300 if e_FindResource(AllMapDirs
, wad
) then
1302 wad
:= ExpandFileName(wad
);
1303 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1307 procedure ProcSingle1Player
;
1312 procedure ProcSingle2Players
;
1317 procedure ProcSelectMapMenu();
1320 wad_lb
: TGUIFileListBox
;
1321 map_lb
: TGUIListBox
;
1324 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1325 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1326 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1328 if wad_lb
.SelectedItem() <> '' then
1329 map
:= map_lb
.SelectedItem()
1333 wad_lb
.UpdateFileList();
1336 if wad_lb
.SelectedItem() <> '' then
1339 map_lb
.SelectItem(map
);
1341 if map_lb
.SelectedItem() <> '' then
1345 g_GUI_ShowWindow('SelectMapMenu');
1348 procedure ProcSelectCampaignMenu();
1351 wad_lb
: TGUIFileListBox
;
1353 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1354 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1356 wad_lb
.UpdateFileList();
1358 if wad_lb
.SelectedItem() <> '' then
1359 ProcSelectCampaignWAD(nil);
1362 procedure ProcSetMap();
1364 wad
, map
, res
: String;
1366 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1368 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1369 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1372 if (wad
= '') or (map
= '') then
1375 wad
:= e_FindWadRel(MapDirs
, WAD
);
1377 res
:= wad
+':\'+map
;
1379 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1380 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1383 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1387 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1389 g_Sound_SetupAllVolumes(
1390 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1391 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1395 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1399 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1400 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1402 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1403 g_dbg_scale
:= TempScale
+ 1;
1407 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1411 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1412 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1413 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1414 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1417 procedure ProcOptionsPlayersMIMenu();
1422 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1424 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1426 if a
= '' then Exit
;
1428 b
:= g_PlayerModel_GetInfo(a
);
1430 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1432 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1433 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1434 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1436 if b
.HaveWeapon
then
1437 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1439 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1442 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1445 procedure ProcOptionsPlayersAnim();
1449 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1454 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1457 Model
.GetCurrentAnimation
.Loop
:= True;
1458 Model
.GetCurrentAnimationMask
.Loop
:= True;
1462 procedure ProcOptionsPlayersWeap();
1466 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1471 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1475 procedure ProcOptionsPlayersRot();
1479 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1480 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1482 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1486 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1490 g_Options_SetDefault();
1496 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1498 if yes
then ReadOptions();
1502 procedure ProcAuthorsClose();
1504 gMusic
.SetByName('MUSIC_MENU');
1506 gState
:= STATE_MENU
;
1509 procedure ProcGMClose();
1511 g_Game_InGameMenu(False);
1514 procedure ProcGMShow();
1519 if (gGameSettings
.GameType
= GT_SINGLE
) and
1520 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1521 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1522 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1524 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1525 if g_Game_IsTestMap
then
1526 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1527 TGUIMainMenu(g_ActiveWindow
.GetControl(
1528 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1531 procedure ProcChangePlayers();
1533 TeamGame
, Spectator
, AddTwo
: Boolean;
1534 P1Team
{, P2Team}: Byte;
1535 bP2
: TGUITextButton
;
1537 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1538 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1539 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1540 P1Team
:= TEAM_NONE
;
1541 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1543 //P2Team := TEAM_NONE;
1544 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1546 TGUIMainMenu(g_ActiveWindow
.GetControl(
1547 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1548 TGUIMainMenu(g_ActiveWindow
.GetControl(
1549 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1550 TGUIMainMenu(g_ActiveWindow
.GetControl(
1551 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1553 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1554 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1555 bP2
.Enabled
:= AddTwo
and not Spectator
;
1557 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1559 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1560 if gPlayer2
= nil then
1561 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1563 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1565 TGUIMainMenu(g_ActiveWindow
.GetControl(
1566 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1569 procedure ProcJoinRed();
1571 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1573 if g_Game_IsServer
then
1575 if gPlayer1
= nil then
1576 g_Game_AddPlayer(TEAM_RED
)
1579 if gPlayer1
.Team
<> TEAM_RED
then
1581 gPlayer1
.SwitchTeam
;
1582 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1585 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1590 gPlayer1Settings
.Team
:= TEAM_RED
;
1591 MC_SEND_PlayerSettings
;
1592 if gPlayer1
= nil then
1593 g_Game_AddPlayer(TEAM_RED
);
1595 g_ActiveWindow
:= nil;
1596 g_Game_Pause(False);
1599 procedure ProcJoinBlue();
1601 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1603 if g_Game_IsServer
then
1605 if gPlayer1
= nil then
1606 g_Game_AddPlayer(TEAM_BLUE
)
1609 if gPlayer1
.Team
<> TEAM_BLUE
then
1611 gPlayer1
.SwitchTeam
;
1612 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1615 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1620 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1621 MC_SEND_PlayerSettings
;
1622 if gPlayer1
= nil then
1623 g_Game_AddPlayer(TEAM_BLUE
);
1625 g_ActiveWindow
:= nil;
1626 g_Game_Pause(False);
1629 procedure ProcJoinGame();
1631 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1633 if gPlayer1
= nil then
1635 g_ActiveWindow
:= nil;
1636 g_Game_Pause(False);
1639 procedure ProcSwitchP2();
1641 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1643 if gPlayer1
= nil then
1645 if gPlayer2
= nil then
1648 g_Game_RemovePlayer();
1649 g_ActiveWindow
:= nil;
1650 g_Game_Pause(False);
1653 procedure ProcSpectate();
1655 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1658 g_ActiveWindow
:= nil;
1659 g_Game_Pause(False);
1662 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1664 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1667 procedure ProcEndMenuKeyDown (yes
: Boolean);
1669 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1672 procedure ProcSetRussianLanguage
;
1674 if gLanguage
<> LANGUAGE_RUSSIAN
then
1676 gLanguage
:= LANGUAGE_RUSSIAN
;
1677 gLanguageChange
:= True;
1678 gAskLanguage
:= False;
1683 procedure ProcSetEnglishLanguage
;
1685 if gLanguage
<> LANGUAGE_ENGLISH
then
1687 gLanguage
:= LANGUAGE_ENGLISH
;
1688 gLanguageChange
:= True;
1689 gAskLanguage
:= False;
1694 procedure ReadGameSettings();
1698 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1700 with gGameSettings
do
1702 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1703 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1707 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1708 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1713 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1714 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1715 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1717 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1718 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1719 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1722 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1727 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1729 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1730 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1732 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1733 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1737 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1738 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1740 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1741 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1742 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1743 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1744 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1745 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1746 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1750 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1751 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1752 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1753 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1758 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1759 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1764 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1765 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1770 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1771 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1776 procedure ProcApplyGameSet();
1780 stat
: TPlayerStatArray
;
1782 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1784 if not g_Game_IsServer
then Exit
;
1786 with gGameSettings
do
1788 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1790 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1791 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1793 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1796 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1798 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1799 Options
:= Options
or GAME_OPTION_DMKEYS
1801 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1804 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1806 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1812 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1814 TimeLimit
:= Max(n
, b
);
1818 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1820 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1827 if GameMode
= GM_DM
then
1829 stat
:= g_Player_GetStats();
1831 for a
:= 0 to High(stat
) do
1832 if stat
[a
].Frags
> b
then
1836 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1838 GoalLimit
:= Max(n
, b
);
1842 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1844 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1845 if n
< 0 then n
:= 0;
1846 if n
> 255 then n
:= 255;
1852 stat
:= g_Player_GetStats();
1854 for a
:= 0 to High(stat
) do
1855 if stat
[a
].Lives
> b
then
1858 MaxLives
:= Max(n
, b
);
1862 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1864 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1867 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1868 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1872 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1873 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1877 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1878 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1884 if g_Game_IsNet
then MH_SEND_GameSettings
;
1887 procedure ProcVideoOptionsRes();
1892 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1894 TGUILabel(menu
.GetControl('lbCurrentRes')).Text :=
1895 IntToStr(gWinSizeX
) +
1896 ' x ' + IntToStr(gWinSizeY
) +
1897 ', ' + IntToStr(gBPP
) + ' bpp';
1899 with TGUIListBox(menu
.GetControl('lsResolution')) do
1901 list
:= sys_GetDisplayModes(gBPP
);
1905 ItemIndex
:= Length(list
)
1913 with TGUISwitch(menu
.GetControl('swFullScreen')) do
1919 TempResScale
:= Round(r_pixel_scale
- 1);
1920 TGUIScroll(menu
.GetControl('scResFactor')).Value
:= TempResScale
;
1923 procedure ProcApplyVideoOptions();
1926 Fullscreen
: Boolean;
1927 SWidth
, SHeight
: Integer;
1928 ScaleChanged
: Boolean;
1931 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1933 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1935 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1938 SWidth
:= gWinSizeX
;
1939 SHeight
:= gWinSizeY
;
1942 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1944 ScaleChanged
:= False;
1945 if TGUIScroll(menu
.GetControl('scResFactor')).Value
<> TempResScale
then
1947 TempResScale
:= TGUIScroll(menu
.GetControl('scResFactor')).Value
;
1948 r_pixel_scale
:= TempResScale
+ 1;
1949 ScaleChanged
:= True;
1952 if (SWidth
<> gWinSizeX
) or
1953 (SHeight
<> gWinSizeY
) or
1954 (Fullscreen
<> gFullscreen
) or
1957 gResolutionChange
:= True;
1958 gRC_Width
:= SWidth
;
1959 gRC_Height
:= SHeight
;
1960 gRC_FullScreen
:= Fullscreen
;
1961 gRC_Maximized
:= gWinMaximized
;
1964 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1968 procedure ProcSetFirstRussianLanguage
;
1970 gLanguage
:= LANGUAGE_RUSSIAN
;
1971 gLanguageChange
:= True;
1972 gAskLanguage
:= False;
1975 procedure ProcSetFirstEnglishLanguage
;
1977 gLanguage
:= LANGUAGE_ENGLISH
;
1978 gLanguageChange
:= True;
1979 gAskLanguage
:= False;
1982 procedure ProcRecallAddress();
1984 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1986 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1987 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1991 procedure CreateFirstLanguageMenu();
1995 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1997 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
1999 Name
:= 'mmFirstLanguageMenu';
2000 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
2001 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
2004 Menu
.DefControl
:= 'mmFirstLanguageMenu';
2005 Menu
.MainWindow
:= True;
2006 g_GUI_AddWindow(Menu
);
2009 procedure g_Menu_AskLanguage();
2011 CreateFirstLanguageMenu();
2012 g_GUI_ShowWindow('FirstLanguageMenu');
2015 procedure CreatePlayerOptionsMenu(s
: String);
2020 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
2022 a
:= _lc
[I_MENU_PLAYER_1
]
2024 a
:= _lc
[I_MENU_PLAYER_2
];
2025 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
2027 Name
:= 'mOptionsPlayers'+s
+'Menu';
2028 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
2030 Name
:= 'ed'+s
+'Name';
2034 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
2036 Name
:= 'sw'+s
+'Team';
2037 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
2038 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2040 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2042 Name
:= 'ls'+s
+'Model';
2044 Items
:= g_PlayerModel_GetNames();
2045 OnChange
:= ProcSelectModel
;
2047 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2049 Name
:= 'sc'+s
+'Red';
2051 OnChange
:= ProcChangeColor
;
2053 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2055 Name
:= 'sc'+s
+'Green';
2057 OnChange
:= ProcChangeColor
;
2059 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2061 Name
:= 'sc'+s
+'Blue';
2063 OnChange
:= ProcChangeColor
;
2066 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2067 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2068 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2069 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2071 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2073 Name
:= 'mv'+s
+'Model';
2074 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2075 Y
:= GetControl('ls'+s
+'Model').Y
;
2078 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2079 g_GUI_AddWindow(Menu
);
2082 procedure CreateAllMenus();
2086 a
, cx
, _y
, i
: Integer;
2089 Menu
:= TGUIWindow
.Create('MainMenu');
2090 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2092 Name
:= 'mmMainMenu';
2093 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2094 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2095 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2096 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2097 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2098 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2100 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2102 Color
:= _RGB(255, 255, 255);
2103 X
:= gScreenWidth
-GetWidth
-8;
2104 Y
:= gScreenHeight
-GetHeight
-8;
2106 Menu
.DefControl
:= 'mmMainMenu';
2107 Menu
.MainWindow
:= True;
2108 g_GUI_AddWindow(Menu
);
2110 Menu
:= TGUIWindow
.Create('NewGameMenu');
2111 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2113 Name
:= 'mmNewGameMenu';
2114 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2115 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2116 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2117 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2119 Menu
.DefControl
:= 'mmNewGameMenu';
2120 g_GUI_AddWindow(Menu
);
2122 Menu
:= TGUIWindow
.Create('NetGameMenu');
2123 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2125 Name
:= 'mmNetGameMenu';
2126 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2127 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2129 Menu
.DefControl
:= 'mmNetGameMenu';
2130 g_GUI_AddWindow(Menu
);
2132 Menu
:= TGUIWindow
.Create('NetServerMenu');
2133 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2135 Name
:= 'mNetServerMenu';
2136 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2138 Name
:= 'edSrvName';
2139 OnlyDigits
:= False;
2142 Text := NetServerName
;
2144 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2146 Name
:= 'edSrvPassword';
2147 OnlyDigits
:= False;
2150 Text := NetPassword
;
2152 with AddEdit(_lc
[I_NET_PORT
]) do
2158 Text := IntToStr(NetPort
);
2160 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2162 Name
:= 'edMaxPlayers';
2166 Text := IntToStr(NetMaxClients
);
2168 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2170 Name
:= 'swUseMaster';
2171 AddItem(_lc
[I_MENU_YES
]);
2172 AddItem(_lc
[I_MENU_NO
]);
2173 if NetUseMaster
then
2179 with AddLabel(_lc
[I_MENU_MAP
]) do
2184 OnClick
:= @ProcSelectMapMenu
;
2186 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2188 Name
:= 'swGameMode';
2189 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2190 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2191 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2192 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2193 case g_Game_TextToMode(gnGameMode
) of
2195 GM_DM
: ItemIndex
:= 0;
2196 GM_TDM
: ItemIndex
:= 1;
2197 GM_CTF
: ItemIndex
:= 2;
2199 GM_COOP
: ItemIndex
:= 3;
2201 OnChange
:= ProcSwitchMonstersNet
;
2203 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2205 Name
:= 'edTimeLimit';
2209 if gnTimeLimit
> 0 then
2210 Text := IntToStr(gnTimeLimit
);
2212 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2214 Name
:= 'edGoalLimit';
2218 if gnGoalLimit
> 0 then
2219 Text := IntToStr(gnGoalLimit
);
2221 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2223 Name
:= 'edMaxLives';
2227 if gnMaxLives
> 0 then
2228 Text := IntToStr(gnMaxLives
);
2230 with AddSwitch(_lc
[I_MENU_SERVER_PLAYERS
]) do
2232 Name
:= 'swPlayers';
2233 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2234 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2235 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2236 ItemIndex
:= gnPlayers
;
2238 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2240 Name
:= 'swTeamDamage';
2241 AddItem(_lc
[I_MENU_YES
]);
2242 AddItem(_lc
[I_MENU_NO
]);
2243 if gnTeamDamage
then
2248 with AddSwitch(_lc
[I_MENU_RESPAWN_ITEMS
]) do
2250 Name
:= 'swRespawnItems';
2251 AddItem(_lc
[I_MENU_YES
]);
2252 AddItem(_lc
[I_MENU_NO
]);
2253 if gnRespawnItems
then
2258 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2260 Name
:= 'swDeathmatchKeys';
2261 AddItem(_lc
[I_MENU_YES
]);
2262 AddItem(_lc
[I_MENU_NO
]);
2263 if gnDeathmatchKeys
then
2268 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2270 Name
:= 'swEnableExits';
2271 AddItem(_lc
[I_MENU_YES
]);
2272 AddItem(_lc
[I_MENU_NO
]);
2278 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2280 Name
:= 'swWeaponStay';
2281 AddItem(_lc
[I_MENU_YES
]);
2282 AddItem(_lc
[I_MENU_NO
]);
2283 if gnWeaponStay
then
2288 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2290 Name
:= 'swMonsters';
2291 AddItem(_lc
[I_MENU_YES
]);
2292 AddItem(_lc
[I_MENU_NO
]);
2298 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2301 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2302 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2303 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2305 if gnBotsVS
= 'Players' then
2307 if gnBotsVS
= 'Monsters' then
2311 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2315 Menu
.DefControl
:= 'mNetServerMenu';
2316 g_GUI_AddWindow(Menu
);
2318 Menu
:= TGUIWindow
.Create('NetClientMenu');
2319 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2321 Name
:= 'mNetClientMenu';
2323 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2326 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2332 Text := 'localhost';
2334 with AddEdit(_lc
[I_NET_PORT
]) do
2342 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2345 OnlyDigits
:= False;
2352 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2356 Menu
.DefControl
:= 'mNetClientMenu';
2357 g_GUI_AddWindow(Menu
);
2359 Menu
:= TGUIWindow
.Create('LoadMenu');
2360 Menu
.OnShow
:= ProcLoadMenu
;
2361 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2363 Name
:= 'mmLoadMenu';
2368 Name
:= 'edSlot'+IntToStr(a
);
2371 OnEnter
:= ProcLoadGame
;
2374 Menu
.DefControl
:= 'mmLoadMenu';
2375 g_GUI_AddWindow(Menu
);
2377 Menu
:= TGUIWindow
.Create('SaveMenu');
2378 Menu
.OnShow
:= ProcSaveMenu
;
2379 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2381 Name
:= 'mmSaveMenu';
2386 Name
:= 'edSlot'+IntToStr(a
);
2389 OnChange
:= ProcSaveGame
;
2392 Menu
.DefControl
:= 'mmSaveMenu';
2393 g_GUI_AddWindow(Menu
);
2395 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2396 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2398 Name
:= 'mCustomGameMenu';
2399 with AddLabel(_lc
[I_MENU_MAP
]) do
2404 OnClick
:= @ProcSelectMapMenu
;
2406 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2408 Name
:= 'swGameMode';
2409 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2410 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2411 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2412 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2413 case g_Game_TextToMode(gcGameMode
) of
2415 GM_DM
: ItemIndex
:= 0;
2416 GM_TDM
: ItemIndex
:= 1;
2417 GM_CTF
: ItemIndex
:= 2;
2419 GM_COOP
: ItemIndex
:= 3;
2421 OnChange
:= ProcSwitchMonstersCustom
;
2423 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2425 Name
:= 'edTimeLimit';
2429 if gcTimeLimit
> 0 then
2430 Text := IntToStr(gcTimeLimit
);
2432 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2434 Name
:= 'edGoalLimit';
2438 if gcGoalLimit
> 0 then
2439 Text := IntToStr(gcGoalLimit
);
2441 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2443 Name
:= 'edMaxLives';
2447 if gcMaxLives
> 0 then
2448 Text := IntToStr(gcMaxLives
);
2450 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2452 Name
:= 'swPlayers';
2453 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2454 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2455 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2456 ItemIndex
:= gcPlayers
;
2458 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2460 Name
:= 'swTeamDamage';
2461 AddItem(_lc
[I_MENU_YES
]);
2462 AddItem(_lc
[I_MENU_NO
]);
2463 if gcTeamDamage
then
2468 with AddSwitch(_lc
[I_MENU_RESPAWN_ITEMS
]) do
2470 Name
:= 'swRespawnItems';
2471 AddItem(_lc
[I_MENU_YES
]);
2472 AddItem(_lc
[I_MENU_NO
]);
2473 if gcRespawnItems
then
2478 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2480 Name
:= 'swDeathmatchKeys';
2481 AddItem(_lc
[I_MENU_YES
]);
2482 AddItem(_lc
[I_MENU_NO
]);
2483 if gcDeathmatchKeys
then
2488 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2490 Name
:= 'swEnableExits';
2491 AddItem(_lc
[I_MENU_YES
]);
2492 AddItem(_lc
[I_MENU_NO
]);
2498 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2500 Name
:= 'swWeaponStay';
2501 AddItem(_lc
[I_MENU_YES
]);
2502 AddItem(_lc
[I_MENU_NO
]);
2503 if gcWeaponStay
then
2508 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2510 Name
:= 'swMonsters';
2511 AddItem(_lc
[I_MENU_YES
]);
2512 AddItem(_lc
[I_MENU_NO
]);
2518 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2521 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2522 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2523 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2525 if gcBotsVS
= 'Players' then
2527 if gcBotsVS
= 'Monsters' then
2531 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2535 Menu
.DefControl
:= 'mCustomGameMenu';
2536 g_GUI_AddWindow(Menu
);
2538 Menu
:= TGUIWindow
.Create('CampaignMenu');
2539 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2541 Name
:= 'mCampaignMenu';
2550 with AddFileList('', 15, 4) do
2553 OnChange
:= ProcSelectCampaignWAD
;
2557 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2558 SetBase(MegawadDirs
);
2561 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2563 Name
:= 'lbWADName';
2567 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2569 Name
:= 'lbWADAuthor';
2573 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2574 with AddMemo('', 15, 3) do
2576 Name
:= 'meWADDescription';
2577 Color
:= MENU_ITEMSCTRL_COLOR
;
2579 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2581 Name
:= 'swPlayers';
2582 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2583 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2586 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2590 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2592 Name
:= 'mpWADImage';
2593 DefaultRes
:= 'NOPIC';
2594 X
:= GetControl('lsWAD').X
+4;
2595 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2598 Menu
.DefControl
:= 'mCampaignMenu';
2599 g_GUI_AddWindow(Menu
);
2601 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2602 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2604 Name
:= 'mSelectMapMenu';
2605 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2608 OnChange
:= ProcSelectWAD
;
2612 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2615 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2619 OnChange
:= ProcSelectMap
;
2622 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2624 Name
:= 'lbMapName';
2628 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2630 Name
:= 'lbMapAuthor';
2634 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2636 Name
:= 'lbMapSize';
2640 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2642 Name
:= 'meMapDescription';
2647 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2649 Name
:= 'mpMapPreview';
2650 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2651 Y
:= GetControl('lsMapWAD').Y
;
2653 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2655 Name
:= 'lbMapScale';
2658 Color
:= MENU_ITEMSCTRL_COLOR
;
2659 X
:= GetControl('lsMapWAD').X
+
2660 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2661 2 + MAPPREVIEW_WIDTH
*4;
2662 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2665 Menu
.OnClose
:= ProcSetMap
;
2666 Menu
.DefControl
:= 'mSelectMapMenu';
2667 g_GUI_AddWindow(Menu
);
2669 Menu
:= TGUIWindow
.Create('OptionsMenu');
2670 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2672 Name
:= 'mmOptionsMenu';
2673 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2674 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2675 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2676 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2677 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2678 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2680 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2681 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2683 Menu
.OnClose
:= ProcApplyOptions
;
2684 Menu
.DefControl
:= 'mmOptionsMenu';
2685 g_GUI_AddWindow(Menu
);
2687 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2688 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2689 g_GUI_AddWindow(Menu
);
2691 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2692 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2694 Name
:= 'mOptionsVideoMenu';
2695 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2696 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2702 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2705 AddItem(_lc
[I_MENU_YES
]);
2706 AddItem(_lc
[I_MENU_NO
]);
2708 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2710 Name
:= 'swTextureFilter';
2711 AddItem(_lc
[I_MENU_YES
]);
2712 AddItem(_lc
[I_MENU_NO
]);
2714 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2716 Name
:= 'swLegacyNPOT';
2717 AddItem(_lc
[I_MENU_NO
]);
2718 AddItem(_lc
[I_MENU_YES
]);
2721 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2724 Menu
.DefControl
:= 'mOptionsVideoMenu';
2725 g_GUI_AddWindow(Menu
);
2727 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2728 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2730 Name
:= 'mOptionsVideoResMenu';
2731 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2733 Name
:= 'lbCurrentRes';
2737 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2739 Name
:= 'lsResolution';
2742 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2744 Name
:= 'swFullScreen';
2745 AddItem(_lc
[I_MENU_YES
]);
2746 AddItem(_lc
[I_MENU_NO
]);
2748 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2750 Name
:= 'scResFactor';
2754 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2757 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2758 g_GUI_AddWindow(Menu
);
2760 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2761 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2763 Name
:= 'mOptionsSoundMenu';
2764 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2766 Name
:= 'scMusicLevel';
2768 OnChange
:= ProcChangeSoundSettings
;
2770 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2772 Name
:= 'scSoundLevel';
2774 OnChange
:= ProcChangeSoundSettings
;
2776 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2778 Name
:= 'scMaxSimSounds';
2781 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2783 Name
:= 'swAnnouncer';
2784 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2785 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2786 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2787 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2789 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2790 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2792 Name
:= 'swSoundEffects';
2793 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2794 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2796 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2797 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2799 Name
:= 'swChatSpeech';
2800 AddItem(_lc
[I_MENU_YES
]);
2801 AddItem(_lc
[I_MENU_NO
]);
2803 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2805 Name
:= 'swInactiveSounds';
2806 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2807 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2811 Menu
.DefControl
:= 'mOptionsSoundMenu';
2812 g_GUI_AddWindow(Menu
);
2814 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2815 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2817 Name
:= 'mOptionsGameMenu';
2818 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2820 Name
:= 'scParticlesCount';
2823 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2825 Name
:= 'swBloodCount';
2826 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2827 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2828 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2829 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2830 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2832 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2834 Name
:= 'scShellsMax';
2837 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2839 Name
:= 'scGibsMax';
2842 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2844 Name
:= 'scCorpsesMax';
2847 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2849 Name
:= 'swGibsCount';
2850 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2851 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2852 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2853 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2854 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2856 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2858 Name
:= 'swCorpseType';
2859 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2860 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2862 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2864 Name
:= 'swGibsType';
2865 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2866 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2868 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2870 Name
:= 'swBloodType';
2871 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2872 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2874 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2876 Name
:= 'swScreenFlash';
2877 AddItem(_lc
[I_MENU_NO
]);
2878 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2879 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2881 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2883 Name
:= 'swBackground';
2884 AddItem(_lc
[I_MENU_YES
]);
2885 AddItem(_lc
[I_MENU_NO
]);
2887 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2889 Name
:= 'swMessages';
2890 AddItem(_lc
[I_MENU_YES
]);
2891 AddItem(_lc
[I_MENU_NO
]);
2893 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2895 Name
:= 'swRevertPlayers';
2896 AddItem(_lc
[I_MENU_YES
]);
2897 AddItem(_lc
[I_MENU_NO
]);
2899 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2901 Name
:= 'swChatBubble';
2902 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2903 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2904 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2905 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2906 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2908 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2910 Name
:= 'swPlayerIndicator';
2911 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2912 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2913 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2915 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2917 Name
:= 'swPlayerIndicatorStyle';
2918 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2919 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2921 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2923 Name
:= 'scScaleFactor';
2925 OnChange
:= ProcChangeGameSettings
;
2929 Menu
.DefControl
:= 'mOptionsGameMenu';
2930 g_GUI_AddWindow(Menu
);
2932 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2933 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
2935 Name
:= 'mOptionsControlsMenu';
2936 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
2937 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
2938 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
2939 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
2940 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
2942 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
2943 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
2944 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
2945 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
2946 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
2947 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
2948 if e_HasJoysticks
then
2951 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
2953 if g_touch_enabled
then
2956 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
2959 Menu
.DefControl
:= 'mOptionsControlsMenu';
2960 g_GUI_AddWindow(Menu
);
2962 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
2963 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
2965 Name
:= 'mOptionsControlsP1Menu';
2966 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2967 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2968 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2969 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2970 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
2971 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
2972 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
2973 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
2974 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
2975 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
2977 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
2978 g_GUI_AddWindow(Menu
);
2980 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
2981 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
2983 Name
:= 'mOptionsControlsP1MenuWeapons';
2984 for i
:= WP_FIRST
to WP_LAST
do
2985 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
2986 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
2988 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
2989 g_GUI_AddWindow(Menu
);
2991 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
2992 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
2994 Name
:= 'mOptionsControlsP2Menu';
2995 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
2996 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
2997 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
2998 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
2999 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3000 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3001 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3002 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3003 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3004 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3006 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3007 g_GUI_AddWindow(Menu
);
3009 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3010 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3012 Name
:= 'mOptionsControlsP2MenuWeapons';
3013 for i
:= WP_FIRST
to WP_LAST
do
3014 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3015 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3017 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3018 g_GUI_AddWindow(Menu
);
3020 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3021 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3023 Name
:= 'mOptionsControlsJoystickMenu';
3024 for i
:= 0 to e_MaxJoys
- 1 do
3025 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3027 Name
:= 'scDeadzone' + IntToStr(i
);
3031 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3032 g_GUI_AddWindow(Menu
);
3034 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3035 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3037 Name
:= 'mOptionsControlsTouchMenu';
3038 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3040 Name
:= 'swTouchAlt';
3041 AddItem(_lc
[I_MENU_NO
]);
3042 AddItem(_lc
[I_MENU_YES
]);
3043 OnChange
:= ProcChangeTouchSettings
;
3045 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3047 Name
:= 'scTouchSize';
3049 OnChange
:= ProcChangeTouchSettings
;
3051 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3053 Name
:= 'swTouchFire';
3054 AddItem(_lc
[I_MENU_NO
]);
3055 AddItem(_lc
[I_MENU_YES
]);
3057 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3059 Name
:= 'scTouchOffset';
3061 OnChange
:= ProcChangeTouchSettings
;
3064 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3065 g_GUI_AddWindow(Menu
);
3067 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3068 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3070 Name
:= 'mOptionsPlayersMenu';
3071 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3072 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3074 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3075 g_GUI_AddWindow(Menu
);
3077 CreatePlayerOptionsMenu('P1');
3078 CreatePlayerOptionsMenu('P2');
3080 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3081 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3083 Name
:= 'mOptionsPlayersMIMenu';
3084 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3089 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3094 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3096 Name
:= 'meComment';
3099 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3100 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3103 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3107 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3108 g_GUI_AddWindow(Menu
);
3110 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3111 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3113 Name
:= 'mOptionsLanguageMenu';
3114 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3115 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3118 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3119 g_GUI_AddWindow(Menu
);
3121 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3122 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3123 g_GUI_AddWindow(Menu
);
3125 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3126 Menu
.BackTexture
:= 'INTER';
3127 Menu
.OnClose
:= ProcAuthorsClose
;
3131 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3133 Color
:= _RGB(255, 0, 0);
3134 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3136 _y
:= _y
+GetHeight();
3138 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3140 Color
:= _RGB(255, 0, 0);
3141 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3143 _y
:= _y
+GetHeight()+32;
3145 // ×òî äåëàë: Êòî äåëàë
3146 cx
:= gScreenWidth
div 2 - 320 + 64;
3147 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3149 Color
:= _RGB(255, 0, 0);
3154 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3156 Color
:= _RGB(255, 255, 255);
3161 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3163 Color
:= _RGB(255, 0, 0);
3168 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3170 Color
:= _RGB(255, 255, 255);
3175 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3177 Color
:= _RGB(255, 255, 255);
3182 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3184 Color
:= _RGB(255, 0, 0);
3189 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3191 Color
:= _RGB(255, 255, 255);
3196 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3198 Color
:= _RGB(255, 0, 0);
3203 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3205 Color
:= _RGB(255, 255, 255);
3208 _y
:= gScreenHeight
- 128;
3211 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3213 Color
:= _RGB(255, 0, 0);
3218 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3220 Color
:= _RGB(255, 255, 255);
3223 _y
:= _y
+GetHeight();
3225 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3227 Color
:= _RGB(255, 255, 255);
3230 _y
:= _y
+GetHeight();
3232 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3234 Color
:= _RGB(255, 255, 255);
3237 _y
:= gScreenHeight
- 32;
3239 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3241 Color
:= _RGB(255, 0, 0);
3242 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3245 g_GUI_AddWindow(Menu
);
3247 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3248 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3249 g_GUI_AddWindow(Menu
);
3251 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3252 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3254 Name
:= 'mmGameSingleMenu';
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
:= 'mmGameSingleMenu';
3263 Menu
.MainWindow
:= True;
3264 Menu
.OnClose
:= ProcGMClose
;
3265 Menu
.OnShow
:= ProcGMShow
;
3266 g_GUI_AddWindow(Menu
);
3268 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3269 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3270 g_GUI_AddWindow(Menu
);
3272 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3273 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3274 g_GUI_AddWindow(Menu
);
3276 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3277 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3279 Name
:= 'mmGameCustomMenu';
3280 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3281 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3282 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3283 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3284 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3285 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3286 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3288 Menu
.DefControl
:= 'mmGameCustomMenu';
3289 Menu
.MainWindow
:= True;
3290 Menu
.OnClose
:= ProcGMClose
;
3291 Menu
.OnShow
:= ProcGMShow
;
3292 g_GUI_AddWindow(Menu
);
3294 Menu
:= TGUIWindow
.Create('GameServerMenu');
3295 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3297 Name
:= 'mmGameServerMenu';
3298 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3299 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3300 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3301 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3302 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3304 Menu
.DefControl
:= 'mmGameServerMenu';
3305 Menu
.MainWindow
:= True;
3306 Menu
.OnClose
:= ProcGMClose
;
3307 Menu
.OnShow
:= ProcGMShow
;
3308 g_GUI_AddWindow(Menu
);
3310 Menu
:= TGUIWindow
.Create('GameClientMenu');
3311 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3313 Name
:= 'mmGameClientMenu';
3314 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3315 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3316 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3318 Menu
.DefControl
:= 'mmGameClientMenu';
3319 Menu
.MainWindow
:= True;
3320 Menu
.OnClose
:= ProcGMClose
;
3321 Menu
.OnShow
:= ProcGMShow
;
3322 g_GUI_AddWindow(Menu
);
3324 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3325 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3327 Name
:= 'mClientPasswordMenu';
3328 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3336 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3339 Menu
.DefControl
:= 'mClientPasswordMenu';
3340 g_GUI_AddWindow(Menu
);
3342 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3343 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3345 Name
:= 'mGameSetGameMenu';
3346 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3348 Name
:= 'swTeamDamage';
3349 AddItem(_lc
[I_MENU_YES
]);
3350 AddItem(_lc
[I_MENU_NO
]);
3353 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3355 Name
:= 'swDeathmatchKeys';
3356 AddItem(_lc
[I_MENU_YES
]);
3357 AddItem(_lc
[I_MENU_NO
]);
3360 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3362 Name
:= 'edTimeLimit';
3367 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3369 Name
:= 'edGoalLimit';
3374 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3376 Name
:= 'edMaxLives';
3381 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3384 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3385 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3386 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3392 Menu
.DefControl
:= 'mGameSetGameMenu';
3393 Menu
.OnClose
:= ProcApplyGameSet
;
3394 g_GUI_AddWindow(Menu
);
3396 Menu
:= TGUIWindow
.Create('TeamMenu');
3397 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3399 Name
:= 'mmTeamMenu';
3400 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3401 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3402 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3403 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3404 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3406 Menu
.DefControl
:= 'mmTeamMenu';
3407 Menu
.OnShow
:= ProcChangePlayers
;
3408 g_GUI_AddWindow(Menu
);
3411 procedure g_Menu_Show_SaveMenu();
3413 if g_Game_IsTestMap
then
3415 if gGameSettings
.GameType
= GT_SINGLE
then
3416 g_GUI_ShowWindow('GameSingleMenu')
3419 if g_Game_IsClient
then
3422 if g_Game_IsNet
then
3425 g_GUI_ShowWindow('GameCustomMenu');
3427 g_GUI_ShowWindow('SaveMenu');
3428 g_Sound_PlayEx('MENU_OPEN');
3431 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3433 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3434 if gGameSettings
.GameType
= GT_SINGLE
then
3436 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3440 if g_Game_IsClient
then exit
;
3441 if g_Game_IsNet
then exit
;
3442 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3444 g_GUI_ShowWindow('LoadMenu');
3445 g_Sound_PlayEx('MENU_OPEN');
3448 procedure g_Menu_Show_GameSetGame();
3450 if gGameSettings
.GameType
= GT_SINGLE
then
3451 g_GUI_ShowWindow('GameSingleMenu')
3454 if g_Game_IsClient
then
3457 if g_Game_IsNet
then
3458 g_GUI_ShowWindow('GameServerMenu')
3460 g_GUI_ShowWindow('GameCustomMenu');
3463 g_GUI_ShowWindow('GameSetGameMenu');
3464 g_Sound_PlayEx('MENU_OPEN');
3467 procedure g_Menu_Show_OptionsVideo();
3469 if gGameSettings
.GameType
= GT_SINGLE
then
3470 g_GUI_ShowWindow('GameSingleMenu')
3473 if g_Game_IsClient
then
3474 g_GUI_ShowWindow('GameClientMenu')
3476 if g_Game_IsNet
then
3477 g_GUI_ShowWindow('GameServerMenu')
3479 g_GUI_ShowWindow('GameCustomMenu');
3482 g_GUI_ShowWindow('OptionsMenu');
3483 g_GUI_ShowWindow('OptionsVideoMenu');
3484 g_Sound_PlayEx('MENU_OPEN');
3487 procedure g_Menu_Show_OptionsSound();
3489 if gGameSettings
.GameType
= GT_SINGLE
then
3490 g_GUI_ShowWindow('GameSingleMenu')
3493 if g_Game_IsClient
then
3494 g_GUI_ShowWindow('GameClientMenu')
3496 if g_Game_IsNet
then
3497 g_GUI_ShowWindow('GameServerMenu')
3499 g_GUI_ShowWindow('GameCustomMenu');
3502 g_GUI_ShowWindow('OptionsMenu');
3503 g_GUI_ShowWindow('OptionsSoundMenu');
3504 g_Sound_PlayEx('MENU_OPEN');
3507 procedure g_Menu_Show_EndGameMenu();
3509 g_GUI_ShowWindow('EndGameMenu');
3510 g_Sound_PlayEx('MENU_OPEN');
3513 procedure g_Menu_Show_QuitGameMenu();
3515 g_GUI_ShowWindow('ExitMenu');
3516 g_Sound_PlayEx('MENU_OPEN');
3519 procedure g_Menu_Init();
3526 procedure g_Menu_Free();
3530 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3535 procedure g_Menu_Reset();
3539 g_GUI_SaveMenuPos();
3540 ex
:= g_GUI_Destroy();
3544 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3549 g_Game_SetDebugMode();
3551 g_GUI_LoadMenuPos();