* Dink now continues to download and install dmods when in the background, but everywhere else pauses automatically

* After installing a dmod, you can now choose to play it now or go back to the browse dmod list
* DMOD data downloaded from dink network is now cached for that session (it's not going to change so quickly, so why stress DN.com if we don't have to)
* (Bugfix) "installing <dmod>..." text message is no longer truncated in a weird way sometimes
* (Bugfix) Fixed another issue where a base graphic could fill in with a missing .bmp in a sequence when it shouldn't


git-svn-id: svn://rtsoft.com/rtsvn/projects/RTDink@1505 353e56fe-9613-0410-8469-b96ad8e6f29c
This commit is contained in:
seth 2017-09-23 11:52:16 +00:00
parent 3998875161
commit 59d4b5754c
9 changed files with 166 additions and 49 deletions

View file

@ -180,7 +180,18 @@ first so it should be ok anyway)
* (Bugfix) dmod installer no longer chokes on zero byte files (I'm looking at you, 9gems)
* (Bugfix) Fixed memory leak and possible crash related to script loading
* (Bugfix) Fixed issue with the checkerboard shadow processing where the 8 bit RLE decoder failed because it was expecting an 8 bit target (most bmps don't use RLE, but Alliance does in places)
* (Bugfix) Fixed issue with loading certain 16 bit bmps incorrectly, fixed tilted text in Infinidink
* Went ahead and decided to accept 252,252,252 as alpha if it's index 255 on an 8bit sprite. This fixed the white background issue with Alliance dmod as well as Dinkcraft
* FEATURE: Can now download all DMODs from Dink Network directly from inside the game via Dan's php interface. Can sort by rating, latest update date, or alphabetically
- Note: Just to be safe, save state version has changed, so old save states won't load
------ Change log for 1.7.9 ----------
* Dink now continues to download and install dmods when in the background, but everywhere else pauses automatically
* After installing a dmod, you can now choose to play it now or go back to the browse dmod list
* DMOD data downloaded from dink network is now cached for that session (it's not going to change so quickly, so why stress DN.com if we don't have to)
* (Bugfix) "installing <dmod>..." text message is no longer truncated in a weird way sometimes
* (Bugfix) Fixed another issue where a base graphic could fill in with a missing .bmp in a sequence when it shouldn't
- Note: Just to be safe, save state version has changed, so old save states won't load

View file

@ -182,8 +182,8 @@ App::App()
m_bDidPostInit = false;
m_bHasDMODSupport = true;
//for mobiles
m_version = 1.78f;
m_versionString = "V1.7.8";
m_version = 1.79f;
m_versionString = "V1.7.9";
m_build = 1;
m_bCheatsEnabled = false;

View file

@ -473,7 +473,17 @@ void BrowseOnPostIntroTransition(VariantList *pVList)
Entity *pBG = pVList->Get(0).GetEntity();
//fresh download or use cached data?
if (g_dmodData.empty())
{
DownloadDMODList(pBG);
}
else
{
//use what we got
BrowseMenuAddScrollContent(pBG, NULL);
}
//CreateQuickTipFirstTimeOnly(pBG, "interface/iphone/quicktip_dmod.rttex", false);
}

View file

@ -11,6 +11,9 @@
#include "Network/NetHTTP.h"
#include "Entity/HTTPComponent.h"
#ifdef WINAPI
extern bool g_bAppCanRunInBackground;
#endif
void DMODInstallMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent from
{
@ -44,6 +47,14 @@ void DMODInstallMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=ent
}
if (pEntClicked->GetName() == "Abort")
{
//slide it off the screen and then kill the whole menu tree
SlideScreen(pEntClicked->GetParent(), false);
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
BrowseMenuCreate(pEntClicked->GetParent()->GetParent());
}
//GetEntityRoot()->PrintTreeAsText(); //useful for Loading
}
@ -64,6 +75,10 @@ void DMODInstallUpdateStatus(Entity *pMenu, string msg)
void DMODInstallShowMsg(Entity *pMenu, string myMsg, bool bSuccess = false)
{
#ifdef WINAPI
g_bAppCanRunInBackground = false;
#endif
Entity *pMsg = pMenu->GetEntityByName("status");
Entity *pLabel = pMenu->GetEntityByName("title_label");
@ -76,17 +91,43 @@ void DMODInstallShowMsg(Entity *pMenu, string myMsg, bool bSuccess = false)
pLabel->GetComponentByName("TextRender")->GetVar("text")->Set("Error!");
} else
{
pLabel->GetComponentByName("TextRender")->GetVar("text")->Set("Success!");
pLabel->GetComponentByName("TextRender")->GetVar("text")->Set("New quest added successfully.");
}
}
if (pMsg)
{
pMsg->RemoveComponentByName("Typer"); // a thing that types stuff
pMsg->GetComponentByName("TextRender")->GetVar("text")->Set(myMsg);
if (!pMsg->RemoveComponentByName("Typer"))
{
LogMsg("Failed to remove typer;");
}; // a thing that types stuff
}
Entity *pSkip = pMenu->GetEntityByName("Back");
if (bSuccess)
{
if (pSkip)
{
pSkip->GetComponentByName("TextRender")->GetVar("text")->Set("`wPlay it now");
}
//also add a button to keep browsing DMODs
float yStart = iPhoneMapY(230);
yStart = GetPos2DEntity(pSkip).y;
CL_Vec2f vPos(iPhoneMapX(300), yStart);
SetPos2DEntity(pSkip, vPos);
Entity *pEnt = CreateTextButtonEntity(pMenu, "Abort", iPhoneMapX(100), yStart, "Back", true);
SetAlignmentEntity(pEnt, ALIGNMENT_CENTER);
pEnt->GetFunction("OnButtonSelected")->sig_function.connect(&DMODInstallMenuOnSelect);
}
else
{
if (pSkip)
{
pSkip->GetComponentByName("TextRender")->GetVar("text")->Set("`wContinue");
@ -94,16 +135,26 @@ void DMODInstallShowMsg(Entity *pMenu, string myMsg, bool bSuccess = false)
}
}
void DMODSetTitleLabel(Entity *pMenu, string myMsg)
{
Entity *pLabel = pMenu->GetEntityByName("title_label");
if (pLabel)
{
//pLabel->RemoveComponentByName("Typer"); // a thing that types stuff
pLabel->RemoveComponentByName("Typer"); // a thing that types stuff
pLabel->GetComponentByName("TextRender")->GetVar("text")->Set(myMsg);
//just kidding, add typer back
EntityComponent *pTyper = pLabel->AddComponent(new TyperComponent);
pTyper->GetVar("text")->Set(".......");
pTyper->GetVar("speedMS")->Set(uint32(500));
}
@ -178,7 +229,7 @@ void OnDMODUnpackFinish(VariantList *pVList)
Entity *pMenu = pVList->m_variant[0].GetComponent()->GetParent();
DMODInstallSetProgressBar(1);
DMODInstallShowMsg(pMenu, pMenu->GetVar("originalFileName")->GetString()+" installed. Tap continue.", true);
DMODInstallShowMsg(pMenu, pMenu->GetVar("originalFileName")->GetString()+" installed.", true);
RemoveFile(GetDMODRootPath()+"temp.dmod");
RemoveFile("temp.dmod");
@ -265,6 +316,7 @@ void InitNetStuff(VariantList *pVList)
Entity * DMODInstallMenuCreate(Entity *pParentEnt, string dmodURL, string installDirectory, string sourceFileName, bool bFromBrowseMenu, string dmodName)
{
Entity *pBG = CreateOverlayEntity(pParentEnt, "DMODInstall", ReplaceWithDeviceNameInFileName("interface/iphone/bkgd_stone.rttex"), 0,0);
AddFocusIfNeeded(pBG, true);
@ -309,6 +361,11 @@ Entity * DMODInstallMenuCreate(Entity *pParentEnt, string dmodURL, string instal
Entity *pStatus = CreateTextLabelEntity(pBG, "status", x, iPhoneMapY(180), "Initializing...");
SetAlignmentEntity(pStatus, ALIGNMENT_CENTER);
#ifdef WINAPI
g_bAppCanRunInBackground = true;
#endif
if (bFromBrowseMenu)
{
Entity *pStatus = CreateTextLabelEntity(pBG, "title", x, iPhoneMapY(30), "-= Installing "+dmodName+" =-");

View file

@ -193,7 +193,7 @@ byte * FFReader::LoadFFIntoMemory(int index, int *pSizeOut)
}
byte * FFReader::LoadFileIntoMemory( string const &fName, int *pSizeOut )
byte * FFReader::LoadFileIntoMemory( string const &fName, int *pSizeOut, const string &fFirstFrame)
{
#ifdef _DEBUG
@ -202,6 +202,18 @@ byte * FFReader::LoadFileIntoMemory( string const &fName, int *pSizeOut )
int len;
byte *pBuff = NULL;
bool bUsingDMODDirOnly = false;
if (fFirstFrame != fName && !m_dmodGamePath.empty())
{
//what if load part of a sequence from the DMOD dir, but part from the DInk dir? That would be bad
if (FileExists(m_dmodGamePath + m_basePath + fFirstFrame))
{
bUsingDMODDirOnly = true;
}
}
if (m_fp)
{
if (m_bUsingBaseDinkFF && !m_dmodGamePath.empty())
@ -218,7 +230,8 @@ byte * FFReader::LoadFileIntoMemory( string const &fName, int *pSizeOut )
}
}
if (!bUsingDMODDirOnly)
{
int index = GetFFRecordIndexFromFileName(fName);
if (index != -1)
@ -226,8 +239,10 @@ byte * FFReader::LoadFileIntoMemory( string const &fName, int *pSizeOut )
//we found it!
return LoadFFIntoMemory(index, pSizeOut);
}
} else
{
}
}
if (!m_dmodGamePath.empty())
{
@ -238,15 +253,18 @@ byte * FFReader::LoadFileIntoMemory( string const &fName, int *pSizeOut )
pBuff = GetFileManager()->Get(m_dmodGamePath+m_dmodBasePath+fName, &len,false);
if (!pBuff) SetError(ERROR_LOW_MEM);
return pBuff;
}
}
}
}
if (!bUsingDMODDirOnly)
{
//pBuff = LoadFileIntoMemoryBasic(m_gamePath+m_basePath+fName, &len, false, false);
pBuff = GetFileManager()->Get(m_gamePath + m_basePath + fName, &len, false);
if (len == UINT_MAX) SetError(ERROR_LOW_MEM);
return pBuff;
}
return NULL;
}

View file

@ -35,7 +35,7 @@ public:
bool DoesFileExist(const string &fName, const string &fFirstFrame);
void Init( const string &gamePath, const string &dmodGamePath, const string &baseDir, bool bUsingDinkPak);
byte * LoadFileIntoMemory(string const &fName, int *pSizeout); //you need to delete [] what this gives you on your own
byte * LoadFileIntoMemory(string const &fName, int *pSizeout, const string &fFirstFrame); //you need to delete [] what this gives you on your own
eErrorType GetLastError() {return m_error;}
private:

View file

@ -16,7 +16,7 @@ bool pre_figure_out(const char *line, int load_seq, bool bLoadSpriteOnly);
#define C_DINK_SCREEN_TRANSITION_TIME_MS 400
const float SAVE_FORMAT_VERSION = 2.6f;
const float SAVE_FORMAT_VERSION = 2.7f;
const int C_DINK_FADE_TIME_MS = 300;
const float G_TRANSITION_SCALE_TRICK = 1.01f;
@ -1533,7 +1533,7 @@ bool LoadSpriteSingleFrame(string fNameBase, int seq, int oo, int picIndex, eTra
fName += toString(oo) + ".bmp";
byte *pMem = pReader->LoadFileIntoMemory(fName, NULL);
byte *pMem = pReader->LoadFileIntoMemory(fName, NULL, fNameBase + "01.bmp");
if (g_dglos.g_seq[seq].m_spaceAllowed != 0)
{
@ -1587,6 +1587,18 @@ bool LoadSpriteSingleFrame(string fNameBase, int seq, int oo, int picIndex, eTra
}
#ifdef _DEBUG
if (seq == 181 && oo == 11)
{
LogMsg("hey");
}
#endif
if (seq == 181 && oo == 11)
{
//hack for exp divider to be trans
transType = TRANSPARENT_WHITE;
}
g_pSpriteSurface[picIndex] = LoadBitmapIntoSurface("", transType, IDirectDrawSurface::MODE_SHADOW_GL, pMem, bUseCheckerboardFix);
}
@ -1595,7 +1607,9 @@ bool LoadSpriteSingleFrame(string fNameBase, int seq, int oo, int picIndex, eTra
if (oo == 1)
{
#ifdef _DEBUG
LogMsg("load_sprites: Anim %s not found.", (fName).c_str());
#endif
//assert(0);
return false;
}
@ -2068,10 +2082,10 @@ bool figure_out(const char *line, int load_seq)
int seqID = atol(ev[3]);
#ifdef _DEBUG
if (seqID == 453)
if (seqID == 104)
{
// LogMsg("Loading sand stuff");
LogMsg("Loading sand stuff");
}
#endif
@ -2645,6 +2659,7 @@ void draw_mlevel(int percent, bool bDraw)
void draw_status_all(void)
{
g_forceBuildBackgroundFromScratch = true;
ClearBitmapCopy();
g_dglos.g_guiStrength = *pstrength;
@ -4283,9 +4298,9 @@ int var_equals(char name[20], char newname[20], char math, int script, char rest
}
#ifdef _DEBUG
if (string(name) == "&startscreen")
if (string(name) == "&vision")
{
// LogMsg("Var!");
LogMsg("Var!");
}
#endif
int i = get_var(script, name);
@ -5353,11 +5368,10 @@ void changedir( int dir1, int k,int base)
}
void update_play_changes( void )
{
for (int j = 1; j < 100; j++)
for (int j = 1; j < C_MAX_SPRITES_AT_ONCE; j++)
{
if (g_dglos.g_smallMap.sprite[j].active)
if (g_dglos.g_playerInfo.spmap[*pmap].type[j] != 0)
@ -5562,7 +5576,7 @@ void place_sprites_game(bool bBackgroundOnly )
highest_sprite = 20000; //more than it could ever be
rank[r1] = 0;
for (int h1 = 1; h1 < 100; h1++)
for (int h1 = 1; h1 < C_MAX_SPRITES_AT_ONCE; h1++)
{
if (bs[h1] == false)
{
@ -5593,7 +5607,7 @@ void place_sprites_game(bool bBackgroundOnly )
#ifdef _DEBUG
if (g_dglos.g_smallMap.sprite[j].seq == 66)
{
LogMsg("Garden");
//LogMsg("Garden");
//bScaledBackgroundSpritesRequired = true;
//continue;
}
@ -5711,6 +5725,9 @@ void place_sprites_game(bool bBackgroundOnly )
if (strlen(g_dglos.g_smallMap.sprite[j].script) > 1)
{
#ifdef _DEBUG
LogMsg("Sprite %d is requesting that script %s is loaded when the map is drawn, vision is %d", j, g_dglos.g_smallMap.sprite[j].script, *pvision);
#endif
g_sprite[sprite].script = load_script(g_dglos.g_smallMap.sprite[j].script, sprite, true);
}
@ -7664,8 +7681,6 @@ pass:
}
if (compare(ev[1], (char*)"draw_background"))
{
g_forceBuildBackgroundFromScratch = true;
@ -7931,7 +7946,7 @@ pass:
*pvision = g_nlist[0];
g_scriptInstance[script]->sprite = 1000;
fill_whole_hard();
BuildScreenBackground();
BuildScreenBackground(true, true);
}
strcpy(pLineIn, h);
@ -10583,7 +10598,7 @@ void init_scripts(void)
{
for (int k = 1; k < C_MAX_SCRIPTS; k++)
{
if (g_scriptInstance[k] != NULL && g_scriptInstance[k]->sprite != 0 && g_scriptInstance[k]->sprite < 300 && g_sprite[g_scriptInstance[k]->sprite].active )
if (g_scriptInstance[k] != NULL && g_scriptInstance[k]->sprite != 0 && g_scriptInstance[k]->sprite < C_MAX_SPRITES_AT_ONCE && g_sprite[g_scriptInstance[k]->sprite].active )
{
if (locate(k,"main"))
{
@ -17303,6 +17318,7 @@ bool LoadState(string const &path, bool bLoadPathsOnly)
if ( g_dglos.g_gameMode > 2 || g_dglos.m_bRenderBackgroundOnLoad)
{
if (g_sprite[1].brain != 13)
BuildScreenBackground(false, true);
}
@ -17604,12 +17620,17 @@ void DinkOnForeground()
//reinit any lost surfaces that we need to
if ( g_dglos.g_gameMode > 2 || g_dglos.m_bRenderBackgroundOnLoad)
{
if (g_dglos.m_bRenderBackgroundOnLoad)
if (g_dglos.m_bRenderBackgroundOnLoad && g_sprite[1].brain != 13)
{
g_forceBuildBackgroundFromScratch = true;
}
if (g_sprite[1].brain != 13)
{
//brain 13 means mouse so we probably don't need this. Could be wrong though..
BuildScreenBackground(false);
}
}
if (g_dglos.g_bShowingBitmap.active)
{

View file

@ -169,7 +169,7 @@ const int C_MAX_SCRIPTS = 400;
#else
const int32 C_MAX_SEQUENCES = 1300; //Max # of sprite animations
const int32 C_MAX_SPRITES = 6000;
const int32 C_MAX_SPRITES_AT_ONCE = 300;
const int32 C_MAX_SPRITES_AT_ONCE = 100; //don't change, there are still hardcoded numbers elsewhere and some weird stuff with screen lock and "flub" stuff whatever that is
const int32 C_MAX_SCRIPT_CALLBACKS = 100;
const int32 max_vars = 250;

View file

@ -7,7 +7,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug GL|Win32'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>-game dmods/alliance</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>-game dmods/akt2</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Common Debug|Win32'">
<LocalDebuggerCommandArguments>