Merged 4x graphics
This commit is contained in:
@@ -160,9 +160,7 @@ public class Blocks extends BlockList implements ContentList{
|
||||
minimapColor = Color.valueOf("549d5b");
|
||||
}};
|
||||
|
||||
shrub = new Rock("shrub"){{
|
||||
shadow = "shrubshadow";
|
||||
}};
|
||||
shrub = new Rock("shrub");
|
||||
|
||||
rock = new Rock("rock"){{
|
||||
variants = 2;
|
||||
|
||||
@@ -40,7 +40,6 @@ public class DebugBlocks extends BlockList implements ContentList{
|
||||
powerVoid = new PowerBlock("powervoid"){
|
||||
{
|
||||
powerCapacity = Float.MAX_VALUE;
|
||||
shadow = "shadow-round-1";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,7 +55,6 @@ public class DebugBlocks extends BlockList implements ContentList{
|
||||
maxNodes = 100;
|
||||
outputsPower = true;
|
||||
consumesPower = false;
|
||||
shadow = "shadow-round-1";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,13 +12,11 @@ public class LiquidBlocks extends BlockList implements ContentList{
|
||||
public void load(){
|
||||
|
||||
mechanicalPump = new Pump("mechanical-pump"){{
|
||||
shadow = "shadow-round-1";
|
||||
pumpAmount = 0.1f;
|
||||
tier = 0;
|
||||
}};
|
||||
|
||||
rotaryPump = new Pump("rotary-pump"){{
|
||||
shadow = "shadow-rounded-2";
|
||||
pumpAmount = 0.2f;
|
||||
consumes.power(0.015f);
|
||||
liquidCapacity = 30f;
|
||||
@@ -29,7 +27,6 @@ public class LiquidBlocks extends BlockList implements ContentList{
|
||||
}};
|
||||
|
||||
thermalPump = new Pump("thermal-pump"){{
|
||||
shadow = "shadow-rounded-2";
|
||||
pumpAmount = 0.275f;
|
||||
consumes.power(0.03f);
|
||||
liquidCapacity = 40f;
|
||||
|
||||
@@ -72,7 +72,6 @@ public class PowerBlocks extends BlockList implements ContentList{
|
||||
}};
|
||||
|
||||
powerNode = new PowerNode("power-node"){{
|
||||
shadow = "shadow-round-1";
|
||||
maxNodes = 4;
|
||||
laserRange = 6;
|
||||
}};
|
||||
@@ -81,7 +80,6 @@ public class PowerBlocks extends BlockList implements ContentList{
|
||||
size = 2;
|
||||
maxNodes = 6;
|
||||
laserRange = 9.5f;
|
||||
shadow = "shadow-round-2";
|
||||
}};
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +45,6 @@ public class UnitBlocks extends BlockList implements ContentList{
|
||||
produceTime = 3600;
|
||||
size = 3;
|
||||
consumes.power(0.2f);
|
||||
shadow = "shadow-round-3";
|
||||
consumes.items(new ItemStack(Items.silicon, 30), new ItemStack(Items.titanium, 30), new ItemStack(Items.plastanium, 20));
|
||||
}};
|
||||
|
||||
@@ -54,7 +53,6 @@ public class UnitBlocks extends BlockList implements ContentList{
|
||||
produceTime = 8000;
|
||||
size = 4;
|
||||
consumes.power(0.3f);
|
||||
shadow = "shadow-round-4";
|
||||
consumes.items(new ItemStack(Items.silicon, 80), new ItemStack(Items.titanium, 80), new ItemStack(Items.plastanium, 50));
|
||||
}};
|
||||
|
||||
@@ -71,7 +69,6 @@ public class UnitBlocks extends BlockList implements ContentList{
|
||||
produceTime = 3400;
|
||||
size = 3;
|
||||
consumes.power(0.15f);
|
||||
shadow = "shadow-round-3";
|
||||
consumes.items(new ItemStack(Items.silicon, 20), new ItemStack(Items.thorium, 30));
|
||||
}};
|
||||
|
||||
@@ -80,12 +77,10 @@ public class UnitBlocks extends BlockList implements ContentList{
|
||||
produceTime = 5000;
|
||||
size = 3;
|
||||
consumes.power(0.2f);
|
||||
shadow = "shadow-round-3";
|
||||
consumes.items(new ItemStack(Items.silicon, 40), new ItemStack(Items.thorium, 50));
|
||||
}};
|
||||
|
||||
repairPoint = new RepairPoint("repair-point"){{
|
||||
shadow = "shadow-round-1";
|
||||
repairSpeed = 0.1f;
|
||||
}};
|
||||
|
||||
|
||||
@@ -37,28 +37,24 @@ public class UpgradeBlocks extends BlockList{
|
||||
mech = Mechs.dart;
|
||||
size = 2;
|
||||
powerCapacity = 50f;
|
||||
shadow = "shadow-rounded-2";
|
||||
}};
|
||||
|
||||
javelinPad = new MechPad("javelin-ship-pad"){{
|
||||
mech = Mechs.javelin;
|
||||
size = 2;
|
||||
powerCapacity = 80f;
|
||||
shadow = "shadow-rounded-2";
|
||||
}};
|
||||
|
||||
tridentPad = new MechPad("trident-ship-pad"){{
|
||||
mech = Mechs.trident;
|
||||
size = 2;
|
||||
powerCapacity = 100f;
|
||||
shadow = "shadow-rounded-2";
|
||||
}};
|
||||
|
||||
glaivePad = new MechPad("glaive-ship-pad"){{
|
||||
mech = Mechs.glaive;
|
||||
size = 3;
|
||||
powerCapacity = 120f;
|
||||
shadow = "shadow-round-3";
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ public class BlockFx extends FxList implements ContentList{
|
||||
Lines.stroke(e.fout() * 2f);
|
||||
|
||||
Angles.randLenVectors(e.id, 30, 4f + 40f * e.fin(), (x, y) -> {
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), e.fin() * 4f + 1f);
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fin() * 4f + 1f);
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
@@ -246,7 +246,7 @@ public class BlockFx extends FxList implements ContentList{
|
||||
Lines.circle(e.x, e.y, 7f + e.fout() * 8f);
|
||||
|
||||
Angles.randLenVectors(e.id, 20, 6f + 20f * e.fout(), (x, y) -> {
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), e.fin() * 4f + 1f);
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fin() * 4f + 1f);
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
@@ -257,7 +257,7 @@ public class BlockFx extends FxList implements ContentList{
|
||||
Lines.circle(e.x, e.y, 7f + e.fin() * 8f);
|
||||
|
||||
Angles.randLenVectors(e.id, 20, 4f + 20f * e.fin(), (x, y) -> {
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), e.fslope() * 4f + 1f);
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fslope() * 4f + 1f);
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
|
||||
@@ -29,7 +29,7 @@ public class BulletFx extends FxList implements ContentList{
|
||||
Lines.stroke(0.5f + e.fout());
|
||||
|
||||
Angles.randLenVectors(e.id, 5, e.fin() * 15f, (x, y) -> {
|
||||
float ang = Mathf.atan2(x, y);
|
||||
float ang = Mathf.angle(x, y);
|
||||
Lines.lineAngle(e.x + x, e.y + y, ang, e.fout() * 3 + 1f);
|
||||
});
|
||||
|
||||
@@ -48,7 +48,7 @@ public class BulletFx extends FxList implements ContentList{
|
||||
Lines.stroke(0.5f + e.fout());
|
||||
|
||||
Angles.randLenVectors(e.id, 6, e.fin() * 15f, (x, y) -> {
|
||||
float ang = Mathf.atan2(x, y);
|
||||
float ang = Mathf.angle(x, y);
|
||||
Lines.lineAngle(e.x + x, e.y + y, ang, e.fout() * 3 + 1f);
|
||||
});
|
||||
|
||||
@@ -60,7 +60,7 @@ public class BulletFx extends FxList implements ContentList{
|
||||
Lines.stroke(0.5f + e.fout() * 1.5f);
|
||||
|
||||
Angles.randLenVectors(e.id, 8, e.finpow() * 30f, e.rotation, 50f, (x, y) -> {
|
||||
float ang = Mathf.atan2(x, y);
|
||||
float ang = Mathf.angle(x, y);
|
||||
Lines.lineAngle(e.x + x, e.y + y, ang, e.fout() * 4 + 1.5f);
|
||||
});
|
||||
|
||||
@@ -72,7 +72,7 @@ public class BulletFx extends FxList implements ContentList{
|
||||
Lines.stroke(0.5f + e.fout());
|
||||
|
||||
Angles.randLenVectors(e.id, 5, e.fin() * 15f, e.rotation, 50f, (x, y) -> {
|
||||
float ang = Mathf.atan2(x, y);
|
||||
float ang = Mathf.angle(x, y);
|
||||
Lines.lineAngle(e.x + x, e.y + y, ang, e.fout() * 3 + 1f);
|
||||
});
|
||||
|
||||
@@ -94,7 +94,7 @@ public class BulletFx extends FxList implements ContentList{
|
||||
Lines.stroke(e.fout() * 1.5f);
|
||||
|
||||
Angles.randLenVectors(e.id, 8, e.finpow() * 17f, e.rotation, 360f, (x, y) -> {
|
||||
float ang = Mathf.atan2(x, y);
|
||||
float ang = Mathf.angle(x, y);
|
||||
Lines.lineAngle(e.x + x, e.y + y, ang, e.fout() * 4 + 1f);
|
||||
});
|
||||
|
||||
@@ -106,7 +106,7 @@ public class BulletFx extends FxList implements ContentList{
|
||||
Lines.stroke(e.fout() * 2f);
|
||||
|
||||
Angles.randLenVectors(e.id, 6, e.finpow() * 18f, e.rotation, 360f, (x, y) -> {
|
||||
float ang = Mathf.atan2(x, y);
|
||||
float ang = Mathf.angle(x, y);
|
||||
Lines.lineAngle(e.x + x, e.y + y, ang, e.fout() * 4 + 1f);
|
||||
});
|
||||
|
||||
@@ -125,7 +125,7 @@ public class BulletFx extends FxList implements ContentList{
|
||||
Lines.stroke(e.fout());
|
||||
|
||||
Angles.randLenVectors(e.id, 7, e.fin() * 7f, e.rotation, 40f, (x, y) -> {
|
||||
float ang = Mathf.atan2(x, y);
|
||||
float ang = Mathf.angle(x, y);
|
||||
Lines.lineAngle(e.x + x, e.y + y, ang, e.fout() * 2 + 1f);
|
||||
});
|
||||
|
||||
@@ -150,7 +150,7 @@ public class BulletFx extends FxList implements ContentList{
|
||||
Lines.stroke(1f * e.fout());
|
||||
|
||||
Angles.randLenVectors(e.id + 1, 4, 1f + 23f * e.finpow(), (x, y) -> {
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), 1f + e.fout() * 3f);
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
@@ -174,7 +174,7 @@ public class BulletFx extends FxList implements ContentList{
|
||||
Lines.stroke(1f * e.fout());
|
||||
|
||||
Angles.randLenVectors(e.id + 1, 4, 1f + 25f * e.finpow(), (x, y) -> {
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), 1f + e.fout() * 3f);
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
@@ -198,7 +198,7 @@ public class BulletFx extends FxList implements ContentList{
|
||||
Lines.stroke(1f * e.fout());
|
||||
|
||||
Angles.randLenVectors(e.id + 1, 4, 1f + 30f * e.finpow(), (x, y) -> {
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), 1f + e.fout() * 3f);
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
@@ -222,7 +222,7 @@ public class BulletFx extends FxList implements ContentList{
|
||||
Lines.stroke(1f * e.fout());
|
||||
|
||||
Angles.randLenVectors(e.id + 1, 4, 1f + 23f * e.finpow(), (x, y) -> {
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), 1f + e.fout() * 3f);
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
@@ -271,7 +271,7 @@ public class BulletFx extends FxList implements ContentList{
|
||||
Lines.stroke(1f * e.fout());
|
||||
|
||||
Angles.randLenVectors(e.id + 1, 4, 1f + 23f * e.finpow(), (x, y) -> {
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), 1f + e.fout() * 3f);
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ExplosionFx extends FxList implements ContentList{
|
||||
Lines.stroke(1.5f * e.fout());
|
||||
|
||||
Angles.randLenVectors(e.id + 1, 8, 1f + 23f * e.finpow(), (x, y) -> {
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), 1f + e.fout() * 3f);
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
@@ -77,7 +77,7 @@ public class ExplosionFx extends FxList implements ContentList{
|
||||
Lines.stroke(1.7f * e.fout());
|
||||
|
||||
Angles.randLenVectors(e.id + 1, 9, 1f + 23f * e.finpow(), (x, y) -> {
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), 1f + e.fout() * 3f);
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
|
||||
@@ -177,7 +177,7 @@ public class ShootFx extends FxList implements ContentList{
|
||||
Draw.color(Palette.lancerLaser);
|
||||
|
||||
Angles.randLenVectors(e.id, 7, 80f, e.rotation, 0f, (x, y) -> {
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), e.fout() * 9f);
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fout() * 9f);
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
@@ -187,7 +187,7 @@ public class ShootFx extends FxList implements ContentList{
|
||||
Draw.color(Palette.lancerLaser);
|
||||
|
||||
Angles.randLenVectors(e.id, 2, 1f + 20f * e.fout(), e.rotation, 120f, (x, y) -> {
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), e.fslope() * 3f + 1f);
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fslope() * 3f + 1f);
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
@@ -205,7 +205,7 @@ public class ShootFx extends FxList implements ContentList{
|
||||
Draw.color(Palette.lancerLaser);
|
||||
|
||||
Angles.randLenVectors(e.id, 2, 1f + 20f * e.fout(), e.rotation, 120f, (x, y) -> {
|
||||
Shapes.tri(e.x + x, e.y + y, e.fslope() * 3f + 1, e.fslope() * 3f + 1, Mathf.atan2(x, y));
|
||||
Shapes.tri(e.x + x, e.y + y, e.fslope() * 3f + 1, e.fslope() * 3f + 1, Mathf.angle(x, y));
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
@@ -216,7 +216,7 @@ public class ShootFx extends FxList implements ContentList{
|
||||
Lines.stroke(e.fout() * 1.2f + 0.5f);
|
||||
|
||||
Angles.randLenVectors(e.id, 7, 25f * e.finpow(), e.rotation, 50f, (x, y) -> {
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), e.fin() * 5f + 2f);
|
||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fin() * 5f + 2f);
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
|
||||
@@ -6,6 +6,7 @@ import io.anuke.arc.Events;
|
||||
import io.anuke.arc.entities.Effects;
|
||||
import io.anuke.arc.entities.EntityQuery;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.graphics.g2d.TextureAtlas;
|
||||
import io.anuke.arc.input.KeyCode;
|
||||
import io.anuke.arc.scene.ui.TextField;
|
||||
@@ -61,8 +62,13 @@ public class Control implements ApplicationListener{
|
||||
|
||||
content.initialize(Content::init);
|
||||
Core.atlas = new TextureAtlas("sprites/sprites.atlas");
|
||||
Draw.scl = 1f / Core.atlas.find("scale_marker").getWidth();
|
||||
content.initialize(Content::load);
|
||||
|
||||
if(Core.atlas.getTextures().size != 1){
|
||||
throw new IllegalStateException("Atlas must be exactly one texture.");
|
||||
}
|
||||
|
||||
unlocks.load();
|
||||
|
||||
Core.settings.setAppName(appName);
|
||||
@@ -284,7 +290,7 @@ public class Control implements ApplicationListener{
|
||||
Core.settings.put("4.0-warning-2", true);
|
||||
Core.settings.save();
|
||||
}).size(100f, 60f);
|
||||
dialog.content().add("Reminder: The beta version you are about to play is very unstable, and is [accent]not representative of the final 4.0 release.[]\n\n " +
|
||||
dialog.content().add("Reminder: The alpha version you are about to play is very unstable, and is [accent]not representative of the final 4.0 release.[]\n\n " +
|
||||
"\nThere is currently[scarlet] no sound implemented[]; this is intentional.\n" +
|
||||
"All current art and UI is temporary, and will be re-drawn before release. " +
|
||||
"\n\n[accent]Saves and maps may be corrupted without warning between updates.").wrap().width(400f);
|
||||
|
||||
@@ -170,7 +170,9 @@ public class Renderer implements ApplicationListener{
|
||||
drawAndInterpolate(groundEffectGroup, e -> !(e instanceof BelowLiquidTrait));
|
||||
|
||||
blocks.processBlocks();
|
||||
|
||||
blocks.drawShadows();
|
||||
|
||||
for(Team team : Team.all){
|
||||
if(blocks.isTeamShown(team)){
|
||||
blocks.drawTeamBlocks(Layer.block, team);
|
||||
@@ -201,23 +203,21 @@ public class Renderer implements ApplicationListener{
|
||||
|
||||
//TODO shield
|
||||
/*
|
||||
Graphics.beginShaders(Shaders.shield);
|
||||
EntityDraw.draw(shieldGroup);
|
||||
EntityDraw.drawWith(shieldGroup, shield -> true, shield -> ((ShieldEntity)shield).drawOver());
|
||||
Draw.color(Palette.accent);
|
||||
Graphics.endShaders();
|
||||
Draw.color();
|
||||
if(shieldGroup.size() > 0){
|
||||
Graphics.beginShaders(Shaders.shield);
|
||||
EntityDraw.draw(shieldGroup);
|
||||
EntityDraw.drawWith(shieldGroup, shield -> true, shield -> ((ShieldEntity)shield).drawOver());
|
||||
Draw.color(Palette.accent);
|
||||
Graphics.endShaders();
|
||||
Draw.color();
|
||||
}
|
||||
*/
|
||||
|
||||
overlays.drawTop();
|
||||
|
||||
//TODO this isn't necessary anymore
|
||||
//Graphics.beginCam();
|
||||
|
||||
EntityDraw.setClip(false);
|
||||
drawAndInterpolate(playerGroup, p -> !p.isDead() && !p.isLocal, Player::drawName);
|
||||
EntityDraw.setClip(true);
|
||||
//Graphics.end();
|
||||
|
||||
Draw.color();
|
||||
Draw.flush();
|
||||
@@ -308,7 +308,6 @@ public class Renderer implements ApplicationListener{
|
||||
float vpW = camera.width, vpH = camera.height;
|
||||
int w = world.width()*tilesize, h = world.height()*tilesize;
|
||||
int pw = pixelSurface.width(), ph = pixelSurface.height();
|
||||
showFog = false;
|
||||
disableUI = true;
|
||||
pixelSurface.setSize(w, h, true);
|
||||
Graphics.getEffectSurface().setSize(w, h, true);
|
||||
@@ -319,7 +318,6 @@ public class Renderer implements ApplicationListener{
|
||||
|
||||
draw();
|
||||
|
||||
showFog = true;
|
||||
disableUI = false;
|
||||
camera.width = vpW;
|
||||
camera.height = vpH;
|
||||
|
||||
@@ -121,12 +121,12 @@ public class MapRenderer implements Disposable{
|
||||
if(wall.rotate){
|
||||
mesh.draw((wx % chunksize) + (wy % chunksize) * chunksize, region,
|
||||
wx * tilesize + wall.offset(), wy * tilesize + wall.offset(),
|
||||
region.getWidth(), region.getHeight(), rotation * 90 - 90);
|
||||
region.getWidth() * Draw.scl, region.getHeight() * Draw.scl, rotation * 90 - 90);
|
||||
}else{
|
||||
mesh.draw((wx % chunksize) + (wy % chunksize) * chunksize, region,
|
||||
wx * tilesize + wall.offset() + (tilesize - region.getWidth())/2f,
|
||||
wy * tilesize + wall.offset() + (tilesize - region.getHeight())/2f,
|
||||
region.getWidth(), region.getHeight());
|
||||
wx * tilesize + wall.offset() + (tilesize - region.getWidth() * Draw.scl)/2f,
|
||||
wy * tilesize + wall.offset() + (tilesize - region.getHeight() * Draw.scl)/2f,
|
||||
region.getWidth() * Draw.scl, region.getHeight() * Draw.scl);
|
||||
}
|
||||
}else{
|
||||
region = floor.getEditorIcon();
|
||||
@@ -150,7 +150,7 @@ public class MapRenderer implements Disposable{
|
||||
|
||||
mesh.draw((wx % chunksize) + (wy % chunksize) * chunksize + chunksize * chunksize, region,
|
||||
wx * tilesize - (wall.size/3) * tilesize, wy * tilesize - (wall.size/3) * tilesize,
|
||||
region.getWidth(), region.getHeight());
|
||||
region.getWidth() * Draw.scl, region.getHeight() * Draw.scl);
|
||||
mesh.setColor(Color.WHITE);
|
||||
}
|
||||
|
||||
|
||||
@@ -319,7 +319,9 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
Draw.rect(mech.legRegion,
|
||||
x + Angles.trnsx(baseRotation, ft * i + boostTrnsY, -boostTrnsX * i),
|
||||
y + Angles.trnsy(baseRotation, ft * i + boostTrnsY, -boostTrnsX * i),
|
||||
mech.legRegion.getWidth() * i, mech.legRegion.getHeight() - Mathf.clamp(ft * i, 0, 2), baseRotation - 90 + boostAng * i);
|
||||
mech.legRegion.getWidth() * i * Draw.scl,
|
||||
(mech.legRegion.getHeight() - Mathf.clamp(ft * i, 0, 2)) * Draw.scl,
|
||||
baseRotation - 90 + boostAng * i);
|
||||
}
|
||||
|
||||
Draw.rect(mech.baseRegion, x, y, baseRotation - 90);
|
||||
@@ -340,7 +342,10 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
float w = i > 0 ? -mech.weapon.equipRegion.getWidth() : mech.weapon.equipRegion.getWidth();
|
||||
Draw.rect(mech.weapon.equipRegion,
|
||||
x + Angles.trnsx(tra, (mech.weaponOffsetX + mech.spreadX(this)) * i, trY),
|
||||
y + Angles.trnsy(tra, (mech.weaponOffsetX + mech.spreadX(this)) * i, trY), w, mech.weapon.equipRegion.getHeight(), rotation - 90);
|
||||
y + Angles.trnsy(tra, (mech.weaponOffsetX + mech.spreadX(this)) * i, trY),
|
||||
w * Draw.scl,
|
||||
mech.weapon.equipRegion.getHeight() * Draw.scl,
|
||||
rotation - 90);
|
||||
}
|
||||
|
||||
float backTrns = 4f, itemSize = 5f;
|
||||
|
||||
@@ -104,7 +104,7 @@ public abstract class GroundUnit extends BaseUnit{
|
||||
@Override
|
||||
public void move(float x, float y){
|
||||
if(Mathf.dst(x, y) > 0.01f){
|
||||
baseRotation = Mathf.slerpDelta(baseRotation, Mathf.atan2(x, y), type.baseRotateSpeed);
|
||||
baseRotation = Mathf.slerpDelta(baseRotation, Mathf.angle(x, y), type.baseRotateSpeed);
|
||||
}
|
||||
super.move(x, y);
|
||||
}
|
||||
|
||||
@@ -82,11 +82,12 @@ public class BlockRenderer{
|
||||
return;
|
||||
}
|
||||
|
||||
int shadowW = rangex * tilesize*2, shadowH = rangey * tilesize*2;
|
||||
int shadowW = (int)(rangex * tilesize*2/Draw.scl), shadowH = (int)(rangey * tilesize*2/Draw.scl);
|
||||
|
||||
teamChecks.clear();
|
||||
requestidx = 0;
|
||||
|
||||
//TODO fix shadows
|
||||
Draw.flush();
|
||||
Draw.proj().setOrtho(Mathf.round(camera.position.x, tilesize)-shadowW/2f, Mathf.round(camera.position.y, tilesize)-shadowH/2f,
|
||||
shadowW, shadowH);
|
||||
@@ -136,6 +137,7 @@ public class BlockRenderer{
|
||||
}
|
||||
}
|
||||
|
||||
//TODO proper shadows
|
||||
Draw.flush();
|
||||
shadows.end();
|
||||
|
||||
@@ -149,10 +151,6 @@ public class BlockRenderer{
|
||||
lastRangeY = rangey;
|
||||
}
|
||||
|
||||
public int getRequests(){
|
||||
return requestidx;
|
||||
}
|
||||
|
||||
public void drawBlocks(Layer stopAt){
|
||||
|
||||
for(; iterateidx < requestidx; iterateidx++){
|
||||
|
||||
@@ -21,8 +21,7 @@ import io.anuke.mindustry.world.blocks.Floor;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class FloorRenderer{
|
||||
private final static int chunksize = 64;
|
||||
@@ -194,7 +193,7 @@ public class FloorRenderer{
|
||||
if(cbatch != null) cbatch.dispose();
|
||||
|
||||
int chunksx = Mathf.ceil((float) (world.width()) / chunksize),
|
||||
chunksy = Mathf.ceil((float) (world.height()) / chunksize) ;
|
||||
chunksy = Mathf.ceil((float) (world.height()) / chunksize) ;
|
||||
cache = new Chunk[chunksx][chunksy];
|
||||
cbatch = new CacheBatch(world.width() * world.height() * 4 * 4);
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ import io.anuke.arc.math.Mathf;
|
||||
public class Shapes{
|
||||
|
||||
public static void laser(String line, String edge, float x, float y, float x2, float y2, float scale){
|
||||
laser(line, edge, x, y, x2, y2, Mathf.atan2(x2 - x, y2 - y), scale);
|
||||
laser(line, edge, x, y, x2, y2, Mathf.angle(x2 - x, y2 - y), scale);
|
||||
}
|
||||
|
||||
public static void laser(String line, String edge, float x, float y, float x2, float y2){
|
||||
laser(line, edge, x, y, x2, y2, Mathf.atan2(x2 - x, y2 - y), 1f);
|
||||
laser(line, edge, x, y, x2, y2, Mathf.angle(x2 - x, y2 - y), 1f);
|
||||
}
|
||||
|
||||
public static void laser(String line, String edge, float x, float y, float x2, float y2, float rotation, float scale){
|
||||
|
||||
@@ -49,7 +49,8 @@ public class DesktopInput extends InputHandler{
|
||||
|
||||
for(TextureRegion region : regions){
|
||||
Draw.rect(region, x * tilesize + block.offset(), y * tilesize + block.offset(),
|
||||
region.getWidth() * selectScale, region.getHeight() * selectScale, block.rotate ? rotation * 90 : 0);
|
||||
region.getWidth() * selectScale * Draw.scl,
|
||||
region.getHeight() * selectScale * Draw.scl, block.rotate ? rotation * 90 : 0);
|
||||
}
|
||||
}else{
|
||||
Draw.color(Palette.removeBack);
|
||||
|
||||
@@ -177,7 +177,8 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
for(TextureRegion region : regions){
|
||||
Draw.rect(region, tile.worldx() + offset, tile.worldy() + offset,
|
||||
region.getWidth() * request.scale, region.getHeight() * request.scale,
|
||||
region.getWidth() * request.scale * Draw.scl,
|
||||
region.getHeight() * request.scale * Draw.scl,
|
||||
request.recipe.result.rotate ? request.rotation * 90 : 0);
|
||||
}
|
||||
}else{
|
||||
@@ -345,7 +346,9 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
for(TextureRegion region : regions){
|
||||
Draw.rect(region, x * tilesize + recipe.result.offset(), y * tilesize + recipe.result.offset(),
|
||||
region.getWidth() * lineScale, region.getHeight() * lineScale, recipe.result.rotate ? result.rotation * 90 : 0);
|
||||
region.getWidth() * lineScale * Draw.scl,
|
||||
region.getHeight() * lineScale * Draw.scl,
|
||||
recipe.result.rotate ? result.rotation * 90 : 0);
|
||||
}
|
||||
}else{
|
||||
Draw.color(Palette.removeBack);
|
||||
@@ -734,4 +737,4 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
return world.tileWorld(x - (recipe == null ? 0 : recipe.result.offset()), y - (recipe == null ? 0 : recipe.result.offset()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,13 +23,13 @@ public class BackgroundFragment extends Fragment{
|
||||
Draw.shader();
|
||||
|
||||
boolean portrait = Core.graphics.getWidth() < Core.graphics.getHeight();
|
||||
float logoscl = (int) Unit.dp.scl(7) * (portrait ? 5f / 7f : 1f);
|
||||
float logoscl = (int) Unit.dp.scl(1) * (portrait ? 5f / 7f : 1f);
|
||||
TextureRegion logo = Core.atlas.find("logotext");
|
||||
float logow = logo.getWidth() * logoscl;
|
||||
float logoh = logo.getHeight() * logoscl;
|
||||
|
||||
Draw.color();
|
||||
Draw.rect(logo, (int) (w / 2), (int) (h - logoh + 15 - Unit.dp.scl(portrait ? 30f : 0)) + logoh/2, logow, logoh);
|
||||
Draw.rect(logo, (int) (w / 2), (int) (h - 10 - logoh - Unit.dp.scl(portrait ? 30f : 0)) + logoh/2, logow, logoh);
|
||||
}).visible(() -> state.is(State.menu)).grow();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ public class PlacementFragment extends Fragment{
|
||||
});
|
||||
}).colspan(3).fillX().visible(() -> getSelected() != null || tileDisplayBlock() != null).touchable(Touchable.enabled);
|
||||
frame.row();
|
||||
frame.addImage("blank").color(Palette.accent).colspan(3).height(3 * 2).growX();
|
||||
frame.addImage("blank").color(Palette.accent).colspan(3).height(3).growX();
|
||||
frame.row();
|
||||
frame.table("pane-2", blocksSelect -> {
|
||||
blocksSelect.margin(4).marginTop(0);
|
||||
|
||||
@@ -85,8 +85,6 @@ public class Block extends BaseBlock {
|
||||
public EnumSet<BlockFlag> flags;
|
||||
/** Whether to automatically set the entity to 'sleeping' when created. */
|
||||
public boolean autoSleep;
|
||||
/** Name of shadow region to load. Null to indicate normal shadow. */
|
||||
public String shadow = null;
|
||||
/** Whether the block can be tapped and selected to configure. */
|
||||
public boolean configurable;
|
||||
/** Whether this block consumes touchDown events when tapped. */
|
||||
@@ -108,7 +106,6 @@ public class Block extends BaseBlock {
|
||||
protected TextureRegion[] compactIcon;
|
||||
protected TextureRegion editorIcon;
|
||||
|
||||
public TextureRegion shadowRegion;
|
||||
public TextureRegion region;
|
||||
|
||||
public Block(String name){
|
||||
@@ -256,7 +253,6 @@ public class Block extends BaseBlock {
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
shadowRegion = Core.atlas.find(shadow == null ? "shadow-" + size : shadow);
|
||||
region = Core.atlas.find(name);
|
||||
}
|
||||
|
||||
@@ -486,8 +482,8 @@ public class Block extends BaseBlock {
|
||||
/** Crops a regionto 8x8 */
|
||||
protected TextureRegion iconRegion(TextureRegion src){
|
||||
TextureRegion region = new TextureRegion(src);
|
||||
region.setWidth(8);
|
||||
region.setHeight(8);
|
||||
region.setWidth((int)(8 / Draw.scl));
|
||||
region.setHeight((int)(8 / Draw.scl));
|
||||
return region;
|
||||
}
|
||||
|
||||
@@ -507,7 +503,7 @@ public class Block extends BaseBlock {
|
||||
}
|
||||
|
||||
public void drawShadow(Tile tile){
|
||||
Draw.rect(shadowRegion, tile.drawx(), tile.drawy());
|
||||
draw(tile);
|
||||
}
|
||||
|
||||
/** Offset for placing and drawing multiblocks. */
|
||||
|
||||
@@ -39,7 +39,7 @@ public class Edges{
|
||||
edges[i][idx++] = new Point2(top, bot + j + 1);
|
||||
}
|
||||
|
||||
Arrays.sort(edges[i], (e1, e2) -> Float.compare(Mathf.atan2(e1.x, e1.y), Mathf.atan2(e2.x, e2.y)));
|
||||
Arrays.sort(edges[i], (e1, e2) -> Float.compare(Mathf.angle(e1.x, e1.y), Mathf.angle(e2.x, e2.y)));
|
||||
|
||||
edgeInside[i] = new Point2[edges[i].length];
|
||||
|
||||
|
||||
@@ -149,16 +149,7 @@ public class BuildBlock extends Block{
|
||||
|
||||
@Override
|
||||
public void drawShadow(Tile tile){
|
||||
BuildEntity entity = tile.entity();
|
||||
|
||||
Recipe recipe = entity.recipe;
|
||||
Block previous = entity.previous;
|
||||
|
||||
if(recipe != null){
|
||||
Draw.rect(recipe.result.shadowRegion, tile.drawx(), tile.drawy());
|
||||
}else if(previous != null && !(previous instanceof BuildBlock)){
|
||||
previous.drawShadow(tile);
|
||||
}
|
||||
//don't
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,6 +17,8 @@ import io.anuke.mindustry.type.StatusEffect;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
|
||||
public class Floor extends Block{
|
||||
/** number of different variant regions to use */
|
||||
public int variants;
|
||||
@@ -76,19 +78,23 @@ public class Floor extends Block{
|
||||
|
||||
TextureRegion result = new TextureRegion();
|
||||
|
||||
int sx = -dx * 8 + 2, sy = -dy * 8 + 2;
|
||||
int x = Mathf.clamp(sx, 0, 12);
|
||||
int y = Mathf.clamp(sy, 0, 12);
|
||||
int w = Mathf.clamp(sx + 8, 0, 12) - x, h = Mathf.clamp(sy + 8, 0, 12) - y;
|
||||
int padSize = (int)(tilesize/Draw.scl/2);
|
||||
int texSize = (int)(tilesize/Draw.scl);
|
||||
int totSize = padSize + texSize;
|
||||
|
||||
float rx = Mathf.clamp(dx * 8, 0, 8 - w);
|
||||
float ry = Mathf.clamp(dy * 8, 0, 8 - h);
|
||||
int sx = -dx * texSize + padSize/2, sy = -dy * texSize + padSize/2;
|
||||
int x = Mathf.clamp(sx, 0, totSize);
|
||||
int y = Mathf.clamp(sy, 0, totSize);
|
||||
int w = Mathf.clamp(sx + texSize, 0, totSize) - x, h = Mathf.clamp(sy + texSize, 0, totSize) - y;
|
||||
|
||||
float rx = Mathf.clamp(dx * texSize, 0, texSize - w);
|
||||
float ry = Mathf.clamp(dy * texSize, 0, texSize - h);
|
||||
|
||||
result.setTexture(edgeRegion.getTexture());
|
||||
result.set(edgeRegion.getX() + x, edgeRegion.getY() + y + h, w, -h);
|
||||
|
||||
edgeRegions[i] = result;
|
||||
offsets[i] = new Vector2(-4 + rx, -4 + ry);
|
||||
offsets[i] = new Vector2(-padSize + rx, -padSize + ry);
|
||||
}
|
||||
|
||||
cliffRegions = new TextureRegion[4];
|
||||
@@ -172,13 +178,20 @@ public class Floor extends Block{
|
||||
if(other == null) continue;
|
||||
|
||||
Floor floor = other.floor();
|
||||
Floor cur = this;
|
||||
if(floor instanceof OreBlock) floor = ((OreBlock) floor).base;
|
||||
if(cur instanceof OreBlock) cur = ((OreBlock) cur).base;
|
||||
|
||||
if(floor.edgeRegions == null || (floor.id <= this.id && !(tile.getElevation() != -1 && other.getElevation() > tile.getElevation())) || (!blends.test(floor) && !tileBlends.test(tile, other)) || (floor.cacheLayer.ordinal() > this.cacheLayer.ordinal() && !sameLayer) ||
|
||||
(sameLayer && floor.cacheLayer == this.cacheLayer)) continue;
|
||||
if(floor.edgeRegions == null || (floor.id <= cur.id && !(tile.getElevation() != -1 && other.getElevation() > tile.getElevation())) || (!cur.blends.test(floor) && !cur.tileBlends.test(tile, other)) || (floor.cacheLayer.ordinal() > cur.cacheLayer.ordinal() && !sameLayer) ||
|
||||
(sameLayer && floor.cacheLayer == cur.cacheLayer)) continue;
|
||||
|
||||
TextureRegion region = floor.edgeRegions[i];
|
||||
|
||||
Draw.rect(region, tile.worldx() + floor.offsets[i].x + region.getWidth()/2f, tile.worldy() + floor.offsets[i].y + region.getHeight()/2f, region.getWidth(), region.getHeight());
|
||||
Draw.rect(region,
|
||||
tile.worldx() + floor.offsets[i].x * Draw.scl + Draw.scl * region.getWidth()/2f,
|
||||
tile.worldy() + floor.offsets[i].y * Draw.scl + Draw.scl * region.getHeight()/2f,
|
||||
region.getWidth() * Draw.scl,
|
||||
region.getHeight() * Draw.scl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package io.anuke.mindustry.world.blocks;
|
||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
@@ -18,8 +17,6 @@ public class OreBlock extends Floor{
|
||||
this.base = base;
|
||||
this.variants = 3;
|
||||
this.minimapColor = ore.color;
|
||||
this.blends = block -> (block instanceof OreBlock && ((OreBlock) block).base != base) || (!(block instanceof OreBlock) && block != base);
|
||||
this.tileBlends = (tile, other) -> tile.getElevation() < other.getElevation();
|
||||
this.edge = base.name;
|
||||
}
|
||||
|
||||
@@ -50,8 +47,4 @@ public class OreBlock extends Floor{
|
||||
base.drawEdges(tile, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean blendOverride(Block block){
|
||||
return block == base;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,15 +26,6 @@ public class Rock extends Block{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawShadow(Tile tile){
|
||||
if(shadowRegions != null){
|
||||
Draw.rect(shadowRegions[(Mathf.randomSeed(tile.pos(), 0, variants - 1))], tile.worldx(), tile.worldy());
|
||||
}else if(shadowRegion != null){
|
||||
Draw.rect(shadowRegion, tile.drawx(), tile.drawy());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
super.load();
|
||||
|
||||
@@ -24,7 +24,6 @@ public class ShockMine extends Block{
|
||||
update = false;
|
||||
destructible = true;
|
||||
solid = false;
|
||||
shadow = "shadow-shock-mine";
|
||||
targetable = false;
|
||||
layer = Layer.overlay;
|
||||
}
|
||||
|
||||
@@ -133,8 +133,6 @@ public abstract class Turret extends Block{
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
Draw.rect(baseRegion, tile.drawx(), tile.drawy());
|
||||
Draw.color(tile.getTeam().color, Color.WHITE, 0.45f);
|
||||
Draw.rect(baseTopRegion, tile.drawx(), tile.drawy());
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
|
||||
@@ -38,17 +38,6 @@ public class Conduit extends LiquidBlock{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawShadow(Tile tile){
|
||||
ConduitEntity entity = tile.entity();
|
||||
|
||||
if(entity.blendshadowrot == -1){
|
||||
super.drawShadow(tile);
|
||||
}else{
|
||||
Draw.rect(Core.atlas.find("shadow-corner"), tile.drawx(), tile.drawy(), (tile.getRotation() + 3 + entity.blendshadowrot) * 90);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProximityUpdate(Tile tile){
|
||||
super.onProximityUpdate(tile);
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.io.IOException;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class Conveyor extends Block{
|
||||
private static final float itemSpace = 0.135f * 2.2f;
|
||||
private static final float itemSpace = 0.135f * 2.5f;
|
||||
private static final float offsetScl = 128f * 3f;
|
||||
private static final float minmove = 1f / (Short.MAX_VALUE - 2);
|
||||
private static ItemPos drawpos = new ItemPos();
|
||||
@@ -75,23 +75,6 @@ public class Conveyor extends Block{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawShadow(Tile tile){
|
||||
//fixes build block crash
|
||||
if(!(tile.entity instanceof ConveyorEntity)){
|
||||
super.drawShadow(tile);
|
||||
return;
|
||||
}
|
||||
|
||||
ConveyorEntity entity = tile.entity();
|
||||
|
||||
if(entity.blendshadowrot == -1){
|
||||
super.drawShadow(tile);
|
||||
}else{
|
||||
Draw.rect(Core.atlas.find("shadow-corner"), tile.drawx(), tile.drawy(), (tile.getRotation() + 3 + entity.blendshadowrot) * 90);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
ConveyorEntity entity = tile.entity();
|
||||
@@ -163,8 +146,8 @@ public class Conveyor extends Block{
|
||||
tr2.trns(rotation * 90, -tilesize / 2f, pos.x * tilesize / 2f);
|
||||
|
||||
Draw.rect(pos.item.region,
|
||||
(int) (tile.x * tilesize + tr1.x * pos.y + tr2.x),
|
||||
(int) (tile.y * tilesize + tr1.y * pos.y + tr2.y), itemSize, itemSize);
|
||||
(tile.x * tilesize + tr1.x * pos.y + tr2.x),
|
||||
(tile.y * tilesize + tr1.y * pos.y + tr2.y), itemSize, itemSize);
|
||||
}
|
||||
|
||||
}catch(IndexOutOfBoundsException e){
|
||||
|
||||
@@ -238,8 +238,8 @@ public class PowerNode extends PowerBlock{
|
||||
float angle1 = Angles.angle(x1, y1, x2, y2);
|
||||
float angle2 = angle1 + 180f;
|
||||
|
||||
t1.trns(angle1, tile.block().size * tilesize / 2f - 1f);
|
||||
t2.trns(angle2, target.block().size * tilesize / 2f - 1f);
|
||||
t1.trns(angle1, tile.block().size * tilesize / 2f - 1.5f);
|
||||
t2.trns(angle2, target.block().size * tilesize / 2f - 1.5f);
|
||||
|
||||
x1 += t1.x;
|
||||
y1 += t1.y;
|
||||
|
||||
Reference in New Issue
Block a user