diff --git a/build.gradle b/build.gradle index 17431baa..45616af0 100644 --- a/build.gradle +++ b/build.gradle @@ -88,26 +88,6 @@ project(":tools") { } } -project(":mapbuilder") { - apply plugin: "java" - - ext { - visuiVersion = '1.4.0' - } - - dependencies { - compile project(":core") - compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" - compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" - - } - - dependencies { - compile group: 'commons-cli', name: 'commons-cli', version: cliVersion - compile "com.kotcrab.vis:vis-ui:$visuiVersion" - } -} - project(":ds1viewer") { apply plugin: "java" diff --git a/mapbuilder/build.gradle b/mapbuilder/build.gradle deleted file mode 100644 index 51eccc6e..00000000 --- a/mapbuilder/build.gradle +++ /dev/null @@ -1,46 +0,0 @@ -apply plugin: "java" - -sourceCompatibility = 1.7 -sourceSets.main.java.srcDirs = ["src/"] - -project.ext.mainClassName = "com.riiablo.map.MapViewer" -project.ext.assetsDir = new File("../android/assets"); - -task run(dependsOn: classes, type: JavaExec) { - main = project.mainClassName - classpath = sourceSets.main.runtimeClasspath - standardInput = System.in - workingDir = project.assetsDir - ignoreExitValue = true -} - -task dist(type: Jar) { - from files(sourceSets.main.output.classesDir) - from files(sourceSets.main.output.resourcesDir) - from { configurations.compile.collect { zipTree(it) } } - from files(project.assetsDir); - - manifest { - attributes 'Main-Class': project.mainClassName - } -} - -dist.dependsOn classes - -eclipse { - project { - name = appName + "-mapbuilder" - linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/android/assets' - } -} - -task afterEclipseImport(description: "Post processing after project generation", group: "IDE") { - doLast { - def classpath = new XmlParser().parse(file(".classpath")) - new Node(classpath, "classpathentry", [kind: 'src', path: 'assets']); - def writer = new FileWriter(file(".classpath")) - def printer = new XmlNodePrinter(new PrintWriter(writer)) - printer.setPreserveWhitespace(true) - printer.print(classpath) - } -} \ No newline at end of file diff --git a/mapbuilder/src/com/riiablo/map/DS1Types.java b/mapbuilder/src/com/riiablo/map/DS1Types.java deleted file mode 100644 index b82d6950..00000000 --- a/mapbuilder/src/com/riiablo/map/DS1Types.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.riiablo.map; - -import com.riiablo.codec.excel.Excel; - -public class DS1Types extends Excel { - public static class Entry extends Excel.Entry { - @Override - public String toString() { - return Name; - } - - @Column public String Name; - - @Column @Key - public int Def; - - @Column public int LevelType; - } -} diff --git a/settings.gradle b/settings.gradle index 80b96424..36061c00 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include 'tools', 'tester', 'ds1viewer', 'mapbuilder', 'mpqviewer', 'server', 'desktop', 'android', 'mpqlib', 'core' \ No newline at end of file +include 'tools', 'tester', 'ds1viewer', 'mpqviewer', 'server', 'desktop', 'android', 'mpqlib', 'core' \ No newline at end of file diff --git a/mapbuilder/src/com/riiablo/map/MapViewer.java b/tools/src/com/riiablo/map/MapViewer.java similarity index 95% rename from mapbuilder/src/com/riiablo/map/MapViewer.java rename to tools/src/com/riiablo/map/MapViewer.java index 1c0f2dbe..06c9fd5c 100644 --- a/mapbuilder/src/com/riiablo/map/MapViewer.java +++ b/tools/src/com/riiablo/map/MapViewer.java @@ -11,6 +11,7 @@ import com.badlogic.gdx.ai.utils.Ray; import com.badlogic.gdx.assets.AssetManager; import com.badlogic.gdx.backends.lwjgl.LwjglApplication; import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; +import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Texture; @@ -36,7 +37,6 @@ import com.riiablo.codec.FontTBL; import com.riiablo.codec.Palette; import com.riiablo.codec.StringTBLs; import com.riiablo.codec.TXT; -import com.riiablo.codec.excel.Excel; import com.riiablo.entity.Engine; import com.riiablo.entity.Entity; import com.riiablo.entity.Player; @@ -49,18 +49,19 @@ import com.riiablo.loader.TXTLoader; import com.riiablo.map.DT1.Tile; import com.riiablo.mpq.MPQFileHandleResolver; -public class MapViewer extends ApplicationAdapter { +import org.apache.commons.lang3.math.NumberUtils; - private static final String TAG = "MapBuilder"; +public class MapViewer extends ApplicationAdapter { + private static final String TAG = "MapViewer"; public static void main(String[] args) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); - config.title = "Map Builder"; + config.title = TAG; config.resizable = true; config.width = 1280; // 1280 config.height = 720; config.foregroundFPS = config.backgroundFPS = 144; - MapViewer client = new MapViewer(); + MapViewer client = new MapViewer(args); new LwjglApplication(client, config); } @@ -69,7 +70,6 @@ public class MapViewer extends ApplicationAdapter { ShapeRenderer shapes; Texture palette; Map map; - com.riiablo.map.DS1Types DS1Types; Entity ent; MapRenderer mapRenderer; @@ -91,11 +91,27 @@ public class MapViewer extends ApplicationAdapter { boolean drawRoofs = true; boolean drawSpecial = true; + FileHandle home; + int seed; + int act; + int diff; + + MapViewer(String[] args) { + this(args[0], NumberUtils.toInt(args[1]), NumberUtils.toInt(args[2]), NumberUtils.toInt(args[3])); + } + + MapViewer(String home, int seed, int act, int diff) { + this.home = new FileHandle(home); + this.seed = seed; + this.act = act; + this.diff = diff; + } + @Override public void create() { Gdx.app.setLogLevel(Application.LOG_DEBUG); - Riiablo.home = Gdx.files.absolute("C:\\Program Files (x86)\\Steam\\steamapps\\common\\Diablo II"); + Riiablo.home = home = Gdx.files.absolute(home.path()); MPQFileHandleResolver resolver = Riiablo.mpqs = new MPQFileHandleResolver(); AssetManager assets = Riiablo.assets = new AssetManager(); @@ -116,9 +132,6 @@ public class MapViewer extends ApplicationAdapter { Riiablo.string = new StringTBLs(resolver); Riiablo.cofs = new COFs(assets);//COFD2.loadFromFile(resolver.resolve("data\\global\\cmncof_a1.d2")); - TXT txt = TXT.loadFromFile(Gdx.files.local("data/ds1types.txt")); - DS1Types = Excel.parse(txt, com.riiablo.map.DS1Types.class); - ShaderProgram.pedantic = false; ShaderProgram shader = Riiablo.shader = new ShaderProgram( Gdx.files.internal("shaders/indexpalette3.vert"), @@ -332,7 +345,7 @@ public class MapViewer extends ApplicationAdapter { */ assets.setLoader(Map.class, new MapLoader(resolver)); - assets.load("Act 1", Map.class, MapLoader.MapParameters.of(0, 0, 0)); + assets.load("Act 1", Map.class, MapLoader.MapParameters.of(seed, act, diff)); assets.finishLoading(); map = assets.get("Act 1");