add intro tune, part 3

This commit is contained in:
tildearrow 2023-02-24 00:38:32 -05:00
parent 234ef5c9b4
commit b3c3c038ad
3 changed files with 32 additions and 9 deletions

View file

@ -3437,6 +3437,14 @@ bool FurnaceGUI::loop() {
continue;
}
if (firstFrame) {
if (!tutorial.introPlayed || settings.alwaysPlayIntro==3 || (settings.alwaysPlayIntro==2 && curFileName.empty())) {
unsigned char* introTemp=new unsigned char[intro_fur_len];
memcpy(introTemp,intro_fur,intro_fur_len);
e->load(introTemp,intro_fur_len);
}
}
layoutTimeBegin=SDL_GetPerformanceCounter();
ImGui_ImplSDLRenderer_NewFrame();
@ -5666,12 +5674,6 @@ bool FurnaceGUI::init() {
oldPat[i]=new DivPattern;
}
if ((!tutorial.introPlayed || settings.alwaysPlayIntro>=2) && curFileName.empty()) {
unsigned char* introTemp=new unsigned char[intro_fur_len];
memcpy(introTemp,intro_fur,intro_fur_len);
e->load(introTemp,intro_fur_len);
}
firstFrame=true;
// TODO: MIDI mapping time!

View file

@ -20,6 +20,7 @@
#define _USE_MATH_DEFINES
#include "gui.h"
#include "imgui_internal.h"
#include <fmt/printf.h>
void FurnaceGUI::drawImage(ImDrawList* dl, FurnaceGUIImages image, const ImVec2& pos, const ImVec2& scale, double rotate, const ImVec2& uvMin, const ImVec2& uvMax, const ImVec4& imgColor) {
FurnaceGUIImage* imgI=getImage(image);
@ -73,7 +74,27 @@ void FurnaceGUI::drawImage(ImDrawList* dl, FurnaceGUIImages image, const ImVec2&
void FurnaceGUI::endIntroTune() {
stop();
e->createNewFromDefaults();
if (curFileName.empty()) {
e->createNewFromDefaults();
} else { // load pending song
if (load(curFileName)>0) {
showError(fmt::sprintf("Error while loading file! (%s)",lastError));
curFileName="";
e->createNewFromDefaults();
}
}
undoHist.clear();
redoHist.clear();
modified=false;
curNibble=false;
orderNibble=false;
orderCursor=-1;
samplePos=0;
updateSampleTex=true;
selStart=SelectionPoint();
selEnd=SelectionPoint();
cursor=SelectionPoint();
updateWindowTitle();
}
void FurnaceGUI::drawIntro(double introTime, bool monitor) {
@ -89,7 +110,7 @@ void FurnaceGUI::drawIntro(double introTime, bool monitor) {
nextWindow=GUI_WINDOW_NOTHING;
ImGui::SetNextWindowPos(ImVec2(0,0));
ImGui::SetNextWindowSize(ImVec2(canvasW,canvasH));
ImGui::SetNextWindowFocus();
if (introPos<0.1) ImGui::SetNextWindowFocus();
}
if (ImGui::Begin(monitor?"IntroMon X":"Intro",monitor?(&introMonOpen):NULL,monitor?globalWinFlags:(ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoDocking|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoBackground))) {
if (monitor) {

View file

@ -451,7 +451,7 @@ int main(int argc, char** argv) {
e.preInit();
if (!fileName.empty()) {
if (!fileName.empty() && ((!e.getConfBool("tutIntroPlayed",false)) || e.getConfInt("alwaysPlayIntro",0)!=3 || consoleMode || benchMode || outName!="" || vgmOutName!="" || cmdOutName!="")) {
logI("loading module...");
FILE* f=ps_fopen(fileName.c_str(),"rb");
if (f==NULL) {