GUI: fix intro carry-over in specific situations

issue #1149
This commit is contained in:
tildearrow 2023-06-12 02:18:50 -05:00
parent 54e7bd295d
commit 16adc1fb1b
3 changed files with 10 additions and 3 deletions

View file

@ -19,6 +19,7 @@
#define _USE_MATH_DEFINES
#include "gui.h"
#include "../ta-log.h"
#include "imgui_internal.h"
#include <fmt/printf.h>
@ -73,6 +74,8 @@ void FurnaceGUI::drawImage(ImDrawList* dl, FurnaceGUIImages image, const ImVec2&
}
void FurnaceGUI::endIntroTune() {
if (introStopped) return;
logV("ending intro");
stop();
if (curFileName.empty()) {
e->createNewFromDefaults();
@ -96,6 +99,7 @@ void FurnaceGUI::endIntroTune() {
cursor=SelectionPoint();
updateWindowTitle();
updateScroll(0);
introStopped=true;
}
void FurnaceGUI::drawIntro(double introTime, bool monitor) {
@ -291,7 +295,7 @@ void FurnaceGUI::drawIntro(double introTime, bool monitor) {
if (introSkipDo) {
introSkip+=ImGui::GetIO().DeltaTime;
if (introSkip>=0.5) {
if (e->isPlaying()) endIntroTune();
if (!shortIntro) endIntroTune();
introPos=0.1;
if (introSkip>=0.75) introPos=12.0;
}
@ -318,7 +322,7 @@ void FurnaceGUI::drawIntro(double introTime, bool monitor) {
e->setRepeatPattern(false);
play();
}
if (e->isPlaying() && introPos>=10.0 && !shortIntro) endIntroTune();
if (introPos>=10.0 && !shortIntro) endIntroTune();
introPos+=ImGui::GetIO().DeltaTime;
if (introPos>=(shortIntro?1.0:11.0)) {
introPos=12.0;
@ -326,5 +330,7 @@ void FurnaceGUI::drawIntro(double introTime, bool monitor) {
commitTutorial();
}
}
} else if (!shortIntro) {
endIntroTune();
}
}