Massive amount of bugfixes, too many to list in commit log
This commit is contained in:
@@ -64,31 +64,31 @@ public class BlockRenderer{
|
||||
int worldx = Mathf.scl(camera.position.x, tilesize) + x;
|
||||
int worldy = Mathf.scl(camera.position.y, tilesize) + y;
|
||||
boolean expanded = (x < -rangex || x > rangex || y < -rangey || y > rangey);
|
||||
|
||||
Tile tile = world.tile(worldx, worldy);
|
||||
|
||||
if(tile != null){
|
||||
Block block = tile.block();
|
||||
|
||||
if(!expanded && block != Blocks.air && world.isAccessible(worldx, worldy)){
|
||||
synchronized (Tile.tileSetLock) {
|
||||
|
||||
synchronized (Tile.tileSetLock) {
|
||||
Tile tile = world.tile(worldx, worldy);
|
||||
|
||||
if (tile != null) {
|
||||
Block block = tile.block();
|
||||
|
||||
if (!expanded && block != Blocks.air && world.isAccessible(worldx, worldy)) {
|
||||
tile.block().drawShadow(tile);
|
||||
}
|
||||
}
|
||||
|
||||
if(!(block instanceof StaticBlock)){
|
||||
if(block != Blocks.air){
|
||||
if(!expanded){
|
||||
addRequest(tile, Layer.block);
|
||||
}
|
||||
|
||||
if(block.expanded || !expanded){
|
||||
if(block.layer != null && block.isLayer(tile)){
|
||||
addRequest(tile, block.layer);
|
||||
if (!(block instanceof StaticBlock)) {
|
||||
if (block != Blocks.air) {
|
||||
if (!expanded) {
|
||||
addRequest(tile, Layer.block);
|
||||
}
|
||||
|
||||
if(block.layer2 != null && block.isLayer2(tile)){
|
||||
addRequest(tile, block.layer2);
|
||||
if (block.expanded || !expanded) {
|
||||
if (block.layer != null && block.isLayer(tile)) {
|
||||
addRequest(tile, block.layer);
|
||||
}
|
||||
|
||||
if (block.layer2 != null && block.isLayer2(tile)) {
|
||||
addRequest(tile, block.layer2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.function.Callable;
|
||||
import io.anuke.ucore.graphics.CapStyle;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Fill;
|
||||
import io.anuke.ucore.graphics.Lines;
|
||||
@@ -123,11 +122,11 @@ public class OverlayRenderer {
|
||||
drawbars.run();
|
||||
|
||||
if(values[0] > 0){
|
||||
drawEncloser(target.drawx(), target.drawy() + block.size * tilesize/2f + 2f + values[0]/2f - 0.5f + (values[0] > 1 ? 0.75f : 0), values[0]);
|
||||
drawEncloser(target.drawx(), target.drawy() + block.size * tilesize/2f + 2f, values[0]);
|
||||
}
|
||||
|
||||
if(values[1] > 0){
|
||||
drawEncloser(target.drawx(), target.drawy() - block.size * tilesize/2f - 2f - values[1]/2f - 0.5f, values[1]);
|
||||
drawEncloser(target.drawx(), target.drawy() - block.size * tilesize/2f - 2f - values[1], values[1]);
|
||||
}
|
||||
|
||||
doDraw[0] = true;
|
||||
@@ -208,15 +207,11 @@ public class OverlayRenderer {
|
||||
}
|
||||
|
||||
void drawEncloser(float x, float y, float height){
|
||||
x -= 0.5f;
|
||||
y += 0.5f - (height-1f)/2f;
|
||||
|
||||
float len = 3;
|
||||
|
||||
Lines.stroke(2f + height);
|
||||
Draw.color(Palette.bar);
|
||||
Lines.line(x - len - 0.5f, y, x + len + 1.5f, y, CapStyle.none);
|
||||
|
||||
Draw.reset();
|
||||
Fill.crect(x - len - 1, y - 1, len*2f + 2f, height + 2f);
|
||||
Draw.color();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.anuke.mindustry.graphics;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.FloatArray;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Fill;
|
||||
@@ -9,14 +10,20 @@ import io.anuke.ucore.util.Mathf;
|
||||
|
||||
/**Class that renders a trail.*/
|
||||
public class Trail {
|
||||
private final static float maxJump = 15f;
|
||||
private final int length;
|
||||
private final FloatArray points = new FloatArray();
|
||||
private float lastX, lastY;
|
||||
|
||||
public Trail(int length){
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public synchronized void update(float curx, float cury){
|
||||
if(Vector2.dst(curx, cury, lastX, lastY) >= maxJump){
|
||||
points.clear();
|
||||
}
|
||||
|
||||
points.add(curx, cury);
|
||||
|
||||
if(points.size > length*2) {
|
||||
@@ -24,6 +31,9 @@ public class Trail {
|
||||
System.arraycopy(items, 2, items, 0, points.size - 2);
|
||||
points.size -= 2;
|
||||
}
|
||||
|
||||
lastX = curx;
|
||||
lastY = cury;
|
||||
}
|
||||
|
||||
public synchronized void clear(){
|
||||
|
||||
Reference in New Issue
Block a user