Support of mods with textures in different resolution (HD or low-res) (#7602)
* HDustry - scl() & private map Co-Authored-By: citrusMarmelade <20476281+citrusMarmelade@users.noreply.github.com> * MEEP stop doing stuff when i work <3 <3 * Replaced Draw.scl Co-authored-by: citrusMarmelade <20476281+citrusMarmelade@users.noreply.github.com> Co-authored-by: Anuken <arnukren@gmail.com>
This commit is contained in:
@@ -54,10 +54,10 @@ public class Fx{
|
||||
unitSpawn = new Effect(30f, e -> {
|
||||
if(!(e.data instanceof UnitType unit)) return;
|
||||
|
||||
float scl = 1f + e.fout() * 2f;
|
||||
|
||||
TextureRegion region = unit.fullIcon;
|
||||
|
||||
float scl = (1f + e.fout() * 2f) * region.scl();
|
||||
|
||||
alpha(e.fout());
|
||||
mixcol(Color.white, e.fin());
|
||||
|
||||
@@ -67,7 +67,7 @@ public class Fx{
|
||||
|
||||
alpha(e.fin());
|
||||
|
||||
rect(region, e.x, e.y, region.width * Draw.scl * scl, region.height * Draw.scl * scl, e.rotation - 90);
|
||||
rect(region, e.x, e.y, region.width * scl, region.height * scl, e.rotation - 90);
|
||||
}),
|
||||
|
||||
unitCapKill = new Effect(80f, e -> {
|
||||
|
||||
@@ -484,7 +484,7 @@ public class Renderer implements ApplicationListener{
|
||||
TextureRegion reg = block.fullIcon;
|
||||
float scl = Scl.scl(4f) / camerascale;
|
||||
float shake = 0f;
|
||||
float s = reg.width * Draw.scl * scl * 3.6f * Interp.pow2Out.apply(fout);
|
||||
float s = reg.width * reg.scl() * scl * 3.6f * Interp.pow2Out.apply(fout);
|
||||
float rotation = Interp.pow2In.apply(fout) * 135f, x = build.x + Mathf.range(shake), y = build.y + Mathf.range(shake);
|
||||
float thrustOpen = 0.25f;
|
||||
float thrusterFrame = fin >= thrustOpen ? 1f : fin / thrustOpen;
|
||||
|
||||
@@ -119,7 +119,7 @@ public class MapRenderer implements Disposable{
|
||||
if(wall != Blocks.air && useSyntheticWall){
|
||||
region = !center ? clearEditor : getIcon(wall, idxWall);
|
||||
|
||||
float width = region.width * Draw.scl, height = region.height * Draw.scl, ox = wall.offset + (tilesize - width) / 2f, oy = wall.offset + (tilesize - height) / 2f;
|
||||
float width = region.width * region.scl(), height = region.height * region.scl(), ox = wall.offset + (tilesize - width) / 2f, oy = wall.offset + (tilesize - height) / 2f;
|
||||
|
||||
//force fit to tile
|
||||
if(overlay.wallOre && !wall.synthetic()){
|
||||
@@ -152,8 +152,8 @@ public class MapRenderer implements Disposable{
|
||||
region = ((Cliff)Blocks.cliff).editorCliffs[tile.data & 0xff];
|
||||
}
|
||||
|
||||
offsetX = tilesize / 2f - region.width / 2f * Draw.scl;
|
||||
offsetY = tilesize / 2f - region.height / 2f * Draw.scl;
|
||||
offsetX = tilesize / 2f - region.width * region.scl() / 2f;
|
||||
offsetY = tilesize / 2f - region.height * region.scl() / 2f;
|
||||
}else if((wall == Blocks.air || overlay.wallOre) && !overlay.isAir()){
|
||||
if(floor.isLiquid){
|
||||
mesh.setColor(Tmp.c1.set(1f, 1f, 1f, floor.overlayAlpha));
|
||||
@@ -163,7 +163,7 @@ public class MapRenderer implements Disposable{
|
||||
region = clearEditor;
|
||||
}
|
||||
|
||||
float width = region.width * Draw.scl, height = region.height * Draw.scl;
|
||||
float width = region.width * region.scl(), height = region.height * region.scl();
|
||||
if(!wall.synthetic() && wall != Blocks.air && !wall.isMultiblock()){
|
||||
offsetX = offsetY = 0f;
|
||||
width = height = tilesize;
|
||||
|
||||
@@ -43,7 +43,8 @@ abstract class LaunchCoreComp implements Drawc, Timedc{
|
||||
Draw.z(Layer.weather - 1);
|
||||
|
||||
TextureRegion region = block.fullIcon;
|
||||
float rw = region.width * Draw.scl * scale, rh = region.height * Draw.scl * scale;
|
||||
scale *= region.scl();
|
||||
float rw = region.width * scale, rh = region.height * scale;
|
||||
|
||||
Draw.alpha(alpha);
|
||||
Draw.rect(region, cx, cy, rw, rh, rotation - 45);
|
||||
|
||||
@@ -402,8 +402,8 @@ public class Drawf{
|
||||
float scl = 8f * scale * Draw.scl, rot = Mathf.angle(x2 - x, y2 - y);
|
||||
float vx = Mathf.cosDeg(rot) * scl, vy = Mathf.sinDeg(rot) * scl;
|
||||
|
||||
Draw.rect(start, x, y, start.width * scale * Draw.scl, start.height * scale * Draw.scl, rot + 180);
|
||||
Draw.rect(end, x2, y2, end.width * scale * Draw.scl, end.height * scale * Draw.scl, rot);
|
||||
Draw.rect(start, x, y, start.width * scale * start.scl(), start.height * scale * start.scl(), rot + 180);
|
||||
Draw.rect(end, x2, y2, end.width * scale * end.scl(), end.height * scale * end.scl(), rot);
|
||||
|
||||
Lines.stroke(12f * scale);
|
||||
Lines.line(line, x + vx, y + vy, x2 - vx, y2 - vy, false);
|
||||
|
||||
@@ -243,12 +243,12 @@ public class MenuRenderer implements Disposable{
|
||||
|
||||
TextureRegion icon = flyerType.fullIcon;
|
||||
|
||||
float size = Math.max(icon.width, icon.height) * Draw.scl * 1.6f;
|
||||
|
||||
flyers((x, y) -> {
|
||||
Draw.rect(icon, x - 12f, y - 13f, flyerRot - 90);
|
||||
});
|
||||
|
||||
float size = Math.max(icon.width, icon.height) * icon.scl() * 1.6f;
|
||||
|
||||
flyers((x, y) -> {
|
||||
Draw.rect("circle-shadow", x, y, size, size);
|
||||
});
|
||||
|
||||
@@ -1653,20 +1653,26 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
public void drawArrow(Block block, int x, int y, int rotation, boolean valid){
|
||||
float trns = (block.size / 2) * tilesize;
|
||||
int dx = Geometry.d4(rotation).x, dy = Geometry.d4(rotation).y;
|
||||
float offsetx = x * tilesize + block.offset + dx*trns;
|
||||
float offsety = y * tilesize + block.offset + dy*trns;
|
||||
|
||||
Draw.color(!valid ? Pal.removeBack : Pal.accentBack);
|
||||
Draw.rect(Core.atlas.find("place-arrow"),
|
||||
x * tilesize + block.offset + dx*trns,
|
||||
y * tilesize + block.offset - 1 + dy*trns,
|
||||
Core.atlas.find("place-arrow").width * Draw.scl,
|
||||
Core.atlas.find("place-arrow").height * Draw.scl, rotation * 90 - 90);
|
||||
TextureRegion regionArrow = Core.atlas.find("place-arrow");
|
||||
|
||||
Draw.rect(regionArrow,
|
||||
offsetx,
|
||||
offsety - 1,
|
||||
regionArrow.width * regionArrow.scl(),
|
||||
regionArrow.height * regionArrow.scl(),
|
||||
rotation * 90 - 90);
|
||||
|
||||
Draw.color(!valid ? Pal.remove : Pal.accent);
|
||||
Draw.rect(Core.atlas.find("place-arrow"),
|
||||
x * tilesize + block.offset + dx*trns,
|
||||
y * tilesize + block.offset + dy*trns,
|
||||
Core.atlas.find("place-arrow").width * Draw.scl,
|
||||
Core.atlas.find("place-arrow").height * Draw.scl, rotation * 90 - 90);
|
||||
Draw.rect(regionArrow,
|
||||
offsetx,
|
||||
offsety,
|
||||
regionArrow.width * regionArrow.scl(),
|
||||
regionArrow.height * regionArrow.scl(),
|
||||
rotation * 90 - 90);
|
||||
}
|
||||
|
||||
void iterateLine(int startX, int startY, int endX, int endY, Cons<PlaceLine> cons){
|
||||
|
||||
@@ -40,6 +40,7 @@ public class Mods implements Loadable{
|
||||
private ObjectSet<String> specialFolders = ObjectSet.with("bundles", "sprites", "sprites-override");
|
||||
|
||||
private int totalSprites;
|
||||
private static ObjectFloatMap<String> textureResize = new ObjectFloatMap<>();
|
||||
private MultiPacker packer;
|
||||
private ModClassLoader mainLoader = new ModClassLoader(getClass().getClassLoader());
|
||||
|
||||
@@ -181,6 +182,7 @@ public class Mods implements Loadable{
|
||||
|
||||
private void packSprites(Seq<Fi> sprites, LoadedMod mod, boolean prefix, Seq<Future<Runnable>> tasks){
|
||||
boolean bleed = Core.settings.getBool("linear", true) && !mod.meta.pregenerated;
|
||||
float textureScale = mod.meta.texturescale;
|
||||
|
||||
for(Fi file : sprites){
|
||||
String name = file.nameWithoutExtension();
|
||||
@@ -209,7 +211,11 @@ public class Mods implements Loadable{
|
||||
}
|
||||
//this returns a *runnable* which actually packs the resulting pixmap; this has to be done synchronously outside the method
|
||||
return () -> {
|
||||
packer.add(getPage(file), (prefix ? mod.name + "-" : "") + name, new PixmapRegion(pix));
|
||||
String fullName = (prefix ? mod.name + "-" : "") + name;
|
||||
packer.add(getPage(file), fullName, new PixmapRegion(pix));
|
||||
if(textureScale != 1.0f){
|
||||
textureResize.put(fullName, textureScale);
|
||||
}
|
||||
pix.dispose();
|
||||
};
|
||||
}catch(Exception e){
|
||||
@@ -344,13 +350,17 @@ public class Mods implements Loadable{
|
||||
}
|
||||
Log.debug("Time to generate icons: @", Time.elapsed());
|
||||
|
||||
packer.printStats();
|
||||
|
||||
//dispose old atlas data
|
||||
Core.atlas = packer.flush(filter, new TextureAtlas());
|
||||
|
||||
Time.mark();
|
||||
textureResize.each(e -> { Core.atlas.find(e.key).scale = e.value; });
|
||||
Log.debug("Time to rescale textures: @", Time.elapsed());
|
||||
|
||||
Core.atlas.setErrorRegion("error");
|
||||
Log.debug("Total pages: @", Core.atlas.getTextures().size);
|
||||
|
||||
packer.printStats();
|
||||
}
|
||||
|
||||
packer.dispose();
|
||||
@@ -1141,6 +1151,8 @@ public class Mods implements Loadable{
|
||||
public boolean java;
|
||||
/** If true, -outline regions for units are kept when packing. Only use if you know exactly what you are doing. */
|
||||
public boolean keepOutlines;
|
||||
/** To rescale textures with a different size. Represents the size in pixels of the sprite of a 1x1 block. */
|
||||
public float texturescale = 1.0f;
|
||||
/** If true, bleeding is skipped and no content icons are generated. */
|
||||
public boolean pregenerated;
|
||||
|
||||
@@ -1176,6 +1188,7 @@ public class Mods implements Loadable{
|
||||
", minGameVersion='" + minGameVersion + '\'' +
|
||||
", hidden=" + hidden +
|
||||
", repo=" + repo +
|
||||
", texturescale=" + texturescale +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1274,7 +1274,7 @@ public class UnitType extends UnlockableContent{
|
||||
public void drawSoftShadow(float x, float y, float rotation, float alpha){
|
||||
Draw.color(0, 0, 0, 0.4f * alpha);
|
||||
float rad = 1.6f;
|
||||
float size = Math.max(region.width, region.height) * Draw.scl;
|
||||
float size = Math.max(region.width, region.height) * region.scl();
|
||||
Draw.rect(softShadowRegion, x, y, size * rad * Draw.xscl, size * rad * Draw.yscl, rotation - 90);
|
||||
Draw.color();
|
||||
}
|
||||
@@ -1293,11 +1293,12 @@ public class UnitType extends UnlockableContent{
|
||||
size, size, unit.rotation);
|
||||
Draw.mixcol();
|
||||
|
||||
size = (3f + Mathf.absin(Time.time, 5f, 1f)) * unit.itemTime + 0.5f;
|
||||
size = ((3f + Mathf.absin(Time.time, 5f, 1f)) * unit.itemTime + 0.5f) * 2;
|
||||
Draw.color(Pal.accent);
|
||||
Draw.rect(itemCircleRegion,
|
||||
unit.x + Angles.trnsx(unit.rotation + 180f, itemOffsetY),
|
||||
unit.y + Angles.trnsy(unit.rotation + 180f, itemOffsetY), size * 2, size * 2);
|
||||
unit.y + Angles.trnsy(unit.rotation + 180f, itemOffsetY),
|
||||
size, size);
|
||||
|
||||
if(unit.isLocal() && !renderer.pixelator.enabled()){
|
||||
Fonts.outline.draw(unit.stack.amount + "",
|
||||
@@ -1409,7 +1410,7 @@ public class UnitType extends UnlockableContent{
|
||||
|
||||
for(int side : Mathf.signs){
|
||||
Tmp.v1.set(xOffset * side, yOffset).rotate(unit.rotation - 90);
|
||||
Draw.rect(region, unit.x + Tmp.v1.x / 4f, unit.y + Tmp.v1.y / 4f, treadRect.width / 4f, region.height / 4f, unit.rotation - 90);
|
||||
Draw.rect(region, unit.x + Tmp.v1.x / 4f, unit.y + Tmp.v1.y / 4f, treadRect.width / 4f, region.height * region.scale / 4f, unit.rotation - 90);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1421,7 +1422,7 @@ public class UnitType extends UnlockableContent{
|
||||
|
||||
Leg[] legs = unit.legs();
|
||||
|
||||
float ssize = footRegion.width * Draw.scl * 1.5f;
|
||||
float ssize = footRegion.width * footRegion.scl() * 1.5f;
|
||||
float rotation = unit.baseRotation();
|
||||
float invDrown = 1f - unit.drownTime;
|
||||
|
||||
@@ -1456,10 +1457,10 @@ public class UnitType extends UnlockableContent{
|
||||
Draw.rect(footRegion, leg.base.x, leg.base.y, position.angleTo(leg.base));
|
||||
}
|
||||
|
||||
Lines.stroke(legRegion.height * Draw.scl * flips);
|
||||
Lines.stroke(legRegion.height * legRegion.scl() * flips);
|
||||
Lines.line(legRegion, position.x, position.y, leg.joint.x, leg.joint.y, false);
|
||||
|
||||
Lines.stroke(legBaseRegion.height * Draw.scl * flips);
|
||||
Lines.stroke(legBaseRegion.height * legRegion.scl() * flips);
|
||||
Lines.line(legBaseRegion, leg.joint.x + Tmp.v1.x, leg.joint.y + Tmp.v1.y, leg.base.x, leg.base.y, false);
|
||||
|
||||
if(jointRegion.found()){
|
||||
@@ -1534,8 +1535,8 @@ public class UnitType extends UnlockableContent{
|
||||
Draw.rect(legRegion,
|
||||
unit.x + Angles.trnsx(mech.baseRotation(), extension * i - boostTrns, -boostTrns*i),
|
||||
unit.y + Angles.trnsy(mech.baseRotation(), extension * i - boostTrns, -boostTrns*i),
|
||||
legRegion.width * i * Draw.scl,
|
||||
legRegion.height * Draw.scl - Math.max(-sin * i, 0) * legRegion.height * 0.5f * Draw.scl,
|
||||
legRegion.width * legRegion.scl() * i,
|
||||
legRegion.height * legRegion.scl() * (1 - Math.max(-sin * i, 0) * 0.5f),
|
||||
mech.baseRotation() - 90 + 35f*i*e);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ public class MenuFragment{
|
||||
parent.fill((x, y, w, h) -> {
|
||||
TextureRegion logo = Core.atlas.find("logo");
|
||||
float width = Core.graphics.getWidth(), height = Core.graphics.getHeight() - Core.scene.marginTop;
|
||||
float logoscl = Scl.scl(1);
|
||||
float logoscl = Scl.scl(1) * logo.scale;
|
||||
float logow = Math.min(logo.width * logoscl, Core.graphics.getWidth() - Scl.scl(20));
|
||||
float logoh = logow * (float)logo.height / logo.width;
|
||||
|
||||
|
||||
@@ -229,7 +229,8 @@ public class LaunchPad extends Block{
|
||||
Draw.z(Layer.weather - 1);
|
||||
|
||||
TextureRegion region = blockOn() instanceof mindustry.world.blocks.campaign.LaunchPad p ? p.podRegion : Core.atlas.find("launchpod");
|
||||
float rw = region.width * Draw.scl * scale, rh = region.height * Draw.scl * scale;
|
||||
scale *= region.scl();
|
||||
float rw = region.width * scale, rh = region.height * scale;
|
||||
|
||||
Draw.alpha(alpha);
|
||||
Draw.rect(region, cx, cy, rw, rh, rotation);
|
||||
|
||||
@@ -73,7 +73,7 @@ public class Conveyor extends Block implements Autotiler{
|
||||
if(bits == null) return;
|
||||
|
||||
TextureRegion region = regions[bits[0]][0];
|
||||
Draw.rect(region, plan.drawx(), plan.drawy(), region.width * bits[1] * Draw.scl, region.height * bits[2] * Draw.scl, plan.rotation * 90);
|
||||
Draw.rect(region, plan.drawx(), plan.drawy(), region.width * bits[1] * region.scl(), region.height * bits[2] * region.scl(), plan.rotation * 90);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -134,16 +134,16 @@ public class DirectionBridge extends Block{
|
||||
cy = (y1 + y2)/2f,
|
||||
len = Math.max(Math.abs(x1 - x2), Math.abs(y1 - y2)) - size * tilesize;
|
||||
|
||||
Draw.rect(bridgeRegion, cx, cy, len, bridgeRegion.height * Draw.scl, angle);
|
||||
Draw.rect(bridgeRegion, cx, cy, len, bridgeRegion.height * bridgeRegion.scl(), angle);
|
||||
if(liquidColor != null){
|
||||
Draw.color(liquidColor, liquidColor.a * Renderer.bridgeOpacity);
|
||||
Draw.rect(bridgeLiquidRegion, cx, cy, len, bridgeLiquidRegion.height * Draw.scl, angle);
|
||||
Draw.rect(bridgeLiquidRegion, cx, cy, len, bridgeLiquidRegion.height * bridgeLiquidRegion.scl(), angle);
|
||||
Draw.color();
|
||||
Draw.alpha(Renderer.bridgeOpacity);
|
||||
}
|
||||
if(bridgeBotRegion.found()){
|
||||
Draw.color(0.4f, 0.4f, 0.4f, 0.4f * Renderer.bridgeOpacity);
|
||||
Draw.rect(bridgeBotRegion, cx, cy, len, bridgeBotRegion.height * Draw.scl, angle);
|
||||
Draw.rect(bridgeBotRegion, cx, cy, len, bridgeBotRegion.height * bridgeBotRegion.scl(), angle);
|
||||
Draw.reset();
|
||||
}
|
||||
Draw.alpha(Renderer.bridgeOpacity);
|
||||
|
||||
@@ -28,7 +28,7 @@ public class SeaBush extends Prop{
|
||||
int lobes = rand.random(lobesMin, lobesMax);
|
||||
for(int i = 0; i < lobes; i++){
|
||||
float ba = i / (float)lobes * 360f + offset + rand.range(spread), angle = ba + Mathf.sin(Time.time + rand.random(0, timeRange), rand.random(sclMin, sclMax), rand.random(magMin, magMax));
|
||||
float w = region.width * Draw.scl, h = region.height * Draw.scl;
|
||||
float w = region.width * region.scl(), h = region.height * region.scl();
|
||||
var region = Angles.angleDist(ba, 225f) <= botAngle ? botRegion : this.region;
|
||||
|
||||
Draw.rect(region,
|
||||
|
||||
@@ -19,7 +19,7 @@ public class Seaweed extends Prop{
|
||||
x = tile.worldx(), y = tile.worldy(),
|
||||
rotmag = 3f, rotscl = 0.5f,
|
||||
rot = Mathf.randomSeedRange(tile.pos(), 20f) - 45 + Mathf.sin(Time.time + x, 50f * rotscl, 0.5f * rotmag) + Mathf.sin(Time.time - y, 65f * rotscl, 0.9f* rotmag) + Mathf.sin(Time.time + y - x, 85f * rotscl, 0.9f* rotmag),
|
||||
w = region.width * Draw.scl, h = region.height * Draw.scl,
|
||||
w = region.width * region.scl(), h = region.height * region.scl(),
|
||||
scl = 30f, mag = 0.3f;
|
||||
|
||||
Draw.rectv(region, x, y, w, h, rot, vec -> vec.add(
|
||||
|
||||
@@ -23,7 +23,7 @@ public class TreeBlock extends Block{
|
||||
float
|
||||
x = tile.worldx(), y = tile.worldy(),
|
||||
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),
|
||||
w = region.width * Draw.scl, h = region.height * Draw.scl,
|
||||
w = region.width * region.scl(), h = region.height * region.scl(),
|
||||
scl = 30f, mag = 0.2f;
|
||||
|
||||
if(shadow.found()){
|
||||
|
||||
@@ -18,7 +18,7 @@ public class WobbleProp extends Prop{
|
||||
public void drawBase(Tile tile){
|
||||
var region = variants > 0 ? variantRegions[Mathf.randomSeed(tile.pos(), 0, Math.max(0, variantRegions.length - 1))] : this.region;
|
||||
|
||||
Draw.rectv(region, tile.worldx(), tile.worldy(), region.width * Draw.scl, region.height * Draw.scl, 0, vec -> vec.add(
|
||||
Draw.rectv(region, tile.worldx(), tile.worldy(), region.width * region.scl(), region.height * region.scl(), 0, vec -> vec.add(
|
||||
Mathf.sin(vec.y*3 + Time.time, wscl, wmag) + Mathf.sin(vec.x*3 - Time.time, 70 * wtscl, 0.8f * wmag2),
|
||||
Mathf.cos(vec.x*3 + Time.time + 8, wscl + 6f, wmag * 1.1f) + Mathf.sin(vec.y*3 - Time.time, 50 * wtscl, 0.2f * wmag2)
|
||||
));
|
||||
|
||||
@@ -197,26 +197,28 @@ public class PayloadConveyor extends Block{
|
||||
float glow = Math.max((dst - (Math.abs(fract() - 0.5f) * 2)) / dst, 0);
|
||||
Draw.mixcol(team.color, glow);
|
||||
|
||||
float trnext = fract() * size * tilesize, trprev = size * tilesize * (fract() - 1), rot = rotdeg();
|
||||
|
||||
TextureRegion clipped = clipRegion(tile.getHitbox(Tmp.r1), tile.getHitbox(Tmp.r2).move(trnext, 0), topRegion);
|
||||
float s = tilesize * size;
|
||||
float trnext = s * fract(), trprev = s * (fract() - 1), rot = rotdeg();
|
||||
|
||||
//next
|
||||
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);
|
||||
TextureRegion clipped = clipRegion(tile.getHitbox(Tmp.r1), tile.getHitbox(Tmp.r2).move(trnext, 0), topRegion);
|
||||
float widthNext = (s - clipped.width * clipped.scl()) * 0.5f;
|
||||
float heightNext = (s - clipped.height * clipped.scl()) * 0.5f;
|
||||
Tmp.v1.set(widthNext, heightNext).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.width /2f*Draw.scl, - s/2f + clipped.height /2f*Draw.scl).rotate(rot);
|
||||
clipped = clipRegion(tile.getHitbox(Tmp.r1), tile.getHitbox(Tmp.r2).move(trprev, 0), topRegion);
|
||||
float widthPrev = (clipped.width * clipped.scl() - s) * 0.5f;
|
||||
float heightPrev = (clipped.height * clipped.scl() - s) * 0.5f;
|
||||
Tmp.v1.set(widthPrev, heightPrev).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.width /2f*Draw.scl, - s/2f + clipped.height /2f*Draw.scl).rotate(i * 90 + 180);
|
||||
Tmp.v1.set(widthPrev, heightPrev).rotate(i * 90 + 180);
|
||||
Draw.rect(clipped, x + Tmp.v1.x, y + Tmp.v1.y, i * 90 + 180);
|
||||
}
|
||||
}
|
||||
@@ -331,6 +333,7 @@ public class PayloadConveyor extends Block{
|
||||
|
||||
TextureRegion out = Tmp.tr1;
|
||||
out.set(region.texture);
|
||||
out.scale = region.scale;
|
||||
|
||||
if(overlaps){
|
||||
float w = region.u2 - region.u;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class DrawPlasma extends DrawFlame{
|
||||
public void draw(Building build){
|
||||
Draw.blend(Blending.additive);
|
||||
for(int i = 0; i < regions.length; i++){
|
||||
float r = ((float)regions[i].width * Draw.scl - 3f + Mathf.absin(Time.time, 2f + i * 1f, 5f - i * 0.5f));
|
||||
float r = ((float)regions[i].width * regions[i].scl() - 3f + Mathf.absin(Time.time, 2f + i * 1f, 5f - i * 0.5f));
|
||||
|
||||
Draw.color(plasma1, plasma2, (float)i / regions.length);
|
||||
Draw.alpha((0.3f + Mathf.absin(Time.time, 2f + i * 2f, 0.3f + i * 0.05f)) * build.warmup());
|
||||
|
||||
Reference in New Issue
Block a user