diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 78ff25d23e..d29db28d50 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -552,13 +552,12 @@ namespace CalamityMod.ILEditing color = Color.Lerp(color, Color.White, 0.75f); float offsetAngleValue = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6.7f) * 0.99f; - float horizontalAreaValue = (float)horizontalArea * 0.34f; int origin = size / 2; for (int i = -horizontalArea; i <= horizontalArea; i++) { float offsetAngle = offsetAngleValue; - offsetAngle += i / horizontalAreaValue; + offsetAngle += i / (float)horizontalArea * 0.34f; Vector2 velocity = Main.MouseWorld - UIManagementSystem.PreviousMouseWorld; if (velocity.Length() < 64f) { diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index b860b689df..bb5889922e 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -6076,7 +6076,7 @@ namespace CalamityMod.NPCs for (int i = 0; i < 3; i++) { spriteBatch.Draw(TextureAssets.Dest[npc.type - NPCID.TheDestroyer].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, - drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); } } else diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index f2126c15f8..926bee0dd5 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -479,6 +479,8 @@ namespace CalamityMod maxTrailPoints = (int)projectile.localAI[0]; Vector2 cumulativeOffset = Vector2.Zero; + Color alpha = projectile.GetAlpha(lightColor); + float fixedRotation = projectile.rotation + MathHelper.PiOver2; for (int i = 1; i <= (int)projectile.localAI[0]; i++) { Vector2 velToUseThisIter = projectile.velocity; @@ -493,10 +495,9 @@ namespace CalamityMod } } cumulativeOffset += Vector2.Normalize(velToUseThisIter) * spacer; - Color color = projectile.GetAlpha(lightColor); + Color color = alpha; color *= (maxTrailPoints - (float)i) / maxTrailPoints; color.A = 0; - float fixedRotation = projectile.rotation + MathHelper.PiOver2; Main.spriteBatch.Draw(texture, drawPos - cumulativeOffset, null, color, fixedRotation, origin, projectile.scale, spriteEffects, 0f); } } @@ -548,9 +549,10 @@ namespace CalamityMod float time = Main.player[projectile.owner].miscCounter % 216000f / 60f; Color outerColor = outer * 0.2f; outerColor.A = 0; + float rotation = MathHelper.TwoPi * time; for (int o = 0; o < 6; o += 2) { - Vector2 spinStart = drawStartOuter + spinPoint.RotatedBy(MathHelper.TwoPi * time - MathHelper.Pi * o / 3f); + Vector2 spinStart = drawStartOuter + spinPoint.RotatedBy(rotation - MathHelper.Pi * o / 3f); float scaleMultOuter = 1.5f - o * 0.1f; Main.EntitySpriteDraw(aura, spinStart, auraRec, outerColor, auraRotation, auraOrigin, scaleMultOuter, SpriteEffects.None, 0); } @@ -565,9 +567,8 @@ namespace CalamityMod scaleMult = (scaleMult + i) % 1f; float colorMult = scaleMult * 2f; if (colorMult > 1f) - { colorMult = 2f - colorMult; - } + Main.EntitySpriteDraw(aura, drawStartInner, auraRec, innerColor * colorMult, auraRotation, auraOrigin, 0.3f + scaleMult * 0.5f, SpriteEffects.None, 0); } } @@ -596,11 +597,13 @@ namespace CalamityMod } bool canKillWalls = false; + float projectilePositionX = projectile.position.X / 16f; + float projectilePositionY = projectile.position.Y / 16f; for (int x = minTileX; x <= maxTileX; x++) { for (int y = minTileY; y <= maxTileY; y++) { - Vector2 explodeArea = new Vector2(Math.Abs(x - projectile.position.X / 16f), Math.Abs(y - projectile.position.Y / 16f)); + Vector2 explodeArea = new Vector2(Math.Abs(x - projectilePositionX), Math.Abs(y - projectilePositionY)); float distance = explodeArea.Length(); if (distance < explosionRadius && Main.tile[x, y] != null && Main.tile[x, y].WallType == WallID.None) { @@ -644,7 +647,7 @@ namespace CalamityMod Tile tile = Main.tile[i, j]; bool t = 1 == 1; bool f = 1 == 2; - Vector2 explodeArea = new Vector2(Math.Abs(i - projectile.position.X / 16f), Math.Abs(j - projectile.position.Y / 16f)); + Vector2 explodeArea = new Vector2(Math.Abs(i - projectilePositionX), Math.Abs(j - projectilePositionY)); float distance = explodeArea.Length(); if (distance < explosionRadius) { @@ -654,14 +657,11 @@ namespace CalamityMod if (checkExplosions) { if (Main.tileDungeon[tile.TileType] || explosionCheckList.Contains(tile.TileType)) - { canKillTile = false; - } if (!TileLoader.CanExplode(i, j)) - { canKillTile = false; - } } + if (Main.tileContainer[tile.TileType]) canKillTile = false; if (!TileLoader.CanKillTile(i, j, tile.TileType, ref t) || !TileLoader.CanKillTile(i, j, tile.TileType, ref f)) @@ -673,11 +673,10 @@ namespace CalamityMod { WorldGen.KillTile(i, j, false, false, false); if (!tile.HasTile && Main.netMode != NetmodeID.SinglePlayer) - { NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, i, j, 0f, 0, 0, 0); - } } } + if (canKillTile) { for (int x = i - 1; x <= i + 1; x++) @@ -689,13 +688,12 @@ namespace CalamityMod canExplode = WallLoader.CanExplode(x, y, Main.tile[x, y].WallType); if (wallExcludeList.Any() && wallExcludeList.Contains(Main.tile[x, y].WallType)) canKillWalls = false; + if (Main.tile[x, y] != null && Main.tile[x, y].WallType > WallID.None && canKillWalls && canExplode) { WorldGen.KillWall(x, y, false); if (Main.tile[x, y].WallType == WallID.None && Main.netMode != NetmodeID.SinglePlayer) - { NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 2, x, y, 0f, 0, 0, 0); - } } } } diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index 24df06d0a1..543f728b5b 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -62,18 +62,16 @@ namespace CalamityMod { if (xIter < 0 || xIter >= Main.maxTilesX) continue; + for (int yIter = y - 1; yIter <= y + 1; yIter++) { if (yIter < 0 || yIter >= Main.maxTilesY) continue; + if (xIter == x && yIter == y) - { WorldGen.TileFrame(x, y, resetFrame, false); - } else - { WorldGen.TileFrame(xIter, yIter, false, false); - } } } } @@ -82,31 +80,27 @@ namespace CalamityMod { int x = i - Main.tile[i, j].TileFrameX / 18 % tileX; int y = j - Main.tile[i, j].TileFrameY / 18 % tileY; + int tileXX18 = 18 * tileX; for (int l = x; l < x + tileX; l++) { for (int m = y; m < y + tileY; m++) { if (Main.tile[l, m].HasTile && Main.tile[l, m].TileType == type) { - if (Main.tile[l, m].TileFrameX < (18 * tileX)) - { - Main.tile[l, m].TileFrameX += (short)(18 * tileX); - } + if (Main.tile[l, m].TileFrameX < tileXX18) + Main.tile[l, m].TileFrameX += (short)(tileXX18); else - { - Main.tile[l, m].TileFrameX -= (short)(18 * tileX); - } + Main.tile[l, m].TileFrameX -= (short)(tileXX18); } } } + if (Wiring.running) { for (int k = 0; k < tileX; k++) { for (int l = 0; l < tileY; l++) - { Wiring.SkipWire(x + k, y + l); - } } } } @@ -121,12 +115,13 @@ namespace CalamityMod int yOffset = TileObjectData.GetTileData(tile).DrawYOffset; ulong num190 = Main.TileFrameSeed ^ (ulong)((long)j << 32 | (long)(uint)i); - + float drawPositionX = i * 16 - (int)Main.screenPosition.X - (width - 16f) / 2f; + float drawPositionY = j * 16 - (int)Main.screenPosition.Y; for (int c = 0; c < 7; c++) { float shakeX = Utils.RandomInt(ref num190, -10, 11) * 0.15f; float shakeY = Utils.RandomInt(ref num190, -10, 1) * 0.35f; - Main.spriteBatch.Draw(flameTexture, new Vector2(i * 16 - (int)Main.screenPosition.X - (width - 16f) / 2f + shakeX, j * 16 - (int)Main.screenPosition.Y + shakeY + yOffset) + zero, new Rectangle(tile.TileFrameX + offsetX, tile.TileFrameY + offsetY, width, height), new Color(100, 100, 100, 0), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(flameTexture, new Vector2(drawPositionX + shakeX, drawPositionY + shakeY + yOffset) + zero, new Rectangle(tile.TileFrameX + offsetX, tile.TileFrameY + offsetY, width, height), new Color(100, 100, 100, 0), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } @@ -171,11 +166,13 @@ namespace CalamityMod { int width = flameTexture.Width; int height = flameTexture.Height; + float drawPositionX = item.position.X - Main.screenPosition.X + item.width * 0.5f; + float drawPositionY = item.position.Y - Main.screenPosition.Y + item.height - flameTexture.Height * 0.5f + 2f; for (int c = 0; c < 7; c++) { float shakeX = Main.rand.Next(-10, 11) * 0.15f; float shakeY = Main.rand.Next(-10, 1) * 0.35f; - Main.spriteBatch.Draw(flameTexture, new Vector2(item.position.X - Main.screenPosition.X + item.width * 0.5f + shakeX, item.position.Y - Main.screenPosition.Y + item.height - flameTexture.Height * 0.5f + 2f + shakeY), new Rectangle(0, 0, width, height), new Color(100, 100, 100, 0), 0f, default, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(flameTexture, new Vector2(drawPositionX + shakeX, drawPositionY + shakeY), new Rectangle(0, 0, width, height), new Color(100, 100, 100, 0), 0f, default, 1f, SpriteEffects.None, 0f); } } @@ -239,6 +236,7 @@ namespace CalamityMod { if (WorldGen.InWorld(i, j)) continue; + if (WorldGen.SolidTile(Framing.GetTileSafely(i, j))) return true; } @@ -254,6 +252,7 @@ namespace CalamityMod { if (!WorldGen.InWorld(i, j)) return false; + if (!WorldGen.SolidTile(Framing.GetTileSafely(i, j))) return false; } @@ -269,6 +268,7 @@ namespace CalamityMod { if (!WorldGen.InWorld(i, j)) return false; + if (!WorldGen.SolidTile(Framing.GetTileSafely(i, j))) return false; } diff --git a/Walls/VoidstoneWall.cs b/Walls/VoidstoneWall.cs index 937ec1998b..21170ca508 100644 --- a/Walls/VoidstoneWall.cs +++ b/Walls/VoidstoneWall.cs @@ -54,10 +54,11 @@ namespace CalamityMod.Walls Vector2 pos = new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero; Main.spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, Lighting.GetColor(i, j, Color.White), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Color glowColor = drawcolor * 0.4f; for (int k = 0; k < 3; k++) { Vector2 offset = new Vector2(Main.rand.NextFloat(-1, 1f), Main.rand.NextFloat(-1, 1f)) * 0.2f * k; - Main.spriteBatch.Draw(GlowTexture, pos + offset + new Vector2(-8 + xOff, -8), frame, drawcolor * 0.4f, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Main.spriteBatch.Draw(GlowTexture, pos + offset + new Vector2(-8 + xOff, -8), frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); } } diff --git a/Walls/VoidstoneWallUnsafe.cs b/Walls/VoidstoneWallUnsafe.cs index 4f88ec3d09..a633899346 100644 --- a/Walls/VoidstoneWallUnsafe.cs +++ b/Walls/VoidstoneWallUnsafe.cs @@ -60,10 +60,11 @@ namespace CalamityMod.Walls Vector2 pos = new Vector2((i * 16 - (int)Main.screenPosition.X), (j * 16 - (int)Main.screenPosition.Y)) + zero; Main.spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8 + xOff, -8), frame, Lighting.GetColor(i, j, Color.White), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Color glowColor = drawcolor * 0.4f; for (int k = 0; k < 3; k++) { - Vector2 offset = new Vector2(Main.rand.NextFloat(-1, 1f), Main.rand.NextFloat(-1, 1f)) * 0.2f * k; - Main.spriteBatch.Draw(GlowTexture, pos + offset + new Vector2(-8 + xOff, -8), frame, drawcolor * 0.4f, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Vector2 offset = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)) * 0.2f * k; + Main.spriteBatch.Draw(GlowTexture, pos + offset + new Vector2(-8 + xOff, -8), frame, glowColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); } }