From 4cdf43341d72dcf16c63a44e9eb7a6761797a046 Mon Sep 17 00:00:00 2001
From: Luc van den Brand <10974297+LucvandenBrand@users.noreply.github.com>
Date: Wed, 12 Sep 2018 18:55:58 +0200
Subject: [PATCH 01/25] Created debug map for objects.
---
.../assets/size16-terrain-objects/map.tmx | 32 ++++++++++++++++++
.../size16-terrain-objects/tileset.aseprite | Bin 0 -> 732 bytes
.../assets/size16-terrain-objects/tileset.png | Bin 0 -> 802 bytes
.../size16-terrain-objects/untitled.tsx | 11 ++++++
4 files changed, 43 insertions(+)
create mode 100644 examples/assets/size16-terrain-objects/map.tmx
create mode 100644 examples/assets/size16-terrain-objects/tileset.aseprite
create mode 100644 examples/assets/size16-terrain-objects/tileset.png
create mode 100644 examples/assets/size16-terrain-objects/untitled.tsx
diff --git a/examples/assets/size16-terrain-objects/map.tmx b/examples/assets/size16-terrain-objects/map.tmx
new file mode 100644
index 0000000..09666f1
--- /dev/null
+++ b/examples/assets/size16-terrain-objects/map.tmx
@@ -0,0 +1,32 @@
+
+
diff --git a/examples/assets/size16-terrain-objects/tileset.aseprite b/examples/assets/size16-terrain-objects/tileset.aseprite
new file mode 100644
index 0000000000000000000000000000000000000000..fce3ce0e6de54b41fd4aa5dc121fc10d8289c82f
GIT binary patch
literal 732
zcmcJNZ%7ky9EX2vN-s=$(+eeJzfE&NFPtkKBiV@{{+VI_(7l;KOrtloA*nAyFsDH+4UtHeibdP}`MFGk-uFH3fxClyp6_uV4iNHb
zP(kSLLqQ1PasC}j6!OjgHWv7QeNWi8F2IyZ=^vl!UoRs>Lr;N)$MZm&F&mUBPlF%r
znP8~j2Clt+1V-0$!G~YYg2F2uXt>`Dnj5mf3Udai&ohD?*9z+DZhFxC`Be35r{gZp$kzcLXOKBmV%`A5YW{Z!uHi{ABQ+=8%5rhxVjTH!Zr{nZ8Kfn95TV
z@wd>Jw04n?-nJ)=-w?W3{$jZ|qCK+W%8AcvVkKvo`|Z){XU^(n)>-Uy`D3Yfwhr_0
zM$<7#^D;QugSVzP_9?1TY@FX(WRAWISRK4wSdeBMj?d41eHQj)=tNW7z|_(PXAGB@
zUFaXt@|@|~xmnS&oe>a)r%qvB8W~jw#7jSwciEM+?KeTC_nT@sqMb|IT<6q=+dvflP8M~B7z=kPwp_cWG+U=a2a{}R3#E8*LYEFPO)=T}2TWTi^e32P
z?3Q>)po1Yp4Nj+S84RJtQjjg0p~j(;i|y+mq)4((zLWYUo$lU!-+OoOeMi1lS7|Yy
z1|Wzwl^<+s0S`6G8{WQ4bM2AD+mD_!%F~w1OV!L1$v{&?cCXEpzv{H
z0o>k{=iBy?>c{#KzZc~TWb>5Rf2>>oVCZFZ(Bzo
z0`4Z^PkMh$Q9YUBdgA@x)+pNA4Cy4$s>moQB)kztvHqB1^KcQ|ZPycE^Kgp(nEqb^
zv$+*HuT@W`n9b=80sB&knA@j2prMfmWuiNv-VBJ4@UK0(ms{~
zS{2!8$x>WBcjQ?iINg>*Gm%aLr`z6EEW6KC
+
+
+
+
+
+
+
+
+
+
From 16e19830071e0c1bba084efc65dad57dffcf678c Mon Sep 17 00:00:00 2001
From: Luc van den Brand <10974297+LucvandenBrand@users.noreply.github.com>
Date: Sun, 23 Sep 2018 10:52:56 +0200
Subject: [PATCH 02/25] Beginning of object converter.
---
.../objectLayerConverter.cpp | 32 +++++++++++++++++++
.../objectLayerConverter.hpp | 26 +++++++++++++++
.../stringConverter/stringConverter.cpp | 29 +++++++++++++++++
.../stringConverter/stringConverter.hpp | 25 +++++++++++++++
4 files changed, 112 insertions(+)
create mode 100644 src/mapConverter/objectLayerConverter/objectLayerConverter.cpp
create mode 100644 src/mapConverter/objectLayerConverter/objectLayerConverter.hpp
create mode 100644 src/mapConverter/stringConverter/stringConverter.cpp
create mode 100644 src/mapConverter/stringConverter/stringConverter.hpp
diff --git a/src/mapConverter/objectLayerConverter/objectLayerConverter.cpp b/src/mapConverter/objectLayerConverter/objectLayerConverter.cpp
new file mode 100644
index 0000000..2074bee
--- /dev/null
+++ b/src/mapConverter/objectLayerConverter/objectLayerConverter.cpp
@@ -0,0 +1,32 @@
+#include "objectLayerConverter.hpp"
+#include "../stringConverter/stringConverter.hpp"
+
+vector ObjectLayerConverter::convert(const tmx::ObjectGroup *objectGroup) {
+ return convert(objectGroup->getObjects());
+}
+
+vector ObjectLayerConverter::convert(const vector &objects) {
+ vector bytes;
+ for (const tmx::Object &object : objects) {
+ auto objectBytes = convert(object);
+ bytes.insert(bytes.end(), objectBytes.begin(), objectBytes.end());
+ }
+
+ return bytes;
+}
+
+vector ObjectLayerConverter::convert(const tmx::Object &object) {
+ vector bytes;
+
+ auto id = (uint16_t) object.getUID();
+ bytes.push_back(id);
+
+ StringConverter stringConverter;
+ vector nameBytes = stringConverter.convert(object.getName());
+ bytes.insert(bytes.end(), nameBytes.begin(), nameBytes.end());
+
+ vector typeBytes = stringConverter.convert(object.getType());
+ bytes.insert(bytes.end(), typeBytes.begin(), typeBytes.end());
+
+ return bytes;
+}
\ No newline at end of file
diff --git a/src/mapConverter/objectLayerConverter/objectLayerConverter.hpp b/src/mapConverter/objectLayerConverter/objectLayerConverter.hpp
new file mode 100644
index 0000000..fe58674
--- /dev/null
+++ b/src/mapConverter/objectLayerConverter/objectLayerConverter.hpp
@@ -0,0 +1,26 @@
+#ifndef OBJECT_LAYER_CONVERTER_H
+#define OBJECT_LAYER_CONVERTER_H
+
+#include
+#include "../../lib/tmxlite/ObjectGroup.hpp"
+
+using namespace std;
+
+/**
+ * Converts an Object Layer to binary data describing the objects.
+ */
+class ObjectLayerConverter {
+public:
+ /**
+ * Convert an Object Layer.
+ * @param objectGroup The list of objects in the layer.
+ */
+ vector convert(const tmx::ObjectGroup *objectGroup);
+
+private:
+ vector convert(const vector &objects);
+ vector convert(const tmx::Object &object);
+
+};
+
+#endif // OBJECT_LAYER_CONVERTER_H
\ No newline at end of file
diff --git a/src/mapConverter/stringConverter/stringConverter.cpp b/src/mapConverter/stringConverter/stringConverter.cpp
new file mode 100644
index 0000000..7b7a156
--- /dev/null
+++ b/src/mapConverter/stringConverter/stringConverter.cpp
@@ -0,0 +1,29 @@
+#include
+#include "stringConverter.hpp"
+
+vector StringConverter::convert(const string &text) {
+ vector bytes;
+
+ string paddedText = paddString(text);
+ auto numStringBytes = paddedText.length() + 1;
+
+ char characters[numStringBytes];
+ strcpy(characters, paddedText.c_str());
+
+ for (unsigned index = 0; index < numStringBytes; index += 2) {
+ auto mergedChar = (uint16_t) characters[index];
+ mergedChar |= (uint16_t) characters[index+1] << 8;
+ bytes.push_back(mergedChar);
+ }
+
+ return bytes;
+}
+
+string StringConverter::paddString(string text) {
+ auto numStringBytes = text.length() + 1;
+ auto remainingBytes = 4 - numStringBytes % 4;
+ string appendedText = text;
+ appendedText.append(remainingBytes, ' ');
+
+ return appendedText;
+}
\ No newline at end of file
diff --git a/src/mapConverter/stringConverter/stringConverter.hpp b/src/mapConverter/stringConverter/stringConverter.hpp
new file mode 100644
index 0000000..a9e7220
--- /dev/null
+++ b/src/mapConverter/stringConverter/stringConverter.hpp
@@ -0,0 +1,25 @@
+#ifndef STRING_CONVERTER_H
+#define STRING_CONVERTER_H
+
+#include
+#include
+
+using namespace std;
+
+/**
+ * Converts strings into binary data readable by the GBA.
+ */
+class StringConverter {
+public:
+ /**
+ * Convert a string into a vector of 2-byte values.
+ * @param text The text to convert.
+ * @return A vector of 2-byte values.
+ */
+ vector convert(const string &text);
+
+private:
+ string paddString(string text);
+};
+
+#endif
\ No newline at end of file
From 3b6d05453d741a1ad5d445cb499c3e3092dfa1b3 Mon Sep 17 00:00:00 2001
From: Luc van den Brand <10974297+LucvandenBrand@users.noreply.github.com>
Date: Sun, 23 Sep 2018 11:18:43 +0200
Subject: [PATCH 03/25] Refactor to ease layer parsing.
---
src/mapConverter/mapConverter.cpp | 39 ++++++++++++++++++++++++-------
src/mapConverter/mapConverter.hpp | 5 ++++
2 files changed, 36 insertions(+), 8 deletions(-)
diff --git a/src/mapConverter/mapConverter.cpp b/src/mapConverter/mapConverter.cpp
index e4448a8..54b746a 100644
--- a/src/mapConverter/mapConverter.cpp
+++ b/src/mapConverter/mapConverter.cpp
@@ -69,22 +69,45 @@ GBAMap MapConverter::convert(const string &name, const tmx::Map &tmxMap) {
gbaMap.setTerrainMap(terrainMap);
const auto& layers = tmxMap.getLayers();
- if (layers.size() > GBA_LAYERS) {
- log(WARN, "This map has " + to_string(layers.size())
- + " layers, which is " + to_string(layers.size() - GBA_LAYERS)
+ const auto tileLayers = getTileLayers(layers);
+ if (tileLayers.size() > GBA_LAYERS) {
+ log(WARN, "This map has " + to_string(tileLayers.size())
+ + "tile layers, which is " + to_string(tileLayers.size() - GBA_LAYERS)
+ " more than than the GBA has natively.");
}
auto *tileLayerConverter = new TileLayerConverter(tileSet.getFirstGID());
+ for (const auto& tileLayer : tileLayers) {
+ log(INFO, "Converting layer '" + tileLayer->getName() + "'.");
+ auto tileLayerBytes = tileLayerConverter->convert(tileLayer, mapSize.x, mapSize.y, tileSize.x);
+ gbaMap.addTileLayer(tileLayerBytes);
+ }
+
+ return gbaMap;
+}
+
+vector MapConverter::getTileLayers(const vector &layers) {
+ vector tileLayers;
+
for (const auto& layer : layers) {
if (layer->getType() != tmx::Layer::Type::Tile)
continue;
-
- log(INFO, "Converting layer '" + layer->getName() + "'.");
const auto tileLayer = dynamic_cast(layer.get());
- auto tileLayerBytes = tileLayerConverter->convert(tileLayer, mapSize.x, mapSize.y, tileSize.x);
- gbaMap.addTileLayer(tileLayerBytes);
+ tileLayers.push_back(tileLayer);
}
- return gbaMap;
+ return tileLayers;
+}
+
+vector MapConverter::getObjectLayers(const vector &layers) {
+ vector objectLayers;
+
+ for (const auto& layer : layers) {
+ if (layer->getType() != tmx::Layer::Type::Object)
+ continue;
+ const auto tileLayer = dynamic_cast(layer.get());
+ objectLayers.push_back(tileLayer);
+ }
+
+ return objectLayers;
}
\ No newline at end of file
diff --git a/src/mapConverter/mapConverter.hpp b/src/mapConverter/mapConverter.hpp
index b9b146b..7145c53 100644
--- a/src/mapConverter/mapConverter.hpp
+++ b/src/mapConverter/mapConverter.hpp
@@ -3,6 +3,7 @@
#include "../lib/tmxlite/Map.hpp"
#include "../gba/gbaMap/gbaMap.hpp"
+#include "../lib/tmxlite/TileLayer.hpp"
using namespace std;
@@ -17,6 +18,10 @@ class MapConverter {
* @return The GBA Map.
*/
GBAMap convert(const string &name, const tmx::Map &tmxMap);
+
+private:
+ vector getTileLayers(const vector &layers);
+ vector getObjectLayers(const vector &layers);
};
#endif // MAP_CONVERTER_H
\ No newline at end of file
From d82babe7b1615aeb2bf82312e2f1b9e4fd98c561 Mon Sep 17 00:00:00 2001
From: Luc van den Brand <10974297+LucvandenBrand@users.noreply.github.com>
Date: Sun, 30 Sep 2018 17:01:20 +0200
Subject: [PATCH 04/25] Improved string conversion for objects.
---
examples/mapViewer/source/asset/map.c | 200 ++++++++++--------
examples/mapViewer/source/asset/map.h | 7 +-
src/gba/gbaMap/gbaMap.cpp | 7 +
src/gba/gbaMap/gbaMap.hpp | 9 +-
src/mapConverter/mapConverter.cpp | 15 +-
.../stringConverter/stringConverter.cpp | 40 ++--
.../stringConverter/stringConverter.hpp | 5 +-
7 files changed, 172 insertions(+), 111 deletions(-)
diff --git a/examples/mapViewer/source/asset/map.c b/examples/mapViewer/source/asset/map.c
index 9a99fce..1d90455 100644
--- a/examples/mapViewer/source/asset/map.c
+++ b/examples/mapViewer/source/asset/map.c
@@ -1,6 +1,6 @@
const unsigned short mapPalette[256] = {
- 0x7c1f, 0x18e6, 0x3626, 0x6f0b, 0x3d65, 0x38e7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x7c1f, 0x0557, 0x11bb, 0x47bf, 0x1bbe, 0x235a, 0x22da, 0x2276, 0x5c28, 0x6c8c, 0x0831, 0x1474, 0x019a, 0x0113, 0x0088,
+ 0x0001, 0x0156, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
@@ -19,103 +19,125 @@ const unsigned short mapPalette[256] = {
0x0000
};
-const unsigned short mapTileSet[288] = {
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0102, 0x0101, 0x0102, 0x0201,
- 0x0201, 0x0201, 0x0201, 0x0202, 0x0202, 0x0202, 0x0202, 0x0102, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0201, 0x0102,
- 0x0201, 0x0202, 0x0202, 0x0202, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0102, 0x0101,
- 0x0102, 0x0201, 0x0201, 0x0201, 0x0201, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0102, 0x0202, 0x0202, 0x0201,
- 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303,
- 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303,
- 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303,
- 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303,
- 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202,
- 0x0102, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202,
- 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0102, 0x0202, 0x0102,
- 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0102, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202,
- 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0202, 0x0303,
- 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303,
- 0x0304, 0x0304, 0x0304, 0x0304, 0x0503, 0x0503, 0x0503, 0x0503, 0x0305, 0x0505, 0x0305, 0x0505, 0x0505, 0x0505, 0x0505,
- 0x0505, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303, 0x0303,
- 0x0303, 0x0303, 0x0304, 0x0304, 0x0304, 0x0304, 0x0503, 0x0503, 0x0503, 0x0503, 0x0305, 0x0505, 0x0305, 0x0505, 0x0505,
- 0x0505, 0x0505, 0x0505
+const unsigned short mapTileSet[544] = {
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x0201, 0x0202, 0x0202, 0x0202, 0x0202, 0x0303, 0x0303, 0x0303, 0x0402, 0x0302, 0x0303, 0x0303, 0x0402,
+ 0x0204, 0x0303, 0x0303, 0x0402, 0x0404, 0x0302, 0x0303, 0x0402, 0x0404, 0x0204, 0x0303, 0x0402, 0x0404, 0x0404, 0x0302,
+ 0x0402, 0x0404, 0x0404, 0x0204, 0x0201, 0x0202, 0x0202, 0x0202, 0x0303, 0x0303, 0x0303, 0x0101, 0x0303, 0x0303, 0x0103,
+ 0x0105, 0x0303, 0x0303, 0x0501, 0x0105, 0x0303, 0x0103, 0x0505, 0x0105, 0x0303, 0x0501, 0x0505, 0x0105, 0x0103, 0x0505,
+ 0x0505, 0x0105, 0x0501, 0x0505, 0x0505, 0x0105, 0x0401, 0x0404, 0x0404, 0x0104, 0x0402, 0x0404, 0x0404, 0x0601, 0x0402,
+ 0x0404, 0x0104, 0x0606, 0x0402, 0x0404, 0x0601, 0x0606, 0x0402, 0x0104, 0x0606, 0x0606, 0x0402, 0x0701, 0x0606, 0x0606,
+ 0x0102, 0x0707, 0x0707, 0x0707, 0x0202, 0x0202, 0x0202, 0x0202, 0x0502, 0x0505, 0x0505, 0x0205, 0x0206, 0x0505, 0x0505,
+ 0x0105, 0x0606, 0x0502, 0x0505, 0x0105, 0x0606, 0x0206, 0x0505, 0x0105, 0x0606, 0x0606, 0x0502, 0x0105, 0x0606, 0x0606,
+ 0x0207, 0x0105, 0x0707, 0x0707, 0x0707, 0x0102, 0x0202, 0x0202, 0x0202, 0x0102, 0x0808, 0x0808, 0x0808, 0x0808, 0x0808,
+ 0x0909, 0x0909, 0x0909, 0x0908, 0x0809, 0x0909, 0x0908, 0x0908, 0x0909, 0x0909, 0x0909, 0x0908, 0x0908, 0x0809, 0x0909,
+ 0x0908, 0x0909, 0x0909, 0x0909, 0x0908, 0x0809, 0x0909, 0x0908, 0x0908, 0x0909, 0x0909, 0x0909, 0x0808, 0x0808, 0x0808,
+ 0x0808, 0x0909, 0x0909, 0x0909, 0x0808, 0x0809, 0x0909, 0x0908, 0x0809, 0x0909, 0x0909, 0x0909, 0x0809, 0x0908, 0x0809,
+ 0x0809, 0x0809, 0x0909, 0x0909, 0x0909, 0x0809, 0x0809, 0x0909, 0x0908, 0x0809, 0x0909, 0x0909, 0x0909, 0x0809, 0x0908,
+ 0x0908, 0x0908, 0x0909, 0x0908, 0x0909, 0x0909, 0x0908, 0x0908, 0x0809, 0x0909, 0x0909, 0x0908, 0x0909, 0x0809, 0x0909,
+ 0x0908, 0x0909, 0x0909, 0x0909, 0x0908, 0x0809, 0x0909, 0x0908, 0x0808, 0x0909, 0x0909, 0x0909, 0x0808, 0x0808, 0x0808,
+ 0x0808, 0x0908, 0x0909, 0x0908, 0x0809, 0x0909, 0x0908, 0x0909, 0x0809, 0x0909, 0x0909, 0x0809, 0x0809, 0x0908, 0x0809,
+ 0x0909, 0x0809, 0x0909, 0x0909, 0x0909, 0x0809, 0x0809, 0x0909, 0x0908, 0x0809, 0x0909, 0x0909, 0x0909, 0x0808, 0x0808,
+ 0x0808, 0x0808, 0x0808, 0x0701, 0x0607, 0x0606, 0x0606, 0x0702, 0x0606, 0x0606, 0x0606, 0x0602, 0x0606, 0x0606, 0x0606,
+ 0x0602, 0x0606, 0x0606, 0x0606, 0x0602, 0x0606, 0x0606, 0x0606, 0x0702, 0x0606, 0x0606, 0x0606, 0x0702, 0x0607, 0x0606,
+ 0x0606, 0x0208, 0x0202, 0x0202, 0x0202, 0x0606, 0x0606, 0x0706, 0x0207, 0x0606, 0x0606, 0x0606, 0x0107, 0x0606, 0x0606,
+ 0x0606, 0x0106, 0x0606, 0x0606, 0x0606, 0x0106, 0x0606, 0x0606, 0x0606, 0x0106, 0x0606, 0x0606, 0x0606, 0x0107, 0x0606,
+ 0x0606, 0x0706, 0x0107, 0x0202, 0x0202, 0x0202, 0x0802, 0x0808, 0x0808, 0x0808, 0x0808, 0x0808, 0x0909, 0x0909, 0x0908,
+ 0x0908, 0x0809, 0x0909, 0x0909, 0x0908, 0x0909, 0x0809, 0x0909, 0x0908, 0x0909, 0x0909, 0x0909, 0x0908, 0x0809, 0x0909,
+ 0x0908, 0x0808, 0x0909, 0x0909, 0x0909, 0x0808, 0x0808, 0x0808, 0x0808, 0x0808, 0x0808, 0x0808, 0x0808, 0x0909, 0x0908,
+ 0x0909, 0x0808, 0x0909, 0x0909, 0x0809, 0x0809, 0x0908, 0x0809, 0x0909, 0x0809, 0x0909, 0x0909, 0x0909, 0x0809, 0x0809,
+ 0x0909, 0x0908, 0x0809, 0x0909, 0x0909, 0x0909, 0x0808, 0x0808, 0x0808, 0x0808, 0x0808, 0x0b0a, 0x0b0b, 0x0b0b, 0x0b0b,
+ 0x0c0b, 0x0c0c, 0x0d0c, 0x0f0e, 0x0c0b, 0x100c, 0x110f, 0x1111, 0x0c0b, 0x1110, 0x1111, 0x1111, 0x0c0b, 0x110f, 0x1111,
+ 0x1111, 0x0d0b, 0x1111, 0x1111, 0x1111, 0x0e0b, 0x1111, 0x1111, 0x1111, 0x0f0b, 0x1111, 0x1111, 0x1111, 0x0b0a, 0x0b0b,
+ 0x0b0b, 0x0b0b, 0x0e0f, 0x0c0d, 0x0c0c, 0x0a0c, 0x1111, 0x0f11, 0x0c10, 0x0a0c, 0x1111, 0x1111, 0x1011, 0x0a0c, 0x1111,
+ 0x1111, 0x0f11, 0x0a0c, 0x1111, 0x1111, 0x1111, 0x0a0d, 0x1111, 0x1111, 0x1111, 0x0a0e, 0x1111, 0x1111, 0x1111, 0x0a0f,
+ 0x0f0a, 0x1111, 0x1111, 0x1111, 0x0e0b, 0x1111, 0x1111, 0x1111, 0x0d0b, 0x1111, 0x1111, 0x1111, 0x0c0b, 0x110f, 0x1111,
+ 0x1111, 0x0c0b, 0x1110, 0x1111, 0x1111, 0x0c0b, 0x100c, 0x110f, 0x1111, 0x0c0b, 0x0c0c, 0x0d0c, 0x0f0e, 0x0a0b, 0x0a0a,
+ 0x0a0a, 0x0a0a, 0x1111, 0x1111, 0x1111, 0x0b0f, 0x1111, 0x1111, 0x1111, 0x0a0e, 0x1111, 0x1111, 0x1111, 0x0a0d, 0x1111,
+ 0x1111, 0x0f11, 0x0a0c, 0x1111, 0x1111, 0x1011, 0x0a0c, 0x1111, 0x0f11, 0x0c10, 0x0a0c, 0x0e0f, 0x0c0d, 0x0c0c, 0x0a0c,
+ 0x0a0b, 0x0a0a, 0x0a0a, 0x0a0a
};
const unsigned short mapTerrainMap[16] = {
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+ 0x0001, 0x0001, 0x0001, 0x0001, 0xffff, 0xffff, 0xffff, 0xffff, 0x0001, 0x0001, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000,
0x0000
};
+const unsigned short mapObjects[20] = {
+ 0x0004, 0x4261, 0x6c6c, 0x2053, 0x7061, 0x776e, 0x0000, 0x5265, 0x6400, 0x0005, 0x426c, 0x6f63, 0x6b4f, 0x626a, 0x6563,
+ 0x7400, 0x466c, 0x6f61, 0x7479, 0x0000
+};
+
const unsigned short mapTileMap0[1024] = {
- 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0004, 0x0003, 0x0003, 0x0003, 0x0003,
- 0x0003, 0x0003, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0003, 0x0003, 0x0007, 0x0008, 0x0004,
- 0x0004, 0x0003, 0x0003, 0x0003, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0003, 0x0004, 0x0003, 0x0003, 0x0003,
- 0x0003, 0x0004, 0x0004, 0x0004, 0x0003, 0x0003, 0x0004, 0x0003, 0x0004, 0x0004, 0x0004, 0x0003, 0x0003, 0x0004, 0x0001,
- 0x0002, 0x0003, 0x0003, 0x0004, 0x0003, 0x0003, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0004, 0x0003, 0x0003,
- 0x0003, 0x0003, 0x0007, 0x0008, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0004, 0x0004, 0x0004, 0x0004,
- 0x0003, 0x0005, 0x0006, 0x0004, 0x0003, 0x0004, 0x0004, 0x0003, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0003,
- 0x0004, 0x0004, 0x0004, 0x0004, 0x0001, 0x0002, 0x0003, 0x0003, 0x0004, 0x0003, 0x0003, 0x0003, 0x0003, 0x0004, 0x0004,
- 0x0003, 0x0004, 0x0004, 0x0003, 0x0003, 0x0003, 0x0004, 0x0003, 0x0003, 0x0003, 0x0004, 0x0003, 0x0003, 0x0004, 0x0003,
- 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0005, 0x0006, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0004, 0x0003,
- 0x0004, 0x0003, 0x0003, 0x0003, 0x0003, 0x0004, 0x0003, 0x0004, 0x0004, 0x0003, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003,
- 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004,
- 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0003, 0x0007, 0x0008, 0x0003, 0x0004, 0x0003, 0x0003, 0x0003, 0x0003, 0x0004,
- 0x0003, 0x0007, 0x0008, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008,
- 0x0007, 0x0008, 0x0007, 0x0008, 0x0003, 0x0004, 0x0003, 0x0004, 0x0001, 0x0002, 0x0004, 0x0004, 0x0003, 0x0004, 0x0004,
- 0x0003, 0x0004, 0x0004, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002,
- 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0003, 0x0004, 0x0003, 0x0004, 0x0005, 0x0006, 0x0004, 0x0004, 0x0003,
- 0x0004, 0x0003, 0x0004, 0x0004, 0x0003, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006,
- 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0003, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004,
- 0x0003, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0003, 0x0003, 0x0004, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003,
- 0x0004, 0x0004, 0x0004, 0x0004, 0x0003, 0x0003, 0x0004, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0004, 0x0003, 0x0004,
- 0x0004, 0x0003, 0x0003, 0x0004, 0x0004, 0x0004, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0004, 0x0004, 0x0003,
- 0x0003, 0x0003, 0x0004, 0x0004, 0x0003, 0x0004, 0x0004, 0x0007, 0x0008, 0x0004, 0x0003, 0x0004, 0x0003, 0x0003, 0x0004,
- 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0003, 0x0004, 0x0004, 0x0004, 0x0003, 0x0003, 0x0003,
- 0x0004, 0x0004, 0x0003, 0x0004, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0001, 0x0002, 0x0004, 0x0003, 0x0004, 0x0003,
- 0x0003, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0003, 0x0003,
- 0x0004, 0x0007, 0x0008, 0x0004, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0005, 0x0006, 0x0004, 0x0003,
- 0x0004, 0x0003, 0x0003, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0004, 0x0003, 0x0003, 0x0003,
- 0x0004, 0x0004, 0x0003, 0x0001, 0x0002, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003,
- 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004,
- 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0005, 0x0006, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003,
- 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004,
- 0x0003, 0x0004, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003,
- 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004,
- 0x0003, 0x0004, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003,
- 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004,
- 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0004, 0x0004, 0x0003, 0x0004, 0x0004, 0x0004, 0x0004,
- 0x0003, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003,
- 0x0004, 0x0003, 0x0004, 0x0004, 0x0003, 0x0004, 0x0004, 0x0003, 0x0004, 0x0004, 0x0003, 0x0003, 0x0004, 0x0003, 0x0004,
- 0x0003, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0003, 0x0003, 0x0004, 0x0003, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007,
- 0x0008, 0x0007, 0x0008, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003,
- 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0003, 0x0004, 0x0003, 0x0004, 0x0004, 0x0004, 0x0001, 0x0002, 0x0001,
- 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003,
- 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0003, 0x0003, 0x0004, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0005,
- 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003,
- 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004,
- 0x0003, 0x0003, 0x0003, 0x0004, 0x0003, 0x0003, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003,
- 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004,
- 0x0003, 0x0003, 0x0003, 0x0003, 0x0004, 0x0004, 0x0003, 0x0003, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003,
+ 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001,
+ 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002,
+ 0x0001, 0x0002, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003,
0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004,
- 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0003, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003,
- 0x0004, 0x0003, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0003, 0x0004, 0x0003, 0x0003, 0x0003, 0x0004, 0x0003, 0x0004,
- 0x0003, 0x0004, 0x0003, 0x0003, 0x0004, 0x0003, 0x0003, 0x0004, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0004,
- 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0004, 0x0004, 0x0003, 0x0003, 0x0004, 0x0004, 0x0003, 0x0003, 0x0004, 0x0004,
- 0x0003, 0x0004, 0x0003, 0x0003, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0004, 0x0003, 0x0004, 0x0004, 0x0003,
- 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0003, 0x0004,
- 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0003, 0x0004, 0x0004, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0004, 0x0004,
- 0x0004, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0004, 0x0003, 0x0003, 0x0004, 0x0003, 0x0003,
- 0x0004, 0x0004, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0003, 0x0004, 0x0004, 0x0003,
- 0x0004, 0x0004, 0x0003, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004,
- 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003,
- 0x0004, 0x0003, 0x0004, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0007, 0x0008,
+ 0x0003, 0x0004, 0x0003, 0x0004, 0x0001, 0x0002, 0x0009, 0x000a, 0x0009, 0x000a, 0x0009, 0x000a, 0x0009, 0x000a, 0x0009,
+ 0x000a, 0x0009, 0x000a, 0x0009, 0x000a, 0x0009, 0x000a, 0x0009, 0x000a, 0x0009, 0x000a, 0x0009, 0x000a, 0x0009, 0x000a,
+ 0x0009, 0x000a, 0x0009, 0x000a, 0x0001, 0x0002, 0x0003, 0x0004, 0x000b, 0x000c, 0x000b, 0x000c, 0x000b, 0x000c, 0x000b,
+ 0x000c, 0x000b, 0x000c, 0x000b, 0x000c, 0x000b, 0x000c, 0x000b, 0x000c, 0x000b, 0x000c, 0x000b, 0x000c, 0x000b, 0x000c,
+ 0x000b, 0x000c, 0x000b, 0x000c, 0x000b, 0x000c, 0x0003, 0x0004, 0x0001, 0x0002, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005,
+ 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006,
+ 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0001, 0x0002, 0x0003, 0x0004, 0x0007, 0x0008, 0x0007,
+ 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008,
+ 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0003, 0x0004, 0x0001, 0x0002, 0x0005,
+ 0x0006, 0x0005, 0x0006, 0x000d, 0x000e, 0x0005, 0x0006, 0x0001, 0x0002, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006,
+ 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0001, 0x0002, 0x0003,
+ 0x0004, 0x0007, 0x0008, 0x0007, 0x0008, 0x000f, 0x0010, 0x0007, 0x0008, 0x0003, 0x0004, 0x0007, 0x0008, 0x0007, 0x0008,
+ 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0003,
+ 0x0004, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0005, 0x0006,
+ 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005,
+ 0x0006, 0x0001, 0x0002, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004,
0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007,
- 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007,
+ 0x0008, 0x0007, 0x0008, 0x0003, 0x0004, 0x0001, 0x0002, 0x0009, 0x000a, 0x0009, 0x000a, 0x0009, 0x000a, 0x0009, 0x000a,
+ 0x0009, 0x000a, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0001, 0x0002, 0x0001, 0x0002, 0x0005, 0x0006, 0x0005,
+ 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0001, 0x0002, 0x0003, 0x0004, 0x000b, 0x000c, 0x000b, 0x000c, 0x000b, 0x000c,
+ 0x000b, 0x000c, 0x000b, 0x000c, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0003, 0x0004, 0x0003, 0x0004, 0x0007,
+ 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0003, 0x0004, 0x0001, 0x0002, 0x0005, 0x0006, 0x0005, 0x0006,
+ 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0001, 0x0002, 0x0001,
+ 0x0002, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0001, 0x0002, 0x0003, 0x0004, 0x0007, 0x0008,
+ 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0003,
+ 0x0004, 0x0003, 0x0004, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0003, 0x0004, 0x0009, 0x000a,
+ 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005,
+ 0x0006, 0x0009, 0x000a, 0x0009, 0x000a, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0009, 0x000a,
+ 0x000b, 0x000c, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007,
+ 0x0008, 0x0007, 0x0008, 0x000b, 0x000c, 0x000b, 0x000c, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008,
+ 0x000b, 0x000c, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005,
+ 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006,
+ 0x0005, 0x0006, 0x0005, 0x0006, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007,
+ 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008,
+ 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005,
+ 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006,
+ 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007,
+ 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008,
+ 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005,
+ 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0001, 0x0002,
+ 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0007, 0x0008, 0x0007,
+ 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008,
+ 0x0003, 0x0004, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0001,
+ 0x0002, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006,
+ 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0001,
+ 0x0002, 0x0003, 0x0004, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008,
+ 0x0007, 0x0008, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007,
+ 0x0008, 0x0003, 0x0004, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0005, 0x0006, 0x0005, 0x0006,
+ 0x0005, 0x0006, 0x0005, 0x0006, 0x0009, 0x000a, 0x0001, 0x0002, 0x0009, 0x000a, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005,
+ 0x0006, 0x0005, 0x0006, 0x0001, 0x0002, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0007, 0x0008,
+ 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x000b, 0x000c, 0x0003, 0x0004, 0x000b, 0x000c, 0x0007, 0x0008, 0x0007,
+ 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0003, 0x0004, 0x0001, 0x0002, 0x0009, 0x000a, 0x0009, 0x000a, 0x0009, 0x000a,
+ 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0009, 0x000a, 0x0005, 0x0006, 0x0005,
+ 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0001, 0x0002, 0x0003, 0x0004, 0x000b, 0x000c, 0x000b, 0x000c,
+ 0x000b, 0x000c, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x000b, 0x000c, 0x0007,
+ 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0003, 0x0004, 0x0001, 0x0002, 0x0005, 0x0006,
+ 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005,
+ 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0001, 0x0002, 0x0003, 0x0004,
+ 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007,
+ 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0007, 0x0008, 0x0003, 0x0004,
0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001,
0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002, 0x0001, 0x0002,
- 0x0001, 0x0002, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005,
- 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006, 0x0005, 0x0006,
- 0x0005, 0x0006, 0x0005, 0x0006
+ 0x0001, 0x0002, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003,
+ 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004, 0x0003, 0x0004,
+ 0x0003, 0x0004, 0x0003, 0x0004
};
diff --git a/examples/mapViewer/source/asset/map.h b/examples/mapViewer/source/asset/map.h
index 14c7f28..2e82013 100644
--- a/examples/mapViewer/source/asset/map.h
+++ b/examples/mapViewer/source/asset/map.h
@@ -3,12 +3,15 @@
#define mapPaletteLength 256
extern const unsigned short mapPalette[256];
-#define mapTileSetLength 288
-extern const unsigned short mapTileSet[288];
+#define mapTileSetLength 544
+extern const unsigned short mapTileSet[544];
#define mapTerrainMapLength 16
extern const unsigned short mapTerrainMap[16];
+#define mapObjectsLength 20
+extern const unsigned short mapObjects[20];
+
#define mapTileMap0Length 1024
extern const unsigned short mapTileMap0[1024];
diff --git a/src/gba/gbaMap/gbaMap.cpp b/src/gba/gbaMap/gbaMap.cpp
index 9fb3d60..448cfa3 100644
--- a/src/gba/gbaMap/gbaMap.cpp
+++ b/src/gba/gbaMap/gbaMap.cpp
@@ -23,6 +23,10 @@ void GBAMap::setTerrainMap(vector &bytes) {
d_terrainMap = bytes;
}
+void GBAMap::addObjects(vector &bytes) {
+ d_objects = bytes;
+}
+
void GBAMap::setSize(unsigned mapWidth, unsigned mapHeight) {
auto widthFlag = (uint16_t) (mapWidth == GBA_MAP_SIZE ? 0 : 1);
auto heightFlag = (uint16_t) (mapHeight == GBA_MAP_SIZE ? 0 : 1);
@@ -42,6 +46,9 @@ void GBAMap::toCode(ostream &headerFile, ostream &codeFile) {
makeArrayDeclaration(headerFile, d_name + TERRAIN_MAP_NAME, d_terrainMap);
makeArrayDefinition(codeFile, d_name + TERRAIN_MAP_NAME, d_terrainMap);
+ makeArrayDeclaration(headerFile, d_name + OBJECTS_NAME, d_objects);
+ makeArrayDefinition(codeFile, d_name + OBJECTS_NAME, d_objects);
+
for (int index = 0; index < d_tileLayers.size(); index++) {
auto tileLayer = d_tileLayers[index];
makeArrayDeclaration(headerFile, d_name + TILE_MAP_NAME + to_string(index), tileLayer);
diff --git a/src/gba/gbaMap/gbaMap.hpp b/src/gba/gbaMap/gbaMap.hpp
index 4a826c9..5ff9644 100644
--- a/src/gba/gbaMap/gbaMap.hpp
+++ b/src/gba/gbaMap/gbaMap.hpp
@@ -51,6 +51,12 @@ class GBAMap {
*/
void addTileLayer(vector &bytes);
+ /**
+ * Add a collection of objects to the map.
+ * @param bytes The objects in byte data.
+ */
+ void addObjects(vector &bytes);
+
/**
* Convert the map data to C code.
* @param headerFile The header file to store declarations in.
@@ -83,11 +89,12 @@ class GBAMap {
const char *TILE_SET_NAME = "TileSet";
const char *TILE_MAP_NAME = "TileMap";
const char *TERRAIN_MAP_NAME = "TerrainMap";
+ const char *OBJECTS_NAME = "Objects";
const uint16_t PADDING_16_BIT = 0x0000;
uint16_t d_sizeFlag;
- vector d_palette, d_tileSet, d_terrainMap;
+ vector d_palette, d_tileSet, d_terrainMap, d_objects;
vector> d_tileLayers;
string d_name;
diff --git a/src/mapConverter/mapConverter.cpp b/src/mapConverter/mapConverter.cpp
index 54b746a..a1bb384 100644
--- a/src/mapConverter/mapConverter.cpp
+++ b/src/mapConverter/mapConverter.cpp
@@ -3,6 +3,7 @@
#include "tileLayerConverter/tileLayerConverter.hpp"
#include "../log/logger.hpp"
#include "../gba/background.h"
+#include "objectLayerConverter/objectLayerConverter.hpp"
#include
GBAMap MapConverter::convert(const string &name, const tmx::Map &tmxMap) {
@@ -28,8 +29,8 @@ GBAMap MapConverter::convert(const string &name, const tmx::Map &tmxMap) {
unsigned gbaWidth = mapSize.x * tileSize.x / GBA_TILE_SIZE;
unsigned gbaHeight = mapSize.y * tileSize.y / GBA_TILE_SIZE;
- if (gbaWidth != GBA_MAP_SIZE && gbaWidth != GBA_MAP_SIZE * 2 ||
- gbaHeight != GBA_MAP_SIZE && gbaHeight != GBA_MAP_SIZE * 2) {
+ if ((gbaWidth != GBA_MAP_SIZE && gbaWidth != GBA_MAP_SIZE * 2) ||
+ (gbaHeight != GBA_MAP_SIZE && gbaHeight != GBA_MAP_SIZE * 2)) {
log(ERROR, "The map width and height must be either " + to_string(GBA_MAP_SIZE) +
" or " + to_string(GBA_MAP_SIZE * 2) +
" tiles large (when subdivided to GBA-sized tiles of "
@@ -78,11 +79,19 @@ GBAMap MapConverter::convert(const string &name, const tmx::Map &tmxMap) {
auto *tileLayerConverter = new TileLayerConverter(tileSet.getFirstGID());
for (const auto& tileLayer : tileLayers) {
- log(INFO, "Converting layer '" + tileLayer->getName() + "'.");
+ log(INFO, "Converting tile layer '" + tileLayer->getName() + "'.");
auto tileLayerBytes = tileLayerConverter->convert(tileLayer, mapSize.x, mapSize.y, tileSize.x);
gbaMap.addTileLayer(tileLayerBytes);
}
+ const auto objectLayers = getObjectLayers(layers);
+ auto *objectLayerConverter = new ObjectLayerConverter();
+ for (const auto& objectLayer : objectLayers) {
+ log(INFO, "Converting object layer '" + objectLayer->getName() + "'.");
+ auto objectLayerBytes = objectLayerConverter->convert(objectLayer);
+ gbaMap.addObjects(objectLayerBytes);
+ }
+
return gbaMap;
}
diff --git a/src/mapConverter/stringConverter/stringConverter.cpp b/src/mapConverter/stringConverter/stringConverter.cpp
index 7b7a156..ece0476 100644
--- a/src/mapConverter/stringConverter/stringConverter.cpp
+++ b/src/mapConverter/stringConverter/stringConverter.cpp
@@ -2,28 +2,38 @@
#include "stringConverter.hpp"
vector StringConverter::convert(const string &text) {
+ const char* byteArray = text.c_str();
+ const char* paddedByteArray = createPaddedByteArray(byteArray);
+ auto numBytes = getByteArraySize(paddedByteArray);
vector bytes;
- string paddedText = paddString(text);
- auto numStringBytes = paddedText.length() + 1;
-
- char characters[numStringBytes];
- strcpy(characters, paddedText.c_str());
-
- for (unsigned index = 0; index < numStringBytes; index += 2) {
- auto mergedChar = (uint16_t) characters[index];
- mergedChar |= (uint16_t) characters[index+1] << 8;
+ for (unsigned index = 0; index < numBytes; index += 2) {
+ auto mergedChar = (uint16_t) paddedByteArray[index] << 8;
+ mergedChar |= (uint16_t) paddedByteArray[index+1];
bytes.push_back(mergedChar);
}
return bytes;
}
-string StringConverter::paddString(string text) {
- auto numStringBytes = text.length() + 1;
- auto remainingBytes = 4 - numStringBytes % 4;
- string appendedText = text;
- appendedText.append(remainingBytes, ' ');
+const char* StringConverter::createPaddedByteArray(const char* byteArray) {
+ auto numBytes = getByteArraySize(byteArray);
+ unsigned remainingBytes = getAlignmentOffset(numBytes);
+ unsigned numBytesPadded = numBytes + remainingBytes;
+ char* paddedByteArray = new char[numBytesPadded];
+
+ for (unsigned index = 0; index < numBytes; index++)
+ paddedByteArray[index] = byteArray[index];
+ for (unsigned index = numBytes; index < numBytesPadded; index++)
+ paddedByteArray[index] = '\0';
+
+ return paddedByteArray;
+}
+
+unsigned StringConverter::getByteArraySize(const char *byteArray) {
+ return (unsigned) strlen(byteArray) + 1;
+}
- return appendedText;
+unsigned StringConverter::getAlignmentOffset(unsigned size) {
+ return sizeof(uint32_t) - size % sizeof(uint32_t);
}
\ No newline at end of file
diff --git a/src/mapConverter/stringConverter/stringConverter.hpp b/src/mapConverter/stringConverter/stringConverter.hpp
index a9e7220..8c38a04 100644
--- a/src/mapConverter/stringConverter/stringConverter.hpp
+++ b/src/mapConverter/stringConverter/stringConverter.hpp
@@ -13,13 +13,16 @@ class StringConverter {
public:
/**
* Convert a string into a vector of 2-byte values.
+ * It adds null characters to the vector in order preserve proper 32-bit alignment.
* @param text The text to convert.
* @return A vector of 2-byte values.
*/
vector convert(const string &text);
private:
- string paddString(string text);
+ const char* createPaddedByteArray(const char* byteArray);
+ unsigned getByteArraySize(const char* byteArray);
+ unsigned getAlignmentOffset(unsigned size);
};
#endif
\ No newline at end of file
From d3f1994c2cdcaa949031c3207ca48e07af36473d Mon Sep 17 00:00:00 2001
From: Luc van den Brand <10974297+LucvandenBrand@users.noreply.github.com>
Date: Sun, 30 Sep 2018 17:25:43 +0200
Subject: [PATCH 05/25] Increased object id size, because it plays nicer with
alignments.
---
examples/mapViewer/source/asset/map.c | 6 +++---
examples/mapViewer/source/asset/map.h | 4 ++--
.../objectLayerConverter/objectLayerConverter.cpp | 7 +++++--
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/examples/mapViewer/source/asset/map.c b/examples/mapViewer/source/asset/map.c
index 1d90455..873bef5 100644
--- a/examples/mapViewer/source/asset/map.c
+++ b/examples/mapViewer/source/asset/map.c
@@ -64,9 +64,9 @@ const unsigned short mapTerrainMap[16] = {
0x0000
};
-const unsigned short mapObjects[20] = {
- 0x0004, 0x4261, 0x6c6c, 0x2053, 0x7061, 0x776e, 0x0000, 0x5265, 0x6400, 0x0005, 0x426c, 0x6f63, 0x6b4f, 0x626a, 0x6563,
- 0x7400, 0x466c, 0x6f61, 0x7479, 0x0000
+const unsigned short mapObjects[22] = {
+ 0x0000, 0x0004, 0x4261, 0x6c6c, 0x2053, 0x7061, 0x776e, 0x0000, 0x5265, 0x6400, 0x0000, 0x0005, 0x426c, 0x6f63, 0x6b4f,
+ 0x626a, 0x6563, 0x7400, 0x466c, 0x6f61, 0x7479, 0x0000
};
const unsigned short mapTileMap0[1024] = {
diff --git a/examples/mapViewer/source/asset/map.h b/examples/mapViewer/source/asset/map.h
index 2e82013..25775ed 100644
--- a/examples/mapViewer/source/asset/map.h
+++ b/examples/mapViewer/source/asset/map.h
@@ -9,8 +9,8 @@ extern const unsigned short mapTileSet[544];
#define mapTerrainMapLength 16
extern const unsigned short mapTerrainMap[16];
-#define mapObjectsLength 20
-extern const unsigned short mapObjects[20];
+#define mapObjectsLength 22
+extern const unsigned short mapObjects[22];
#define mapTileMap0Length 1024
extern const unsigned short mapTileMap0[1024];
diff --git a/src/mapConverter/objectLayerConverter/objectLayerConverter.cpp b/src/mapConverter/objectLayerConverter/objectLayerConverter.cpp
index 2074bee..5dc04da 100644
--- a/src/mapConverter/objectLayerConverter/objectLayerConverter.cpp
+++ b/src/mapConverter/objectLayerConverter/objectLayerConverter.cpp
@@ -18,8 +18,11 @@ vector ObjectLayerConverter::convert(const vector &object
vector ObjectLayerConverter::convert(const tmx::Object &object) {
vector bytes;
- auto id = (uint16_t) object.getUID();
- bytes.push_back(id);
+ uint32_t id = object.getUID();
+ auto higherId = (uint16_t) (id << 16);
+ bytes.push_back(higherId);
+ auto lowerId = (uint16_t) id;
+ bytes.push_back(lowerId);
StringConverter stringConverter;
vector nameBytes = stringConverter.convert(object.getName());
From 54fc2166916ea3c77eb8b05f9f5d50ca12519040 Mon Sep 17 00:00:00 2001
From: Luc van den Brand <10974297+LucvandenBrand@users.noreply.github.com>
Date: Sun, 30 Sep 2018 17:57:18 +0200
Subject: [PATCH 06/25] Fixed string padding error and added multiple obj layer
support.
---
examples/assets/size16-terrain-objects/map.tmx | 7 ++++++-
examples/mapViewer/source/asset/map.c | 7 ++++---
examples/mapViewer/source/asset/map.h | 4 ++--
src/gba/gbaMap/gbaMap.cpp | 2 +-
src/mapConverter/stringConverter/stringConverter.cpp | 1 +
5 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/examples/assets/size16-terrain-objects/map.tmx b/examples/assets/size16-terrain-objects/map.tmx
index 09666f1..11d362b 100644
--- a/examples/assets/size16-terrain-objects/map.tmx
+++ b/examples/assets/size16-terrain-objects/map.tmx
@@ -1,6 +1,11 @@
-