Added editor, such as it is.
authorNot Zed <notzed@gmail.com>
Tue, 28 Feb 2023 01:58:17 +0000 (12:28 +1030)
committerNot Zed <notzed@gmail.com>
Tue, 28 Feb 2023 01:59:56 +0000 (12:29 +1030)
De-duplicated xml io and viewer classes.

59 files changed:
Makefile
build.xml [new file with mode: 0644]
src/duskz.client/classes/duskz/client/DataManager.java
src/duskz.client/classes/duskz/client/Dusk.java
src/duskz.client/classes/duskz/client/fx/DataManagerFX.java
src/duskz.client/classes/module-info.java
src/duskz.common/classes/duskz/map/Locatable.java [new file with mode: 0644]
src/duskz.common/classes/duskz/map/Location.java [moved from src/duskz.server/classes/duskz/server/entityz/Location.java with 98% similarity]
src/duskz.common/classes/duskz/map/TileMap.java [moved from src/duskz.server/classes/duskz/server/entityz/TileMap.java with 90% similarity]
src/duskz.common/classes/duskz/map/io/Data.java [moved from src/duskz.server/classes/duskz/io/tiled/Data.java with 99% similarity]
src/duskz.common/classes/duskz/map/io/Image.java [moved from src/duskz.server/classes/duskz/io/tiled/Image.java with 99% similarity]
src/duskz.common/classes/duskz/map/io/Layer.java [moved from src/duskz.server/classes/duskz/io/tiled/Layer.java with 99% similarity]
src/duskz.common/classes/duskz/map/io/Map.java [moved from src/duskz.server/classes/duskz/io/tiled/Map.java with 99% similarity]
src/duskz.common/classes/duskz/map/io/Object.java [moved from src/duskz.server/classes/duskz/io/tiled/Object.java with 99% similarity]
src/duskz.common/classes/duskz/map/io/ObjectFactory.java [moved from src/duskz.server/classes/duskz/io/tiled/ObjectFactory.java with 99% similarity]
src/duskz.common/classes/duskz/map/io/Objectgroup.java [moved from src/duskz.server/classes/duskz/io/tiled/Objectgroup.java with 99% similarity]
src/duskz.common/classes/duskz/map/io/Properties.java [moved from src/duskz.server/classes/duskz/io/tiled/Properties.java with 98% similarity]
src/duskz.common/classes/duskz/map/io/Property.java [moved from src/duskz.server/classes/duskz/io/tiled/Property.java with 98% similarity]
src/duskz.common/classes/duskz/map/io/Tile.java [moved from src/duskz.server/classes/duskz/io/tiled/Tile.java with 99% similarity]
src/duskz.common/classes/duskz/map/io/Tileset.java [moved from src/duskz.server/classes/duskz/io/tiled/Tileset.java with 99% similarity]
src/duskz.common/classes/duskz/util/PropertyLoader.java [moved from src/duskz.server/classes/duskz/server/entityz/PropertyLoader.java with 99% similarity]
src/duskz.common/classes/module-info.java
src/duskz.editor/classes/au/notzed/tilez/io/Data.java [deleted file]
src/duskz.editor/classes/au/notzed/tilez/io/Image.java [deleted file]
src/duskz.editor/classes/au/notzed/tilez/io/Layer.java [deleted file]
src/duskz.editor/classes/au/notzed/tilez/io/Map.java [deleted file]
src/duskz.editor/classes/au/notzed/tilez/io/Object.java [deleted file]
src/duskz.editor/classes/au/notzed/tilez/io/ObjectFactory.java [deleted file]
src/duskz.editor/classes/au/notzed/tilez/io/Objectgroup.java [deleted file]
src/duskz.editor/classes/au/notzed/tilez/io/Properties.java [deleted file]
src/duskz.editor/classes/au/notzed/tilez/io/Property.java [deleted file]
src/duskz.editor/classes/au/notzed/tilez/io/Tile.java [deleted file]
src/duskz.editor/classes/au/notzed/tilez/io/Tileset.java [deleted file]
src/duskz.server/classes/duskz/server/entity/TileMap.java
src/duskz.server/classes/duskz/server/entityz/Active.java
src/duskz.server/classes/duskz/server/entityz/Converter.java
src/duskz.server/classes/duskz/server/entityz/Faction.java
src/duskz.server/classes/duskz/server/entityz/Game.java
src/duskz.server/classes/duskz/server/entityz/Mobile.java
src/duskz.server/classes/duskz/server/entityz/PlayerCommands.java
src/duskz.server/classes/duskz/server/entityz/PlayerState.java
src/duskz.server/classes/duskz/server/entityz/Race.java
src/duskz.server/classes/duskz/server/entityz/Thing.java
src/duskz.server/classes/module-info.java
src/duskz.tools/classes/duskz/editor/DuskInfoView.java [moved from src/duskz.editor/classes/au/notzed/tilez/DuskInfoView.java with 98% similarity]
src/duskz.tools/classes/duskz/editor/LocationEditor.java [moved from src/duskz.editor/classes/au/notzed/tilez/LocationEditor.java with 99% similarity]
src/duskz.tools/classes/duskz/editor/MapLayer.java [moved from src/duskz.editor/classes/au/notzed/tilez/MapLayer.java with 98% similarity]
src/duskz.tools/classes/duskz/editor/TZ.java [moved from src/duskz.editor/classes/au/notzed/tilez/TZ.java with 97% similarity]
src/duskz.tools/classes/duskz/editor/TextEditor.java [moved from src/duskz.editor/classes/au/notzed/tilez/TextEditor.java with 99% similarity]
src/duskz.tools/classes/duskz/editor/TileView.java [moved from src/duskz.editor/classes/au/notzed/tilez/TileView.java with 97% similarity]
src/duskz.tools/classes/duskz/editor/TileZ.java [moved from src/duskz.editor/classes/au/notzed/tilez/TileZ.java with 92% similarity]
src/duskz.tools/classes/duskz/proto/Junk.java [moved from src/duskz.server/classes/duskz/proto/Junk.java with 100% similarity]
src/duskz.tools/classes/duskz/tool/Convert.java [moved from src/duskz.server/classes/duskz/io/Convert.java with 98% similarity]
src/duskz.tools/classes/duskz/tool/fx/MapSelectionModel.java [moved from src/duskz.editor/classes/au/notzed/tilez/MapSelectionModel.java with 98% similarity]
src/duskz.tools/classes/duskz/tool/fx/MapView.java [moved from src/duskz.editor/classes/au/notzed/tilez/MapView.java with 79% similarity]
src/duskz.tools/classes/duskz/tool/fx/TileAnimator.java [new file with mode: 0644]
src/duskz.tools/classes/duskz/viewer/MapViewer.java [new file with mode: 0644]
src/duskz.tools/classes/duskz/viewer/Tiled.java [moved from src/duskz.server/classes/duskz/io/Tiled.java with 51% similarity]
src/duskz.tools/classes/module-info.java [new file with mode: 0644]

index 9488d4e..73bd8d8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,11 +5,18 @@ dist_EXTRA=
 
 include config.make
 
-java_MODULES = duskz.common duskz.client duskz.server
+java_MODULES =                                 \
+       duskz.common                            \
+       duskz.client                            \
+       duskz.server                            \
+       duskz.tools
 
 duskz.client_JDEPMOD = duskz.common
 duskz.server_JDEPMOD = duskz.common
 
+duskz.editor_JDEPMOD = duskz.common duskz.client
+duskz.viewer_JDEPMOD = duskz.common duskz.client
+
 include java.make
 
 maven_central_JARS = \
@@ -36,15 +43,25 @@ include maven.make
 run-server-old: duskz.server
        cd game-2.7.3 && \
        $(JAVA) \
-               --module-path $(JAVAFX_HOME)/lib:../.lib:../bin/$(TARGET)/lib \
+               --module-path ../.lib:../bin/$(TARGET)/lib \
                -m duskz.server/duskz.server.DuskServer
 
 run-server: duskz.server
        $(JAVA) \
-               --module-path $(JAVAFX_HOME)/lib:../.lib:../bin/$(TARGET)/lib \
+               --module-path .lib:bin/$(TARGET)/lib \
                -m duskz.server/duskz.server.entityz.GameServer game
 
 run-client: duskz.client
        $(JAVA) \
                $(if $(JAVAMODPATH),--module-path $(subst $(S),:,$(JAVAMODPATH))) \
                -m duskz.client/duskz.client.fx.DuskFX
+
+run-viewer: duskz.tools
+       $(JAVA) \
+               $(if $(JAVAMODPATH),--module-path $(subst $(S),:,$(JAVAMODPATH))) \
+               -m duskz.tools/duskz.viewer.MapViewer
+
+run-editor: duskz.tools
+       $(JAVA) \
+               $(if $(JAVAMODPATH),--module-path $(subst $(S),:,$(JAVAMODPATH))) \
+               -m duskz.tools/duskz.viewer.MapViewer
diff --git a/build.xml b/build.xml
new file mode 100644 (file)
index 0000000..200816d
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See commented blocks below for -->
+<!-- some examples of how to customize the build. -->
+<!-- (If you delete it and reopen the project it will be recreated.) -->
+<!-- By default, only the Clean and Build commands use this build script. -->
+<!-- Commands such as Run, Debug, and Test only use this build script if -->
+<!-- the Compile on Save feature is turned off for the project. -->
+<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
+<!-- in the project's Project Properties dialog box.-->
+<project name="DuskZ" default="default" basedir="." xmlns:j2semodularproject="http://www.netbeans.org/ns/j2se-modular-project/1">
+    <description>Builds, tests, and runs the project DuskZ.</description>
+    <import file="nbproject/build-impl.xml"/>
+    <!--
+
+    There exist several targets which are by default empty and which can be 
+    used for execution of your tasks. These targets are usually executed 
+    before and after some main targets. They are: 
+
+      -pre-init:                 called before initialization of project properties
+      -post-init:                called after initialization of project properties
+      -pre-compile:              called before javac compilation
+      -post-compile:             called after javac compilation
+      -pre-compile-single:       called before javac compilation of single file
+      -post-compile-single:      called after javac compilation of single file
+      -pre-compile-test:         called before javac compilation of JUnit tests
+      -post-compile-test:        called after javac compilation of JUnit tests
+      -pre-compile-test-single:  called before javac compilation of single JUnit test
+      -post-compile-test-single: called after javac compilation of single JUunit test
+      -pre-jar:                  called before JAR building
+      -post-jar:                 called after JAR building
+      -post-clean:               called after cleaning build products
+
+    (Targets beginning with '-' are not intended to be called on their own.)
+
+    Example of inserting an obfuscator after compilation could look like this:
+
+        <target name="-post-compile">
+            <obfuscate>
+                <fileset dir="${build.classes.dir}"/>
+            </obfuscate>
+        </target>
+
+    For list of available properties check the imported 
+    nbproject/build-impl.xml file. 
+
+
+    Another way to customize the build is by overriding existing main targets.
+    The targets of interest are: 
+
+      -init-macrodef-javac:     defines macro for javac compilation
+      -init-macrodef-junit:     defines macro for junit execution
+      -init-macrodef-debug:     defines macro for class debugging
+      -init-macrodef-java:      defines macro for class execution
+      -do-jar:                  JAR building
+      run:                      execution of project 
+      -javadoc-build:           Javadoc generation
+      test-report:              JUnit report generation
+
+    Notice that the overridden target depends on the jar target and not only on 
+    the compile target as the regular run target does. Again, for a list of available 
+    properties which you can use, check the target you are overriding in the
+    nbproject/build-impl.xml file. 
+
+    -->
+</project>
index 52a0249..3c7343f 100644 (file)
@@ -31,6 +31,8 @@ import java.util.jar.Attributes;
 import java.util.jar.JarEntry;
 import java.util.jar.JarInputStream;
 import java.util.jar.Manifest;
+import javafx.geometry.Rectangle2D;
+import javafx.scene.image.ImageView;
 
 /**
  * Utility for loading game objects from jar file
@@ -99,6 +101,28 @@ public class DataManager {
                return list.toArray(new ImageSet[list.size()]);
        }
 
+       public InputStream getInputStream(String path) throws IOException {
+               JarInputStream jis = null;
+               try {
+                       jis = openJar();
+                       JarEntry je;
+
+                       System.out.println("Looking for: " + path);
+
+                       while ((je = jis.getNextJarEntry()) != null) {
+                               System.out.println("je = " + je.getName());
+                               if (je.getName().equals(path))
+                                       return jis;
+                       }
+                       jis.close();
+                       throw new FileNotFoundException(path);
+               } catch (IOException ex) {
+                       if (jis != null)
+                               jis.close();
+                       throw ex;
+               }
+       }
+
        public class ImageSet {
 
                public String name;
@@ -113,27 +137,27 @@ public class DataManager {
 
                public void load() throws IOException {
                }
-
-               public InputStream getInputStream() throws IOException {
-                       JarInputStream jis = null;
-                       try {
-                               jis = openJar();
-                               JarEntry je;
-
-                               System.out.println("Looking for: " + source);
-
-                               while ((je = jis.getNextJarEntry()) != null) {
-                                       System.out.println("je = " + je.getName());
-                                       if (je.getName().equals(source))
-                                               return jis;
-                               }
-                               jis.close();
-                               throw new FileNotFoundException(source);
-                       } catch (IOException ex) {
-                               if (jis != null)
-                                       jis.close();
-                               throw ex;
-                       }
-               }
+               /*
+                public InputStream getInputStream() throws IOException {
+                JarInputStream jis = null;
+                try {
+                jis = openJar();
+                JarEntry je;
+
+                System.out.println("Looking for: " + source);
+
+                while ((je = jis.getNextJarEntry()) != null) {
+                System.out.println("je = " + je.getName());
+                if (je.getName().equals(source))
+                return jis;
+                }
+                jis.close();
+                throw new FileNotFoundException(source);
+                } catch (IOException ex) {
+                if (jis != null)
+                jis.close();
+                throw ex;
+                }
+                }*/
        }
 }
index fbc0264..c63efd7 100644 (file)
@@ -124,9 +124,9 @@ public class Dusk implements Runnable, DuskProtocol {
        }
 
        // Main entry point
-       //static public void main(String[] args) {
-       //      new Dusk();
-       //}
+       static public void main(String[] args) {
+       }
+
        void connect() {
                throw new UnsupportedOperationException();
        }
index 041ee6c..8281c91 100644 (file)
 package duskz.client.fx;
 
 import duskz.client.DataManager;
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
 import javafx.geometry.Rectangle2D;
 import javafx.scene.image.Image;
 import javafx.scene.image.ImageView;
@@ -36,10 +42,119 @@ import javafx.scene.image.ImageView;
  */
 public class DataManagerFX extends DataManager {
 
+       HashMap<Integer, AnimSetFX> animset = new HashMap<>();
+
        public DataManagerFX(String source) {
                super(source);
        }
 
+       public boolean isAnimRoot(int id) {
+               return animset.containsKey(id);
+       }
+
+       public AnimSetFX getAnimSet(int id) {
+               return animset.get(id);
+       }
+
+       @Override
+       public void open() throws IOException {
+               super.open();
+
+               try (BufferedReader is = new BufferedReader(new InputStreamReader(getInputStream("tiles/anim")))) {
+                       String line;
+                       PropParser prop = new PropParser();
+
+                       while ((line = is.readLine()) != null) {
+                               if (!prop.setInput(line))
+                                       continue;
+
+                               if (!prop.getProperty().startsWith("anim."))
+                                       continue;
+
+                               AnimSetFX anim = new AnimSetFX(prop.getProperty().substring(5));
+                               List<Rectangle2D> rects = new ArrayList<>();
+                               while (!prop.eof()) {
+                                       int tileid = prop.nextInt();
+                                       int time = 250;
+
+                                       if (prop.nextChar(':')) {
+                                               time = prop.nextInt();
+                                       }
+
+                                       if (anim.root == -1)
+                                               anim.root = tileid;
+                                       rects.add(createTile(tileid, 0, 0, 64, 64).getViewport());
+
+                                       if (!prop.nextChar(','))
+                                               break;
+                               }
+                               if (anim.root != -1) {
+                                       anim.tiles = rects.toArray(new Rectangle2D[rects.size()]);
+                                       animset.put(anim.root, anim);
+                               }
+                       }
+               } catch (FileNotFoundException ex) {
+               }
+               /*              final Rectangle2D[] anims = new Rectangle2D[2];
+                anims[0] = data.createTile(305, 0, 0, tileSize, tileSize).getViewport();
+                anims[1] = data.createTile(304, 0, 0, tileSize, tileSize).getViewport();
+                final List<ImageView> animated = new ArrayList<>();
+                */
+
+       }
+
+       static class PropParser {
+
+               String input;
+               String prop;
+               int eq;
+               int index;
+
+               public boolean setInput(String input) {
+                       this.input = input;
+
+                       eq = input.indexOf("=");
+                       if (eq > 0) {
+                               index = eq + 1;
+                               prop = input.substring(0, eq);
+                               return true;
+                       } else {
+                               prop = null;
+                               return false;
+                       }
+               }
+
+               public String getProperty() {
+                       return prop;
+               }
+
+               public boolean eof() {
+                       return index == -1 || index >= input.length();
+               }
+
+               public int nextInt() {
+                       int val = 0;
+                       while (!eof()) {
+                               char c = input.charAt(index);
+                               if (Character.isDigit(c)) {
+                                       val = val * 10 + Character.digit(c, 10);
+                                       index++;
+                               } else {
+                                       return val;
+                               }
+                       }
+                       return val;
+               }
+
+               public boolean nextChar(char c) {
+                       if (!eof() && input.charAt(index) == c) {
+                               index++;
+                               return true;
+                       }
+                       return false;
+               }
+       }
+
        @Override
        protected ImageSet createImageSet() {
                return new ImageSetFX();
@@ -95,6 +210,18 @@ public class DataManagerFX extends DataManager {
                return new ImageView();
        }
 
+       public class AnimSetFX {
+
+               public String name;
+               public int root = -1;
+               public Rectangle2D[] tiles;
+               public int rate = 250;
+
+               public AnimSetFX(String name) {
+                       this.name = name;
+               }
+       }
+
        public class ImageSetFX extends ImageSet {
 
                Image image;
@@ -105,7 +232,7 @@ public class DataManagerFX extends DataManager {
 
                public void load() throws IOException {
                        System.out.println("Load tileset " + name + " gid " + gid + " count " + count);
-                       try (InputStream s = getInputStream()) {
+                       try (InputStream s = getInputStream(this.source)) {
                                image = new Image(s);
                        }
 
index 5c79a77..542a148 100644 (file)
@@ -21,6 +21,8 @@ module duskz.client {
        requires java.logging;
        requires duskz.common;
 
+       requires java.desktop; // for old client?
+       
        requires javafx.graphics;
        requires javafx.controls;
 
diff --git a/src/duskz.common/classes/duskz/map/Locatable.java b/src/duskz.common/classes/duskz/map/Locatable.java
new file mode 100644 (file)
index 0000000..4a7a878
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2023 Michael Zucchi
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+package duskz.map;
+
+public interface Locatable {
+
+       public int getX();
+
+       public int getY();
+
+       public void setX(int x);
+
+       public void setY(int y);
+}
@@ -17,7 +17,7 @@
  * along with DuskZ; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
-package duskz.server.entityz;
+package duskz.map;
 
 /**
  * Track position.
 /**
  * Changes
  */
-package duskz.server.entityz;
+package duskz.map;
 
-import duskz.server.entityz.PropertyLoader.PropertyEntry;
+//import duskz.server.entityz.Thing;
+import duskz.util.PropertyLoader;
+import duskz.util.PropertyLoader.PropertyEntry;
 import duskz.util.Maths;
 import java.io.DataInputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.RandomAccessFile;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -47,7 +50,7 @@ import java.util.zip.GZIPInputStream;
  *
  * @author notzed
  */
-public class TileMap implements Iterable<TileMap.MapData> {
+public class TileMap<Thing extends Locatable> implements Iterable<TileMap.MapData> {
 
        /**
         * Name of map for referencing
@@ -191,6 +194,65 @@ public class TileMap implements Iterable<TileMap.MapData> {
        // TODO: gzip?
        public static final int MAGIC_LAYERED = 0x6d61707a;
 
+       /**
+        * Load just the map part of a map.
+        *
+        * TODO: sort something out with the alias stuff and loadLayered()
+        *
+        * @param is
+        * @param name
+        * @return
+        * @throws IOException
+        */
+       public static TileMap loadLayeredMap(InputStream is, String name) throws IOException {
+               TileMap map;
+
+               try (DataInputStream mapFile = new DataInputStream((is))) {
+                       int magic = mapFile.readInt();
+                       int version = mapFile.readInt();
+                       int flags = mapFile.readInt();
+                       int cols = mapFile.readInt();
+                       int rows = mapFile.readInt();
+                       int groundLayer = mapFile.readInt();
+                       int layerCount = mapFile.readInt();
+
+                       if (magic != MAGIC_LAYERED
+                                       || version != 0) {
+                               throw new IOException("Invalid format/magic/unknown version");
+                       }
+
+                       System.out.println("Load map: " + name);
+                       System.out.printf(" size: %dx%d\n", cols, rows);
+                       System.out.printf(" groundLayer: %d\n", groundLayer);
+                       System.out.printf(" layerCount: %d\n", layerCount);
+
+                       map = new TileMap(name, cols, rows);
+
+                       map.groundLayer = groundLayer;
+                       map.layers = new TileLayer[layerCount];
+                       for (int l = 0; l < layerCount; l++) {
+                               int tx = mapFile.readInt();
+                               int ty = mapFile.readInt();
+                               int twidth = mapFile.readInt();
+                               int theight = mapFile.readInt();
+                               TileLayer tl;
+
+                               System.out.printf("  layer %2d: at %3d,%3d size %3dx%3d\n", l, tx, ty, twidth, theight);
+                               if (l == groundLayer)
+                                       tl = new TileLayer(tx, ty, twidth, theight, map.tiles);
+                               else
+                                       tl = new TileLayer(tx, ty, twidth, theight);
+
+                               map.layers[l] = tl;
+
+                               for (int i = 0; i < twidth * theight; i++) {
+                                       tl.tiles[i] = mapFile.readShort();
+                               }
+                       }
+               }
+               return map;
+       }
+
        /**
         * Load a layered map. Format is:
         * magic: int
@@ -488,10 +550,10 @@ public class TileMap implements Iterable<TileMap.MapData> {
        }
 
        public synchronized void addEntity(Thing o) {
-               if (inside(o.x, o.y)) {
+               if (inside(o.getX(), o.getY())) {
                        //int index = o.x + o.y * cols;
                        //entities[index] = Thing.append(entities[index], o);
-                       Location l = new Location(o.x, o.y);
+                       Location l = new Location(o.getX(), o.getY());
                        LinkedList<Thing> ll = entities.get(l);
                        if (ll == null) {
                                ll = new LinkedList<>();
@@ -506,10 +568,10 @@ public class TileMap implements Iterable<TileMap.MapData> {
        }
 
        public synchronized void removeEntity(Thing o) {
-               if (inside(o.x, o.y)) {
+               if (inside(o.getX(), o.getY())) {
                        //int index = o.x + o.y * cols;
                        //entities[index] = Thing.remove(entities[index], o);
-                       Location l = new Location(o.x, o.y);
+                       Location l = new Location(o.getX(), o.getY());
                        LinkedList<Thing> ll = entities.get(l);
                        ll.remove(o);
                        if (ll.isEmpty()) {
@@ -521,8 +583,8 @@ public class TileMap implements Iterable<TileMap.MapData> {
        public synchronized void moveEntity(Thing o, int x, int y) {
                if (inside(x, y)) {
                        removeEntity(o);
-                       o.x = x;
-                       o.y = y;
+                       o.setX(x);
+                       o.setY(y);
                        addEntity(o);
                }
        }
@@ -536,7 +598,7 @@ public class TileMap implements Iterable<TileMap.MapData> {
         * @param y1
         * @return
         */
-       public Iterable<MapData> range(int x0, int y0, int x1, int y1) {
+       public Iterable<TileMap.MapData> range(int x0, int y0, int x1, int y1) {
                return new MapIterable(x0, y0, x1, y1);
        }
 
@@ -548,7 +610,7 @@ public class TileMap implements Iterable<TileMap.MapData> {
         * @param radius
         * @return
         */
-       public Iterable<MapData> range(int x, int y, int radius) {
+       public Iterable<TileMap.MapData> range(int x, int y, int radius) {
                return new MapIterable(x - radius, y - radius, x + radius + 1, y + radius + 1);
        }
 
@@ -632,7 +694,7 @@ public class TileMap implements Iterable<TileMap.MapData> {
                return hash;
        }
 
-       private class MapIterable implements Iterable<MapData> {
+       private class MapIterable implements Iterable<TileMap.MapData> {
 
                int x0, y0, x1, y1;
 
@@ -644,7 +706,7 @@ public class TileMap implements Iterable<TileMap.MapData> {
                }
 
                @Override
-               public Iterator<MapData> iterator() {
+               public Iterator<TileMap.MapData> iterator() {
                        return new MapIterator(x0, y0, x1, y1);
                }
        }
@@ -689,12 +751,12 @@ public class TileMap implements Iterable<TileMap.MapData> {
                }
        }
 
-       public Iterator<MapData> getIterator(int x0, int y0, int x1, int y1) {
+       public Iterator<TileMap.MapData> getIterator(int x0, int y0, int x1, int y1) {
                return new MapIterator(x0, y0, x1, y1);
        }
 
        @Override
-       public Iterator<MapData> iterator() {
+       public Iterator<TileMap.MapData> iterator() {
                return getIterator(0, 0, cols, rows);
        }
 
@@ -731,7 +793,7 @@ public class TileMap implements Iterable<TileMap.MapData> {
                public String direction;
        }
 
-       private class MapIterator implements Iterator<MapData> {
+       private class MapIterator implements Iterator<TileMap.MapData> {
 
                int x0, y0, x1, y1;
                int x, y;
@@ -876,7 +938,7 @@ public class TileMap implements Iterable<TileMap.MapData> {
 
        public interface MoveListener {
 
-               public boolean canMoveto(MapData md);
+               public boolean canMoveto(TileMap.MapData md);
        }
 
        /**
@@ -1078,46 +1140,4 @@ public class TileMap implements Iterable<TileMap.MapData> {
                        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }
        }
-
-       public static void main(String[] args) {
-               TileMap map = new TileMap("test", 16, 16);
-
-               /*
-                for (MapData md : map.look(5, 5, 10, 3)) {
-                System.out.printf(" %d,%d\n", md.x, md.y);
-                }
-                for (MapData md : map.look(15, 15, 0, 0)) {
-                System.out.printf(" %d,%d\n", md.x, md.y);
-                }
-                for (MapData md : map.look(15, 0, 0, 15)) {
-                System.out.printf(" %d,%d\n", md.x, md.y);
-                }*/
-
-
-               MoveListener l = new MoveListener() {
-                       @Override
-                       public boolean canMoveto(MapData md) {
-                               //System.out.printf("can move %d,%d\n", md.x, md.y);
-                               return md.tile == 0;
-                       }
-               };
-               System.out.println("no obstacles");
-               for (MoveData md : map.move(0, 0, 10, 10, 0, l)) {
-                       System.out.printf(" %d,%d %s\n", md.x, md.y, md.direction);
-               }
-
-               // put an obstacle in the way
-               for (int x = 0; x < 11; x++) {
-                       map.setTile(x, 5, 1);
-               }
-               System.out.println("line in the way");
-               for (MoveData md : map.move(0, 0, 10, 10, SKIP_END, l)) {
-                       System.out.printf(" %d,%d %s\n", md.x, md.y, md.direction);
-               }
-               System.out.println("line in the way to last");
-               for (MoveData md : map.move(0, 0, 1, 1, 0, l)) {
-                       System.out.printf(" %d,%d %s\n", md.x, md.y, md.direction);
-               }
-
-       }
 }
@@ -6,7 +6,7 @@
 //
 
 
-package duskz.io.tiled;
+package duskz.map.io;
 
 import jakarta.xml.bind.annotation.XmlAccessType;
 import jakarta.xml.bind.annotation.XmlAccessorType;
@@ -6,7 +6,7 @@
 //
 
 
-package duskz.io.tiled;
+package duskz.map.io;
 
 import jakarta.xml.bind.annotation.XmlAccessType;
 import jakarta.xml.bind.annotation.XmlAccessorType;
@@ -6,7 +6,7 @@
 //
 
 
-package duskz.io.tiled;
+package duskz.map.io;
 
 import jakarta.xml.bind.annotation.XmlAccessType;
 import jakarta.xml.bind.annotation.XmlAccessorType;
@@ -6,7 +6,7 @@
 //
 
 
-package duskz.io.tiled;
+package duskz.map.io;
 
 import jakarta.xml.bind.annotation.XmlAccessType;
 import jakarta.xml.bind.annotation.XmlAccessorType;
@@ -6,7 +6,7 @@
 //
 
 
-package duskz.io.tiled;
+package duskz.map.io;
 
 import jakarta.xml.bind.annotation.XmlAccessType;
 import jakarta.xml.bind.annotation.XmlAccessorType;
@@ -6,7 +6,7 @@
 //
 
 
-package duskz.io.tiled;
+package duskz.map.io;
 
 import jakarta.xml.bind.annotation.XmlAccessType;
 import jakarta.xml.bind.annotation.XmlAccessorType;
@@ -6,7 +6,7 @@
 //
 
 
-package duskz.io.tiled;
+package duskz.map.io;
 
 import jakarta.xml.bind.annotation.XmlAccessType;
 import jakarta.xml.bind.annotation.XmlAccessorType;
@@ -6,7 +6,7 @@
 //
 
 
-package duskz.io.tiled;
+package duskz.map.io;
 
 import jakarta.xml.bind.annotation.XmlAccessType;
 import jakarta.xml.bind.annotation.XmlAccessorType;
@@ -6,7 +6,7 @@
 //
 
 
-package duskz.io.tiled;
+package duskz.map.io;
 
 import jakarta.xml.bind.annotation.XmlAccessType;
 import jakarta.xml.bind.annotation.XmlAccessorType;
@@ -6,7 +6,7 @@
 //
 
 
-package duskz.io.tiled;
+package duskz.map.io;
 
 import jakarta.xml.bind.annotation.XmlAccessType;
 import jakarta.xml.bind.annotation.XmlAccessorType;
@@ -17,7 +17,7 @@
  * along with DuskZ; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
-package duskz.server.entityz;
+package duskz.util;
 
 import java.io.BufferedReader;
 import java.io.File;
index eba8bac..4684294 100644 (file)
@@ -1,6 +1,11 @@
 
 module duskz.common {
+       requires java.desktop;
+       requires java.logging;
+       requires jakarta.xml.bind;
 
        exports duskz.protocol;
        exports duskz.util;
+       exports duskz.map;
+       exports duskz.map.io;
 }
diff --git a/src/duskz.editor/classes/au/notzed/tilez/io/Data.java b/src/duskz.editor/classes/au/notzed/tilez/io/Data.java
deleted file mode 100644 (file)
index c23d4ba..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2013.02.27 at 01:07:39 PM CST
-//
-
-
-package au.notzed.tilez.io;
-
-import jakarta.xml.bind.annotation.XmlAccessType;
-import jakarta.xml.bind.annotation.XmlAccessorType;
-import jakarta.xml.bind.annotation.XmlAttribute;
-import jakarta.xml.bind.annotation.XmlRootElement;
-import jakarta.xml.bind.annotation.XmlType;
-import jakarta.xml.bind.annotation.XmlValue;
-import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter;
-import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-/**
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
-    "value"
-})
-@XmlRootElement(name = "data")
-public class Data {
-
-    @XmlAttribute(name = "encoding")
-    @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
-    protected String encoding;
-    @XmlAttribute(name = "compression")
-    @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
-    protected String compression;
-    @XmlValue
-    protected String value;
-
-    /**
-     * Gets the value of the encoding property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getEncoding() {
-        return encoding;
-    }
-
-    /**
-     * Sets the value of the encoding property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setEncoding(String value) {
-        this.encoding = value;
-    }
-
-    /**
-     * Gets the value of the compression property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getCompression() {
-        return compression;
-    }
-
-    /**
-     * Sets the value of the compression property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setCompression(String value) {
-        this.compression = value;
-    }
-
-    /**
-     * Gets the value of the value property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getvalue() {
-        return value;
-    }
-
-    /**
-     * Sets the value of the value property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setvalue(String value) {
-        this.value = value;
-    }
-
-}
diff --git a/src/duskz.editor/classes/au/notzed/tilez/io/Image.java b/src/duskz.editor/classes/au/notzed/tilez/io/Image.java
deleted file mode 100644 (file)
index b597b25..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2013.02.27 at 01:07:39 PM CST
-//
-
-
-package au.notzed.tilez.io;
-
-import jakarta.xml.bind.annotation.XmlAccessType;
-import jakarta.xml.bind.annotation.XmlAccessorType;
-import jakarta.xml.bind.annotation.XmlAttribute;
-import jakarta.xml.bind.annotation.XmlRootElement;
-import jakarta.xml.bind.annotation.XmlType;
-import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter;
-import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-/**
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
-    "data"
-})
-@XmlRootElement(name = "image")
-public class Image {
-
-    @XmlAttribute(name = "format")
-    @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
-    protected String format;
-    @XmlAttribute(name = "id")
-    protected String id;
-    @XmlAttribute(name = "source")
-    @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
-    protected String source;
-    @XmlAttribute(name = "trans")
-    protected String trans;
-    protected Data data;
-
-    /**
-     * Gets the value of the format property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getFormat() {
-        return format;
-    }
-
-    /**
-     * Sets the value of the format property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setFormat(String value) {
-        this.format = value;
-    }
-
-    /**
-     * Gets the value of the id property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getId() {
-        return id;
-    }
-
-    /**
-     * Sets the value of the id property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setId(String value) {
-        this.id = value;
-    }
-
-    /**
-     * Gets the value of the source property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getSource() {
-        return source;
-    }
-
-    /**
-     * Sets the value of the source property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setSource(String value) {
-        this.source = value;
-    }
-
-    /**
-     * Gets the value of the trans property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getTrans() {
-        return trans;
-    }
-
-    /**
-     * Sets the value of the trans property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setTrans(String value) {
-        this.trans = value;
-    }
-
-    /**
-     * Gets the value of the data property.
-     *
-     * @return
-     *     possible object is
-     *     {@link Data }
-     *
-     */
-    public Data getData() {
-        return data;
-    }
-
-    /**
-     * Sets the value of the data property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link Data }
-     *
-     */
-    public void setData(Data value) {
-        this.data = value;
-    }
-
-}
diff --git a/src/duskz.editor/classes/au/notzed/tilez/io/Layer.java b/src/duskz.editor/classes/au/notzed/tilez/io/Layer.java
deleted file mode 100644 (file)
index 82d4e33..0000000
+++ /dev/null
@@ -1,266 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2013.02.27 at 01:07:39 PM CST
-//
-
-
-package au.notzed.tilez.io;
-
-import jakarta.xml.bind.annotation.XmlAccessType;
-import jakarta.xml.bind.annotation.XmlAccessorType;
-import jakarta.xml.bind.annotation.XmlAttribute;
-import jakarta.xml.bind.annotation.XmlElement;
-import jakarta.xml.bind.annotation.XmlRootElement;
-import jakarta.xml.bind.annotation.XmlType;
-import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter;
-import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-/**
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
-    "properties",
-    "data"
-})
-@XmlRootElement(name = "layer")
-public class Layer {
-
-    @XmlAttribute(name = "name", required = true)
-    @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
-    protected String name;
-    @XmlAttribute(name = "width", required = true)
-    protected int width;
-    @XmlAttribute(name = "height", required = true)
-    protected int height;
-    @XmlAttribute(name = "x")
-    protected int x;
-    @XmlAttribute(name = "y")
-    protected int y;
-    @XmlAttribute(name = "opacity")
-    protected float opacity;
-    @XmlAttribute(name = "visible")
-    protected int visible;
-    protected Properties properties;
-    @XmlElement(required = true)
-    protected Data data;
-
-    /**
-     * Gets the value of the name property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Sets the value of the name property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setName(String value) {
-        this.name = value;
-    }
-
-    /**
-     * Gets the value of the width property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getWidth() {
-        return width;
-    }
-
-    /**
-     * Sets the value of the width property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setWidth(int value) {
-        this.width = value;
-    }
-
-    /**
-     * Gets the value of the height property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getHeight() {
-        return height;
-    }
-
-    /**
-     * Sets the value of the height property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setHeight(int value) {
-        this.height = value;
-    }
-
-    /**
-     * Gets the value of the x property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getX() {
-        return x;
-    }
-
-    /**
-     * Sets the value of the x property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setX(int value) {
-        this.x = value;
-    }
-
-    /**
-     * Gets the value of the y property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getY() {
-        return y;
-    }
-
-    /**
-     * Sets the value of the y property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setY(int value) {
-        this.y = value;
-    }
-
-    /**
-     * Gets the value of the opacity property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public float getOpacity() {
-        return opacity;
-    }
-
-    /**
-     * Sets the value of the opacity property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setOpacity(float value) {
-        this.opacity = value;
-    }
-
-    /**
-     * Gets the value of the visible property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getVisible() {
-        return visible;
-    }
-
-    /**
-     * Sets the value of the visible property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setVisible(int value) {
-        this.visible = value;
-    }
-
-    /**
-     * Gets the value of the properties property.
-     *
-     * @return
-     *     possible object is
-     *     {@link Properties }
-     *
-     */
-    public Properties getProperties() {
-        return properties;
-    }
-
-    /**
-     * Sets the value of the properties property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link Properties }
-     *
-     */
-    public void setProperties(Properties value) {
-        this.properties = value;
-    }
-
-    /**
-     * Gets the value of the data property.
-     *
-     * @return
-     *     possible object is
-     *     {@link Data }
-     *
-     */
-    public Data getData() {
-        return data;
-    }
-
-    /**
-     * Sets the value of the data property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link Data }
-     *
-     */
-    public void setData(Data value) {
-        this.data = value;
-    }
-
-}
diff --git a/src/duskz.editor/classes/au/notzed/tilez/io/Map.java b/src/duskz.editor/classes/au/notzed/tilez/io/Map.java
deleted file mode 100644 (file)
index a60366f..0000000
+++ /dev/null
@@ -1,366 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2013.02.27 at 01:07:39 PM CST
-//
-
-
-package au.notzed.tilez.io;
-
-import jakarta.xml.bind.annotation.XmlAccessType;
-import jakarta.xml.bind.annotation.XmlAccessorType;
-import jakarta.xml.bind.annotation.XmlAttribute;
-import jakarta.xml.bind.annotation.XmlElement;
-import jakarta.xml.bind.annotation.XmlElements;
-import jakarta.xml.bind.annotation.XmlRootElement;
-import jakarta.xml.bind.annotation.XmlType;
-import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
-import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter;
-import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
-    "properties",
-    "tileset",
-    "layerOrObjectgroup"
-})
-@XmlRootElement(name = "map")
-public class Map {
-
-    @XmlAttribute(name = "xmlns")
-    @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
-    protected String xmlns;
-    @XmlAttribute(name = "xmlns:xsi")
-    @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
-    protected String xmlnsXsi;
-    @XmlAttribute(name = "xsi:schemaLocation")
-    @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
-    protected String xsiSchemaLocation;
-    @XmlAttribute(name = "version", required = true)
-    @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
-    protected String version;
-    @XmlAttribute(name = "orientation", required = true)
-    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
-    protected String orientation;
-    @XmlAttribute(name = "width", required = true)
-    protected int width;
-    @XmlAttribute(name = "height", required = true)
-    protected int height;
-    @XmlAttribute(name = "tilewidth", required = true)
-    protected int tilewidth;
-    @XmlAttribute(name = "tileheight", required = true)
-    protected int tileheight;
-    protected Properties properties;
-    protected List<Tileset> tileset;
-    @XmlElements({
-        @XmlElement(name = "layer", type = Layer.class),
-        @XmlElement(name = "objectgroup", type = Objectgroup.class)
-    })
-    protected List<java.lang.Object> layerOrObjectgroup;
-
-    /**
-     * Gets the value of the xmlns property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getXmlns() {
-        return xmlns;
-    }
-
-    /**
-     * Sets the value of the xmlns property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setXmlns(String value) {
-        this.xmlns = value;
-    }
-
-    /**
-     * Gets the value of the xmlnsXsi property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getXmlnsXsi() {
-        return xmlnsXsi;
-    }
-
-    /**
-     * Sets the value of the xmlnsXsi property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setXmlnsXsi(String value) {
-        this.xmlnsXsi = value;
-    }
-
-    /**
-     * Gets the value of the xsiSchemaLocation property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getXsiSchemaLocation() {
-        return xsiSchemaLocation;
-    }
-
-    /**
-     * Sets the value of the xsiSchemaLocation property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setXsiSchemaLocation(String value) {
-        this.xsiSchemaLocation = value;
-    }
-
-    /**
-     * Gets the value of the version property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getVersion() {
-        return version;
-    }
-
-    /**
-     * Sets the value of the version property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setVersion(String value) {
-        this.version = value;
-    }
-
-    /**
-     * Gets the value of the orientation property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getOrientation() {
-        return orientation;
-    }
-
-    /**
-     * Sets the value of the orientation property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setOrientation(String value) {
-        this.orientation = value;
-    }
-
-    /**
-     * Gets the value of the width property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getWidth() {
-        return width;
-    }
-
-    /**
-     * Sets the value of the width property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setWidth(int value) {
-        this.width = value;
-    }
-
-    /**
-     * Gets the value of the height property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getHeight() {
-        return height;
-    }
-
-    /**
-     * Sets the value of the height property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setHeight(int value) {
-        this.height = value;
-    }
-
-    /**
-     * Gets the value of the tilewidth property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getTilewidth() {
-        return tilewidth;
-    }
-
-    /**
-     * Sets the value of the tilewidth property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setTilewidth(int value) {
-        this.tilewidth = value;
-    }
-
-    /**
-     * Gets the value of the tileheight property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getTileheight() {
-        return tileheight;
-    }
-
-    /**
-     * Sets the value of the tileheight property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setTileheight(int value) {
-        this.tileheight = value;
-    }
-
-    /**
-     * Gets the value of the properties property.
-     *
-     * @return
-     *     possible object is
-     *     {@link Properties }
-     *
-     */
-    public Properties getProperties() {
-        return properties;
-    }
-
-    /**
-     * Sets the value of the properties property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link Properties }
-     *
-     */
-    public void setProperties(Properties value) {
-        this.properties = value;
-    }
-
-    /**
-     * Gets the value of the tileset property.
-     *
-     * <p>
-     * This accessor method returns a reference to the live list,
-     * not a snapshot. Therefore any modification you make to the
-     * returned list will be present inside the JAXB object.
-     * This is why there is not a <CODE>set</CODE> method for the tileset property.
-     *
-     * <p>
-     * For example, to add a new item, do as follows:
-     * <pre>
-     *    getTileset().add(newItem);
-     * </pre>
-     *
-     *
-     * <p>
-     * Objects of the following type(s) are allowed in the list
-     * {@link Tileset }
-     *
-     *
-     */
-    public List<Tileset> getTileset() {
-        if (tileset == null) {
-            tileset = new ArrayList<Tileset>();
-        }
-        return this.tileset;
-    }
-
-    /**
-     * Gets the value of the layerOrObjectgroup property.
-     *
-     * <p>
-     * This accessor method returns a reference to the live list,
-     * not a snapshot. Therefore any modification you make to the
-     * returned list will be present inside the JAXB object.
-     * This is why there is not a <CODE>set</CODE> method for the layerOrObjectgroup property.
-     *
-     * <p>
-     * For example, to add a new item, do as follows:
-     * <pre>
-     *    getLayerOrObjectgroup().add(newItem);
-     * </pre>
-     *
-     *
-     * <p>
-     * Objects of the following type(s) are allowed in the list
-     * {@link Layer }
-     * {@link Objectgroup }
-     *
-     *
-     */
-    public List<java.lang.Object> getLayerOrObjectgroup() {
-        if (layerOrObjectgroup == null) {
-            layerOrObjectgroup = new ArrayList<java.lang.Object>();
-        }
-        return this.layerOrObjectgroup;
-    }
-
-}
diff --git a/src/duskz.editor/classes/au/notzed/tilez/io/Object.java b/src/duskz.editor/classes/au/notzed/tilez/io/Object.java
deleted file mode 100644 (file)
index f05d376..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2013.02.27 at 01:07:39 PM CST
-//
-
-
-package au.notzed.tilez.io;
-
-import jakarta.xml.bind.annotation.XmlAccessType;
-import jakarta.xml.bind.annotation.XmlAccessorType;
-import jakarta.xml.bind.annotation.XmlAttribute;
-import jakarta.xml.bind.annotation.XmlRootElement;
-import jakarta.xml.bind.annotation.XmlType;
-import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter;
-import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-
-/**
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
-    "properties",
-    "image"
-})
-@XmlRootElement(name = "object")
-public class Object {
-
-    @XmlAttribute(name = "name", required = true)
-    @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
-    protected String name;
-    @XmlAttribute(name = "type", required = true)
-    @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
-    protected String type;
-    @XmlAttribute(name = "x", required = true)
-    protected int x;
-    @XmlAttribute(name = "y", required = true)
-    protected int y;
-    @XmlAttribute(name = "width")
-    protected int width;
-    @XmlAttribute(name = "height")
-    protected int height;
-    protected Properties properties;
-    protected Image image;
-
-    /**
-     * Gets the value of the name property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Sets the value of the name property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setName(String value) {
-        this.name = value;
-    }
-
-    /**
-     * Gets the value of the type property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getType() {
-        return type;
-    }
-
-    /**
-     * Sets the value of the type property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setType(String value) {
-        this.type = value;
-    }
-
-    /**
-     * Gets the value of the x property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getX() {
-        return x;
-    }
-
-    /**
-     * Sets the value of the x property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setX(int value) {
-        this.x = value;
-    }
-
-    /**
-     * Gets the value of the y property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getY() {
-        return y;
-    }
-
-    /**
-     * Sets the value of the y property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setY(int value) {
-        this.y = value;
-    }
-
-    /**
-     * Gets the value of the width property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getWidth() {
-        return width;
-    }
-
-    /**
-     * Sets the value of the width property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setWidth(int value) {
-        this.width = value;
-    }
-
-    /**
-     * Gets the value of the height property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getHeight() {
-        return height;
-    }
-
-    /**
-     * Sets the value of the height property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setHeight(int value) {
-        this.height = value;
-    }
-
-    /**
-     * Gets the value of the properties property.
-     *
-     * @return
-     *     possible object is
-     *     {@link Properties }
-     *
-     */
-    public Properties getProperties() {
-        return properties;
-    }
-
-    /**
-     * Sets the value of the properties property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link Properties }
-     *
-     */
-    public void setProperties(Properties value) {
-        this.properties = value;
-    }
-
-    /**
-     * Gets the value of the image property.
-     *
-     * @return
-     *     possible object is
-     *     {@link Image }
-     *
-     */
-    public Image getImage() {
-        return image;
-    }
-
-    /**
-     * Sets the value of the image property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link Image }
-     *
-     */
-    public void setImage(Image value) {
-        this.image = value;
-    }
-
-}
diff --git a/src/duskz.editor/classes/au/notzed/tilez/io/ObjectFactory.java b/src/duskz.editor/classes/au/notzed/tilez/io/ObjectFactory.java
deleted file mode 100644 (file)
index a9ce8ef..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2013.02.27 at 01:07:39 PM CST
-//
-
-
-package au.notzed.tilez.io;
-
-import jakarta.xml.bind.annotation.XmlRegistry;
-
-
-/**
- * This object contains factory methods for each
- * Java content interface and Java element interface
- * generated in the generated package.
- * <p>An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups.  Factory methods for each of these are
- * provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
-
-    /**
-     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: generated
-     *
-     */
-    public ObjectFactory() {
-    }
-
-    /**
-     * Create an instance of {@link Tileset }
-     *
-     */
-    public Tileset createTileset() {
-        return new Tileset();
-    }
-
-    /**
-     * Create an instance of {@link Image }
-     *
-     */
-    public Image createImage() {
-        return new Image();
-    }
-
-    /**
-     * Create an instance of {@link Tile }
-     *
-     */
-    public Tile createTile() {
-        return new Tile();
-    }
-
-    /**
-     * Create an instance of {@link Properties }
-     *
-     */
-    public Properties createProperties() {
-        return new Properties();
-    }
-
-    /**
-     * Create an instance of {@link Objectgroup }
-     *
-     */
-    public Objectgroup createObjectgroup() {
-        return new Objectgroup();
-    }
-
-    /**
-     * Create an instance of {@link Object }
-     *
-     */
-    public Object createObject() {
-        return new Object();
-    }
-
-    /**
-     * Create an instance of {@link Data }
-     *
-     */
-    public Data createData() {
-        return new Data();
-    }
-
-    /**
-     * Create an instance of {@link Map }
-     *
-     */
-    public Map createMap() {
-        return new Map();
-    }
-
-    /**
-     * Create an instance of {@link Layer }
-     *
-     */
-    public Layer createLayer() {
-        return new Layer();
-    }
-
-    /**
-     * Create an instance of {@link Property }
-     *
-     */
-    public Property createProperty() {
-        return new Property();
-    }
-
-}
diff --git a/src/duskz.editor/classes/au/notzed/tilez/io/Objectgroup.java b/src/duskz.editor/classes/au/notzed/tilez/io/Objectgroup.java
deleted file mode 100644 (file)
index 452f77a..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2013.02.27 at 01:07:39 PM CST
-//
-
-
-package au.notzed.tilez.io;
-
-import jakarta.xml.bind.annotation.XmlAccessType;
-import jakarta.xml.bind.annotation.XmlAccessorType;
-import jakarta.xml.bind.annotation.XmlAttribute;
-import jakarta.xml.bind.annotation.XmlRootElement;
-import jakarta.xml.bind.annotation.XmlType;
-import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter;
-import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
-    "object"
-})
-@XmlRootElement(name = "objectgroup")
-public class Objectgroup {
-
-    @XmlAttribute(name = "name", required = true)
-    @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
-    protected String name;
-    @XmlAttribute(name = "width")
-    protected int width;
-    @XmlAttribute(name = "height")
-    protected int height;
-    @XmlAttribute(name = "x")
-    protected int x;
-    @XmlAttribute(name = "y")
-    protected int y;
-    protected List<Object> object;
-
-    /**
-     * Gets the value of the name property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Sets the value of the name property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setName(String value) {
-        this.name = value;
-    }
-
-    /**
-     * Gets the value of the width property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getWidth() {
-        return width;
-    }
-
-    /**
-     * Sets the value of the width property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setWidth(int value) {
-        this.width = value;
-    }
-
-    /**
-     * Gets the value of the height property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getHeight() {
-        return height;
-    }
-
-    /**
-     * Sets the value of the height property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setHeight(int value) {
-        this.height = value;
-    }
-
-    /**
-     * Gets the value of the x property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getX() {
-        return x;
-    }
-
-    /**
-     * Sets the value of the x property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setX(int value) {
-        this.x = value;
-    }
-
-    /**
-     * Gets the value of the y property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getY() {
-        return y;
-    }
-
-    /**
-     * Sets the value of the y property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setY(int value) {
-        this.y = value;
-    }
-
-    /**
-     * Gets the value of the object property.
-     *
-     * <p>
-     * This accessor method returns a reference to the live list,
-     * not a snapshot. Therefore any modification you make to the
-     * returned list will be present inside the JAXB object.
-     * This is why there is not a <CODE>set</CODE> method for the object property.
-     *
-     * <p>
-     * For example, to add a new item, do as follows:
-     * <pre>
-     *    getObject().add(newItem);
-     * </pre>
-     *
-     *
-     * <p>
-     * Objects of the following type(s) are allowed in the list
-     * {@link Object }
-     *
-     *
-     */
-    public List<Object> getObject() {
-        if (object == null) {
-            object = new ArrayList<Object>();
-        }
-        return this.object;
-    }
-
-}
diff --git a/src/duskz.editor/classes/au/notzed/tilez/io/Properties.java b/src/duskz.editor/classes/au/notzed/tilez/io/Properties.java
deleted file mode 100644 (file)
index e43733f..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2013.02.27 at 01:07:39 PM CST
-//
-
-
-package au.notzed.tilez.io;
-
-import jakarta.xml.bind.annotation.XmlAccessType;
-import jakarta.xml.bind.annotation.XmlAccessorType;
-import jakarta.xml.bind.annotation.XmlRootElement;
-import jakarta.xml.bind.annotation.XmlType;
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
-    "property"
-})
-@XmlRootElement(name = "properties")
-public class Properties {
-
-    protected List<Property> property;
-
-    /**
-     * Gets the value of the property property.
-     *
-     * <p>
-     * This accessor method returns a reference to the live list,
-     * not a snapshot. Therefore any modification you make to the
-     * returned list will be present inside the JAXB object.
-     * This is why there is not a <CODE>set</CODE> method for the property property.
-     *
-     * <p>
-     * For example, to add a new item, do as follows:
-     * <pre>
-     *    getProperty().add(newItem);
-     * </pre>
-     *
-     *
-     * <p>
-     * Objects of the following type(s) are allowed in the list
-     * {@link Property }
-     *
-     *
-     */
-    public List<Property> getProperty() {
-        if (property == null) {
-            property = new ArrayList<Property>();
-        }
-        return this.property;
-    }
-
-}
diff --git a/src/duskz.editor/classes/au/notzed/tilez/io/Property.java b/src/duskz.editor/classes/au/notzed/tilez/io/Property.java
deleted file mode 100644 (file)
index 752e583..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2013.02.27 at 01:07:39 PM CST
-//
-
-
-package au.notzed.tilez.io;
-
-import jakarta.xml.bind.annotation.XmlAccessType;
-import jakarta.xml.bind.annotation.XmlAccessorType;
-import jakarta.xml.bind.annotation.XmlAttribute;
-import jakarta.xml.bind.annotation.XmlRootElement;
-import jakarta.xml.bind.annotation.XmlType;
-import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter;
-import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-
-/**
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "")
-@XmlRootElement(name = "property")
-public class Property {
-
-    @XmlAttribute(name = "name", required = true)
-    @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
-    protected String name;
-    @XmlAttribute(name = "value", required = true)
-    @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
-    protected String value;
-
-    /**
-     * Gets the value of the name property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Sets the value of the name property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setName(String value) {
-        this.name = value;
-    }
-
-    /**
-     * Gets the value of the value property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getValue() {
-        return value;
-    }
-
-    /**
-     * Sets the value of the value property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setValue(String value) {
-        this.value = value;
-    }
-
-}
diff --git a/src/duskz.editor/classes/au/notzed/tilez/io/Tile.java b/src/duskz.editor/classes/au/notzed/tilez/io/Tile.java
deleted file mode 100644 (file)
index 151c6b3..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2013.02.27 at 01:07:39 PM CST
-//
-
-
-package au.notzed.tilez.io;
-
-import jakarta.xml.bind.annotation.XmlAccessType;
-import jakarta.xml.bind.annotation.XmlAccessorType;
-import jakarta.xml.bind.annotation.XmlAttribute;
-import jakarta.xml.bind.annotation.XmlRootElement;
-import jakarta.xml.bind.annotation.XmlType;
-
-/**
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
-    "properties",
-    "image"
-})
-@XmlRootElement(name = "tile")
-public class Tile {
-
-    @XmlAttribute(name = "id")
-    protected int id;
-    @XmlAttribute(name = "gid")
-    protected String gid;
-    protected Properties properties;
-    protected Image image;
-
-    /**
-     * Gets the value of the id property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getId() {
-        return id;
-    }
-
-    /**
-     * Sets the value of the id property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setId(int value) {
-        this.id = value;
-    }
-
-    /**
-     * Gets the value of the gid property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getGid() {
-        return gid;
-    }
-
-    /**
-     * Sets the value of the gid property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setGid(String value) {
-        this.gid = value;
-    }
-
-    /**
-     * Gets the value of the properties property.
-     *
-     * @return
-     *     possible object is
-     *     {@link Properties }
-     *
-     */
-    public Properties getProperties() {
-        return properties;
-    }
-
-    /**
-     * Sets the value of the properties property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link Properties }
-     *
-     */
-    public void setProperties(Properties value) {
-        this.properties = value;
-    }
-
-    /**
-     * Gets the value of the image property.
-     *
-     * @return
-     *     possible object is
-     *     {@link Image }
-     *
-     */
-    public Image getImage() {
-        return image;
-    }
-
-    /**
-     * Sets the value of the image property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link Image }
-     *
-     */
-    public void setImage(Image value) {
-        this.image = value;
-    }
-
-}
diff --git a/src/duskz.editor/classes/au/notzed/tilez/io/Tileset.java b/src/duskz.editor/classes/au/notzed/tilez/io/Tileset.java
deleted file mode 100644 (file)
index 6a5bf9e..0000000
+++ /dev/null
@@ -1,279 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2013.02.27 at 01:07:39 PM CST
-//
-
-
-package au.notzed.tilez.io;
-
-import jakarta.xml.bind.annotation.XmlAccessType;
-import jakarta.xml.bind.annotation.XmlAccessorType;
-import jakarta.xml.bind.annotation.XmlAttribute;
-import jakarta.xml.bind.annotation.XmlRootElement;
-import jakarta.xml.bind.annotation.XmlType;
-import jakarta.xml.bind.annotation.adapters.NormalizedStringAdapter;
-import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
-    "image",
-    "tile"
-})
-@XmlRootElement(name = "tileset")
-public class Tileset {
-
-    @XmlAttribute(name = "name")
-    @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
-    protected String name;
-    @XmlAttribute(name = "firstgid", required = true)
-    protected int firstgid;
-    @XmlAttribute(name = "source")
-    @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
-    protected String source;
-    @XmlAttribute(name = "tilewidth")
-    protected int tilewidth;
-    @XmlAttribute(name = "tileheight")
-    protected int tileheight;
-    @XmlAttribute(name = "spacing")
-    protected int spacing;
-    @XmlAttribute(name = "margin")
-    @XmlJavaTypeAdapter(NormalizedStringAdapter.class)
-    protected String margin;
-    protected List<Image> image;
-    protected List<Tile> tile;
-
-    /**
-     * Gets the value of the name property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Sets the value of the name property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setName(String value) {
-        this.name = value;
-    }
-
-    /**
-     * Gets the value of the firstgid property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getFirstgid() {
-        return firstgid;
-    }
-
-    /**
-     * Sets the value of the firstgid property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setFirstgid(int value) {
-        this.firstgid = value;
-    }
-
-    /**
-     * Gets the value of the source property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getSource() {
-        return source;
-    }
-
-    /**
-     * Sets the value of the source property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setSource(String value) {
-        this.source = value;
-    }
-
-    /**
-     * Gets the value of the tilewidth property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getTilewidth() {
-        return tilewidth;
-    }
-
-    /**
-     * Sets the value of the tilewidth property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setTilewidth(int value) {
-        this.tilewidth = value;
-    }
-
-    /**
-     * Gets the value of the tileheight property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getTileheight() {
-        return tileheight;
-    }
-
-    /**
-     * Sets the value of the tileheight property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setTileheight(int value) {
-        this.tileheight = value;
-    }
-
-    /**
-     * Gets the value of the spacing property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public int getSpacing() {
-        return spacing;
-    }
-
-    /**
-     * Sets the value of the spacing property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setSpacing(int value) {
-        this.spacing = value;
-    }
-
-    /**
-     * Gets the value of the margin property.
-     *
-     * @return
-     *     possible object is
-     *     {@link String }
-     *
-     */
-    public String getMargin() {
-        return margin;
-    }
-
-    /**
-     * Sets the value of the margin property.
-     *
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *
-     */
-    public void setMargin(String value) {
-        this.margin = value;
-    }
-
-    /**
-     * Gets the value of the image property.
-     *
-     * <p>
-     * This accessor method returns a reference to the live list,
-     * not a snapshot. Therefore any modification you make to the
-     * returned list will be present inside the JAXB object.
-     * This is why there is not a <CODE>set</CODE> method for the image property.
-     *
-     * <p>
-     * For example, to add a new item, do as follows:
-     * <pre>
-     *    getImage().add(newItem);
-     * </pre>
-     *
-     *
-     * <p>
-     * Objects of the following type(s) are allowed in the list
-     * {@link Image }
-     *
-     *
-     */
-    public List<Image> getImage() {
-        if (image == null) {
-            image = new ArrayList<Image>();
-        }
-        return this.image;
-    }
-
-    /**
-     * Gets the value of the tile property.
-     *
-     * <p>
-     * This accessor method returns a reference to the live list,
-     * not a snapshot. Therefore any modification you make to the
-     * returned list will be present inside the JAXB object.
-     * This is why there is not a <CODE>set</CODE> method for the tile property.
-     *
-     * <p>
-     * For example, to add a new item, do as follows:
-     * <pre>
-     *    getTile().add(newItem);
-     * </pre>
-     *
-     *
-     * <p>
-     * Objects of the following type(s) are allowed in the list
-     * {@link Tile }
-     *
-     *
-     */
-    public List<Tile> getTile() {
-        if (tile == null) {
-            tile = new ArrayList<Tile>();
-        }
-        return this.tile;
-    }
-
-}
index 0e15b35..f595112 100644 (file)
@@ -209,7 +209,7 @@ public class TileMap implements Iterable<TileMap.MapData> {
                        System.out.printf(" size: %dx%d\n", cols, rows);
                        System.out.printf(" groundLayer: %d\n", groundLayer);
                        System.out.printf(" layerCount: %d\n", layerCount);
-                       
+
                        map = new TileMap(path.getName(), cols, rows);
 
                        map.groundLayer = groundLayer;
index e3e8af1..698dd95 100644 (file)
@@ -21,6 +21,8 @@
 // fixme copyrihgts
 package duskz.server.entityz;
 
+import duskz.map.Location;
+import duskz.map.TileMap;
 import duskz.protocol.DuskMessage;
 import duskz.protocol.Wearing;
 import java.io.BufferedWriter;
@@ -349,7 +351,7 @@ public abstract class Active extends Thing {
        public void addStat(int key, int value) {
                setStat(key, stats[key] + value);
        }
-       
+
        public int getBonus(int key) {
                return bonus[key];
        }
@@ -727,7 +729,7 @@ public abstract class Active extends Thing {
        public void localisedChat(String msg) {
                //log.printMessage(Log.ALWAYS, inMessage);
 
-               for (TileMap.MapData md : map.range(x, y, game.viewRange)) {
+               for (TileMap<Thing>.MapData md : map.range(x, y, game.viewRange)) {
                        for (Thing o : md.entities) {
                                if (o.getType() == Thing.TYPE_PLAYER) {
                                        Player p = (Player) o;
@@ -926,7 +928,7 @@ public abstract class Active extends Thing {
                }
 
                // search by name
-               for (TileMap.MapData md : map.range(x, y, game.viewRange)) {
+               for (TileMap<Thing>.MapData md : map.range(x, y, game.viewRange)) {
                        for (Thing t : md.entities) {
                                if (t.name.equalsIgnoreCase(name)) {
                                        boolean see = true;
@@ -1413,9 +1415,9 @@ public abstract class Active extends Thing {
        /* *
         * So all this 'get the player object to implemeent the commands' seemed
         * like a good idea, but the code will bloat.
-        * 
+        *
         * having it reusable is useful for scripts though.
-        * 
+        *
         * Perhaps it shoudl be put into antoher class for reusability stake.
         */
        public void fleeCommand() {
index e367e40..be013a9 100644 (file)
@@ -20,6 +20,7 @@
  */
 package duskz.server.entityz;
 
+import duskz.map.TileMap;
 import duskz.protocol.Wearing;
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
@@ -218,7 +219,7 @@ public class Converter {
                        case "givegp":
                                dst.add("givegold", in.readLine());
                                break;
-                       // nice: mob format is different ... 
+                       // nice: mob format is different ...
                        case "wield":
                        case "arms":
                        case "legs":
@@ -505,7 +506,7 @@ public class Converter {
                        out.append("=");
                        out.append(item.name);
                        out.append('\n');
-                       
+
                        item.writeProperties(out);
 
                        out.append("=end");
index e00a56c..34dbcef 100644 (file)
@@ -29,6 +29,7 @@
  */
 package duskz.server.entityz;
 
+import duskz.map.TileMap;
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
@@ -141,7 +142,7 @@ public class Faction {
                Active enemy = null;
                double enemyrelation = 0;
                boolean visiblePlayer = false;
-               for (TileMap.MapData md : mob.map.range(mob.x, mob.y, game.viewRange - 1)) {
+               for (TileMap<Thing>.MapData md : mob.map.range(mob.x, mob.y, game.viewRange - 1)) {
                        for (Thing o : md.entities) {
                                if (o.getType() == Thing.TYPE_MOBILE || o.getType() == Thing.TYPE_PLAYER) {
                                        Active lt = (Active) o;
index d7860aa..cef2ab3 100644 (file)
@@ -20,6 +20,9 @@
  */
 package duskz.server.entityz;
 
+import duskz.map.Location;
+import duskz.map.TileMap;
+import duskz.util.PropertyLoader;
 import duskz.server.BlockedIPException;
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
@@ -112,7 +115,7 @@ public class Game {
        // All actives in game
        HashMap<Long, Active> actives = new HashMap<>();
        //
-       private final HashMap<String, TileMap> maps = new HashMap<>();
+       private final HashMap<String, TileMap<Thing>> maps = new HashMap<>();
        //
        private ArrayList<Battle> battles = new ArrayList<>();
 
@@ -275,7 +278,7 @@ public class Game {
 
                scriptManager.start();
 
-               // We're ready, time for 'onstart' script               
+               // We're ready, time for 'onstart' script
                runScript(confDir, "onStart", "game", this);
        }
 
@@ -301,7 +304,7 @@ public class Game {
                props.saveState(this);
        }
 
-       public TileMap getMap(String name) {
+       public TileMap<Thing> getMap(String name) {
                return maps.get(name);
        }
 
index 1176024..25b3101 100644 (file)
@@ -20,6 +20,7 @@
  */
 package duskz.server.entityz;
 
+import duskz.map.TileMap;
 import duskz.protocol.DuskMessage;
 import java.io.BufferedWriter;
 import java.io.IOException;
@@ -52,7 +53,7 @@ public class Mobile extends Active {
                super(game);
        }
 
-       // onBattle script      
+       // onBattle script
        @Override
        public int getType() {
                return TYPE_MOBILE;
@@ -291,7 +292,7 @@ public class Mobile extends Active {
 
                boolean seePlayer = false;
 
-               for (TileMap.MapData md : map.range(x, y, game.viewRange)) {
+               for (TileMap<Thing>.MapData md : map.range(x, y, game.viewRange)) {
                        if (!md.entities.isEmpty() && canSee(md.x, md.y)) {
                                for (Thing thing : md.entities) {
                                        if (thing instanceof Player)
index 0184bf5..3551614 100644 (file)
@@ -19,6 +19,9 @@
  */
 package duskz.server.entityz;
 
+import duskz.map.Location;
+import duskz.map.TileMap;
+
 /**
  * This is a wrapper for the player object, which is passed to scripts.
  *
@@ -67,7 +70,7 @@ public class PlayerCommands {
        public int getInt(String name) {
                return p.variables.getInteger(name, 0);
        }
-       
+
        /**
         * Jump to a location
         * @param mapName
@@ -76,11 +79,11 @@ public class PlayerCommands {
         */
        public boolean jumpTo(String mapName, String mapAlias) {
                System.out.println("script: jumpto(" + mapName + ", " + mapAlias + ")");
-               TileMap map = game.getMap(mapName);
-               
+               TileMap<Thing> map = game.getMap(mapName);
+
                if (map != null) {
                        Location l = map.locationForAlias(mapAlias);
-                       
+
                        if (l != null) {
                                return p.jumpTo(map, l.x, l.y);
                        }
index ed0e04e..f410cfe 100644 (file)
@@ -20,6 +20,7 @@
  */
 package duskz.server.entityz;
 
+import duskz.map.TileMap;
 import duskz.protocol.DuskMessage;
 import duskz.protocol.DuskProtocol;
 import static duskz.protocol.DuskProtocol.FIELD_ENTITY_FLAGS;
@@ -81,7 +82,7 @@ public class PlayerState implements DuskProtocol {
        /**
         * Last updated location
         */
-       TileMap map;
+       TileMap<Thing> map;
        int x;
        int y;
        /**
@@ -225,7 +226,7 @@ public class PlayerState implements DuskProtocol {
 
                // FIXME: I think this is missing something here, i.e. some sort of object visibility check
 
-               for (TileMap.MapData md : map.range(x, y, player.game.viewRange)) {
+               for (TileMap<Thing>.MapData md : map.range(x, y, player.game.viewRange)) {
                        if (!md.entities.isEmpty() && player.canSee(md.x, md.y)) {
                                for (Thing thing : md.entities) {
                                        VisibleThing here = left.remove(thing.ID);
index e4984ef..83c2368 100644 (file)
@@ -20,6 +20,7 @@
  */
 package duskz.server.entityz;
 
+import duskz.util.PropertyLoader;
 import static duskz.server.entityz.Active.STAT_CON;
 import static duskz.server.entityz.Active.STAT_DEX;
 import static duskz.server.entityz.Active.STAT_HP;
@@ -29,7 +30,7 @@ import static duskz.server.entityz.Active.STAT_MP;
 import static duskz.server.entityz.Active.STAT_MPMAX;
 import static duskz.server.entityz.Active.STAT_STR;
 import static duskz.server.entityz.Active.STAT_WIS;
-import duskz.server.entityz.PropertyLoader.PropertyEntry;
+import duskz.util.PropertyLoader.PropertyEntry;
 import java.io.File;
 import java.io.IOException;
 
index 0a891af..ab1d63c 100644 (file)
  */
 package duskz.server.entityz;
 
+import duskz.map.Locatable;
+import duskz.map.TileMap;
+import duskz.util.PropertyLoader;
 import duskz.protocol.DuskMessage;
 import duskz.protocol.EntityUpdateMessage;
-import duskz.server.entityz.PropertyLoader.PropertyEntry;
+import duskz.util.PropertyLoader.PropertyEntry;
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
@@ -39,7 +42,7 @@ import java.util.Comparator;
  *
  * @author Michael Zucchi <notzed@gmail.com>
  */
-public abstract class Thing implements Cloneable {
+public abstract class Thing implements Cloneable, Locatable {
 
        /**
         * Every non-abstract sub-class of thing needs a unique
@@ -85,7 +88,7 @@ public abstract class Thing implements Cloneable {
         * /**
         * Map object belongs to
         */
-       public TileMap map;
+       public TileMap<Thing> map;
        /**
         * Location on map
         */
@@ -115,7 +118,7 @@ public abstract class Thing implements Cloneable {
        }
 
        /*
-        * 
+        *
         */
        @Override
        public boolean equals(Object obj) {
@@ -132,6 +135,26 @@ public abstract class Thing implements Cloneable {
                return hash;
        }
 
+       @Override
+       public int getX() {
+               return x;
+       }
+
+       @Override
+       public int getY() {
+               return y;
+       }
+
+       @Override
+       public void setX(int x) {
+               this.x = x;
+       }
+
+       @Override
+       public void setY(int y) {
+               this.y = y;
+       }
+
        public int getImage() {
                return image;
        }
@@ -192,13 +215,13 @@ public abstract class Thing implements Cloneable {
                                this.map = game.getMap(value);
                                break;
                        case "x":
-                               this.x = Integer.valueOf(value);
+                               this.x = Integer.parseInt(value);
                                break;
                        case "y":
-                               this.y = Integer.valueOf(value);
+                               this.y = Integer.parseInt(value);
                                break;
                        case "image":
-                               this.image = Integer.valueOf(value);
+                               this.image = Integer.parseInt(value);
                                break;
                        default:
                                //System.out.println("unknown property: " + name + " on class " + getClass().getSimpleName());
index 8eeade9..979f666 100644 (file)
@@ -23,5 +23,4 @@ module duskz.server {
        requires java.desktop;
        requires java.logging;
 
-       requires jakarta.xml.bind;
 }
@@ -15,7 +15,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-package au.notzed.tilez;
+package duskz.editor;
 
 import java.io.File;
 import java.io.IOException;
@@ -15,9 +15,9 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-package au.notzed.tilez;
+package duskz.editor;
 
-import duskz.server.entityz.TileMap;
+import duskz.map.TileMap;
 import java.io.IOException;
 import java.nio.charset.Charset;
 import java.nio.file.Files;
@@ -15,7 +15,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-package au.notzed.tilez;
+package duskz.editor;
 
 import javafx.geometry.Orientation;
 import javafx.scene.control.ListView;
@@ -15,7 +15,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-package au.notzed.tilez;
+package duskz.editor;
 
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadPoolExecutor;
@@ -15,7 +15,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-package au.notzed.tilez;
+package duskz.editor;
 
 import java.io.IOException;
 import java.nio.charset.Charset;
@@ -15,7 +15,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-package au.notzed.tilez;
+package duskz.editor;
 
 import javafx.scene.layout.FlowPane;
 
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-package au.notzed.tilez;
+package duskz.editor;
 
 import duskz.client.fx.DataManagerFX;
+import duskz.tool.fx.MapSelectionModel;
+import duskz.tool.fx.MapView;
 import java.io.IOException;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -68,9 +70,9 @@ public class TileZ extends Application {
                        data.open();
                        mapView.loadMap(data, mappath);
 
-                       locationEditor.setMap(mapView.map);
+                       locationEditor.setMap(mapView.getMap());
 
-                       mapView.selectionModel.boundsProperty.addListener(new ChangeListener<MapSelectionModel.Bounds>() {
+                       mapView.getSelectionModel().boundsProperty().addListener(new ChangeListener<MapSelectionModel.Bounds>() {
                                @Override
                                public void changed(ObservableValue<? extends MapSelectionModel.Bounds> ov, MapSelectionModel.Bounds t, MapSelectionModel.Bounds t1) {
                                        if (t1 != null) {
@@ -17,7 +17,7 @@
  * along with DuskZ; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
-package duskz.io;
+package duskz.tool;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -15,7 +15,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-package au.notzed.tilez;
+package duskz.tool.fx;
 
 import javafx.beans.property.ObjectProperty;
 import javafx.beans.property.SimpleObjectProperty;
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-package au.notzed.tilez;
+package duskz.tool.fx;
 
 import duskz.client.fx.DataManagerFX;
-import duskz.server.entityz.TileMap;
+import duskz.map.TileMap;
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
-import java.util.concurrent.Future;
+import java.util.Map.Entry;
+import javafx.animation.Animation;
 import javafx.application.Platform;
 import javafx.beans.value.ChangeListener;
 import javafx.beans.value.ObservableValue;
@@ -33,6 +36,7 @@ import javafx.geometry.Orientation;
 import javafx.scene.Node;
 import javafx.scene.control.ScrollBar;
 import javafx.scene.image.ImageView;
+import javafx.scene.input.MouseButton;
 import javafx.scene.input.MouseEvent;
 import javafx.scene.layout.BorderPane;
 import javafx.scene.layout.Pane;
@@ -41,6 +45,7 @@ import javafx.scene.layout.StackPane;
 import javafx.scene.paint.Color;
 import javafx.scene.shape.Rectangle;
 import javafx.scene.text.Text;
+import javafx.util.Duration;
 
 /**
  *
@@ -53,7 +58,7 @@ public class MapView extends Region implements ChangeListener<Number> {
        DataManagerFX data;
        // TODO: tilesize on DataManagerFX
        int tileSize = 32;
-       double scale = 1;
+       double scale = 0.5;
        Pane graphics;
        Pane alias;
        StackPane stack;
@@ -63,7 +68,6 @@ public class MapView extends Region implements ChangeListener<Number> {
        MapSelectionModel selectionModel = new MapSelectionModel();
 
        public MapView() {
-
                graphics = new Pane();
                graphics.setManaged(false);
                graphics.setScaleX(scale);
@@ -99,8 +103,42 @@ public class MapView extends Region implements ChangeListener<Number> {
                });
 
                stack.addEventHandler(MouseEvent.ANY, new EventHandler<MouseEvent>() {
+                       double startx, starty;
+                       double hstart, vstart;
+                       boolean inpan = false;
+
                        public void handle(MouseEvent t) {
-                               if (t.getEventType() == MouseEvent.MOUSE_CLICKED) {
+
+                               if (t.getEventType() == MouseEvent.MOUSE_PRESSED) {
+                                       if (t.getButton() == MouseButton.SECONDARY) {
+                                               startx = t.getX();
+                                               starty = t.getY();
+                                               hstart = hbar.getValue();
+                                               vstart = vbar.getValue();
+                                               inpan = true;
+                                               t.consume();
+                                       }
+                               } else if (t.getEventType() == MouseEvent.MOUSE_DRAGGED) {
+                                       //if (t.getButton() == MouseButton.MIDDLE) {
+                                       if (inpan) {
+                                               double dx = t.getX() - startx;
+                                               double dy = t.getY() - starty;
+
+                                               // oh that's right, fx scrollbars are kind of fucked up, they don't reflect the range
+                                               // the same way as every other toolkit in existance, ho hum.
+                                               double fixh = (hbar.getMax() + hbar.getVisibleAmount()) / hbar.getMax();
+                                               double fixv = (vbar.getMax() + vbar.getVisibleAmount()) / vbar.getMax();
+                                               hbar.setValue(hstart - dx * fixh);
+                                               vbar.setValue(vstart - dy * fixv);
+                                               t.consume();
+                                       }
+                                       //}
+                               } else if (t.getEventType() == MouseEvent.MOUSE_RELEASED) {
+                                       if (inpan) {
+                                               inpan = false;
+                                               t.consume();
+                                       }
+                               } else if (t.getEventType() == MouseEvent.MOUSE_CLICKED) {
                                        int tx = (int) ((getOriginX() + t.getX()) / tileSize / scale);
                                        int ty = (int) ((getOriginY() + t.getY()) / tileSize / scale);
 
@@ -116,6 +154,7 @@ public class MapView extends Region implements ChangeListener<Number> {
        }
        double oldw, oldh;
        int vcols, vrows;
+       HashMap<Integer, TileAnimator> animators = new HashMap<>();
 
        @Override
        protected void layoutChildren() {
@@ -172,13 +211,24 @@ public class MapView extends Region implements ChangeListener<Number> {
                System.out.println("trnaslate changed");
        }
 
-       void loadMap(DataManagerFX data, String path) throws IOException {
+       public void loadMap(DataManagerFX data, String name) throws IOException {
                this.data = data;
-               map = TileMap.loadLayered(new File(path));
+
+               try (InputStream is = data.getInputStream("maps/" + name)) {
+                       map = TileMap.loadLayeredMap(is, name);
+               }
                updateMap();
                requestLayout();
        }
 
+       public MapSelectionModel getSelectionModel() {
+               return selectionModel;
+       }
+
+       public TileMap getMap() {
+               return map;
+       }
+
        @Override
        protected double computePrefHeight(double d) {
                //if (map == null)
@@ -210,11 +260,11 @@ public class MapView extends Region implements ChangeListener<Number> {
                return v;
        }
 
-       int getTileX() {
+       public int getTileX() {
                return (int) (getOriginX() / tileSize / scale);
        }
 
-       int getTileY() {
+       public int getTileY() {
                return (int) (getOriginY() / tileSize / scale);
        }
 
@@ -248,6 +298,8 @@ public class MapView extends Region implements ChangeListener<Number> {
                oldvcols = vcols;
                oldvrows = vrows;
 
+               final HashMap<Integer, List<ImageView>> animated = new HashMap<>();
+
                for (int l = 0; l < map.getLayerCount(); l++) {
                        for (int y = 0; y < vrows; y++) {
                                int ty = y + y0;
@@ -258,6 +310,17 @@ public class MapView extends Region implements ChangeListener<Number> {
                                        int tileid = map.getTile(l, tx, ty);
                                        if (tileid != 0) {
                                                data.updateTile(iv, tileid, tileSize, tileSize);
+
+                                               // FIXME: put in some animation controller code
+                                               if (data.isAnimRoot(tileid)) {
+                                                       List<ImageView> list = animated.get(tileid);
+                                                       if (list == null) {
+                                                               list = new ArrayList<>();
+                                                               animated.put(tileid, list);
+                                                       }
+                                                       list.add(iv);
+                                               }
+
                                                iv.setVisible(true);
                                        } else {
                                                iv.setVisible(false);
@@ -270,7 +333,7 @@ public class MapView extends Region implements ChangeListener<Number> {
                // Check for meta data on map region
                List<Node> nodes = new ArrayList<Node>();
 
-               boolean overlayOld = true;
+               boolean overlayOld = false;
 
                // HACK: check for old map shit
                if (overlayOld) {
@@ -341,21 +404,38 @@ public class MapView extends Region implements ChangeListener<Number> {
 
                alias.getChildren().setAll(nodes);
 
+               // Load animation stuff
+               for (Entry<Integer, List<ImageView>> e : animated.entrySet()) {
+                       int root = e.getKey();
+                       TileAnimator animator = animators.get(root);
+                       DataManagerFX.AnimSetFX set = data.getAnimSet(root);
+                       if (animator == null) {
+                               animator = new TileAnimator(e.getValue(), Duration.millis(set.rate * set.tiles.length), set.tiles);
+                               animators.put(root, animator);
+                               animator.setCycleCount(Animation.INDEFINITE);
+                               animator.play();
+                               System.out.println("create animator for " + root);
+                       } else {
+                               animator.setNodes(e.getValue());
+                               System.out.println("update animator for " + root);
+                       }
+               }
        }
-       Future f;
+       /*
+        Future f;
 
-       void updateThread() {
-               int y0 = (int) (vbar.getValue() / tileSize / scale);
-               int x0 = (int) (hbar.getValue() / tileSize / scale);
+        void updateThread() {
+        int y0 = (int) (vbar.getValue() / tileSize / scale);
+        int x0 = (int) (hbar.getValue() / tileSize / scale);
 
-               if (f != null) {
-                       if (f.cancel(false)) {
-                               System.out.println("pending cancelled");
-                       }
-               }
+        if (f != null) {
+        if (f.cancel(false)) {
+        System.out.println("pending cancelled");
+        }
+        }
 
-               f = TZ.single.submit(new Update(x0, y0, 1, vcols, vrows));
-       }
+        f = TZ.single.submit(new Update(x0, y0, 1, vcols, vrows));
+        }*/
 
        class Update implements Runnable {
 
diff --git a/src/duskz.tools/classes/duskz/tool/fx/TileAnimator.java b/src/duskz.tools/classes/duskz/tool/fx/TileAnimator.java
new file mode 100644 (file)
index 0000000..a3db00e
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * This file is part of DuskZ, a graphical mud engine.
+ *
+ * Copyright (C) 2013 Michael Zucchi <notzed@gmail.com>
+ *
+ * DuskZ is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * DuskZ is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with DuskZ.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package duskz.tool.fx;
+
+import java.util.List;
+import javafx.animation.Transition;
+import javafx.geometry.Rectangle2D;
+import javafx.scene.image.ImageView;
+import javafx.util.Duration;
+
+/**
+ * Animates a set of tiles by switching the viewport on the texture.
+ *
+ * @author Michael Zucchi <notzed@gmail.com>
+ */
+public class TileAnimator extends Transition {
+
+       Rectangle2D[] viewports;
+       List<ImageView> nodes;
+
+       public TileAnimator(List<ImageView> nodes, Duration duration, Rectangle2D[] images) {
+               setCycleDuration(duration);
+               this.viewports = images;
+               this.nodes = nodes;
+       }
+
+       public void setNodes(List<ImageView> nodes) {
+               this.nodes = nodes;
+
+               // Track the current time properly
+               double d = getCurrentTime().toMillis() /getCycleDuration().toMillis();
+               
+               interpolate(d);
+       }
+
+       @Override
+       protected void interpolate(double d) {
+               int index = Math.min(viewports.length - 1, (int) (d * viewports.length));
+
+               for (ImageView node : nodes)
+                       node.setViewport(viewports[index]);
+       }
+}
diff --git a/src/duskz.tools/classes/duskz/viewer/MapViewer.java b/src/duskz.tools/classes/duskz/viewer/MapViewer.java
new file mode 100644 (file)
index 0000000..6de2844
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package duskz.viewer;
+
+import duskz.tool.fx.MapView;
+import duskz.client.fx.DataManagerFX;
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javafx.application.Application;
+import javafx.scene.Scene;
+import javafx.scene.layout.BorderPane;
+import javafx.stage.Stage;
+
+/**
+ *
+ * @author Michael Zucchi <notzed@gmail.com>
+ */
+public class MapViewer extends Application {
+
+       MapView mapView;
+       DataManagerFX data;
+       static final String tag = "mapviewer";
+
+       @Override
+       public void start(Stage stage) {
+                               BorderPane root = new BorderPane();
+
+                                               root.setCenter(mapView = new MapView());
+
+               Scene scene = new Scene(root, 768, 512);
+
+               stage.setTitle("TileZ");
+               stage.setScene(scene);
+               stage.show();
+
+               String datapath = "/home/notzed/house.jar";
+               String mappath = "main";
+
+               try {
+                       data = new DataManagerFX(datapath);
+                       data.open();
+                       mapView.loadMap(data, mappath);
+
+               //      locationEditor.setMap(mapView.map);
+
+                       /*
+                       mapView.selectionModel.boundsProperty.addListener(new ChangeListener<MapSelectionModel.Bounds>() {
+                               @Override
+                               public void changed(ObservableValue<? extends MapSelectionModel.Bounds> ov, MapSelectionModel.Bounds t, MapSelectionModel.Bounds t1) {
+                                       if (t1 != null) {
+                                               locationEditor.setTileX(t1.left);
+                                               locationEditor.setTileY(t1.top);
+                                               oldInfo.setLocation(t1.left, t1.top);
+                                       } else {
+                                               locationEditor.setTileX(-1);
+                                               locationEditor.setTileY(-1);
+                                       }
+                               }
+                       });*/
+               } catch (IOException ex) {
+                       Logger.getLogger(tag).log(Level.SEVERE, null, ex);
+               }
+       }
+
+       /**
+        * The main() method is ignored in correctly deployed JavaFX
+        * application. main() serves only as fallback in case the
+        * application can not be launched through deployment artifacts,
+        * e.g., in IDEs with limited FX support. NetBeans ignores main().
+        *
+        * @param args the command line arguments
+        */
+       public static void main(String[] args) {
+               launch(args);
+       }
+}
 /**
  * Changes
  */
-package duskz.io;
-
-import duskz.server.entity.TileMap;
-import duskz.io.tiled.Data;
-import duskz.io.tiled.Image;
-import duskz.io.tiled.Layer;
-import duskz.io.tiled.Map;
-import duskz.io.tiled.Property;
-import duskz.io.tiled.Tile;
-import duskz.io.tiled.Tileset;
+package duskz.viewer;
+
 import jakarta.xml.bind.JAXBContext;
 import jakarta.xml.bind.JAXBException;
-import jakarta.xml.bind.Marshaller;
 import jakarta.xml.bind.Unmarshaller;
 import java.awt.Graphics2D;
 import java.awt.image.BufferedImage;
@@ -51,6 +42,8 @@ import java.nio.ByteOrder;
 import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
 import java.util.jar.Attributes;
 import java.util.jar.JarEntry;
@@ -63,14 +56,19 @@ import java.util.zip.GZIPOutputStream;
 import javax.imageio.ImageIO;
 import javax.imageio.stream.ImageInputStream;
 import javax.imageio.stream.MemoryCacheImageInputStream;
+import duskz.map.io.*;
+import java.util.Map.Entry;
+
 /**
  * Tiled loader/converter. This is only experimental at this stage.
  *
+ * @author notzed
  */
 public class Tiled {
 
        static byte[] map64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".getBytes(Charset.forName("US-ASCII"));
        static byte[] unmap64 = new byte[256];
+       public static final int MAGIC_LAYERED = 0x6d61707a;
 
        static {
                for (int i = 0; i < 256; i++)
@@ -197,106 +195,107 @@ public class Tiled {
                return ImageIO.read(is);
        }
 
-       static void testexport() throws IOException {
-               File path = new File("/home/notzed/src/DuskRPG/DuskFiles/Dusk2.7.3/shortmap");
+       /*
+        static void testexport() throws IOException {
+        File path = new File("/home/notzed/src/DuskRPG/DuskFiles/Dusk2.7.3/shortmap");
 
-               TileMap map = TileMap.loadMap(path, TileMap.FORMAT_SHORT);
-               int width = map.getCols();
-               int height = map.getRows();
-               int len = width * height;
+        TileMap map = TileMap.loadMap(path, TileMap.FORMAT_SHORT);
+        int width = map.getCols();
+        int height = map.getRows();
+        int len = width * height;
 
 
-               System.out.println("Map size: " + width + "," + height);
+        System.out.println("Map size: " + width + "," + height);
 
-               duskz.io.tiled.Map tmap = new duskz.io.tiled.Map();
+        duskz.io.tiled.Map tmap = new duskz.io.tiled.Map();
 
-               tmap.setWidth(width);
-               tmap.setHeight(height);
-               tmap.setOrientation("orthogonal");
-               tmap.setVersion("1.0");
-               tmap.setTilewidth(32);
-               tmap.setTileheight(32);
+        tmap.setWidth(width);
+        tmap.setHeight(height);
+        tmap.setOrientation("orthogonal");
+        tmap.setVersion("1.0");
+        tmap.setTilewidth(32);
+        tmap.setTileheight(32);
 
-               Tileset tset = new Tileset();
-               tmap.getTileset().add(tset);
+        Tileset tset = new Tileset();
+        tmap.getTileset().add(tset);
 
-               tset.setTileheight(32);
-               tset.setTilewidth(32);
-               tset.setFirstgid(0);
-               tset.setName("dusk-map");
+        tset.setTileheight(32);
+        tset.setTilewidth(32);
+        tset.setFirstgid(0);
+        tset.setName("dusk-map");
 
-               // Add tile set
-               BufferedImage tiles = ImageIO.read(new File("/home/notzed/src/DuskRPG/DuskFiles/Dusk2.7.3/www/rc/somedusk/images/map.png"));
-               int tileWidth = 32;
-               int tileHeight = 32;
-               int imageWidth = tiles.getWidth();
-               for (int x = 0; x * tileWidth < imageWidth; x++) {
-                       BufferedImage tile = tiles.getSubimage(x * tileWidth, 0, tileWidth, tileHeight);
+        // Add tile set
+        BufferedImage tiles = ImageIO.read(new File("/home/notzed/src/DuskRPG/DuskFiles/Dusk2.7.3/www/rc/somedusk/images/map.png"));
+        int tileWidth = 32;
+        int tileHeight = 32;
+        int imageWidth = tiles.getWidth();
+        for (int x = 0; x * tileWidth < imageWidth; x++) {
+        BufferedImage tile = tiles.getSubimage(x * tileWidth, 0, tileWidth, tileHeight);
 
-                       Image timage = new Image();
-                       Data idata = new Data();
+        Image timage = new Image();
+        Data idata = new Data();
 
-                       idata.setEncoding("base64");
-                       idata.setvalue(encodeImage(tile));
-                       timage.setData(idata);
-                       timage.setFormat("png");
+        idata.setEncoding("base64");
+        idata.setvalue(encodeImage(tile));
+        timage.setData(idata);
+        timage.setFormat("png");
 
-                       Tile ttile = new Tile();
-                       ttile.setId(x);
-                       ttile.setImage(timage);
+        Tile ttile = new Tile();
+        ttile.setId(x);
+        ttile.setImage(timage);
 
-                       tset.getTile().add(ttile);
-               }
+        tset.getTile().add(ttile);
+        }
 
-               // Add layer
-               Layer layer = new Layer();
+        // Add layer
+        Layer layer = new Layer();
 
-               tmap.getLayerOrObjectgroup().add(layer);
+        tmap.getLayerOrObjectgroup().add(layer);
 
-               layer.setName("base");
-               layer.setVisible(1);
-               layer.setOpacity(1);
-               layer.setWidth(map.getCols());
-               layer.setHeight(map.getRows());
+        layer.setName("base");
+        layer.setVisible(1);
+        layer.setOpacity(1);
+        layer.setWidth(map.getCols());
+        layer.setHeight(map.getRows());
 
-               Data d = new Data();
+        Data d = new Data();
 
-               layer.setData(d);
+        layer.setData(d);
 
-               d.setCompression("gzip");
-               d.setEncoding("base64");
+        d.setCompression("gzip");
+        d.setEncoding("base64");
 
-               // First convert to ints
-               ByteBuffer bb = ByteBuffer.allocate(len * 4).order(ByteOrder.LITTLE_ENDIAN);
+        // First convert to ints
+        ByteBuffer bb = ByteBuffer.allocate(len * 4).order(ByteOrder.LITTLE_ENDIAN);
 
-               for (int y = 0; y < height; y++) {
-                       for (int x = 0; x < width; x++) {
-                               bb.putInt(map.getTile(x, y));
-                       }
-               }
-               bb.rewind();
-
-               d.setvalue(encodeArray(bb.array()));
-               //d.setvalue("dummy");
-               try {
-                       JAXBContext jc = JAXBContext.newInstance(Map.class);
-                       //Unmarshaller u = jc.createUnmarshaller();
-                       //Object element = u.unmarshal(new File("foo.xml"));
-                       Marshaller m = jc.createMarshaller();
+        for (int y = 0; y < height; y++) {
+        for (int x = 0; x < width; x++) {
+        bb.putInt(map.getTile(x, y));
+        }
+        }
+        bb.rewind();
 
-                       m.setProperty("jaxb.formatted.output", true);
+        d.setvalue(encodeArray(bb.array()));
+        //d.setvalue("dummy");
 
+        try {
+        JAXBContext jc = JAXBContext.newInstance(Map.class);
+        //Unmarshaller u = jc.createUnmarshaller();
+        //Object element = u.unmarshal(new File("foo.xml"));
+        Marshaller m = jc.createMarshaller();
 
-                       m.marshal(tmap, new File("/home/notzed/tiled-test.tmx"));
+        m.setProperty("jaxb.formatted.output", true);
 
-               } catch (JAXBException ex) {
-                       Logger.getLogger(Tiled.class.getName()).log(Level.SEVERE, null, ex);
-               }
 
-               System.out.println("done");
+        m.marshal(tmap, new File("/home/notzed/tiled-test.tmx"));
 
-       }
+        } catch (JAXBException ex) {
+        Logger.getLogger(Tiled.class.getName()).log(Level.SEVERE, null, ex);
+        }
+        System.out.println("done");
 
+        }
+        */
        static class TileInfo {
 
                int id;
@@ -304,6 +303,26 @@ public class Tiled {
                String move;
                String see;
                String action;
+               // animation meta-data
+               List<String> anim = new ArrayList<>();
+       }
+
+       static class AnimGroup {
+
+               String name;
+               int rate = 250;
+               HashMap<String, List<AnimInfo>> sets = new HashMap<>();
+       }
+
+       static class AnimInfo implements Comparable<AnimInfo> {
+
+               int tileid;
+               int seq;
+
+               @Override
+               public int compareTo(AnimInfo t) {
+                       return Integer.compare(seq, t.seq);
+               }
        }
 
        static void testimport(File src, File dst) throws IOException {
@@ -372,6 +391,9 @@ public class Tiled {
                                                                                case "action":
                                                                                        ti.action = p.getValue();
                                                                                        break;
+                                                                               case "anim":
+                                                                                       ti.anim.add(p.getValue());
+                                                                                       break;
                                                                        }
                                                                }
                                                        }
@@ -397,44 +419,141 @@ public class Tiled {
                                        jos.closeEntry();
                                }
                        }
+                       {
+                               int tileWidth = tmap.getTilewidth();
+                               int tileHeight = tmap.getTileheight();
+
+                               for (java.lang.Object o : tmap.getLayerOrObjectgroup()) {
+                                       if (o instanceof Objectgroup) {
+                                               Objectgroup og = (Objectgroup) o;
+                                               for (duskz.map.io.Object oo : og.getObject()) {
+                                                       int ox = oo.getX() / tileWidth;
+                                                       int oy = oo.getY() / tileHeight;
+                                                       int ow = oo.getWidth() / tileWidth;
+                                                       int oh = oo.getHeight() / tileHeight;
+
+                                                       if (oo.getProperties() != null) {
+                                                               for (Property op : oo.getProperties().getProperty()) {
+                                                                       String name = op.getName();
+                                                                       String value = op.getValue();
+                                                                       switch (name) {
+                                                                               case "alias":
+                                                                               case "goto":
+                                                                               case "able":
+                                                                               case "visible":
+                                                                                       for (int y = 0; y < oh; y++) {
+                                                                                               for (int x = 0; x < ow; x++) {
+                                                                                                       System.out.printf("%d.%d.%s=%s\n", ox + x, oy + y, name, value);
+                                                                                               }
+                                                                                       }
+                                                                                       break;
+                                                                       }
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
 
-                       TileMap map = new TileMap("main", tmap.getWidth(), tmap.getHeight());
-
-                       int lid = 0;
+                       {
+                               //TileMap map = new TileMap("main", tmap.getWidth(), tmap.getHeight());
+                               int lid = 0;
+
+                               int nlayers = 0;
+                               int groundid = 0;
+                               int mwidth = 0;
+                               int mheight = 0;
+                               // TODO: take layer size as max of all
+                               for (java.lang.Object o : tmap.getLayerOrObjectgroup()) {
+                                       if (o instanceof Layer) {
+                                               Layer l = (Layer) o;
 
-                       for (Object o : tmap.getLayerOrObjectgroup()) {
-                               if (o instanceof Layer) {
-                                       Layer l = (Layer) o;
+                                               if (l.getName() != null && l.getName().equals("ground")) {
+                                                       mwidth = l.getWidth();
+                                                       mheight = l.getHeight();
+                                                       groundid = nlayers;
+                                               }
 
-                                       // FIXME: remap map?
-                                       //l.getData().getvalue();
+                                               nlayers++;
+                                       }
+                               }
 
-                                       // encoding blah blah
+                               // Write layered map
+                               JarEntry je = new JarEntry("maps/main");
+                               jos.putNextEntry(je);
 
-                                       InputStream is = decodeArray(l.getData().getvalue());
-                                       ImageInputStream dis = new MemoryCacheImageInputStream(is);
+                               {
+                                       DataOutputStream dos = new DataOutputStream(jos);
+                                       dos.writeInt(MAGIC_LAYERED);
+                                       dos.writeInt(0);
+                                       dos.writeInt(0);
+                                       dos.writeInt(mwidth);
+                                       dos.writeInt(mheight);
+                                       dos.writeInt(groundid);
+                                       dos.writeInt(nlayers);
+
+                                       int layerid = 0;
+                                       for (java.lang.Object o : tmap.getLayerOrObjectgroup()) {
+                                               if (o instanceof Layer) {
+                                                       Layer l = (Layer) o;
+                                                       int lwidth = l.getWidth();
+                                                       int lheight = l.getHeight();
+                                                       int len = l.getWidth() * l.getHeight();
+                                                       int layer[] = new int[len];
+
+                                                       // Read in layer and perform some optimisation on it
+                                                       try (ImageInputStream dis = new MemoryCacheImageInputStream(decodeArray(l.getData().getvalue()))) {
+                                                               dis.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+                                                               for (int i = 0; i < len; i++) {
+                                                                       layer[i] = dis.readInt();
+                                                               }
 
-                                       dis.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+                                                       }
 
-                                       // Convert to shorts
-                                       JarEntry je = new JarEntry("maps/0-" + lid + "-" + l.getName());
-                                       jos.putNextEntry(je);
+                                                       // Find bounds of used squares (if not ground layer)
+                                                       int minx = lwidth - 1;
+                                                       int maxx = 0;
+                                                       int miny = lheight - 1;
+                                                       int maxy = 0;
+
+                                                       if (layerid != groundid) {
+                                                               for (int y = 0; y < lheight; y++) {
+                                                                       for (int x = 0; x < lwidth; x++) {
+                                                                               if (layer[x + y * lwidth] != 0) {
+                                                                                       minx = Math.min(x, minx);
+                                                                                       miny = Math.min(y, miny);
+                                                                                       maxx = Math.max(x, maxx);
+                                                                                       maxy = Math.max(y, maxy);
+                                                                               }
+                                                                       }
+                                                               }
+                                                       } else {
+                                                               minx = 0;
+                                                               maxx = lwidth - 1;
+                                                               miny = 0;
+                                                               maxy = lheight - 1;
+                                                       }
 
-                                       DataOutputStream dos = new DataOutputStream(jos);
-                                       dos.writeInt(l.getWidth());
-                                       dos.writeInt(l.getHeight());
-                                       for (int y = 0; y < l.getHeight(); y++) {
-                                               for (int x = 0; x < l.getWidth(); x++) {
-                                                       int t = dis.readInt();
-                                                       dos.writeShort(t);
-                                                       //System.out.printf("%3d\n", t);
+                                                       System.out.printf("Writing layer %d '%s' at %d,%d size %d,%d\n",
+                                                                       layerid, l.getName(), minx, miny, maxx - minx + 1, maxy - miny + 1);
+
+                                                       // Write out used area
+                                                       dos.writeInt(minx);
+                                                       dos.writeInt(miny);
+                                                       dos.writeInt(maxx - minx + 1);
+                                                       dos.writeInt(maxy - miny + 1);
+                                                       for (int y = miny; y <= maxy; y++) {
+                                                               for (int x = minx; x <= maxx; x++) {
+                                                                       dos.writeShort(layer[x + y * lwidth]);
+                                                               }
+                                                       }
                                                }
+
+                                               layerid++;
                                        }
                                        dos.flush();
-                                       //dos.close();
-
-                                       jos.closeEntry();
                                }
+                               jos.closeEntry();
                        }
 
                        // Add tile script names
@@ -457,6 +576,65 @@ public class Tiled {
                                jos.closeEntry();
                        }
 
+                       {
+                               JarEntry je = new JarEntry("tiles/anim");
+                               jos.putNextEntry(je);
+                               PrintStream ps = new PrintStream(jos);
+                               HashMap<String, AnimGroup> anims = new HashMap<>();
+                               for (TileInfo ti : tileInfo) {
+                                       for (String a : ti.anim) {
+                                               // group,set,seq,[,time]
+                                               String[] as = a.split(",");
+                                               if (as != null && as.length > 2) {
+                                                       String key = as[0].trim();
+                                                       String setkey = as[1].trim();
+                                                       AnimGroup ag = anims.get(key);
+                                                       if (ag == null) {
+                                                               ag = new AnimGroup();
+                                                               ag.name = key;
+                                                               anims.put(key, ag);
+                                                       }
+                                                       AnimInfo ai = new AnimInfo();
+                                                       ai.tileid = ti.id;
+                                                       ai.seq = Integer.valueOf(as[2]);
+                                                       if (as.length > 3 && ai.tileid == 0) {
+                                                               ag.rate = Integer.valueOf(as[3]);
+                                                       }
+                                                       List<AnimInfo> set = ag.sets.get(setkey);
+                                                       if (set == null) {
+                                                               set = new ArrayList<>();
+                                                               ag.sets.put(setkey, set);
+                                                       }
+                                                       set.add(ai);
+                                               }
+                                       }
+                               }
+                               for (Entry<String, AnimGroup> ae : anims.entrySet()) {
+                                       AnimGroup ag = ae.getValue();
+                                       String key = ae.getKey();
+
+                                       ps.format("anim.%s=%d", key, ag.rate);
+                                       // default timing
+
+                                       for (Entry<String, List<AnimInfo>> as : ag.sets.entrySet()) {
+                                               List<AnimInfo> set = as.getValue();
+                                               boolean first = true;
+
+                                               ps.format(";");
+                                               Collections.sort(set);
+                                               for (AnimInfo a : set) {
+                                                       if (!first)
+                                                               ps.print(",");
+                                                       first = false;
+                                                       ps.format("%d", a.tileid);
+                                               }
+                                       }
+                                       ps.println();
+                               }
+                               ps.flush();
+                               jos.closeEntry();
+                       }
+
                        // Build tileset manifest - nope in manifest
                        if (false) {
                                int setid = 0;
@@ -541,129 +719,130 @@ public class Tiled {
                        Logger.getLogger(Tiled.class.getName()).log(Level.SEVERE, null, ex);
                }
        }
-
-       static void tiledToDusk(File src, File dst) throws IOException {
-               try {
-                       JAXBContext jc = JAXBContext.newInstance(Map.class);
-                       Unmarshaller u = jc.createUnmarshaller();
-                       Map tmap = (Map) u.unmarshal(src);
-
-                       System.out.println("Loaded map size: " + tmap.getWidth() + "x" + tmap.getHeight());
-
-                       List<TileInfo> tileInfo = new ArrayList<>();
-                       int tid = 0;
-
-                       // TODO: write out tileset info somewhere
-
-
-                       TileMap map = new TileMap(dst.getName(), tmap.getWidth(), tmap.getHeight());
-
-                       int lid = 0;
-
-                       int nlayers = 0;
-                       int groundid = 0;
-                       int twidth = 0;
-                       int theight = 0;
-                       for (Object o : tmap.getLayerOrObjectgroup()) {
-                               if (o instanceof Layer) {
-                                       Layer l = (Layer) o;
-
-                                       if (l.getName() != null && l.getName().equals("ground")) {
-                                               twidth = l.getWidth();
-                                               theight = l.getHeight();
-                                               groundid = nlayers;
-                                       }
-
-                                       nlayers++;
-                               }
-                       }
-
-                       if (twidth == 0 || theight == 0)
-                               throw new IOException("Couldn't find a layer called 'ground'");
-
-                       System.out.printf("Found %d layers\n", nlayers);
-                       System.out.printf("Ground on layer %d\n", groundid);
-                       // Create map
-                       try (DataOutputStream dos = new DataOutputStream(new FileOutputStream(dst))) {
-                               // Write header
-                               dos.writeInt(TileMap.MAGIC_LAYERED);
-                               dos.writeInt(0);
-                               dos.writeInt(0);
-                               dos.writeInt(twidth);
-                               dos.writeInt(theight);
-                               dos.writeInt(groundid);
-                               dos.writeInt(nlayers);
-
-                               int layerid = 0;
-                               for (Object o : tmap.getLayerOrObjectgroup()) {
-                                       if (o instanceof Layer) {
-                                               Layer l = (Layer) o;
-                                               int lwidth = l.getWidth();
-                                               int lheight = l.getHeight();
-                                               int len = l.getWidth() * l.getHeight();
-                                               int layer[] = new int[len];
-
-                                               // Read in layer and perform some optimisation on it
-                                               try (ImageInputStream dis = new MemoryCacheImageInputStream(decodeArray(l.getData().getvalue()))) {
-                                                       dis.setByteOrder(ByteOrder.LITTLE_ENDIAN);
-                                                       for (int i = 0; i < len; i++) {
-                                                               layer[i] = dis.readInt();
-                                                       }
-
-                                               }
-
-                                               // Find bounds of used squares (if not ground layer)
-                                               int minx = lwidth - 1;
-                                               int maxx = 0;
-                                               int miny = lheight - 1;
-                                               int maxy = 0;
-
-                                               if (layerid != groundid) {
-                                                       for (int y = 0; y < lheight; y++) {
-                                                               for (int x = 0; x < lwidth; x++) {
-                                                                       if (layer[x + y * lwidth] != 0) {
-                                                                               minx = Math.min(x, minx);
-                                                                               miny = Math.min(y, miny);
-                                                                               maxx = Math.max(x, maxx);
-                                                                               maxy = Math.max(y, maxy);
-                                                                       }
-                                                               }
-                                                       }
-                                               } else {
-                                                       minx = 0;
-                                                       maxx = lwidth - 1;
-                                                       miny = 0;
-                                                       maxy = lheight - 1;
-                                               }
-
-                                               System.out.printf("Writing layer %d '%s' at %d,%d size %d,%d\n",
-                                                               layerid, l.getName(), minx, miny, maxx - minx + 1, maxy - miny + 1);
-
-                                               // Write out used area
-                                               dos.writeInt(minx);
-                                               dos.writeInt(miny);
-                                               dos.writeInt(maxx - minx + 1);
-                                               dos.writeInt(maxy - miny + 1);
-                                               for (int y = miny; y <= maxy; y++) {
-                                                       for (int x = minx; x <= maxx; x++) {
-                                                               dos.writeShort(layer[x + y * lwidth]);
-                                                       }
-                                               }
-                                       }
-
-                                       layerid++;
-                               }
-                       }
-
-               } catch (JAXBException ex) {
-                       Logger.getLogger(Tiled.class.getName()).log(Level.SEVERE, null, ex);
-               }
-       }
+       /*
+        static void tiledToDusk(File src, File dst) throws IOException {
+        try {
+        JAXBContext jc = JAXBContext.newInstance(Map.class);
+        Unmarshaller u = jc.createUnmarshaller();
+        Map tmap = (Map) u.unmarshal(src);
+
+        System.out.println("Loaded map size: " + tmap.getWidth() + "x" + tmap.getHeight());
+
+        List<TileInfo> tileInfo = new ArrayList<>();
+        int tid = 0;
+
+        // TODO: write out tileset info somewhere
+
+
+        TileMap map = new TileMap(dst.getName(), tmap.getWidth(), tmap.getHeight());
+
+        int lid = 0;
+
+        int nlayers = 0;
+        int groundid = 0;
+        int twidth = 0;
+        int theight = 0;
+        for (Object o : tmap.getLayerOrObjectgroup()) {
+        if (o instanceof Layer) {
+        Layer l = (Layer) o;
+
+        if (l.getName() != null && l.getName().equals("ground")) {
+        twidth = l.getWidth();
+        theight = l.getHeight();
+        groundid = nlayers;
+        }
+
+        nlayers++;
+        }
+        }
+
+        if (twidth == 0 || theight == 0)
+        throw new IOException("Couldn't find a layer called 'ground'");
+
+        System.out.printf("Found %d layers\n", nlayers);
+        System.out.printf("Ground on layer %d\n", groundid);
+        // Create map
+        try (DataOutputStream dos = new DataOutputStream(new FileOutputStream(dst))) {
+        // Write header
+        dos.writeInt(TileMap.MAGIC_LAYERED);
+        dos.writeInt(0);
+        dos.writeInt(0);
+        dos.writeInt(twidth);
+        dos.writeInt(theight);
+        dos.writeInt(groundid);
+        dos.writeInt(nlayers);
+
+        int layerid = 0;
+        for (Object o : tmap.getLayerOrObjectgroup()) {
+        if (o instanceof Layer) {
+        Layer l = (Layer) o;
+        int lwidth = l.getWidth();
+        int lheight = l.getHeight();
+        int len = l.getWidth() * l.getHeight();
+        int layer[] = new int[len];
+
+        // Read in layer and perform some optimisation on it
+        try (ImageInputStream dis = new MemoryCacheImageInputStream(decodeArray(l.getData().getvalue()))) {
+        dis.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+        for (int i = 0; i < len; i++) {
+        layer[i] = dis.readInt();
+        }
+
+        }
+
+        // Find bounds of used squares (if not ground layer)
+        int minx = lwidth - 1;
+        int maxx = 0;
+        int miny = lheight - 1;
+        int maxy = 0;
+
+        if (layerid != groundid) {
+        for (int y = 0; y < lheight; y++) {
+        for (int x = 0; x < lwidth; x++) {
+        if (layer[x + y * lwidth] != 0) {
+        minx = Math.min(x, minx);
+        miny = Math.min(y, miny);
+        maxx = Math.max(x, maxx);
+        maxy = Math.max(y, maxy);
+        }
+        }
+        }
+        } else {
+        minx = 0;
+        maxx = lwidth - 1;
+        miny = 0;
+        maxy = lheight - 1;
+        }
+
+        System.out.printf("Writing layer %d '%s' at %d,%d size %d,%d\n",
+        layerid, l.getName(), minx, miny, maxx - minx + 1, maxy - miny + 1);
+
+        // Write out used area
+        dos.writeInt(minx);
+        dos.writeInt(miny);
+        dos.writeInt(maxx - minx + 1);
+        dos.writeInt(maxy - miny + 1);
+        for (int y = miny; y <= maxy; y++) {
+        for (int x = minx; x <= maxx; x++) {
+        dos.writeShort(layer[x + y * lwidth]);
+        }
+        }
+        }
+
+        layerid++;
+        }
+        }
+
+        } catch (JAXBException ex) {
+        Logger.getLogger(Tiled.class.getName()).log(Level.SEVERE, null, ex);
+        }
+        }
+        * */
        // test load/save itled format map
 
        public static void main(String[] args) throws IOException {
-               //testimport(new File("/home/notzed/house.tmx"),
-               //              new File("/home/notzed/house.jar"));
+               testimport(new File("/home/notzed/dusk/maps/main.tmx"),
+                               new File("/home/notzed/house.jar"));
                //tiledToDusk(new File("/home/notzed/test-map.tmx"),
                //              new File("/home/notzed/test-map.bin"));
                //tiledToDusk(new File("/home/notzed/dusk/maps/dusk.tmx"),
@@ -671,7 +850,7 @@ public class Tiled {
                //tiledToDusk(new File("/home/notzed/dusk/maps/do-drop-inn.tmx"),
                //              new File("/home/notzed/src/DuskRPG/DuskFiles/DuskX/defMaps/do-drop-inn"));
                //testexport();
-               //(new File("/home/notzed/dusk/maps/main.tmx"),
+               //tiledToDusk(new File("/home/notzed/dusk/maps/main.tmx"),
                //              new File("/home/notzed/dusk/game/defMaps/main"));
        }
 }
diff --git a/src/duskz.tools/classes/module-info.java b/src/duskz.tools/classes/module-info.java
new file mode 100644 (file)
index 0000000..0c4740b
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2023 Michael Zucchi
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+module duskz.tools {
+
+       requires java.scripting;
+
+       requires javafx.graphics;
+       requires javafx.controls;
+       requires java.desktop;
+       requires java.logging;
+       requires jakarta.xml.bind;
+
+       requires duskz.common;
+       requires duskz.client;
+
+       exports duskz.tool;
+
+       exports duskz.viewer to javafx.graphics;
+       exports duskz.editor to javafx.graphics;
+}