From 5c6f2171f44b010653ecda938d9e53c95de4c8a1 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 25 Aug 2019 11:16:38 -0400 Subject: [PATCH] Fixed black tile issue --- core/src/io/anuke/mindustry/core/World.java | 20 ++++++++++++++++--- .../mindustry/graphics/FloorRenderer.java | 7 +++---- core/src/io/anuke/mindustry/world/Tile.java | 4 ++++ .../mindustry/world/blocks/StaticWall.java | 6 +++--- desktop/build.gradle | 10 +++++++++- 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/core/src/io/anuke/mindustry/core/World.java b/core/src/io/anuke/mindustry/core/World.java index 1c330ce397..632ea297ee 100644 --- a/core/src/io/anuke/mindustry/core/World.java +++ b/core/src/io/anuke/mindustry/core/World.java @@ -190,7 +190,9 @@ public class World implements ApplicationListener{ } } - addDarkness(tiles); + if(!headless){ + addDarkness(tiles); + } Entities.getAllGroups().each(group -> group.resize(-finalWorldBounds, -finalWorldBounds, tiles.length * tilesize + finalWorldBounds * 2, tiles[0].length * tilesize + finalWorldBounds * 2)); @@ -354,7 +356,7 @@ public class World implements ApplicationListener{ for(int x = 0; x < tiles.length; x++){ for(int y = 0; y < tiles[0].length; y++){ Tile tile = tiles[x][y]; - if(tile.block().solid && !tile.block().synthetic() && tile.block().fillsTile){ + if(tile.isDarkened()){ dark[x][y] = darkIterations; } } @@ -383,9 +385,21 @@ public class World implements ApplicationListener{ for(int x = 0; x < tiles.length; x++){ for(int y = 0; y < tiles[0].length; y++){ Tile tile = tiles[x][y]; - if(tile.block().solid && !tile.block().synthetic()){ + if(tile.isDarkened()){ tiles[x][y].rotation(dark[x][y]); } + if(dark[x][y] == 4){ + boolean full = true; + for(Point2 p : Geometry.d4){ + int px = p.x + x, py = p.y + y; + if(Structs.inBounds(px, py, tiles) && !(tiles[px][py].isDarkened() && dark[px][py] == 4)){ + full = false; + break; + } + } + + if(full) tiles[x][y].rotation(5); + } } } } diff --git a/core/src/io/anuke/mindustry/graphics/FloorRenderer.java b/core/src/io/anuke/mindustry/graphics/FloorRenderer.java index 06dba70468..58d022f579 100644 --- a/core/src/io/anuke/mindustry/graphics/FloorRenderer.java +++ b/core/src/io/anuke/mindustry/graphics/FloorRenderer.java @@ -22,7 +22,7 @@ public class FloorRenderer implements Disposable{ private final static int chunksize = 64; private Chunk[][] cache; - private CacheBatch cbatch; + private MultiCacheBatch cbatch; private IntSet drawnLayerSet = new IntSet(); private IntArray drawnLayers = new IntArray(); private ObjectSet used = new ObjectSet<>(); @@ -185,7 +185,7 @@ public class FloorRenderer implements Disposable{ floor = tile.floor(); } - if(tile.block().cacheLayer == layer && layer == CacheLayer.walls){ + if(tile.block().cacheLayer == layer && layer == CacheLayer.walls && !(tile.isDarkened() && tile.rotation() >= 5)){ tile.block().draw(tile); }else if(floor.cacheLayer == layer && (world.isAccessible(tile.x, tile.y) || tile.block().cacheLayer != CacheLayer.walls || !tile.block().fillsTile)){ floor.draw(tile); @@ -204,8 +204,7 @@ public class FloorRenderer implements Disposable{ int chunksx = Mathf.ceil((float)(world.width()) / chunksize), chunksy = Mathf.ceil((float)(world.height()) / chunksize); cache = new Chunk[chunksx][chunksy]; - SpriteCache sprites = new SpriteCache(world.width() * world.height() * 6, (world.width() / chunksize) * (world.height() / chunksize) * 2, false); - cbatch = new CacheBatch(sprites); + cbatch = new MultiCacheBatch(chunksize * chunksize * 4); Time.mark(); diff --git a/core/src/io/anuke/mindustry/world/Tile.java b/core/src/io/anuke/mindustry/world/Tile.java index 05e0f6c1ac..e67be3d812 100644 --- a/core/src/io/anuke/mindustry/world/Tile.java +++ b/core/src/io/anuke/mindustry/world/Tile.java @@ -104,6 +104,10 @@ public class Tile implements Position, TargetTrait{ return block().offset() + worldy(); } + public boolean isDarkened(){ + return block().solid && !block().synthetic() && block().fillsTile; + } + public Floor floor(){ return floor; } diff --git a/core/src/io/anuke/mindustry/world/blocks/StaticWall.java b/core/src/io/anuke/mindustry/world/blocks/StaticWall.java index 79a9b6f1d7..0797fee02a 100644 --- a/core/src/io/anuke/mindustry/world/blocks/StaticWall.java +++ b/core/src/io/anuke/mindustry/world/blocks/StaticWall.java @@ -10,6 +10,7 @@ import static io.anuke.mindustry.Vars.*; public class StaticWall extends Rock{ TextureRegion large; + TextureRegion[][] split; public StaticWall(String name){ super(name); @@ -25,9 +26,7 @@ public class StaticWall extends Rock{ int ry = tile.y / 2 * 2; if(Core.atlas.isFound(large) && eq(rx, ry) && Mathf.randomSeed(Pos.get(rx, ry)) < 0.5){ - if(rx == tile.x && ry == tile.y){ - Draw.rect(large, tile.worldx() + tilesize / 2f, tile.worldy() + tilesize / 2f); - } + Draw.rect(split[tile.x % 2][1 - tile.y % 2], tile.worldx(), tile.worldy()); }else if(variants > 0){ Draw.rect(variantRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, variantRegions.length - 1))], tile.worldx(), tile.worldy()); }else{ @@ -39,6 +38,7 @@ public class StaticWall extends Rock{ public void load(){ super.load(); large = Core.atlas.find(name + "-large"); + split = large.split(32, 32); } boolean eq(int rx, int ry){ diff --git a/desktop/build.gradle b/desktop/build.gradle index 2a99053dc6..1d095446b8 100644 --- a/desktop/build.gradle +++ b/desktop/build.gradle @@ -99,7 +99,7 @@ PackrConfig.Platform.values().each{ platform -> new Packr().pack(config) - if(platform == PackrConfig.Platform.Linux64){ + if(platform != PackrConfig.Platform.MacOS){ copy{ into "build/packr/output/jre/" from "build/packr/output/desktop.jar" @@ -123,6 +123,14 @@ PackrConfig.Platform.values().each{ platform -> } } } + + if((platform == PackrConfig.Platform.Windows64 || platform == PackrConfig.Platform.Windows32)){ + copy{ + from "build/packr/output/jre/bin/msvcr100.dll" + into "build/packr/output/" + rename("msvcr100.dll", "MSVCR100.dll") + } + } } task "zip${platform.toString()}"(type: Zip){