Minor optimization
This commit is contained in:
@@ -31,14 +31,14 @@ public interface Autotiler{
|
||||
default TextureRegion topHalf(TextureRegion input){
|
||||
TextureRegion region = Tmp.tr1;
|
||||
region.set(input);
|
||||
region.setWidth(region.getWidth() / 2);
|
||||
region.setWidth(region.width / 2);
|
||||
return region;
|
||||
}
|
||||
|
||||
default TextureRegion botHalf(TextureRegion input){
|
||||
TextureRegion region = Tmp.tr1;
|
||||
region.set(input);
|
||||
int width = region.getWidth();
|
||||
int width = region.width;
|
||||
region.setWidth(width / 2);
|
||||
region.setX(region.getX() + width);
|
||||
return region;
|
||||
|
||||
@@ -142,7 +142,7 @@ public class LaunchPad extends Block{
|
||||
Draw.z(Layer.weather - 1);
|
||||
|
||||
TextureRegion region = Core.atlas.find("launchpod");
|
||||
float rw = region.getWidth() * Draw.scl * scale, rh = region.getHeight() * Draw.scl * scale;
|
||||
float rw = region.width * Draw.scl * scale, rh = region.height * Draw.scl * scale;
|
||||
|
||||
Draw.alpha(alpha);
|
||||
Draw.rect(region, cx, cy, rw, rh, rotation);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
if(bits == null) return;
|
||||
|
||||
TextureRegion region = regions[bits[0]][0];
|
||||
Draw.rect(region, req.drawx(), req.drawy(), region.getWidth() * bits[1] * Draw.scl, region.getHeight() * bits[2] * Draw.scl, req.rotation * 90);
|
||||
Draw.rect(region, req.drawx(), req.drawy(), region.width * bits[1] * Draw.scl, region.height * bits[2] * Draw.scl, req.rotation * 90);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,7 +17,7 @@ import mindustry.world.blocks.production.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class PayloadConveyor extends Block{
|
||||
public float moveTime = 60f;
|
||||
public float moveTime = 50f;
|
||||
public @Load("@-top") TextureRegion topRegion;
|
||||
public @Load("@-edge") TextureRegion edgeRegion;
|
||||
public Interp interp = Interp.pow5;
|
||||
@@ -155,20 +155,20 @@ public class PayloadConveyor extends Block{
|
||||
float s = tilesize * size;
|
||||
|
||||
//next
|
||||
Tmp.v1.set((s-clipped.getWidth()*Draw.scl) + clipped.getWidth()/2f*Draw.scl - s/2f, s-clipped.getHeight()*Draw.scl + clipped.getHeight()/2f*Draw.scl - s/2f).rotate(rot);
|
||||
Tmp.v1.set((s- clipped.width *Draw.scl) + clipped.width /2f*Draw.scl - s/2f, s- clipped.height *Draw.scl + clipped.height /2f*Draw.scl - s/2f).rotate(rot);
|
||||
Draw.rect(clipped, x + Tmp.v1.x, y + Tmp.v1.y, rot);
|
||||
|
||||
clipped = clipRegion(tile.getHitbox(Tmp.r1), tile.getHitbox(Tmp.r2).move(trprev, 0), topRegion);
|
||||
|
||||
//prev
|
||||
Tmp.v1.set(- s/2f + clipped.getWidth()/2f*Draw.scl, - s/2f + clipped.getHeight()/2f*Draw.scl).rotate(rot);
|
||||
Tmp.v1.set(- s/2f + clipped.width /2f*Draw.scl, - s/2f + clipped.height /2f*Draw.scl).rotate(rot);
|
||||
Draw.rect(clipped, x + Tmp.v1.x, y + Tmp.v1.y, rot);
|
||||
|
||||
for(int i = 0; i < 4; i++){
|
||||
if(blends(i) && i != rotation){
|
||||
Draw.alpha(1f - Interp.pow5In.apply(fract()));
|
||||
//prev from back
|
||||
Tmp.v1.set(- s/2f + clipped.getWidth()/2f*Draw.scl, - s/2f + clipped.getHeight()/2f*Draw.scl).rotate(i * 90 + 180);
|
||||
Tmp.v1.set(- s/2f + clipped.width /2f*Draw.scl, - s/2f + clipped.height /2f*Draw.scl).rotate(i * 90 + 180);
|
||||
Draw.rect(clipped, x + Tmp.v1.x, y + Tmp.v1.y, i * 90 + 180);
|
||||
}
|
||||
}
|
||||
@@ -268,9 +268,9 @@ public class PayloadConveyor extends Block{
|
||||
out.set(region.getTexture());
|
||||
|
||||
if(overlaps){
|
||||
float w = region.getU2() - region.getU();
|
||||
float h = region.getV2() - region.getV();
|
||||
float x = region.getU(), y = region.getV();
|
||||
float w = region.u2 - region.u;
|
||||
float h = region.v2 - region.v;
|
||||
float x = region.u, y = region.v;
|
||||
float newX = (over.x - sprite.x) / sprite.width * w + x;
|
||||
float newY = (over.y - sprite.y) / sprite.height * h + y;
|
||||
float newW = (over.width / sprite.width) * w, newH = (over.height / sprite.height) * h;
|
||||
|
||||
@@ -16,7 +16,7 @@ public class StaticTree extends StaticWall{
|
||||
public void drawBase(Tile tile){
|
||||
TextureRegion r = Tmp.tr1;
|
||||
r.set(region);
|
||||
int crop = (region.getWidth() - tilesize*4) / 2;
|
||||
int crop = (region.width - tilesize*4) / 2;
|
||||
float ox = 0;
|
||||
float oy = 0;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class StaticTree extends StaticWall{
|
||||
if(tile.getNearby(i) != null && tile.getNearby(i).block() instanceof StaticWall){
|
||||
|
||||
if(i == 0){
|
||||
r.setWidth(r.getWidth() - crop);
|
||||
r.setWidth(r.width - crop);
|
||||
ox -= crop /2f;
|
||||
}else if(i == 1){
|
||||
r.setY(r.getY() + crop);
|
||||
@@ -33,7 +33,7 @@ public class StaticTree extends StaticWall{
|
||||
r.setX(r.getX() + crop);
|
||||
ox += crop /2f;
|
||||
}else{
|
||||
r.setHeight(r.getHeight() - crop);
|
||||
r.setHeight(r.height - crop);
|
||||
oy += crop /2f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class TreeBlock extends Block{
|
||||
|
||||
float x = tile.worldx(), y = tile.worldy();
|
||||
float rot = Mathf.randomSeed(tile.pos(), 0, 4) * 90 + Mathf.sin(Time.time() + x, 50f, 0.5f) + Mathf.sin(Time.time() - y, 65f, 0.9f) + Mathf.sin(Time.time() + y - x, 85f, 0.9f);
|
||||
float w = region.getWidth() * Draw.scl, h = region.getHeight() * Draw.scl;
|
||||
float w = region.width * Draw.scl, h = region.height * Draw.scl;
|
||||
float scl = 30f, mag = 0.2f;
|
||||
|
||||
if(shadow.found()){
|
||||
|
||||
@@ -146,9 +146,6 @@ public class PowerNode extends PowerBlock{
|
||||
}
|
||||
|
||||
protected void drawLaser(Team team, float x1, float y1, float x2, float y2, float satisfaction, int size1, int size2){
|
||||
float opacity = Core.settings.getInt("lasersopacity") / 100f;
|
||||
if(Mathf.zero(opacity)) return;
|
||||
|
||||
float angle1 = Angles.angle(x1, y1, x2, y2);
|
||||
t1.trns(angle1, size1 * tilesize / 2f - 1.5f);
|
||||
t2.trns(angle1 + 180f, size2 * tilesize / 2f - 1.5f);
|
||||
@@ -161,7 +158,7 @@ public class PowerNode extends PowerBlock{
|
||||
float fract = 1f - satisfaction;
|
||||
|
||||
Draw.color(laserColor1, laserColor2, fract * 0.86f + Mathf.absin(3f, 0.1f));
|
||||
Draw.alpha(opacity);
|
||||
Draw.alpha(renderer.laserOpacity);
|
||||
Drawf.laser(team, laser, laserEnd, x1, y1, x2, y2, 0.25f);
|
||||
Draw.color();
|
||||
}
|
||||
@@ -386,7 +383,7 @@ public class PowerNode extends PowerBlock{
|
||||
public void draw(){
|
||||
super.draw();
|
||||
|
||||
if(Core.settings.getInt("lasersopacity") == 0) return;
|
||||
if(Mathf.zero(renderer.laserOpacity)) return;
|
||||
|
||||
Draw.z(Layer.power);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user