Skip to content

Commit

Permalink
Rename function, add input offset to HoldObjectAvailable
Browse files Browse the repository at this point in the history
  • Loading branch information
ASleepyCat committed Apr 18, 2021
1 parent 06c7b1d commit abc0a34
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Main/include/Scoring.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class Scoring : public Unique
void m_SetHoldObject(ObjectState* obj, uint32 index);
void m_ReleaseHoldObject(ObjectState* obj);
void m_ReleaseHoldObject(uint32 index);
bool m_IsBeingHold(const ScoreTick* tick) const;
bool m_IsBeingHeld(const ScoreTick* tick) const;

// Check whether the laser segment is the beginning
bool m_IsRoot(const LaserObjectState* laser) const;
Expand Down
10 changes: 5 additions & 5 deletions Main/src/Scoring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ void Scoring::m_UpdateTicks()
assert(buttonCode < 6);
if (!tick->HasFlag(TickFlags::Ignore))
{
if (m_IsBeingHold(tick) || autoplayInfo.IsAutoplayButtons())
if (m_IsBeingHeld(tick) || autoplayInfo.IsAutoplayButtons())
{
m_TickHit(tick, buttonCode);
HitStat* stat = new HitStat(tick->object);
Expand Down Expand Up @@ -1080,7 +1080,7 @@ void Scoring::m_ReleaseHoldObject(uint32 index)
m_ReleaseHoldObject(m_holdObjects[index]);
}

bool Scoring::m_IsBeingHold(const ScoreTick* tick) const
bool Scoring::m_IsBeingHeld(const ScoreTick* tick) const
{
// NOTE: all these are just heuristics. If there's a better heuristic, change this.
// See issue #355 for more detail.
Expand Down Expand Up @@ -1425,15 +1425,15 @@ bool Scoring::HoldObjectAvailable(uint32 index, bool checkIfPassedCritLine)
if (m_ticks[index].empty())
return false;

auto currentTime = m_playback->GetLastTime();
auto currentTime = m_playback->GetLastTime() + m_inputOffset;
auto tick = m_ticks[index].front();
auto obj = (HoldObjectState*)tick->object;
// When a hold passes the crit line and we're eligible to hit the starting tick,
// change the idle hit effect to the crit hit effect
bool withinHoldStartWindow = tick->HasFlag(TickFlags::Start) && m_IsBeingHold(tick) && (!checkIfPassedCritLine || obj->time <= currentTime);
bool withinHoldStartWindow = tick->HasFlag(TickFlags::Start) && m_IsBeingHeld(tick) && (!checkIfPassedCritLine || obj->time <= currentTime);
// This allows us to have a crit hit effect anytime a hold hasn't fully scrolled past,
// including when the final scorable tick has been processed
bool holdObjectHittable = obj->time + obj->duration > currentTime && m_buttonHitTime[index] > obj->time;
bool holdObjectHittable = obj->time + obj->duration > currentTime && m_buttonHitTime[index] + m_inputOffset > obj->time;

return withinHoldStartWindow || holdObjectHittable;
}
Expand Down

0 comments on commit abc0a34

Please sign in to comment.