Colored floor map preview fix
This commit is contained in:
@@ -77,6 +77,12 @@ public class MapIO{
|
|||||||
Pixmap walls = new Pixmap(map.width, map.height);
|
Pixmap walls = new Pixmap(map.width, map.height);
|
||||||
int black = 255;
|
int black = 255;
|
||||||
int shade = Color.rgba8888(0f, 0f, 0f, 0.5f);
|
int shade = Color.rgba8888(0f, 0f, 0f, 0.5f);
|
||||||
|
|
||||||
|
int width = map.width, height = map.height;
|
||||||
|
int len = width*height;
|
||||||
|
short[] floorIds = new short[len];
|
||||||
|
boolean[] overlays = new boolean[len];
|
||||||
|
|
||||||
CachedTile tile = new CachedTile(){
|
CachedTile tile = new CachedTile(){
|
||||||
@Override
|
@Override
|
||||||
public void setBlock(Block type){
|
public void setBlock(Block type){
|
||||||
@@ -139,20 +145,23 @@ public class MapIO{
|
|||||||
if(content.block(overlayID) == Blocks.spawn){
|
if(content.block(overlayID) == Blocks.spawn){
|
||||||
map.spawns ++;
|
map.spawns ++;
|
||||||
}
|
}
|
||||||
|
floorIds[x + y * width] = (short)floorID;
|
||||||
|
overlays[x + y * width] = overlayID != 0;
|
||||||
return tile;
|
return tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReadTileData(){
|
public void onReadTileData(){
|
||||||
//colored floor/wall tile data will affect the map preview
|
Block block = tile.block();
|
||||||
|
Block floor = content.block(floorIds[tile.x + tile.y*width]);
|
||||||
|
|
||||||
if(!tile.block().synthetic() && tile.block() != Blocks.air){
|
if(!block.synthetic() && block != Blocks.air){
|
||||||
int color = tile.block().minimapColor(tile);
|
int color = block.minimapColor(tile);
|
||||||
if(color != 0){
|
if(color != 0){
|
||||||
walls.set(tile.x, walls.height - 1 - tile.y, color);
|
walls.set(tile.x, walls.height - 1 - tile.y, color);
|
||||||
}
|
}
|
||||||
}else if(tile.overlay() == Blocks.air && tile.block() == Blocks.air){
|
}else if(!overlays[tile.array()] && block == Blocks.air){
|
||||||
int color = tile.floor().minimapColor(tile);
|
int color = floor.minimapColor(tile);
|
||||||
if(color != 0){
|
if(color != 0){
|
||||||
floors.set(tile.x, floors.height - 1 - tile.y, color);
|
floors.set(tile.x, floors.height - 1 - tile.y, color);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user