diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index 89b1a55acfd384e0fcf6e533c072090633e4ea01..93666fa87f3f4f4a9da3c5fe71a195b871af8533 100644 (file)
--- a/src/game/g_menu.pas
+++ b/src/game/g_menu.pas
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*)
-{$MODE DELPHI}
+{$INCLUDE ../shared/a_modes.inc}
unit g_menu;
interface
procedure g_Menu_AskLanguage();
procedure g_Menu_Show_SaveMenu();
-procedure g_Menu_Show_LoadMenu();
+procedure g_Menu_Show_LoadMenu(standalone: Boolean=false);
procedure g_Menu_Show_GameSetGame();
procedure g_Menu_Show_OptionsVideo();
procedure g_Menu_Show_OptionsSound();
uses
g_gui, g_textures, e_graphics, g_main, g_window, g_game, g_map,
- g_basic, g_console, g_sound, g_gfx, g_player, g_options,
+ g_basic, g_console, g_sound, g_gfx, g_player, g_options, g_weapons,
e_log, SysUtils, CONFIG, g_playermodel, DateUtils,
- MAPSTRUCT, wadreader, Math, g_saveload,
- e_textures, GL, GLExt, g_language,
+ MAPDEF, wadreader, Math, g_saveload,
+ e_texture, GL, GLExt, g_language,
g_net, g_netmsg, g_netmaster, g_items, e_input;
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
with menu, gGameControls.P1Control do
begin
- for i := 0 to 9 do
+ for i := WP_FIRST to WP_LAST do
begin
KeyWeapon[i] := TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0;
KeyWeapon2[i] := TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1;
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
with menu, gGameControls.P2Control do
begin
- for i := 0 to 9 do
+ for i := WP_FIRST to WP_LAST do
begin
KeyWeapon[i] := TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0;
KeyWeapon2[i] := TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1;
TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key0 := KeyNextWeapon;
TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key0 := KeyPrevWeapon;
TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key0 := KeyOpen;
- TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key1 := KeyStrafe;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key0 := KeyStrafe;
// second set
TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key1 := KeyRight2;
TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key1 := KeyLeft2;
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
with menu, gGameControls.P1Control do
begin
- for i := 0 to 9 do
+ for i := WP_FIRST to WP_LAST do
begin
TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0 := KeyWeapon[i];
TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1 := KeyWeapon2[i];
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
with menu, gGameControls.P2Control do
begin
- for i := 0 to 9 do
+ for i := WP_FIRST to WP_LAST do
begin
TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0 := KeyWeapon[i];
TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1 := KeyWeapon2[i];
procedure ProcSwitchMonstersCustom(Sender: TGUIControl);
begin
+ // don't turn off monsters in DM
+ {
with TGUIMenu(g_ActiveWindow.GetControl('mCustomGameMenu')) do
- if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
+ if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
else
TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
+ }
+ {
+ if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
+ TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
+ else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
+ TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
+ }
end;
procedure ProcSwitchMonstersNet(Sender: TGUIControl);
begin
+ // don't turn off monsters in DM
+ {
with TGUIMenu(g_ActiveWindow.GetControl('mNetServerMenu')) do
- if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
+ if TGUISwitch(GetControl('swGameMode')).GetText <> _lc[I_MENU_GAME_TYPE_CTF] then
TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
else
TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
+ }
+ {
+ if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_COOP] then
+ TGUISwitch(GetControl('swMonsters')).ItemIndex := 0
+ else if TGUISwitch(GetControl('swGameMode')).GetText = _lc[I_MENU_GAME_TYPE_CTF] then
+ TGUISwitch(GetControl('swMonsters')).ItemIndex := 1;
+ }
end;
procedure ProcStartCustomGame();
procedure ProcSingle1Player();
begin
- g_Game_StartSingle('megawads/DOOM2D.WAD:\MAP01', False, 1);
+ g_Game_StartSingle(gDefaultMegawadStart, False, 1);
end;
procedure ProcSingle2Players();
begin
- g_Game_StartSingle('megawads/DOOM2D.WAD:\MAP01', True, 2);
+ g_Game_StartSingle(gDefaultMegawadStart, True, 2);
end;
procedure ProcSelectMapMenu();
with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_1_WEAPONS]))) do
begin
Name := 'mOptionsControlsP1MenuWeapons';
- for i := 0 to 9 do
+ for i := WP_FIRST to WP_LAST do
AddKeyRead2(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)]).Name :=
_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)];
end;
with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_2_WEAPONS]))) do
begin
Name := 'mOptionsControlsP2MenuWeapons';
- for i := 0 to 9 do
+ for i := WP_FIRST to WP_LAST do
AddKeyRead2(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)]).Name :=
_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)];
end;
g_Sound_PlayEx('MENU_OPEN');
end;
-procedure g_Menu_Show_LoadMenu();
+procedure g_Menu_Show_LoadMenu (standalone: Boolean=false);
begin
+ if (g_ActiveWindow <> nil) and (g_ActiveWindow.name = 'LoadMenu') then exit; // nothing to do
if gGameSettings.GameType = GT_SINGLE then
- g_GUI_ShowWindow('GameSingleMenu')
+ begin
+ if not standalone then g_GUI_ShowWindow('GameSingleMenu')
+ end
else
begin
- if g_Game_IsClient then
- Exit
- else
- if g_Game_IsNet then
- Exit
- else
- g_GUI_ShowWindow('GameCustomMenu');
+ if g_Game_IsClient then exit;
+ if g_Game_IsNet then exit;
+ if not standalone then g_GUI_ShowWindow('GameCustomMenu');
end;
g_GUI_ShowWindow('LoadMenu');
g_Sound_PlayEx('MENU_OPEN');