add intro tune, part 2
This commit is contained in:
parent
2f8a69646e
commit
658428d68d
|
@ -600,6 +600,8 @@ src/gui/fileDialog.cpp
|
||||||
src/gui/intConst.cpp
|
src/gui/intConst.cpp
|
||||||
src/gui/guiConst.cpp
|
src/gui/guiConst.cpp
|
||||||
|
|
||||||
|
src/gui/introTune.cpp
|
||||||
|
|
||||||
src/gui/about.cpp
|
src/gui/about.cpp
|
||||||
src/gui/channels.cpp
|
src/gui/channels.cpp
|
||||||
src/gui/chanOsc.cpp
|
src/gui/chanOsc.cpp
|
||||||
|
|
|
@ -1469,6 +1469,42 @@ void DivEngine::createNew(const char* description, String sysName, bool inBase64
|
||||||
BUSY_END;
|
BUSY_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivEngine::createNewFromDefaults() {
|
||||||
|
quitDispatch();
|
||||||
|
BUSY_BEGIN;
|
||||||
|
saveLock.lock();
|
||||||
|
song.unload();
|
||||||
|
song=DivSong();
|
||||||
|
changeSong(0);
|
||||||
|
|
||||||
|
String preset=getConfString("initialSys2","");
|
||||||
|
bool oldVol=getConfInt("configVersion",DIV_ENGINE_VERSION)<135;
|
||||||
|
if (preset.empty()) {
|
||||||
|
// try loading old preset
|
||||||
|
preset=decodeSysDesc(getConfString("initialSys",""));
|
||||||
|
oldVol=false;
|
||||||
|
}
|
||||||
|
logD("preset size %ld",preset.size());
|
||||||
|
if (preset.size()>0 && (preset.size()&3)==0) {
|
||||||
|
initSongWithDesc(preset.c_str(),true,oldVol);
|
||||||
|
}
|
||||||
|
String sysName=getConfString("initialSysName","");
|
||||||
|
if (sysName=="") {
|
||||||
|
song.systemName=getSongSystemLegacyName(song,!getConfInt("noMultiSystem",0));
|
||||||
|
} else {
|
||||||
|
song.systemName=sysName;
|
||||||
|
}
|
||||||
|
|
||||||
|
recalcChans();
|
||||||
|
saveLock.unlock();
|
||||||
|
BUSY_END;
|
||||||
|
initDispatch();
|
||||||
|
BUSY_BEGIN;
|
||||||
|
renderSamples();
|
||||||
|
reset();
|
||||||
|
BUSY_END;
|
||||||
|
}
|
||||||
|
|
||||||
void DivEngine::swapChannels(int src, int dest) {
|
void DivEngine::swapChannels(int src, int dest) {
|
||||||
logV("swapping channel %d with %d",src,dest);
|
logV("swapping channel %d with %d",src,dest);
|
||||||
if (src==dest) {
|
if (src==dest) {
|
||||||
|
|
|
@ -516,6 +516,7 @@ class DivEngine {
|
||||||
String decodeSysDesc(String desc);
|
String decodeSysDesc(String desc);
|
||||||
// start fresh
|
// start fresh
|
||||||
void createNew(const char* description, String sysName, bool inBase64=true);
|
void createNew(const char* description, String sysName, bool inBase64=true);
|
||||||
|
void createNewFromDefaults();
|
||||||
// load a file.
|
// load a file.
|
||||||
bool load(unsigned char* f, size_t length);
|
bool load(unsigned char* f, size_t length);
|
||||||
// save as .dmf.
|
// save as .dmf.
|
||||||
|
|
|
@ -40,7 +40,7 @@ struct EndOfFileException {
|
||||||
};
|
};
|
||||||
|
|
||||||
class SafeReader {
|
class SafeReader {
|
||||||
unsigned char* buf;
|
const unsigned char* buf;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
size_t curSeek;
|
size_t curSeek;
|
||||||
|
@ -71,8 +71,8 @@ class SafeReader {
|
||||||
String readStringToken();
|
String readStringToken();
|
||||||
inline bool isEOF() { return curSeek >= len; };
|
inline bool isEOF() { return curSeek >= len; };
|
||||||
|
|
||||||
SafeReader(void* b, size_t l):
|
SafeReader(const void* b, size_t l):
|
||||||
buf((unsigned char*)b),
|
buf((const unsigned char*)b),
|
||||||
len(l),
|
len(l),
|
||||||
curSeek(0) {}
|
curSeek(0) {}
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "guiConst.h"
|
#include "guiConst.h"
|
||||||
#include "intConst.h"
|
#include "intConst.h"
|
||||||
#include "scaling.h"
|
#include "scaling.h"
|
||||||
|
#include "introTune.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
#include <fmt/printf.h>
|
#include <fmt/printf.h>
|
||||||
|
@ -5665,6 +5666,12 @@ bool FurnaceGUI::init() {
|
||||||
oldPat[i]=new DivPattern;
|
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;
|
firstFrame=true;
|
||||||
|
|
||||||
// TODO: MIDI mapping time!
|
// TODO: MIDI mapping time!
|
||||||
|
|
|
@ -2006,6 +2006,7 @@ class FurnaceGUI {
|
||||||
void play(int row=0);
|
void play(int row=0);
|
||||||
void setOrder(unsigned char order, bool forced=false);
|
void setOrder(unsigned char order, bool forced=false);
|
||||||
void stop();
|
void stop();
|
||||||
|
void endIntroTune();
|
||||||
|
|
||||||
void previewNote(int refChan, int note, bool autoNote=false);
|
void previewNote(int refChan, int note, bool autoNote=false);
|
||||||
void stopPreviewNote(SDL_Scancode scancode, bool autoNote=false);
|
void stopPreviewNote(SDL_Scancode scancode, bool autoNote=false);
|
||||||
|
|
|
@ -71,6 +71,11 @@ void FurnaceGUI::drawImage(ImDrawList* dl, FurnaceGUIImages image, const ImVec2&
|
||||||
dl->AddImageQuad(img,quad0,quad1,quad2,quad3,uv0,uv1,uv2,uv3,colorConverted);
|
dl->AddImageQuad(img,quad0,quad1,quad2,quad3,uv0,uv1,uv2,uv3,colorConverted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FurnaceGUI::endIntroTune() {
|
||||||
|
stop();
|
||||||
|
e->createNewFromDefaults();
|
||||||
|
}
|
||||||
|
|
||||||
void FurnaceGUI::drawIntro(double introTime, bool monitor) {
|
void FurnaceGUI::drawIntro(double introTime, bool monitor) {
|
||||||
if (monitor) {
|
if (monitor) {
|
||||||
if (introTime<0.0) introTime=0.0;
|
if (introTime<0.0) introTime=0.0;
|
||||||
|
@ -264,6 +269,7 @@ void FurnaceGUI::drawIntro(double introTime, bool monitor) {
|
||||||
if (introSkipDo) {
|
if (introSkipDo) {
|
||||||
introSkip+=ImGui::GetIO().DeltaTime;
|
introSkip+=ImGui::GetIO().DeltaTime;
|
||||||
if (introSkip>=0.5) {
|
if (introSkip>=0.5) {
|
||||||
|
if (e->isPlaying()) endIntroTune();
|
||||||
introPos=0.1;
|
introPos=0.1;
|
||||||
if (introSkip>=0.75) introPos=9.1;
|
if (introSkip>=0.75) introPos=9.1;
|
||||||
}
|
}
|
||||||
|
@ -285,6 +291,12 @@ void FurnaceGUI::drawIntro(double introTime, bool monitor) {
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
if (mustClear<=0 && !monitor) {
|
if (mustClear<=0 && !monitor) {
|
||||||
|
if (!shortIntro && introPos<=0.0) {
|
||||||
|
e->setOrder(0);
|
||||||
|
e->setRepeatPattern(false);
|
||||||
|
play();
|
||||||
|
}
|
||||||
|
if (e->isPlaying() && introPos>=8.0 && !shortIntro) endIntroTune();
|
||||||
introPos+=ImGui::GetIO().DeltaTime;
|
introPos+=ImGui::GetIO().DeltaTime;
|
||||||
if (introPos>=(shortIntro?1.0:9.0)) {
|
if (introPos>=(shortIntro?1.0:9.0)) {
|
||||||
introPos=10.0;
|
introPos=10.0;
|
||||||
|
|
38091
src/gui/introTune.cpp
Normal file
38091
src/gui/introTune.cpp
Normal file
File diff suppressed because it is too large
Load diff
26
src/gui/introTune.h
Normal file
26
src/gui/introTune.h
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/**
|
||||||
|
* Furnace Tracker - multi-system chiptune tracker
|
||||||
|
* Copyright (C) 2021-2023 tildearrow and contributors
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _INTRO_TUNE_H
|
||||||
|
#define _INTRO_TUNE_H
|
||||||
|
|
||||||
|
extern const unsigned char intro_fur[];
|
||||||
|
extern const unsigned int intro_fur_len;
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in a new issue