Merge branch '1.4.4' into HadopelagicPressure

This commit is contained in:
mochi-angel committed 2024-10-23 15:58:09 -07:00
commit f5bb20cb48
48 files changed
+180 -485

No files matched your search

-1
View File
@@ -40,7 +40,6 @@ namespace CalamityMod.Items.Accessories
AddIngredient(ItemID.FireGauntlet).
AddIngredient(ItemID.LunarBar, 8).
AddIngredient<AscendantSpiritEssence>(4).
AddIngredient<GalacticaSingularity>(4).
AddTile<CosmicAnvil>().
Register();
}
-1
View File
@@ -42,7 +42,6 @@ namespace CalamityMod.Items.Accessories
AddRecipeGroup("AnyManaFlower"). //Any mana flower accessory
AddIngredient(ItemID.LunarBar, 8).
AddIngredient<AscendantSpiritEssence>(4).
AddIngredient<GalacticaSingularity>(4).
AddTile<CosmicAnvil>().
Register();
}
-1
View File
@@ -41,7 +41,6 @@ namespace CalamityMod.Items.Accessories
AddIngredient<ElectriciansGlove>().
AddIngredient(ItemID.LunarBar, 8).
AddIngredient<AscendantSpiritEssence>(4).
AddIngredient<GalacticaSingularity>(4).
AddTile<CosmicAnvil>().
Register();
}
-1
View File
@@ -50,7 +50,6 @@ namespace CalamityMod.Items.Accessories
AddIngredient<StatisCurse>().
AddIngredient(ItemID.LunarBar, 8).
AddIngredient<AscendantSpiritEssence>(4).
AddIngredient<GalacticaSingularity>(4).
AddTile<CosmicAnvil>().
Register();
}
-1
View File
@@ -38,7 +38,6 @@ namespace CalamityMod.Items.Accessories
AddIngredient<DeadshotBrooch>().
AddIngredient(ItemID.LunarBar, 8).
AddIngredient<AscendantSpiritEssence>(4).
AddIngredient<GalacticaSingularity>(4).
AddTile<CosmicAnvil>().
Register();
}
-1
View File
@@ -33,7 +33,6 @@ namespace CalamityMod.Items.Potions
CreateRecipe(4).
AddIngredient(ItemID.BottledWater, 4).
AddIngredient<DarkPlasma>().
AddIngredient<GalacticaSingularity>().
AddTile(TileID.AlchemyTable).
AddConsumeItemCallback(Recipe.ConsumptionRules.Alchemy).
Register();
+1 -1
View File
@@ -55,7 +55,7 @@ namespace CalamityMod.Items.Weapons.Magic
AddIngredient<EldritchTome>().
AddIngredient(ItemID.LunarBar, 5).
AddIngredient<LifeAlloy>(5).
AddIngredient<GalacticaSingularity>(5).
AddIngredient(ItemID.FragmentNebula, 5).
AddTile(TileID.Bookcases).
Register();
}
+1 -1
View File
@@ -85,7 +85,7 @@ namespace CalamityMod.Items.Weapons.Magic
AddIngredient<Photosynthesis>().
AddIngredient(ItemID.LunarBar, 5).
AddIngredient<LifeAlloy>(5).
AddIngredient<GalacticaSingularity>(5).
AddIngredient(ItemID.FragmentNebula, 5).
AddTile(TileID.LunarCraftingStation).
Register();
}
+1 -1
View File
@@ -234,7 +234,7 @@ namespace CalamityMod.Items.Weapons.Melee
AddIngredient<TrueArkoftheAncients>().
AddIngredient(ItemID.LunarBar, 5).
AddIngredient<LifeAlloy>(5).
AddIngredient<GalacticaSingularity>(5).
AddIngredient(ItemID.FragmentSolar, 5).
AddTile(TileID.LunarCraftingStation).
Register();
}
+10 -2
View File
@@ -1,4 +1,5 @@
using CalamityMod.Items.Materials;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables;
using CalamityMod.Projectiles.Melee;
using Microsoft.Xna.Framework;
@@ -27,7 +28,14 @@ namespace CalamityMod.Items.Weapons.Melee
Item.UseSound = SoundID.Item1;
Item.shoot = ModContent.ProjectileType<SeashineSwordProj>();
}
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 120);
}
public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo)
{
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 120);
}
public override void AddRecipes()
{
CreateRecipe().
+1 -1
View File
@@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee
AddIngredient(ItemID.PiercingStarlight).
AddIngredient(ItemID.LunarBar, 5).
AddIngredient<LifeAlloy>(5).
AddIngredient<GalacticaSingularity>(5).
AddIngredient(ItemID.FragmentSolar, 5).
AddTile(TileID.LunarCraftingStation).
Register();
}
+1 -1
View File
@@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee
AddIngredient<BotanicPiercer>().
AddIngredient(ItemID.LunarBar, 5).
AddIngredient<LifeAlloy>(5).
AddIngredient<GalacticaSingularity>(5).
AddIngredient(ItemID.FragmentSolar, 5).
AddTile(TileID.LunarCraftingStation).
Register();
}
+1 -1
View File
@@ -63,7 +63,7 @@ namespace CalamityMod.Items.Weapons.Ranged
AddIngredient<WildfireBloom>().
AddIngredient(ItemID.LunarBar, 5).
AddIngredient<LifeAlloy>(5).
AddIngredient<GalacticaSingularity>(5).
AddIngredient(ItemID.FragmentVortex, 5).
AddTile(TileID.LunarCraftingStation).
Register();
}
@@ -105,7 +105,7 @@ namespace CalamityMod.Items.Weapons.Ranged
AddIngredient(ItemID.DaedalusStormbow).
AddIngredient(ItemID.LunarBar, 5).
AddIngredient<LifeAlloy>(5).
AddIngredient<GalacticaSingularity>(5).
AddIngredient(ItemID.FragmentVortex, 5).
AddTile(TileID.LunarCraftingStation).
Register();
}
+3 -5
View File
@@ -12,8 +12,6 @@ namespace CalamityMod.Items.Weapons.Ranged
public class ReedBlowgun : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public static readonly SoundStyle BubbleBurstSound = new("CalamityMod/Sounds/Custom/PistolShrimpBubbleBurst") { PitchVariance = 0.15f, Volume = 0.2f };
public override void SetStaticDefaults()
{
ItemID.Sets.IsRangedSpecialistWeapon[Type] = true;
@@ -23,10 +21,10 @@ namespace CalamityMod.Items.Weapons.Ranged
{
Item.width = 22;
Item.height = 46;
Item.damage = 21;
Item.damage = 25;
Item.DamageType = DamageClass.Ranged;
Item.useTime = 25;
Item.useAnimation = 25;
Item.useTime = 32;
Item.useAnimation = 32;
Item.useStyle = ItemUseStyleID.Shoot;
Item.holdStyle = 16;
Item.noMelee = true;
+1 -1
View File
@@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Ranged
Item.rare = ModContent.RarityType<Turquoise>();
Item.UseSound = SoundID.Item11;
Item.autoReuse = true;
Item.shoot = ModContent.ProjectileType<ArcherfishShot>();
Item.shoot = ModContent.ProjectileType<MegalodonShot>();
Item.shootSpeed = 16f;
Item.useAmmo = AmmoID.Bullet;
Item.Calamity().canFirePointBlankShots = true;
@@ -122,7 +122,7 @@ namespace CalamityMod.Items.Weapons.Ranged
AddIngredient<SpeedBlaster>().
AddIngredient(ItemID.LunarBar, 5).
AddIngredient<LifeAlloy>(5).
AddIngredient<GalacticaSingularity>(5).
AddIngredient(ItemID.FragmentVortex, 5).
AddTile(TileID.LunarCraftingStation).
Register();
}
+1 -1
View File
@@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Rogue
AddIngredient<SamsaraSlicer>().
AddIngredient(ItemID.LunarBar, 5).
AddIngredient<LifeAlloy>(5).
AddIngredient<GalacticaSingularity>(5).
AddIngredient<MeldConstruct>(5).
AddTile(TileID.LunarCraftingStation).
Register();
}
+1 -1
View File
@@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Summon
AddIngredient<WitherBlossomsStaff>().
AddIngredient(ItemID.LunarBar, 5).
AddIngredient<LifeAlloy>(5).
AddIngredient<GalacticaSingularity>(5).
AddIngredient(ItemID.FragmentStardust, 5).
AddTile(TileID.LunarCraftingStation).
Register();
}
+1 -1
View File
@@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Summon
AddIngredient<PlantationStaff>().
AddIngredient(ItemID.LunarBar, 5).
AddIngredient<LifeAlloy>(5).
AddIngredient<GalacticaSingularity>(5).
AddIngredient(ItemID.FragmentStardust, 5).
AddTile(TileID.LunarCraftingStation).
Register();
}
+4 -2
View File
@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework;
using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -39,7 +40,8 @@ namespace CalamityMod.Projectiles.Magic
}
Projectile.rotation += 0.3f * (float)Projectile.direction;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 120);
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 120);
public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200);
public override bool PreDraw(ref Color lightColor)
+3 -1
View File
@@ -1,4 +1,5 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
@@ -139,7 +140,8 @@ namespace CalamityMod.Projectiles.Melee
{
return new Color(30, 255, 253);
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 120);
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 120);
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item10, Projectile.position);
+3 -1
View File
@@ -1,4 +1,5 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -54,7 +55,8 @@ namespace CalamityMod.Projectiles.Melee
return false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 120);
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 120);
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.NPCDeath19, Projectile.position);
+3 -2
View File
@@ -1,4 +1,5 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
@@ -92,9 +93,9 @@ namespace CalamityMod.Projectiles.Melee
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2);
return false;
}
public override Color? GetAlpha(Color lightColor) => new Color(128, byte.MaxValue, byte.MaxValue);
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 60);
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 60);
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item10, Projectile.Center);
+12 -2
View File
@@ -1,4 +1,5 @@
using CalamityMod.Dusts;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
@@ -59,6 +60,15 @@ namespace CalamityMod.Projectiles.Ranged
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Wet, 240);
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(BuffID.Wet, 120);
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 120);
}
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
target.AddBuff(BuffID.Wet, 120);
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 120);
}
}
}
+1 -1
View File
@@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Ranged
bubble.type = Main.rand.NextBool(3) ? 412 : 411;
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<CrushDepth>(), 240);
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<CrushDepth>(), 240);
}
}
@@ -1,4 +1,5 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
@@ -32,9 +33,11 @@ namespace CalamityMod.Projectiles.Ranged
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = 1;
Projectile.penetrate = 3;
Projectile.extraUpdates = 4;
Projectile.timeLeft = FireTime + ChargeupTime;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 10;
}
public override bool ShouldUpdatePosition()
@@ -80,7 +83,7 @@ namespace CalamityMod.Projectiles.Ranged
Vector2 bubblePosition = Owner.MountedCenter - Vector2.UnitY * 4f + bubbleRotation.ToRotationVector2() * 55f;
SoundEngine.PlaySound(ReedBlowgun.BubbleBurstSound, bubblePosition);
SoundEngine.PlaySound(SoundID.Item64, bubblePosition);
}
Projectile.velocity *= 0.985f;
@@ -130,7 +133,8 @@ namespace CalamityMod.Projectiles.Ranged
waterDust.velocity -= Projectile.velocity * 0.1f;
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 120);
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 120);
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item21, Projectile.position);
+4 -2
View File
@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework;
using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -42,7 +43,8 @@ namespace CalamityMod.Projectiles.Rogue
Projectile.damage *= 2;
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 120);
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 120);
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item54, Projectile.position);
@@ -336,6 +336,9 @@ namespace CalamityMod.Systems
if (sideType < 0)
return;
if (!_TileTypeToBlendTextureSlot.IndexInRange(sideType))
return;
var blendTextureSlot = _TileTypeToBlendTextureSlot[sideType];
if (blendTextureSlot == TileBlendTextureLoader.EmptySlot)
return;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

+40
View File
@@ -21,6 +21,7 @@ using CalamityMod.Tiles.SunkenSea;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
@@ -264,6 +265,45 @@ namespace CalamityMod
return PaintID.DeepRedPaint >= paintType && paintType <= PaintID.DeepPinkPaint;
}
/// <summary>
/// Draws placed wall with multiple variants, properly painted.
/// </summary>
/// <param name="spriteBatch">The sprite batch.</param>
/// <param name="type">The type of wall.</param>
/// <param name="i">The x co-ordinate of the wall.</param>
/// <param name="j">The y co-ordinate of the wall.</param>
/// <param name="sheetOffset">The offset within the spritesheet, similar to TileFrame.</param>
/// <returns>Whether or not PreDraw is drawn</returns>
public static bool DrawMultiVariantWall(this SpriteBatch spriteBatch, int type, int i, int j, int[] sheetOffset)
{
if (spriteBatch is null)
return true;
spriteBatch.SafeBegin(SpriteSortMode.Immediate, BatchSetting.AlphaBlend, null, Main.GameViewMatrix.TransformationMatrix, () =>
{
Tile tile = Main.tile[i, j];
Effect tileShader = Main.tileShader;
TreePaintingSettings settings = TreePaintSystemData.GetWallSettings(type);
int paintColor = tile.WallColor;
tileShader.Parameters["leafHueTestOffset"]?.SetValue(settings.HueTestOffset);
tileShader.Parameters["leafMinHue"]?.SetValue(settings.SpecialGroupMinimalHueValue);
tileShader.Parameters["leafMaxHue"]?.SetValue(settings.SpecialGroupMaximumHueValue);
tileShader.Parameters["leafMinSat"]?.SetValue(settings.SpecialGroupMinimumSaturationValue);
tileShader.Parameters["leafMaxSat"]?.SetValue(settings.SpecialGroupMaximumSaturationValue);
tileShader.Parameters["invertSpecialGroupResult"]?.SetValue(settings.InvertSpecialGroupResult);
int index = Main.ConvertPaintIdToTileShaderIndex(paintColor, settings.UseSpecialGroups, settings.UseWallShaderHacks);
tileShader.CurrentTechnique.Passes[index].Apply();
Texture2D sprite = TextureAssets.Wall[type].Value;
Vector2 offset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + (Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange)) - Vector2.One * 8f;
Rectangle frame = new Rectangle(sheetOffset[0] + tile.WallFrameX, sheetOffset[1] + tile.WallFrameY, 32, 32);
Color lightColor = Lighting.GetColor(i, j);
spriteBatch.Draw(sprite, offset, frame, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
});
return false;
}
public static Tile ParanoidTileRetrieval(int x, int y)
{
if (!WorldGen.InWorld(x, y))
+1 -23
View File
@@ -1,7 +1,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
@@ -24,28 +23,7 @@ namespace CalamityMod.Walls
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = TextureAssets.Wall[Type].Value;
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;
int[] sheetOffset = CreatePattern(i, j);
spriteBatch.Draw
(
sprite,
drawOffset,
new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32),
lightColor,
0,
new Vector2(0f, 0f),
1,
SpriteEffects.None,
0f
);
return false;
}
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => spriteBatch.DrawMultiVariantWall(Type, i, j, CreatePattern(i, j));
private int[] CreatePattern(int i, int j)
{
+1 -23
View File
@@ -2,7 +2,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.ModLoader;
namespace CalamityMod.Walls
@@ -23,28 +22,7 @@ namespace CalamityMod.Walls
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = TextureAssets.Wall[Type].Value;
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;
int[] sheetOffset = CreatePattern(i, j);
spriteBatch.Draw
(
sprite,
drawOffset,
new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32),
lightColor,
0,
new Vector2(0f, 0f),
1,
SpriteEffects.None,
0f
);
return false;
}
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => spriteBatch.DrawMultiVariantWall(Type, i, j, CreatePattern(i, j));
private int[] CreatePattern(int i, int j)
{
+1 -23
View File
@@ -1,7 +1,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
@@ -29,28 +28,7 @@ namespace CalamityMod.Walls
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = TextureAssets.Wall[Type].Value;
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;
int[] sheetOffset = CreatePattern(i, j);
spriteBatch.Draw
(
sprite,
drawOffset,
new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32),
lightColor,
0,
new Vector2(0f, 0f),
1,
SpriteEffects.None,
0f
);
return false;
}
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => spriteBatch.DrawMultiVariantWall(Type, i, j, CreatePattern(i, j));
private int[] CreatePattern(int i, int j)
{
+1 -23
View File
@@ -1,7 +1,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
@@ -24,28 +23,7 @@ namespace CalamityMod.Walls
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = TextureAssets.Wall[Type].Value;
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;
int[] sheetOffset = CreatePattern(i, j);
spriteBatch.Draw
(
sprite,
drawOffset,
new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32),
lightColor,
0,
new Vector2(0f, 0f),
1,
SpriteEffects.None,
0f
);
return false;
}
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => spriteBatch.DrawMultiVariantWall(Type, i, j, CreatePattern(i, j));
private int[] CreatePattern(int i, int j)
{
+1 -23
View File
@@ -1,7 +1,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
@@ -24,28 +23,7 @@ namespace CalamityMod.Walls
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = TextureAssets.Wall[Type].Value;
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;
int[] sheetOffset = CreatePattern(i, j);
spriteBatch.Draw
(
sprite,
drawOffset,
new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32),
lightColor,
0,
new Vector2(0f, 0f),
1,
SpriteEffects.None,
0f
);
return false;
}
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => spriteBatch.DrawMultiVariantWall(Type, i, j, CreatePattern(i, j));
private int[] CreatePattern(int i, int j)
{
+1 -22
View File
@@ -24,28 +24,7 @@ namespace CalamityMod.Walls
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = TextureAssets.Wall[Type].Value;
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;
int[] sheetOffset = CreatePattern(i, j);
spriteBatch.Draw
(
sprite,
drawOffset,
new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32),
lightColor,
0,
new Vector2(0f, 0f),
1,
SpriteEffects.None,
0f
);
return false;
}
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => spriteBatch.DrawMultiVariantWall(Type, i, j, CreatePattern(i, j));
private int[] CreatePattern(int i, int j)
{
+1 -22
View File
@@ -24,28 +24,7 @@ namespace CalamityMod.Walls
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = TextureAssets.Wall[Type].Value;
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;
int[] sheetOffset = CreatePattern(i, j);
spriteBatch.Draw
(
sprite,
drawOffset,
new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32),
lightColor,
0,
new Vector2(0f, 0f),
1,
SpriteEffects.None,
0f
);
return false;
}
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => spriteBatch.DrawMultiVariantWall(Type, i, j, CreatePattern(i, j));
private int[] CreatePattern(int i, int j)
{
+1 -22
View File
@@ -25,28 +25,7 @@ namespace CalamityMod.Walls
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = TextureAssets.Wall[Type].Value;
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;
int[] sheetOffset = CreatePattern(i, j);
spriteBatch.Draw
(
sprite,
drawOffset,
new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32),
lightColor,
0,
new Vector2(0f, 0f),
1,
SpriteEffects.None,
0f
);
return false;
}
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => spriteBatch.DrawMultiVariantWall(Type, i, j, CreatePattern(i, j));
private int[] CreatePattern(int i, int j)
{
+1 -22
View File
@@ -25,28 +25,7 @@ namespace CalamityMod.Walls
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = TextureAssets.Wall[Type].Value;
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;
int[] sheetOffset = CreatePattern(i, j);
spriteBatch.Draw
(
sprite,
drawOffset,
new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32),
lightColor,
0,
new Vector2(0f, 0f),
1,
SpriteEffects.None,
0f
);
return false;
}
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => spriteBatch.DrawMultiVariantWall(Type, i, j, CreatePattern(i, j));
private int[] CreatePattern(int i, int j)
{
+1 -22
View File
@@ -24,28 +24,7 @@ namespace CalamityMod.Walls
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = TextureAssets.Wall[Type].Value;
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;
int[] sheetOffset = CreatePattern(i, j);
spriteBatch.Draw
(
sprite,
drawOffset,
new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32),
lightColor,
0,
new Vector2(0f, 0f),
1,
SpriteEffects.None,
0f
);
return false;
}
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => spriteBatch.DrawMultiVariantWall(Type, i, j, CreatePattern(i, j));
private int[] CreatePattern(int i, int j)
{
+1 -22
View File
@@ -26,28 +26,7 @@ namespace CalamityMod.Walls
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = TextureAssets.Wall[Type].Value;
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;
int[] sheetOffset = CreatePattern(i, j);
spriteBatch.Draw
(
sprite,
drawOffset,
new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32),
lightColor,
0,
new Vector2(0f, 0f),
1,
SpriteEffects.None,
0f
);
return false;
}
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => spriteBatch.DrawMultiVariantWall(Type, i, j, CreatePattern(i, j));
private int[] CreatePattern(int i, int j)
{
+1 -22
View File
@@ -18,28 +18,7 @@ namespace CalamityMod.Walls
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = TextureAssets.Wall[Type].Value;
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;
int[] sheetOffset = CreatePattern(i, j);
spriteBatch.Draw
(
sprite,
drawOffset,
new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32),
lightColor,
0,
new Vector2(0f, 0f),
1,
SpriteEffects.None,
0f
);
return false;
}
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => spriteBatch.DrawMultiVariantWall(Type, i, j, CreatePattern(i, j));
private int[] CreatePattern(int i, int j)
{
+2 -69
View File
@@ -24,80 +24,13 @@ namespace CalamityMod.Walls
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = TextureAssets.Wall[Type].Value;
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;
int[] sheetOffset = CreatePattern(i, j);
spriteBatch.Draw
(
sprite,
drawOffset,
new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32),
lightColor,
0,
new Vector2(0f, 0f),
1,
SpriteEffects.None,
0f
);
return false;
}
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => spriteBatch.DrawMultiVariantWall(Type, i, j, CreatePattern(i, j));
private int[] CreatePattern(int i, int j)
{
int[] sheetOffset = new int[2] { i % 3, j % 3 };
int xPos = i % 3;
int yPos = j % 3;
switch (yPos)
{
case 0:
switch (xPos)
{
case 0:
sheetOffset = new int[2] { 0, 0 };
break;
case 1:
sheetOffset = new int[2] { 0, 1 };
break;
case 2:
sheetOffset = new int[2] { 0, 2 };
break;
}
break;
case 1:
switch (xPos)
{
case 0:
sheetOffset = new int[2] { 0, 3 };
break;
case 1:
sheetOffset = new int[2] { 0, 4 };
break;
case 2:
sheetOffset = new int[2] { 0, 0 };
break;
}
break;
case 2:
switch (xPos)
{
case 0:
sheetOffset = new int[2] { 0, 1 };
break;
case 1:
sheetOffset = new int[2] { 0, 2 };
break;
case 2:
sheetOffset = new int[2] { 0, 3 };
break;
}
break;
}
sheetOffset[0] = sheetOffset[0] * 468;
int[] sheetOffset = new int[2] { 0, (xPos + yPos * 3) % 5 };
sheetOffset[1] = sheetOffset[1] * 180;
return sheetOffset;
}
+30 -43
View File
@@ -33,59 +33,46 @@ namespace CalamityMod.Walls
return false;
}
public static void DrawWallGlow(int wallType, int i, int j, SpriteBatch spriteBatch)
public static bool DrawWallGlow(int type, int i, int j, SpriteBatch spriteBatch)
{
if (GlowMask.Texture is null)
return;
return true;
Tile tile = Main.tile[i, j];
int xLength = 32;
int xOff = 0;
int xPos = tile.WallFrameX + xOff;
int yPos = tile.WallFrameY;
Rectangle frame = new Rectangle(xPos, yPos, xLength, 32);
Color drawcolor;
drawcolor = WorldGen.paintColor(tile.WallColor);
drawcolor.A = 255;
Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange);
if (Main.drawToScreen)
zero = Vector2.Zero;
Vector2 pos = new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero;
Color lightColor = Lighting.GetColor(i, j, Color.White);
spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
if (GlowMask.HasContentInFramePos(xPos, yPos))
spriteBatch.SafeBegin(SpriteSortMode.Immediate, BatchSetting.AlphaBlend, null, Main.GameViewMatrix.TransformationMatrix, () =>
{
float brightness = 1f;
float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f;
brightness *= MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes);
brightness *= MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes);
brightness *= MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes);
brightness *= MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes);
drawcolor *= brightness;
Color glowColor = drawcolor * 0.4f;
Tile tile = Main.tile[i, j];
Effect tileShader = Main.tileShader;
TreePaintingSettings settings = TreePaintSystemData.GetWallSettings(type);
int paintColor = tile.WallColor;
tileShader.Parameters["leafHueTestOffset"]?.SetValue(settings.HueTestOffset);
tileShader.Parameters["leafMinHue"]?.SetValue(settings.SpecialGroupMinimalHueValue);
tileShader.Parameters["leafMaxHue"]?.SetValue(settings.SpecialGroupMaximumHueValue);
tileShader.Parameters["leafMinSat"]?.SetValue(settings.SpecialGroupMinimumSaturationValue);
tileShader.Parameters["leafMaxSat"]?.SetValue(settings.SpecialGroupMaximumSaturationValue);
tileShader.Parameters["invertSpecialGroupResult"]?.SetValue(settings.InvertSpecialGroupResult);
int index = Main.ConvertPaintIdToTileShaderIndex(paintColor, settings.UseSpecialGroups, settings.UseWallShaderHacks);
tileShader.CurrentTechnique.Passes[index].Apply();
// For now checking for glowing frames greatly reducing the bottleneck
// But maybe we could squeeze bit more by removing the loop
for (int k = 0; k < 3; k++)
Texture2D sprite = TextureAssets.Wall[type].Value;
Vector2 offset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + (Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange)) - Vector2.One * 8f;
int yPos = tile.WallFrameY;
int xPos = tile.WallFrameX;
Rectangle frame = new Rectangle(xPos, yPos, 32, 32);
Color lightColor = Lighting.GetColor(i, j);
spriteBatch.Draw(sprite, offset, frame, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
if (GlowMask.HasContentInFramePos(xPos, yPos))
{
Vector2 offset = new Vector2(Main.rand.NextFloat(-1, 1f), Main.rand.NextFloat(-1, 1f)) * 0.2f * k;
spriteBatch.Draw(GlowMask.Texture, pos + offset + new Vector2(-8 + xOff, -8), frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
Color glowColor = Color.Lerp(lightColor, Color.White, 0.2f + MathF.Sin(Main.GameUpdateCount * 0.007f) * 0.1f);
spriteBatch.Draw(GlowMask.Texture, offset, frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
}
}
}
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
DrawWallGlow(Type, i, j, spriteBatch);
});
return false;
}
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => DrawWallGlow(Type, i, j, spriteBatch);
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
}
}
+30 -43
View File
@@ -42,59 +42,46 @@ namespace CalamityMod.Walls
}
}
public static void DrawWallGlow(int wallType, int i, int j, SpriteBatch spriteBatch)
public static bool DrawWallGlow(int type, int i, int j, SpriteBatch spriteBatch)
{
if (GlowMask.Texture is null)
return;
return true;
Tile tile = Main.tile[i, j];
int xLength = 32;
int xOff = 0;
int xPos = tile.WallFrameX + xOff;
int yPos = tile.WallFrameY;
Rectangle frame = new Rectangle(xPos, yPos, xLength, 32);
Color drawcolor;
drawcolor = WorldGen.paintColor(tile.WallColor);
drawcolor.A = 255;
Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange);
if (Main.drawToScreen)
zero = Vector2.Zero;
Vector2 pos = new Vector2((i * 16 - (int)Main.screenPosition.X), (j * 16 - (int)Main.screenPosition.Y)) + zero;
Color lightColor = Lighting.GetColor(i, j, Color.White);
spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
if (GlowMask.HasContentInFramePos(xPos, yPos))
spriteBatch.SafeBegin(SpriteSortMode.Immediate, BatchSetting.AlphaBlend, null, Main.GameViewMatrix.TransformationMatrix, () =>
{
float brightness = 1f;
float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.007f;
brightness *= MathF.Sin(i / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes);
brightness *= MathF.Sin(j / 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes);
brightness *= MathF.Sin(i * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes);
brightness *= MathF.Sin(j * 18f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes);
drawcolor *= brightness;
Color glowColor = drawcolor * 0.4f;
Tile tile = Main.tile[i, j];
Effect tileShader = Main.tileShader;
TreePaintingSettings settings = TreePaintSystemData.GetWallSettings(type);
int paintColor = tile.WallColor;
tileShader.Parameters["leafHueTestOffset"]?.SetValue(settings.HueTestOffset);
tileShader.Parameters["leafMinHue"]?.SetValue(settings.SpecialGroupMinimalHueValue);
tileShader.Parameters["leafMaxHue"]?.SetValue(settings.SpecialGroupMaximumHueValue);
tileShader.Parameters["leafMinSat"]?.SetValue(settings.SpecialGroupMinimumSaturationValue);
tileShader.Parameters["leafMaxSat"]?.SetValue(settings.SpecialGroupMaximumSaturationValue);
tileShader.Parameters["invertSpecialGroupResult"]?.SetValue(settings.InvertSpecialGroupResult);
int index = Main.ConvertPaintIdToTileShaderIndex(paintColor, settings.UseSpecialGroups, settings.UseWallShaderHacks);
tileShader.CurrentTechnique.Passes[index].Apply();
// For now checking for glowing frames greatly reducing the bottleneck
// But maybe we could squeeze bit more by removing the loop
for (int k = 0; k < 3; k++)
Texture2D sprite = TextureAssets.Wall[type].Value;
Vector2 offset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + (Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange)) - Vector2.One * 8f;
int yPos = tile.WallFrameY;
int xPos = tile.WallFrameX;
Rectangle frame = new Rectangle(xPos, yPos, 32, 32);
Color lightColor = Lighting.GetColor(i, j);
spriteBatch.Draw(sprite, offset, frame, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
if (GlowMask.HasContentInFramePos(xPos, yPos))
{
Vector2 offset = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)) * 0.2f * k;
spriteBatch.Draw(GlowMask.Texture, pos + offset + new Vector2(-8 + xOff, -8), frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
Color glowColor = Color.Lerp(lightColor, Color.White, 0.2f + MathF.Sin(Main.GameUpdateCount * 0.007f) * 0.1f);
spriteBatch.Draw(GlowMask.Texture, offset, frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
}
}
}
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
DrawWallGlow(Type, i, j, spriteBatch);
});
return false;
}
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => DrawWallGlow(Type, i, j, spriteBatch);
public override void KillWall(int i, int j, ref bool fail) => fail = true;
public override bool CanExplode(int i, int j) => false;
+1 -22
View File
@@ -23,28 +23,7 @@ namespace CalamityMod.Walls
public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3;
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch)
{
Texture2D sprite = TextureAssets.Wall[Type].Value;
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;
int[] sheetOffset = CreatePattern(i, j);
spriteBatch.Draw
(
sprite,
drawOffset,
new Rectangle(sheetOffset[0] + Main.tile[i, j].WallFrameX, sheetOffset[1] + Main.tile[i, j].WallFrameY, 32, 32),
lightColor,
0,
new Vector2(0f, 0f),
1,
SpriteEffects.None,
0f
);
return false;
}
public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => spriteBatch.DrawMultiVariantWall(Type, i, j, CreatePattern(i, j));
private int[] CreatePattern(int i, int j)
{