summaryrefslogtreecommitdiff
path: root/extractor/grf.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2025-01-17 22:09:25 +0100
committerDaniel Weipert <git@mail.dweipert.de>2025-01-17 22:09:25 +0100
commitbd77c88efc9327805b6f6fd83fa0492ed59d0f9a (patch)
tree99ed473ec1c137b774bd5e2a0e2bca9e56daf691 /extractor/grf.gd
parente8f03c4d6a94aa16b3587bdce525cf0cf7c6c6c3 (diff)
next commitHEADmain
Diffstat (limited to 'extractor/grf.gd')
-rw-r--r--extractor/grf.gd14
1 files changed, 6 insertions, 8 deletions
diff --git a/extractor/grf.gd b/extractor/grf.gd
index 84918de..fd0e6f7 100644
--- a/extractor/grf.gd
+++ b/extractor/grf.gd
@@ -203,13 +203,6 @@ func extract(destination: String = "user://client_data"):
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)
@@ -237,8 +230,13 @@ func convert(destination: String = "res://client_data"):
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])
+ var texture_image := texture.get_image()
+ texture_image.decompress()
var image := BMPTexture.convert_image(
- Image.load_from_file("%s/%s" % [destination, file_path]),
+ texture_image,
[Color.MAGENTA]
)
image.save_png("%s/%s" % [destination, file_path.replace(".bmp", ".png")])