From 2a6fcb7983ae19a26e86857d9b637c7a89e66764 Mon Sep 17 00:00:00 2001 From: MEEPofFaith <54301439+MEEPofFaith@users.noreply.github.com> Date: Mon, 9 Jan 2023 19:08:40 -0800 Subject: [PATCH] Region part growing (#7861) E x p a n d --- core/src/mindustry/entities/part/DrawPart.java | 9 +++++++-- .../mindustry/entities/part/RegionPart.java | 18 ++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/core/src/mindustry/entities/part/DrawPart.java b/core/src/mindustry/entities/part/DrawPart.java index 7d85db582d..245d1c8064 100644 --- a/core/src/mindustry/entities/part/DrawPart.java +++ b/core/src/mindustry/entities/part/DrawPart.java @@ -45,14 +45,19 @@ public abstract class DrawPart{ public static class PartMove{ public PartProgress progress = PartProgress.warmup; - public float x, y, rot; + public float x, y, gx, gy, rot; - public PartMove(PartProgress progress, float x, float y, float rot){ + public PartMove(PartProgress progress, float x, float y, float gx, float gy, float rot){ this.progress = progress; this.x = x; this.y = y; + this.gx = gx; + this.gy = gy; this.rot = rot; } + public PartMove(PartProgress progress, float x, float y, float rot){ + this(progress, x, y, 0, 0, rot); + } public PartMove(){ } diff --git a/core/src/mindustry/entities/part/RegionPart.java b/core/src/mindustry/entities/part/RegionPart.java index e2186f5e16..341dd6f3fc 100644 --- a/core/src/mindustry/entities/part/RegionPart.java +++ b/core/src/mindustry/entities/part/RegionPart.java @@ -29,13 +29,15 @@ public class RegionPart extends DrawPart{ public boolean heatLight = false; /** Progress function for determining position/rotation. */ public PartProgress progress = PartProgress.warmup; + /** Progress function for scaling. */ + public PartProgress growProgress = PartProgress.warmup; /** Progress function for heat alpha. */ public PartProgress heatProgress = PartProgress.heat; public Blending blending = Blending.normal; public float layer = -1, layerOffset = 0f, heatLayerOffset = 1f, turretHeatLayer = Layer.turretHeat; public float outlineLayerOffset = -0.001f; - public float x, y, rotation; - public float moveX, moveY, moveRot; + public float x, y, xScl = 1f, yScl = 1f, rotation; + public float moveX, moveY, growX, growY, moveRot; public float heatLightOpacity = 0.3f; public @Nullable Color color, colorTo, mixColor, mixColorTo; public Color heatColor = Pal.turretHeat.cpy(); @@ -65,8 +67,9 @@ public class RegionPart extends DrawPart{ Draw.z(Draw.z() + layerOffset); float prevZ = Draw.z(); - float prog = progress.getClamp(params); - float mx = moveX * prog, my = moveY * prog, mr = moveRot * prog + rotation; + float prog = progress.getClamp(params), sclProg = growProgress.getClamp(params); + float mx = moveX * prog, my = moveY * prog, mr = moveRot * prog + rotation, + gx = growX * sclProg, gy = growY * sclProg; if(moves.size > 0){ for(int i = 0; i < moves.size; i++){ @@ -75,10 +78,15 @@ public class RegionPart extends DrawPart{ mx += move.x * p; my += move.y * p; mr += move.rot * p; + gx += move.gx; + gy += move.gy; } } int len = mirror && params.sideOverride == -1 ? 2 : 1; + float preXscl = Draw.xscl, preYscl = Draw.yscl; + Draw.xscl *= xScl + gx; + Draw.yscl *= yScl + gy; for(int s = 0; s < len; s++){ //use specific side if necessary @@ -153,6 +161,8 @@ public class RegionPart extends DrawPart{ } } } + + Draw.scl(preXscl, preYscl); } @Override