diff options
Diffstat (limited to 'extractor/grf.gd')
-rw-r--r-- | extractor/grf.gd | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/extractor/grf.gd b/extractor/grf.gd index fd0e6f7..5b7046f 100644 --- a/extractor/grf.gd +++ b/extractor/grf.gd @@ -156,7 +156,7 @@ class FileEntry: var file_access: FileAccess -static func open(path: String): +static func open(path: String) -> GRF: var grf = GRF.new() grf.file_access = FileAccess.open(path, FileAccess.ModeFlags.READ) @@ -227,12 +227,17 @@ func convert(destination: String = "res://client_data"): # BMP if file_path.ends_with(".bmp"): + #continue if not FileAccess.file_exists("%s/%s" % [destination, file_path]): continue # load existing bmp files, so language specific overwrites are kept var texture: CompressedTexture2D = load("%s/%s" % [destination, file_path]) + if not texture: + # TODO: check if .godot/imported file is there (alrdy sufficient?) + continue + var texture_image := texture.get_image() texture_image.decompress() var image := BMPTexture.convert_image( @@ -241,18 +246,19 @@ func convert(destination: String = "res://client_data"): ) image.save_png("%s/%s" % [destination, file_path.replace(".bmp", ".png")]) + continue # Sprite.spr and Action.act - var player_head_path_part = "¸Ó¸®Åë" - var player_body_path_part = "¸öÅë" + var player_head_path_part = "머리통" + var player_body_path_part = "몸통" - if file_path.ends_with(".spr") and file_path.contains(player_head_path_part): + if file_path.ends_with(".spr"): #and (file_path.contains(player_head_path_part) or file_path.contains(player_body_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): #or file_path.contains(player_body_path_part): + elif file_path.ends_with(".act") and file_path.contains("cursors"): #and (file_path.contains(player_head_path_part) or file_path.contains(player_body_path_part)): #continue if not FileAccess.file_exists("%s/000.png.import" % base_file_directory_path): continue @@ -267,6 +273,7 @@ func convert(destination: String = "res://client_data"): ResourceSaver.save(scene, "%s/actions.tscn" % base_file_directory_path) + continue # Map.rsw and .gnd and .gat if file_path.ends_with(".rsw") and (file_path.contains("pay_dun") or file_path.contains("iz_int") or file_path.contains("int_land")): @@ -279,5 +286,9 @@ func convert(destination: String = "res://client_data"): static func decode_string(bytes: PackedByteArray): - # TODO: use iconv to decode EUC-KR - return bytes.get_string_from_ascii() + Engine.print_error_messages = false + var string := bytes.get_string_from_multibyte_char("EUC-KR") + Engine.print_error_messages = true + if string.is_empty(): + return bytes.get_string_from_ascii() + return string |