Editor variant display / Visual changes

This commit is contained in:
Anuken
2019-01-24 13:11:22 -05:00
parent 9a444da343
commit dd4f4b83fc
15 changed files with 1812 additions and 1706 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 B

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 B

After

Width:  |  Height:  |  Size: 1.3 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1005 KiB

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@ -33,7 +33,7 @@ public class Blocks implements ContentList{
//environment
air, part, spawn, space, metalfloor, deepwater, water, tar, stone, craters, charr, blackstone, dirt, sand, ice, snow,
grass, shrub, rock, icerock, blackrock, rocks, pine,
grass, shrub, rock, icerock, blackrock, rocks, cliffs, pine,
//crafting
siliconSmelter, graphitePress, plastaniumCompressor, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer,
@ -154,6 +154,7 @@ public class Blocks implements ContentList{
craters = new Floor("craters"){{
minimapColor = Color.valueOf("323232");
variants = 6;
}};
charr = new Floor("char"){{
@ -200,6 +201,11 @@ public class Blocks implements ContentList{
variants = 2;
}};
cliffs = new StaticWall("cliffs"){{
variants = 1;
fillsTile = false;
}};
icerock = new Rock("icerock"){{
variants = 2;
}};

View File

@ -58,7 +58,7 @@ public class Zones implements ContentList{
}};
}};
craters = new Zone("craters", new MapGenerator("craters", 1){{ distortion = 1.44f; }}){{
craters = new Zone("craters", new MapGenerator("craters", 1){{ distortion = 0; }}){{
alwaysUnlocked = true;
deployCost = ItemStack.with(Items.copper, 300);
@ -91,6 +91,7 @@ public class Zones implements ContentList{
new SpawnGroup(UnitTypes.crawler){{
begin = 15;
unitScaling = 1;
unitAmount = 2;
}},
new SpawnGroup(UnitTypes.dagger){{
@ -101,6 +102,7 @@ public class Zones implements ContentList{
new SpawnGroup(UnitTypes.crawler){{
begin = 25;
unitScaling = 1;
unitAmount = 2;
}}
);
}};

View File

@ -6,6 +6,7 @@ import io.anuke.arc.collection.IntSet.IntSetIterator;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.TextureRegion;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.util.Disposable;
import io.anuke.arc.util.Pack;
import io.anuke.mindustry.content.Blocks;
@ -128,7 +129,7 @@ public class MapRenderer implements Disposable{
region.getWidth() * Draw.scl, region.getHeight() * Draw.scl);
}
}else{
region = floor.icon(Icon.full);
region = floor.variantRegions()[Mathf.randomSeed(idxWall, 0, floor.variantRegions().length-1)];
mesh.draw(idxWall, region, wx * tilesize, wy * tilesize, 8, 8);
}

View File

@ -186,7 +186,7 @@ public class FloorRenderer{
if(tile.block().cacheLayer == layer && layer == CacheLayer.walls){
tile.block().draw(tile);
}else if(floor.cacheLayer == layer && (tile.block().cacheLayer != CacheLayer.walls || !tile.block().fillsTile)){
}else if(floor.cacheLayer == layer && (world.isAccessible(tile.x,tile.y) || tile.block().cacheLayer != CacheLayer.walls || !tile.block().fillsTile)){
floor.draw(tile);
}
}
@ -201,7 +201,7 @@ public class FloorRenderer{
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() * 2, (world.width() / chunksize) * (world.height() / chunksize) * 2, false);
SpriteCache sprites = new SpriteCache(world.width() * world.height() * 3, (world.width() / chunksize) * (world.height() / chunksize) * 2, false);
cbatch = new CacheBatch(sprites);
Time.mark();

View File

@ -114,6 +114,7 @@ public class Block extends BlockStorage{
protected Array<Tile> tempTiles = new Array<>();
protected TextureRegion[] icons = new TextureRegion[Icon.values().length];
protected TextureRegion[] generatedIcons;
protected TextureRegion[] variants;
protected TextureRegion region;
public Block(String name){
@ -509,6 +510,13 @@ public class Block extends BlockStorage{
return generatedIcons;
}
public TextureRegion[] variantRegions(){
if(variants == null){
variants = new TextureRegion[]{icon(Icon.full)};
}
return variants;
}
public boolean hasEntity(){
return destructible || update;
}

View File

@ -73,6 +73,11 @@ public class Floor extends Block{
region = variantRegions[0];
}
@Override
public TextureRegion[] variantRegions(){
return variantRegions;
}
@Override
public void init(){
super.init();

View File

@ -8,7 +8,7 @@ import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.math.Mathf;
public class Rock extends Block{
protected TextureRegion[] shadowRegions, regions;
protected TextureRegion[] regions;
protected int variants;
public Rock(String name){
@ -28,6 +28,11 @@ public class Rock extends Block{
Draw.color();
}
@Override
public TextureRegion[] variantRegions(){
return regions;
}
@Override
public TextureRegion[] generateIcons(){
return variants == 0 ? super.generateIcons() : new TextureRegion[]{Core.atlas.find(name + "1")};
@ -38,11 +43,9 @@ public class Rock extends Block{
super.load();
if(variants > 0){
shadowRegions = new TextureRegion[variants];
regions = new TextureRegion[variants];
for(int i = 0; i < variants; i++){
shadowRegions[i] = Core.atlas.find(name + "shadow" + (i + 1));
regions[i] = Core.atlas.find(name + (i + 1));
}
}

View File

@ -1,8 +1,12 @@
package io.anuke.mindustry.world.blocks;
import io.anuke.arc.Core;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.TextureRegion;
import io.anuke.mindustry.graphics.CacheLayer;
public class StaticWall extends Rock{
TextureRegion[][] regions;
public StaticWall(String name){
super(name);
@ -10,4 +14,11 @@ public class StaticWall extends Rock{
solid = true;
cacheLayer = CacheLayer.walls;
}
@Override
public void load(){
super.load();
int size = (int)(8 / Draw.scl);
regions = Core.atlas.find("mountains-tiles").split(size, size);
}
}