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:
co-authored by
citrusMarmelade
Anuken
parent
0e9e3de11f
commit
1d971231ca
@@ -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