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