1
0
mirror of synced 2024-09-23 18:58:28 +02:00

Properly set timing window values for easier difficulties (#74)

This commit is contained in:
Viv 2024-04-29 18:44:18 -04:00 committed by GitHub
parent 09d83c3808
commit 405cea3be2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 3 deletions

View File

@ -9,7 +9,7 @@ from typing import Any, List, Dict, Tuple
from dataclasses import dataclass, field, fields
from tja2fumen.constants import BRANCH_NAMES
from tja2fumen.constants import BRANCH_NAMES, TIMING_WINDOWS
@dataclass()
@ -224,7 +224,7 @@ class FumenMeasure:
class FumenHeader:
"""Contains all the byte values for a Fumen chart file's header."""
order: str = "<"
b000_b431_timing_windows: Tuple[float, ...] = (25.025, 75.075, 108.422)*36
b000_b431_timing_windows: Tuple[float, ...] = (0.0, 0.0, 0.0)*36
b432_b435_has_branches: int = 0
b436_b439_hp_max: int = 10000
b440_b443_hp_clear: int = 8000
@ -292,6 +292,12 @@ class FumenHeader:
else:
self.order = "<"
def set_timing_windows(self, difficulty: str) -> None:
"""Set the timing window header bytes depending on the difficulty."""
# Note: Ura Oni is equivalent to Oni for timing window behavior
difficulty = 'Oni' if difficulty in ['Ura', 'Edit'] else difficulty
self.b000_b431_timing_windows = TIMING_WINDOWS[difficulty]*36
def set_hp_bytes(self, n_notes: int, difficulty: str, stars: int) -> None:
"""Compute header bytes related to the soul gauge (HP) behavior."""
# Note: Ura Oni is equivalent to Oni for soul gauge behavior

View File

@ -94,3 +94,11 @@ COURSE_IDS = {
'Oni': 'm',
'Ura': 'x',
}
TIMING_WINDOWS = {
# "GOOD" timing "OK" timing "BAD" timing
'Easy': (041.7083358764648, 108.441665649414, 125.125000000000),
'Normal': (041.7083358764648, 108.441665649414, 125.125000000000),
'Hard': (025.0250015258789, 075.075004577637, 108.441665649414),
'Oni': (025.0250015258789, 075.075004577637, 108.441665649414)
}

View File

@ -377,6 +377,8 @@ def convert_tja_to_fumen(tja: TJACourse) -> FumenCourse:
# Compute the header bytes that dictate the soul gauge bar behavior
fumen.header.set_hp_bytes(total_notes['normal'], tja.course, tja.level)
# Compute the timing windows based on the course
fumen.header.set_timing_windows(tja.course)
# If song has only drumroll branching conditions (also allowing percentage
# conditions that force a level up/level down), then set the header bytes

View File

@ -79,7 +79,8 @@ def test_converted_tja_vs_cached_fumen(id_song, tmp_path, entry_point):
# cannot be expressed in a TJA file. So, we skip checking the
# `branch_point` header values for KAGEKIYO.
if id_song != 'genpe':
for header_property in ['b468_b471_branch_pts_good',
for header_property in ['b000_b431_timing_windows',
'b468_b471_branch_pts_good',
'b472_b475_branch_pts_ok',
'b476_b479_branch_pts_bad',
'b480_b483_branch_pts_drumroll',