Line optimization & cleanup
This commit is contained in:
@@ -817,6 +817,7 @@ rules.reactorexplosions = Reactor Explosions
|
|||||||
rules.wavetimer = Wave Timer
|
rules.wavetimer = Wave Timer
|
||||||
rules.waves = Waves
|
rules.waves = Waves
|
||||||
rules.attack = Attack Mode
|
rules.attack = Attack Mode
|
||||||
|
rules.buildai = AI Building
|
||||||
rules.enemyCheat = Infinite AI (Red Team) Resources
|
rules.enemyCheat = Infinite AI (Red Team) Resources
|
||||||
rules.blockhealthmultiplier = Block Health Multiplier
|
rules.blockhealthmultiplier = Block Health Multiplier
|
||||||
rules.blockdamagemultiplier = Block Damage Multiplier
|
rules.blockdamagemultiplier = Block Damage Multiplier
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class Blocks implements ContentList{
|
|||||||
|
|
||||||
//environment
|
//environment
|
||||||
air, spawn, cliff, deepwater, water, taintedWater, tar, slag, stone, craters, charr, sand, darksand, dirt, ice, snow, darksandTaintedWater,
|
air, spawn, cliff, deepwater, water, taintedWater, tar, slag, stone, craters, charr, sand, darksand, dirt, ice, snow, darksandTaintedWater,
|
||||||
dacite, stoneWall, dirtWall, sporeWall, iceWall, daciteWall, cliffs, sporePine, snowPine, pine, shrubs, whiteTree, whiteTreeDead, sporeCluster,
|
dacite, stoneWall, dirtWall, sporeWall, iceWall, daciteWall, sporePine, snowPine, pine, shrubs, whiteTree, whiteTreeDead, sporeCluster,
|
||||||
iceSnow, sandWater, darksandWater, duneWall, sandWall, moss, sporeMoss, shale, shaleWall, shaleBoulder, sandBoulder, daciteBoulder, grass, salt,
|
iceSnow, sandWater, darksandWater, duneWall, sandWall, moss, sporeMoss, shale, shaleWall, shaleBoulder, sandBoulder, daciteBoulder, grass, salt,
|
||||||
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, basalt, magmarock, hotrock, snowWall, boulder, snowBoulder, saltWall,
|
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, basalt, magmarock, hotrock, snowWall, boulder, snowBoulder, saltWall,
|
||||||
darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal,
|
darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal,
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ public class Weathers implements ContentList{
|
|||||||
|
|
||||||
float scale = 1f / 2000f;
|
float scale = 1f / 2000f;
|
||||||
float scroll = Time.time() * scale;
|
float scroll = Time.time() * scale;
|
||||||
Tmp.tr1.setTexture(noise);
|
Tmp.tr1.texture = noise;
|
||||||
Core.camera.bounds(Tmp.r1);
|
Core.camera.bounds(Tmp.r1);
|
||||||
Tmp.tr1.set(Tmp.r1.x*scale, Tmp.r1.y*scale, (Tmp.r1.x + Tmp.r1.width)*scale, (Tmp.r1.y + Tmp.r1.height)*scale);
|
Tmp.tr1.set(Tmp.r1.x*scale, Tmp.r1.y*scale, (Tmp.r1.x + Tmp.r1.width)*scale, (Tmp.r1.y + Tmp.r1.height)*scale);
|
||||||
Tmp.tr1.scroll(-xspeed * scroll, -yspeed * scroll);
|
Tmp.tr1.scroll(-xspeed * scroll, -yspeed * scroll);
|
||||||
@@ -287,7 +287,7 @@ public class Weathers implements ContentList{
|
|||||||
|
|
||||||
float scale = 1f / 2000f;
|
float scale = 1f / 2000f;
|
||||||
float scroll = Time.time() * scale;
|
float scroll = Time.time() * scale;
|
||||||
Tmp.tr1.setTexture(noise);
|
Tmp.tr1.texture = noise;
|
||||||
Core.camera.bounds(Tmp.r1);
|
Core.camera.bounds(Tmp.r1);
|
||||||
Tmp.tr1.set(Tmp.r1.x*scale, Tmp.r1.y*scale, (Tmp.r1.x + Tmp.r1.width)*scale, (Tmp.r1.y + Tmp.r1.height)*scale);
|
Tmp.tr1.set(Tmp.r1.x*scale, Tmp.r1.y*scale, (Tmp.r1.x + Tmp.r1.width)*scale, (Tmp.r1.y + Tmp.r1.height)*scale);
|
||||||
Tmp.tr1.scroll(-xspeed * scroll, -yspeed * scroll);
|
Tmp.tr1.scroll(-xspeed * scroll, -yspeed * scroll);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class MapRenderer implements Disposable{
|
|||||||
|
|
||||||
public MapRenderer(MapEditor editor){
|
public MapRenderer(MapEditor editor){
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
this.texture = Core.atlas.find("clear-editor").getTexture();
|
this.texture = Core.atlas.find("clear-editor").texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resize(int width, int height){
|
public void resize(int width, int height){
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ public class WaveGraph extends Table{
|
|||||||
|
|
||||||
rect((x, y, width, height) -> {
|
rect((x, y, width, height) -> {
|
||||||
Lines.stroke(Scl.scl(3f));
|
Lines.stroke(Scl.scl(3f));
|
||||||
Lines.precise(true);
|
|
||||||
|
|
||||||
GlyphLayout lay = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
|
GlyphLayout lay = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
|
||||||
Font font = Fonts.outline;
|
Font font = Fonts.outline;
|
||||||
@@ -122,7 +121,6 @@ public class WaveGraph extends Table{
|
|||||||
|
|
||||||
Pools.free(lay);
|
Pools.free(lay);
|
||||||
|
|
||||||
Lines.precise(false);
|
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}).pad(4).padBottom(10).grow();
|
}).pad(4).padBottom(10).grow();
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ public class LaserBulletType extends BulletType{
|
|||||||
float compound = 1f;
|
float compound = 1f;
|
||||||
|
|
||||||
Lines.lineAngle(b.x, b.y, b.rotation(), baseLen);
|
Lines.lineAngle(b.x, b.y, b.rotation(), baseLen);
|
||||||
Lines.precise(true);
|
|
||||||
for(Color color : colors){
|
for(Color color : colors){
|
||||||
Draw.color(color);
|
Draw.color(color);
|
||||||
Lines.stroke((cwidth *= lengthFalloff) * b.fout());
|
Lines.stroke((cwidth *= lengthFalloff) * b.fout());
|
||||||
@@ -76,7 +75,6 @@ public class LaserBulletType extends BulletType{
|
|||||||
|
|
||||||
compound *= lengthFalloff;
|
compound *= lengthFalloff;
|
||||||
}
|
}
|
||||||
Lines.precise(false);
|
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|
||||||
Tmp.v1.trns(b.rotation(), baseLen * 1.1f);
|
Tmp.v1.trns(b.rotation(), baseLen * 1.1f);
|
||||||
|
|||||||
@@ -150,15 +150,14 @@ public class Drawf{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void laser(Team team, TextureRegion line, TextureRegion edge, float x, float y, float x2, float y2, float rotation, float scale){
|
public static void laser(Team team, TextureRegion line, TextureRegion edge, float x, float y, float x2, float y2, float rotation, float scale){
|
||||||
Tmp.v1.trns(rotation, 8f * scale * Draw.scl);
|
float scl = 8f * scale * Draw.scl;
|
||||||
|
float vx = Mathf.cosDeg(rotation) * scl, vy = Mathf.sinDeg(rotation) * scl;
|
||||||
|
|
||||||
Draw.rect(edge, x, y, edge.width * scale * Draw.scl, edge.height * scale * Draw.scl, rotation + 180);
|
Draw.rect(edge, x, y, edge.width * scale * Draw.scl, edge.height * scale * Draw.scl, rotation + 180);
|
||||||
Draw.rect(edge, x2, y2, edge.width * scale * Draw.scl, edge.height * scale * Draw.scl, rotation);
|
Draw.rect(edge, x2, y2, edge.width * scale * Draw.scl, edge.height * scale * Draw.scl, rotation);
|
||||||
|
|
||||||
Lines.stroke(12f * scale);
|
Lines.stroke(12f * scale);
|
||||||
Lines.precise(true);
|
Lines.line(line, x + vx, y + vy, x2 - vx, y2 - vy, false);
|
||||||
Lines.line(line, x + Tmp.v1.x, y + Tmp.v1.y, x2 - Tmp.v1.x, y2 - Tmp.v1.y, false, 0f);
|
|
||||||
Lines.precise(false);
|
|
||||||
Lines.stroke(1f);
|
Lines.stroke(1f);
|
||||||
|
|
||||||
light(team, x, y, x2, y2);
|
light(team, x, y, x2, y2);
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ public class LightRenderer{
|
|||||||
vertices[22] = v;
|
vertices[22] = v;
|
||||||
vertices[23] = 0;
|
vertices[23] = 0;
|
||||||
|
|
||||||
Draw.vert(ledge.getTexture(), vertices, 0, vertices.length);
|
Draw.vert(ledge.texture, vertices, 0, vertices.length);
|
||||||
|
|
||||||
|
|
||||||
Vec2 v3 = Tmp.v2.trnsExact(rot, stroke);
|
Vec2 v3 = Tmp.v2.trnsExact(rot, stroke);
|
||||||
@@ -136,7 +136,7 @@ public class LightRenderer{
|
|||||||
vertices[22] = v;
|
vertices[22] = v;
|
||||||
vertices[23] = 0;
|
vertices[23] = 0;
|
||||||
|
|
||||||
Draw.vert(ledge.getTexture(), vertices, 0, vertices.length);
|
Draw.vert(ledge.texture, vertices, 0, vertices.length);
|
||||||
|
|
||||||
vertices[0] = lx2;
|
vertices[0] = lx2;
|
||||||
vertices[1] = ly2;
|
vertices[1] = ly2;
|
||||||
@@ -166,7 +166,7 @@ public class LightRenderer{
|
|||||||
vertices[22] = v;
|
vertices[22] = v;
|
||||||
vertices[23] = 0;
|
vertices[23] = 0;
|
||||||
|
|
||||||
Draw.vert(ledge.getTexture(), vertices, 0, vertices.length);
|
Draw.vert(ledge.texture, vertices, 0, vertices.length);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ public class LoadRenderer implements Disposable{
|
|||||||
|
|
||||||
float w = Core.graphics.getWidth(), h = Core.graphics.getHeight(), s = Scl.scl();
|
float w = Core.graphics.getWidth(), h = Core.graphics.getHeight(), s = Scl.scl();
|
||||||
//s = 2f;
|
//s = 2f;
|
||||||
Lines.precise(true);
|
|
||||||
|
|
||||||
Draw.proj().setOrtho(0, 0, Core.graphics.getWidth(), Core.graphics.getHeight());
|
Draw.proj().setOrtho(0, 0, Core.graphics.getWidth(), Core.graphics.getHeight());
|
||||||
|
|
||||||
@@ -467,7 +466,6 @@ public class LoadRenderer implements Disposable{
|
|||||||
font.draw(red + "[[[[ " + key + " ]]\n"+orange+"<" + Version.modifier + " " + (Version.build == 0 ? " [init]" : Version.build == -1 ? " custom" : " " + Version.build) + ">", w/2f, h/2f + 110*s, Align.center);
|
font.draw(red + "[[[[ " + key + " ]]\n"+orange+"<" + Version.modifier + " " + (Version.build == 0 ? " [init]" : Version.build == -1 ? " custom" : " " + Version.build) + ">", w/2f, h/2f + 110*s, Align.center);
|
||||||
}
|
}
|
||||||
|
|
||||||
Lines.precise(false);
|
|
||||||
Draw.flush();
|
Draw.flush();
|
||||||
|
|
||||||
fx.end();
|
fx.end();
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ public class Shaders{
|
|||||||
setUniformf("u_progress", progress);
|
setUniformf("u_progress", progress);
|
||||||
setUniformf("u_uv", region.u, region.v);
|
setUniformf("u_uv", region.u, region.v);
|
||||||
setUniformf("u_uv2", region.u2, region.v2);
|
setUniformf("u_uv2", region.u2, region.v2);
|
||||||
setUniformf("u_texsize", region.getTexture().getWidth(), region.getTexture().height);
|
setUniformf("u_texsize", region.texture.getWidth(), region.texture.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ public class Shaders{
|
|||||||
setUniformf("u_uv", region.u, region.v);
|
setUniformf("u_uv", region.u, region.v);
|
||||||
setUniformf("u_uv2", region.u2, region.v2);
|
setUniformf("u_uv2", region.u2, region.v2);
|
||||||
setUniformf("u_time", Time.time());
|
setUniformf("u_time", Time.time());
|
||||||
setUniformf("u_texsize", region.getTexture().getWidth(), region.getTexture().height);
|
setUniformf("u_texsize", region.texture.getWidth(), region.texture.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -192,10 +192,10 @@ public class Mods implements Loadable{
|
|||||||
|
|
||||||
private PageType getPage(AtlasRegion region){
|
private PageType getPage(AtlasRegion region){
|
||||||
return
|
return
|
||||||
region.getTexture() == Core.atlas.find("white").getTexture() ? PageType.main :
|
region.texture == Core.atlas.find("white").texture ? PageType.main :
|
||||||
region.getTexture() == Core.atlas.find("stone1").getTexture() ? PageType.environment :
|
region.texture == Core.atlas.find("stone1").texture ? PageType.environment :
|
||||||
region.getTexture() == Core.atlas.find("clear-editor").getTexture() ? PageType.editor :
|
region.texture == Core.atlas.find("clear-editor").texture ? PageType.editor :
|
||||||
region.getTexture() == Core.atlas.find("whiteui").getTexture() ? PageType.ui :
|
region.texture == Core.atlas.find("whiteui").texture ? PageType.ui :
|
||||||
PageType.main;
|
PageType.main;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -587,10 +587,10 @@ public class UnitType extends UnlockableContent{
|
|||||||
Draw.rect(footRegion, leg.base.x, leg.base.y, position.angleTo(leg.base));
|
Draw.rect(footRegion, leg.base.x, leg.base.y, position.angleTo(leg.base));
|
||||||
|
|
||||||
Lines.stroke(legRegion.height * Draw.scl * flips);
|
Lines.stroke(legRegion.height * Draw.scl * flips);
|
||||||
Lines.line(legRegion, position.x, position.y, leg.joint.x, leg.joint.y, false, 0);
|
Lines.line(legRegion, position.x, position.y, leg.joint.x, leg.joint.y, false);
|
||||||
|
|
||||||
Lines.stroke(legBaseRegion.height * Draw.scl * flips);
|
Lines.stroke(legBaseRegion.height * Draw.scl * flips);
|
||||||
Lines.line(legBaseRegion, leg.joint.x + Tmp.v1.x, leg.joint.y + Tmp.v1.y, leg.base.x, leg.base.y, false, 0);
|
Lines.line(legBaseRegion, leg.joint.x + Tmp.v1.x, leg.joint.y + Tmp.v1.y, leg.base.x, leg.base.y, false);
|
||||||
|
|
||||||
if(jointRegion.found()){
|
if(jointRegion.found()){
|
||||||
Draw.rect(jointRegion, leg.joint.x, leg.joint.y);
|
Draw.rect(jointRegion, leg.joint.x, leg.joint.y);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class Fonts{
|
|||||||
|
|
||||||
public static void loadContentIcons(){
|
public static void loadContentIcons(){
|
||||||
Seq<Font> fonts = Seq.with(Fonts.chat, Fonts.def, Fonts.outline);
|
Seq<Font> fonts = Seq.with(Fonts.chat, Fonts.def, Fonts.outline);
|
||||||
Texture uitex = Core.atlas.find("logo").getTexture();
|
Texture uitex = Core.atlas.find("logo").texture;
|
||||||
int size = (int)(Fonts.def.getData().lineHeight/Fonts.def.getData().scaleY);
|
int size = (int)(Fonts.def.getData().lineHeight/Fonts.def.getData().scaleY);
|
||||||
|
|
||||||
try(Scanner scan = new Scanner(Core.files.internal("icons/icons.properties").read(512))){
|
try(Scanner scan = new Scanner(Core.files.internal("icons/icons.properties").read(512))){
|
||||||
@@ -84,7 +84,7 @@ public class Fonts{
|
|||||||
int ch = Integer.parseInt(character);
|
int ch = Integer.parseInt(character);
|
||||||
TextureRegion region = Core.atlas.find(texture);
|
TextureRegion region = Core.atlas.find(texture);
|
||||||
|
|
||||||
if(region.getTexture() != uitex){
|
if(region.texture != uitex){
|
||||||
continue;
|
continue;
|
||||||
//throw new IllegalArgumentException("Font icon '" + texture + "' is not in the UI texture.");
|
//throw new IllegalArgumentException("Font icon '" + texture + "' is not in the UI texture.");
|
||||||
}
|
}
|
||||||
@@ -160,21 +160,21 @@ public class Fonts{
|
|||||||
//grab all textures from the ui page, remove all the regions assigned to it, then copy them over to Fonts.packer and replace the texture in this atlas.
|
//grab all textures from the ui page, remove all the regions assigned to it, then copy them over to Fonts.packer and replace the texture in this atlas.
|
||||||
|
|
||||||
//grab old UI texture and regions...
|
//grab old UI texture and regions...
|
||||||
Texture texture = atlas.find("logo").getTexture();
|
Texture texture = atlas.find("logo").texture;
|
||||||
|
|
||||||
Page page = UI.packer.getPages().first();
|
Page page = UI.packer.getPages().first();
|
||||||
|
|
||||||
Seq<AtlasRegion> regions = atlas.getRegions().select(t -> t.getTexture() == texture);
|
Seq<AtlasRegion> regions = atlas.getRegions().select(t -> t.texture == texture);
|
||||||
for(AtlasRegion region : regions){
|
for(AtlasRegion region : regions){
|
||||||
//get new pack rect
|
//get new pack rect
|
||||||
page.setDirty(false);
|
page.setDirty(false);
|
||||||
Rect rect = UI.packer.pack(region.name + (region.splits != null ? ".9" : ""), atlas.getPixmap(region));
|
Rect rect = UI.packer.pack(region.name + (region.splits != null ? ".9" : ""), atlas.getPixmap(region));
|
||||||
//set new texture
|
//set new texture
|
||||||
region.setTexture(UI.packer.getPages().first().getTexture());
|
region.texture = UI.packer.getPages().first().getTexture();
|
||||||
//set its new position
|
//set its new position
|
||||||
region.set((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);
|
region.set((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);
|
||||||
//add old texture
|
//add old texture
|
||||||
atlas.getTextures().add(region.getTexture());
|
atlas.getTextures().add(region.texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove old texture, it will no longer be used
|
//remove old texture, it will no longer be used
|
||||||
@@ -191,7 +191,7 @@ public class Fonts{
|
|||||||
if(g == null) throw new IllegalArgumentException("No glyph: " + glyph + " (" + (int)glyph + ")");
|
if(g == null) throw new IllegalArgumentException("No glyph: " + glyph + " (" + (int)glyph + ")");
|
||||||
|
|
||||||
float size = Math.max(g.width, g.height);
|
float size = Math.max(g.width, g.height);
|
||||||
TextureRegionDrawable draw = new TextureRegionDrawable(new TextureRegion(font.getRegion().getTexture(), g.u, g.v2, g.u2, g.v)){
|
TextureRegionDrawable draw = new TextureRegionDrawable(new TextureRegion(font.getRegion().texture, g.u, g.v2, g.u2, g.v)){
|
||||||
@Override
|
@Override
|
||||||
public void draw(float x, float y, float width, float height){
|
public void draw(float x, float y, float width, float height){
|
||||||
Draw.color(Tmp.c1.set(tint).mul(Draw.getColor()).toFloatBits());
|
Draw.color(Tmp.c1.set(tint).mul(Draw.getColor()).toFloatBits());
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ public class CustomRulesDialog extends BaseDialog{
|
|||||||
|
|
||||||
title("@rules.title.enemy");
|
title("@rules.title.enemy");
|
||||||
check("@rules.attack", b -> rules.attackMode = b, () -> rules.attackMode);
|
check("@rules.attack", b -> rules.attackMode = b, () -> rules.attackMode);
|
||||||
|
check("@rules.buildai", b -> rules.waveTeam.rules().ai = b, () -> rules.waveTeam.rules().ai);
|
||||||
number("@rules.enemycorebuildradius", f -> rules.enemyCoreBuildRadius = f * tilesize, () -> Math.min(rules.enemyCoreBuildRadius / tilesize, 200));
|
number("@rules.enemycorebuildradius", f -> rules.enemyCoreBuildRadius = f * tilesize, () -> Math.min(rules.enemyCoreBuildRadius / tilesize, 200));
|
||||||
|
|
||||||
title("@rules.title.environment");
|
title("@rules.title.environment");
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public class LoadDialog extends BaseDialog{
|
|||||||
|
|
||||||
button.left().add(new BorderImage(def, 4f)).update(im -> {
|
button.left().add(new BorderImage(def, 4f)).update(im -> {
|
||||||
TextureRegionDrawable draw = (TextureRegionDrawable)im.getDrawable();
|
TextureRegionDrawable draw = (TextureRegionDrawable)im.getDrawable();
|
||||||
if(draw.getRegion().getTexture().isDisposed()){
|
if(draw.getRegion().texture.isDisposed()){
|
||||||
draw.setRegion(def);
|
draw.setRegion(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -673,7 +673,7 @@ public class Block extends UnlockableContent{
|
|||||||
public void load(){
|
public void load(){
|
||||||
region = Core.atlas.find(name);
|
region = Core.atlas.find(name);
|
||||||
|
|
||||||
if(cracks == null || (cracks[0][0].getTexture() != null && cracks[0][0].getTexture().isDisposed())){
|
if(cracks == null || (cracks[0][0].texture != null && cracks[0][0].texture.isDisposed())){
|
||||||
cracks = new TextureRegion[maxCrackSize][crackRegions];
|
cracks = new TextureRegion[maxCrackSize][crackRegions];
|
||||||
for(int size = 1; size <= maxCrackSize; size++){
|
for(int size = 1; size <= maxCrackSize; size++){
|
||||||
for(int i = 0; i < crackRegions; i++){
|
for(int i = 0; i < crackRegions; i++){
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class ExtendingItemBridge extends ItemBridge{
|
|||||||
x + Geometry.d4[i].x * tilesize / 2f,
|
x + Geometry.d4[i].x * tilesize / 2f,
|
||||||
y + Geometry.d4[i].y * tilesize / 2f,
|
y + Geometry.d4[i].y * tilesize / 2f,
|
||||||
x + ex,
|
x + ex,
|
||||||
y + ey, false, 0f);
|
y + ey, false);
|
||||||
|
|
||||||
Draw.rect(endRegion, x, y, i * 90 + 90);
|
Draw.rect(endRegion, x, y, i * 90 + 90);
|
||||||
Draw.rect(endRegion,
|
Draw.rect(endRegion,
|
||||||
|
|||||||
@@ -61,11 +61,17 @@ public class ItemBridge extends Block{
|
|||||||
if(otherReq == null) return;
|
if(otherReq == null) return;
|
||||||
|
|
||||||
Lines.stroke(8f);
|
Lines.stroke(8f);
|
||||||
Lines.line(bridgeRegion,
|
|
||||||
req.drawx(),
|
Tmp.v1.set(otherReq.drawx(), otherReq.drawx()).sub(req.drawx(), req.drawy()).setLength(-tilesize/2f);
|
||||||
req.drawy(),
|
|
||||||
otherReq.drawx(),
|
Lines.line(
|
||||||
otherReq.drawy(), false, -tilesize / 2f);
|
bridgeRegion,
|
||||||
|
req.drawx() + Tmp.v1.x,
|
||||||
|
req.drawy() + Tmp.v1.y,
|
||||||
|
otherReq.drawx() - Tmp.v1.x,
|
||||||
|
otherReq.drawy() - Tmp.v1.y, false
|
||||||
|
);
|
||||||
|
|
||||||
Draw.rect(arrowRegion, (req.drawx() + otherReq.drawx()) / 2f, (req.drawy() + otherReq.drawy()) / 2f,
|
Draw.rect(arrowRegion, (req.drawx() + otherReq.drawx()) / 2f, (req.drawy() + otherReq.drawy()) / 2f,
|
||||||
Angles.angle(req.drawx(), req.drawy(), otherReq.drawx(), otherReq.drawy()));
|
Angles.angle(req.drawx(), req.drawy(), otherReq.drawx(), otherReq.drawy()));
|
||||||
}
|
}
|
||||||
@@ -296,11 +302,14 @@ public class ItemBridge extends Block{
|
|||||||
Draw.rect(endRegion, other.drawx(), other.drawy(), i * 90 + 270);
|
Draw.rect(endRegion, other.drawx(), other.drawy(), i * 90 + 270);
|
||||||
|
|
||||||
Lines.stroke(8f);
|
Lines.stroke(8f);
|
||||||
|
|
||||||
|
Tmp.v1.set(x, y).sub(other.worldx(), other.worldy()).setLength(-tilesize/2f);
|
||||||
|
|
||||||
Lines.line(bridgeRegion,
|
Lines.line(bridgeRegion,
|
||||||
x,
|
x + Tmp.v1.x,
|
||||||
y,
|
y + Tmp.v1.y,
|
||||||
other.worldx(),
|
other.worldx() - Tmp.v1.x,
|
||||||
other.worldy(), false, -tilesize / 2f);
|
other.worldy() - Tmp.v1.y, false);
|
||||||
|
|
||||||
int dist = Math.max(Math.abs(other.x - tile.x), Math.abs(other.y - tile.y));
|
int dist = Math.max(Math.abs(other.x - tile.x), Math.abs(other.y - tile.y));
|
||||||
|
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ public class PayloadConveyor extends Block{
|
|||||||
boolean overlaps = Intersector.intersectRectangles(bounds, sprite, over);
|
boolean overlaps = Intersector.intersectRectangles(bounds, sprite, over);
|
||||||
|
|
||||||
TextureRegion out = Tmp.tr1;
|
TextureRegion out = Tmp.tr1;
|
||||||
out.set(region.getTexture());
|
out.set(region.texture);
|
||||||
|
|
||||||
if(overlaps){
|
if(overlaps){
|
||||||
float w = region.u2 - region.u;
|
float w = region.u2 - region.u;
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ public class LogicDisplay extends Block{
|
|||||||
buffer.begin();
|
buffer.begin();
|
||||||
Draw.color(color);
|
Draw.color(color);
|
||||||
Lines.stroke(stroke);
|
Lines.stroke(stroke);
|
||||||
Lines.precise(true);
|
|
||||||
|
|
||||||
while(!commands.isEmpty()){
|
while(!commands.isEmpty()){
|
||||||
long c = commands.removeFirst();
|
long c = commands.removeFirst();
|
||||||
@@ -88,8 +87,6 @@ public class LogicDisplay extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Lines.precise(false);
|
|
||||||
|
|
||||||
buffer.end();
|
buffer.end();
|
||||||
Draw.proj(Tmp.m1);
|
Draw.proj(Tmp.m1);
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
|
|||||||
@@ -145,22 +145,19 @@ public class PowerNode extends PowerBlock{
|
|||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawLaser(Team team, float x1, float y1, float x2, float y2, float satisfaction, int size1, int size2){
|
protected void setupColor(float satisfaction){
|
||||||
float angle1 = Angles.angle(x1, y1, x2, y2);
|
|
||||||
t1.trns(angle1, size1 * tilesize / 2f - 1.5f);
|
|
||||||
t2.trns(angle1 + 180f, size2 * tilesize / 2f - 1.5f);
|
|
||||||
|
|
||||||
x1 += t1.x;
|
|
||||||
y1 += t1.y;
|
|
||||||
x2 += t2.x;
|
|
||||||
y2 += t2.y;
|
|
||||||
|
|
||||||
float fract = 1f - satisfaction;
|
float fract = 1f - satisfaction;
|
||||||
|
|
||||||
Draw.color(laserColor1, laserColor2, fract * 0.86f + Mathf.absin(3f, 0.1f));
|
Draw.color(laserColor1, laserColor2, fract * 0.86f + Mathf.absin(3f, 0.1f));
|
||||||
Draw.alpha(renderer.laserOpacity);
|
Draw.alpha(renderer.laserOpacity);
|
||||||
Drawf.laser(team, laser, laserEnd, x1, y1, x2, y2, 0.25f);
|
}
|
||||||
Draw.color();
|
|
||||||
|
protected void drawLaser(Team team, float x1, float y1, float x2, float y2, int size1, int size2){
|
||||||
|
float angle1 = Angles.angle(x1, y1, x2, y2);
|
||||||
|
float vx = Mathf.cosDeg(angle1), vy = Mathf.sinDeg(angle1);
|
||||||
|
float len1 = size1 * tilesize / 2f - 1.5f, len2 = size2 * tilesize / 2f - 1.5f;
|
||||||
|
|
||||||
|
Drawf.laser(team, laser, laserEnd, x1 + vx*len1, y1 + vy*len1, x2 - vx*len2, y2 - vy*len2, 0.25f);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean overlaps(float srcx, float srcy, Tile other, float range){
|
protected boolean overlaps(float srcx, float srcy, Tile other, float range){
|
||||||
@@ -214,6 +211,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
@Override
|
@Override
|
||||||
public void drawRequestConfigTop(BuildPlan req, Eachable<BuildPlan> list){
|
public void drawRequestConfigTop(BuildPlan req, Eachable<BuildPlan> list){
|
||||||
if(req.config instanceof Point2[]){
|
if(req.config instanceof Point2[]){
|
||||||
|
setupColor(1f);
|
||||||
for(Point2 point : (Point2[])req.config){
|
for(Point2 point : (Point2[])req.config){
|
||||||
otherReq = null;
|
otherReq = null;
|
||||||
list.each(other -> {
|
list.each(other -> {
|
||||||
@@ -224,8 +222,9 @@ public class PowerNode extends PowerBlock{
|
|||||||
|
|
||||||
if(otherReq == null || otherReq.block == null) return;
|
if(otherReq == null || otherReq.block == null) return;
|
||||||
|
|
||||||
drawLaser(player.team(), req.drawx(), req.drawy(), otherReq.drawx(), otherReq.drawy(), 1f, size, otherReq.block.size);
|
drawLaser(player.team(), req.drawx(), req.drawy(), otherReq.drawx(), otherReq.drawy(), size, otherReq.block.size);
|
||||||
}
|
}
|
||||||
|
Draw.color();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,6 +385,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
if(Mathf.zero(renderer.laserOpacity)) return;
|
if(Mathf.zero(renderer.laserOpacity)) return;
|
||||||
|
|
||||||
Draw.z(Layer.power);
|
Draw.z(Layer.power);
|
||||||
|
setupColor(power.graph.getSatisfaction());
|
||||||
|
|
||||||
for(int i = 0; i < power.links.size; i++){
|
for(int i = 0; i < power.links.size; i++){
|
||||||
Building link = world.build(power.links.get(i));
|
Building link = world.build(power.links.get(i));
|
||||||
@@ -394,7 +394,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
|
|
||||||
if(link.block instanceof PowerNode && !(link.pos() < tile.pos())) continue;
|
if(link.block instanceof PowerNode && !(link.pos() < tile.pos())) continue;
|
||||||
|
|
||||||
drawLaserTo(link);
|
drawLaser(team, x, y, link.x, link.y, size, link.block.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
@@ -404,10 +404,6 @@ public class PowerNode extends PowerBlock{
|
|||||||
return power.links.contains(other.pos());
|
return power.links.contains(other.pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawLaserTo(Building target){
|
|
||||||
drawLaser(team, x, y, target.x, target.y, power.graph.getSatisfaction(), size, target.block.size);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Point2[] config(){
|
public Point2[] config(){
|
||||||
Point2[] out = new Point2[power.links.size];
|
Point2[] out = new Point2[power.links.size];
|
||||||
|
|||||||
Reference in New Issue
Block a user