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();
113 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
115 if TGUISwitch(menu
.GetControl('swBPP')).ItemIndex
= 0 then
121 gVSync
:= TGUISwitch(menu
.GetControl('swVSync')).ItemIndex
= 0;
122 if (ovs
<> gVSync
) then
123 sys_EnableVSync(gVSync
);
125 gTextureFilter
:= TGUISwitch(menu
.GetControl('swTextureFilter')).ItemIndex
= 0;
126 glNPOTOverride
:= not (TGUISwitch(menu
.GetControl('swLegacyNPOT')).ItemIndex
= 0);
127 gLerpActors
:= TGUISwitch(menu
.GetControl('swInterp')).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_activate', '-p1_activate'), '');
198 g_Console_BindKey(g_Console_FindBind(1, '+p1_strafe', '-p1_strafe'), '');
199 g_Console_BindKey(g_Console_FindBind(1, 'p1_dropflag', ''), '');
200 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapnext', ''), '');
201 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapprev', ''), '');
202 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p1_moveright', '-p1_moveright');
203 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p1_moveleft', '-p1_moveleft');
204 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p1_lookup', '-p1_lookup');
205 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p1_lookdown', '-p1_lookdown');
206 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p1_attack', '-p1_attack');
207 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p1_jump', '-p1_jump');
208 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p1_activate', '-p1_activate');
209 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p1_strafe', '-p1_strafe');
210 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p1_dropflag', '');
211 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p1_weapnext', '', True);
212 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p1_weapprev', '', True);
214 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveright', '-p1_moveright'), '');
215 g_Console_BindKey(g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft'), '');
216 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookup', '-p1_lookup'), '');
217 g_Console_BindKey(g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown'), '');
218 g_Console_BindKey(g_Console_FindBind(2, '+p1_attack', '-p1_attack'), '');
219 g_Console_BindKey(g_Console_FindBind(2, '+p1_jump', '-p1_jump'), '');
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(g_Console_FindBind(2, 'p1_dropflag', ''), '');
223 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapnext', ''), '');
224 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapprev', ''), '');
225 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p1_moveright', '-p1_moveright');
226 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p1_moveleft', '-p1_moveleft');
227 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p1_lookup', '-p1_lookup');
228 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p1_lookdown', '-p1_lookdown');
229 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p1_attack', '-p1_attack');
230 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p1_jump', '-p1_jump');
231 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p1_activate', '-p1_activate');
232 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p1_strafe', '-p1_strafe');
233 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p1_dropflag', '');
234 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p1_weapnext', '', True);
235 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p1_weapprev', '', True);
238 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
241 for i
:= WP_FIRST
to WP_LAST
do
243 g_Console_BindKey(g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1)), '');
244 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p1_weapon ' + IntToStr(i
+ 1));
245 g_Console_BindKey(g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1)), '');
246 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p1_weapon ' + IntToStr(i
+ 1));
250 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
253 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveright', '-p2_moveright'), '');
254 g_Console_BindKey(g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft'), '');
255 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookup', '-p2_lookup'), '');
256 g_Console_BindKey(g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown'), '');
257 g_Console_BindKey(g_Console_FindBind(1, '+p2_attack', '-p2_attack'), '');
258 g_Console_BindKey(g_Console_FindBind(1, '+p2_jump', '-p2_jump'), '');
259 g_Console_BindKey(g_Console_FindBind(1, '+p2_activate', '-p2_activate'), '');
260 g_Console_BindKey(g_Console_FindBind(1, '+p2_strafe', '-p2_strafe'), '');
261 g_Console_BindKey(g_Console_FindBind(1, 'p2_dropflag', ''), '');
262 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapnext', ''), '');
263 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapprev', ''), '');
264 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
, '+p2_moveright', '-p2_moveright');
265 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
, '+p2_moveleft', '-p2_moveleft');
266 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
, '+p2_lookup', '-p2_lookup');
267 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
, '+p2_lookdown', '-p2_lookdown');
268 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
, '+p2_attack', '-p2_attack');
269 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
, '+p2_jump', '-p2_jump');
270 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
, '+p2_activate', '-p2_activate');
271 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
, '+p2_strafe', '-p2_strafe');
272 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
, 'p2_dropflag', '');
273 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
, 'p2_weapnext', '', True);
274 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
, 'p2_weapprev', '', True);
276 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveright', '-p2_moveright'), '');
277 g_Console_BindKey(g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft'), '');
278 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookup', '-p2_lookup'), '');
279 g_Console_BindKey(g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown'), '');
280 g_Console_BindKey(g_Console_FindBind(2, '+p2_attack', '-p2_attack'), '');
281 g_Console_BindKey(g_Console_FindBind(2, '+p2_jump', '-p2_jump'), '');
282 g_Console_BindKey(g_Console_FindBind(2, '+p2_activate', '-p2_activate'), '');
283 g_Console_BindKey(g_Console_FindBind(2, '+p2_strafe', '-p2_strafe'), '');
284 g_Console_BindKey(g_Console_FindBind(2, 'p2_dropflag', ''), '');
285 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapnext', ''), '');
286 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapprev', ''), '');
287 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
, '+p2_moveright', '-p2_moveright');
288 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
, '+p2_moveleft', '-p2_moveleft');
289 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
, '+p2_lookup', '-p2_lookup');
290 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
, '+p2_lookdown', '-p2_lookdown');
291 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
, '+p2_attack', '-p2_attack');
292 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
, '+p2_jump', '-p2_jump');
293 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
, '+p2_activate', '-p2_activate');
294 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
, '+p2_strafe', '-p2_strafe');
295 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
, 'p2_dropflag', '');
296 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
, 'p2_weapnext', '', True);
297 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
, 'p2_weapprev', '', True);
300 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
303 for i
:= WP_FIRST
to WP_LAST
do
305 g_Console_BindKey(g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1)), '');
306 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
, 'p2_weapon ' + IntToStr(i
+ 1));
307 g_Console_BindKey(g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1)), '');
308 g_Console_BindKey(TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
, 'p2_weapon ' + IntToStr(i
+ 1));
312 if e_HasJoysticks
then
314 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
317 for i
:= 0 to e_MaxJoys
- 1 do
318 if e_JoystickAvailable
[i
] then
319 e_JoystickDeadzones
[i
] := TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
*(32767 div 20)
323 if g_touch_enabled
then
325 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
326 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
327 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
328 g_touch_fire
:= TGUISwitch(menu
.GetControl('swTouchFire')).ItemIndex
= 1;
329 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
332 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
334 gPlayer1Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP1Name')).Text);
335 gPlayer1Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
= 0,
336 TEAM_RED
, TEAM_BLUE
);
338 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mvP1Model')) do
340 gPlayer1Settings
.Model
:= Model
.Name
;
341 gPlayer1Settings
.Color
:= Model
.Color
;
344 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
346 gPlayer2Settings
.Name
:= b_Text_Unformat(TGUIEdit(menu
.GetControl('edP2Name')).Text);
347 gPlayer2Settings
.Team
:= IfThen(TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
= 0,
348 TEAM_RED
, TEAM_BLUE
);
349 with TGUIModelView(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mvP2Model')) do
351 gPlayer2Settings
.Model
:= Model
.Name
;
352 gPlayer2Settings
.Color
:= Model
.Color
;
355 if gPlayer1Settings
.Name
= '' then gPlayer1Settings
.Name
:= GenPlayerName(1);
356 if gPlayer2Settings
.Name
= '' then gPlayer2Settings
.Name
:= GenPlayerName(2);
358 if g_Game_IsServer
then
360 if gPlayer1
<> nil then
362 gPlayer1
.SetModel(gPlayer1Settings
.Model
);
363 gPlayer1
.Name
:= gPlayer1Settings
.Name
;
364 if not (gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
]) then
365 gPlayer1
.SetColor(gPlayer1Settings
.Color
)
367 if gPlayer1
.Team
<> gPlayer1Settings
.Team
then
370 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
373 if gPlayer2
<> nil then
375 gPlayer2
.SetModel(gPlayer2Settings
.Model
);
376 gPlayer2
.Name
:= gPlayer2Settings
.Name
;
377 if (gGameSettings
.GameMode
<> GM_TDM
) and (gGameSettings
.GameMode
<> GM_CTF
) then
378 gPlayer2
.SetColor(gPlayer2Settings
.Color
)
380 if gPlayer2
.Team
<> gPlayer2Settings
.Team
then
385 if g_Game_IsClient
then MC_SEND_PlayerSettings
;
387 g_Console_WriteGameConfig
;
390 procedure ReadOptions();
395 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoMenu').GetControl('mOptionsVideoMenu'));
397 with TGUISwitch(menu
.GetControl('swBPP')) do
403 with TGUISwitch(menu
.GetControl('swTextureFilter')) do
404 if gTextureFilter
then ItemIndex
:= 0 else ItemIndex
:= 1;
406 with TGUISwitch(menu
.GetControl('swVSync')) do
407 if gVSync
then ItemIndex
:= 0 else ItemIndex
:= 1;
409 with TGUISwitch(menu
.GetControl('swLegacyNPOT')) do
410 if not glNPOTOverride
then ItemIndex
:= 0 else ItemIndex
:= 1;
412 with TGUISwitch(menu
.GetControl('swInterp')) do
413 if gLerpActors
then ItemIndex
:= 0 else ItemIndex
:= 1;
415 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
417 TGUIScroll(menu
.GetControl('scSoundLevel')).Value
:= Round(gSoundLevel
/16);
418 TGUIScroll(menu
.GetControl('scMusicLevel')).Value
:= Round(gMusicLevel
/16);
419 TGUIScroll(menu
.GetControl('scMaxSimSounds')).Value
:= Round((gMaxSimSounds
-2)/4);
421 with TGUISwitch(menu
.GetControl('swInactiveSounds')) do
422 if gMuteWhenInactive
then
427 TGUISwitch(menu
.GetControl('swAnnouncer')).ItemIndex
:= gAnnouncer
;
429 with TGUISwitch(menu
.GetControl('swSoundEffects')) do
430 if gSoundEffectsDF
then
435 with TGUISwitch(menu
.GetControl('swChatSpeech')) do
436 if gUseChatSounds
then
441 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
444 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p1_moveright', '-p1_moveright');
445 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p1_moveleft', '-p1_moveleft');
446 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p1_lookup', '-p1_lookup');
447 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p1_lookdown', '-p1_lookdown');
448 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p1_attack', '-p1_attack');
449 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p1_jump', '-p1_jump');
450 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p1_activate', '-p1_activate');
451 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p1_strafe', '-p1_strafe');
452 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p1_dropflag', '');
453 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapnext', '');
454 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p1_weapprev', '');
456 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p1_moveright', '-p1_moveright');
457 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p1_moveleft', '-p1_moveleft');
458 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p1_lookup', '-p1_lookup');
459 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p1_lookdown', '-p1_lookdown');
460 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p1_attack', '-p1_attack');
461 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p1_jump', '-p1_jump');
462 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p1_activate', '-p1_activate');
463 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p1_strafe', '-p1_strafe');
464 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p1_dropflag', '');
465 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapnext', '');
466 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p1_weapprev', '');
469 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
472 for i
:= WP_FIRST
to WP_LAST
do
474 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p1_weapon ' + IntToStr(i
+ 1));
475 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p1_weapon ' + IntToStr(i
+ 1));
479 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
482 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key0
:= g_Console_FindBind(1, '+p2_moveright', '-p2_moveright');
483 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key0
:= g_Console_FindBind(1, '+p2_moveleft', '-p2_moveleft');
484 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key0
:= g_Console_FindBind(1, '+p2_lookup', '-p2_lookup');
485 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key0
:= g_Console_FindBind(1, '+p2_lookdown', '-p2_lookdown');
486 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key0
:= g_Console_FindBind(1, '+p2_attack', '-p2_attack');
487 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key0
:= g_Console_FindBind(1, '+p2_jump', '-p2_jump');
488 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key0
:= g_Console_FindBind(1, '+p2_activate', '-p2_activate');
489 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key0
:= g_Console_FindBind(1, '+p2_strafe', '-p2_strafe');
490 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key0
:= g_Console_FindBind(1, 'p2_dropflag', '');
491 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapnext', '');
492 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key0
:= g_Console_FindBind(1, 'p2_weapprev', '');
494 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_RIGHT
])).Key1
:= g_Console_FindBind(2, '+p2_moveright', '-p2_moveright');
495 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_LEFT
])).Key1
:= g_Console_FindBind(2, '+p2_moveleft', '-p2_moveleft');
496 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_UP
])).Key1
:= g_Console_FindBind(2, '+p2_lookup', '-p2_lookup');
497 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DOWN
])).Key1
:= g_Console_FindBind(2, '+p2_lookdown', '-p2_lookdown');
498 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_FIRE
])).Key1
:= g_Console_FindBind(2, '+p2_attack', '-p2_attack');
499 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_JUMP
])).Key1
:= g_Console_FindBind(2, '+p2_jump', '-p2_jump');
500 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_USE
])).Key1
:= g_Console_FindBind(2, '+p2_activate', '-p2_activate');
501 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_STRAFE
])).Key1
:= g_Console_FindBind(2, '+p2_strafe', '-p2_strafe');
502 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_DROPFLAG
])).Key1
:= g_Console_FindBind(2, 'p2_dropflag', '');
503 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_NEXT_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapnext', '');
504 TGUIKeyRead2(GetControl(_lc
[I_MENU_CONTROL_PREV_WEAPON
])).Key1
:= g_Console_FindBind(2, 'p2_weapprev', '');
507 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
510 for i
:= WP_FIRST
to WP_LAST
do
512 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key0
:= g_Console_FindBind(1, 'p2_weapon ' + IntToStr(i
+ 1));
513 TGUIKeyRead2(GetControl(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)])).Key1
:= g_Console_FindBind(2, 'p2_weapon ' + IntToStr(i
+ 1));
517 if e_HasJoysticks
then
519 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu'));
522 for i
:= 0 to e_MaxJoys
- 1 do
523 if e_JoystickAvailable
[i
] then
524 TGUIScroll(menu
.GetControl('scDeadzone' + IntToStr(i
))).Value
:= e_JoystickDeadzones
[i
] div (32767 div 20)
528 if g_touch_enabled
then
530 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
531 with TGUISwitch(menu
.GetControl('swTouchAlt')) do
532 if g_touch_alt
then ItemIndex
:= 1 else ItemIndex
:= 0;
533 TGUIScroll(menu
.GetControl('scTouchSize')).Value
:= Round((g_touch_size
- 0.5) * 10);
534 with TGUISwitch(menu
.GetControl('swTouchFire')) do
535 if g_touch_fire
then ItemIndex
:= 1 else ItemIndex
:= 0;
536 TGUIScroll(menu
.GetControl('scTouchOffset')).Value
:= Round(g_touch_offset
/ 5);
539 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu'));
542 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_SCREENSHOT
])).Key
:= g_Console_FindBind(1, 'screenshot');
543 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_STAT
])).Key
:= g_Console_FindBind(1, '+p1_scores', '-p1_scores');
544 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_CHAT
])).Key
:= g_Console_FindBind(1, 'togglechat');
545 TGUIKeyRead(GetControl(_lc
[I_MENU_CONTROL_TEAMCHAT
])).Key
:= g_Console_FindBind(1, 'toggleteamchat');
548 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
550 TGUIScroll(menu
.GetControl('scParticlesCount')).Value
:= g_GFX_GetMax() div 1000;
551 TGUIScroll(menu
.GetControl('scShellsMax')).Value
:= g_Shells_GetMax() div 30;
552 TGUIScroll(menu
.GetControl('scGibsMax')).Value
:= g_Gibs_GetMax() div 25;
553 TGUIScroll(menu
.GetControl('scCorpsesMax')).Value
:= g_Corpses_GetMax() div 5;
554 TGUISwitch(menu
.GetControl('swBloodCount')).ItemIndex
:= gBloodCount
;
556 with TGUISwitch(menu
.GetControl('swScreenFlash')) do
559 with TGUISwitch(menu
.GetControl('swBloodType')) do
560 if gAdvBlood
then ItemIndex
:= 1 else ItemIndex
:= 0;
562 with TGUISwitch(menu
.GetControl('swCorpseType')) do
563 if gAdvCorpses
then ItemIndex
:= 1 else ItemIndex
:= 0;
565 with TGUISwitch(menu
.GetControl('swGibsType')) do
566 if gAdvGibs
then ItemIndex
:= 1 else ItemIndex
:= 0;
568 with TGUISwitch(menu
.GetControl('swGibsCount')) do
577 with TGUISwitch(menu
.GetControl('swBackGround')) do
578 if gDrawBackGround
then ItemIndex
:= 0 else ItemIndex
:= 1;
580 with TGUISwitch(menu
.GetControl('swMessages')) do
581 if gShowMessages
then ItemIndex
:= 0 else ItemIndex
:= 1;
583 with TGUISwitch(menu
.GetControl('swRevertPlayers')) do
584 if gRevertPlayers
then ItemIndex
:= 0 else ItemIndex
:= 1;
586 with TGUISwitch(menu
.GetControl('swChatBubble')) do
587 ItemIndex
:= gChatBubble
;
589 with TGUISwitch(menu
.GetControl('swPlayerIndicator')) do
590 ItemIndex
:= gPlayerIndicator
;
592 with TGUISwitch(menu
.GetControl('swPlayerIndicatorStyle')) do
593 ItemIndex
:= gPlayerIndicatorStyle
;
595 TempScale
:= Round(g_dbg_scale
- 1);
596 TGUIScroll(menu
.GetControl('scScaleFactor')).Value
:= TempScale
;
598 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu'));
600 TGUIListBox(menu
.GetControl('lsP1Model')).SelectItem(gPlayer1Settings
.Model
);
601 TGUIEdit(menu
.GetControl('edP1Name')).Text := gPlayer1Settings
.Name
;
603 TGUISwitch(menu
.GetControl('swP1Team')).ItemIndex
:=
604 IfThen(gPlayer1Settings
.Team
= TEAM_BLUE
, 1, 0);
606 TGUIScroll(menu
.GetControl('scP1Red')).Value
:= Round(gPlayer1Settings
.Color
.R
/16);
607 TGUIScroll(menu
.GetControl('scP1Green')).Value
:= Round(gPlayer1Settings
.Color
.G
/16);
608 TGUIScroll(menu
.GetControl('scP1Blue')).Value
:= Round(gPlayer1Settings
.Color
.B
/16);
610 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsPlayersP2Menu').GetControl('mOptionsPlayersP2Menu'));
612 TGUIListBox(menu
.GetControl('lsP2Model')).SelectItem(gPlayer2Settings
.Model
);
613 TGUIEdit(menu
.GetControl('edP2Name')).Text := gPlayer2Settings
.Name
;
615 TGUISwitch(menu
.GetControl('swP2Team')).ItemIndex
:=
616 IfThen(gPlayer2Settings
.Team
= TEAM_BLUE
, 1, 0);
618 TGUIScroll(menu
.GetControl('scP2Red')).Value
:= Round(gPlayer2Settings
.Color
.R
/16);
619 TGUIScroll(menu
.GetControl('scP2Green')).Value
:= Round(gPlayer2Settings
.Color
.G
/16);
620 TGUIScroll(menu
.GetControl('scP2Blue')).Value
:= Round(gPlayer2Settings
.Color
.B
/16);
622 ProcSelectModel(nil);
625 procedure ProcSwitchMonstersCustom(Sender
: TGUIControl
);
627 // don't turn off monsters in DM
629 with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
630 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
631 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
633 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
636 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
637 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
638 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
639 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
643 procedure ProcSwitchMonstersNet(Sender
: TGUIControl
);
645 // don't turn off monsters in DM
647 with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
648 if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
649 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
651 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
654 if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
655 TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
656 else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
657 TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
661 function LatchGameOptions(const MenuName
: string): Byte;
667 with TGUIMenu(g_ActiveWindow
.GetControl(MenuName
)) do
669 Map
:= TGUILabel(GetControl('lbMap')).Text;
672 if not isWadPath(Map
) then
675 Result
:= TGUISwitch(GetControl('swGameMode')).ItemIndex
+1;
676 gsGameMode
:= TGUISwitch(GetControl('swGameMode')).GetText
;
677 gsTimeLimit
:= StrToIntDef(TGUIEdit(GetControl('edTimeLimit')).Text, 0);
678 gsGoalLimit
:= StrToIntDef(TGUIEdit(GetControl('edGoalLimit')).Text, 0);
679 gsMaxLives
:= StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
680 gsItemRespawnTime
:= StrToIntDef(TGUIEdit(GetControl('edItemRespawnTime')).Text, 0);
681 gsPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
;
685 if TGUISwitch(GetControl('swTeamDamage')).ItemIndex
= 0 then
686 gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMDAMAGE
;
687 if TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
688 gsGameFlags
:= gsGameFlags
or GAME_OPTION_DMKEYS
;
689 if TGUISwitch(GetControl('swEnableExits')).ItemIndex
= 0 then
690 gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWEXIT
;
691 if TGUISwitch(GetControl('swWeaponStay')).ItemIndex
= 0 then
692 gsGameFlags
:= gsGameFlags
or GAME_OPTION_WEAPONSTAY
;
693 if TGUISwitch(GetControl('swMonsters')).ItemIndex
= 0 then
694 gsGameFlags
:= gsGameFlags
or GAME_OPTION_MONSTERS
;
696 case TGUISwitch(GetControl('swTeamHit')).ItemIndex
of
697 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
;
698 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITPROJECTILE
;
699 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
702 case TGUISwitch(GetControl('swBotsVS')).ItemIndex
of
703 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSMONSTER
;
704 2: gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
or GAME_OPTION_BOTVSMONSTER
;
705 else gsGameFlags
:= gsGameFlags
or GAME_OPTION_BOTVSPLAYER
;
708 case TGUISwitch(GetControl('swFlagDrop')).ItemIndex
of
709 0: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
710 1: gsGameFlags
:= gsGameFlags
or GAME_OPTION_ALLOWDROPFLAG
;
711 else gsGameFlags
:= gsGameFlags
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
714 // TODO: get this crap out of here
715 gGameSettings
.ItemRespawnTime
:= gsItemRespawnTime
;
716 gGameSettings
.WarmupTime
:= gsWarmupTime
;
717 gGameSettings
.SpawnInvul
:= gsSpawnInvul
;
721 procedure ProcStartCustomGame();
725 GameMode
:= LatchGameOptions('mCustomGameMenu');
726 if GameMode
= GM_NONE
then Exit
;
728 g_Console_WriteGameConfig
;
729 g_Game_StartCustom(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
,
730 gsMaxLives
, gsGameFlags
, gsPlayers
);
734 procedure ProcStartNetGame();
738 GameMode
:= LatchGameOptions('mNetServerMenu');
739 if GameMode
= GM_NONE
then Exit
;
741 with TGUIMenu(g_ActiveWindow
.GetControl('mNetServerMenu')) do
743 NetPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
744 NetServerName
:= TGUIEdit(GetControl('edSrvName')).Text;
745 NetMaxClients
:= Max(1, StrToIntDef(TGUIEdit(GetControl('edMaxPlayers')).Text, 1));
746 NetMaxClients
:= Min(NET_MAXCLIENTS
, NetMaxClients
);
747 NetPassword
:= TGUIEdit(GetControl('edSrvPassword')).Text;
748 NetUseMaster
:= TGUISwitch(GetControl('swUseMaster')).ItemIndex
= 0;
751 g_Console_WriteGameConfig
;
752 g_Game_StartServer(gsMap
, GameMode
, gsTimeLimit
, gsGoalLimit
, gsMaxLives
,
753 gsGameFlags
, gsPlayers
, 0, NetPort
);
756 procedure ProcConnectNetGame();
760 with TGUIMenu(g_ActiveWindow
.GetControl('mNetClientMenu')) do
762 NetClientIP
:= TGUIEdit(GetControl('edIP')).Text;
763 NetClientPort
:= StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
764 PW
:= TGUIEdit(GetControl('edPW')).Text;
767 g_Console_WriteGameConfig
;
768 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
771 procedure ProcEnterPassword();
775 with TGUIMenu(g_ActiveWindow
.GetControl('mClientPasswordMenu')) do
777 NetClientIP
:= PromptIP
;
778 NetClientPort
:= PromptPort
;
779 PW
:= TGUIEdit(GetControl('edPW')).Text;
782 g_Console_WriteGameConfig
;
783 g_Game_StartClient(NetClientIP
, NetClientPort
, PW
);
786 procedure ProcServerlist();
788 if not NetInitDone
then
790 if (not g_Net_Init()) then
792 g_Console_Add('NET: ERROR: Failed to init ENet!');
799 g_Net_Slist_Set(NetMasterList
);
801 gState
:= STATE_SLIST
;
802 g_ActiveWindow
:= nil;
804 slWaitStr
:= _lc
[I_NET_SLIST_WAIT
];
809 slReturnPressed
:= True;
810 if g_Net_Slist_Fetch(slCurrent
) then
812 if slCurrent
= nil then
813 slWaitStr
:= _lc
[I_NET_SLIST_NOSERVERS
];
816 slWaitStr
:= _lc
[I_NET_SLIST_ERROR
];
817 g_Serverlist_GenerateTable(slCurrent
, slTable
);
820 procedure ProcStartCampaign();
826 with TGUIMenu(g_ActiveWindow
.GetControl('mCampaignMenu')) do
828 WAD
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
829 TwoPlayers
:= TGUISwitch(GetControl('swPlayers')).ItemIndex
= 1;
831 WAD
:= e_FindWadRel(MegawadDirs
, WAD
);
837 g_Game_StartSingle(WAD
+ ':\MAP01', TwoPlayers
, n
);
840 procedure ProcSelectMap(Sender
: TGUIControl
);
844 wad
, map
, res
: String;
846 win
:= g_GUI_GetWindow('SelectMapMenu');
847 with TGUIMenu(win
.GetControl('mSelectMapMenu')) do
849 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
850 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
852 if (wad
= '') or (map
= '') then
853 begin // Ýòî íå êàðòà
854 TGUILabel(GetControl('lbMapName')).Text := '';
855 TGUILabel(GetControl('lbMapAuthor')).Text := '';
856 TGUILabel(GetControl('lbMapSize')).Text := '';
857 TGUIMemo(GetControl('meMapDescription')).SetText('');
858 TGUIMapPreview(win
.GetControl('mpMapPreview')).ClearMap();
859 TGUILabel(win
.GetControl('lbMapScale')).Text := '';
865 a
:= g_Map_GetMapInfo(res
);
867 TGUILabel(GetControl('lbMapName')).Text := a
.Name
;
868 TGUILabel(GetControl('lbMapAuthor')).Text := a
.Author
;
869 TGUILabel(GetControl('lbMapSize')).Text := Format('%dx%d', [a
.Width
, a
.Height
]);
870 TGUIMemo(GetControl('meMapDescription')).SetText(a
.Description
);
871 TGUIMapPreview(win
.GetControl('mpMapPreview')).SetMap(res
);
872 TGUILabel(win
.GetControl('lbMapScale')).Text :=
873 TGUIMapPreview(win
.GetControl('mpMapPreview')).GetScaleStr
;
878 procedure ProcSelectWAD(Sender
: TGUIControl
);
883 with TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu')) do
885 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
887 with TGUIListBox(GetControl('lsMapRes')) do
893 list
:= g_Map_GetMapsList(wad
);
907 procedure ProcSelectCampaignWAD(Sender
: TGUIControl
);
913 win
:= g_GUI_GetWindow('CampaignMenu');
914 with TGUIMenu(win
.GetControl('mCampaignMenu')) do
916 wad
:= TGUIFileListBox(GetControl('lsWAD')).SelectedItem();
920 TGUILabel(GetControl('lbWADName')).Text := '';
921 TGUILabel(GetControl('lbWADAuthor')).Text := '';
922 TGUIMemo(GetControl('meWADDescription')).SetText('');
925 a
:= g_Game_GetMegaWADInfo(wad
);
927 TGUILabel(GetControl('lbWADName')).Text := a
.Name
;
928 TGUILabel(GetControl('lbWADAuthor')).Text := a
.Author
;
929 TGUIMemo(GetControl('meWADDescription')).SetText(a
.Description
);
931 TGUIImage(win
.GetControl('mpWADImage')).ClearImage();
935 fn
:= g_ExtractWadName(a
.pic
);
937 TGUIImage(win
.GetControl('mpWADImage')).SetImage(wad
+a
.pic
)
939 TGUIImage(win
.GetControl('mpWADImage')).SetImage(a
.pic
);
944 procedure ProcChangeColor(Sender
: TGUIControl
);
948 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
949 with TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')) do
950 TGUIModelView(window
.GetControl('mvP1Model')).SetColor(
951 Min(TGUIScroll(GetControl('scP1Red')).Value
*16, 255),
952 Min(TGUIScroll(GetControl('scP1Green')).Value
*16, 255),
953 Min(TGUIScroll(GetControl('scP1Blue')).Value
*16, 255));
955 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
956 with TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')) do
957 TGUIModelView(window
.GetControl('mvP2Model')).SetColor(
958 Min(TGUIScroll(GetControl('scP2Red')).Value
*16, 255),
959 Min(TGUIScroll(GetControl('scP2Green')).Value
*16, 255),
960 Min(TGUIScroll(GetControl('scP2Blue')).Value
*16, 255));
963 procedure ProcSelectModel(Sender
: TGUIControl
);
968 window
:= g_GUI_GetWindow('OptionsPlayersP1Menu');
969 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP1Menu')).GetControl('lsP1Model')).SelectedItem
;
970 if a
<> '' then TGUIModelView(window
.GetControl('mvP1Model')).SetModel(a
);
972 window
:= g_GUI_GetWindow('OptionsPlayersP2Menu');
973 a
:= TGUIListBox(TGUIMenu(window
.GetControl('mOptionsPlayersP2Menu')).GetControl('lsP2Model')).SelectedItem
;
974 if a
<> '' then TGUIModelView(window
.GetControl('mvP2Model')).SetModel(a
);
976 ProcChangeColor(nil);
979 procedure LoadStdFont(cfgres
, texture
: string; var FontID
: DWORD
);
991 wad
:= TWADFile
.Create
;
992 if wad
.ReadFile(GameWAD
) then
993 wad
.GetResource('FONTS/'+cfgres
, cfgdata
, cfglen
);
998 g_Texture_CreateWADEx('FONT_STD', GameWAD
+':FONTS\'+texture
);
1000 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1001 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1002 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1003 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1005 if g_Texture_Get('FONT_STD', ID
) then
1006 e_TextureFontBuild(ID
, FontID
, cwdt
, chgt
, spc
);
1011 if cfglen
<> 0 then FreeMem(cfgdata
);
1014 procedure LoadFont(txtres
, fntres
: string; var FontID
: DWORD
);
1020 cfgdata
, fntdata
: Pointer;
1021 cfglen
, fntlen
: Integer;
1029 wad
:= TWADFile
.Create
;
1030 if wad
.ReadFile(GameWAD
) then
1032 wad
.GetResource('FONTS/'+txtres
, cfgdata
, cfglen
);
1033 wad
.GetResource('FONTS/'+fntres
, fntdata
, fntlen
);
1039 config
:= TConfig
.CreateMem(cfgdata
, cfglen
);
1040 cwdt
:= Min(Max(config
.ReadInt('FontMap', 'CharWidth', 0), 0), 255);
1041 chgt
:= Min(Max(config
.ReadInt('FontMap', 'CharHeight', 0), 0), 255);
1043 spc
:= Min(Max(config
.ReadInt('FontMap', 'Kerning', 0), -128), 127);
1044 FontID
:= e_CharFont_Create(spc
);
1046 for a
:= 0 to 255 do
1048 chrwidth
:= config
.ReadInt(IntToStr(a
), 'Width', 0);
1049 if chrwidth
= 0 then Continue
;
1051 if e_CreateTextureMemEx(fntdata
, fntlen
, CharID
, cwdt
*(a
mod 16), chgt
*(a
div 16),
1053 e_CharFont_AddChar(FontID
, CharID
, Chr(a
), chrwidth
);
1059 if cfglen
<> 0 then FreeMem(cfgdata
);
1060 if fntlen
<> 0 then FreeMem(fntdata
);
1063 procedure MenuLoadData();
1065 e_WriteLog('Loading menu data...', TMsgType
.Notify
);
1067 g_Texture_CreateWADEx('MAINMENU_LOGO', GameWAD
+':TEXTURES\MAINLOGO');
1068 g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD
+':TEXTURES\MARKER1');
1069 g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD
+':TEXTURES\MARKER2');
1070 g_Texture_CreateWADEx('SCROLL_LEFT', GameWAD
+':TEXTURES\SLEFT');
1071 g_Texture_CreateWADEx('SCROLL_RIGHT', GameWAD
+':TEXTURES\SRIGHT');
1072 g_Texture_CreateWADEx('SCROLL_MIDDLE', GameWAD
+':TEXTURES\SMIDDLE');
1073 g_Texture_CreateWADEx('SCROLL_MARKER', GameWAD
+':TEXTURES\SMARKER');
1074 g_Texture_CreateWADEx('EDIT_LEFT', GameWAD
+':TEXTURES\ELEFT');
1075 g_Texture_CreateWADEx('EDIT_RIGHT', GameWAD
+':TEXTURES\ERIGHT');
1076 g_Texture_CreateWADEx('EDIT_MIDDLE', GameWAD
+':TEXTURES\EMIDDLE');
1077 g_Texture_CreateWADEx('BOX1', GameWAD
+':TEXTURES\BOX1');
1078 g_Texture_CreateWADEx('BOX2', GameWAD
+':TEXTURES\BOX2');
1079 g_Texture_CreateWADEx('BOX3', GameWAD
+':TEXTURES\BOX3');
1080 g_Texture_CreateWADEx('BOX4', GameWAD
+':TEXTURES\BOX4');
1081 g_Texture_CreateWADEx('BOX5', GameWAD
+':TEXTURES\BOX5');
1082 g_Texture_CreateWADEx('BOX6', GameWAD
+':TEXTURES\BOX6');
1083 g_Texture_CreateWADEx('BOX7', GameWAD
+':TEXTURES\BOX7');
1084 g_Texture_CreateWADEx('BOX8', GameWAD
+':TEXTURES\BOX8');
1085 g_Texture_CreateWADEx('BOX9', GameWAD
+':TEXTURES\BOX9');
1086 g_Texture_CreateWADEx('BSCROLL_UP_A', GameWAD
+':TEXTURES\SCROLLUPA');
1087 g_Texture_CreateWADEx('BSCROLL_UP_U', GameWAD
+':TEXTURES\SCROLLUPU');
1088 g_Texture_CreateWADEx('BSCROLL_DOWN_A', GameWAD
+':TEXTURES\SCROLLDOWNA');
1089 g_Texture_CreateWADEx('BSCROLL_DOWN_U', GameWAD
+':TEXTURES\SCROLLDOWNU');
1090 g_Texture_CreateWADEx('BSCROLL_MIDDLE', GameWAD
+':TEXTURES\SCROLLMIDDLE');
1091 g_Texture_CreateWADEx('NOPIC', GameWAD
+':TEXTURES\NOPIC');
1093 g_Sound_CreateWADEx('MENU_SELECT', GameWAD
+':SOUNDS\MENUSELECT');
1094 g_Sound_CreateWADEx('MENU_OPEN', GameWAD
+':SOUNDS\MENUOPEN');
1095 g_Sound_CreateWADEx('MENU_CLOSE', GameWAD
+':SOUNDS\MENUCLOSE');
1096 g_Sound_CreateWADEx('MENU_CHANGE', GameWAD
+':SOUNDS\MENUCHANGE');
1097 g_Sound_CreateWADEx('SCROLL_ADD', GameWAD
+':SOUNDS\SCROLLADD');
1098 g_Sound_CreateWADEx('SCROLL_SUB', GameWAD
+':SOUNDS\SCROLLSUB');
1099 g_Sound_CreateWADEx('SOUND_PLAYER_FALL', GameWAD
+':SOUNDS\FALL');
1102 procedure MenuFreeData();
1104 e_CharFont_Remove(gMenuFont
);
1105 e_CharFont_Remove(gMenuSmallFont
);
1107 g_Texture_Delete('MAINMENU_LOGO');
1108 g_Texture_Delete('MAINMENU_MARKER1');
1109 g_Texture_Delete('MAINMENU_MARKER2');
1110 g_Texture_Delete('SCROLL_LEFT');
1111 g_Texture_Delete('SCROLL_RIGHT');
1112 g_Texture_Delete('SCROLL_MIDDLE');
1113 g_Texture_Delete('SCROLL_MARKER');
1114 g_Texture_Delete('EDIT_LEFT');
1115 g_Texture_Delete('EDIT_RIGHT');
1116 g_Texture_Delete('EDIT_MIDDLE');
1117 g_Texture_Delete('BOX1');
1118 g_Texture_Delete('BOX2');
1119 g_Texture_Delete('BOX3');
1120 g_Texture_Delete('BOX4');
1121 g_Texture_Delete('BOX5');
1122 g_Texture_Delete('BOX6');
1123 g_Texture_Delete('BOX7');
1124 g_Texture_Delete('BOX8');
1125 g_Texture_Delete('BOX9');
1126 g_Texture_Delete('BSCROLL_UP_A');
1127 g_Texture_Delete('BSCROLL_UP_U');
1128 g_Texture_Delete('BSCROLL_DOWN_A');
1129 g_Texture_Delete('BSCROLL_DOWN_U');
1130 g_Texture_Delete('BSCROLL_MIDDLE');
1131 g_Texture_Delete('NOPIC');
1133 g_Sound_Delete('MENU_SELECT');
1134 g_Sound_Delete('MENU_OPEN');
1135 g_Sound_Delete('MENU_CLOSE');
1136 g_Sound_Delete('MENU_CHANGE');
1137 g_Sound_Delete('SCROLL_ADD');
1138 g_Sound_Delete('SCROLL_SUB');
1139 g_Sound_Delete('SOUND_PLAYER_FALL');
1142 procedure ProcAuthorsMenu();
1144 gMusic
.SetByName('MUSIC_INTERMUS');
1148 procedure ProcExitMenuKeyDown (yes
: Boolean);
1151 snd
: TPlayableSound
;
1156 g_Game_StopAllSounds(True);
1157 case (Random(18)) of
1158 0: s
:= 'SOUND_MONSTER_PAIN';
1159 1: s
:= 'SOUND_MONSTER_DIE_3';
1160 2: s
:= 'SOUND_MONSTER_SLOP';
1161 3: s
:= 'SOUND_MONSTER_DEMON_DIE';
1162 4: s
:= 'SOUND_MONSTER_IMP_DIE_2';
1163 5: s
:= 'SOUND_MONSTER_MAN_DIE';
1164 6: s
:= 'SOUND_MONSTER_BSP_DIE';
1165 7: s
:= 'SOUND_MONSTER_VILE_DIE';
1166 8: s
:= 'SOUND_MONSTER_SKEL_DIE';
1167 9: s
:= 'SOUND_MONSTER_MANCUB_ALERT';
1168 10: s
:= 'SOUND_MONSTER_PAIN_PAIN';
1169 11: s
:= 'SOUND_MONSTER_BARON_DIE';
1170 12: s
:= 'SOUND_MONSTER_CACO_DIE';
1171 13: s
:= 'SOUND_MONSTER_CYBER_DIE';
1172 14: s
:= 'SOUND_MONSTER_KNIGHT_ALERT';
1173 15: s
:= 'SOUND_MONSTER_SPIDER_ALERT';
1174 else s
:= 'SOUND_PLAYER_FALL';
1176 snd
:= TPlayableSound
.Create();
1177 res
:= snd
.SetByName(s
);
1178 if not res
then res
:= snd
.SetByName('SOUND_PLAYER_FALL');
1182 while snd
.IsPlaying() do begin end;
1190 procedure ProcLoadMenu();
1197 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Text := g_GetSaveName(a
, valid
);
1198 TGUIEdit(TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= not valid
;
1199 //TGUIMenu(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu')).GetControl('edSlot'+IntToStr(a)).Enabled := valid;
1203 procedure ProcSaveMenu();
1211 name
:= g_GetSaveName(a
, valid
);
1212 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Text := name
;
1213 TGUIEdit(TGUIMenu(g_GUI_GetWindow('SaveMenu').GetControl('mmSaveMenu')).GetControl('edSlot'+IntToStr(a
))).Invalid
:= (name
<> '') and (not valid
);
1217 procedure ProcSaveGame(Sender
: TGUIControl
);
1221 if g_Game_IsNet
then Exit
;
1222 if g_Game_IsTestMap
then Exit
;
1223 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1224 g_Game_PauseAllSounds(True);
1225 g_SaveGame(a
, TGUIEdit(Sender
).Text);
1227 g_ActiveWindow
:= nil;
1228 g_Game_Pause(False);
1231 procedure ProcLoadGame(Sender
: TGUIControl
);
1235 if g_Game_IsNet
then Exit
;
1236 a
:= StrToInt(Copy(Sender
.Name
, Length(Sender
.Name
), 1));
1237 if g_LoadGame(a
) then
1239 g_Game_PauseAllSounds(False)
1241 else // Íå çàãðóçèëîñü - âîçâðàò â ìåíþ
1243 g_Console_Add(_lc
[I_MSG_BAD_SAVE_VERSION
], true);
1244 g_GUI_GetWindow('LoadMenu').SetActive(g_GUI_GetWindow('LoadMenu').GetControl('mmLoadMenu'));
1245 //g_ActiveWindow := nil;
1249 procedure ProcSinglePlayer (n
: Integer);
1250 var wad
, map
: AnsiString;
1253 wad
:= g_ExtractWadName(gDefaultMegawadStart
);
1254 map
:= g_ExtractFilePathName(gDefaultMegawadStart
);
1255 if e_FindResource(AllMapDirs
, wad
) then
1257 wad
:= ExpandFileName(wad
);
1258 g_Game_StartSingle(wad
+ ':\' + map
, n
> 1, n
)
1262 procedure ProcSingle1Player
;
1267 procedure ProcSingle2Players
;
1272 procedure ProcSelectMapMenu();
1275 wad_lb
: TGUIFileListBox
;
1276 map_lb
: TGUIListBox
;
1279 menu
:= TGUIMenu(g_GUI_GetWindow('SelectMapMenu').GetControl('mSelectMapMenu'));
1280 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsMapWAD'));
1281 map_lb
:= TGUIListBox(menu
.GetControl('lsMapRes'));
1283 if wad_lb
.SelectedItem() <> '' then
1284 map
:= map_lb
.SelectedItem()
1288 wad_lb
.UpdateFileList();
1291 if wad_lb
.SelectedItem() <> '' then
1294 map_lb
.SelectItem(map
);
1296 if map_lb
.SelectedItem() <> '' then
1300 g_GUI_ShowWindow('SelectMapMenu');
1303 procedure ProcSelectCampaignMenu();
1306 wad_lb
: TGUIFileListBox
;
1308 menu
:= TGUIMenu(g_GUI_GetWindow('CampaignMenu').GetControl('mCampaignMenu'));
1309 wad_lb
:= TGUIFileListBox(menu
.GetControl('lsWAD'));
1311 wad_lb
.UpdateFileList();
1313 if wad_lb
.SelectedItem() <> '' then
1314 ProcSelectCampaignWAD(nil);
1317 procedure ProcSetMap();
1319 wad
, map
, res
: String;
1321 with TGUIMenu(g_ActiveWindow
.GetControl('mSelectMapMenu')) do
1323 wad
:= TGUIFileListBox(GetControl('lsMapWAD')).SelectedItem();
1324 map
:= TGUIListBox(GetControl('lsMapRes')).SelectedItem();
1327 if (wad
= '') or (map
= '') then
1330 wad
:= e_FindWadRel(MapDirs
, WAD
);
1332 res
:= wad
+':\'+map
;
1334 TGUILabel(TGUIMenu(g_GUI_GetWindow('CustomGameMenu').GetControl('mCustomGameMenu')).GetControl('lbMap')).Text := res
;
1335 TGUILabel(TGUIMenu(g_GUI_GetWindow('NetServerMenu').GetControl('mNetServerMenu')).GetControl('lbMap')).Text := res
;
1338 procedure ProcChangeSoundSettings(Sender
: TGUIControl
);
1342 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
1344 g_Sound_SetupAllVolumes(
1345 Min(TGUIScroll(menu
.GetControl('scSoundLevel')).Value
*16, 255),
1346 Min(TGUIScroll(menu
.GetControl('scMusicLevel')).Value
*16, 255)
1350 procedure ProcChangeGameSettings(Sender
: TGUIControl
);
1354 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsGameMenu').GetControl('mOptionsGameMenu'));
1355 if TGUIScroll(menu
.GetControl('scScaleFactor')).Value
<> TempScale
then
1357 TempScale
:= TGUIScroll(menu
.GetControl('scScaleFactor')).Value
;
1358 g_dbg_scale
:= TempScale
+ 1;
1362 procedure ProcChangeTouchSettings(Sender
: TGUIControl
);
1366 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
1367 g_touch_alt
:= TGUISwitch(menu
.GetControl('swTouchAlt')).ItemIndex
= 1;
1368 g_touch_size
:= TGUIScroll(menu
.GetControl('scTouchSize')).Value
/ 10 + 0.5;
1369 g_touch_offset
:= TGUIScroll(menu
.GetControl('scTouchOffset')).Value
* 5;
1372 procedure ProcOptionsPlayersMIMenu();
1377 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1379 a
:= TGUIListBox(TGUIMenu(g_ActiveWindow
.GetControl('mOptionsPlayers'+s
+'Menu')).GetControl('ls'+s
+'Model')).SelectedItem
;
1381 if a
= '' then Exit
;
1383 b
:= g_PlayerModel_GetInfo(a
);
1385 with TGUIMenu(g_GUI_GetWindow('OptionsPlayersMIMenu').GetControl('mOptionsPlayersMIMenu')) do
1387 TGUILabel(GetControl('lbName')).Text := b
.Name
;
1388 TGUILabel(GetControl('lbAuthor')).Text := b
.Author
;
1389 TGUIMemo(GetControl('meComment')).SetText(b
.Description
);
1391 if b
.HaveWeapon
then
1392 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_YES
]
1394 TGUILabel(GetControl('lbWeapon')).Text := _lc
[I_MENU_NO
];
1397 g_GUI_ShowWindow('OptionsPlayersMIMenu');
1400 procedure ProcOptionsPlayersAnim();
1404 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1409 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1412 Model
.GetCurrentAnimation
.Loop
:= True;
1413 Model
.GetCurrentAnimationMask
.Loop
:= True;
1417 procedure ProcOptionsPlayersWeap();
1421 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then
1426 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')) do
1430 procedure ProcOptionsPlayersRot();
1434 if g_ActiveWindow
.Name
= 'OptionsPlayersP1Menu' then s
:= 'P1' else s
:= 'P2';
1435 with TGUIModelView(g_ActiveWindow
.GetControl('mv'+s
+'Model')).Model
do
1437 if Direction
= TDirection
.D_LEFT
then Direction
:= TDirection
.D_RIGHT
else Direction
:= TDirection
.D_LEFT
;
1441 procedure ProcDefaultMenuKeyDown (yes
: Boolean);
1445 g_Options_SetDefault();
1451 procedure ProcSavedMenuKeyDown (yes
: Boolean);
1453 if yes
then ReadOptions();
1457 procedure ProcAuthorsClose();
1459 gMusic
.SetByName('MUSIC_MENU');
1461 gState
:= STATE_MENU
;
1464 procedure ProcGMClose();
1466 g_Game_InGameMenu(False);
1469 procedure ProcGMShow();
1474 if (gGameSettings
.GameType
= GT_SINGLE
) and
1475 ((gPlayer1
= nil) or (not gPlayer1
.alive
)) and
1476 ((gPlayer2
= nil) or (not gPlayer2
.alive
)) then
1477 Enabled
:= False; // Îäèí èç èãðîêîâ ïîãèá â ñèíãëå
1479 Enabled
:= False; // Çàïðåòèòü ñîõðàíåíèå â èíòåðìèññèè (íå ðåàëèçîâàíî)
1480 if g_Game_IsTestMap
then
1481 Enabled
:= False; // Åñëè èãðàåì íà òåñòîâîé èëè âðåìåííîé êàðòå
1482 TGUIMainMenu(g_ActiveWindow
.GetControl(
1483 g_ActiveWindow
.DefControl
)).EnableButton('save', Enabled
);
1486 procedure ProcChangePlayers();
1488 TeamGame
, Spectator
, AddTwo
: Boolean;
1489 P1Team
{, P2Team}: Byte;
1490 bP2
: TGUITextButton
;
1492 TeamGame
:= gGameSettings
.GameMode
in [GM_TDM
, GM_CTF
];
1493 Spectator
:= (gPlayer1
= nil) and (gPlayer2
= nil);
1494 AddTwo
:= gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
];
1495 P1Team
:= TEAM_NONE
;
1496 if gPlayer1
<> nil then P1Team
:= gPlayer1
.Team
;
1498 //P2Team := TEAM_NONE;
1499 //if gPlayer2 <> nil then P2Team := gPlayer2.Team;
1501 TGUIMainMenu(g_ActiveWindow
.GetControl(
1502 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinRed', TeamGame
and (P1Team
<> TEAM_RED
));
1503 TGUIMainMenu(g_ActiveWindow
.GetControl(
1504 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinBlue', TeamGame
and (P1Team
<> TEAM_BLUE
));
1505 TGUIMainMenu(g_ActiveWindow
.GetControl(
1506 g_ActiveWindow
.DefControl
)).EnableButton('tmJoinGame', Spectator
and not TeamGame
);
1508 bP2
:= TGUIMainMenu(g_ActiveWindow
.GetControl(
1509 g_ActiveWindow
.DefControl
)).GetButton('tmPlayer2');
1510 bP2
.Enabled
:= AddTwo
and not Spectator
;
1512 bP2
.Color
:= MAINMENU_ITEMS_COLOR
1514 bP2
.Color
:= MAINMENU_UNACTIVEITEMS_COLOR
;
1515 if gPlayer2
= nil then
1516 bP2
.Caption
:= _lc
[I_MENU_ADD_PLAYER_2
]
1518 bP2
.Caption
:= _lc
[I_MENU_REM_PLAYER_2
];
1520 TGUIMainMenu(g_ActiveWindow
.GetControl(
1521 g_ActiveWindow
.DefControl
)).EnableButton('tmSpectate', not Spectator
);
1524 procedure ProcJoinRed();
1526 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1528 if g_Game_IsServer
then
1530 if gPlayer1
= nil then
1531 g_Game_AddPlayer(TEAM_RED
)
1534 if gPlayer1
.Team
<> TEAM_RED
then
1536 gPlayer1
.SwitchTeam
;
1537 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1540 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1545 gPlayer1Settings
.Team
:= TEAM_RED
;
1546 MC_SEND_PlayerSettings
;
1547 if gPlayer1
= nil then
1548 g_Game_AddPlayer(TEAM_RED
);
1550 g_ActiveWindow
:= nil;
1551 g_Game_Pause(False);
1554 procedure ProcJoinBlue();
1556 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1558 if g_Game_IsServer
then
1560 if gPlayer1
= nil then
1561 g_Game_AddPlayer(TEAM_BLUE
)
1564 if gPlayer1
.Team
<> TEAM_BLUE
then
1566 gPlayer1
.SwitchTeam
;
1567 gPlayer1Settings
.Team
:= gPlayer1
.Team
;
1570 if g_Game_IsNet
then MH_SEND_PlayerSettings(gPlayer1
.UID
);
1575 gPlayer1Settings
.Team
:= TEAM_BLUE
;
1576 MC_SEND_PlayerSettings
;
1577 if gPlayer1
= nil then
1578 g_Game_AddPlayer(TEAM_BLUE
);
1580 g_ActiveWindow
:= nil;
1581 g_Game_Pause(False);
1584 procedure ProcJoinGame();
1586 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1588 if gPlayer1
= nil then
1590 g_ActiveWindow
:= nil;
1591 g_Game_Pause(False);
1594 procedure ProcSwitchP2();
1596 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
]) then
1598 if gPlayer1
= nil then
1600 if gPlayer2
= nil then
1603 g_Game_RemovePlayer();
1604 g_ActiveWindow
:= nil;
1605 g_Game_Pause(False);
1608 procedure ProcSpectate();
1610 if not (gGameSettings
.GameType
in [GT_CUSTOM
, GT_SERVER
, GT_CLIENT
]) then
1613 g_ActiveWindow
:= nil;
1614 g_Game_Pause(False);
1617 procedure ProcRestartMenuKeyDown (yes
: Boolean);
1619 if yes
then g_Game_Restart() else g_GUI_HideWindow
;
1622 procedure ProcEndMenuKeyDown (yes
: Boolean);
1624 if yes
then gExit
:= EXIT_SIMPLE
else g_GUI_HideWindow
;
1627 procedure ProcSetRussianLanguage
;
1629 if gLanguage
<> LANGUAGE_RUSSIAN
then
1631 gLanguage
:= LANGUAGE_RUSSIAN
;
1632 gLanguageChange
:= True;
1633 gAskLanguage
:= False;
1638 procedure ProcSetEnglishLanguage
;
1640 if gLanguage
<> LANGUAGE_ENGLISH
then
1642 gLanguage
:= LANGUAGE_ENGLISH
;
1643 gLanguageChange
:= True;
1644 gAskLanguage
:= False;
1649 procedure ReadGameSettings();
1653 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1655 with gGameSettings
do
1657 with TGUISwitch(menu
.GetControl('swTeamDamage')) do
1658 if LongBool(Options
and GAME_OPTION_TEAMDAMAGE
) then
1662 with TGUISwitch(menu
.GetControl('swTeamHit')) do
1663 if (Options
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
1665 else if LongBool(Options
and GAME_OPTION_TEAMHITTRACE
) then
1667 else if LongBool(Options
and GAME_OPTION_TEAMHITPROJECTILE
) then
1671 with TGUISwitch(menu
.GetControl('swDeathmatchKeys')) do
1672 if LongBool(Options
and GAME_OPTION_DMKEYS
) then
1676 with TGUISwitch(menu
.GetControl('swFlagDrop')) do
1677 if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) and LongBool(Options
and GAME_OPTION_THROWFLAG
) then
1679 else if LongBool(Options
and GAME_OPTION_ALLOWDROPFLAG
) then
1684 TGUIEdit(menu
.GetControl('edTimeLimit')).Text := IntToStr(TimeLimit
);
1685 TGUIEdit(menu
.GetControl('edGoalLimit')).Text := IntToStr(GoalLimit
);
1686 TGUIEdit(menu
.GetControl('edMaxLives')).Text := IntToStr(MaxLives
);
1688 with TGUISwitch(menu
.GetControl('swBotsVS')) do
1689 if LongBool(Options
and GAME_OPTION_BOTVSPLAYER
) and
1690 LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1693 if LongBool(Options
and GAME_OPTION_BOTVSMONSTER
) then
1698 if GameType
in [GT_CUSTOM
, GT_SERVER
] then
1700 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1701 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1702 if (GameMode
in [GM_DM
, GM_TDM
, GM_CTF
]) then
1704 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= True;
1705 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_ITEMSTEXT_COLOR
;
1709 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1710 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1712 TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
:= True;
1713 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1714 TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
:= True;
1715 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_ITEMSTEXT_COLOR
;
1716 TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
:= True;
1717 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_ITEMSTEXT_COLOR
;
1718 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1719 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= True;
1723 TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
:= True;
1724 TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
:= True;
1725 TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
:= False;
1726 TGUILabel(menu
.GetControlsText('swDeathmatchKeys')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1727 with TGUIEdit(menu
.GetControl('edTimeLimit')) do
1732 TGUILabel(menu
.GetControlsText('edTimeLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1733 with TGUIEdit(menu
.GetControl('edGoalLimit')) do
1738 TGUILabel(menu
.GetControlsText('edGoalLimit')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1739 with TGUIEdit(menu
.GetControl('edMaxLives')) do
1744 TGUILabel(menu
.GetControlsText('edMaxLives')).Color
:= MENU_UNACTIVEITEMS_COLOR
;
1745 TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
:= True;
1746 TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
:= False;
1751 procedure ProcApplyGameSet();
1755 stat
: TPlayerStatArray
;
1757 menu
:= TGUIMenu(g_GUI_GetWindow('GameSetGameMenu').GetControl('mGameSetGameMenu'));
1759 if not g_Game_IsServer
then Exit
;
1761 with gGameSettings
do
1763 if TGUISwitch(menu
.GetControl('swTeamDamage')).Enabled
then
1765 if TGUISwitch(menu
.GetControl('swTeamDamage')).ItemIndex
= 0 then
1766 Options
:= Options
or GAME_OPTION_TEAMDAMAGE
1768 Options
:= Options
and (not GAME_OPTION_TEAMDAMAGE
);
1771 if TGUISwitch(menu
.GetControl('swTeamHit')).Enabled
then
1773 Options
:= Options
and not (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
);
1774 case TGUISwitch(menu
.GetControl('swTeamHit')).ItemIndex
of
1775 1: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
;
1776 2: Options
:= Options
or GAME_OPTION_TEAMHITPROJECTILE
;
1777 0: Options
:= Options
or GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
;
1781 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).Enabled
then
1783 if TGUISwitch(menu
.GetControl('swDeathmatchKeys')).ItemIndex
= 0 then
1784 Options
:= Options
or GAME_OPTION_DMKEYS
1786 Options
:= Options
and (not GAME_OPTION_DMKEYS
);
1789 if TGUIEdit(menu
.GetControl('edTimeLimit')).Enabled
then
1791 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edTimeLimit')).Text, TimeLimit
);
1797 b
:= (gTime
- gGameStartTime
) div 1000 + 10; // 10 ñåêóíä íà ñìåíó
1799 TimeLimit
:= Max(n
, b
);
1803 if TGUIEdit(menu
.GetControl('edGoalLimit')).Enabled
then
1805 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edGoalLimit')).Text, GoalLimit
);
1812 if GameMode
= GM_DM
then
1814 stat
:= g_Player_GetStats();
1816 for a
:= 0 to High(stat
) do
1817 if stat
[a
].Frags
> b
then
1821 b
:= Max(gTeamStat
[TEAM_RED
].Goals
, gTeamStat
[TEAM_BLUE
].Goals
);
1823 GoalLimit
:= Max(n
, b
);
1827 if TGUIEdit(menu
.GetControl('edMaxLives')).Enabled
then
1829 n
:= StrToIntDef(TGUIEdit(menu
.GetControl('edMaxLives')).Text, GoalLimit
);
1830 if n
< 0 then n
:= 0;
1831 if n
> 255 then n
:= 255;
1837 stat
:= g_Player_GetStats();
1839 for a
:= 0 to High(stat
) do
1840 if stat
[a
].Lives
> b
then
1843 MaxLives
:= Max(n
, b
);
1847 if TGUISwitch(menu
.GetControl('swBotsVS')).Enabled
then
1849 case TGUISwitch(menu
.GetControl('swBotsVS')).ItemIndex
of
1852 Options
:= Options
and (not GAME_OPTION_BOTVSPLAYER
);
1853 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1857 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1858 Options
:= Options
or GAME_OPTION_BOTVSMONSTER
;
1862 Options
:= Options
or GAME_OPTION_BOTVSPLAYER
;
1863 Options
:= Options
and (not GAME_OPTION_BOTVSMONSTER
);
1868 if TGUISwitch(menu
.GetControl('swFlagDrop')).Enabled
then
1870 case TGUISwitch(menu
.GetControl('swFlagDrop')).ItemIndex
of
1871 0: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
;
1872 1: Options
:= Options
or GAME_OPTION_ALLOWDROPFLAG
;
1873 else Options
:= Options
and not (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
);
1877 // don't forget to latch this shit
1878 gsGameFlags
:= Options
;
1879 gsMaxLives
:= MaxLives
;
1880 gsGoalLimit
:= GoalLimit
;
1881 gsTimeLimit
:= TimeLimit
;
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 with TGUISwitch(menu
.GetControl('swResFactor')) do
1921 ItemIndex
:= Min(TempResScale
, gRC_Width
div 640 - 1);
1924 procedure ProcApplyVideoOptions();
1927 Fullscreen
: Boolean;
1928 SWidth
, SHeight
: Integer;
1929 ScaleChanged
: Boolean;
1932 menu
:= TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
1934 str
:= TGUIListBox(menu
.GetControl('lsResolution')).SelectedItem
;
1936 SScanf(str
, '%dx%d', [@SWidth
, @SHeight
])
1939 SWidth
:= gWinSizeX
;
1940 SHeight
:= gWinSizeY
;
1941 TempResScale
:= Min(TempResScale
, SWidth
div 640 - 1);
1944 Fullscreen
:= TGUISwitch(menu
.GetControl('swFullScreen')).ItemIndex
= 0;
1946 ScaleChanged
:= False;
1947 if TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
<> TempResScale
then
1949 TempResScale
:= Min(TGUISwitch(menu
.GetControl('swResFactor')).ItemIndex
, SWidth
div 640 - 1);
1950 r_pixel_scale
:= TempResScale
+ 1;
1951 ScaleChanged
:= True;
1954 if (SWidth
<> gWinSizeX
) or
1955 (SHeight
<> gWinSizeY
) or
1956 (Fullscreen
<> gFullscreen
) or
1959 gResolutionChange
:= True;
1960 gRC_Width
:= SWidth
;
1961 gRC_Height
:= SHeight
;
1962 gRC_FullScreen
:= Fullscreen
;
1963 gRC_Maximized
:= gWinMaximized
;
1966 // Ñîõðàíÿåì èçìåíåíèÿ âñåõ íàñòðîåê:
1970 procedure ProcSetFirstRussianLanguage
;
1972 gLanguage
:= LANGUAGE_RUSSIAN
;
1973 gLanguageChange
:= True;
1974 gAskLanguage
:= False;
1977 procedure ProcSetFirstEnglishLanguage
;
1979 gLanguage
:= LANGUAGE_ENGLISH
;
1980 gLanguageChange
:= True;
1981 gAskLanguage
:= False;
1984 procedure ProcRecallAddress();
1986 with TGUIMenu(g_GUI_GetWindow('NetClientMenu').GetControl('mNetClientMenu')) do
1988 TGUIEdit(GetControl('edIP')).Text := NetClientIP
;
1989 TGUIEdit(GetControl('edPort')).Text := IntToStr(NetClientPort
);
1993 procedure CreateFirstLanguageMenu();
1997 Menu
:= TGUIWindow
.Create('FirstLanguageMenu');
1999 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', ' '))) do
2001 Name
:= 'mmFirstLanguageMenu';
2002 AddButton(@ProcSetFirstRussianLanguage
, 'Ðóññêèé', '');
2003 AddButton(@ProcSetFirstEnglishLanguage
, 'English', '');
2006 Menu
.DefControl
:= 'mmFirstLanguageMenu';
2007 Menu
.MainWindow
:= True;
2008 g_GUI_AddWindow(Menu
);
2011 procedure g_Menu_AskLanguage();
2013 CreateFirstLanguageMenu();
2014 g_GUI_ShowWindow('FirstLanguageMenu');
2017 procedure CreatePlayerOptionsMenu(s
: String);
2022 Menu
:= TGUIWindow
.Create('OptionsPlayers'+s
+'Menu');
2024 a
:= _lc
[I_MENU_PLAYER_1
]
2026 a
:= _lc
[I_MENU_PLAYER_2
];
2027 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, a
))) do
2029 Name
:= 'mOptionsPlayers'+s
+'Menu';
2030 with AddEdit(_lc
[I_MENU_PLAYER_NAME
]) do
2032 Name
:= 'ed'+s
+'Name';
2036 with AddSwitch(_lc
[I_MENU_PLAYER_TEAM
]) do
2038 Name
:= 'sw'+s
+'Team';
2039 AddItem(_lc
[I_MENU_PLAYER_TEAM_RED
]);
2040 AddItem(_lc
[I_MENU_PLAYER_TEAM_BLUE
]);
2042 with AddList(_lc
[I_MENU_PLAYER_MODEL
], 12, 6) do
2044 Name
:= 'ls'+s
+'Model';
2046 Items
:= g_PlayerModel_GetNames();
2047 OnChange
:= ProcSelectModel
;
2049 with AddScroll(_lc
[I_MENU_PLAYER_RED
]) do
2051 Name
:= 'sc'+s
+'Red';
2053 OnChange
:= ProcChangeColor
;
2055 with AddScroll(_lc
[I_MENU_PLAYER_GREEN
]) do
2057 Name
:= 'sc'+s
+'Green';
2059 OnChange
:= ProcChangeColor
;
2061 with AddScroll(_lc
[I_MENU_PLAYER_BLUE
]) do
2063 Name
:= 'sc'+s
+'Blue';
2065 OnChange
:= ProcChangeColor
;
2068 AddButton(@ProcOptionsPlayersMIMenu
, _lc
[I_MENU_MODEL_INFO
]);
2069 AddButton(@ProcOptionsPlayersAnim
, _lc
[I_MENU_MODEL_ANIMATION
]);
2070 AddButton(@ProcOptionsPlayersWeap
, _lc
[I_MENU_MODEL_CHANGE_WEAPON
]);
2071 AddButton(@ProcOptionsPlayersRot
, _lc
[I_MENU_MODEL_ROTATE
]);
2073 with TGUIModelView(Menu
.AddChild(TGUIModelView
.Create
)) do
2075 Name
:= 'mv'+s
+'Model';
2076 X
:= GetControl('ls'+s
+'Model').X
+TGUIListBox(GetControl('ls'+s
+'Model')).GetWidth
+16;
2077 Y
:= GetControl('ls'+s
+'Model').Y
;
2080 Menu
.DefControl
:= 'mOptionsPlayers'+s
+'Menu';
2081 g_GUI_AddWindow(Menu
);
2084 procedure CreateAllMenus();
2088 a
, cx
, _y
, i
: Integer;
2091 Menu
:= TGUIWindow
.Create('MainMenu');
2092 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, 'MAINMENU_LOGO', _lc
[I_MENU_MAIN_MENU
]))) do
2094 Name
:= 'mmMainMenu';
2095 AddButton(nil, _lc
[I_MENU_NEW_GAME
], 'NewGameMenu');
2096 AddButton(nil, _lc
[I_MENU_MULTIPLAYER
], 'NetGameMenu');
2097 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
2098 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
2099 AddButton(@ProcAuthorsMenu
, _lc
[I_MENU_AUTHORS
], 'AuthorsMenu');
2100 AddButton(nil, _lc
[I_MENU_EXIT
], 'ExitMenu');
2102 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_VERSION
], [GAME_VERSION
]), gMenuSmallFont
))) do
2104 Color
:= _RGB(255, 255, 255);
2105 X
:= gScreenWidth
-GetWidth
-8;
2106 Y
:= gScreenHeight
-GetHeight
-8;
2108 Menu
.DefControl
:= 'mmMainMenu';
2109 Menu
.MainWindow
:= True;
2110 g_GUI_AddWindow(Menu
);
2112 Menu
:= TGUIWindow
.Create('NewGameMenu');
2113 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_NEW_GAME
]))) do
2115 Name
:= 'mmNewGameMenu';
2116 AddButton(@ProcSingle1Player
, _lc
[I_MENU_1_PLAYER
]);
2117 AddButton(@ProcSingle2Players
, _lc
[I_MENU_2_PLAYERS
]);
2118 AddButton(nil, _lc
[I_MENU_CUSTOM_GAME
], 'CustomGameMenu');
2119 AddButton(@ProcSelectCampaignMenu
, _lc
[I_MENU_CAMPAIGN
], 'CampaignMenu');
2121 Menu
.DefControl
:= 'mmNewGameMenu';
2122 g_GUI_AddWindow(Menu
);
2124 Menu
:= TGUIWindow
.Create('NetGameMenu');
2125 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MULTIPLAYER
]))) do
2127 Name
:= 'mmNetGameMenu';
2128 AddButton(@ProcRecallAddress
, _lc
[I_MENU_START_CLIENT
], 'NetClientMenu');
2129 AddButton(nil, _lc
[I_MENU_START_SERVER
], 'NetServerMenu');
2131 Menu
.DefControl
:= 'mmNetGameMenu';
2132 g_GUI_AddWindow(Menu
);
2134 Menu
:= TGUIWindow
.Create('NetServerMenu');
2135 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_SERVER
]))) do
2137 Name
:= 'mNetServerMenu';
2138 with AddEdit(_lc
[I_NET_SERVER_NAME
]) do
2140 Name
:= 'edSrvName';
2141 OnlyDigits
:= False;
2144 Text := NetServerName
;
2146 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2148 Name
:= 'edSrvPassword';
2149 OnlyDigits
:= False;
2152 Text := NetPassword
;
2154 with AddEdit(_lc
[I_NET_PORT
]) do
2160 Text := IntToStr(NetPort
);
2162 with AddEdit(_lc
[I_NET_MAX_CLIENTS
]) do
2164 Name
:= 'edMaxPlayers';
2168 Text := IntToStr(NetMaxClients
);
2170 with AddSwitch(_lc
[I_NET_USE_MASTER
]) do
2172 Name
:= 'swUseMaster';
2173 AddItem(_lc
[I_MENU_YES
]);
2174 AddItem(_lc
[I_MENU_NO
]);
2175 if NetUseMaster
then
2181 with AddLabel(_lc
[I_MENU_MAP
]) do
2186 OnClick
:= @ProcSelectMapMenu
;
2188 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2190 Name
:= 'swGameMode';
2191 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2192 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2193 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2194 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2195 case g_Game_TextToMode(gsGameMode
) of
2197 GM_DM
: ItemIndex
:= 0;
2198 GM_TDM
: ItemIndex
:= 1;
2199 GM_CTF
: ItemIndex
:= 2;
2201 GM_COOP
: ItemIndex
:= 3;
2203 OnChange
:= ProcSwitchMonstersCustom
;
2205 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2207 Name
:= 'edTimeLimit';
2211 if gsTimeLimit
> 0 then
2212 Text := IntToStr(gsTimeLimit
);
2214 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2216 Name
:= 'edGoalLimit';
2220 if gsGoalLimit
> 0 then
2221 Text := IntToStr(gsGoalLimit
);
2223 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2225 Name
:= 'edMaxLives';
2229 if gsMaxLives
> 0 then
2230 Text := IntToStr(gsMaxLives
);
2232 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2234 Name
:= 'edItemRespawnTime';
2238 if gsItemRespawnTime
> 0 then
2239 Text := IntToStr(gsItemRespawnTime
);
2241 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2243 Name
:= 'swPlayers';
2244 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2245 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2246 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2247 ItemIndex
:= gsPlayers
;
2249 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2251 Name
:= 'swTeamDamage';
2252 AddItem(_lc
[I_MENU_YES
]);
2253 AddItem(_lc
[I_MENU_NO
]);
2254 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2259 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2261 Name
:= 'swTeamHit';
2262 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2263 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2264 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2265 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2266 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2268 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2270 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2275 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2277 Name
:= 'swDeathmatchKeys';
2278 AddItem(_lc
[I_MENU_YES
]);
2279 AddItem(_lc
[I_MENU_NO
]);
2280 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2285 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2287 Name
:= 'swEnableExits';
2288 AddItem(_lc
[I_MENU_YES
]);
2289 AddItem(_lc
[I_MENU_NO
]);
2290 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2295 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2297 Name
:= 'swWeaponStay';
2298 AddItem(_lc
[I_MENU_YES
]);
2299 AddItem(_lc
[I_MENU_NO
]);
2300 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2305 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2307 Name
:= 'swMonsters';
2308 AddItem(_lc
[I_MENU_YES
]);
2309 AddItem(_lc
[I_MENU_NO
]);
2310 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2315 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2318 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2319 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2320 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2322 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2324 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2327 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2329 Name
:= 'swFlagDrop';
2330 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2331 AddItem(_lc
[I_MENU_YES
]);
2332 AddItem(_lc
[I_MENU_NO
]);
2333 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2335 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2341 AddButton(@ProcStartNetGame
, _lc
[I_MENU_START_GAME
]);
2345 Menu
.DefControl
:= 'mNetServerMenu';
2346 g_GUI_AddWindow(Menu
);
2348 Menu
:= TGUIWindow
.Create('NetClientMenu');
2349 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_START_CLIENT
]))) do
2351 Name
:= 'mNetClientMenu';
2353 AddButton(@ProcServerlist
, _lc
[I_NET_SLIST
]);
2356 with AddEdit(_lc
[I_NET_ADDRESS
]) do
2362 Text := 'localhost';
2364 with AddEdit(_lc
[I_NET_PORT
]) do
2372 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
2375 OnlyDigits
:= False;
2382 AddButton(@ProcConnectNetGame
, _lc
[I_MENU_CLIENT_CONNECT
]);
2386 Menu
.DefControl
:= 'mNetClientMenu';
2387 g_GUI_AddWindow(Menu
);
2389 Menu
:= TGUIWindow
.Create('LoadMenu');
2390 Menu
.OnShow
:= ProcLoadMenu
;
2391 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LOAD_GAME
]))) do
2393 Name
:= 'mmLoadMenu';
2398 Name
:= 'edSlot'+IntToStr(a
);
2401 OnEnter
:= ProcLoadGame
;
2404 Menu
.DefControl
:= 'mmLoadMenu';
2405 g_GUI_AddWindow(Menu
);
2407 Menu
:= TGUIWindow
.Create('SaveMenu');
2408 Menu
.OnShow
:= ProcSaveMenu
;
2409 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SAVE_GAME
]))) do
2411 Name
:= 'mmSaveMenu';
2416 Name
:= 'edSlot'+IntToStr(a
);
2419 OnChange
:= ProcSaveGame
;
2422 Menu
.DefControl
:= 'mmSaveMenu';
2423 g_GUI_AddWindow(Menu
);
2425 Menu
:= TGUIWindow
.Create('CustomGameMenu');
2426 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CUSTOM_GAME
]))) do
2428 Name
:= 'mCustomGameMenu';
2429 with AddLabel(_lc
[I_MENU_MAP
]) do
2434 OnClick
:= @ProcSelectMapMenu
;
2436 with AddSwitch(_lc
[I_MENU_GAME_TYPE
]) do
2438 Name
:= 'swGameMode';
2439 AddItem(_lc
[I_MENU_GAME_TYPE_DM
]);
2440 AddItem(_lc
[I_MENU_GAME_TYPE_TDM
]);
2441 AddItem(_lc
[I_MENU_GAME_TYPE_CTF
]);
2442 AddItem(_lc
[I_MENU_GAME_TYPE_COOP
]);
2443 case g_Game_TextToMode(gsGameMode
) of
2445 GM_DM
: ItemIndex
:= 0;
2446 GM_TDM
: ItemIndex
:= 1;
2447 GM_CTF
: ItemIndex
:= 2;
2449 GM_COOP
: ItemIndex
:= 3;
2451 OnChange
:= ProcSwitchMonstersCustom
;
2453 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
2455 Name
:= 'edTimeLimit';
2459 if gsTimeLimit
> 0 then
2460 Text := IntToStr(gsTimeLimit
);
2462 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
2464 Name
:= 'edGoalLimit';
2468 if gsGoalLimit
> 0 then
2469 Text := IntToStr(gsGoalLimit
);
2471 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
2473 Name
:= 'edMaxLives';
2477 if gsMaxLives
> 0 then
2478 Text := IntToStr(gsMaxLives
);
2480 with AddEdit(_lc
[I_MENU_ITEM_RESPAWN_TIME
]) do
2482 Name
:= 'edItemRespawnTime';
2486 if gsItemRespawnTime
> 0 then
2487 Text := IntToStr(gsItemRespawnTime
);
2489 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2491 Name
:= 'swPlayers';
2492 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2493 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2494 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2495 ItemIndex
:= gsPlayers
;
2497 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
2499 Name
:= 'swTeamDamage';
2500 AddItem(_lc
[I_MENU_YES
]);
2501 AddItem(_lc
[I_MENU_NO
]);
2502 if LongBool(gsGameFlags
and GAME_OPTION_TEAMDAMAGE
) then
2507 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
2509 Name
:= 'swTeamHit';
2510 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
2511 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
2512 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
2513 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
2514 if (gsGameFlags
and (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
)) = (GAME_OPTION_TEAMHITTRACE
or GAME_OPTION_TEAMHITPROJECTILE
) then
2516 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITTRACE
) then
2518 else if LongBool(gsGameFlags
and GAME_OPTION_TEAMHITPROJECTILE
) then
2523 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
2525 Name
:= 'swDeathmatchKeys';
2526 AddItem(_lc
[I_MENU_YES
]);
2527 AddItem(_lc
[I_MENU_NO
]);
2528 if LongBool(gsGameFlags
and GAME_OPTION_DMKEYS
) then
2533 with AddSwitch(_lc
[I_MENU_ENABLE_EXITS
]) do
2535 Name
:= 'swEnableExits';
2536 AddItem(_lc
[I_MENU_YES
]);
2537 AddItem(_lc
[I_MENU_NO
]);
2538 if LongBool(gsGameFlags
and GAME_OPTION_ALLOWEXIT
) then
2543 with AddSwitch(_lc
[I_MENU_WEAPONS_STAY
]) do
2545 Name
:= 'swWeaponStay';
2546 AddItem(_lc
[I_MENU_YES
]);
2547 AddItem(_lc
[I_MENU_NO
]);
2548 if LongBool(gsGameFlags
and GAME_OPTION_WEAPONSTAY
) then
2553 with AddSwitch(_lc
[I_MENU_ENABLE_MONSTERS
]) do
2555 Name
:= 'swMonsters';
2556 AddItem(_lc
[I_MENU_YES
]);
2557 AddItem(_lc
[I_MENU_NO
]);
2558 if LongBool(gsGameFlags
and GAME_OPTION_MONSTERS
) then
2563 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
2566 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
2567 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
2568 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
2570 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSMONSTER
) then
2572 if not LongBool(gsGameFlags
and GAME_OPTION_BOTVSPLAYER
) then
2575 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
2577 Name
:= 'swFlagDrop';
2578 AddItem(_lc
[I_MENU_FLAG_THROW
]);
2579 AddItem(_lc
[I_MENU_YES
]);
2580 AddItem(_lc
[I_MENU_NO
]);
2581 if (gsGameFlags
and (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
)) = (GAME_OPTION_ALLOWDROPFLAG
or GAME_OPTION_THROWFLAG
) then
2583 else if LongBool(gsGameFlags
and GAME_OPTION_ALLOWDROPFLAG
) then
2589 AddButton(@ProcStartCustomGame
, _lc
[I_MENU_START_GAME
]);
2593 Menu
.DefControl
:= 'mCustomGameMenu';
2594 g_GUI_AddWindow(Menu
);
2596 Menu
:= TGUIWindow
.Create('CampaignMenu');
2597 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CAMPAIGN
]))) do
2599 Name
:= 'mCampaignMenu';
2608 with AddFileList('', 15, 4) do
2611 OnChange
:= ProcSelectCampaignWAD
;
2615 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2616 SetBase(MegawadDirs
);
2619 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2621 Name
:= 'lbWADName';
2625 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2627 Name
:= 'lbWADAuthor';
2631 AddLine(_lc
[I_MENU_MAP_DESCRIPTION
]);
2632 with AddMemo('', 15, 3) do
2634 Name
:= 'meWADDescription';
2635 Color
:= MENU_ITEMSCTRL_COLOR
;
2637 with AddSwitch(_lc
[I_MENU_PLAYERS
]) do
2639 Name
:= 'swPlayers';
2640 AddItem(_lc
[I_MENU_PLAYERS_ONE
]);
2641 AddItem(_lc
[I_MENU_PLAYERS_TWO
]);
2644 AddButton(@ProcStartCampaign
, _lc
[I_MENU_START_GAME
]);
2648 with TGUIImage(Menu
.AddChild(TGUIImage
.Create
)) do
2650 Name
:= 'mpWADImage';
2651 DefaultRes
:= 'NOPIC';
2652 X
:= GetControl('lsWAD').X
+4;
2653 Y
:= GetControl('lsWAD').Y
-128-MENU_VSPACE
;
2656 Menu
.DefControl
:= 'mCampaignMenu';
2657 g_GUI_AddWindow(Menu
);
2659 Menu
:= TGUIWindow
.Create('SelectMapMenu');
2660 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SELECT_MAP
]))) do
2662 Name
:= 'mSelectMapMenu';
2663 with AddFileList(_lc
[I_MENU_MAP_WAD
], 12, 4) do
2666 OnChange
:= ProcSelectWAD
;
2670 FileMask
:= '*.wad|*.pk3|*.zip|*.dfz';
2673 with AddList(_lc
[I_MENU_MAP_RESOURCE
], 12, 4) do
2677 OnChange
:= ProcSelectMap
;
2680 with AddLabel(_lc
[I_MENU_MAP_NAME
]) do
2682 Name
:= 'lbMapName';
2686 with AddLabel(_lc
[I_MENU_MAP_AUTHOR
]) do
2688 Name
:= 'lbMapAuthor';
2692 with AddLabel(_lc
[I_MENU_MAP_SIZE
]) do
2694 Name
:= 'lbMapSize';
2698 with AddMemo(_lc
[I_MENU_MAP_DESCRIPTION
], 12, 4) do
2700 Name
:= 'meMapDescription';
2705 with TGUIMapPreview(Menu
.AddChild(TGUIMapPreview
.Create
)) do
2707 Name
:= 'mpMapPreview';
2708 X
:= GetControl('lsMapWAD').X
+TGUIListBox(GetControl('lsMapWAD')).GetWidth()+2;
2709 Y
:= GetControl('lsMapWAD').Y
;
2711 with TGUILabel(Menu
.AddChild(TGUILabel
.Create('', gMenuSmallFont
))) do
2713 Name
:= 'lbMapScale';
2716 Color
:= MENU_ITEMSCTRL_COLOR
;
2717 X
:= GetControl('lsMapWAD').X
+
2718 TGUIListBox(GetControl('lsMapWAD')).GetWidth() +
2719 2 + MAPPREVIEW_WIDTH
*4;
2720 Y
:= GetControl('lsMapWAD').Y
+ MAPPREVIEW_HEIGHT
*16 + 16;
2723 Menu
.OnClose
:= ProcSetMap
;
2724 Menu
.DefControl
:= 'mSelectMapMenu';
2725 g_GUI_AddWindow(Menu
);
2727 Menu
:= TGUIWindow
.Create('OptionsMenu');
2728 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_OPTIONS
]))) do
2730 Name
:= 'mmOptionsMenu';
2731 AddButton(nil, _lc
[I_MENU_VIDEO_OPTIONS
], 'OptionsVideoMenu');
2732 AddButton(nil, _lc
[I_MENU_SOUND_OPTIONS
], 'OptionsSoundMenu');
2733 AddButton(nil, _lc
[I_MENU_GAME_OPTIONS
], 'OptionsGameMenu');
2734 AddButton(nil, _lc
[I_MENU_CONTROLS_OPTIONS
], 'OptionsControlsMenu');
2735 AddButton(nil, _lc
[I_MENU_PLAYER_OPTIONS
], 'OptionsPlayersMenu');
2736 AddButton(nil, _lc
[I_MENU_LANGUAGE_OPTIONS
], 'OptionsLanguageMenu');
2738 AddButton(nil, _lc
[I_MENU_SAVED_OPTIONS
], 'SavedOptionsMenu').Color
:= _RGB(255, 0, 0);
2739 AddButton(nil, _lc
[I_MENU_DEFAULT_OPTIONS
], 'DefaultOptionsMenu').Color
:= _RGB(255, 0, 0);
2741 Menu
.OnClose
:= ProcApplyOptions
;
2742 Menu
.DefControl
:= 'mmOptionsMenu';
2743 g_GUI_AddWindow(Menu
);
2745 Menu
:= CreateYNMenu('SavedOptionsMenu', _lc
[I_MENU_LOAD_SAVED_PROMT
], Round(gScreenWidth
*0.6),
2746 gMenuSmallFont
, @ProcSavedMenuKeyDown
);
2747 g_GUI_AddWindow(Menu
);
2749 Menu
:= TGUIWindow
.Create('OptionsVideoMenu');
2750 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_VIDEO_OPTIONS
]))) do
2752 Name
:= 'mOptionsVideoMenu';
2753 AddButton(@ProcVideoOptionsRes
, _lc
[I_MENU_VIDEO_RESOLUTION
], 'OptionsVideoResMenu');
2754 with AddSwitch(_lc
[I_MENU_VIDEO_BPP
]) do
2760 with AddSwitch(_lc
[I_MENU_VIDEO_VSYNC
]) do
2763 AddItem(_lc
[I_MENU_YES
]);
2764 AddItem(_lc
[I_MENU_NO
]);
2766 with AddSwitch(_lc
[I_MENU_VIDEO_FILTER_SKY
]) do
2768 Name
:= 'swTextureFilter';
2769 AddItem(_lc
[I_MENU_YES
]);
2770 AddItem(_lc
[I_MENU_NO
]);
2772 with AddSwitch(_lc
[I_MENU_VIDEO_INTERPOLATION
]) do
2775 AddItem(_lc
[I_MENU_YES
]);
2776 AddItem(_lc
[I_MENU_NO
]);
2778 with AddSwitch(_lc
[I_MENU_VIDEO_LEGACY_COMPATIBLE
]) do
2780 Name
:= 'swLegacyNPOT';
2781 AddItem(_lc
[I_MENU_NO
]);
2782 AddItem(_lc
[I_MENU_YES
]);
2785 AddText(_lc
[I_MENU_VIDEO_NEED_RESTART
], Round(gScreenWidth
*0.6));
2788 Menu
.DefControl
:= 'mOptionsVideoMenu';
2789 g_GUI_AddWindow(Menu
);
2791 Menu
:= TGUIWindow
.Create('OptionsVideoResMenu');
2792 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_RESOLUTION_SELECT
]))) do
2794 Name
:= 'mOptionsVideoResMenu';
2795 with AddLabel(_lc
[I_MENU_RESOLUTION_CURRENT
]) do
2797 Name
:= 'lbCurrentRes';
2801 with AddList(_lc
[I_MENU_RESOLUTION_LIST
], 12, 6) do
2803 Name
:= 'lsResolution';
2806 with AddSwitch(_lc
[I_MENU_RESOLUTION_FULLSCREEN
]) do
2808 Name
:= 'swFullScreen';
2809 AddItem(_lc
[I_MENU_YES
]);
2810 AddItem(_lc
[I_MENU_NO
]);
2812 with AddSwitch(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2814 Name
:= 'swResFactor';
2816 for i
:= 2 to gRC_Width
div 640 do
2817 AddItem(IntToStr(i
) + 'x');
2820 AddButton(@ProcApplyVideoOptions
, _lc
[I_MENU_RESOLUTION_APPLY
]);
2823 Menu
.DefControl
:= 'mOptionsVideoResMenu';
2824 g_GUI_AddWindow(Menu
);
2826 Menu
:= TGUIWindow
.Create('OptionsSoundMenu');
2827 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SOUND_OPTIONS
]))) do
2829 Name
:= 'mOptionsSoundMenu';
2830 with AddScroll(_lc
[I_MENU_SOUND_MUSIC_LEVEL
]) do
2832 Name
:= 'scMusicLevel';
2834 OnChange
:= ProcChangeSoundSettings
;
2836 with AddScroll(_lc
[I_MENU_SOUND_SOUND_LEVEL
]) do
2838 Name
:= 'scSoundLevel';
2840 OnChange
:= ProcChangeSoundSettings
;
2842 with AddScroll(_lc
[I_MENU_SOUND_MAX_SIM_SOUNDS
]) do
2844 Name
:= 'scMaxSimSounds';
2847 with AddSwitch (_lc
[I_MENU_SOUND_ANNOUNCE
]) do
2849 Name
:= 'swAnnouncer';
2850 AddItem(_lc
[I_MENU_ANNOUNCE_NONE
]);
2851 AddItem(_lc
[I_MENU_ANNOUNCE_ME
]);
2852 AddItem(_lc
[I_MENU_ANNOUNCE_MEPLUS
]);
2853 AddItem(_lc
[I_MENU_ANNOUNCE_ALL
]);
2855 // Ïåðåêëþ÷àòåëü çâóêîâûõ ýôôåêòîâ (DF / Doom 2)
2856 with AddSwitch (_lc
[I_MENU_SOUND_COMPAT
]) do
2858 Name
:= 'swSoundEffects';
2859 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2860 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2862 // Ïåðåêëþ÷àòåëü çâóêîâ ÷àòà
2863 with AddSwitch (_lc
[I_MENU_SOUND_CHAT
]) do
2865 Name
:= 'swChatSpeech';
2866 AddItem(_lc
[I_MENU_YES
]);
2867 AddItem(_lc
[I_MENU_NO
]);
2869 with AddSwitch(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS
]) do
2871 Name
:= 'swInactiveSounds';
2872 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_ON
]);
2873 AddItem(_lc
[I_MENU_SOUND_INACTIVE_SOUNDS_OFF
]);
2877 Menu
.DefControl
:= 'mOptionsSoundMenu';
2878 g_GUI_AddWindow(Menu
);
2880 Menu
:= TGUIWindow
.Create('OptionsGameMenu');
2881 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_GAME_OPTIONS
]))) do
2883 Name
:= 'mOptionsGameMenu';
2884 with AddScroll(_lc
[I_MENU_GAME_PARTICLES_COUNT
]) do
2886 Name
:= 'scParticlesCount';
2889 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_COUNT
]) do
2891 Name
:= 'swBloodCount';
2892 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2893 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2894 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2895 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2896 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2898 with AddScroll(_lc
[I_MENU_GAME_MAX_SHELLS
]) do
2900 Name
:= 'scShellsMax';
2903 with AddScroll(_lc
[I_MENU_GAME_GIBS_COUNT
]) do
2905 Name
:= 'scGibsMax';
2908 with AddScroll(_lc
[I_MENU_GAME_MAX_CORPSES
]) do
2910 Name
:= 'scCorpsesMax';
2913 with AddSwitch(_lc
[I_MENU_GAME_MAX_GIBS
]) do
2915 Name
:= 'swGibsCount';
2916 AddItem(_lc
[I_MENU_COUNT_NONE
]);
2917 AddItem(_lc
[I_MENU_COUNT_SMALL
]);
2918 AddItem(_lc
[I_MENU_COUNT_NORMAL
]);
2919 AddItem(_lc
[I_MENU_COUNT_BIG
]);
2920 AddItem(_lc
[I_MENU_COUNT_VERYBIG
]);
2922 with AddSwitch(_lc
[I_MENU_GAME_CORPSE_TYPE
]) do
2924 Name
:= 'swCorpseType';
2925 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_SIMPLE
]);
2926 AddItem(_lc
[I_MENU_GAME_CORPSE_TYPE_ADV
]);
2928 with AddSwitch(_lc
[I_MENU_GAME_GIBS_TYPE
]) do
2930 Name
:= 'swGibsType';
2931 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_SIMPLE
]);
2932 AddItem(_lc
[I_MENU_GAME_GIBS_TYPE_ADV
]);
2934 with AddSwitch(_lc
[I_MENU_GAME_BLOOD_TYPE
]) do
2936 Name
:= 'swBloodType';
2937 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_SIMPLE
]);
2938 AddItem(_lc
[I_MENU_GAME_BLOOD_TYPE_ADV
]);
2940 with AddSwitch(_lc
[I_MENU_GAME_SCREEN_FLASH
]) do
2942 Name
:= 'swScreenFlash';
2943 AddItem(_lc
[I_MENU_NO
]);
2944 AddItem(_lc
[I_MENU_COMPAT_DF
]);
2945 AddItem(_lc
[I_MENU_COMPAT_DOOM2
]);
2947 with AddSwitch(_lc
[I_MENU_GAME_BACKGROUND
]) do
2949 Name
:= 'swBackground';
2950 AddItem(_lc
[I_MENU_YES
]);
2951 AddItem(_lc
[I_MENU_NO
]);
2953 with AddSwitch(_lc
[I_MENU_GAME_MESSAGES
]) do
2955 Name
:= 'swMessages';
2956 AddItem(_lc
[I_MENU_YES
]);
2957 AddItem(_lc
[I_MENU_NO
]);
2959 with AddSwitch(_lc
[I_MENU_GAME_REVERT_PLAYERS
]) do
2961 Name
:= 'swRevertPlayers';
2962 AddItem(_lc
[I_MENU_YES
]);
2963 AddItem(_lc
[I_MENU_NO
]);
2965 with AddSwitch(_lc
[I_MENU_GAME_CHAT_BUBBLE
]) do
2967 Name
:= 'swChatBubble';
2968 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_NONE
]);
2969 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_SIMPLE
]);
2970 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_ADV
]);
2971 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_COLOR
]);
2972 AddItem(_lc
[I_MENU_GAME_CHAT_TYPE_TEXTURE
]);
2974 with AddSwitch(_lc
[I_MENU_GAME_PLAYER_INDICATOR
]) do
2976 Name
:= 'swPlayerIndicator';
2977 AddItem(_lc
[I_MENU_GAME_INDICATOR_NONE
]);
2978 AddItem(_lc
[I_MENU_GAME_INDICATOR_OWN
]);
2979 AddItem(_lc
[I_MENU_GAME_INDICATOR_ALL
]);
2981 with AddSwitch(_lc
[I_MENU_GAME_INDICATOR_STYLE
]) do
2983 Name
:= 'swPlayerIndicatorStyle';
2984 AddItem(_lc
[I_MENU_GAME_INDICATOR_ARROW
]);
2985 AddItem(_lc
[I_MENU_GAME_INDICATOR_NAME
]);
2987 with AddScroll(_lc
[I_MENU_GAME_SCALE_FACTOR
]) do
2989 Name
:= 'scScaleFactor';
2991 OnChange
:= ProcChangeGameSettings
;
2995 Menu
.DefControl
:= 'mOptionsGameMenu';
2996 g_GUI_AddWindow(Menu
);
2998 Menu
:= TGUIWindow
.Create('OptionsControlsMenu');
2999 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROLS_OPTIONS
]))) do
3001 Name
:= 'mOptionsControlsMenu';
3002 AddLine(_lc
[I_MENU_CONTROL_GLOBAL
]);
3003 AddKeyRead(_lc
[I_MENU_CONTROL_SCREENSHOT
]).Name
:= _lc
[I_MENU_CONTROL_SCREENSHOT
];
3004 AddKeyRead(_lc
[I_MENU_CONTROL_STAT
]).Name
:= _lc
[I_MENU_CONTROL_STAT
];
3005 AddKeyRead(_lc
[I_MENU_CONTROL_CHAT
]).Name
:= _lc
[I_MENU_CONTROL_CHAT
];
3006 AddKeyRead(_lc
[I_MENU_CONTROL_TEAMCHAT
]).Name
:= _lc
[I_MENU_CONTROL_TEAMCHAT
];
3008 AddButton(nil, _lc
[I_MENU_PLAYER_1_KBD
], 'OptionsControlsP1Menu');
3009 {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
3010 AddButton(nil, _lc
[I_MENU_PLAYER_1_WEAPONS
], 'OptionsControlsP1MenuWeapons');
3011 AddButton(nil, _lc
[I_MENU_PLAYER_2_KBD
], 'OptionsControlsP2Menu');
3012 {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
3013 AddButton(nil, _lc
[I_MENU_PLAYER_2_WEAPONS
], 'OptionsControlsP2MenuWeapons');
3014 if e_HasJoysticks
then
3017 AddButton(nil, _lc
[I_MENU_CONTROL_JOYSTICKS
], 'OptionsControlsJoystickMenu');
3019 if g_touch_enabled
then
3022 AddButton(nil, _lc
[I_MENU_CONTROL_TOUCH
], 'OptionsControlsTouchMenu');
3025 Menu
.DefControl
:= 'mOptionsControlsMenu';
3026 g_GUI_AddWindow(Menu
);
3028 Menu
:= TGUIWindow
.Create('OptionsControlsP1Menu');
3029 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_KBD
]))) do
3031 Name
:= 'mOptionsControlsP1Menu';
3032 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3033 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3034 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3035 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3036 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3037 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3038 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3039 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3040 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3041 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3042 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3044 Menu
.DefControl
:= 'mOptionsControlsP1Menu';
3045 g_GUI_AddWindow(Menu
);
3047 Menu
:= TGUIWindow
.Create('OptionsControlsP1MenuWeapons');
3048 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_1_WEAPONS
]))) do
3050 Name
:= 'mOptionsControlsP1MenuWeapons';
3051 for i
:= WP_FIRST
to WP_LAST
do
3052 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3053 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3055 Menu
.DefControl
:= 'mOptionsControlsP1MenuWeapons';
3056 g_GUI_AddWindow(Menu
);
3058 Menu
:= TGUIWindow
.Create('OptionsControlsP2Menu');
3059 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_KBD
]))) do
3061 Name
:= 'mOptionsControlsP2Menu';
3062 AddKeyRead2(_lc
[I_MENU_CONTROL_LEFT
]).Name
:= _lc
[I_MENU_CONTROL_LEFT
];
3063 AddKeyRead2(_lc
[I_MENU_CONTROL_RIGHT
]).Name
:= _lc
[I_MENU_CONTROL_RIGHT
];
3064 AddKeyRead2(_lc
[I_MENU_CONTROL_UP
]).Name
:= _lc
[I_MENU_CONTROL_UP
];
3065 AddKeyRead2(_lc
[I_MENU_CONTROL_DOWN
]).Name
:= _lc
[I_MENU_CONTROL_DOWN
];
3066 AddKeyRead2(_lc
[I_MENU_CONTROL_JUMP
]).Name
:= _lc
[I_MENU_CONTROL_JUMP
];
3067 AddKeyRead2(_lc
[I_MENU_CONTROL_FIRE
]).Name
:= _lc
[I_MENU_CONTROL_FIRE
];
3068 AddKeyRead2(_lc
[I_MENU_CONTROL_USE
]).Name
:= _lc
[I_MENU_CONTROL_USE
];
3069 AddKeyRead2(_lc
[I_MENU_CONTROL_NEXT_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_NEXT_WEAPON
];
3070 AddKeyRead2(_lc
[I_MENU_CONTROL_PREV_WEAPON
]).Name
:= _lc
[I_MENU_CONTROL_PREV_WEAPON
];
3071 AddKeyRead2(_lc
[I_MENU_CONTROL_STRAFE
]).Name
:= _lc
[I_MENU_CONTROL_STRAFE
];
3072 AddKeyRead2(_lc
[I_MENU_CONTROL_DROPFLAG
]).Name
:= _lc
[I_MENU_CONTROL_DROPFLAG
];
3074 Menu
.DefControl
:= 'mOptionsControlsP2Menu';
3075 g_GUI_AddWindow(Menu
);
3077 Menu
:= TGUIWindow
.Create('OptionsControlsP2MenuWeapons');
3078 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_2_WEAPONS
]))) do
3080 Name
:= 'mOptionsControlsP2MenuWeapons';
3081 for i
:= WP_FIRST
to WP_LAST
do
3082 AddKeyRead2(_lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)]).Name
:=
3083 _lc
[TStrings_Locale(Cardinal(I_GAME_WEAPON0
) + i
)];
3085 Menu
.DefControl
:= 'mOptionsControlsP2MenuWeapons';
3086 g_GUI_AddWindow(Menu
);
3088 Menu
:= TGUIWindow
.Create('OptionsControlsJoystickMenu');
3089 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_JOYSTICKS
]))) do
3091 Name
:= 'mOptionsControlsJoystickMenu';
3092 for i
:= 0 to e_MaxJoys
- 1 do
3093 with AddScroll(Format(_lc
[I_MENU_CONTROL_DEADZONE
], [i
+ 1])) do
3095 Name
:= 'scDeadzone' + IntToStr(i
);
3099 Menu
.DefControl
:= 'mOptionsControlsJoystickMenu';
3100 g_GUI_AddWindow(Menu
);
3102 Menu
:= TGUIWindow
.Create('OptionsControlsTouchMenu');
3103 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_CONTROL_TOUCH
]))) do
3105 Name
:= 'mOptionsControlsTouchMenu';
3106 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_ALT
]) do
3108 Name
:= 'swTouchAlt';
3109 AddItem(_lc
[I_MENU_NO
]);
3110 AddItem(_lc
[I_MENU_YES
]);
3111 OnChange
:= ProcChangeTouchSettings
;
3113 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_SIZE
]) do
3115 Name
:= 'scTouchSize';
3117 OnChange
:= ProcChangeTouchSettings
;
3119 with AddSwitch(_lc
[I_MENU_CONTROL_TOUCH_FIRE
]) do
3121 Name
:= 'swTouchFire';
3122 AddItem(_lc
[I_MENU_NO
]);
3123 AddItem(_lc
[I_MENU_YES
]);
3125 with AddScroll(_lc
[I_MENU_CONTROL_TOUCH_OFFSET
]) do
3127 Name
:= 'scTouchOffset';
3129 OnChange
:= ProcChangeTouchSettings
;
3132 Menu
.DefControl
:= 'mOptionsControlsTouchMenu';
3133 g_GUI_AddWindow(Menu
);
3135 Menu
:= TGUIWindow
.Create('OptionsPlayersMenu');
3136 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_PLAYER_OPTIONS
]))) do
3138 Name
:= 'mOptionsPlayersMenu';
3139 AddButton(nil, _lc
[I_MENU_PLAYER_1
], 'OptionsPlayersP1Menu');
3140 AddButton(nil, _lc
[I_MENU_PLAYER_2
], 'OptionsPlayersP2Menu');
3142 Menu
.DefControl
:= 'mOptionsPlayersMenu';
3143 g_GUI_AddWindow(Menu
);
3145 CreatePlayerOptionsMenu('P1');
3146 CreatePlayerOptionsMenu('P2');
3148 Menu
:= TGUIWindow
.Create('OptionsPlayersMIMenu');
3149 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_MODEL_INFO
]))) do
3151 Name
:= 'mOptionsPlayersMIMenu';
3152 with AddLabel(_lc
[I_MENU_MODEL_NAME
]) do
3157 with AddLabel(_lc
[I_MENU_MODEL_AUTHOR
]) do
3162 with AddMemo(_lc
[I_MENU_MODEL_COMMENT
], 14, 6) do
3164 Name
:= 'meComment';
3167 AddLine(_lc
[I_MENU_MODEL_OPTIONS
]);
3168 with AddLabel(_lc
[I_MENU_MODEL_WEAPON
]) do
3171 FixedLength
:= Max(Length(_lc
[I_MENU_YES
]), Length(_lc
[I_MENU_NO
]));
3175 Menu
.DefControl
:= 'mOptionsPlayersMIMenu';
3176 g_GUI_AddWindow(Menu
);
3178 Menu
:= TGUIWindow
.Create('OptionsLanguageMenu');
3179 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_LANGUAGE_OPTIONS
]))) do
3181 Name
:= 'mOptionsLanguageMenu';
3182 AddButton(@ProcSetRussianLanguage
, _lc
[I_MENU_LANGUAGE_RUSSIAN
]);
3183 AddButton(@ProcSetEnglishLanguage
, _lc
[I_MENU_LANGUAGE_ENGLISH
]);
3186 Menu
.DefControl
:= 'mOptionsLanguageMenu';
3187 g_GUI_AddWindow(Menu
);
3189 Menu
:= CreateYNMenu('DefaultOptionsMenu', _lc
[I_MENU_SET_DEFAULT_PROMT
], Round(gScreenWidth
*0.6),
3190 gMenuSmallFont
, @ProcDefaultMenuKeyDown
);
3191 g_GUI_AddWindow(Menu
);
3193 Menu
:= TGUIWindow
.Create('AuthorsMenu');
3194 Menu
.BackTexture
:= 'INTER';
3195 Menu
.OnClose
:= ProcAuthorsClose
;
3199 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_1
], gMenuFont
))) do
3201 Color
:= _RGB(255, 0, 0);
3202 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3204 _y
:= _y
+GetHeight();
3206 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(Format(_lc
[I_CREDITS_CAP_2
], [GAME_VERSION
, NET_PROTOCOL_VER
]), gMenuSmallFont
))) do
3208 Color
:= _RGB(255, 0, 0);
3209 X
:= (gScreenWidth
div 2)-(GetWidth() div 2);
3211 _y
:= _y
+GetHeight()+32;
3213 // ×òî äåëàë: Êòî äåëàë
3214 cx
:= gScreenWidth
div 2 - 320 + 64;
3215 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1
], gMenuSmallFont
))) do
3217 Color
:= _RGB(255, 0, 0);
3222 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_1_1
], gMenuSmallFont
))) do
3224 Color
:= _RGB(255, 255, 255);
3229 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2
], gMenuSmallFont
))) do
3231 Color
:= _RGB(255, 0, 0);
3236 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_1
], gMenuSmallFont
))) do
3238 Color
:= _RGB(255, 255, 255);
3243 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_2_2
], gMenuSmallFont
))) do
3245 Color
:= _RGB(255, 255, 255);
3250 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3
], gMenuSmallFont
))) do
3252 Color
:= _RGB(255, 0, 0);
3257 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_3_1
], gMenuSmallFont
))) do
3259 Color
:= _RGB(255, 255, 255);
3264 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4
], gMenuSmallFont
))) do
3266 Color
:= _RGB(255, 0, 0);
3271 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_A_4_1
], gMenuSmallFont
))) do
3273 Color
:= _RGB(255, 255, 255);
3276 _y
:= gScreenHeight
- 128;
3279 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CAP_3
], gMenuSmallFont
))) do
3281 Color
:= _RGB(255, 0, 0);
3286 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_1
], gMenuSmallFont
))) do
3288 Color
:= _RGB(255, 255, 255);
3291 _y
:= _y
+GetHeight();
3293 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_2
], gMenuSmallFont
))) do
3295 Color
:= _RGB(255, 255, 255);
3298 _y
:= _y
+GetHeight();
3300 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_3
], gMenuSmallFont
))) do
3302 Color
:= _RGB(255, 255, 255);
3305 _y
:= gScreenHeight
- 32;
3307 with TGUILabel(Menu
.AddChild(TGUILabel
.Create(_lc
[I_CREDITS_CLO_4
], gMenuSmallFont
))) do
3309 Color
:= _RGB(255, 0, 0);
3310 X
:= gScreenWidth
div 2 - GetWidth() div 2;
3313 g_GUI_AddWindow(Menu
);
3315 Menu
:= CreateYNMenu('ExitMenu', _lc
[I_MENU_EXIT_PROMT
], Round(gScreenWidth
*0.6),
3316 gMenuSmallFont
, @ProcExitMenuKeyDown
);
3317 g_GUI_AddWindow(Menu
);
3319 Menu
:= TGUIWindow
.Create('GameSingleMenu');
3320 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3322 Name
:= 'mmGameSingleMenu';
3323 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3324 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3325 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3326 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3327 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3328 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3330 Menu
.DefControl
:= 'mmGameSingleMenu';
3331 Menu
.MainWindow
:= True;
3332 Menu
.OnClose
:= ProcGMClose
;
3333 Menu
.OnShow
:= ProcGMShow
;
3334 g_GUI_AddWindow(Menu
);
3336 Menu
:= CreateYNMenu('EndGameMenu', _lc
[I_MENU_END_GAME_PROMT
], Round(gScreenWidth
*0.6),
3337 gMenuSmallFont
, @ProcEndMenuKeyDown
);
3338 g_GUI_AddWindow(Menu
);
3340 Menu
:= CreateYNMenu('RestartGameMenu', _lc
[I_MENU_RESTART_GAME_PROMT
], Round(gScreenWidth
*0.6),
3341 gMenuSmallFont
, @ProcRestartMenuKeyDown
);
3342 g_GUI_AddWindow(Menu
);
3344 Menu
:= TGUIWindow
.Create('GameCustomMenu');
3345 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3347 Name
:= 'mmGameCustomMenu';
3348 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3349 AddButton(nil, _lc
[I_MENU_LOAD_GAME
], 'LoadMenu');
3350 AddButton(nil, _lc
[I_MENU_SAVE_GAME
], 'SaveMenu').Name
:= 'save';
3351 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3352 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3353 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3354 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3356 Menu
.DefControl
:= 'mmGameCustomMenu';
3357 Menu
.MainWindow
:= True;
3358 Menu
.OnClose
:= ProcGMClose
;
3359 Menu
.OnShow
:= ProcGMShow
;
3360 g_GUI_AddWindow(Menu
);
3362 Menu
:= TGUIWindow
.Create('GameServerMenu');
3363 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3365 Name
:= 'mmGameServerMenu';
3366 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3367 AddButton(@ReadGameSettings
, _lc
[I_MENU_SET_GAME
], 'GameSetGameMenu');
3368 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3369 AddButton(nil, _lc
[I_MENU_RESTART
], 'RestartGameMenu');
3370 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3372 Menu
.DefControl
:= 'mmGameServerMenu';
3373 Menu
.MainWindow
:= True;
3374 Menu
.OnClose
:= ProcGMClose
;
3375 Menu
.OnShow
:= ProcGMShow
;
3376 g_GUI_AddWindow(Menu
);
3378 Menu
:= TGUIWindow
.Create('GameClientMenu');
3379 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_MAIN_MENU
]))) do
3381 Name
:= 'mmGameClientMenu';
3382 AddButton(nil, _lc
[I_MENU_CHANGE_PLAYERS
], 'TeamMenu');
3383 AddButton(@ReadOptions
, _lc
[I_MENU_OPTIONS
], 'OptionsMenu');
3384 AddButton(nil, _lc
[I_MENU_END_GAME
], 'EndGameMenu');
3386 Menu
.DefControl
:= 'mmGameClientMenu';
3387 Menu
.MainWindow
:= True;
3388 Menu
.OnClose
:= ProcGMClose
;
3389 Menu
.OnShow
:= ProcGMShow
;
3390 g_GUI_AddWindow(Menu
);
3392 Menu
:= TGUIWindow
.Create('ClientPasswordMenu');
3393 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuSmallFont
, gMenuSmallFont
, _lc
[I_MENU_ENTERPASSWORD
]))) do
3395 Name
:= 'mClientPasswordMenu';
3396 with AddEdit(_lc
[I_NET_SERVER_PASSWORD
]) do
3404 AddButton(@ProcEnterPassword
, _lc
[I_MENU_START_GAME
]);
3407 Menu
.DefControl
:= 'mClientPasswordMenu';
3408 g_GUI_AddWindow(Menu
);
3410 Menu
:= TGUIWindow
.Create('GameSetGameMenu');
3411 with TGUIMenu(Menu
.AddChild(TGUIMenu
.Create(gMenuFont
, gMenuSmallFont
, _lc
[I_MENU_SET_GAME
]))) do
3413 Name
:= 'mGameSetGameMenu';
3414 with AddSwitch(_lc
[I_MENU_TEAM_DAMAGE
]) do
3416 Name
:= 'swTeamDamage';
3417 AddItem(_lc
[I_MENU_YES
]);
3418 AddItem(_lc
[I_MENU_NO
]);
3421 with AddSwitch(_lc
[I_MENU_TEAM_HIT
]) do
3423 Name
:= 'swTeamHit';
3424 AddItem(_lc
[I_MENU_TEAM_HIT_BOTH
]);
3425 AddItem(_lc
[I_MENU_TEAM_HIT_TRACE
]);
3426 AddItem(_lc
[I_MENU_TEAM_HIT_PROJECTILE
]);
3427 AddItem(_lc
[I_MENU_TEAM_HIT_NOTHING
]);
3430 with AddSwitch(_lc
[I_MENU_DEATHMATCH_KEYS
]) do
3432 Name
:= 'swDeathmatchKeys';
3433 AddItem(_lc
[I_MENU_YES
]);
3434 AddItem(_lc
[I_MENU_NO
]);
3437 with AddEdit(_lc
[I_MENU_TIME_LIMIT
]) do
3439 Name
:= 'edTimeLimit';
3444 with AddEdit(_lc
[I_MENU_GOAL_LIMIT
]) do
3446 Name
:= 'edGoalLimit';
3451 with AddEdit(_lc
[I_MENU_MAX_LIVES
]) do
3453 Name
:= 'edMaxLives';
3458 with AddSwitch(_lc
[I_MENU_BOTS_VS
]) do
3461 AddItem(_lc
[I_MENU_BOTS_VS_PLAYERS
]);
3462 AddItem(_lc
[I_MENU_BOTS_VS_MONSTERS
]);
3463 AddItem(_lc
[I_MENU_BOTS_VS_ALL
]);
3466 with AddSwitch(_lc
[I_MENU_FLAG_DROP
]) do
3468 Name
:= 'swFlagDrop';
3469 AddItem(_lc
[I_MENU_FLAG_THROW
]);
3470 AddItem(_lc
[I_MENU_YES
]);
3471 AddItem(_lc
[I_MENU_NO
]);
3477 Menu
.DefControl
:= 'mGameSetGameMenu';
3478 Menu
.OnClose
:= ProcApplyGameSet
;
3479 g_GUI_AddWindow(Menu
);
3481 Menu
:= TGUIWindow
.Create('TeamMenu');
3482 with TGUIMainMenu(Menu
.AddChild(TGUIMainMenu
.Create(gMenuFont
, '', _lc
[I_MENU_CHANGE_PLAYERS
]))) do
3484 Name
:= 'mmTeamMenu';
3485 AddButton(@ProcJoinRed
, _lc
[I_MENU_JOIN_RED
], '').Name
:= 'tmJoinRed';
3486 AddButton(@ProcJoinBlue
, _lc
[I_MENU_JOIN_BLUE
], '').Name
:= 'tmJoinBlue';
3487 AddButton(@ProcJoinGame
, _lc
[I_MENU_JOIN_GAME
], '').Name
:= 'tmJoinGame';
3488 AddButton(@ProcSwitchP2
, _lc
[I_MENU_ADD_PLAYER_2
], '').Name
:= 'tmPlayer2';
3489 AddButton(@ProcSpectate
, _lc
[I_MENU_SPECTATE
], '').Name
:= 'tmSpectate';
3491 Menu
.DefControl
:= 'mmTeamMenu';
3492 Menu
.OnShow
:= ProcChangePlayers
;
3493 g_GUI_AddWindow(Menu
);
3496 procedure g_Menu_Show_SaveMenu();
3498 if g_Game_IsTestMap
then
3500 if gGameSettings
.GameType
= GT_SINGLE
then
3501 g_GUI_ShowWindow('GameSingleMenu')
3504 if g_Game_IsClient
then
3507 if g_Game_IsNet
then
3510 g_GUI_ShowWindow('GameCustomMenu');
3512 g_GUI_ShowWindow('SaveMenu');
3513 g_Sound_PlayEx('MENU_OPEN');
3516 procedure g_Menu_Show_LoadMenu (standalone
: Boolean=false);
3518 if (g_ActiveWindow
<> nil) and (g_ActiveWindow
.name
= 'LoadMenu') then exit
; // nothing to do
3519 if gGameSettings
.GameType
= GT_SINGLE
then
3521 if not standalone
then g_GUI_ShowWindow('GameSingleMenu')
3525 if g_Game_IsClient
then exit
;
3526 if g_Game_IsNet
then exit
;
3527 if not standalone
then g_GUI_ShowWindow('GameCustomMenu');
3529 g_GUI_ShowWindow('LoadMenu');
3530 g_Sound_PlayEx('MENU_OPEN');
3533 procedure g_Menu_Show_GameSetGame();
3535 if gGameSettings
.GameType
= GT_SINGLE
then
3536 g_GUI_ShowWindow('GameSingleMenu')
3539 if g_Game_IsClient
then
3542 if g_Game_IsNet
then
3543 g_GUI_ShowWindow('GameServerMenu')
3545 g_GUI_ShowWindow('GameCustomMenu');
3548 g_GUI_ShowWindow('GameSetGameMenu');
3549 g_Sound_PlayEx('MENU_OPEN');
3552 procedure g_Menu_Show_OptionsVideo();
3554 if gGameSettings
.GameType
= GT_SINGLE
then
3555 g_GUI_ShowWindow('GameSingleMenu')
3558 if g_Game_IsClient
then
3559 g_GUI_ShowWindow('GameClientMenu')
3561 if g_Game_IsNet
then
3562 g_GUI_ShowWindow('GameServerMenu')
3564 g_GUI_ShowWindow('GameCustomMenu');
3567 g_GUI_ShowWindow('OptionsMenu');
3568 g_GUI_ShowWindow('OptionsVideoMenu');
3569 g_Sound_PlayEx('MENU_OPEN');
3572 procedure g_Menu_Show_OptionsSound();
3574 if gGameSettings
.GameType
= GT_SINGLE
then
3575 g_GUI_ShowWindow('GameSingleMenu')
3578 if g_Game_IsClient
then
3579 g_GUI_ShowWindow('GameClientMenu')
3581 if g_Game_IsNet
then
3582 g_GUI_ShowWindow('GameServerMenu')
3584 g_GUI_ShowWindow('GameCustomMenu');
3587 g_GUI_ShowWindow('OptionsMenu');
3588 g_GUI_ShowWindow('OptionsSoundMenu');
3589 g_Sound_PlayEx('MENU_OPEN');
3592 procedure g_Menu_Show_EndGameMenu();
3594 g_GUI_ShowWindow('EndGameMenu');
3595 g_Sound_PlayEx('MENU_OPEN');
3598 procedure g_Menu_Show_QuitGameMenu();
3600 g_GUI_ShowWindow('ExitMenu');
3601 g_Sound_PlayEx('MENU_OPEN');
3604 procedure g_Menu_Init();
3611 procedure g_Menu_Free();
3615 e_WriteLog('Releasing menu data...', TMsgType
.Notify
);
3620 procedure g_Menu_Reset();
3624 g_GUI_SaveMenuPos();
3625 ex
:= g_GUI_Destroy();
3629 e_WriteLog('Recreating menu...', TMsgType
.Notify
);
3634 g_Game_SetDebugMode();
3636 g_GUI_LoadMenuPos();