Temporary measure to reduce atlas size
This commit is contained in:
@@ -21,7 +21,8 @@ import static arc.Core.*;
|
|||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class BlockRenderer{
|
public class BlockRenderer{
|
||||||
public static final int crackRegions = 8, maxCrackSize = 9;
|
//TODO cracks take up far to much space, so I had to limit it to 7. this means larger blocks won't have cracks - draw tiling mirrored stuff instead?
|
||||||
|
public static final int crackRegions = 8, maxCrackSize = 7;
|
||||||
|
|
||||||
private static final int initialRequests = 32 * 32;
|
private static final int initialRequests = 32 * 32;
|
||||||
private static final Color shadowColor = new Color(0, 0, 0, 0.71f), blendShadowColor = Color.white.cpy().lerp(Color.black, shadowColor.a);
|
private static final Color shadowColor = new Color(0, 0, 0, 0.71f), blendShadowColor = Color.white.cpy().lerp(Color.black, shadowColor.a);
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ public class LightRenderer{
|
|||||||
float u2 = lmid.u2;
|
float u2 = lmid.u2;
|
||||||
float v2 = lmid.v;
|
float v2 = lmid.v;
|
||||||
|
|
||||||
|
|
||||||
Vec2 v1 = Tmp.v1.trnsExact(rot + 90f, stroke);
|
Vec2 v1 = Tmp.v1.trnsExact(rot + 90f, stroke);
|
||||||
float lx1 = x - v1.x, ly1 = y - v1.y,
|
float lx1 = x - v1.x, ly1 = y - v1.y,
|
||||||
lx2 = x + v1.x, ly2 = y + v1.y,
|
lx2 = x + v1.x, ly2 = y + v1.y,
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ import mindustry.world.blocks.environment.*;
|
|||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class Tile implements Position, QuadTreeObject, Displayable{
|
public class Tile implements Position, QuadTreeObject, Displayable{
|
||||||
|
private static boolean tileChangeLock = false;
|
||||||
|
private static boolean tilePreChangeLock = false;
|
||||||
private static final TileChangeEvent tileChange = new TileChangeEvent();
|
private static final TileChangeEvent tileChange = new TileChangeEvent();
|
||||||
private static final TilePreChangeEvent preChange = new TilePreChangeEvent();
|
private static final TilePreChangeEvent preChange = new TilePreChangeEvent();
|
||||||
private static final ObjectSet<Building> tileSet = new ObjectSet<>();
|
private static final ObjectSet<Building> tileSet = new ObjectSet<>();
|
||||||
@@ -530,9 +532,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void preChanged(){
|
protected void preChanged(){
|
||||||
if(!world.isGenerating()){
|
firePreChange();
|
||||||
Events.fire(preChange.set(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(build != null){
|
if(build != null){
|
||||||
//only call removed() for the center block - this only gets called once.
|
//only call removed() for the center block - this only gets called once.
|
||||||
@@ -552,7 +552,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
|||||||
//reset entity and block *manually* - thus, preChanged() will not be called anywhere else, for multiblocks
|
//reset entity and block *manually* - thus, preChanged() will not be called anywhere else, for multiblocks
|
||||||
if(other != this){ //do not remove own entity so it can be processed in changed()
|
if(other != this){ //do not remove own entity so it can be processed in changed()
|
||||||
//manually call pre-change event for other tile
|
//manually call pre-change event for other tile
|
||||||
Events.fire(preChange.set(other));
|
other.firePreChange();
|
||||||
|
|
||||||
other.build = null;
|
other.build = null;
|
||||||
other.block = Blocks.air;
|
other.block = Blocks.air;
|
||||||
@@ -619,7 +619,34 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
|||||||
|
|
||||||
protected void fireChanged(){
|
protected void fireChanged(){
|
||||||
if(!world.isGenerating()){
|
if(!world.isGenerating()){
|
||||||
Events.fire(tileChange.set(this));
|
|
||||||
|
//A TileChangeEvent may cause other TileChangeEvents to occur, and if that happens, allocate a new instance.
|
||||||
|
boolean wasLocked = tileChangeLock;
|
||||||
|
var eventInst = wasLocked ? new TileChangeEvent() : tileChange;
|
||||||
|
tileChangeLock = true;
|
||||||
|
|
||||||
|
Events.fire(eventInst.set(this));
|
||||||
|
|
||||||
|
//unlock after it's done
|
||||||
|
if(!wasLocked){
|
||||||
|
tileChangeLock = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void firePreChange(){
|
||||||
|
if(!world.isGenerating()){
|
||||||
|
|
||||||
|
//same as above
|
||||||
|
boolean wasLocked = tilePreChangeLock;
|
||||||
|
var eventInst = wasLocked ? new TilePreChangeEvent() : preChange;
|
||||||
|
tilePreChangeLock = true;
|
||||||
|
|
||||||
|
Events.fire(eventInst.set(this));
|
||||||
|
|
||||||
|
if(!wasLocked){
|
||||||
|
tilePreChangeLock = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user