1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-11-11 03:31:19 +03:00

Fixed black tile issue

This commit is contained in:
Anuken 2019-08-25 11:16:38 -04:00
parent fd973038bb
commit 5c6f2171f4
5 changed files with 36 additions and 11 deletions

View File

@ -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);
}
}
}
}

View File

@ -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<CacheLayer> 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();

View File

@ -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;
}

View File

@ -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){

View File

@ -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){