This commit is contained in:
Anuken
2021-07-17 11:09:38 -04:00
parent 820920e5f9
commit 55920e6242
5 changed files with 8 additions and 12 deletions

View File

@@ -525,8 +525,7 @@ public class World{
private class Context implements WorldContext{ private class Context implements WorldContext{
Context(){ Context(){}
}
@Override @Override
public Tile tile(int index){ public Tile tile(int index){
@@ -579,7 +578,7 @@ public class World{
for(GenerateFilter filter : filters){ for(GenerateFilter filter : filters){
filter.randomize(); filter.randomize();
input.begin(filter, width(), height(), (x, y) -> tiles.getn(x, y)); input.begin(width(), height(), (x, y) -> tiles.getn(x, y));
filter.apply(tiles, input); filter.apply(tiles, input);
} }
} }

View File

@@ -158,7 +158,7 @@ public class MapGenerateDialog extends BaseDialog{
long[] writeTiles = new long[editor.width() * editor.height()]; long[] writeTiles = new long[editor.width() * editor.height()];
for(GenerateFilter filter : filters){ for(GenerateFilter filter : filters){
input.begin(filter, editor.width(), editor.height(), editor::tile); input.begin(editor.width(), editor.height(), editor::tile);
//write to buffer //write to buffer
for(int x = 0; x < editor.width(); x++){ for(int x = 0; x < editor.width(); x++){
@@ -414,7 +414,7 @@ public class MapGenerateDialog extends BaseDialog{
} }
for(var filter : copy){ for(var filter : copy){
input.begin(filter, editor.width(), editor.height(), (x, y) -> unpack(buffer1[Mathf.clamp(x / scaling, 0, pixmap.width -1) + w* Mathf.clamp(y / scaling, 0, pixmap.height -1)])); input.begin(editor.width(), editor.height(), (x, y) -> unpack(buffer1[Mathf.clamp(x / scaling, 0, pixmap.width -1) + w* Mathf.clamp(y / scaling, 0, pixmap.height -1)]));
//read from buffer1 and write to buffer2 //read from buffer1 and write to buffer2
pixmap.each((px, py) -> { pixmap.each((px, py) -> {

View File

@@ -9,7 +9,7 @@ import static mindustry.Vars.*;
@Component @Component
abstract class BoundedComp implements Velc, Posc, Healthc, Flyingc{ abstract class BoundedComp implements Velc, Posc, Healthc, Flyingc{
static final float warpDst = 40f; static final float warpDst = 30f;
@Import float x, y; @Import float x, y;

View File

@@ -75,8 +75,7 @@ public abstract class GenerateFilter{
/** localized display name */ /** localized display name */
public String name(){ public String name(){
var s = simpleName(); return Core.bundle.get("filter." + simpleName());
return Core.bundle.get("filter." + s);
} }
public char icon(){ public char icon(){
@@ -100,8 +99,6 @@ public abstract class GenerateFilter{
//utility generation functions //utility generation functions
//TODO would be nice if these functions used the seed and ditched "in" completely; simplex should be stateless
protected float noise(GenerateInput in, float scl, float mag){ protected float noise(GenerateInput in, float scl, float mag){
return Simplex.noise2d(seed, 1f, 0f, 1f / scl, in.x, in.y) * mag; return Simplex.noise2d(seed, 1f, 0f, 1f / scl, in.x, in.y) * mag;
} }
@@ -141,7 +138,7 @@ public abstract class GenerateFilter{
this.y = y; this.y = y;
} }
public void begin(GenerateFilter filter, int width, int height, TileProvider buffer){ public void begin(int width, int height, TileProvider buffer){
this.buffer = buffer; this.buffer = buffer;
this.width = width; this.width = width;
this.height = height; this.height = height;

View File

@@ -10,4 +10,4 @@ kapt.include.compile.classpath=false
kotlin.stdlib.default.dependency=false kotlin.stdlib.default.dependency=false
#needed for android compilation #needed for android compilation
android.useAndroidX=true android.useAndroidX=true
archash=3fe3fc594d041fa0a7e096e50ce1a032ffe3dae0 archash=2eaaa8e46b18b2a4a5af3e012ce1814b05ab7955