fix subtitle loading

This commit is contained in:
Anthony Samms
2025-12-20 14:57:04 -05:00
parent d10c76fc2e
commit af227e0303
2 changed files with 18 additions and 5 deletions

View File

@@ -412,11 +412,12 @@ class YellowBox:
self.is_back = is_back
self.tja = tja
if self.tja is not None:
subtitle_text = self.tja.metadata.subtitle.get(global_data.config['general']['language'], '')
subtitle_text = self.tja.metadata.subtitle.get(global_data.config['general']['language'], self.tja.metadata.subtitle.get('en', ''))
font_size = tex.skin_config["yb_subtitle"].font_size if len(subtitle_text) < 30 else tex.skin_config["yb_subtitle"].font_size - int(10 * tex.screen_scale)
self.subtitle = OutlinedText(subtitle_text, font_size, ray.WHITE, outline_thickness=5, vertical=True)
else:
self.subtitle = None
self.is_dan = is_dan
self.subtitle = None
self.left_out = tex.get_animation(9)
self.right_out = tex.get_animation(10)

View File

@@ -25,6 +25,9 @@ class SkinInfo:
self.height = height
self.font_size = font_size
def __repr__(self):
return f"{self.__dict__}"
class Texture:
"""Texture class for managing textures and animations."""
def __init__(self, name: str, texture: Any, init_vals: dict[str, int]):
@@ -55,6 +58,9 @@ class Texture:
self.y2: list[int] = [self.height]
self.controllable: list[bool] = [False]
def __repr__(self):
return f"{self.__dict__}"
class TextureWrapper:
"""Texture wrapper class for managing textures and animations."""
def __init__(self):
@@ -188,9 +194,15 @@ class TextureWrapper:
with parent_zip_ref.open('texture.json') as json_file:
tex_mapping_data = json.loads(json_file.read().decode('utf-8'))
for tex_map in tex_mapping_data:
for key in tex_mapping_data[tex_map]:
if key in ["x", "y", "x2", "y2"]:
tex_mapping_data[tex_map][key] = tex_mapping_data[tex_map][key] * self.screen_scale
if isinstance(tex_mapping_data[tex_map], list):
for index, item in enumerate(tex_mapping_data[tex_map]):
for key in item:
if key in ["x", "y", "x2", "y2"]:
tex_mapping_data[tex_map][index][key] = tex_mapping_data[tex_map][index][key] * self.screen_scale
else:
for key in tex_mapping_data[tex_map]:
if key in ["x", "y", "x2", "y2"]:
tex_mapping_data[tex_map][key] = tex_mapping_data[tex_map][key] * self.screen_scale
texture_json_source = "parent"
else:
raise Exception(f"texture.json file missing from both {zip_path} and {parent_zip_path}")