Editor generation cleanup

This commit is contained in:
Anuken
2020-10-22 19:26:55 -04:00
parent 4f21ea7799
commit 514e2503fa
5 changed files with 47 additions and 89 deletions

View File

@@ -80,7 +80,7 @@ public class MapIO{
@Override
public void setBlock(Block type){
super.setBlock(type);
int c = colorFor(Blocks.air, block(), Blocks.air, team());
int c = colorFor(block(), Blocks.air, Blocks.air, team());
if(c != black){
walls.draw(x, floors.getHeight() - 1 - y, c);
floors.draw(x, floors.getHeight() - 1 - y + 1, shade);
@@ -119,7 +119,7 @@ public class MapIO{
if(overlayID != 0){
floors.draw(x, floors.getHeight() - 1 - y, colorFor(Blocks.air, Blocks.air, content.block(overlayID), Team.derelict));
}else{
floors.draw(x, floors.getHeight() - 1 - y, colorFor(content.block(floorID), Blocks.air, Blocks.air, Team.derelict));
floors.draw(x, floors.getHeight() - 1 - y, colorFor(Blocks.air, content.block(floorID), Blocks.air, Team.derelict));
}
if(content.block(overlayID) == Blocks.spawn){
map.spawns ++;
@@ -141,17 +141,17 @@ public class MapIO{
for(int x = 0; x < pixmap.getWidth(); x++){
for(int y = 0; y < pixmap.getHeight(); y++){
Tile tile = tiles.getn(x, y);
pixmap.draw(x, pixmap.getHeight() - 1 - y, colorFor(tile.floor(), tile.block(), tile.overlay(), tile.team()));
pixmap.draw(x, pixmap.getHeight() - 1 - y, colorFor(tile.block(), tile.floor(), tile.overlay(), tile.team()));
}
}
return pixmap;
}
public static int colorFor(Block floor, Block wall, Block ore, Team team){
public static int colorFor(Block wall, Block floor, Block overlay, Team team){
if(wall.synthetic()){
return team.color.rgba();
}
return (wall.solid ? wall.mapColor : !ore.useColor ? floor.mapColor : ore.mapColor).rgba();
return (wall.solid ? wall.mapColor : !overlay.useColor ? floor.mapColor : overlay.mapColor).rgba();
}
public static Pixmap writeImage(Tiles tiles){