diff --git a/core/src/io/anuke/mindustry/core/Renderer.java b/core/src/io/anuke/mindustry/core/Renderer.java index d61fe1e617..0bd9e89709 100644 --- a/core/src/io/anuke/mindustry/core/Renderer.java +++ b/core/src/io/anuke/mindustry/core/Renderer.java @@ -317,6 +317,15 @@ public class Renderer implements ApplicationListener{ targetscale = Mathf.clamp(targetscale, s * 1.5f, Math.round(s * 6)); } + public float getScale(){ + return targetscale; + } + + public void setScale(float scl){ + targetscale = scl; + clampScale(); + } + public void takeMapScreenshot(){ drawGroundShadows(); diff --git a/core/src/io/anuke/mindustry/entities/Damage.java b/core/src/io/anuke/mindustry/entities/Damage.java index 093c3f7b14..6d78dc494b 100644 --- a/core/src/io/anuke/mindustry/entities/Damage.java +++ b/core/src/io/anuke/mindustry/entities/Damage.java @@ -176,6 +176,15 @@ public class Damage{ } int trad = (int) (radius / tilesize); + Tile tile = world.tileWorld(x, y); + if(tile != null){ + tileDamage(tile.x, tile.y, trad); + } + + } + + private static void tileDamage(int x, int y, int radius){ + /* for(int dx = -trad; dx <= trad; dx++){ for(int dy = -trad; dy <= trad; dy++){ Tile tile = world.tile(Math.round(x / tilesize) + dx, Math.round(y / tilesize) + dy); @@ -184,8 +193,7 @@ public class Damage{ tile.entity.damage(amount); } } - } - + }*/ } private static float calculateDamage(float x, float y, float tx, float ty, float radius, float damage){ diff --git a/core/src/io/anuke/mindustry/graphics/Pixelator.java b/core/src/io/anuke/mindustry/graphics/Pixelator.java index 2441f1dccc..46d37e8212 100644 --- a/core/src/io/anuke/mindustry/graphics/Pixelator.java +++ b/core/src/io/anuke/mindustry/graphics/Pixelator.java @@ -4,6 +4,7 @@ import io.anuke.arc.Core; import io.anuke.arc.graphics.Blending; import io.anuke.arc.graphics.g2d.Draw; import io.anuke.arc.graphics.glutils.FrameBuffer; +import io.anuke.arc.math.Mathf; import io.anuke.arc.util.Disposable; import io.anuke.mindustry.entities.type.Player; @@ -14,8 +15,24 @@ import static io.anuke.mindustry.Vars.renderer; public class Pixelator implements Disposable{ private FrameBuffer buffer = new FrameBuffer(2, 2); + private float lastScale = -1; public void drawPixelate(){ + float scale = renderer.getScale(); + if(lastScale > 0){ + //going smaller + if(scale < lastScale){ + scale = (int)scale; + }else if(scale > lastScale){ + scale = Mathf.ceil(scale); + + } + renderer.setScale(scale); + } + lastScale = renderer.getScale(); + camera.width = (int)camera.width; + camera.height = (int)camera.height; + boolean hadShields = Core.settings.getBool("animatedshields"); boolean hadWater = Core.settings.getBool("animatedwater"); Core.settings.put("animatedwater", false); @@ -23,7 +40,7 @@ public class Pixelator implements Disposable{ graphics.clear(0f, 0f, 0f, 1f); float px = Core.camera.position.x, py = Core.camera.position.y; - Core.camera.position.set((int)px, (int)py + ((int)(camera.height) % 2 == 0 ? 0 : 0.5f)); + Core.camera.position.set((int)px + ((int)(camera.width) % 2 == 0 ? 0 : 0.5f), (int)py + ((int)(camera.height) % 2 == 0 ? 0 : 0.5f)); int w = (int)(Core.camera.width); int h = (int)(Core.camera.height);