diff --git a/projects/blades-engine/Project.xml b/projects/blades-engine/Project.xml
index ad3d9d85..dca4e7cf 100644
--- a/projects/blades-engine/Project.xml
+++ b/projects/blades-engine/Project.xml
@@ -39,6 +39,8 @@
+
+
diff --git a/projects/blades-engine/source/Main.hx b/projects/blades-engine/source/Main.hx
index e35b40ae..f925cdf4 100644
--- a/projects/blades-engine/source/Main.hx
+++ b/projects/blades-engine/source/Main.hx
@@ -2,12 +2,15 @@ package;
import flixel.FlxGame;
import openfl.display.Sprite;
+import data.ScenData;
class Main extends Sprite
{
public function new()
{
+ var scenData = new ScenData();
+ scenData.load("Data/corescendata.txt");
super();
- addChild(new FlxGame(0, 0, IsometricMapState));
+ // addChild(new FlxGame(0, 0, IsometricMapState));
}
}
diff --git a/projects/blades-engine/source/data/FloorData.hx b/projects/blades-engine/source/data/FloorData.hx
new file mode 100644
index 00000000..6d6216aa
--- /dev/null
+++ b/projects/blades-engine/source/data/FloorData.hx
@@ -0,0 +1,79 @@
+package data;
+
+using Type;
+using Reflect;
+
+import flixel.input.keyboard.FlxKey;
+
+enum FloorShimmerType {
+ None;
+ LightToDark;
+ Water;
+}
+
+enum FloorSpecialProperty {
+ Nothing;
+
+ // For dice-based properties, special_strength is the size of the dice.
+ FireDamage2Dice;
+ ColdDamage2Dice;
+ MagicDamage2Dice;
+ PoisonLevels1Die50Percent;
+ DiseaseLevels1Die50Percent;
+
+ BlockedToNPCs;
+ NoRest;
+
+ // Call the scenario script with the number special_strength
+ CallScenarioScript;
+}
+
+class FloorData {
+ public function new() {}
+
+ public function clone():FloorData {
+ var fd = new FloorData();
+ for (field in FloorData.getClassFields()) {
+ fd.setField(field, this.field(field));
+ }
+ return fd;
+ }
+
+ public var name:String = "";
+ public var which_sheet:Int = 0;
+ public var which_icon:Int = 0;
+ public var icon_adjust:Int = 0;
+ public var ed_which_sheet:Int = 0;
+ public var ed_which_icon:Int = 0;
+ private var blocked:Int = 0;
+ public function isBlocked() {
+ return blocked == 1;
+ }
+ public var step_sound:Int = -1;
+ public var light_radius:Int = 0;
+ public var floor_height_pixels:Int = 0;
+ private var special_property:Int = 0;
+ public function specialProperty() {
+ return FloorSpecialProperty.createEnumIndex(special_property);
+ }
+ public var special_strength:Int = 0;
+ public var is_water:Bool = false;
+ public var is_floor:Bool = false;
+ public var is_ground:Bool = false;
+ public var is_rough:Bool = false;
+ public var fly_over:Bool = false;
+ private var shortcut_key:Int = -1;
+ public function shortcutKey() {
+ return if (shortcut_key == -1) {
+ NONE;
+ } else {
+ FlxKey.A + shortcut_key;
+ };
+ }
+ public var anim_steps:Int = 0;
+ private var shimmers:Int;
+ public function shimmerType() {
+ return FloorShimmerType.createEnumIndex(shimmers);
+ }
+ public var out_fight_town_used:Int = 1000;
+}
diff --git a/projects/blades-engine/source/data/ScenData.hx b/projects/blades-engine/source/data/ScenData.hx
new file mode 100644
index 00000000..a81d2e35
--- /dev/null
+++ b/projects/blades-engine/source/data/ScenData.hx
@@ -0,0 +1,82 @@
+package data;
+
+import hscript.Parser;
+import hscript.Interp;
+import sys.io.File;
+
+using StringTools;
+
+class ScenData {
+ public function new() {}
+
+ public var floorData:Map = [];
+
+ public function load(file:String) {
+ var scenDataLines = File.getContent(file).replace("\r", "\n").split("\n");
+ var parser = new Parser();
+ var interp = new Interp();
+
+ var defining = "";
+ var id = -1;
+ var data:Dynamic = null;
+ interp.variables["data"] = null;
+
+ function commitData() {
+ data = interp.variables["data"];
+ if (data == null) return;
+ trace(data);
+
+ switch (defining) {
+ case "floor":
+ floorData[id] = data;
+ default:
+ }
+ data = data.clone();
+ }
+ function clear(?type:String) {
+ if (type == null) type = defining;
+ data = switch (type) {
+ case "floor":
+ new FloorData();
+ default:
+ null;
+ };
+ }
+ function beginDefine(type, tid) {
+ commitData();
+
+ if (defining != type) {
+ clear(type);
+ }
+ interp.variables["data"] = data;
+
+ defining = type;
+ id = tid;
+ }
+ interp.variables["beginDefine"] = beginDefine;
+ interp.variables["beginscendatascript"] = null;
+ interp.variables["clear"] = clear;
+
+ for (line in scenDataLines) {
+ var commentIndex = line.indexOf("//");
+ if (commentIndex != -1) {
+ line = line.substr(0, commentIndex);
+ }
+ line = line.trim();
+ if (line.length > 0) {
+ if (line.startsWith("begindefine")) {
+ line = "beginDefine('" + line.replace("begindefine", "").replace(" ", "',").replace(";", ");");
+ } else if (line.startsWith("fl_")) {
+ line = line.replace("fl_", "data.");
+ } else if (line == "clear;") {
+ line = "clear();";
+ }
+ trace(line);
+ interp.execute(parser.parseString(line));
+ }
+ }
+
+ // Commit the last data object that was defined:
+ commitData();
+ }
+}