From f839269a7211d7bd7776b182034f9b93832fb845 Mon Sep 17 00:00:00 2001 From: biwa <6475593+biwa@users.noreply.github.com> Date: Sun, 27 Nov 2022 11:02:26 +0100 Subject: [PATCH] Disabled visual sloping for game configurations that do not support plane equation slopes. Fixes #828 Added toasts for visual sloping events --- .../Includes/Zandronum_common.cfg | 321 +++++++++--------- .../Includes/Zandronum_things.cfg | 24 +- Build/Configurations/Zandronum_DoomUDMF.cfg | 1 + .../Configurations/Zandronum_HereticUDMF.cfg | 1 + Build/Configurations/Zandronum_HexenUDMF.cfg | 1 + Build/Configurations/Zandronum_StrifeUDMF.cfg | 1 + .../BuilderModes/General/BuilderPlug.cs | 10 +- .../VisualModes/BaseVisualMode.cs | 21 +- 8 files changed, 211 insertions(+), 169 deletions(-) diff --git a/Build/Configurations/Includes/Zandronum_common.cfg b/Build/Configurations/Includes/Zandronum_common.cfg index 862cb557d..0029660c8 100755 --- a/Build/Configurations/Includes/Zandronum_common.cfg +++ b/Build/Configurations/Includes/Zandronum_common.cfg @@ -1,170 +1,185 @@ -// New things available in all games -zandronum +// *********************************************************** +// * * +// * Text map format * +// * * +// *********************************************************** +// Contains the differences to the GZDoom UDMF settings +mapformat_udmf { - //dynamic lights - include("GZDoom_things.cfg", "gzdoom_lights") + // Disables support for plane equation slopes + planeequationsupport = false; +} - // Team player starts - players +// New things available in all games +things +{ + zandronum { - color = 10; // Light Green - arrow = 1; - title = "Player Starts"; - width = 16; - sort = 1; - height = 56; - hangs = 0; - blocking = 2; - error = 2; - - 5080 - { - title = "Player Blue start (team start)"; - sprite = "PLAYE2E8"; - } - 5081 - { - title = "Player Red start (team start)"; - sprite = "PLAYF2F8"; - } - 5082 - { - title = "Player Temporary start (team start)"; - sprite = "PLAYF1"; - } - } + //dynamic lights + include("GZDoom_things.cfg", "gzdoom_lights") - flags - { - color = 13; // Light Magenta - arrow = 0; - title = "Flags"; - width = 20; - sort = 1; - height = 20; - hangs = 0; - blocking = 0; - - 5130 - { - title = "Blue flag"; - sprite = "internal:ZandFlagBlue"; - } - 5131 - { - title = "Red flag"; - sprite = "internal:ZandFlagRed"; - } - 5132 - { - title = "White flag"; - sprite = "internal:ZandFlagWhite"; - } - 5133 - { - title = "Green flag"; - sprite = "internal:ZandFlagGreen"; + // Team player starts + players + { + color = 10; // Light Green + arrow = 1; + title = "Player Starts"; + width = 16; + sort = 1; + height = 56; + hangs = 0; + blocking = 2; + error = 2; + + 5080 + { + title = "Player Blue start (team start)"; + sprite = "PLAYE2E8"; + } + 5081 + { + title = "Player Red start (team start)"; + sprite = "PLAYF2F8"; + } + 5082 + { + title = "Player Temporary start (team start)"; + sprite = "PLAYF1"; + } } - 5134 - { - title = "Gold flag"; - sprite = "internal:ZandFlagGold"; + + flags + { + color = 13; // Light Magenta + arrow = 0; + title = "Flags"; + width = 20; + sort = 1; + height = 20; + hangs = 0; + blocking = 0; + + 5130 + { + title = "Blue flag"; + sprite = "internal:ZandFlagBlue"; + } + 5131 + { + title = "Red flag"; + sprite = "internal:ZandFlagRed"; + } + 5132 + { + title = "White flag"; + sprite = "internal:ZandFlagWhite"; + } + 5133 + { + title = "Green flag"; + sprite = "internal:ZandFlagGreen"; + } + 5134 + { + title = "Gold flag"; + sprite = "internal:ZandFlagGold"; + } } } -} -// New things available in Doom, Heretic, Hexen and Strife but not Chex Quest -doomheretichexenstrife -{ - flags + // New things available in Doom, Heretic, Hexen and Strife but not Chex Quest + doomheretichexenstrife { - color = 13; // Light Magenta - arrow = 0; - title = "Flags"; - width = 20; - sort = 1; - height = 20; - hangs = 0; - blocking = 0; - - 5025 - { - title = "Red skull"; - sprite = "RSKUB0"; - } - 5026 - { - title = "Blue skull"; - sprite = "BSKUB0"; + flags + { + color = 13; // Light Magenta + arrow = 0; + title = "Flags"; + width = 20; + sort = 1; + height = 20; + hangs = 0; + blocking = 0; + + 5025 + { + title = "Red skull"; + sprite = "RSKUB0"; + } + 5026 + { + title = "Blue skull"; + sprite = "BSKUB0"; + } } } -} -// New things available in Doom, Heretic and Hexen; but not in Chex or Strife -doomheretichexen -{ - // Zandronum runes - runes + // New things available in Doom, Heretic and Hexen; but not in Chex or Strife + doomheretichexen { - color = 17; // Light Orange - arrow = 0; - title = "Runes"; - width = 20; - sort = 1; - height = 45; - hangs = 0; - blocking = 0; - - 5100 - { - title = "Strength"; - sprite = "internal:ZandRuneStrength"; - } - 5101 - { - title = "Rage"; - sprite = "internal:ZandRuneRage"; - } - 5102 - { - title = "Drain"; - sprite = "internal:ZandRuneDrain"; - } - 5103 - { - title = "Spread"; - sprite = "internal:ZandRuneSpread"; - } - 5104 - { - title = "Resistance"; - sprite = "internal:ZandRuneResistance"; - } - 5105 - { - title = "Regeneration"; - sprite = "internal:ZandRuneRegeneration"; - } - 5106 - { - title = "Prosperity"; - sprite = "internal:ZandRuneProsperity"; - } - 5107 - { - title = "Reflection"; - sprite = "internal:ZandRuneReflection"; - } - 5108 - { - title = "High Jumper"; - sprite = "internal:ZandRuneHighJump"; - } - 5109 - { - title = "Haste"; - sprite = "internal:ZandRuneHaste"; + // Zandronum runes + runes + { + color = 17; // Light Orange + arrow = 0; + title = "Runes"; + width = 20; + sort = 1; + height = 45; + hangs = 0; + blocking = 0; + + 5100 + { + title = "Strength"; + sprite = "internal:ZandRuneStrength"; + } + 5101 + { + title = "Rage"; + sprite = "internal:ZandRuneRage"; + } + 5102 + { + title = "Drain"; + sprite = "internal:ZandRuneDrain"; + } + 5103 + { + title = "Spread"; + sprite = "internal:ZandRuneSpread"; + } + 5104 + { + title = "Resistance"; + sprite = "internal:ZandRuneResistance"; + } + 5105 + { + title = "Regeneration"; + sprite = "internal:ZandRuneRegeneration"; + } + 5106 + { + title = "Prosperity"; + sprite = "internal:ZandRuneProsperity"; + } + 5107 + { + title = "Reflection"; + sprite = "internal:ZandRuneReflection"; + } + 5108 + { + title = "High Jumper"; + sprite = "internal:ZandRuneHighJump"; + } + 5109 + { + title = "Haste"; + sprite = "internal:ZandRuneHaste"; + } } } } \ No newline at end of file diff --git a/Build/Configurations/Includes/Zandronum_things.cfg b/Build/Configurations/Includes/Zandronum_things.cfg index 4989a3e21..4b0116256 100755 --- a/Build/Configurations/Includes/Zandronum_things.cfg +++ b/Build/Configurations/Includes/Zandronum_things.cfg @@ -5,18 +5,18 @@ doom { - include("Zandronum_common.cfg", "zandronum") - include("Zandronum_common.cfg", "doomheretichexenstrife") - include("Zandronum_common.cfg", "doomheretichexen") + include("Zandronum_common.cfg", "things.zandronum") + include("Zandronum_common.cfg", "things.doomheretichexenstrife") + include("Zandronum_common.cfg", "things.doomheretichexen") include("Skulltag_things.cfg", "doomheretichexen") include("Skulltag_things.cfg", "doom") } heretic { - include("Zandronum_common.cfg", "zandronum") - include("Zandronum_common.cfg", "doomheretichexenstrife") - include("Zandronum_common.cfg", "doomheretichexen") + include("Zandronum_common.cfg", "things.zandronum") + include("Zandronum_common.cfg", "things.doomheretichexenstrife") + include("Zandronum_common.cfg", "things.doomheretichexen") include("Skulltag_things.cfg", "doomheretichexen") include("Skulltag_things.cfg", "raven") include("Skulltag_things.cfg", "heretic") @@ -24,9 +24,9 @@ heretic hexen { - include("Zandronum_common.cfg", "zandronum") - include("Zandronum_common.cfg", "doomheretichexenstrife") - include("Zandronum_common.cfg", "doomheretichexen") + include("Zandronum_common.cfg", "things.zandronum") + include("Zandronum_common.cfg", "things.doomheretichexenstrife") + include("Zandronum_common.cfg", "things.doomheretichexen") include("Skulltag_things.cfg", "doomheretichexen") include("Skulltag_things.cfg", "raven") include("Skulltag_things.cfg", "hexen") @@ -34,13 +34,13 @@ hexen strife { - include("Zandronum_common.cfg", "zandronum") - include("Zandronum_common.cfg", "doomheretichexenstrife") + include("Zandronum_common.cfg", "things.zandronum") + include("Zandronum_common.cfg", "things.doomheretichexenstrife") include("Skulltag_things.cfg", "strife") } default { - include("Zandronum_common.cfg", "zandronum") + include("Zandronum_common.cfg", "things.zandronum") include("Skulltag_things.cfg", "skulltag") } \ No newline at end of file diff --git a/Build/Configurations/Zandronum_DoomUDMF.cfg b/Build/Configurations/Zandronum_DoomUDMF.cfg index 06b48a42d..15eaea1a0 100755 --- a/Build/Configurations/Zandronum_DoomUDMF.cfg +++ b/Build/Configurations/Zandronum_DoomUDMF.cfg @@ -25,6 +25,7 @@ include("Includes\\ZDoom_common.cfg", "common"); // Settings common to text map format include("Includes\\ZDoom_common.cfg", "mapformat_udmf"); +include("Includes\\Zandronum_common.cfg", "mapformat_udmf"); include("Includes\\Zandronum_linedefs.cfg"); // Zandronum doesn't support sectors with multiple tags. Defaults to false, but is set to true diff --git a/Build/Configurations/Zandronum_HereticUDMF.cfg b/Build/Configurations/Zandronum_HereticUDMF.cfg index b83a79ce3..c52db9e0d 100755 --- a/Build/Configurations/Zandronum_HereticUDMF.cfg +++ b/Build/Configurations/Zandronum_HereticUDMF.cfg @@ -25,6 +25,7 @@ include("Includes\\ZDoom_common.cfg", "common"); // Settings common to text map format include("Includes\\ZDoom_common.cfg", "mapformat_udmf"); +include("Includes\\Zandronum_common.cfg", "mapformat_udmf"); include("Includes\\Zandronum_linedefs.cfg"); // Zandronum doesn't support sectors with multiple tags. Defaults to false, but is set to true diff --git a/Build/Configurations/Zandronum_HexenUDMF.cfg b/Build/Configurations/Zandronum_HexenUDMF.cfg index cbf3fefe1..12b61d123 100755 --- a/Build/Configurations/Zandronum_HexenUDMF.cfg +++ b/Build/Configurations/Zandronum_HexenUDMF.cfg @@ -25,6 +25,7 @@ include("Includes\\ZDoom_common.cfg", "common"); // Settings common to text map format include("Includes\\ZDoom_common.cfg", "mapformat_udmf"); +include("Includes\\Zandronum_common.cfg", "mapformat_udmf"); include("Includes\\Zandronum_linedefs.cfg"); // Zandronum doesn't support sectors with multiple tags. Defaults to false, but is set to true diff --git a/Build/Configurations/Zandronum_StrifeUDMF.cfg b/Build/Configurations/Zandronum_StrifeUDMF.cfg index 83c860c75..6115fef63 100755 --- a/Build/Configurations/Zandronum_StrifeUDMF.cfg +++ b/Build/Configurations/Zandronum_StrifeUDMF.cfg @@ -25,6 +25,7 @@ include("Includes\\ZDoom_common.cfg", "common"); // Settings common to text map format include("Includes\\ZDoom_common.cfg", "mapformat_udmf"); +include("Includes\\Zandronum_common.cfg", "mapformat_udmf"); include("Includes\\Zandronum_linedefs.cfg"); // Zandronum doesn't support sectors with multiple tags. Defaults to false, but is set to true diff --git a/Source/Plugins/BuilderModes/General/BuilderPlug.cs b/Source/Plugins/BuilderModes/General/BuilderPlug.cs index 1f90bb6b5..9b35433f3 100755 --- a/Source/Plugins/BuilderModes/General/BuilderPlug.cs +++ b/Source/Plugins/BuilderModes/General/BuilderPlug.cs @@ -42,6 +42,11 @@ using System.Runtime.CompilerServices; namespace CodeImp.DoomBuilder.BuilderModes { + internal class ToastMessages + { + public static readonly string VISUALSLOPING = "visualsloping"; + } + public class BuilderPlug : Plug { #region ================== API Declarations @@ -249,8 +254,11 @@ namespace CodeImp.DoomBuilder.BuilderModes //mxd General.Actions.BindMethods(this); + + // Register toasts + General.ToastManager.RegisterToast(ToastMessages.VISUALSLOPING, "Visual sloping", "Toasts related to visual sloping"); } - + // Disposer public override void Dispose() { diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs index d3f32dff5..adb74ab1f 100755 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs @@ -4457,7 +4457,12 @@ namespace CodeImp.DoomBuilder.BuilderModes { if (!General.Map.UDMF) { - General.Interface.DisplayStatus(StatusType.Warning, "Visual sloping is supported in UDMF only!"); + General.ToastManager.ShowToast(ToastMessages.VISUALSLOPING, ToastType.WARNING, "Visual sloping", "Visual sloping is supported in UDMF only."); + return; + } + else if(!General.Map.Config.PlaneEquationSupport) + { + General.ToastManager.ShowToast(ToastMessages.VISUALSLOPING, ToastType.WARNING, "Visual sloping", "Visual sloping is not supported in this game configuration."); return; } @@ -4483,7 +4488,12 @@ namespace CodeImp.DoomBuilder.BuilderModes { if (!General.Map.UDMF) { - General.Interface.DisplayStatus(StatusType.Warning, "Visual sloping is supported in UDMF only!"); + General.ToastManager.ShowToast(ToastMessages.VISUALSLOPING, ToastType.WARNING, "Visual sloping", "Visual sloping is supported in UDMF only."); + return; + } + else if (!General.Map.Config.PlaneEquationSupport) + { + General.ToastManager.ShowToast(ToastMessages.VISUALSLOPING, ToastType.WARNING, "Visual sloping", "Visual sloping is not supported in this game configuration."); return; } @@ -4509,7 +4519,12 @@ namespace CodeImp.DoomBuilder.BuilderModes { if (!General.Map.UDMF) { - General.Interface.DisplayStatus(StatusType.Warning, "Visual sloping is supported in UDMF only!"); + General.ToastManager.ShowToast(ToastMessages.VISUALSLOPING, ToastType.WARNING, "Visual sloping", "Visual sloping is not supported in this game configuration."); + return; + } + else if (!General.Map.Config.PlaneEquationSupport) + { + General.ToastManager.ShowToast(ToastMessages.VISUALSLOPING, ToastType.WARNING, "Visual sloping", "Visual sloping is not supported in this game configuration."); return; } -- GitLab