diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2025-01-14 14:38:52 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2025-01-14 14:38:52 +0100 |
commit | e8f03c4d6a94aa16b3587bdce525cf0cf7c6c6c3 (patch) | |
tree | d8d5a78a0872b86c3b40089e465120883669542b /extractor/grf.gd | |
parent | b75cc72c4e10bd652330b6d2bd99f3fd9129a3b3 (diff) |
next commit
Diffstat (limited to 'extractor/grf.gd')
-rw-r--r-- | extractor/grf.gd | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/extractor/grf.gd b/extractor/grf.gd index a723fdc..84918de 100644 --- a/extractor/grf.gd +++ b/extractor/grf.gd @@ -190,17 +190,29 @@ static func open(path: String): return grf +signal extracted_file(index: int) + func extract(destination: String = "user://client_data"): DirAccess.make_dir_recursive_absolute(destination) - for file_entry in file_entries: + for idx in file_entries.size(): + var file_entry := file_entries[idx] var file_path: String = file_entry.get_file_path() var base_directory = DirAccess.open(destination) base_directory.make_dir_recursive(file_path.get_base_dir()) var file = FileAccess.open("%s/%s" % [destination, file_path], FileAccess.WRITE_READ) + + #if file_path.ends_with(".bmp"): + #var img := Image.create_empty(1, 1, false, Image.FORMAT_RGBA8) + #img.load_bmp_from_buffer(file_entry.get_contents(file_access)) + #img.save_png(file.get_path()) + #return + #else: file.store_buffer(file_entry.get_contents(file_access)) + + extracted_file.emit(idx) func convert(destination: String = "res://client_data"): @@ -220,6 +232,18 @@ func convert(destination: String = "res://client_data"): #DirAccess.make_dir_recursive_absolute(base_file_directory_path) + # BMP + if file_path.ends_with(".bmp"): + if not FileAccess.file_exists("%s/%s" % [destination, file_path]): + continue + + var image := BMPTexture.convert_image( + Image.load_from_file("%s/%s" % [destination, file_path]), + [Color.MAGENTA] + ) + image.save_png("%s/%s" % [destination, file_path.replace(".bmp", ".png")]) + + continue # Sprite.spr and Action.act var player_head_path_part = "¸Ó¸®Åë" |