diff --git a/core/assets/music/game4.mp3 b/core/assets/music/game4.mp3 new file mode 100644 index 0000000000..87b291c803 Binary files /dev/null and b/core/assets/music/game4.mp3 differ diff --git a/core/src/io/anuke/mindustry/content/Fx.java b/core/src/io/anuke/mindustry/content/Fx.java index ce165451c0..0272a7dc58 100644 --- a/core/src/io/anuke/mindustry/content/Fx.java +++ b/core/src/io/anuke/mindustry/content/Fx.java @@ -160,14 +160,14 @@ public class Fx implements ContentList{ healWave = new Effect(22, e -> { Draw.color(Pal.heal); Lines.stroke(e.fout() * 2f); - Lines.poly(e.x, e.y, 30, 4f + e.finpow() * 60f); + Lines.circle(e.x, e.y, 4f + e.finpow() * 60f); Draw.color(); }); heal = new Effect(11, e -> { Draw.color(Pal.heal); Lines.stroke(e.fout() * 2f); - Lines.poly(e.x, e.y, 24, 2f + e.finpow() * 7f); + Lines.circle(e.x, e.y, 2f + e.finpow() * 7f); Draw.color(); }); @@ -568,21 +568,21 @@ public class Fx implements ContentList{ nuclearShockwave = new Effect(10f, 200f, e -> { Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin()); Lines.stroke(e.fout() * 3f + 0.2f); - Lines.poly(e.x, e.y, 40, e.fin() * 140f); + Lines.circle(e.x, e.y, e.fin() * 140f); Draw.reset(); }); impactShockwave = new Effect(13f, 300f, e -> { Draw.color(Pal.lighterOrange, Color.LIGHT_GRAY, e.fin()); Lines.stroke(e.fout() * 4f + 0.2f); - Lines.poly(e.x, e.y, 60, e.fin() * 200f); + Lines.circle(e.x, e.y, e.fin() * 200f); Draw.reset(); }); spawnShockwave = new Effect(20f, 400f, e -> { Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin()); Lines.stroke(e.fout() * 3f + 0.5f); - Lines.poly(e.x, e.y, 40, e.fin() * (e.rotation + 50f)); + Lines.circle(e.x, e.y, e.fin() * (e.rotation + 50f)); Draw.reset(); }); @@ -614,7 +614,7 @@ public class Fx implements ContentList{ e.scaled(5 + intensity * 2, i -> { Lines.stroke(3.1f * i.fout()); - Lines.poly(e.x, e.y, (int)(20 * intensity), (3f + i.fin() * 14f) * intensity); + Lines.circle(e.x, e.y, (3f + i.fin() * 14f) * intensity); }); Draw.color(Color.GRAY); @@ -1157,21 +1157,21 @@ public class Fx implements ContentList{ launch = new Effect(28, e -> { Draw.color(Pal.command); Lines.stroke(e.fout() * 2f); - Lines.poly(e.x, e.y, 40, 4f + e.finpow() * 120f); + Lines.circle(e.x, e.y, 4f + e.finpow() * 120f); Draw.color(); }); healWaveMend = new Effect(40, e -> { Draw.color(e.color); Lines.stroke(e.fout() * 2f); - Lines.poly(e.x, e.y, 30, e.finpow() * e.rotation); + Lines.circle(e.x, e.y, e.finpow() * e.rotation); Draw.color(); }); overdriveWave = new Effect(50, e -> { Draw.color(e.color); Lines.stroke(e.fout() * 1f); - Lines.poly(e.x, e.y, 30, e.finpow() * e.rotation); + Lines.circle(e.x, e.y, e.finpow() * e.rotation); Draw.color(); }); diff --git a/core/src/io/anuke/mindustry/core/Renderer.java b/core/src/io/anuke/mindustry/core/Renderer.java index 11876580e9..859af89bda 100644 --- a/core/src/io/anuke/mindustry/core/Renderer.java +++ b/core/src/io/anuke/mindustry/core/Renderer.java @@ -48,7 +48,6 @@ public class Renderer implements ApplicationListener{ if(settings.getBool("bloom")){ setupBloom(); } - Lines.setCircleVertices(20); Shaders.init(); Effects.setScreenShakeProvider((intensity, duration) -> { diff --git a/core/src/io/anuke/mindustry/core/UI.java b/core/src/io/anuke/mindustry/core/UI.java index eb45f38fc1..d9e9e599b8 100644 --- a/core/src/io/anuke/mindustry/core/UI.java +++ b/core/src/io/anuke/mindustry/core/UI.java @@ -140,7 +140,7 @@ public class UI implements ApplicationListener{ FreeTypeFontParameter outlined = new FreeTypeFontParameter(){{ size = param.size; borderColor = Color.DARK_GRAY; - borderWidth = 2f; + borderWidth = UnitScl.dp.scl(2f); spaceX -= borderWidth; incremental = true; }}; diff --git a/core/src/io/anuke/mindustry/entities/type/Unit.java b/core/src/io/anuke/mindustry/entities/type/Unit.java index 22fff0524f..c3ba24a6b9 100644 --- a/core/src/io/anuke/mindustry/entities/type/Unit.java +++ b/core/src/io/anuke/mindustry/entities/type/Unit.java @@ -6,6 +6,7 @@ import io.anuke.arc.graphics.*; import io.anuke.arc.graphics.g2d.*; import io.anuke.arc.math.*; import io.anuke.arc.math.geom.*; +import io.anuke.arc.scene.ui.layout.*; import io.anuke.arc.util.*; import io.anuke.mindustry.content.*; import io.anuke.mindustry.entities.*; @@ -402,7 +403,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ Core.scene.skin.getFont("outline").draw(item.amount + "", x + Angles.trnsx(rotation + 180f, backTrns), y + Angles.trnsy(rotation + 180f, backTrns) - 3, - Pal.accent, 0.25f * itemtime, false, Align.center + Pal.accent, 0.25f * itemtime / UnitScl.dp.scl(1f), false, Align.center ); } } diff --git a/core/src/io/anuke/mindustry/game/Gamemode.java b/core/src/io/anuke/mindustry/game/Gamemode.java index b2e803dced..7f94b867ae 100644 --- a/core/src/io/anuke/mindustry/game/Gamemode.java +++ b/core/src/io/anuke/mindustry/game/Gamemode.java @@ -30,11 +30,11 @@ public enum Gamemode{ rules.pvp = true; rules.enemyCoreBuildRadius = 600f; rules.respawnTime = 60 * 10; - rules.buildCostMultiplier = 0.5f; - rules.buildSpeedMultiplier = 2f; + rules.buildCostMultiplier = 1f; + rules.buildSpeedMultiplier = 1f; rules.playerDamageMultiplier = 0.33f; rules.playerHealthMultiplier = 0.5f; - rules.unitBuildSpeedMultiplier = 3f; + rules.unitBuildSpeedMultiplier = 2f; rules.unitHealthMultiplier = 3f; rules.attackMode = true; }, map -> map.teams.size > 1), diff --git a/core/src/io/anuke/mindustry/graphics/Drawf.java b/core/src/io/anuke/mindustry/graphics/Drawf.java index 7327dc5efe..9881185226 100644 --- a/core/src/io/anuke/mindustry/graphics/Drawf.java +++ b/core/src/io/anuke/mindustry/graphics/Drawf.java @@ -21,14 +21,34 @@ public class Drawf{ } public static void circles(float x, float y, float rad, Color color){ - int vertices = (int)(rad * 2); Lines.stroke(3f, Pal.gray); - Lines.poly(x, y, vertices, rad); + Lines.circle(x, y, rad); Lines.stroke(1f, color); - Lines.poly(x, y, vertices, rad); + Lines.circle(x, y, rad); Draw.reset(); } + public static void square(float x, float y, float radius, Color color){ + Lines.stroke(3f, Pal.gray); + Lines.square(x, y, radius + 1f, 45); + Lines.stroke(1f, color); + Lines.square(x, y, radius + 1f, 45); + Draw.reset(); + } + + public static void square(float x, float y, float radius){ + square(x, y, radius, Pal.accent); + } + + /* + public static void square(float x, float y, float radius){ + Lines.stroke(1f, Pal.gray); + Lines.square(x, y - 1f, radius + 1f, 45); + Lines.stroke(1f, Pal.accent); + Lines.square(x, y, radius + 1f, 45); + Draw.reset(); + }*/ + public static void arrow(float x, float y, float x2, float y2, float length, float radius){ float angle = Angles.angle(x, y, x2, y2); float space = 2f; diff --git a/core/src/io/anuke/mindustry/graphics/OverlayRenderer.java b/core/src/io/anuke/mindustry/graphics/OverlayRenderer.java index 4c313567cc..ef137acc60 100644 --- a/core/src/io/anuke/mindustry/graphics/OverlayRenderer.java +++ b/core/src/io/anuke/mindustry/graphics/OverlayRenderer.java @@ -85,9 +85,9 @@ public class OverlayRenderer{ float dst = Mathf.dst(player.x, player.y, core.drawx(), core.drawy()); if(dst < state.rules.enemyCoreBuildRadius * 1.5f){ Draw.color(Color.DARK_GRAY); - Lines.poly(core.drawx(), core.drawy() - 2, 200, state.rules.enemyCoreBuildRadius); + Lines.circle(core.drawx(), core.drawy() - 2, state.rules.enemyCoreBuildRadius); Draw.color(Pal.accent, enemy.color, 0.5f + Mathf.absin(Time.time(), 10f, 0.5f)); - Lines.poly(core.drawx(), core.drawy(), 200, state.rules.enemyCoreBuildRadius); + Lines.circle(core.drawx(), core.drawy(), state.rules.enemyCoreBuildRadius); } } } diff --git a/core/src/io/anuke/mindustry/maps/filters/MirrorFilter.java b/core/src/io/anuke/mindustry/maps/filters/MirrorFilter.java index f049419591..fd2f178337 100644 --- a/core/src/io/anuke/mindustry/maps/filters/MirrorFilter.java +++ b/core/src/io/anuke/mindustry/maps/filters/MirrorFilter.java @@ -24,8 +24,8 @@ public class MirrorFilter extends GenerateFilter{ v1.trns(angle - 90, 1f); v2.set(v1).scl(-1f); - v1.add(in.width/2f, in.height/2f); - v2.add(in.width/2f, in.height/2f); + v1.add(in.width/2f - 0.5f, in.height/2f - 0.5f); + v2.add(in.width/2f - 0.5f, in.height/2f - 0.5f); v3.set(in.x, in.y); diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index 61fc8230c5..5bc5700909 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -238,7 +238,7 @@ public class Block extends BlockStorage{ GlyphLayout layout = Pools.obtain(GlyphLayout.class, GlyphLayout::new); boolean ints = font.usesIntegerPositions(); font.setUseIntegerPositions(false); - font.getData().setScale(1f / 4f); + font.getData().setScale(1f / 4f / UnitScl.dp.scl(1f)); layout.setText(font, text); float width = layout.width; diff --git a/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java b/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java index a32572b893..77b4e8716f 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java @@ -161,13 +161,12 @@ public class PowerNode extends PowerBlock{ Lines.stroke(1f); Draw.color(Pal.accent); - Lines.poly(tile.drawx(), tile.drawy(), 50, laserRange * tilesize); + Drawf.circles(tile.drawx(), tile.drawy(), laserRange * tilesize); Draw.reset(); } @Override public void drawConfigure(Tile tile){ - TileEntity entity = tile.entity(); Draw.color(Pal.accent); @@ -185,15 +184,9 @@ public class PowerNode extends PowerBlock{ if(link != tile && linkValid(tile, link, false)){ boolean linked = linked(tile, link); - Draw.color(linked ? Pal.place : Pal.breakInvalid); - Lines.circle(link.drawx(), link.drawy(), - link.block().size * tilesize / 2f + 1f + (linked ? 0f : Mathf.absin(Time.time(), 4f, 1f))); - - if((entity.power.links.size >= maxNodes || (link.block() instanceof PowerNode && link.entity.power.links.size >= ((PowerNode)link.block()).maxNodes)) && !linked){ - Draw.color(Pal.breakInvalid); - Lines.lineAngleCenter(link.drawx(), link.drawy(), 45, link.block().size * Mathf.sqrt2 * tilesize * 0.9f); - Draw.color(); + if(linked){ + Drawf.square(link.drawx(), link.drawy(), link.block().size * tilesize / 2f + 1f, Pal.place); } } } @@ -204,9 +197,24 @@ public class PowerNode extends PowerBlock{ @Override public void drawPlace(int x, int y, int rotation, boolean valid){ + Tile tile = world.tile(x, y); + + if(tile == null) return; + Lines.stroke(1f); Draw.color(Pal.placing); Drawf.circles(x * tilesize + offset(), y * tilesize + offset(), laserRange * tilesize); + + for(int cx = (int)(x - laserRange - 1); cx <= x + laserRange + 1; cx++){ + for(int cy = (int)(y - laserRange - 1); cy <= y + laserRange + 1; cy++){ + Tile link = world.ltile(cx, cy); + + if(link != null && !(link.x == x && link.y == y) && link.block().hasPower && overlaps(x * tilesize + offset(), y *tilesize + offset(), link, laserRange * tilesize)){ + Drawf.square(link.drawx(), link.drawy(), link.block().size * tilesize / 2f + 2f, link.pos() == lastPlaced ? Pal.place : Pal.accent); + } + } + } + Draw.reset(); } @@ -246,8 +254,12 @@ public class PowerNode extends PowerBlock{ return false; } + protected boolean overlaps(float srcx, float srcy, Tile other, float range){ + return Intersector.overlaps(Tmp.cr1.set(srcx, srcy, range), other.getHitbox(Tmp.r1)); + } + protected boolean overlaps(Tile src, Tile other, float range){ - return Intersector.overlaps(Tmp.cr1.set(src.drawx(), src.drawy(), range), other.getHitbox(Tmp.r1)); + return overlaps(src.drawx(), src.drawy(), other, range); } protected void drawLaser(Tile tile, Tile target){ diff --git a/desktop-sdl/src/io/anuke/mindustry/desktopsdl/DesktopLauncher.java b/desktop-sdl/src/io/anuke/mindustry/desktopsdl/DesktopLauncher.java index fd7ed3edfd..ce4887f27a 100644 --- a/desktop-sdl/src/io/anuke/mindustry/desktopsdl/DesktopLauncher.java +++ b/desktop-sdl/src/io/anuke/mindustry/desktopsdl/DesktopLauncher.java @@ -1,19 +1,19 @@ package io.anuke.mindustry.desktopsdl; import io.anuke.arc.Files.*; import io.anuke.arc.backends.sdl.*; -import io.anuke.mindustry.Mindustry; -import io.anuke.mindustry.core.Platform; +import io.anuke.mindustry.*; +import io.anuke.mindustry.core.*; import io.anuke.mindustry.net.*; public class DesktopLauncher{ public static void main(String[] arg){ try{ - Platform.instance = new DesktopPlatform(arg); Net.setClientProvider(new ArcNetClient()); Net.setServerProvider(new ArcNetServer()); + new SdlApplication(new Mindustry(), new SdlConfig(){{ title = "Mindustry"; maximized = true;