Weapon animation suffering
This commit is contained in:
BIN
core/assets-raw/sprites/units/weapons/conquer-weapon-heat.png
Normal file
BIN
core/assets-raw/sprites/units/weapons/conquer-weapon-heat.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
BIN
core/assets-raw/sprites/units/weapons/conquer-weapon-sides.png
Normal file
BIN
core/assets-raw/sprites/units/weapons/conquer-weapon-sides.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 612 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -2526,7 +2526,9 @@ public class UnitTypes{
|
|||||||
y = -2f;
|
y = -2f;
|
||||||
shadow = 50f;
|
shadow = 50f;
|
||||||
heatColor = Color.valueOf("f9350f");
|
heatColor = Color.valueOf("f9350f");
|
||||||
cooldownTime = 80f;
|
shootWarmupSpeed = 0.06f;
|
||||||
|
cooldownTime = 110f;
|
||||||
|
heatColor = Color.valueOf("f9350f");
|
||||||
|
|
||||||
parts.add(
|
parts.add(
|
||||||
new RegionPart("-glow"){{
|
new RegionPart("-glow"){{
|
||||||
@@ -2534,10 +2536,33 @@ public class UnitTypes{
|
|||||||
blending = Blending.additive;
|
blending = Blending.additive;
|
||||||
outline = mirror = false;
|
outline = mirror = false;
|
||||||
}},
|
}},
|
||||||
|
new RegionPart("-sides"){{
|
||||||
|
useReload = false;
|
||||||
|
mirror = true;
|
||||||
|
under = true;
|
||||||
|
moveX = 0.5f;
|
||||||
|
moveY = 0.5f;
|
||||||
|
rotMove = 82f;
|
||||||
|
x = 38 / 4f;
|
||||||
|
y = 9 / 4f;
|
||||||
|
}},
|
||||||
new RegionPart("-sinks"){{
|
new RegionPart("-sinks"){{
|
||||||
useReload = false;
|
useReload = false;
|
||||||
mirror = true;
|
mirror = true;
|
||||||
under = true;
|
under = true;
|
||||||
|
heatColor = new Color(1f, 0.1f, 0.1f);
|
||||||
|
moveX = 15f / 4f;
|
||||||
|
moveY = -13f / 4f;
|
||||||
|
x = 34 / 4f;
|
||||||
|
y = -36 / 4f;
|
||||||
|
}},
|
||||||
|
new RegionPart("-sinks-heat"){{
|
||||||
|
blending = Blending.additive;
|
||||||
|
useReload = false;
|
||||||
|
mirror = true;
|
||||||
|
outline = false;
|
||||||
|
colorTo = new Color(1f, 0f, 0f, 0.5f);
|
||||||
|
color = colorTo.cpy().a(0f);
|
||||||
moveX = 15f / 4f;
|
moveX = 15f / 4f;
|
||||||
moveY = -13f / 4f;
|
moveY = -13f / 4f;
|
||||||
x = 34 / 4f;
|
x = 34 / 4f;
|
||||||
@@ -2545,20 +2570,20 @@ public class UnitTypes{
|
|||||||
}}
|
}}
|
||||||
);
|
);
|
||||||
|
|
||||||
bullet = new BasicBulletType(8f, 110){{
|
bullet = new BasicBulletType(8.5f, 250){{
|
||||||
sprite = "missile-large";
|
sprite = "missile-large";
|
||||||
width = 9.5f;
|
width = 12f;
|
||||||
height = 15f;
|
height = 20f;
|
||||||
lifetime = 30f;
|
lifetime = 30f;
|
||||||
hitSize = 6f;
|
hitSize = 6f;
|
||||||
shootEffect = Fx.shootTitan;
|
shootEffect = Fx.shootTitan;
|
||||||
smokeEffect = Fx.shootSmokeTitan;
|
smokeEffect = Fx.shootSmokeTitan;
|
||||||
pierceCap = 2;
|
pierceCap = 3;
|
||||||
pierce = true;
|
pierce = true;
|
||||||
pierceBuilding = true;
|
pierceBuilding = true;
|
||||||
hitColor = backColor = trailColor = Color.valueOf("feb380");
|
hitColor = backColor = trailColor = Color.valueOf("feb380");
|
||||||
frontColor = Color.white;
|
frontColor = Color.white;
|
||||||
trailWidth = 3.1f;
|
trailWidth = 4f;
|
||||||
trailLength = 8;
|
trailLength = 8;
|
||||||
hitEffect = despawnEffect = Fx.blastExplosion;
|
hitEffect = despawnEffect = Fx.blastExplosion;
|
||||||
}};
|
}};
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ public class RegionPart extends WeaponPart{
|
|||||||
public boolean mirror = false;
|
public boolean mirror = false;
|
||||||
/** If true, an outline is drawn under the part. */
|
/** If true, an outline is drawn under the part. */
|
||||||
public boolean outline = true;
|
public boolean outline = true;
|
||||||
/** If true, the layer is overridden to be under the weapon/turret itself. */
|
|
||||||
public boolean under = false;
|
|
||||||
/** If true, the base + outline regions are drawn. Set to false for heat-only regions. */
|
/** If true, the base + outline regions are drawn. Set to false for heat-only regions. */
|
||||||
public boolean drawRegion = true;
|
public boolean drawRegion = true;
|
||||||
/** If true, progress is inverted. */
|
/** If true, progress is inverted. */
|
||||||
@@ -49,7 +47,8 @@ public class RegionPart extends WeaponPart{
|
|||||||
public void draw(PartParams params){
|
public void draw(PartParams params){
|
||||||
float z = Draw.z();
|
float z = Draw.z();
|
||||||
if(layer > 0) Draw.z(layer);
|
if(layer > 0) Draw.z(layer);
|
||||||
if(under) Draw.z(z - 0.0001f);
|
//TODO 'under' should not be special cased like this...
|
||||||
|
if(under && turretShading) Draw.z(z - 0.0001f);
|
||||||
|
|
||||||
float prevZ = Draw.z();
|
float prevZ = Draw.z();
|
||||||
float progress = useReload ? 1f - params.reload : params.warmup;
|
float progress = useReload ? 1f - params.reload : params.warmup;
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ public abstract class WeaponPart{
|
|||||||
|
|
||||||
/** If true, turret shading is used. Don't touch this, it is set up in unit/block init()! */
|
/** If true, turret shading is used. Don't touch this, it is set up in unit/block init()! */
|
||||||
public boolean turretShading;
|
public boolean turretShading;
|
||||||
|
/** If true, the layer is overridden to be under the weapon/turret itself. */
|
||||||
|
public boolean under = false;
|
||||||
|
|
||||||
public abstract void draw(PartParams params);
|
public abstract void draw(PartParams params);
|
||||||
public abstract void load(String name);
|
public abstract void load(String name);
|
||||||
|
|||||||
@@ -613,7 +613,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
if(outlines){
|
if(outlines){
|
||||||
|
|
||||||
//outlines only created when weapons are drawn under w/ merged outlines
|
//outlines only created when weapons are drawn under w/ merged outlines
|
||||||
makeOutline(packer, region, alwaysCreateOutline || weapons.contains(w -> !w.top));
|
makeOutline(packer, region, alwaysCreateOutline || weapons.contains(w -> !w.top || w.parts.contains(p -> p.under)));
|
||||||
|
|
||||||
for(Weapon weapon : weapons){
|
for(Weapon weapon : weapons){
|
||||||
if(!weapon.name.isEmpty()){
|
if(!weapon.name.isEmpty()){
|
||||||
@@ -981,7 +981,13 @@ public class UnitType extends UnlockableContent{
|
|||||||
|
|
||||||
for(WeaponMount mount : unit.mounts){
|
for(WeaponMount mount : unit.mounts){
|
||||||
if(!mount.weapon.top){
|
if(!mount.weapon.top){
|
||||||
|
//apply layer offset, roll it back at the end
|
||||||
|
float z = Draw.z();
|
||||||
|
Draw.z(z + mount.weapon.layerOffset);
|
||||||
|
|
||||||
mount.weapon.drawOutline(unit, mount);
|
mount.weapon.drawOutline(unit, mount);
|
||||||
|
|
||||||
|
Draw.z(z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public class Weapon implements Cloneable{
|
|||||||
/** whether this weapon should fire when its owner dies */
|
/** whether this weapon should fire when its owner dies */
|
||||||
public boolean shootOnDeath = false;
|
public boolean shootOnDeath = false;
|
||||||
/** extra animated parts */
|
/** extra animated parts */
|
||||||
public Seq<WeaponPart> parts = new Seq<>();
|
public Seq<WeaponPart> parts = new Seq<>(WeaponPart.class);
|
||||||
|
|
||||||
public Weapon(String name){
|
public Weapon(String name){
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -158,10 +158,6 @@ public class Weapon implements Cloneable{
|
|||||||
public void drawOutline(Unit unit, WeaponMount mount){
|
public void drawOutline(Unit unit, WeaponMount mount){
|
||||||
if(!outlineRegion.found()) return;
|
if(!outlineRegion.found()) return;
|
||||||
|
|
||||||
//apply layer offset, roll it back at the end
|
|
||||||
float z = Draw.z();
|
|
||||||
Draw.z(z + layerOffset);
|
|
||||||
|
|
||||||
float
|
float
|
||||||
rotation = unit.rotation - 90,
|
rotation = unit.rotation - 90,
|
||||||
weaponRotation = rotation + (rotate ? mount.rotation : 0),
|
weaponRotation = rotation + (rotate ? mount.rotation : 0),
|
||||||
@@ -171,8 +167,6 @@ public class Weapon implements Cloneable{
|
|||||||
Draw.xscl = -Mathf.sign(flipSprite);
|
Draw.xscl = -Mathf.sign(flipSprite);
|
||||||
Draw.rect(outlineRegion, wx, wy, weaponRotation);
|
Draw.rect(outlineRegion, wx, wy, weaponRotation);
|
||||||
Draw.xscl = 1f;
|
Draw.xscl = 1f;
|
||||||
|
|
||||||
Draw.z(z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Unit unit, WeaponMount mount){
|
public void draw(Unit unit, WeaponMount mount){
|
||||||
@@ -198,6 +192,17 @@ public class Weapon implements Cloneable{
|
|||||||
|
|
||||||
Draw.xscl = -Mathf.sign(flipSprite);
|
Draw.xscl = -Mathf.sign(flipSprite);
|
||||||
|
|
||||||
|
if(parts.size > 0){
|
||||||
|
WeaponPart.params.set(mount.warmup, 1f - Mathf.clamp(mount.reload / reload), mount.heat, wx, wy, weaponRotation + 90);
|
||||||
|
|
||||||
|
for(int i = 0; i < parts.size; i++){
|
||||||
|
var part = parts.items[i];
|
||||||
|
if(part.under){
|
||||||
|
part.draw(WeaponPart.params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Draw.rect(region, wx, wy, weaponRotation);
|
Draw.rect(region, wx, wy, weaponRotation);
|
||||||
|
|
||||||
if(heatRegion.found() && mount.heat > 0){
|
if(heatRegion.found() && mount.heat > 0){
|
||||||
@@ -218,10 +223,11 @@ public class Weapon implements Cloneable{
|
|||||||
Draw.z(Layer.turret);
|
Draw.z(Layer.turret);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
var params = WeaponPart.params.set(mount.warmup, 1f - Mathf.clamp(mount.reload / reload), mount.heat, wx, wy, weaponRotation + 90);
|
for(int i = 0; i < parts.size; i++){
|
||||||
|
var part = parts.items[i];
|
||||||
for(var part : parts){
|
if(!part.under){
|
||||||
part.draw(params);
|
part.draw(WeaponPart.params);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,8 +367,8 @@ public class Weapon implements Cloneable{
|
|||||||
protected Vec2 getShootPos(Unit unit, WeaponMount mount, Vec2 out){
|
protected Vec2 getShootPos(Unit unit, WeaponMount mount, Vec2 out){
|
||||||
float weaponRot = unit.rotation - 90 + (rotate ? mount.rotation : 0);
|
float weaponRot = unit.rotation - 90 + (rotate ? mount.rotation : 0);
|
||||||
return out.set(unit.x, unit.y)
|
return out.set(unit.x, unit.y)
|
||||||
.add(Angles.trnsx(unit.rotation - 90, x, y), Angles.trnsy(unit.rotation - 90, x, y))
|
.add(Angles.trnsx(unit.rotation - 90, x, y), Angles.trnsy(unit.rotation - 90, x, y))
|
||||||
.add(Angles.trnsx(weaponRot, this.shootX, this.shootY), Angles.trnsx(weaponRot, this.shootX, this.shootY));
|
.add(Angles.trnsx(weaponRot, this.shootX, this.shootY), Angles.trnsx(weaponRot, this.shootX, this.shootY));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void shoot(Unit unit, WeaponMount mount, float shootX, float shootY, float aimX, float aimY, float mountX, float mountY, float rotation, int side){
|
protected void shoot(Unit unit, WeaponMount mount, float shootX, float shootY, float aimX, float aimY, float mountX, float mountY, float rotation, int side){
|
||||||
@@ -430,9 +436,9 @@ public class Weapon implements Cloneable{
|
|||||||
|
|
||||||
protected @Nullable Bullet bullet(Unit unit, float shootX, float shootY, float angle, float lifescl){
|
protected @Nullable Bullet bullet(Unit unit, float shootX, float shootY, float angle, float lifescl){
|
||||||
float
|
float
|
||||||
xr = Mathf.range(xRand),
|
xr = Mathf.range(xRand),
|
||||||
x = shootX + Angles.trnsx(angle, 0, xr),
|
x = shootX + Angles.trnsx(angle, 0, xr),
|
||||||
y = shootY + Angles.trnsy(angle, 0, xr);
|
y = shootY + Angles.trnsy(angle, 0, xr);
|
||||||
|
|
||||||
if(unitSpawned == null){
|
if(unitSpawned == null){
|
||||||
return bullet.create(unit, unit.team, x, y, angle, (1f - velocityRnd) + Mathf.random(velocityRnd), lifescl);
|
return bullet.create(unit, unit.team, x, y, angle, (1f - velocityRnd) + Mathf.random(velocityRnd), lifescl);
|
||||||
|
|||||||
@@ -24,4 +24,4 @@ android.useAndroidX=true
|
|||||||
#used for slow jitpack builds; TODO see if this actually works
|
#used for slow jitpack builds; TODO see if this actually works
|
||||||
org.gradle.internal.http.socketTimeout=100000
|
org.gradle.internal.http.socketTimeout=100000
|
||||||
org.gradle.internal.http.connectionTimeout=100000
|
org.gradle.internal.http.connectionTimeout=100000
|
||||||
archash=680252597e
|
archash=476ab38cea
|
||||||
|
|||||||
@@ -515,7 +515,7 @@ public class Generators{
|
|||||||
for(Weapon weapon : weapons){
|
for(Weapon weapon : weapons){
|
||||||
if(outlined.add(weapon.name) && has(weapon.name)){
|
if(outlined.add(weapon.name) && has(weapon.name)){
|
||||||
//only non-top weapons need separate outline sprites (this is mostly just mechs)
|
//only non-top weapons need separate outline sprites (this is mostly just mechs)
|
||||||
if(!weapon.top){
|
if(!weapon.top || weapon.parts.contains(p -> p.under)){
|
||||||
save(outline.get(get(weapon.name)), weapon.name + "-outline");
|
save(outline.get(get(weapon.name)), weapon.name + "-outline");
|
||||||
}else{
|
}else{
|
||||||
//replace weapon with outlined version, no use keeping standard around
|
//replace weapon with outlined version, no use keeping standard around
|
||||||
|
|||||||
Reference in New Issue
Block a user