Skip to content

Commit

Permalink
release Hyper ESFMing
Browse files Browse the repository at this point in the history
special version for the ESFM demo song contest
  • Loading branch information
tildearrow committed Jan 18, 2024
1 parent 350a1c8 commit 0ce48ea
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/engine/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class DivWorkPool;

#define DIV_UNSTABLE

#define DIV_VERSION "dev191"
#define DIV_VERSION "Hyper ESFMing"
#define DIV_ENGINE_VERSION 191
// for imports
#define DIV_VERSION_MOD 0xff01
Expand Down
106 changes: 106 additions & 0 deletions src/gui/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3010,6 +3010,23 @@ void FurnaceGUI::editOptions(bool topMenu) {
}
}

void FurnaceGUI::startESFMContest() {
e->createNew("id0=209","ESS ES1xxx series (ESFM)",false);
undoHist.clear();
redoHist.clear();
curFileName="";
modified=false;
curNibble=false;
orderNibble=false;
orderCursor=-1;
samplePos=0;
updateSampleTex=true;
selStart=SelectionPoint();
selEnd=SelectionPoint();
cursor=SelectionPoint();
updateWindowTitle();
}

void FurnaceGUI::toggleMobileUI(bool enable, bool force) {
if (mobileUI!=enable || force) {
if (!mobileUI && enable) {
Expand Down Expand Up @@ -4377,6 +4394,63 @@ bool FurnaceGUI::loop() {
}
ImGui::EndMenu();
}

time_t curTime=time(NULL);
ssize_t remain=1706504400-curTime;
bool contestWarn=(remain>0 && remain<86400 && (remain&1));
bool contestErr=(remain>0 && remain<3600 && (remain&1));
pushWarningColor(contestWarn,contestErr);
if (contestErr) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_ERROR]);
} else if (contestWarn) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_WARNING]);
} else {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_TEXT]);
}
if (ImGui::BeginMenu(settings.capitalMenuBar?"Contest":"contest")) {
if (remain<0) {
ImGui::Text("it's over! thank you for participating!");
} else {
int remainDays=remain/86400;
int remainHours=(remain/3600)%24;
int remainMins=(remain/60)%60;
int remainSecs=remain%60;

ImGui::Text("welcome to the ESFM demo song contest!\njoin the official Discord for more information:");

if (ImGui::Button("https://discord.gg/EfrwT2wq7z")) {
if (SDL_OpenURL("https://discord.gg/EfrwT2wq7z")!=0) {
showError("couldn't open link! you'll have to do it manually...");
}
ImGui::CloseCurrentPopup();
}

if (e->song.systemLen==1 && e->song.system[0]==DIV_SYSTEM_ESFM) {
ImGui::Text("your song qualifies for the contest. keep going!");
} else {
ImGui::Text("your song must be on the ESFM system. single-chip!");
}

ImGui::Text("remaining time:");
ImGui::PushFont(bigFont);
ImGui::Text("%d %s, %02d:%02d:%02d",remainDays,(remainDays==1?"day":"days"),remainHours,remainMins,remainSecs);
ImGui::PopFont();

ImGui::Separator();

if (ImGui::Button("click to start fresh!")) {
if (modified) {
showWarning("Unsaved changes! Save changes before getting into the contest?",GUI_WARN_ESFM);
} else {
startESFMContest();
}
ImGui::CloseCurrentPopup();
}
}
ImGui::EndMenu();
}
ImGui::PopStyleColor();
popWarningColor();
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PLAYBACK_STAT]);
if (e->isPlaying()) {
int totalTicks=e->getTotalTicks();
Expand Down Expand Up @@ -4869,6 +4943,9 @@ bool FurnaceGUI::loop() {
case GUI_WARN_NEW:
displayNew=true;
break;
case GUI_WARN_ESFM:
startESFMContest();
break;
case GUI_WARN_OPEN:
openOpen=true;
break;
Expand Down Expand Up @@ -5492,6 +5569,30 @@ bool FurnaceGUI::loop() {
ImGui::CloseCurrentPopup();
}
break;
case GUI_WARN_ESFM:
if (ImGui::Button("Yes")) {
ImGui::CloseCurrentPopup();
if (curFileName=="" || curFileName.find(backupPath)==0 || e->song.version>=0xff00) {
openFileDialog(GUI_FILE_SAVE);
postWarnAction=GUI_WARN_ESFM;
} else {
if (save(curFileName,e->song.isDMF?e->song.version:0)>0) {
showError(fmt::sprintf("Error while saving file! (%s)",lastError));
} else {
startESFMContest();
}
}
}
ImGui::SameLine();
if (ImGui::Button("No")) {
ImGui::CloseCurrentPopup();
startESFMContest();
}
ImGui::SameLine();
if (ImGui::Button("Cancel") || ImGui::IsKeyPressed(ImGuiKey_Escape)) {
ImGui::CloseCurrentPopup();
}
break;
case GUI_WARN_OPEN:
if (ImGui::Button("Yes")) {
ImGui::CloseCurrentPopup();
Expand Down Expand Up @@ -6284,6 +6385,10 @@ bool FurnaceGUI::loop() {
rend->clear(ImVec4(0,0,0,0));
mustClear--;
if (mustClear==0) e->everythingOK();
if (mustClear==0 && !heWarn) {
showWarning("welcome to Furnace Hyper ESFMing!\n\nthis version of Furnace is designed for the ESFM Demo Song Contest of January 2024.\n\ngo to the Contest menu for more information.",GUI_WARN_GENERIC);
heWarn=true;
}
} else {
if (initialScreenWipe>0.0f && !settings.disableFadeIn) {
WAKE_UP;
Expand Down Expand Up @@ -7641,6 +7746,7 @@ FurnaceGUI::FurnaceGUI():
initialScreenWipe(1.0f),
introSkipDo(false),
introStopped(false),
heWarn(false),
curTutorial(-1),
curTutorialStep(0),
audioExportType(0),
Expand Down
5 changes: 4 additions & 1 deletion src/gui/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ enum FurnaceGUIWarnings {
GUI_WARN_SYSTEM_DEL,
GUI_WARN_CLEAR_HISTORY,
GUI_WARN_BASIC_MODE,
GUI_WARN_ESFM,
GUI_WARN_GENERIC
};

Expand Down Expand Up @@ -2358,7 +2359,7 @@ class FurnaceGUI {
double monitorPos;
int mustClear;
float initialScreenWipe;
bool introSkipDo, introStopped;
bool introSkipDo, introStopped, heWarn;
ImVec2 introMin, introMax;

// tutorial
Expand Down Expand Up @@ -2453,6 +2454,8 @@ class FurnaceGUI {

void highlightWindow(const char* winName);

void startESFMContest();

FurnaceGUIImage* getImage(FurnaceGUIImages image);
FurnaceGUITexture* getTexture(FurnaceGUIImages image, FurnaceGUIBlendMode blendMode=GUI_BLEND_MODE_BLEND);
void drawImage(ImDrawList* dl, FurnaceGUIImages image, const ImVec2& pos, const ImVec2& scale, double rotate, const ImVec2& uvMin, const ImVec2& uvMax, const ImVec4& imgColor);
Expand Down
4 changes: 4 additions & 0 deletions src/gui/intro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,10 @@ void FurnaceGUI::drawIntro(double introTime, bool monitor) {
introPos=12.0;
tutorial.introPlayed=true;
commitTutorial();
if (!heWarn) {
showWarning("welcome to Furnace Hyper ESFMing!\n\nthis version of Furnace is designed for the ESFM Demo Song Contest of January 2024.\n\ngo to the Contest menu for more information.",GUI_WARN_GENERIC);
heWarn=true;
}
}
}
} else if (!shortIntro) {
Expand Down
8 changes: 8 additions & 0 deletions src/gui/presets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ void FurnaceGUI::initSystemPresets() {

FurnaceGUISysCategory cat;

CATEGORY_BEGIN("ESFM demo song contest","join the contest and contribute to Furnace!");
ENTRY(
"ESS ES1xxx series (ESFM)", {
CH(DIV_SYSTEM_ESFM, 1.0f, 0, "")
}
);
CATEGORY_END;

CATEGORY_BEGIN("Game consoles","let's play some chiptune making games!");
ENTRY(
"Sega Genesis", {
Expand Down

0 comments on commit 0ce48ea

Please sign in to comment.