diff --git a/bemani/format/afp/swf.py b/bemani/format/afp/swf.py index f3c1418..dcde122 100644 --- a/bemani/format/afp/swf.py +++ b/bemani/format/afp/swf.py @@ -177,6 +177,18 @@ class AP2TextLine: } +class AP2DefineMorphShape(Tag): + def __init__(self, id: int) -> None: + # TODO: I need to figure out what morph shapes actually DO, and take the + # values that I parsed out store them here... + super().__init__(id) + + def as_dict(self, *args: Any, **kwargs: Any) -> Dict[str, Any]: + return { + **super().as_dict(*args, **kwargs), + } + + class AP2DefineTextTag(Tag): def __init__(self, id: int, lines: List[AP2TextLine]) -> None: super().__init__(id) @@ -185,6 +197,7 @@ class AP2DefineTextTag(Tag): def as_dict(self, *args: Any, **kwargs: Any) -> Dict[str, Any]: return { + **super().as_dict(*args, **kwargs), 'lines': [line.as_dict(*args, **kwargs) for line in self.lines], } @@ -1430,6 +1443,143 @@ class SWF(TrackedCoverage, VerboseOutput): default_text = None return AP2DefineEditTextTag(edit_text_id, defined_font_tag_id, font_height, rect, color, default_text=default_text) + elif tagid == AP2Tag.AP2_DEFINE_MORPH_SHAPE: + unk1, unk2, define_shape_id, _0x2c_count, _0x2e_count, another_count = struct.unpack("> 2) & 0x3}, Unk4-2: {(unk4 & 0x3)}") + + unprocessed_flags = flags + if flags & 0x1: + int1, int2 = struct.unpack("> 8) & 0xFF) / 255.0, + b=((rgba1 >> 16) & 0xFF) / 255.0, + a=((rgba1 >> 24) & 0xFF) / 255.0, + ) + + color2 = Color( + r=(rgba2 & 0xFF) / 255.0, + g=((rgba2 >> 8) & 0xFF) / 255.0, + b=((rgba2 >> 16) & 0xFF) / 255.0, + a=((rgba2 >> 24) & 0xFF) / 255.0, + ) + + self.vprint(f"{prefix} Start Color: {color1}, End Color: {color2}") + + if flags & 0x8: + a1, d1, a2, d2, b1, c1, b2, c2, tx1, ty1, tx2, ty2 = struct.unpack("