diff --git a/engine/core/Engine.ts b/engine/core/Engine.ts index 64756b2..4b14f70 100644 --- a/engine/core/Engine.ts +++ b/engine/core/Engine.ts @@ -125,7 +125,7 @@ export class Engine { ) this.videoManager.onEnd(() => { - if (!this.qteResolved) { + if (!this.qteTriggered || this.qteResolved) { this.emit('videoEnd', scene) this.onVideoEnd(scene) } diff --git a/src/composables/useGameEngine.ts b/src/composables/useGameEngine.ts index 75666fa..2d5a921 100644 --- a/src/composables/useGameEngine.ts +++ b/src/composables/useGameEngine.ts @@ -73,6 +73,7 @@ export function useGameEngine(videoEls: () => [HTMLVideoElement | null, HTMLVide }) engine.on('gameEnd', () => { + store.clearQTE() store.setGameEnded(true) engine.choiceSystem.stop() }) diff --git a/src/stores/gameStore.ts b/src/stores/gameStore.ts index 90a35df..f24fdfc 100644 --- a/src/stores/gameStore.ts +++ b/src/stores/gameStore.ts @@ -80,6 +80,14 @@ export const useGameStore = defineStore('game', () => { }, 1000) } + function clearQTE() { + qteActive.value = false + qteDef.value = null + qteResult.value = 'none' + qteTotal.value = 0 + qteRemaining.value = 0 + } + function setVideoTime(t: number) { videoTime.value = t } @@ -131,7 +139,7 @@ export const useGameStore = defineStore('game', () => { hotspots, isImageScene, showChapterSelect, chapters, unlockedChapterIds, setScene, setChoices, clearChoices, setGameEnded, setTimer, clearTimer, setSaves, - showQTE, updateQTE, resolveQTE, setVideoTime, + showQTE, updateQTE, resolveQTE, clearQTE, setVideoTime, setHotspots, clearHotspots, setIsImageScene, setChapters, setUnlockedChapters, addUnlockedChapter, setShowChapterSelect, dump,