Working on UI fixing

This commit is contained in:
Vladislav Khorev 2026-06-12 21:04:19 +03:00
parent 7031a21922
commit 2b32fce5e0
7 changed files with 28 additions and 11 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
resources/w/ui/img/toast/quest_new001.png (Stored with Git LFS)

Binary file not shown.

View File

@ -72,6 +72,7 @@ void CutsceneRuntime::stop() {
activeCutsceneId.clear(); activeCutsceneId.clear();
active = false; active = false;
fadeInCallbackFired = false; fadeInCallbackFired = false;
skipPending = false;
currentCutsceneLine = -1; currentCutsceneLine = -1;
cutsceneTimerMs = 0; cutsceneTimerMs = 0;
cutsceneElapsedMs = 0; cutsceneElapsedMs = 0;
@ -114,6 +115,15 @@ void CutsceneRuntime::update(int deltaMs) {
if (cutsceneElapsedMs >= fadeInCompleteMs && !activeCutscene->onFadeInCallback.empty()) { if (cutsceneElapsedMs >= fadeInCompleteMs && !activeCutscene->onFadeInCallback.empty()) {
fadeInCallbackFired = true; fadeInCallbackFired = true;
onFadeInComplete(activeCutscene->onFadeInCallback); onFadeInComplete(activeCutscene->onFadeInCallback);
// The callback may have stopped the cutscene. Guard before touching
// state, then honour a skip that was deferred until fade-in completed.
if (!active || !activeCutscene) return;
if (skipPending) {
skipPending = false;
finish();
return;
}
} }
} }
@ -145,6 +155,15 @@ bool CutsceneRuntime::canSkip() const {
void CutsceneRuntime::skip() { void CutsceneRuntime::skip() {
if (!canSkip()) return; if (!canSkip()) return;
// If the onFadeInCallback hasn't fired yet, defer the skip.
// The scene change triggered by that callback must happen while the screen
// is still black; calling finish() now would skip the callback entirely.
if (!fadeInCallbackFired && activeCutscene && !activeCutscene->onFadeInCallback.empty()) {
skipPending = true;
return;
}
finish(); finish();
} }

View File

@ -32,6 +32,7 @@ private:
std::string activeCutsceneId; std::string activeCutsceneId;
bool active = false; bool active = false;
bool fadeInCallbackFired = false; bool fadeInCallbackFired = false;
bool skipPending = false;
int currentCutsceneLine = -1; int currentCutsceneLine = -1;
int cutsceneTimerMs = 0; int cutsceneTimerMs = 0;