Merge branch 'unsector'

# Conflicts:
#	core/src/io/anuke/mindustry/maps/SectorPresets.java
#	core/src/io/anuke/mindustry/maps/Sectors.java
#	core/src/io/anuke/mindustry/maps/TutorialSector.java
#	core/src/io/anuke/mindustry/maps/generation/FortressGenerator.java
#	core/src/io/anuke/mindustry/maps/missions/MissionWithStartingCore.java
#	core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java
This commit is contained in:
Anuken
2019-01-08 22:28:13 -05:00
53 changed files with 68 additions and 2445 deletions

View File

@@ -21,6 +21,7 @@ import static io.anuke.mindustry.Vars.*;
public class BlockRenderer{
private final static int initialRequests = 32 * 32;
private final static int expandr = 6;
private final static boolean disableShadows = true;
public final FloorRenderer floor = new FloorRenderer();
@@ -53,6 +54,8 @@ public class BlockRenderer{
}
public void drawShadows(){
if(disableShadows) return;
if(shadows.getWidth() != Core.graphics.getWidth() || shadows.getHeight() != Core.graphics.getHeight()){
shadows.resize(Core.graphics.getWidth(), Core.graphics.getHeight());
}
@@ -107,7 +110,6 @@ public class BlockRenderer{
if(tile != null){
Block block = tile.block();
Team team = tile.getTeam();
if(!expanded && block != Blocks.air && world.isAccessible(x, y)){
tile.block().drawShadow(tile);
@@ -133,8 +135,6 @@ public class BlockRenderer{
}
}
Draw.proj(camera.projection());
Sort.instance().sort(requests.items, 0, requestidx);
lastCamX = avgx;

View File

@@ -11,6 +11,7 @@ import io.anuke.arc.graphics.GL20;
import io.anuke.arc.graphics.g2d.CacheBatch;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.SpriteBatch;
import io.anuke.arc.graphics.g2d.SpriteCache;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.util.Log;
import io.anuke.arc.util.Structs;
@@ -30,6 +31,7 @@ public class FloorRenderer{
private CacheBatch cbatch;
private IntSet drawnLayerSet = new IntSet();
private IntArray drawnLayers = new IntArray();
private ObjectSet<CacheLayer> used = new ObjectSet<>();
public FloorRenderer(){
Events.on(WorldLoadEvent.class, event -> clearTiles());
@@ -111,6 +113,10 @@ public class FloorRenderer{
cbatch.endDraw();
}
public void updateFloor(Tile tile){
//TODO: implement
}
public void drawLayer(CacheLayer layer){
if(cache == null){
return;
@@ -142,10 +148,9 @@ public class FloorRenderer{
}
private void cacheChunk(int cx, int cy){
used.clear();
Chunk chunk = cache[cx][cy];
ObjectSet<CacheLayer> used = new ObjectSet<>();
for(int tilex = cx * chunksize; tilex < (cx + 1) * chunksize; tilex++){
for(int tiley = cy * chunksize; tiley < (cy + 1) * chunksize; tiley++){
Tile tile = world.tile(tilex, tiley);
@@ -180,8 +185,6 @@ public class FloorRenderer{
if(floor.cacheLayer == layer){
floor.draw(tile);
}else if(floor.cacheLayer.ordinal() < layer.ordinal()){
floor.drawNonLayer(tile);
}
}
}
@@ -195,7 +198,8 @@ public class FloorRenderer{
int chunksx = Mathf.ceil((float) (world.width()) / chunksize),
chunksy = Mathf.ceil((float) (world.height()) / chunksize) ;
cache = new Chunk[chunksx][chunksy];
cbatch = new CacheBatch(world.width() * world.height() * 4 * 4);
SpriteCache sprites = new SpriteCache(world.width() * world.height(), (world.width() / chunksize) * (world.height() / chunksize) * 2, false);
cbatch = new CacheBatch(sprites);
Time.mark();

View File

@@ -26,10 +26,6 @@ public class OverlayRenderer{
for(Player player : players){
InputHandler input = control.input(player.playerIndex);
if(world.getSector() != null){
world.getSector().currentMission().drawOverlay();
}
if(!input.isDrawing() || player.isDead()) continue;
Shaders.outline.color.set(Palette.accent);