generate .we maze
- export maze as .we ( still hlf boundaries missing )
This commit is contained in:
@@ -4,7 +4,7 @@ import org.artisanlogiciel.games.maze.DrawingGenerator;
|
|||||||
import org.artisanlogiciel.games.maze.LabyModel;
|
import org.artisanlogiciel.games.maze.LabyModel;
|
||||||
import org.artisanlogiciel.games.maze.MazeParams;
|
import org.artisanlogiciel.games.maze.MazeParams;
|
||||||
import org.artisanlogiciel.games.maze.MazeParamsFixed;
|
import org.artisanlogiciel.games.maze.MazeParamsFixed;
|
||||||
import org.artisanlogiciel.games.maze.persist.MazePeristWorldEdit;
|
import org.artisanlogiciel.games.maze.persist.MazePersistWorldEdit;
|
||||||
import org.artisanlogiciel.games.maze.persist.MazePersistRaw;
|
import org.artisanlogiciel.games.maze.persist.MazePersistRaw;
|
||||||
import org.artisanlogiciel.games.maze.solve.SolvingModel;
|
import org.artisanlogiciel.games.maze.solve.SolvingModel;
|
||||||
import org.artisanlogiciel.games.stl.Maze3dParams;
|
import org.artisanlogiciel.games.stl.Maze3dParams;
|
||||||
@@ -780,7 +780,7 @@ implements StatusListener
|
|||||||
addStatus("Saving we to " + outfile + " ...");
|
addStatus("Saving we to " + outfile + " ...");
|
||||||
try {
|
try {
|
||||||
FileOutputStream out = new FileOutputStream(outfile);
|
FileOutputStream out = new FileOutputStream(outfile);
|
||||||
new MazePeristWorldEdit(model).streamOut("we", out);
|
new MazePersistWorldEdit(model).streamOut("we", out);
|
||||||
out.close();
|
out.close();
|
||||||
addStatus("... Done.");
|
addStatus("... Done.");
|
||||||
} catch (IOException io) {
|
} catch (IOException io) {
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ import org.artisanlogiciel.games.minetest.Node;
|
|||||||
import org.artisanlogiciel.games.minetest.WorlEditGenerator;
|
import org.artisanlogiciel.games.minetest.WorlEditGenerator;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
public class MazePeristWorldEdit {
|
public class MazePersistWorldEdit {
|
||||||
|
|
||||||
private LabyModel model;
|
private LabyModel model;
|
||||||
private WorlEditGenerator generator;
|
private WorlEditGenerator generator;
|
||||||
private static final String GRASS_MATERIAL = "default:dirt_with_grass";
|
private static final String GRASS_MATERIAL = "default:dirt_with_grass";
|
||||||
|
|
||||||
public MazePeristWorldEdit(LabyModel model) {
|
public MazePersistWorldEdit(LabyModel model) {
|
||||||
this.model = model;
|
this.model = model;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,11 +40,14 @@ public class MazePeristWorldEdit {
|
|||||||
int y = oy + (int) (pY * h);
|
int y = oy + (int) (pY * h);
|
||||||
|
|
||||||
// copied from drawing, where order did matter, might not be the case here...
|
// copied from drawing, where order did matter, might not be the case here...
|
||||||
if ((pY == 0) && LabyModel.isFlagSet(walls, Brick.UP)) {
|
//if ((pY == 0) && LabyModel.isFlagSet(walls, Brick.UP)) {
|
||||||
addNode(new Node(x,y,z,material));
|
if (LabyModel.isFlagSet(walls, Brick.UP)) {
|
||||||
addNode(new Node(x + (int) w,y,z,material));
|
for ( int dx = 0; dx < w; dx++) {
|
||||||
|
addNode(new Node(x + dx, y, z, material));
|
||||||
|
}
|
||||||
wdrawn |= Brick.UP;
|
wdrawn |= Brick.UP;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (LabyModel.isFlagSet(walls, Brick.RIGHT)) {
|
if (LabyModel.isFlagSet(walls, Brick.RIGHT)) {
|
||||||
if (!LabyModel.isFlagSet(wdrawn, Brick.UP)) {
|
if (!LabyModel.isFlagSet(wdrawn, Brick.UP)) {
|
||||||
addNode(new Node(x + (int) w, y, 0, material));
|
addNode(new Node(x + (int) w, y, 0, material));
|
||||||
@@ -59,11 +62,12 @@ public class MazePeristWorldEdit {
|
|||||||
addNode(new Node(x, y + (int) h, z, material));
|
addNode(new Node(x, y + (int) h, z, material));
|
||||||
wdrawn |= Brick.DOWN;
|
wdrawn |= Brick.DOWN;
|
||||||
}
|
}
|
||||||
if ((pX == 0) && LabyModel.isFlagSet(walls, Brick.LEFT)) {
|
*/
|
||||||
if (!LabyModel.isFlagSet(wdrawn, Brick.DOWN)) {
|
//if ((pX == 0) && LabyModel.isFlagSet(walls, Brick.LEFT)) {
|
||||||
addNode(new Node(x, y + (int) h, z, material));
|
if (LabyModel.isFlagSet(walls, Brick.LEFT)) {
|
||||||
|
for (int dy = 0; dy < h; dy ++) {
|
||||||
|
addNode(new Node(x, y + dy, z, material));
|
||||||
}
|
}
|
||||||
addNode(new Node(x, y, z, material));
|
|
||||||
wdrawn |= Brick.LEFT;
|
wdrawn |= Brick.LEFT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user