Temporary measure to reduce atlas size

This commit is contained in:
Anuken
2021-12-10 11:55:17 -05:00
parent 3e9747c59c
commit 9614997482
3 changed files with 34 additions and 7 deletions

View File

@@ -21,7 +21,8 @@ import static arc.Core.*;
import static mindustry.Vars.*;
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 Color shadowColor = new Color(0, 0, 0, 0.71f), blendShadowColor = Color.white.cpy().lerp(Color.black, shadowColor.a);

View File

@@ -69,7 +69,6 @@ public class LightRenderer{
float u2 = lmid.u2;
float v2 = lmid.v;
Vec2 v1 = Tmp.v1.trnsExact(rot + 90f, stroke);
float lx1 = x - v1.x, ly1 = y - v1.y,
lx2 = x + v1.x, ly2 = y + v1.y,

View File

@@ -21,6 +21,8 @@ import mindustry.world.blocks.environment.*;
import static mindustry.Vars.*;
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 TilePreChangeEvent preChange = new TilePreChangeEvent();
private static final ObjectSet<Building> tileSet = new ObjectSet<>();
@@ -530,9 +532,7 @@ public class Tile implements Position, QuadTreeObject, Displayable{
}
protected void preChanged(){
if(!world.isGenerating()){
Events.fire(preChange.set(this));
}
firePreChange();
if(build != null){
//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
if(other != this){ //do not remove own entity so it can be processed in changed()
//manually call pre-change event for other tile
Events.fire(preChange.set(other));
other.firePreChange();
other.build = null;
other.block = Blocks.air;
@@ -619,7 +619,34 @@ public class Tile implements Position, QuadTreeObject, Displayable{
protected void fireChanged(){
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;
}
}
}