* Fixed issue with Bloop being slow (actually that's a Proton fix, so update that!)

* Some misc fixes to stuff
* File import/export partially done, not ready yet
* HTML5 build system updated to use new shared template code

git-svn-id: svn://rtsoft.com/rtsvn/projects/RTDink@1627 353e56fe-9613-0410-8469-b96ad8e6f29c
This commit is contained in:
seth 2018-06-13 11:00:20 +00:00
parent bc4a02cf86
commit 7b8c9cb79a
11 changed files with 209 additions and 22 deletions

View file

@ -10,6 +10,20 @@
#include "PopUpMenu.h"
#include "Entity/SelectButtonWithCustomInputComponent.h"
#if defined _DEBUG || defined PLATFORM_HTML5
const bool G_ALLOW_SAVE_EXPORTING = true;
#else
const bool G_ALLOW_SAVE_EXPORTING = false;
#endif
#ifdef PLATFORM_HTML5
#include "HTML5Utils.h"
#endif
void PlayMenuMusic()
{
@ -103,7 +117,7 @@ void PauseEnd(Entity *pMenu)
GetMessageManager()->CallEntityFunction(pMenu, 500, "OnDelete", NULL);
GetBaseApp()->SetGameTickPause(false);
SyncPersistentData();
//SyncPersistentData();
}
@ -179,12 +193,13 @@ void PauseMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity se
{
//slide it off the screen and then kill the whole menu tree
RemoveFocusIfNeeded(pMenu);
SaveState(g_dglo.m_savePath+"continue_state.dat");
SaveState(g_dglo.m_savePath+"continue_state.dat", false);
WriteLastPathSaved("");
//kill our state.dat if it existed, not needed now, this can exist if an iphone goes into suspend, but then is resumed
RemoveFile(GetSavePath()+"state.dat", false);
//SlideScreen(pEntClicked->GetParent()->GetParent(), false);
DinkQuitGame();
SyncPersistentData();
}
if (pEntClicked->GetName() == "Debug")
@ -214,6 +229,37 @@ void PauseMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity se
}
if (pEntClicked->GetName() == "ExportQuickSave")
{
//SaveStateWithExtra(false);
//UpdatePauseButtons(pMenu);
GetAudioManager()->Play("audio/quick_save.wav");
SaveState(DinkGetSavePath() + "quicksave.dat");
string prepend = g_dglo.m_dmodGameDir;
if (prepend.empty()) prepend = "dink";
#ifdef PLATFORM_HTML5
HTMLDownloadFileFromFileSystem(DinkGetSavePath() + "quicksave.dat", prepend + "_quicksave.dat");
#endif
PauseEnd(pMenu);
ShowQuickMessage("Download started");
}
if (pEntClicked->GetName() == "ImportQuickSave")
{
#ifdef PLATFORM_HTML5
HTMLUploadFileToFileSystem();
// HTMLDownloadFileFromFileSystem(DinkGetSavePath() + "quicksave.dat", g_dglo.m_dmodGameDir + "_quicksave.dat");
#endif
PauseEnd(pMenu);
}
if (pEntClicked->GetName() == "QuickLoad")
{
LogMsg("loading state");
@ -361,11 +407,53 @@ Entity * PauseMenuCreate(Entity *pParentEnt)
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&PauseMenuOnSelect);
pButtonEntity->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
if (G_ALLOW_SAVE_EXPORTING)
{
Entity *pButton;
CL_Vec2f vEntSize = GetSize2DEntity(pButtonEntity);
CL_Vec2f vEntPos = GetPos2DEntity(pButtonEntity);
float spacer = 80;
pButton = CreateTextButtonEntity(pBG, "ExportQuickSave", vEntPos.x, (vEntPos.y + vEntSize.y/2) +spacer, "(Export Quicksave to file)", true);
SetAlignmentEntity(pButton, ALIGNMENT_DOWN_CENTER);
pButton->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&PauseMenuOnSelect);
//next button
// pButton = CreateTextButtonEntity(pBG, "ExportNormalSave", vEntPos.x, (vEntPos.y + vEntSize.y / 2) + spacer+spacer, "(Export last save slot save)", true);
// SetAlignmentEntity(pButton, ALIGNMENT_DOWN_CENTER);
// pButton->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&PauseMenuOnSelect);
}
pButtonEntity = CreateOverlayButtonEntity(pBG , "QuickLoad", ReplaceWithLargeInFileName("interface/iphone/button_quickload.rttex"), iPhoneMapX(395), GetScreenSizeYf()/2);
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&PauseMenuOnSelect);
pButtonEntity->GetVar("alignment")->Set(uint32(ALIGNMENT_CENTER));
if (G_ALLOW_SAVE_EXPORTING)
{
Entity *pButton;
CL_Vec2f vEntSize = GetSize2DEntity(pButtonEntity);
CL_Vec2f vEntPos = GetPos2DEntity(pButtonEntity);
float spacer = 80;
pButton = CreateTextButtonEntity(pBG, "ImportQuickSave", vEntPos.x, (vEntPos.y + vEntSize.y / 2) + spacer, "(Import Quicksave file)", true);
SetAlignmentEntity(pButton, ALIGNMENT_DOWN_CENTER);
pButton->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&PauseMenuOnSelect);
SetButtonStyleEntity(pButton, Button2DComponent::BUTTON_STYLE_CLICK_ON_TOUCH); //to get around HTML5 rules on uploading, required because it's only
//allowed when initiated by a user click
//
// //next button
// pButton = CreateTextButtonEntity(pBG, "ImportNormalSave", vEntPos.x, (vEntPos.y + vEntSize.y / 2) + spacer + spacer, "(Import save slot file)", true);
// SetAlignmentEntity(pButton, ALIGNMENT_DOWN_CENTER);
// pButton->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&PauseMenuOnSelect);
}
UpdatePauseButtons(pBG);
pButtonEntity = CreateTextButtonEntity(pTextBG, "Map", x, y, "VIEW MAP", false); y += ySpacer;
@ -414,11 +502,12 @@ Entity * PauseMenuCreate(Entity *pParentEnt)
SetButtonClickSound(pButtonEntity, ""); //no sound
EntityComponent *pKeys = AddHotKeyToButton(pButtonEntity, VIRTUAL_KEY_BACK);
//work around problem of it instantly closing
pKeys->GetVar("disabled")->Set(uint32(1));
GetMessageManager()->SetComponentVariable(pKeys, 500, "disabled", uint32(0)); //enable it again
if (IsDesktop())
if (IsDesktop() || GetEmulatedPlatformID() == PLATFORM_ID_HTML5)
{
EntityComponent *pKeys = AddHotKeyToButton(pButtonEntity, VIRTUAL_KEY_F1);
//work around problem of it instantly closing
@ -426,6 +515,8 @@ Entity * PauseMenuCreate(Entity *pParentEnt)
GetMessageManager()->SetComponentVariable(pKeys, 500, "disabled", uint32(0)); //enable it again
}
/*
pKeys = AddHotKeyToButton(pButtonEntity, VIRTUAL_KEY_PROPERTIES);
//work around problem of it instantly closing