Fix additional type issues caught by mypyc
This commit is contained in:
parent
490c68b86c
commit
b380ad7786
@ -89,6 +89,7 @@ def process_tja_commands(tja: TJACourse) \
|
||||
# measure in those cases.)
|
||||
elif data.name in ['bpm', 'scroll', 'gogo']:
|
||||
# Parse the values
|
||||
new_val: bool | float
|
||||
if data.name == 'bpm':
|
||||
new_val = current_bpm = float(data.value)
|
||||
elif data.name == 'scroll':
|
||||
@ -193,7 +194,7 @@ def convert_tja_to_fumen(tja: TJACourse) -> FumenCourse:
|
||||
continue
|
||||
branch_points_total = 0
|
||||
branch_points_measure = 0
|
||||
current_drumroll = None
|
||||
current_drumroll = FumenNote()
|
||||
current_levelhold = False
|
||||
branch_types: list[str] = []
|
||||
branch_conditions: list[tuple[float, float]] = []
|
||||
@ -281,7 +282,7 @@ def convert_tja_to_fumen(tja: TJACourse) -> FumenCourse:
|
||||
|
||||
# Handle '8' notes (end of a drumroll/balloon)
|
||||
if data.value == "EndDRB":
|
||||
if not isinstance(current_drumroll, FumenNote):
|
||||
if not current_drumroll.note_type:
|
||||
raise ValueError(
|
||||
"'8' note encountered without matching "
|
||||
"drumroll/balloon/kusudama note."
|
||||
@ -299,13 +300,13 @@ def convert_tja_to_fumen(tja: TJACourse) -> FumenCourse:
|
||||
current_drumroll.duration = float(int(
|
||||
current_drumroll.duration
|
||||
))
|
||||
current_drumroll = None
|
||||
current_drumroll = FumenNote()
|
||||
continue
|
||||
|
||||
# The TJA spec technically allows you to place
|
||||
# double-Kusudama notes. But this is unsupported in
|
||||
# fumens, so just skip the second Kusudama note.
|
||||
if data.value == "Kusudama" and current_drumroll:
|
||||
if data.value == "Kusudama" and current_drumroll.note_type:
|
||||
continue
|
||||
|
||||
# Handle note metadata
|
||||
@ -349,7 +350,7 @@ def convert_tja_to_fumen(tja: TJACourse) -> FumenCourse:
|
||||
measure_fumen.branches[current_branch].length += 1
|
||||
|
||||
# If drumroll hasn't ended by this measure, increase duration
|
||||
if current_drumroll:
|
||||
if current_drumroll.note_type:
|
||||
# If drumroll spans multiple measures, add full duration
|
||||
if current_drumroll.multimeasure:
|
||||
current_drumroll.duration += measure_fumen.duration
|
||||
|
@ -198,8 +198,9 @@ def parse_tja_course_data(course: TJACourse) -> None:
|
||||
command, name, value, note_data = '', '', '', ''
|
||||
match_command = re.match(r"^#([A-Z]+)(?:\s+(.+))?", line)
|
||||
if match_command:
|
||||
command, value = match_command.groups()
|
||||
value = '' if value is None else value
|
||||
command = match_command.group(1)
|
||||
if match_command.group(2):
|
||||
value = match_command.group(2)
|
||||
else:
|
||||
note_data = line # If not a command, then line must be note data
|
||||
|
||||
|
@ -87,7 +87,7 @@ class FumenNote:
|
||||
pos: float = 0.0
|
||||
score_init: int = 0
|
||||
score_diff: int = 0
|
||||
padding: int = 0
|
||||
padding: float = 0.0
|
||||
item: int = 0
|
||||
duration: float = 0.0
|
||||
multimeasure: bool = False
|
||||
@ -225,8 +225,9 @@ class FumenMeasure:
|
||||
class FumenHeader:
|
||||
"""Contains all the byte values for a Fumen chart file's header."""
|
||||
order: str = "<"
|
||||
b000_b431_timing_windows: list[float] = field(default_factory=lambda:
|
||||
[25.025, 75.075, 108.422]*36)
|
||||
b000_b431_timing_windows: tuple[float, ...] = field(
|
||||
default_factory=lambda: tuple([25.025, 75.075, 108.422]*36)
|
||||
)
|
||||
b432_b435_has_branches: int = 0
|
||||
b436_b439_hp_max: int = 10000
|
||||
b440_b443_hp_clear: int = 8000
|
||||
|
Loading…
Reference in New Issue
Block a user