From 769efc53cd484bfc4018005817e7dd4625d50697 Mon Sep 17 00:00:00 2001 From: Tymon Date: Fri, 13 Sep 2019 15:30:16 +0200 Subject: [PATCH] Cleaned up backgrounds --- Backgrounds/AstralDesertSurfaceBGStyle.cs | 22 +++++------------- Backgrounds/AstralSnowSurfaceBGStyle.cs | 27 ++++++----------------- Backgrounds/AstralSurfaceBGStyle.cs | 19 +++++----------- Backgrounds/AstralUndergroundBGStyle.cs | 18 +++++++++++++++ Backgrounds/AstralUndergroungBGStyle.cs | 23 ------------------- Backgrounds/SulphurSeaSurfaceBGStyle.cs | 7 +----- 6 files changed, 37 insertions(+), 79 deletions(-) create mode 100644 Backgrounds/AstralUndergroundBGStyle.cs delete mode 100644 Backgrounds/AstralUndergroungBGStyle.cs diff --git a/Backgrounds/AstralDesertSurfaceBGStyle.cs b/Backgrounds/AstralDesertSurfaceBGStyle.cs index 1a29028624..014a06e5ac 100644 --- a/Backgrounds/AstralDesertSurfaceBGStyle.cs +++ b/Backgrounds/AstralDesertSurfaceBGStyle.cs @@ -1,31 +1,21 @@ - -using Terraria; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; - namespace CalamityMod.Backgrounds { public class AstralDesertSurfaceBGStyle : ModSurfaceBgStyle { - public override int ChooseFarTexture() - { - return mod.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceFar"); - } - public override int ChooseMiddleTexture() - { - return mod.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceMiddle"); - } + public override int ChooseFarTexture() => mod.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceFar"); + + public override int ChooseMiddleTexture() => mod.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceMiddle"); + public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) { b -= 75f; return mod.GetBackgroundSlot("Backgrounds/AstralDesertSurfaceClose"); } - public override bool ChooseBgStyle() - { - return !Main.gameMenu && Main.LocalPlayer.GetModPlayer(mod).ZoneAstral && Main.LocalPlayer.ZoneDesert; - } + public override bool ChooseBgStyle() => !Main.gameMenu && Main.LocalPlayer.InAstral() && Main.LocalPlayer.ZoneDesert; public override void ModifyFarFades(float[] fades, float transitionSpeed) { diff --git a/Backgrounds/AstralSnowSurfaceBGStyle.cs b/Backgrounds/AstralSnowSurfaceBGStyle.cs index a9e19766d7..386ce9e4b7 100644 --- a/Backgrounds/AstralSnowSurfaceBGStyle.cs +++ b/Backgrounds/AstralSnowSurfaceBGStyle.cs @@ -1,30 +1,17 @@ - -using Terraria; +using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; - namespace CalamityMod.Backgrounds { public class AstralSnowSurfaceBGStyle : ModSurfaceBgStyle { - public override int ChooseFarTexture() - { - return mod.GetBackgroundSlot("Backgrounds/AstralSnowSurfaceFar"); - } - public override int ChooseMiddleTexture() - { - return mod.GetBackgroundSlot("Backgrounds/AstralSnowSurfaceMiddle"); - } - public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) - { - return mod.GetBackgroundSlot("Backgrounds/AstralSurfaceClose"); - } + public override int ChooseFarTexture() => mod.GetBackgroundSlot("Backgrounds/AstralSnowSurfaceFar"); - public override bool ChooseBgStyle() - { - return !Main.gameMenu && Main.LocalPlayer.GetModPlayer(mod).ZoneAstral && Main.LocalPlayer.ZoneSnow; - } + public override int ChooseMiddleTexture() => mod.GetBackgroundSlot("Backgrounds/AstralSnowSurfaceMiddle"); + + public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) => mod.GetBackgroundSlot("Backgrounds/AstralSurfaceClose"); + + public override bool ChooseBgStyle() => !Main.gameMenu && Main.LocalPlayer.InAstral() && Main.LocalPlayer.ZoneSnow; public override void ModifyFarFades(float[] fades, float transitionSpeed) { diff --git a/Backgrounds/AstralSurfaceBGStyle.cs b/Backgrounds/AstralSurfaceBGStyle.cs index 4c369f64ee..c0d83b6c83 100644 --- a/Backgrounds/AstralSurfaceBGStyle.cs +++ b/Backgrounds/AstralSurfaceBGStyle.cs @@ -1,30 +1,21 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; - namespace CalamityMod.Backgrounds { public class AstralSurfaceBGStyle : ModSurfaceBgStyle { - public override int ChooseFarTexture() - { - return mod.GetBackgroundSlot("Backgrounds/AstralSurfaceFar"); - } - public override int ChooseMiddleTexture() - { - return mod.GetBackgroundSlot("Backgrounds/AstralSurfaceMiddle"); - } + public override int ChooseFarTexture() => mod.GetBackgroundSlot("Backgrounds/AstralSurfaceFar"); + + public override int ChooseMiddleTexture() => mod.GetBackgroundSlot("Backgrounds/AstralSurfaceMiddle"); + public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) { scale *= 0.75f; return mod.GetBackgroundSlot("Backgrounds/AstralSurfaceClose"); } - public override bool ChooseBgStyle() - { - return !Main.gameMenu && Main.LocalPlayer.GetModPlayer(mod).ZoneAstral && !Main.LocalPlayer.ZoneDesert && !Main.LocalPlayer.ZoneSnow; - } + public override bool ChooseBgStyle() => !Main.gameMenu && Main.LocalPlayer.InAstral() && !Main.LocalPlayer.ZoneDesert && !Main.LocalPlayer.ZoneSnow; public override void ModifyFarFades(float[] fades, float transitionSpeed) { diff --git a/Backgrounds/AstralUndergroundBGStyle.cs b/Backgrounds/AstralUndergroundBGStyle.cs new file mode 100644 index 0000000000..dbbb650181 --- /dev/null +++ b/Backgrounds/AstralUndergroundBGStyle.cs @@ -0,0 +1,18 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Backgrounds +{ + public class AstralUndergroundBGStyle : ModUgBgStyle + { + public override bool ChooseBgStyle() => Main.LocalPlayer.InAstral(); + + public override void FillTextureArray(int[] textureSlots) + { + for (int i = 0; i <= 3; i++) + { + textureSlots[i] = mod.GetBackgroundSlot("Backgrounds/AstralUG" + i.ToString()); + } + } + } +} diff --git a/Backgrounds/AstralUndergroungBGStyle.cs b/Backgrounds/AstralUndergroungBGStyle.cs deleted file mode 100644 index f996699ff0..0000000000 --- a/Backgrounds/AstralUndergroungBGStyle.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -using CalamityMod.CalPlayer; - -namespace CalamityMod.Backgrounds -{ - public class ExampleUgBgStyle : ModUgBgStyle - { - public override bool ChooseBgStyle() - { - return Main.LocalPlayer.GetModPlayer().ZoneAstral; - } - - public override void FillTextureArray(int[] textureSlots) - { - textureSlots[0] = mod.GetBackgroundSlot("Backgrounds/AstralUG0"); - textureSlots[1] = mod.GetBackgroundSlot("Backgrounds/AstralUG1"); - textureSlots[2] = mod.GetBackgroundSlot("Backgrounds/AstralUG2"); - textureSlots[3] = mod.GetBackgroundSlot("Backgrounds/AstralUG3"); - } - } -} diff --git a/Backgrounds/SulphurSeaSurfaceBGStyle.cs b/Backgrounds/SulphurSeaSurfaceBGStyle.cs index 87ec69c4dd..d061742b16 100644 --- a/Backgrounds/SulphurSeaSurfaceBGStyle.cs +++ b/Backgrounds/SulphurSeaSurfaceBGStyle.cs @@ -1,8 +1,6 @@ using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; - namespace CalamityMod.Backgrounds { public class SulphurSeaSurfaceBGStyle : ModSurfaceBgStyle @@ -13,10 +11,7 @@ namespace CalamityMod.Backgrounds return mod.GetBackgroundSlot("Backgrounds/SulphurSeaSurfaceClose"); } - public override bool ChooseBgStyle() - { - return !Main.gameMenu && Main.LocalPlayer.GetModPlayer(mod).ZoneSulphur; - } + public override bool ChooseBgStyle() => !Main.gameMenu && Main.LocalPlayer.InSulphur(); public override void ModifyFarFades(float[] fades, float transitionSpeed) {