diff --git a/CMakeLists.txt b/CMakeLists.txt
index e3c55a3..e5745f6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -72,6 +72,7 @@ set(ASSETS_cg
set(ASSETS_cg_EGA64
assets-cg/ega64/tileset/tilesetEGA64_CG.png
+ assets-cg/ega64/tileset/tileset_inEGA64_CG.png
)
set(ASSETS_fx
@@ -86,6 +87,7 @@ set(ASSETS_fx
set(ASSETS_fx_1b
assets-fx/1b/tileset/tileset1b.png
+ assets-fx/1b/tileset/tileset_in1b.png
assets-fx/1b/npc/char/npc_male.png
assets-fx/1b/npc/char/npc_female.png
assets-fx/1b/npc/char/npc_milkman.png
@@ -100,6 +102,7 @@ set(ASSETS_fx_1b
set(ASSETS_fx_2b
assets-fx/2b/tileset/tileset2b.png
+ assets-fx/2b/tileset/tileset_in2b.png
assets-fx/2b/npc/char/npc_male.png
assets-fx/2b/npc/char/npc_female.png
assets-fx/2b/npc/char/npc_milkman.png
diff --git a/assets-cg/1b/tileset/fxconv-metadata.txt b/assets-cg/1b/tileset/fxconv-metadata.txt
deleted file mode 100644
index fad2b40..0000000
--- a/assets-cg/1b/tileset/fxconv-metadata.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-tileset1b_CG.png:
- type: bopti-image
- name: img_tilesetnpp
- profile: p8
diff --git a/assets-cg/1b/tileset/tileset1b_CG.png b/assets-cg/1b/tileset/tileset1b_CG.png
deleted file mode 100644
index 089c983..0000000
Binary files a/assets-cg/1b/tileset/tileset1b_CG.png and /dev/null differ
diff --git a/assets-cg/2b/sprites/SpriteTestCG2b.png b/assets-cg/2b/sprites/SpriteTestCG2b.png
deleted file mode 100644
index e709b04..0000000
Binary files a/assets-cg/2b/sprites/SpriteTestCG2b.png and /dev/null differ
diff --git a/assets-cg/2b/tileset/fxconv-metadata.txt b/assets-cg/2b/tileset/fxconv-metadata.txt
deleted file mode 100644
index 203e19f..0000000
--- a/assets-cg/2b/tileset/fxconv-metadata.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-tileset2b_CG.png:
- type: bopti-image
- name: img_tilesetnpp
- profile: p8
-
\ No newline at end of file
diff --git a/assets-cg/2b/tileset/tileset2b_CG.png b/assets-cg/2b/tileset/tileset2b_CG.png
deleted file mode 100644
index aa53e42..0000000
Binary files a/assets-cg/2b/tileset/tileset2b_CG.png and /dev/null differ
diff --git a/assets-cg/ega64/tileset/fxconv-metadata.txt b/assets-cg/ega64/tileset/fxconv-metadata.txt
index 15d8aeb..e8cdf0d 100644
--- a/assets-cg/ega64/tileset/fxconv-metadata.txt
+++ b/assets-cg/ega64/tileset/fxconv-metadata.txt
@@ -2,4 +2,8 @@ tilesetEGA64_CG.png:
type: bopti-image
name: img_tilesetnpp
profile: p8
-
\ No newline at end of file
+
+tileset_inEGA64_CG.png:
+ type: bopti-image
+ name: img_indoor
+ profile: p8
diff --git a/assets-fx/1b/tileset/fxconv-metadata.txt b/assets-fx/1b/tileset/fxconv-metadata.txt
index d5e87d6..9d175fc 100644
--- a/assets-fx/1b/tileset/fxconv-metadata.txt
+++ b/assets-fx/1b/tileset/fxconv-metadata.txt
@@ -2,3 +2,6 @@ tileset1b.png:
type: bopti-image
name: img_tilesetnpp
+tileset_in1b.png:
+ type: bopti-image
+ name: img_indoor
diff --git a/assets-fx/2b/tileset/fxconv-metadata.txt b/assets-fx/2b/tileset/fxconv-metadata.txt
index 2548038..4f2ab9a 100644
--- a/assets-fx/2b/tileset/fxconv-metadata.txt
+++ b/assets-fx/2b/tileset/fxconv-metadata.txt
@@ -1,3 +1,7 @@
tileset2b.png:
type: bopti-image
name: img_tilesetnpp
+
+tileset_in2b.png:
+ type: bopti-image
+ name: img_indoor
diff --git a/assets/converters.py b/assets/converters.py
index 63d6de5..2d267f9 100644
--- a/assets/converters.py
+++ b/assets/converters.py
@@ -28,6 +28,8 @@ from tinytiled import *
# If the output of the converter should be verbose.
VERBOSE = 1
+# The valid path objects.
+PATH_TYPES = ["polyline", "polygon"]
# The sign types, used to find the sign icon.
SIGN_TYPES = ["SGN", "INFO"]
# The NPC faces, used to find the face id.
@@ -71,6 +73,8 @@ def convert_map(input: str, output: str, params: dict, target):
signs = {}
portals = {}
+ indoor = 0
+
name = os.path.splitext(os.path.basename(input))[0]
map_struct = fxconv.Structure()
@@ -85,7 +89,7 @@ def convert_map(input: str, output: str, params: dict, target):
sys.stderr.write(f"ERROR: Failed to get the dialog file.\n"
+ f" Error message: {e}\n")
sys.exit(1)
-
+
# Get the map position
try:
if VERBOSE: print("INFO: Getting the map position")
@@ -97,7 +101,7 @@ def convert_map(input: str, output: str, params: dict, target):
sys.stderr.write(f"ERROR: Failed to get the map position.\n"
+ f" Error message: {e}\n")
sys.exit(1)
-
+
# Get informations about dialogs
try:
if VERBOSE: print("INFO: Getting informations about dialogs")
@@ -115,23 +119,43 @@ def convert_map(input: str, output: str, params: dict, target):
# Get the outdoor tileset
try:
if VERBOSE: print("INFO: Getting the outdoor tileset")
- outdoor_tileset = input_map.get_tileset_by_firstgid(1)
+ outdoor_tileset = input_map.get_tileset_by_name("tilesetnpp")
except Exception as e:
# Show a simple error message on failure.
sys.stderr.write(f"ERROR: Failed to get the outdoor tileset.\n"
+ f" Error message: {e}\n")
sys.exit(1)
-
+
# Get the walkable tileset
try:
if VERBOSE: print("INFO: Getting the walkable tileset")
- walkable_tileset = input_map.get_tileset_by_firstgid(409)
+ walkable_tileset = input_map.get_tileset_by_name("Walkable")
except Exception as e:
# Show a simple error message on failure.
sys.stderr.write(f"ERROR: Failed to get the walkable tileset.\n"
+ f" Error message: {e}\n")
sys.exit(1)
+ # Check if this is an indoor map
+ try:
+ if VERBOSE: print("INFO: Checking if it is an indoor map")
+ indoor = int(input_map.get_property("indoor"))
+ except Exception as e:
+ # Show a warning
+ print(f"WARNING: Indoor property not found.\n")
+
+ if indoor:
+ # Get the indoor tileset
+ try:
+ if VERBOSE: print("INFO: Getting the indoor tileset (it is an\n"
+ + " indoor map)")
+ indoor_tileset = input_map.get_tileset_by_name("indoor")
+ except Exception as e:
+ # Show a simple error message on failure.
+ sys.stderr.write(f"ERROR: Failed to get the indoor tileset.\n"
+ + f" Error message: {e}\n")
+ sys.exit(1)
+
# Get the background
try:
if VERBOSE: print("INFO: Getting the background layer")
@@ -141,7 +165,10 @@ def convert_map(input: str, output: str, params: dict, target):
height = bg_layer.get_height()
if VERBOSE: print(f"INFO: Map size: ({width}, {height}).")
# Get the layer data himself
- background_layer = bg_layer.get_data_with_tileset(outdoor_tileset)
+ if indoor:
+ background_layer = bg_layer.get_data_with_tileset(indoor_tileset)
+ else:
+ background_layer = bg_layer.get_data_with_tileset(outdoor_tileset)
# Check if the size of the layer data is correct.
if len(background_layer) != width*height:
raise Exception("Bad layer size!")
@@ -151,13 +178,16 @@ def convert_map(input: str, output: str, params: dict, target):
sys.stderr.write(f"ERROR: Failed to get the background layer.\n"
+ f" Error message: {e}\n")
sys.exit(1)
-
+
# Get the foreground
try:
if VERBOSE: print("INFO: Getting the foreground layer")
fg_layer = input_map.get_layer_by_name("Foreground")
# Get the layer data himself
- foreground_layer = fg_layer.get_data_with_tileset(outdoor_tileset)
+ if indoor:
+ foreground_layer = fg_layer.get_data_with_tileset(indoor_tileset)
+ else:
+ foreground_layer = fg_layer.get_data_with_tileset(outdoor_tileset)
# Check if the size of the layer data is correct.
if len(foreground_layer) != width*height:
raise Exception("Bad layer size!")
@@ -167,7 +197,7 @@ def convert_map(input: str, output: str, params: dict, target):
sys.stderr.write(f"ERROR: Failed to get the foreground layer.\n"
+ f" Error message: {e}\n")
sys.exit(1)
-
+
# Get the walkable layer
try:
if VERBOSE: print("INFO: Getting the walkable layer")
@@ -190,7 +220,7 @@ def convert_map(input: str, output: str, params: dict, target):
ed_objgroup = input_map.get_objectgroup_by_name("ExtraData")
# Get the paths the NPCs take.
for object in ed_objgroup.objects:
- if object.get_data_type() == "polyline":
+ if object.get_data_type() in PATH_TYPES:
npc_paths[object.id] = object.get_data()
# Get the NPCs
for object in ed_objgroup.objects:
@@ -252,8 +282,14 @@ def convert_map(input: str, output: str, params: dict, target):
map_struct += fxconv.u32(width)
map_struct += fxconv.u32(height)
map_struct += fxconv.u32(3)
- map_struct += fxconv.u32(outdoor_tileset.columns)
- tileset_name = os.path.splitext(os.path.basename(outdoor_tileset.source))[0]
+ if indoor: map_struct += fxconv.u32(indoor_tileset.columns)
+ else: map_struct += fxconv.u32(outdoor_tileset.columns)
+ if indoor:
+ tileset_name = os.path.splitext(
+ os.path.basename(indoor_tileset.source))[0]
+ else:
+ tileset_name = os.path.splitext(
+ os.path.basename(outdoor_tileset.source))[0]
map_struct += fxconv.ref(f"img_{tileset_name}")
# Store the walkable layer
@@ -289,7 +325,7 @@ def convert_map(input: str, output: str, params: dict, target):
if x: xpath += fxconv.u16(n)
else: ypath += fxconv.u16(n)
x = not x
-
+
npc_struct += fxconv.ptr(xpath)
npc_struct += fxconv.ptr(ypath)
@@ -335,6 +371,7 @@ def convert_map(input: str, output: str, params: dict, target):
# separately.
dialog_name = os.path.splitext(os.path.basename(dialog_file))[0]
map_struct += fxconv.ref(f"_{dialog_name}")
+ map_struct += fxconv.u32(indoor)
# Store the background layer
background_data = bytes()
@@ -366,7 +403,7 @@ def convert_dialog(input: str, output: str, params: dict, target):
sys.stderr.write(f"ERROR: Failed parse json.\n"
+ f" Error message: {e}\n")
sys.exit(1)
-
+
# Create the dialog struct
dialog_struct = fxconv.Structure()
try:
diff --git a/assets/indoor.png b/assets/indoor.png
new file mode 120000
index 0000000..578ed8f
--- /dev/null
+++ b/assets/indoor.png
@@ -0,0 +1 @@
+../assets-fx/2b/tileset/tileset_in2b.png
\ No newline at end of file
diff --git a/assets/indoor.tsx b/assets/indoor.tsx
new file mode 100644
index 0000000..c5bbf05
--- /dev/null
+++ b/assets/indoor.tsx
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/assets/interior1_0.tmx b/assets/interior1_0.tmx
index cca09fa..ddb8fc0 100644
--- a/assets/interior1_0.tmx
+++ b/assets/interior1_0.tmx
@@ -1,54 +1,93 @@
-