Add support for #BRANCHSTART p,999,999
and #SECTION
commands via imcanz.tja
(#30)
This PR adds a new chart to the test suite (`imcanz.tja`) that uses `p,0,0`, `p,999,999` _and_ `#SECTION` commands: - `p,0,0`: Forces the chart into the Master branch (since it's impossible to fail a 0% accuracy requirement) - `p,999,999`: Forces the chart into the Normal branch (since it's impossible to pass a 999% accuracy requirement) - `#SECTION`: Resets accuracy values for notes and drumrolls on the next measure. (In practice, this just means that the branch condition is repeated on the next measure, at least according to the official fumen I have.) Note: Only the Oni and Hard difficulties have actually been added to the test suite. The Normal and Easy charts were too broken to easily match the official fumens. They will need a lot of work to fix charting errors, so I'm leaving them commented out for now. Fixes #27.
This commit is contained in:
parent
3ebbb678f4
commit
2dec26d2bf
@ -202,10 +202,11 @@ def convertTJAToFumen(tja):
|
||||
if measureTJA['branchStart']:
|
||||
# Determine which values to assign based on the type of branching condition
|
||||
if measureTJA['branchStart'][0] == 'p':
|
||||
val1 = int(total_notes_branch * measureTJA['branchStart'][1] * 20)
|
||||
val2 = int(total_notes_branch * measureTJA['branchStart'][2] * 20)
|
||||
vals = [int(total_notes_branch * v * 20) if 0 <= v <= 1 # Ensure value is actually a percentage
|
||||
else int(v * 100) # If it's not, pass the value as-is
|
||||
for v in measureTJA['branchStart'][1:]]
|
||||
elif measureTJA['branchStart'][0] == 'r':
|
||||
val1, val2 = measureTJA['branchStart'][1:]
|
||||
vals = measureTJA['branchStart'][1:]
|
||||
# Determine which bytes to assign the values to
|
||||
if currentBranch == 'normal':
|
||||
idx_b1, idx_b2 = 0, 1
|
||||
@ -214,8 +215,8 @@ def convertTJAToFumen(tja):
|
||||
elif currentBranch == 'master':
|
||||
idx_b1, idx_b2 = 4, 5
|
||||
# Assign the values to their intended bytes
|
||||
measureFumen['branchInfo'][idx_b1] = val1
|
||||
measureFumen['branchInfo'][idx_b2] = val2
|
||||
measureFumen['branchInfo'][idx_b1] = vals[0]
|
||||
measureFumen['branchInfo'][idx_b2] = vals[1]
|
||||
# Reset the note counter corresponding to this branch
|
||||
total_notes_branch = 0
|
||||
total_notes_branch += note_counter_branch
|
||||
|
@ -171,6 +171,10 @@ def parseCourseMeasures(lines):
|
||||
# Append event to the current measure's events
|
||||
for branch in branches.keys() if currentBranch == 'all' else [currentBranch]:
|
||||
branches[branch][idx_m]['events'].append(currentEvent)
|
||||
elif line['name'] == 'SECTION':
|
||||
# Simply repeat the same #BRANCHSTART condition that happened previously
|
||||
# The purpose of #SECTION is to "Reset accuracy values for notes and drumrolls on the next measure."
|
||||
branches[branch][idx_m]['events'].append({"name": 'branchStart', "position": pos, "value": values})
|
||||
|
||||
# 3. Parse commands that don't create an event (e.g. simply changing the current branch)
|
||||
else:
|
||||
@ -198,8 +202,6 @@ def parseCourseMeasures(lines):
|
||||
pass
|
||||
|
||||
# Not implemented commands
|
||||
elif line['name'] == 'SECTION':
|
||||
pass # This seems to be inconsequential, but I'm not 100% sure. Need to test more branching fumens.
|
||||
else:
|
||||
raise NotImplementedError
|
||||
|
||||
|
1763
testing/data/imcanz.tja
Normal file
1763
testing/data/imcanz.tja
Normal file
File diff suppressed because it is too large
Load Diff
BIN
testing/data/imcanz.zip
Normal file
BIN
testing/data/imcanz.zip
Normal file
Binary file not shown.
@ -12,6 +12,7 @@ from tja2fumen.constants import COURSE_IDS, NORMALIZE_COURSE, simpleHeaders, byt
|
||||
|
||||
|
||||
@pytest.mark.parametrize('id_song', [
|
||||
pytest.param('imcanz'),
|
||||
pytest.param('clsca'),
|
||||
pytest.param('linda'),
|
||||
pytest.param('senpac'),
|
||||
|
Loading…
Reference in New Issue
Block a user