* (Windows) Running "dink.exe c:\temp\ACoolDMOD.dmod" from the command line will now install it, then run it. (original dmod file won't be deleted) Just seemed weird that this didn't exist so added it

* DMOD installer progress now switches to showing MB instead of K if the size is big
* BUGFIX: Fixed map loading bug that could crash the game (I added this one recently trying to clean up code to use more consts rather than magic #s, but there is always the risk I stupidely break something!)
* load_tile no longer instantly takes effect but requires a draw_screen or moving screens, this matches how 1.08 worked.  Loading a save state or resizing the window will cause it to happen early, but hey, close enough
* BUGFIX: Fixed extra nasty bug where logic on certain things like charging your magic would pause the amount of time you used TAB to skip time

git-svn-id: svn://rtsoft.com/rtsvn/projects/RTDink@1517 353e56fe-9613-0410-8469-b96ad8e6f29c
This commit is contained in:
seth 2017-10-02 13:48:06 +00:00
parent 7b57f6f277
commit 36a414e12a
12 changed files with 96 additions and 52 deletions

View file

@ -216,7 +216,14 @@ void OnDMODUnpackStatusUpdate(VariantList *pVList)
float progress = float( (curBytes%barSize)) /float(barSize);
//LogMsg("prog: %.2f", progress);
DMODInstallUpdateStatus(NULL, "Writing "+toString(curBytes/1024)+"K");
int installSize = curBytes / 1024;
string sizeType = "K";
if (installSize > 10000)
{
installSize /= 1024;
sizeType = "MB";
}
DMODInstallUpdateStatus(NULL, "Writing "+toString(installSize)+ " "+sizeType);
DMODInstallSetProgressBar(progress);
}
@ -249,8 +256,9 @@ void OnDMODInstallHTTPFinish(VariantList *pVList)
DMODSetTitleLabel(pMenu, string("Installing ")+pMenu->GetVar("originalFileName")->GetString()+"...");
EntityComponent *pUnpack = pMenu->AddComponent(new UnpackArchiveComponent);
pUnpack->GetVar("sourceFileName")->Set(pMenu->GetVar("tempFileName")->GetString());
pUnpack->GetVar("deleteSourceOnFinish")->Set(uint32(1));
bool bDeleteOnFinish = pMenu->GetVar("deleteOnFinish")->GetUINT32();
pUnpack->GetVar("deleteSourceOnFinish")->Set(uint32(bDeleteOnFinish));
pUnpack->GetVar("destDirectory")->Set(pMenu->GetVar("installDirectory")->GetString());
DMODInstallSetProgressBar(0);
@ -310,7 +318,7 @@ void InitNetStuff(VariantList *pVList)
}
Entity * DMODInstallMenuCreate(Entity *pParentEnt, string dmodURL, string installDirectory, string sourceFileName, bool bFromBrowseMenu, string dmodName)
Entity * DMODInstallMenuCreate(Entity *pParentEnt, string dmodURL, string installDirectory, string sourceFileName, bool bFromBrowseMenu, string dmodName, bool bDeleteOnFinish)
{
Entity *pBG = CreateOverlayEntity(pParentEnt, "DMODInstall", ReplaceWithDeviceNameInFileName("interface/iphone/bkgd_stone.rttex"), 0,0);
@ -331,11 +339,12 @@ Entity * DMODInstallMenuCreate(Entity *pParentEnt, string dmodURL, string instal
pBG->GetVar("tempFileName")->Set(GetDMODRootPath()+"temp.dmod");
pBG->GetVar("originalFileName")->Set(GetFileNameFromString(dmodURL));
pBG->GetVar("fromBrowseMenu")->Set(uint32(bFromBrowseMenu));
pBG->GetVar("deleteOnFinish")->Set(uint32(bDeleteOnFinish));
if (IsLargeScreen())
{
//SetupTextEntity(pTitleLabel, FONT_LARGE);
}
//SetAlignmentEntity(pTitleLabel, ALIGNMENT_CENTER);
EntityComponent *pTyper = pTitleLabel->AddComponent(new TyperComponent);
@ -370,6 +379,11 @@ Entity * DMODInstallMenuCreate(Entity *pParentEnt, string dmodURL, string instal
pBG->GetVar("exitto")->Set("browse");
}
if (!bDeleteOnFinish)
{
pBG->GetVar("autoplay")->Set(uint32(1));
}
if (!sourceFileName.empty())
{

View file

@ -3,5 +3,5 @@
#include "App.h"
Entity * DMODInstallMenuCreate(Entity *pParentEnt, string dmodURL, string installDirectory, string sourceFileName = "", bool bFromBrowseMenu = false, string dmodName = "");
Entity * DMODInstallMenuCreate(Entity *pParentEnt, string dmodURL, string installDirectory, string sourceFileName = "", bool bFromBrowseMenu = false, string dmodName = "", bool bDeleteOnFinish = true);
#endif // DMODInstallMenu_h__

View file

@ -209,10 +209,30 @@ void MainMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sen
}
string GetNextDMODToInstall()
string GetNextDMODToInstall(bool &bIsCommandLineInstall, const bool bDeleteCommandLineParms)
{
//if (!GetApp()->CanDownloadDMODS()) return ""; //ignore it
if (IsDesktop())
{
vector<string> parms = GetApp()->GetCommandLineParms();
for (int i = 0; i < parms.size(); i++)
{
StringReplace("\"", "", parms[i]);
if (IsInString(ToLowerCaseString(parms[i]), ".dmod"))
{
bIsCommandLineInstall = true;
//dmod sent via commandline, install it
if (bDeleteCommandLineParms)
GetApp()->GetReferenceToCommandLineParms()[i].clear(); //don't want to install the same dmod twice
return parms[i];
}
}
}
vector<string> files = GetFilesAtPath(GetSavePath());
//LogMsg("listing files");
@ -240,10 +260,13 @@ void MainOnStartLoading(VariantList *pVList)
GetMessageManager()->CallEntityFunction(pBG, 500, "OnDelete", NULL);
pBG->SetName("MainMenuDelete");
string fName = GetNextDMODToInstall();
bool bIsCommandLineInstall = true;
string fName = GetNextDMODToInstall(bIsCommandLineInstall, true);
if (!fName.empty())
{
DMODInstallMenuCreate(pBG->GetParent(), "", GetDMODRootPath(), GetSavePath()+fName);
DMODInstallMenuCreate(pBG->GetParent(), "", GetDMODRootPath(), GetSavePath()+fName, false, "", !bIsCommandLineInstall);
} else
{
GameCreate(pBG->GetParent(), 0, fileName, "Continuing last game...");
@ -606,9 +629,10 @@ Entity * MainMenuCreate( Entity *pParentEnt, bool bFadeIn )
}
}
bool bIsCommandLineInstall = false;
if ( ! GetNextDMODToInstall().empty())
if ( ! GetNextDMODToInstall(bIsCommandLineInstall, false).empty())
{
pBG->GetFunction("OnStartLoading")->sig_function.connect(&MainOnStartLoading);
VariantList vList(pBG, string(""));