summaryrefslogtreecommitdiff
path: root/extractor/grf.gd
diff options
context:
space:
mode:
Diffstat (limited to 'extractor/grf.gd')
-rw-r--r--extractor/grf.gd39
1 files changed, 39 insertions, 0 deletions
diff --git a/extractor/grf.gd b/extractor/grf.gd
index 08f72ee..e2a3c82 100644
--- a/extractor/grf.gd
+++ b/extractor/grf.gd
@@ -219,14 +219,19 @@ func convert(destination: String = "res://client_data"):
#DirAccess.make_dir_recursive_absolute(base_file_directory_path)
+
+ # Sprite.spr and Action.act
+
var player_head_path_part = "¸Ó¸®Åë"
var player_body_path_part = "¸öÅë"
if file_path.ends_with(".spr") and file_path.contains(player_head_path_part):
+ continue
var sprite = SpriteFormat.from_bytes(file_entry.get_contents(file_access))
sprite.save_to_file(base_file_directory_path)
elif file_path.ends_with(".act") and file_path.contains(player_head_path_part):
+ continue
if not FileAccess.file_exists("%s/000.png.import" % base_file_directory_path):
continue
@@ -409,6 +414,40 @@ func convert(destination: String = "res://client_data"):
# TODO: doesn't work if png is not imported via editor focus => run game twice
ResourceSaver.save(scene, "%s/actions.tscn" % base_file_directory_path)
+
+
+ # Map.rsw and .gnd and .gat
+
+ if file_path.ends_with(".rsw") and file_path.contains("pay_dun"):
+ var rsw = RSWFormat.from_bytes(ByteStream.from_bytes(file_entry.get_contents(file_access)))
+
+ var gnd_file_path = "res://client_data/data/%s" % rsw.gnd_file
+ var gnd = GNDFormat.from_bytes(ByteStream.from_bytes(FileAccess.get_file_as_bytes(gnd_file_path)))
+
+ var gat_file_path = "res://client_data/data/%s" % rsw.gat_file
+ var gat = GATFormat.from_bytes(ByteStream.from_bytes(FileAccess.get_file_as_bytes(gat_file_path)))
+
+ var scene := PackedScene.new()
+ var scene_root := Node3D.new()
+ scene_root.name = file_name
+
+ for resource in rsw.map_resources:
+ if resource is RSWFormat.SpatialAudioSource:
+ var audio_file_path := "res://client_data/data/wav/%s" % resource.audio_file
+ if not FileAccess.file_exists(audio_file_path):
+ continue
+
+ var audio = AudioStreamPlayer3D.new()
+ audio.stream = load(audio_file_path)
+ audio.name = resource.audio_file
+ audio.position = resource.get_position()
+ audio.volume_linear = resource.volume_gain
+ audio.max_distance = resource.audio_range
+ scene_root.add_child(audio, true)
+ audio.owner = scene_root
+
+ scene.pack(scene_root)
+ ResourceSaver.save(scene, "%s/%s/%s.tscn" % [destination, base_directory_path, file_name])
static func decode_string(bytes: PackedByteArray):