Shadow Fix
This commit is contained in:
@@ -72,8 +72,6 @@ public class Vars implements Loadable{
|
|||||||
public static final int maxTextLength = 150;
|
public static final int maxTextLength = 150;
|
||||||
/** max player name length in bytes */
|
/** max player name length in bytes */
|
||||||
public static final int maxNameLength = 40;
|
public static final int maxNameLength = 40;
|
||||||
/** shadow color for turrets */
|
|
||||||
public static final float turretShadowColor = Color.toFloatBits(0, 0, 0, 0.22f);
|
|
||||||
/** displayed item size when ingame. */
|
/** displayed item size when ingame. */
|
||||||
public static final float itemSize = 5f;
|
public static final float itemSize = 5f;
|
||||||
/** units outside of this bound will die instantly */
|
/** units outside of this bound will die instantly */
|
||||||
|
|||||||
@@ -84,6 +84,18 @@ public class Drawf{
|
|||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void shadow(TextureRegion region, float x, float y, float rotation){
|
||||||
|
Draw.color(Pal.shadow);
|
||||||
|
Draw.rect(region, x, y, rotation);
|
||||||
|
Draw.color();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void shadow(TextureRegion region, float x, float y){
|
||||||
|
Draw.color(Pal.shadow);
|
||||||
|
Draw.rect(region, x, y);
|
||||||
|
Draw.color();
|
||||||
|
}
|
||||||
|
|
||||||
public static void dashCircle(float x, float y, float rad, Color color){
|
public static void dashCircle(float x, float y, float rad, Color color){
|
||||||
Lines.stroke(3f, Pal.gray);
|
Lines.stroke(3f, Pal.gray);
|
||||||
Lines.dashCircle(x, y, rad);
|
Lines.dashCircle(x, y, rad);
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public class Pal{
|
|||||||
darkishGray = new Color(0.3f, 0.3f, 0.3f, 1f),
|
darkishGray = new Color(0.3f, 0.3f, 0.3f, 1f),
|
||||||
darkerGray = new Color(0.2f, 0.2f, 0.2f, 1f),
|
darkerGray = new Color(0.2f, 0.2f, 0.2f, 1f),
|
||||||
darkestGray = new Color(0.1f, 0.1f, 0.1f, 1f),
|
darkestGray = new Color(0.1f, 0.1f, 0.1f, 1f),
|
||||||
|
shadow = new Color(0, 0, 0, 0.22f),
|
||||||
ammo = Color.valueOf("ff8947"),
|
ammo = Color.valueOf("ff8947"),
|
||||||
rubble = Color.valueOf("1c1817"),
|
rubble = Color.valueOf("1c1817"),
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import mindustry.world.consumers.*;
|
|||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class UnitType extends UnlockableContent{
|
public class UnitType extends UnlockableContent{
|
||||||
public static final float shadowTX = -12, shadowTY = -13, shadowColor = Color.toFloatBits(0, 0, 0, 0.22f), outlineSpace = 0.01f;
|
public static final float shadowTX = -12, shadowTY = -13, outlineSpace = 0.01f;
|
||||||
private static final Vec2 legOffset = new Vec2();
|
private static final Vec2 legOffset = new Vec2();
|
||||||
|
|
||||||
/** If true, the unit is always at elevation 1. */
|
/** If true, the unit is always at elevation 1. */
|
||||||
@@ -409,7 +409,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void drawShadow(Unit unit){
|
public void drawShadow(Unit unit){
|
||||||
Draw.color(shadowColor);
|
Draw.color(Pal.shadow);
|
||||||
float e = Math.max(unit.elevation, visualElevation);
|
float e = Math.max(unit.elevation, visualElevation);
|
||||||
Draw.rect(shadowRegion, unit.x + shadowTX * e, unit.y + shadowTY * e, unit.rotation - 90);
|
Draw.rect(shadowRegion, unit.x + shadowTX * e, unit.y + shadowTY * e, unit.rotation - 90);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
@@ -594,7 +594,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
if(leg.moving && visualElevation > 0){
|
if(leg.moving && visualElevation > 0){
|
||||||
float scl = visualElevation;
|
float scl = visualElevation;
|
||||||
float elev = Mathf.slope(1f - leg.stage) * scl;
|
float elev = Mathf.slope(1f - leg.stage) * scl;
|
||||||
Draw.color(shadowColor);
|
Draw.color(Pal.shadow);
|
||||||
Draw.rect(footRegion, leg.base.x + shadowTX * elev, leg.base.y + shadowTY * elev, position.angleTo(leg.base));
|
Draw.rect(footRegion, leg.base.x + shadowTX * elev, leg.base.y + shadowTY * elev, position.angleTo(leg.base));
|
||||||
Draw.color();
|
Draw.color();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,9 +112,7 @@ public class PointDefenseTurret extends Block{
|
|||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
Draw.rect(baseRegion, x, y);
|
Draw.rect(baseRegion, x, y);
|
||||||
Draw.color(Vars.turretShadowColor);
|
Drawf.shadow(region, x - (size / 2f), y - (size / 2f), rotation - 90);
|
||||||
Draw.rect(region, x - (size / 2f), y - (size / 2f), rotation - 90);
|
|
||||||
Draw.color();
|
|
||||||
Draw.rect(region, x, y, rotation - 90);
|
Draw.rect(region, x, y, rotation - 90);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -107,9 +107,7 @@ public class TractorBeamTurret extends Block{
|
|||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
Draw.rect(baseRegion, x, y);
|
Draw.rect(baseRegion, x, y);
|
||||||
Draw.color(Vars.turretShadowColor);
|
Drawf.shadow(region, x - (size / 2f), y - (size / 2f), rotation - 90);
|
||||||
Draw.rect(region, x - (size / 2f), y - (size / 2f), rotation - 90);
|
|
||||||
Draw.color();
|
|
||||||
Draw.rect(region, x, y, rotation - 90);
|
Draw.rect(region, x, y, rotation - 90);
|
||||||
|
|
||||||
//draw laser if applicable
|
//draw laser if applicable
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import arc.struct.*;
|
|||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.util.io.*;
|
import arc.util.io.*;
|
||||||
import mindustry.*;
|
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
@@ -203,9 +202,7 @@ public abstract class Turret extends Block{
|
|||||||
|
|
||||||
tr2.trns(rotation, -recoil);
|
tr2.trns(rotation, -recoil);
|
||||||
|
|
||||||
Draw.color(Vars.turretShadowColor);
|
Drawf.shadow(region, x + tr2.x - (size / 2f), y + tr2.y - (size / 2f), rotation - 90);
|
||||||
Draw.rect(region, x + tr2.x - (size / 2f), y + tr2.y - (size / 2f), rotation - 90);
|
|
||||||
Draw.color();
|
|
||||||
drawer.get(this);
|
drawer.get(this);
|
||||||
|
|
||||||
if(heatRegion != Core.atlas.find("error")){
|
if(heatRegion != Core.atlas.find("error")){
|
||||||
|
|||||||
@@ -188,6 +188,9 @@ public class MassDriver extends Block{
|
|||||||
|
|
||||||
Draw.z(Layer.turret);
|
Draw.z(Layer.turret);
|
||||||
|
|
||||||
|
Drawf.shadow(region,
|
||||||
|
x + Angles.trnsx(rotation + 180f, reload * knockback) - (size / 2),
|
||||||
|
y + Angles.trnsy(rotation + 180f, reload * knockback) - (size / 2), rotation - 90);
|
||||||
Draw.rect(region,
|
Draw.rect(region,
|
||||||
x + Angles.trnsx(rotation + 180f, reload * knockback),
|
x + Angles.trnsx(rotation + 180f, reload * knockback),
|
||||||
y + Angles.trnsy(rotation + 180f, reload * knockback), rotation - 90);
|
y + Angles.trnsy(rotation + 180f, reload * knockback), rotation - 90);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import arc.math.*;
|
|||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
|
import mindustry.*;
|
||||||
import mindustry.annotations.Annotations.*;
|
import mindustry.annotations.Annotations.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
@@ -70,6 +71,7 @@ public class RepairPoint extends Block{
|
|||||||
Draw.rect(baseRegion, x, y);
|
Draw.rect(baseRegion, x, y);
|
||||||
|
|
||||||
Draw.z(Layer.turret);
|
Draw.z(Layer.turret);
|
||||||
|
Drawf.shadow(region, x - (size / 2), y - (size / 2), rotation - 90);
|
||||||
Draw.rect(region, x, y, rotation - 90);
|
Draw.rect(region, x, y, rotation - 90);
|
||||||
|
|
||||||
if(target != null && Angles.angleDist(angleTo(target), rotation) < 30f){
|
if(target != null && Angles.angleDist(angleTo(target), rotation) < 30f){
|
||||||
|
|||||||
Reference in New Issue
Block a user