Skip to content

Commit 9b67ad5

Browse files
committed
Fixed previous bmp -> png commit.
1 parent 3361793 commit 9b67ad5

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

ConversionRules/Images.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,4 +186,5 @@
186186
"Base.rte/Actors/Doors/MotorGibC.bmp": "Base.rte/Scenes/Objects/Bunkers/BunkerSystems/Doors/Gibs/MotorGibC.png",
187187
"Dummy.rte/Devices/Sprites/ShieldWall.bmp": "Base.rte/Null.png",
188188
"Dummy.rte/Devices/Sprites/ShieldWallDent.bmp": "Base.rte/Null.png",
189+
"Base.rte/Effects/Pyro/FirePuff0.bmp": "Base.rte/Effects/Pyro/FirePuff.png",
189190
}

Python/convert.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,13 @@ def create_converted_file(input_file_path, output_file_path, input_folder_path):
119119
for line in file_in:
120120
line_number += 1
121121

122+
for old_str, new_str in conversion_rules.items():
123+
line = line.replace(old_str, new_str)
124+
125+
if ".bmp" in line:
126+
if not any(keep_bmp in line for keep_bmp in ["palette.bmp", "palettemat.bmp"]):
127+
line = line.replace(".bmp", ".png")
128+
122129
if warnings.warnings_available:
123130
regex_rules.playsound_warning(line, file_path, line_number)
124131

@@ -130,11 +137,8 @@ def create_converted_file(input_file_path, output_file_path, input_folder_path):
130137

131138
all_lines = "".join(all_lines_list)
132139

133-
for old_str, new_str in conversion_rules.items():
134-
all_lines = all_lines.replace(old_str, new_str)
135-
136140
all_lines = regex_rules.regex_replace(all_lines)
137-
file_out.write(regex_rules.regex_replace_bmps_and_wavs(all_lines))
141+
file_out.write(regex_rules.regex_replace_wavs(all_lines))
138142
# except:
139143
# shutil.copyfile(input_file_path, output_file_path)
140144

Python/regex_rules.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,8 @@ def regex_use_capture(all_lines, pattern, replacement, matches):
7474
# # AudioMan:PlaySound("ModName.rte/Folder/SoundName.wav", self.Pos) -- Cut everything and leave the thing inside the brackets after SceneMan:TargetDistanceScalar
7575

7676

77-
def regex_replace_bmps_and_wavs(all_lines):
78-
# TODO: Combine these four patterns into two.
79-
all_lines = specific_replace(all_lines, regex_use_capture, False, "Base\.rte(.*?)\.bmp", "Base.rte{}.png")
80-
all_lines = specific_replace(all_lines, regex_use_capture, False, "base\.rte(.*?)\.bmp", "Base.rte{}.png")
77+
def regex_replace_wavs(all_lines):
78+
# TODO: Combine patterns into one.
8179
all_lines = specific_replace(all_lines, regex_use_capture, False, "Base\.rte(.*?)\.wav", "Base.rte{}.flac")
8280
all_lines = specific_replace(all_lines, regex_use_capture, False, "base\.rte(.*?)\.wav", "Base.rte{}.flac")
8381
return all_lines

0 commit comments

Comments
 (0)