Rotate envmaps to be consistent with vanilla (#636)

* Start work on envmap rotation stuff

* n64graphic envmap rotation working

* Add comment to rotation function

* Fix DLs of non 32x32 env maps, fix envmap rotation

* fix metal flying vanish cap

* fix metal mario's medium poly butt

* new asset version for flipped env maps

* added missing env textures to extract script

* restore asset_needs_update

* Skip asset_needs_update calls if local version matches new version

* removed the goddard textures from envmap rotation

---------

Co-authored-by: mineqwerty <mineqwerty25@gmail.com>
Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com>
This commit is contained in:
Gregory Heskett
2023-09-18 09:10:56 -04:00
committed by GitHub
parent 8a83359ed1
commit ab0cebab7a
7 changed files with 126 additions and 49 deletions

View File

@@ -6,6 +6,19 @@ import subprocess
from tools.detect_baseroms import get_rom_candidates
envmap_table = set([
"actors/mario/mario_metal.rgba16.png",
"actors/mario_cap/mario_cap_metal.rgba16.png",
"actors/star/star_surface.rgba16.png",
"actors/water_bubble/water_bubble.rgba16.png",
"actors/water_ring/water_ring.rgba16.png",
"levels/castle_inside/29.rgba16.png",
"levels/castle_inside/30.rgba16.png",
"levels/hmc/7.rgba16.png",
"levels/castle_inside/16.ia16.png",
"levels/cotmc/2.rgba16.png"
])
def read_asset_map():
with open("assets.json") as f:
ret = json.load(f)
@@ -20,6 +33,26 @@ def read_local_asset_list(f):
ret.append(line.strip())
return ret
def asset_needs_update(asset, version):
if version <= 7 and asset in envmap_table:
return True
if version <= 6 and asset in ["actors/king_bobomb/king_bob-omb_eyes.rgba16.png", "actors/king_bobomb/king_bob-omb_hand.rgba16.png"]:
return True
if version <= 5 and asset == "textures/spooky/bbh_textures.00800.rgba16.png":
return True
if version <= 4 and asset in ["textures/mountain/ttm_textures.01800.rgba16.png", "textures/mountain/ttm_textures.05800.rgba16.png"]:
return True
if version <= 3 and asset == "textures/cave/hmc_textures.01800.rgba16.png":
return True
if version <= 2 and asset == "textures/inside/inside_castle_textures.09000.rgba16.png":
return True
if version <= 1 and asset.endswith(".m64"):
return True
if version <= 0 and asset.endswith(".aiff"):
return True
return False
def remove_file(fname):
os.remove(fname)
print("deleting", fname)
@@ -44,7 +77,7 @@ def clean_assets(local_asset_file):
def main():
# In case we ever need to change formats of generated files, we keep a
# revision ID in the local asset file.
new_version = 7
new_version = 8
try:
local_asset_file = open(".assets-local.txt")
@@ -117,7 +150,7 @@ def main():
todo = defaultdict(lambda: [])
for (asset, data, exists) in all_assets:
# Leave existing assets alone if they have a compatible version.
if exists:
if exists and not (local_version == new_version or asset_needs_update(asset, local_version)):
continue
meta = data[:-2]
@@ -226,6 +259,9 @@ def main():
check=True,
)
else:
rotate_envmap = "false"
if asset in envmap_table:
rotate_envmap = "true"
w, h = meta
fmt = asset.split(".")[-2]
subprocess.run(
@@ -241,6 +277,8 @@ def main():
str(w),
"-h",
str(h),
"-r",
rotate_envmap,
],
check=True,
)