void ScreenGameplay7K::CheckShouldEndScreen() { if (SongTime > CurrentDiff->Duration) { if (!SongFinished) { SongFinished = true; Animations->DoEvent("SongFinishedEvent"); } } // Reached the end! if (SongTime > CurrentDiff->Duration + 3 && !stage_failed) { ScreenEvaluation7K *Eval = new ScreenEvaluation7K(this); Eval->Init(score_keeper); Next = Eval; } if (score_keeper->isStageFailed(lifebar_type) && !stage_failed) { // Run stage failed animation. stage_failed = true; Music->Stop(); FailSnd->Play(); for (std::map<int, SoundSample*>::iterator i = Keysounds.begin(); i != Keysounds.end(); i++) i->second->Stop(); Animations->DoEvent("OnFailureEvent", 1); FailureTime = Clamp(Animations->GetEnv()->GetFunctionResultF(), 0.0f, 30.0f); } if (stage_failed) { MissTime = 10; // Infinite, for as long as it lasts. if (FailureTime <= 0) Running = false; } }
void ScreenGameplay7K::CheckShouldEndScreen() { // Run failure first; make sure it has priority over checking whether it's a pass or not. if (ScoreKeeper->isStageFailed(lifebar_type) && !stage_failed && !NoFail) { // We make sure we don't trigger this twice. stageFailed: stage_failed = true; ScoreKeeper->failStage(); FailSnd.Play(); // We stop all audio.. Music->Stop(); for (auto i = Keysounds.begin(); i != Keysounds.end(); ++i) for (auto &&s: i->second) if (s) s->Stop(); // Run stage failed animation. Animations->DoEvent("OnFailureEvent", 1); FailureTime = Clamp(Animations->GetEnv()->GetFunctionResultF(), 0.0f, 30.0f); } // Okay then, so it's a pass? if (WarpedSongTime > CurrentDiff->Duration && !stage_failed) { double curBPS = SectionValue(BPS, WarpedSongTime); double cutoffspb = 1 / curBPS; double cutoffTime; if (ScoreKeeper->usesO2()) // beat-based judgements cutoffTime = cutoffspb * ScoreKeeper->getMissCutoff(); else // time-based judgments cutoffTime = ScoreKeeper->getMissCutoff() / 1000.0; // we need to make sure we trigger this AFTER all notes could've possibly been judged // note to self: songtime will always be positive since duration is always positive. // cutofftime is unlikely to ever be negative. if (WarpedSongTime - CurrentDiff->Duration > cutoffTime) { if (!SongFinished) { if (ScoreKeeper->isStageFailed(lifebar_type) && !NoFail) goto stageFailed; // No, don't trigger SongFinished. It wasn't a pass. SongFinished = true; // Reached the end! Animations->DoEvent("OnSongFinishedEvent", 1); SuccessTime = Clamp(Animations->GetEnv()->GetFunctionResultF(), 3.0f, 30.0f); } } } // Okay then, the song's done, and the success animation is done too. Time to evaluate. if (SuccessTime < 0 && SongFinished) { ScreenEvaluation7K *Eval = new ScreenEvaluation7K(this); Eval->Init(ScoreKeeper.get()); Next = Eval; } if (stage_failed) { MissTime = 10; // Infinite, for as long as it lasts. if (FailureTime <= 0){ // go to evaluation screen, or back to song select depending on the skin if (Configuration::GetSkinConfigf("GoToSongSelectOnFailure") == 0) { auto Eval = new ScreenEvaluation7K(this); Eval->Init(ScoreKeeper.get()); Next = Eval; } else Running = false; } } }