diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index d3029eb5e0..7d2abeb6dc 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -1896,8 +1896,8 @@ namespace CalamityMod.ILEditing drawColor = glowMaskTile.GlowMaskPaintInteraction switch { - GlowMaskTile.PaintColorTint.OnlyByDeepPaint => GlowMaskTile.ApplyPaint(colType, drawColor, deepPaintOnly: true), - GlowMaskTile.PaintColorTint.ByEveryPaint => GlowMaskTile.ApplyPaint(colType, drawColor, deepPaintOnly: false), + GlowMaskTile.PaintColorTint.OnlyByDeepPaint => CalamityUtils.ApplyPaint(colType, drawColor, deepPaintOnly: true), + GlowMaskTile.PaintColorTint.ByEveryPaint => CalamityUtils.ApplyPaint(colType, drawColor, deepPaintOnly: false), _ => drawColor }; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 9304efb4b8..dff1443e29 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -6064,11 +6064,10 @@ namespace CalamityMod.NPCs if (CalamityLists.DesertScourgeIDs.Contains(npc.type) || CalamityLists.EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper || CalamityLists.PerforatorIDs.Contains(npc.type) || CalamityLists.AquaticScourgeIDs.Contains(npc.type) || CalamityLists.DestroyerIDs.Contains(npc.type) || CalamityLists.AstrumDeusIDs.Contains(npc.type) || CalamityLists.StormWeaverIDs.Contains(npc.type) || CalamityLists.ThanatosIDs.Contains(npc.type) || - npc.type == NPCType() || npc.type == NPCType() || CalamityLists.AresIDs.Contains(npc.type) || npc.type == NPCType() || - npc.type == NPCType()) + npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType()) { - float damageMult = CalamityLists.ThanatosIDs.Contains(npc.type) ? 0.35f : 0.5f; - if (item.CountsAsClass() && item.type != ItemType() && item.type != ItemType()) + float damageMult = CalamityLists.ThanatosIDs.Contains(npc.type) ? 0.35f : (CalamityLists.DesertScourgeIDs.Contains(npc.type) || npc.type == NPCType()) ? 0.75f : 0.5f; + if (item.CountsAsClass() && item.type != ItemType()) modifiers.SourceDamage *= damageMult; } } diff --git a/Tiles/Astral/AstralMonolith.cs b/Tiles/Astral/AstralMonolith.cs index 6273e857ec..1ff2ad9606 100644 --- a/Tiles/Astral/AstralMonolith.cs +++ b/Tiles/Astral/AstralMonolith.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Tiles.Astral Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Astral/AstralMonolithGlow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(50, 50, 50, 50)); if (!tile.IsHalfBlock && tile.Slope == 0) { Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); @@ -132,19 +132,6 @@ namespace CalamityMod.Tiles.Astral } } - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } - public override bool IsTileBiomeSightable(int i, int j, ref Color sightColor) { sightColor = Color.Cyan; diff --git a/Tiles/Crags/BrimstoneSlag.cs b/Tiles/Crags/BrimstoneSlag.cs index 6d64f0c9e3..d88a236f6b 100644 --- a/Tiles/Crags/BrimstoneSlag.cs +++ b/Tiles/Crags/BrimstoneSlag.cs @@ -51,64 +51,5 @@ namespace CalamityMod.Tiles.Crags { return TileFramingSystem.BrimstoneFraming(i, j, resetFrame); } - - /*public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - Tile tile = Main.tile[i, j]; - Texture2D sprite = ModContent.GetTexture("CalamityMod/Tiles/Crags/BrimstoneSlagGlow"); - int frameXOffset = i % 2 * subsheetWidth; - int frameYOffset = j % 2 * subsheetHeight; - Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange); - Color drawColour = GetDrawColour(i, j, new Color(50, 50, 50, 50)); - if (Main.drawToScreen) - { - zero = Vector2.Zero; - } - if (tile.Slope == (byte)0 && !tile.IsHalfBlock) - Main.spriteBatch.Draw(sprite, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y)) + zero, new Rectangle(tile.frameX + frameXOffset, tile.frameY + frameYOffset, 16, 16), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - else if (tile.IsHalfBlock) - { - Main.spriteBatch.Draw(sprite, new Vector2((float)(i * 16 - (int)Main.screenPosition.X), (float)(j * 16 - (int)Main.screenPosition.Y + 10) + 8) + zero, new Rectangle(tile.frameX + frameXOffset, tile.frameY + frameYOffset, 16, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - else - { - byte num9 = tile.Slope; - for (int index4 = 0; index4 < 8; ++index4) - { - int width2 = index4 << 1; - Rectangle drawRectangle = new Rectangle(tile.frameX + frameXOffset, tile.frameY + frameYOffset + index4 * 2, width2, 2); - int num10 = 0; - switch (num9) - { - case 2: - drawRectangle.X = 16 - width2; - num10 = 16 - width2; - break; - case 3: - drawRectangle.Width = 16 - width2; - break; - case 4: - drawRectangle.Width = 14 - width2; - drawRectangle.X = width2 + 2; - num10 = width2 + 2; - break; - } - Main.spriteBatch.Draw(sprite, new Vector2((float)(i * 16 - (int)Main.screenPosition.X) + (float)num10, (float)(j * 16 - (int)Main.screenPosition.Y + index4 * 2)) + zero, drawRectangle, drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } - } - } - - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - }*/ } } diff --git a/Tiles/Crags/ScorchedRemainsGrass.cs b/Tiles/Crags/ScorchedRemainsGrass.cs index 5cf19faafc..9cda532896 100644 --- a/Tiles/Crags/ScorchedRemainsGrass.cs +++ b/Tiles/Crags/ScorchedRemainsGrass.cs @@ -149,7 +149,7 @@ namespace CalamityMod.Tiles.Crags { Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Lighting.GetColor(i, j)); Texture2D leaves = ModContent.Request("CalamityMod/Tiles/Crags/CinderBlossomGrassGrass").Value; DrawExtraTop(i, j, leaves, drawOffset, drawColour); @@ -279,27 +279,6 @@ namespace CalamityMod.Tiles.Crags return Main.tile[i + x, j - y].TileType == type == equal; } - private Color GetDrawColour(int i, int j) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType < 13) - { - paintCol.R = (byte)((paintCol.R / 2f) + 128); - paintCol.G = (byte)((paintCol.G / 2f) + 128); - paintCol.B = (byte)((paintCol.B / 2f) + 128); - } - if (colType == 29) - { - paintCol = Color.Black; - } - Color col = Lighting.GetColor(i, j); - col.R = (byte)(paintCol.R / 255f * col.R); - col.G = (byte)(paintCol.G / 255f * col.G); - col.B = (byte)(paintCol.B / 255f * col.B); - return col; - } - private int GetExtraState(string type) { switch (type) diff --git a/Tiles/Furniture/BabyFlakCrabCageTile.cs b/Tiles/Furniture/BabyFlakCrabCageTile.cs index e07851e25b..a5130a5078 100644 --- a/Tiles/Furniture/BabyFlakCrabCageTile.cs +++ b/Tiles/Furniture/BabyFlakCrabCageTile.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Tiles.Furniture var drawPos = new Vector2(i * 16, j * 16) - Main.screenPosition + zero + CalamityUtils.TileDrawOffset + Vector2.UnitY * 2; var animateFrameOffset = Main.tileFrame[Type] * AnimationFrameHeight; var height = 16; - var finalColor = Lighting.GetColor(i, j); + var finalColor = CalamityUtils.ApplyPaint(tile.TileColor, Lighting.GetColor(i, j), false); var rect = new Rectangle(tile.TileFrameX, tile.TileFrameY + animateFrameOffset, 16, height); diff --git a/Tiles/Furniture/CraftingStations/MonolithAmalgam.cs b/Tiles/Furniture/CraftingStations/MonolithAmalgam.cs index 907903a75f..5bdeda2d2b 100644 --- a/Tiles/Furniture/CraftingStations/MonolithAmalgam.cs +++ b/Tiles/Furniture/CraftingStations/MonolithAmalgam.cs @@ -31,23 +31,10 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Furniture/CraftingStations/MonolithAmalgamGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } } } diff --git a/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs b/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs index 8cd29cfa01..e673581d99 100644 --- a/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs +++ b/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs @@ -36,23 +36,10 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Furniture/CraftingStations/WulfrumLabstationGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } } } diff --git a/Tiles/Furniture/PiggyCageTile.cs b/Tiles/Furniture/PiggyCageTile.cs index 6d03b39c69..66dfb336a4 100644 --- a/Tiles/Furniture/PiggyCageTile.cs +++ b/Tiles/Furniture/PiggyCageTile.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.Furniture var drawPos = new Vector2(i * 16, j * 16) - Main.screenPosition + zero + CalamityUtils.TileDrawOffset + Vector2.UnitY * 2; var animateFrameOffset = Main.tileFrame[Type] * AnimationFrameHeight; var height = 16; - var finalColor = Lighting.GetColor(i, j); + var finalColor = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Lighting.GetColor(i, j), false); var rect = new Rectangle(tile.TileFrameX, tile.TileFrameY + animateFrameOffset, 16, height); diff --git a/Tiles/Furniture/RepairUnitCageTile.cs b/Tiles/Furniture/RepairUnitCageTile.cs index 39eaba532a..5785665977 100644 --- a/Tiles/Furniture/RepairUnitCageTile.cs +++ b/Tiles/Furniture/RepairUnitCageTile.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Tiles.Furniture var drawPos = new Vector2(i * 16, j * 16) - Main.screenPosition + zero + CalamityUtils.TileDrawOffset + Vector2.UnitY * 2; var animateFrameOffset = Main.tileFrame[Type] * AnimationFrameHeight; var height = 16; - var finalColor = Lighting.GetColor(i, j); + var finalColor = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Lighting.GetColor(i, j), false); var rect = new Rectangle(tile.TileFrameX, tile.TileFrameY + animateFrameOffset, 16, height); diff --git a/Tiles/FurnitureAshen/AshenAccentSlab.cs b/Tiles/FurnitureAshen/AshenAccentSlab.cs index f92c169a76..97dc53aba5 100644 --- a/Tiles/FurnitureAshen/AshenAccentSlab.cs +++ b/Tiles/FurnitureAshen/AshenAccentSlab.cs @@ -512,7 +512,7 @@ namespace CalamityMod.Tiles.FurnitureAshen Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAshen/AshenSlabGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(64, 64, 64, 64)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(64, 64, 64, 64)); Tile trackTile = Main.tile[i, j]; if (!trackTile.IsHalfBlock && trackTile.Slope == 0) { @@ -524,19 +524,6 @@ namespace CalamityMod.Tiles.FurnitureAshen } } - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } - /* /// /// Gets the tile variant to use. Returns -1 by default diff --git a/Tiles/FurnitureAshen/AshenSlab.cs b/Tiles/FurnitureAshen/AshenSlab.cs index 2534a691f7..182a094973 100644 --- a/Tiles/FurnitureAshen/AshenSlab.cs +++ b/Tiles/FurnitureAshen/AshenSlab.cs @@ -512,7 +512,7 @@ namespace CalamityMod.Tiles.FurnitureAshen Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAshen/AshenSlabGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(64, 64, 64, 64)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(64, 64, 64, 64)); Tile trackTile = Main.tile[i, j]; if (!trackTile.IsHalfBlock && trackTile.Slope == 0) { @@ -524,19 +524,6 @@ namespace CalamityMod.Tiles.FurnitureAshen } } - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } - /* /// /// Gets the tile variant to use. Returns -1 by default diff --git a/Tiles/FurnitureAuric/AuricAbsorberTile.cs b/Tiles/FurnitureAuric/AuricAbsorberTile.cs index 2d6f075873..133cbee19f 100644 --- a/Tiles/FurnitureAuric/AuricAbsorberTile.cs +++ b/Tiles/FurnitureAuric/AuricAbsorberTile.cs @@ -24,23 +24,9 @@ namespace CalamityMod.Tiles.FurnitureAuric public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { var tileCache = Main.tile[i, j]; - Color drawColour = GetDrawColour(i, j, Color.White); - - TileFramingSystem.SlopedGlowmask(in tileCache, i, j, TextureAssets.Tile[Type].Value, null, GetDrawColour(i, j, drawColour), default); + TileFramingSystem.SlopedGlowmask(in tileCache, i, j, TextureAssets.Tile[Type].Value, null, CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Color.White), default); } - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); diff --git a/Tiles/FurnitureMonolith/MonolithBathtub.cs b/Tiles/FurnitureMonolith/MonolithBathtub.cs index 5aae1e2385..3ce05394fc 100644 --- a/Tiles/FurnitureMonolith/MonolithBathtub.cs +++ b/Tiles/FurnitureMonolith/MonolithBathtub.cs @@ -25,23 +25,10 @@ namespace CalamityMod.Tiles.FurnitureMonolith int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithBathtubGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } } } diff --git a/Tiles/FurnitureMonolith/MonolithBed.cs b/Tiles/FurnitureMonolith/MonolithBed.cs index 6ae7cbfc5e..49e88eb271 100644 --- a/Tiles/FurnitureMonolith/MonolithBed.cs +++ b/Tiles/FurnitureMonolith/MonolithBed.cs @@ -27,25 +27,12 @@ namespace CalamityMod.Tiles.FurnitureMonolith int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithBedGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } - public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); diff --git a/Tiles/FurnitureMonolith/MonolithBench.cs b/Tiles/FurnitureMonolith/MonolithBench.cs index 0400bf17ab..624f9e10f4 100644 --- a/Tiles/FurnitureMonolith/MonolithBench.cs +++ b/Tiles/FurnitureMonolith/MonolithBench.cs @@ -28,25 +28,12 @@ namespace CalamityMod.Tiles.FurnitureMonolith int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithBenchGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); diff --git a/Tiles/FurnitureMonolith/MonolithBookcase.cs b/Tiles/FurnitureMonolith/MonolithBookcase.cs index 60e6ef752a..573af1ad49 100644 --- a/Tiles/FurnitureMonolith/MonolithBookcase.cs +++ b/Tiles/FurnitureMonolith/MonolithBookcase.cs @@ -26,23 +26,10 @@ namespace CalamityMod.Tiles.FurnitureMonolith int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithBookcaseGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } } } diff --git a/Tiles/FurnitureMonolith/MonolithCandelabra.cs b/Tiles/FurnitureMonolith/MonolithCandelabra.cs index 19f60bb71e..f917cbbb59 100644 --- a/Tiles/FurnitureMonolith/MonolithCandelabra.cs +++ b/Tiles/FurnitureMonolith/MonolithCandelabra.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithCandelabraGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); @@ -35,19 +35,6 @@ namespace CalamityMod.Tiles.FurnitureMonolith Main.spriteBatch.Draw(glowmaskBright, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { if (Main.tile[i, j].TileFrameX < 18) diff --git a/Tiles/FurnitureMonolith/MonolithCandle.cs b/Tiles/FurnitureMonolith/MonolithCandle.cs index 33fdb3f075..bfff448231 100644 --- a/Tiles/FurnitureMonolith/MonolithCandle.cs +++ b/Tiles/FurnitureMonolith/MonolithCandle.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithCandleGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y - 4) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 20)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); @@ -35,19 +35,6 @@ namespace CalamityMod.Tiles.FurnitureMonolith Main.spriteBatch.Draw(glowmaskBright, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 20)), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { if (Main.tile[i, j].TileFrameX < 18) diff --git a/Tiles/FurnitureMonolith/MonolithChair.cs b/Tiles/FurnitureMonolith/MonolithChair.cs index 408a20c2e3..ac8524312b 100644 --- a/Tiles/FurnitureMonolith/MonolithChair.cs +++ b/Tiles/FurnitureMonolith/MonolithChair.cs @@ -29,25 +29,12 @@ namespace CalamityMod.Tiles.FurnitureMonolith int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithChairGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); diff --git a/Tiles/FurnitureMonolith/MonolithChandelier.cs b/Tiles/FurnitureMonolith/MonolithChandelier.cs index 8ff78595b1..b6776a0b44 100644 --- a/Tiles/FurnitureMonolith/MonolithChandelier.cs +++ b/Tiles/FurnitureMonolith/MonolithChandelier.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithChandelierGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); @@ -35,19 +35,6 @@ namespace CalamityMod.Tiles.FurnitureMonolith Main.spriteBatch.Draw(glowmaskBright, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { if (Main.tile[i, j].TileFrameX < 18) diff --git a/Tiles/FurnitureMonolith/MonolithChest.cs b/Tiles/FurnitureMonolith/MonolithChest.cs index 435852091e..47cba4785d 100644 --- a/Tiles/FurnitureMonolith/MonolithChest.cs +++ b/Tiles/FurnitureMonolith/MonolithChest.cs @@ -66,23 +66,10 @@ namespace CalamityMod.Tiles.FurnitureMonolith int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithChestGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } } } diff --git a/Tiles/FurnitureMonolith/MonolithClock.cs b/Tiles/FurnitureMonolith/MonolithClock.cs index bbb8bcad8a..7cc3d76d67 100644 --- a/Tiles/FurnitureMonolith/MonolithClock.cs +++ b/Tiles/FurnitureMonolith/MonolithClock.cs @@ -29,25 +29,12 @@ namespace CalamityMod.Tiles.FurnitureMonolith int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithClockGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } - public override bool RightClick(int x, int y) { return CalamityUtils.ClockRightClick(); diff --git a/Tiles/FurnitureMonolith/MonolithDoorClosed.cs b/Tiles/FurnitureMonolith/MonolithDoorClosed.cs index 2303eff699..9190b4cc09 100644 --- a/Tiles/FurnitureMonolith/MonolithDoorClosed.cs +++ b/Tiles/FurnitureMonolith/MonolithDoorClosed.cs @@ -32,25 +32,12 @@ namespace CalamityMod.Tiles.FurnitureMonolith int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithDoorClosedGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } - public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; public override void MouseOver(int i, int j) diff --git a/Tiles/FurnitureMonolith/MonolithDoorOpen.cs b/Tiles/FurnitureMonolith/MonolithDoorOpen.cs index d2c66a4142..a229126bb3 100644 --- a/Tiles/FurnitureMonolith/MonolithDoorOpen.cs +++ b/Tiles/FurnitureMonolith/MonolithDoorOpen.cs @@ -33,25 +33,12 @@ namespace CalamityMod.Tiles.FurnitureMonolith int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithDoorOpenGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } - public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; public override void MouseOver(int i, int j) diff --git a/Tiles/FurnitureMonolith/MonolithDresser.cs b/Tiles/FurnitureMonolith/MonolithDresser.cs index 605738a453..7449085189 100644 --- a/Tiles/FurnitureMonolith/MonolithDresser.cs +++ b/Tiles/FurnitureMonolith/MonolithDresser.cs @@ -35,23 +35,10 @@ namespace CalamityMod.Tiles.FurnitureMonolith int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithDresserGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } } } diff --git a/Tiles/FurnitureMonolith/MonolithLamp.cs b/Tiles/FurnitureMonolith/MonolithLamp.cs index 7f89e56e52..c169899dab 100644 --- a/Tiles/FurnitureMonolith/MonolithLamp.cs +++ b/Tiles/FurnitureMonolith/MonolithLamp.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithLampGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); @@ -35,19 +35,6 @@ namespace CalamityMod.Tiles.FurnitureMonolith Main.spriteBatch.Draw(glowmaskBright, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { if (Main.tile[i, j].TileFrameX < 18) diff --git a/Tiles/FurnitureMonolith/MonolithLantern.cs b/Tiles/FurnitureMonolith/MonolithLantern.cs index 4b4e8d8d3f..e03c7077b2 100644 --- a/Tiles/FurnitureMonolith/MonolithLantern.cs +++ b/Tiles/FurnitureMonolith/MonolithLantern.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithLanternGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); @@ -36,19 +36,6 @@ namespace CalamityMod.Tiles.FurnitureMonolith Main.spriteBatch.Draw(glowmaskBright, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { if (Main.tile[i, j].TileFrameX < 18) diff --git a/Tiles/FurnitureMonolith/MonolithPiano.cs b/Tiles/FurnitureMonolith/MonolithPiano.cs index d32029c9ba..14385c7fb0 100644 --- a/Tiles/FurnitureMonolith/MonolithPiano.cs +++ b/Tiles/FurnitureMonolith/MonolithPiano.cs @@ -28,23 +28,10 @@ namespace CalamityMod.Tiles.FurnitureMonolith int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithPianoGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } } } diff --git a/Tiles/FurnitureMonolith/MonolithSink.cs b/Tiles/FurnitureMonolith/MonolithSink.cs index bd5897d062..3009c01574 100644 --- a/Tiles/FurnitureMonolith/MonolithSink.cs +++ b/Tiles/FurnitureMonolith/MonolithSink.cs @@ -26,23 +26,10 @@ namespace CalamityMod.Tiles.FurnitureMonolith int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithSinkGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } } } diff --git a/Tiles/FurnitureMonolith/MonolithTable.cs b/Tiles/FurnitureMonolith/MonolithTable.cs index 484b6f4ec1..6a3a0d4c69 100644 --- a/Tiles/FurnitureMonolith/MonolithTable.cs +++ b/Tiles/FurnitureMonolith/MonolithTable.cs @@ -26,23 +26,10 @@ namespace CalamityMod.Tiles.FurnitureMonolith int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithTableGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } } } diff --git a/Tiles/FurnitureMonolith/MonolithWorkbench.cs b/Tiles/FurnitureMonolith/MonolithWorkbench.cs index 2734e9dbbf..cd69fd30d2 100644 --- a/Tiles/FurnitureMonolith/MonolithWorkbench.cs +++ b/Tiles/FurnitureMonolith/MonolithWorkbench.cs @@ -26,23 +26,10 @@ namespace CalamityMod.Tiles.FurnitureMonolith int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithWorkBenchGlow").Value; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 100)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } - - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } } } diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs b/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs index 7c3049f1ed..016733d5de 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly { Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Lighting.GetColor(i, j), false); Texture2D cloth = ModContent.Request("CalamityMod/Tiles/FurnitureOtherworldly/OtherworldlyStone_Cloth").Value; DrawExtraTop(i, j, cloth, drawOffset, drawColour); @@ -183,27 +183,6 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly return Main.tile[i + x, j - y].TileType == type == equal; } - private Color GetDrawColour(int i, int j) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType < 13) - { - paintCol.R = (byte)((paintCol.R / 2f) + 128); - paintCol.G = (byte)((paintCol.G / 2f) + 128); - paintCol.B = (byte)((paintCol.B / 2f) + 128); - } - if (colType == 29) - { - paintCol = Color.Black; - } - Color col = Lighting.GetColor(i, j); - col.R = (byte)(paintCol.R / 255f * col.R); - col.G = (byte)(paintCol.G / 255f * col.G); - col.B = (byte)(paintCol.B / 255f * col.B); - return col; - } - private int GetExtraState(string type) { switch (type) diff --git a/Tiles/GlowMaskTile.cs b/Tiles/GlowMaskTile.cs index 80036efbf8..8cbef860ca 100644 --- a/Tiles/GlowMaskTile.cs +++ b/Tiles/GlowMaskTile.cs @@ -64,20 +64,5 @@ namespace CalamityMod.Tiles public virtual void OnUnload() { } public abstract Color GetGlowMaskColor(int i, int j, TileDrawInfo drawData); - - public static Color ApplyPaint(int paintType, Color color, bool deepPaintOnly = true) - { - if (deepPaintOnly && !IsDeepPaint(paintType)) - return color; - - Color paintCol = WorldGen.paintColor(paintType); - color = color.MultiplyRGB(paintCol); - return color; - } - - private static bool IsDeepPaint(int paintType) - { - return PaintID.DeepRedPaint <= paintType && paintType <= PaintID.DeepPinkPaint; - } } } diff --git a/Tiles/Ores/AerialiteOre.cs b/Tiles/Ores/AerialiteOre.cs index c22543b639..eb926362b8 100644 --- a/Tiles/Ores/AerialiteOre.cs +++ b/Tiles/Ores/AerialiteOre.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Tiles.Ores xPos += xOffset; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j, new Color(100, 100, 100, 50)); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 50)); if (!tile.IsHalfBlock && tile.Slope == 0) { Main.spriteBatch.Draw(GlowTexture, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); @@ -92,17 +92,5 @@ namespace CalamityMod.Tiles.Ores Main.spriteBatch.Draw(GlowTexture, drawOffset + new Vector2(0f, 8f), new Rectangle?(new Rectangle(xPos, yPos, 18, 8)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 13 && colType <= 24) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; - } } } diff --git a/Tiles/SunkenSea/EutrophicGlass.cs b/Tiles/SunkenSea/EutrophicGlass.cs index b7831db43e..a11f188fe4 100644 --- a/Tiles/SunkenSea/EutrophicGlass.cs +++ b/Tiles/SunkenSea/EutrophicGlass.cs @@ -58,20 +58,7 @@ namespace CalamityMod.Tiles.SunkenSea Rectangle frame = new Rectangle(tile.TileFrameX + frameXOffset, tile.TileFrameY + frameYOffset, 16, 16); Color color = Lighting.GetColor(i, j) * transparency; - TileFramingSystem.SlopedGlowmask(in tile, i, j, tex, frame, GetDrawColour(i, j, color), default); - } - - private Color GetDrawColour(int i, int j, Color colour) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType >= 0 && colType <= 30) - { - colour.R = (byte)(paintCol.R / 255f * colour.R); - colour.G = (byte)(paintCol.G / 255f * colour.G); - colour.B = (byte)(paintCol.B / 255f * colour.B); - } - return colour; + TileFramingSystem.SlopedGlowmask(in tile, i, j, tex, frame, CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, color, false), default); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/UelibloomBrick.cs b/Tiles/UelibloomBrick.cs index ebfa300dfd..92ba0fcfb6 100644 --- a/Tiles/UelibloomBrick.cs +++ b/Tiles/UelibloomBrick.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Tiles { Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Color drawColour = GetDrawColour(i, j); + Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Lighting.GetColor(i, j), false); Texture2D leaves = ModContent.Request("CalamityMod/Tiles/UelibloomBrick_Leaves").Value; DrawExtraTop(i, j, leaves, drawOffset, drawColour); @@ -194,27 +194,6 @@ namespace CalamityMod.Tiles return Main.tile[i + x, j - y].TileType == type == equal; } - private Color GetDrawColour(int i, int j) - { - int colType = Main.tile[i, j].TileColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType < 13) - { - paintCol.R = (byte)((paintCol.R / 2f) + 128); - paintCol.G = (byte)((paintCol.G / 2f) + 128); - paintCol.B = (byte)((paintCol.B / 2f) + 128); - } - if (colType == 29) - { - paintCol = Color.Black; - } - Color col = Lighting.GetColor(i, j); - col.R = (byte)(paintCol.R / 255f * col.R); - col.G = (byte)(paintCol.G / 255f * col.G); - col.B = (byte)(paintCol.B / 255f * col.B); - return col; - } - private int GetExtraState(string type) { switch (type) diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index 9f9685e2df..09a581aac2 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -226,6 +226,44 @@ namespace CalamityMod return uniqueAnimationFrame * animationFrameLength; } + /// + /// Gets the color of a tile/wall after paint is applied + /// + /// The ID of the paint, this can be received from the tile's TileColor or WallColor + /// The base color to apply the paint to + /// Whether or not only deep paints should be included. Typically this should be set to false if this isn't being used for a glowmask + /// The original color with paint applied + public static Color ApplyPaint(int paintType, Color color, bool deepPaintOnly = true) + { + if (paintType == PaintID.None) + return color; + + bool isDeep = IsDeepPaint(paintType); + if (deepPaintOnly && !isDeep) + return color; + + Color paintCol = WorldGen.paintColor(paintType); + + if (paintType < PaintID.DeepRedPaint) + { + paintCol.R = (byte)((paintCol.R / 2f) + 128); + paintCol.G = (byte)((paintCol.G / 2f) + 128); + paintCol.B = (byte)((paintCol.B / 2f) + 128); + } + if (paintType == PaintID.ShadowPaint) + { + paintCol = Color.Black; + } + color = color.MultiplyRGB(paintCol); + + return color; + } + + private static bool IsDeepPaint(int paintType) + { + return PaintID.DeepRedPaint >= paintType && paintType <= PaintID.DeepPinkPaint; + } + public static Tile ParanoidTileRetrieval(int x, int y) { if (!WorldGen.InWorld(x, y)) diff --git a/Walls/AshenSlabWall.cs b/Walls/AshenSlabWall.cs index 78e0d401f6..a2d65f6c17 100644 --- a/Walls/AshenSlabWall.cs +++ b/Walls/AshenSlabWall.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = TextureAssets.Wall[Type].Value; - Color lightColor = GetWallColour(i, j); + Color lightColor = CalamityUtils.ApplyPaint(Main.tile[i, j].WallColor, Lighting.GetColor(i, j), false); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -54,26 +54,5 @@ namespace CalamityMod.Walls sheetOffset[1] = sheetOffset[1] * 180; return sheetOffset; } - - private Color GetWallColour(int i, int j) - { - int colType = Main.tile[i, j].WallColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType < 13) - { - paintCol.R = (byte)((paintCol.R / 2f) + 128); - paintCol.G = (byte)((paintCol.G / 2f) + 128); - paintCol.B = (byte)((paintCol.B / 2f) + 128); - } - if (colType == 29) - { - paintCol = Color.Black; - } - Color col = Lighting.GetColor(i, j); - col.R = (byte)(paintCol.R / 255f * col.R); - col.G = (byte)(paintCol.G / 255f * col.G); - col.B = (byte)(paintCol.B / 255f * col.B); - return col; - } } } diff --git a/Walls/AstralMonolithWall.cs b/Walls/AstralMonolithWall.cs index 0495a7115f..ab826e6ae2 100644 --- a/Walls/AstralMonolithWall.cs +++ b/Walls/AstralMonolithWall.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = TextureAssets.Wall[Type].Value; - Color lightColor = GetWallColour(i, j); + Color lightColor = CalamityUtils.ApplyPaint(Main.tile[i, j].WallColor, Lighting.GetColor(i, j), false); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -53,26 +53,5 @@ namespace CalamityMod.Walls sheetOffset[1] = sheetOffset[1] * 180; return sheetOffset; } - - private Color GetWallColour(int i, int j) - { - int colType = Main.tile[i, j].WallColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType < 13) - { - paintCol.R = (byte)((paintCol.R / 2f) + 128); - paintCol.G = (byte)((paintCol.G / 2f) + 128); - paintCol.B = (byte)((paintCol.B / 2f) + 128); - } - if (colType == 29) - { - paintCol = Color.Black; - } - Color col = Lighting.GetColor(i, j); - col.R = (byte)(paintCol.R / 255f * col.R); - col.G = (byte)(paintCol.G / 255f * col.G); - col.B = (byte)(paintCol.B / 255f * col.B); - return col; - } } } diff --git a/Walls/BrimstoneSlabWall.cs b/Walls/BrimstoneSlabWall.cs index 7629b8ec01..8aec81812a 100644 --- a/Walls/BrimstoneSlabWall.cs +++ b/Walls/BrimstoneSlabWall.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = TextureAssets.Wall[Type].Value; - Color lightColor = GetWallColour(i, j); + Color lightColor = CalamityUtils.ApplyPaint(Main.tile[i, j].WallColor, Lighting.GetColor(i, j), false); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -59,26 +59,5 @@ namespace CalamityMod.Walls sheetOffset[1] = sheetOffset[1] * 180; return sheetOffset; } - - private Color GetWallColour(int i, int j) - { - int colType = Main.tile[i, j].WallColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType < 13) - { - paintCol.R = (byte)((paintCol.R / 2f) + 128); - paintCol.G = (byte)((paintCol.G / 2f) + 128); - paintCol.B = (byte)((paintCol.B / 2f) + 128); - } - if (colType == 29) - { - paintCol = Color.Black; - } - Color col = Lighting.GetColor(i, j); - col.R = (byte)(paintCol.R / 255f * col.R); - col.G = (byte)(paintCol.G / 255f * col.G); - col.B = (byte)(paintCol.B / 255f * col.B); - return col; - } } } diff --git a/Walls/BrimstoneSlagWall.cs b/Walls/BrimstoneSlagWall.cs index 2e2ea5fcbb..002fb585bb 100644 --- a/Walls/BrimstoneSlagWall.cs +++ b/Walls/BrimstoneSlagWall.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = TextureAssets.Wall[Type].Value; - Color lightColor = GetWallColour(i, j); + Color lightColor = CalamityUtils.ApplyPaint(Main.tile[i, j].WallColor, Lighting.GetColor(i, j), false); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -54,26 +54,5 @@ namespace CalamityMod.Walls sheetOffset[1] = sheetOffset[1] * 180; return sheetOffset; } - - private Color GetWallColour(int i, int j) - { - int colType = Main.tile[i, j].WallColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType < 13) - { - paintCol.R = (byte)((paintCol.R / 2f) + 128); - paintCol.G = (byte)((paintCol.G / 2f) + 128); - paintCol.B = (byte)((paintCol.B / 2f) + 128); - } - if (colType == 29) - { - paintCol = Color.Black; - } - Color col = Lighting.GetColor(i, j); - col.R = (byte)(paintCol.R / 255f * col.R); - col.G = (byte)(paintCol.G / 255f * col.G); - col.B = (byte)(paintCol.B / 255f * col.B); - return col; - } } } diff --git a/Walls/BrimstoneSlagWallUnsafe.cs b/Walls/BrimstoneSlagWallUnsafe.cs index ddfdf24e49..5663da37f0 100644 --- a/Walls/BrimstoneSlagWallUnsafe.cs +++ b/Walls/BrimstoneSlagWallUnsafe.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = TextureAssets.Wall[Type].Value; - Color lightColor = GetWallColour(i, j); + Color lightColor = CalamityUtils.ApplyPaint(Main.tile[i, j].WallColor, Lighting.GetColor(i, j), false); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -54,26 +54,5 @@ namespace CalamityMod.Walls sheetOffset[1] = sheetOffset[1] * 180; return sheetOffset; } - - private Color GetWallColour(int i, int j) - { - int colType = Main.tile[i, j].WallColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType < 13) - { - paintCol.R = (byte)((paintCol.R / 2f) + 128); - paintCol.G = (byte)((paintCol.G / 2f) + 128); - paintCol.B = (byte)((paintCol.B / 2f) + 128); - } - if (colType == 29) - { - paintCol = Color.Black; - } - Color col = Lighting.GetColor(i, j); - col.R = (byte)(paintCol.R / 255f * col.R); - col.G = (byte)(paintCol.G / 255f * col.G); - col.B = (byte)(paintCol.B / 255f * col.B); - return col; - } } } diff --git a/Walls/CryonicBrickWall.cs b/Walls/CryonicBrickWall.cs index bbe3ba48cd..3d2baab04c 100644 --- a/Walls/CryonicBrickWall.cs +++ b/Walls/CryonicBrickWall.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = TextureAssets.Wall[Type].Value; - Color lightColor = GetWallColour(i, j); + Color lightColor = CalamityUtils.ApplyPaint(Main.tile[i, j].WallColor, Lighting.GetColor(i, j), false); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -93,26 +93,5 @@ namespace CalamityMod.Walls sheetOffset[1] = sheetOffset[1] * 180; return sheetOffset; } - - private Color GetWallColour(int i, int j) - { - int colType = Main.tile[i, j].WallColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType < 13) - { - paintCol.R = (byte)((paintCol.R / 2f) + 128); - paintCol.G = (byte)((paintCol.G / 2f) + 128); - paintCol.B = (byte)((paintCol.B / 2f) + 128); - } - if (colType == 29) - { - paintCol = Color.Black; - } - Color col = Lighting.GetColor(i, j); - col.R = (byte)(paintCol.R / 255f * col.R); - col.G = (byte)(paintCol.G / 255f * col.G); - col.B = (byte)(paintCol.B / 255f * col.B); - return col; - } } } diff --git a/Walls/ExoPrismPanelWall.cs b/Walls/ExoPrismPanelWall.cs index fe15711a5e..ff117d1ffd 100644 --- a/Walls/ExoPrismPanelWall.cs +++ b/Walls/ExoPrismPanelWall.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = TextureAssets.Wall[Type].Value; - Color lightColor = GetWallColour(i, j); + Color lightColor = CalamityUtils.ApplyPaint(Main.tile[i, j].WallColor, Lighting.GetColor(i, j), false); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -53,26 +53,5 @@ namespace CalamityMod.Walls sheetOffset[1] = sheetOffset[1] * 180; return sheetOffset; } - - private Color GetWallColour(int i, int j) - { - int colType = Main.tile[i, j].WallColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType < 13) - { - paintCol.R = (byte)((paintCol.R / 2f) + 128); - paintCol.G = (byte)((paintCol.G / 2f) + 128); - paintCol.B = (byte)((paintCol.B / 2f) + 128); - } - if (colType == 29) - { - paintCol = Color.Black; - } - Color col = Lighting.GetColor(i, j); - col.R = (byte)(paintCol.R / 255f * col.R); - col.G = (byte)(paintCol.G / 255f * col.G); - col.B = (byte)(paintCol.B / 255f * col.B); - return col; - } } } diff --git a/Walls/FloralWall.cs b/Walls/FloralWall.cs index 6725d57067..0773f69e1d 100644 --- a/Walls/FloralWall.cs +++ b/Walls/FloralWall.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = TextureAssets.Wall[Type].Value; - Color lightColor = GetWallColour(i, j); + Color lightColor = CalamityUtils.ApplyPaint(Main.tile[i, j].WallColor, Lighting.GetColor(i, j), false); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -88,26 +88,5 @@ namespace CalamityMod.Walls sheetOffset[1] = sheetOffset[1] * 180; return sheetOffset; } - - private Color GetWallColour(int i, int j) - { - int colType = Main.tile[i, j].WallColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType < 13) - { - paintCol.R = (byte)((paintCol.R / 2f) + 128); - paintCol.G = (byte)((paintCol.G / 2f) + 128); - paintCol.B = (byte)((paintCol.B / 2f) + 128); - } - if (colType == 29) - { - paintCol = Color.Black; - } - Color col = Lighting.GetColor(i, j); - col.R = (byte)(paintCol.R / 255f * col.R); - col.G = (byte)(paintCol.G / 255f * col.G); - col.B = (byte)(paintCol.B / 255f * col.B); - return col; - } } } diff --git a/Walls/PerennialBrickWall.cs b/Walls/PerennialBrickWall.cs index 2b160fc779..292f5b34d7 100644 --- a/Walls/PerennialBrickWall.cs +++ b/Walls/PerennialBrickWall.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = TextureAssets.Wall[Type].Value; - Color lightColor = GetWallColour(i, j); + Color lightColor = CalamityUtils.ApplyPaint(Main.tile[i, j].WallColor, Lighting.GetColor(i, j), false); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -55,26 +55,5 @@ namespace CalamityMod.Walls sheetOffset[1] = sheetOffset[1] * 180; return sheetOffset; } - - private Color GetWallColour(int i, int j) - { - int colType = Main.tile[i, j].WallColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType < 13) - { - paintCol.R = (byte)((paintCol.R / 2f) + 128); - paintCol.G = (byte)((paintCol.G / 2f) + 128); - paintCol.B = (byte)((paintCol.B / 2f) + 128); - } - if (colType == 29) - { - paintCol = Color.Black; - } - Color col = Lighting.GetColor(i, j); - col.R = (byte)(paintCol.R / 255f * col.R); - col.G = (byte)(paintCol.G / 255f * col.G); - col.B = (byte)(paintCol.B / 255f * col.B); - return col; - } } } diff --git a/Walls/ProfanedSlabWall.cs b/Walls/ProfanedSlabWall.cs index 1f76c71d55..4cc1a0982f 100644 --- a/Walls/ProfanedSlabWall.cs +++ b/Walls/ProfanedSlabWall.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = TextureAssets.Wall[Type].Value; - Color lightColor = GetWallColour(i, j); + Color lightColor = CalamityUtils.ApplyPaint(Main.tile[i, j].WallColor, Lighting.GetColor(i, j), false); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -54,26 +54,5 @@ namespace CalamityMod.Walls sheetOffset[1] = sheetOffset[1] * 180; return sheetOffset; } - - private Color GetWallColour(int i, int j) - { - int colType = Main.tile[i, j].WallColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType < 13) - { - paintCol.R = (byte)((paintCol.R / 2f) + 128); - paintCol.G = (byte)((paintCol.G / 2f) + 128); - paintCol.B = (byte)((paintCol.B / 2f) + 128); - } - if (colType == 29) - { - paintCol = Color.Black; - } - Color col = Lighting.GetColor(i, j); - col.R = (byte)(paintCol.R / 255f * col.R); - col.G = (byte)(paintCol.G / 255f * col.G); - col.B = (byte)(paintCol.B / 255f * col.B); - return col; - } } } diff --git a/Walls/RunicProfanedBrickWall.cs b/Walls/RunicProfanedBrickWall.cs index 50f974a98d..d69f38209a 100644 --- a/Walls/RunicProfanedBrickWall.cs +++ b/Walls/RunicProfanedBrickWall.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = TextureAssets.Wall[Type].Value; - Color lightColor = GetWallColour(i, j); + Color lightColor = CalamityUtils.ApplyPaint(Main.tile[i, j].WallColor, Lighting.GetColor(i, j), false); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -56,26 +56,5 @@ namespace CalamityMod.Walls sheetOffset[1] = sheetOffset[1] * 180; return sheetOffset; } - - private Color GetWallColour(int i, int j) - { - int colType = Main.tile[i, j].WallColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType < 13) - { - paintCol.R = (byte)((paintCol.R / 2f) + 128); - paintCol.G = (byte)((paintCol.G / 2f) + 128); - paintCol.B = (byte)((paintCol.B / 2f) + 128); - } - if (colType == 29) - { - paintCol = Color.Black; - } - Color col = Lighting.GetColor(i, j); - col.R = (byte)(paintCol.R / 255f * col.R); - col.G = (byte)(paintCol.G / 255f * col.G); - col.B = (byte)(paintCol.B / 255f * col.B); - return col; - } } } diff --git a/Walls/ScorchedBoneWall.cs b/Walls/ScorchedBoneWall.cs index 53abfc1b31..a8f7afb80d 100644 --- a/Walls/ScorchedBoneWall.cs +++ b/Walls/ScorchedBoneWall.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = TextureAssets.Wall[Type].Value; - Color lightColor = GetWallColour(i, j); + Color lightColor = CalamityUtils.ApplyPaint(Main.tile[i, j].WallColor, Lighting.GetColor(i, j), false); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -48,26 +48,5 @@ namespace CalamityMod.Walls sheetOffset[1] = sheetOffset[1] * 180; return sheetOffset; } - - private Color GetWallColour(int i, int j) - { - int colType = Main.tile[i, j].WallColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType < 13) - { - paintCol.R = (byte)((paintCol.R / 2f) + 128); - paintCol.G = (byte)((paintCol.G / 2f) + 128); - paintCol.B = (byte)((paintCol.B / 2f) + 128); - } - if (colType == 29) - { - paintCol = Color.Black; - } - Color col = Lighting.GetColor(i, j); - col.R = (byte)(paintCol.R / 255f * col.R); - col.G = (byte)(paintCol.G / 255f * col.G); - col.B = (byte)(paintCol.B / 255f * col.B); - return col; - } } } diff --git a/Walls/VoidstoneSlabWall.cs b/Walls/VoidstoneSlabWall.cs index ceaf8fcd05..2a7e70cb03 100644 --- a/Walls/VoidstoneSlabWall.cs +++ b/Walls/VoidstoneSlabWall.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = TextureAssets.Wall[Type].Value; - Color lightColor = GetWallColour(i, j); + Color lightColor = CalamityUtils.ApplyPaint(Main.tile[i, j].WallColor, Lighting.GetColor(i, j), false); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -101,26 +101,5 @@ namespace CalamityMod.Walls sheetOffset[1] = sheetOffset[1] * 180; return sheetOffset; } - - private Color GetWallColour(int i, int j) - { - int colType = Main.tile[i, j].WallColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType < 13) - { - paintCol.R = (byte)((paintCol.R / 2f) + 128); - paintCol.G = (byte)((paintCol.G / 2f) + 128); - paintCol.B = (byte)((paintCol.B / 2f) + 128); - } - if (colType == 29) - { - paintCol = Color.Black; - } - Color col = Lighting.GetColor(i, j); - col.R = (byte)(paintCol.R / 255f * col.R); - col.G = (byte)(paintCol.G / 255f * col.G); - col.B = (byte)(paintCol.B / 255f * col.B); - return col; - } } } diff --git a/Walls/WulfrumPlatingWall.cs b/Walls/WulfrumPlatingWall.cs index 39fcfcc9cd..131ba934ea 100644 --- a/Walls/WulfrumPlatingWall.cs +++ b/Walls/WulfrumPlatingWall.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Walls public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Texture2D sprite = TextureAssets.Wall[Type].Value; - Color lightColor = GetWallColour(i, j); + Color lightColor = CalamityUtils.ApplyPaint(Main.tile[i, j].WallColor, Lighting.GetColor(i, j), false); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); zero -= new Vector2(8, 8); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; @@ -53,26 +53,5 @@ namespace CalamityMod.Walls sheetOffset[1] = sheetOffset[1] * 180; return sheetOffset; } - - private Color GetWallColour(int i, int j) - { - int colType = Main.tile[i, j].WallColor; - Color paintCol = WorldGen.paintColor(colType); - if (colType < 13) - { - paintCol.R = (byte)((paintCol.R / 2f) + 128); - paintCol.G = (byte)((paintCol.G / 2f) + 128); - paintCol.B = (byte)((paintCol.B / 2f) + 128); - } - if (colType == 29) - { - paintCol = Color.Black; - } - Color col = Lighting.GetColor(i, j); - col.R = (byte)(paintCol.R / 255f * col.R); - col.G = (byte)(paintCol.G / 255f * col.G); - col.B = (byte)(paintCol.B / 255f * col.B); - return col; - } } }