From 3d674b709110c3abae8c646a9ad0e30c82c0d4a0 Mon Sep 17 00:00:00 2001 From: ASleepyCat Date: Sun, 23 May 2021 13:00:07 +1000 Subject: [PATCH] Check early for slams --- Main/include/Scoring.hpp | 4 +++- Main/src/Scoring.cpp | 21 +++++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Main/include/Scoring.hpp b/Main/include/Scoring.hpp index 26fe2f096..042c4219c 100644 --- a/Main/include/Scoring.hpp +++ b/Main/include/Scoring.hpp @@ -21,7 +21,9 @@ enum class TickFlags : uint8 Slam = 0x20, // Used to make hit effects appear correctly for holds - Ignore = 0x40 + Ignore = 0x40, + + Processed = 0x80 }; TickFlags operator|(const TickFlags& a, const TickFlags& b); TickFlags operator&(const TickFlags& a, const TickFlags& b); diff --git a/Main/src/Scoring.cpp b/Main/src/Scoring.cpp index f02e6b5a3..9b1f1e860 100755 --- a/Main/src/Scoring.cpp +++ b/Main/src/Scoring.cpp @@ -755,13 +755,15 @@ void Scoring::m_UpdateTicks() } else if (tick->HasFlag(TickFlags::Laser)) { - LaserObjectState* laserObject = (LaserObjectState*)tick->object; + auto* laserObject = (LaserObjectState*)tick->object; if (tick->HasFlag(TickFlags::Slam)) { // Check if slam hit float dirSign = Math::Sign(laserObject->GetDirection()); float inputSign = Math::Sign(m_input->GetInputLaserDir(buttonCode - 6)); - if (autoplayInfo.autoplay || (dirSign == inputSign && delta <= hitWindow.slam)) + + if (autoplayInfo.autoplay || (dirSign == inputSign && delta <= hitWindow.slam / 2) + || tick->HasFlag(TickFlags::Processed)) { m_TickHit(tick, buttonCode); HitStat* stat = new HitStat(tick->object); @@ -792,6 +794,14 @@ void Scoring::m_UpdateTicks() } } } + else if (tick->HasFlag(TickFlags::Slam)) + { + auto* laserObject = (LaserObjectState*)tick->object; + float dirSign = Math::Sign(laserObject->GetDirection()); + float inputSign = Math::Sign(m_input->GetInputLaserDir(buttonCode - 6)); + if (dirSign == inputSign && std::abs(delta) <= hitWindow.slam / 2) + tick->SetFlag(TickFlags::Processed); + } bool miss = (tick->HasFlag(TickFlags::Slam) && delta > hitWindow.slam) || (!tick->HasFlag(TickFlags::Slam) && delta > hitWindow.good); @@ -998,7 +1008,6 @@ void Scoring::m_UpdateGauges(ScoreHitRating rating, TickFlags flags) } } - while (m_gaugeStack.size() > 1 && m_gaugeStack.back()->FailOut()) { Gauge* lostGauge = m_gaugeStack.back(); @@ -1019,11 +1028,11 @@ void Scoring::m_UpdateGaugeSamples() void Scoring::m_CleanupTicks() { - for (uint32 i = 0; i < 8; i++) + for (auto & m_tick : m_ticks) { - for (ScoreTick* tick : m_ticks[i]) + for (ScoreTick* tick : m_tick) delete tick; - m_ticks[i].clear(); + m_tick.clear(); } }