diff --git a/src/Parser.cpp b/src/Parser.cpp index f0208b2..1193439 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -76,7 +76,9 @@ namespace bms_parser P1LongKeyBase = 5 * 36 + 1, P2LongKeyBase = 6 * 36 + 1, P1MineKeyBase = 13 * 36 + 1, - P2MineKeyBase = 14 * 36 + 1 + P2MineKeyBase = 14 * 36 + 1, + + Scroll = 1020 }; namespace KeyAssign @@ -86,9 +88,8 @@ namespace bms_parser }; constexpr int TempKey = 16; - constexpr int Scroll = 1020; - Parser::Parser() : BpmTable{}, StopLengthTable{} + Parser::Parser() : BpmTable{}, StopLengthTable{}, ScrollTable{} { std::random_device seeder; Seed = seeder(); @@ -383,6 +384,16 @@ namespace bms_parser ParseHeader(new_chart, L"BPM", xx, value); } } + else if (MatchHeader(line, L"#SCROLL")) + { + if (line.length() < 10) + { + continue; + } + auto xx = line.substr(7, 2); + auto value = line.substr(10); + ParseHeader(new_chart, L"SCROLL", xx, value); + } else { std::wsmatch matcher; @@ -632,6 +643,25 @@ namespace bms_parser timeline->BpmChange = true; break; } + case Scroll: + { + auto id = ParseInt(val_view); + if (!CheckResourceIdRange(id)) + { + // UE_LOG(LogTemp, Warning, TEXT("Invalid Scroll id: %s"), *val); + break; + } + if (ScrollTable.find(id) != ScrollTable.end()) + { + timeline->Scroll = ScrollTable[id]; + } + else + { + timeline->Scroll = 1; + } + // Debug.Log($"SCROLL: {timeline.Scroll}, on measure {i}"); + break; + } case Stop: { auto id = ParseInt(val_view); @@ -1071,6 +1101,13 @@ namespace bms_parser { Chart->Meta.LnMode = static_cast(std::wcstol(Value.c_str(), nullptr, 10)); } + else if (MatchHeader(cmd, L"SCROLL")) + { + auto xx = ParseInt(Xx); + auto value = std::wcstod(Value.c_str(), nullptr); + ScrollTable[xx] = value; + std::wcout << "SCROLL: " << xx << " = " << value << std::endl; + } else { std::wcout << "Unknown command: " << cmd << std::endl; diff --git a/test/testcases/aleph0_another.output b/test/testcases/aleph0_another.output index 8eceb44..74b3de1 100644 --- a/test/testcases/aleph0_another.output +++ b/test/testcases/aleph0_another.output @@ -16,4 +16,5 @@ total_long_notes: 0 total_scratch_notes: 67 total_backspin_notes: 0 playlevel: 12 -playlength: 138717008 \ No newline at end of file +playlength: 138717008 +difficulty: 4 \ No newline at end of file