* Applied 16 bit bmp loading fix to "fancy shadows" version too, forgot before
* (Bugfix) Dink is no longer sometimes incorrectly shown on screen right as a dmod is started * (Windows, DinkC, Performance) Logging code rewritten, it's was horribly slow before. If a DMOD spammed "debug" messages it would previously drastically slow down the entire dmod * (Bugfix) LOAD_SEQUENCE and LOAD_SEQUENCE_NOW fixes, fixes stuff in many dmods * Improved mouse handling on dialog menus, no longer accidently select the first option of the dink menu if you click slow after using HD's escape menu to get there git-svn-id: svn://rtsoft.com/rtsvn/projects/RTDink@1507 353e56fe-9613-0410-8469-b96ad8e6f29c
This commit is contained in:
parent
59d4b5754c
commit
45e7f2bd60
8 changed files with 559 additions and 481 deletions
|
@ -193,5 +193,17 @@ first so it should be ok anyway)
|
|||
* 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
|
||||
* Huh, turns out .D files are always loaded before .C files. I switched back to including .D files, otherwise if you didn't do a clean install my start.c changes don't show up
|
||||
* Fixed it so freedink.exe and the old dink can be run directly from the Dink HD directory without crashing. I didn't actually test it before, they didn't like / instead of \ in my .ini previously.
|
||||
I also added the CD and splash.bmp that were missing
|
||||
* Quick tip that pops up when playing the normal game now talks about the F1/F8 instant state save/load feature instead of talking about pressing the "pause icon" which doesn't even exist on the Windows build
|
||||
|
||||
- Note: Just to be safe, save state version has changed, so old save states won't load
|
||||
- Note: Just to be safe, save state version has changed, so old save states won't load
|
||||
|
||||
------ Change log for 1.8.0 ----------
|
||||
|
||||
* Applied 16 bit bmp loading fix to "fancy shadows" version too, forgot before
|
||||
* (Bugfix) Dink is no longer sometimes incorrectly shown on screen right as a dmod is started
|
||||
* (Windows, DinkC, Performance) Logging code rewritten, it's was horribly slow before. If a DMOD spammed "debug" messages it would previously drastically slow down the entire dmod
|
||||
* (Bugfix) LOAD_SEQUENCE and LOAD_SEQUENCE_NOW fixes, fixes stuff in many dmods
|
||||
* Improved mouse handling on dialog menus, no longer accidently select the first option of the dink menu if you click slow after using HD's escape menu to get there
|
||||
|
|
|
@ -172,6 +172,8 @@ const char * GetAppName()
|
|||
|
||||
App::App()
|
||||
{
|
||||
m_logFileHandle = NULL;
|
||||
|
||||
http://www.rtsoft.com
|
||||
|
||||
m_bGhostMode = false;
|
||||
|
@ -182,8 +184,8 @@ App::App()
|
|||
m_bDidPostInit = false;
|
||||
m_bHasDMODSupport = true;
|
||||
//for mobiles
|
||||
m_version = 1.79f;
|
||||
m_versionString = "V1.7.9";
|
||||
m_version = 1.80f;
|
||||
m_versionString = "V1.8.0";
|
||||
m_build = 1;
|
||||
m_bCheatsEnabled = false;
|
||||
|
||||
|
@ -197,6 +199,11 @@ App::App()
|
|||
App::~App()
|
||||
{
|
||||
|
||||
assert(m_logFileHandle);
|
||||
if (m_logFileHandle)
|
||||
fclose(m_logFileHandle);
|
||||
|
||||
|
||||
//L_ParticleSystem::deinit();
|
||||
}
|
||||
|
||||
|
@ -352,7 +359,7 @@ bool App::Init()
|
|||
#ifdef WINAPI
|
||||
OutputDebugString(text.c_str());
|
||||
#endif
|
||||
AddText(text.c_str(), (GetSavePath() + "log.txt").c_str());
|
||||
AddTextToLog(text.c_str(), (GetSavePath() + "log.txt").c_str());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1018,3 +1025,55 @@ void App::OnUnloadSurfaces()
|
|||
|
||||
//g_transitionSurf.Kill();
|
||||
}
|
||||
|
||||
void App::AddTextToLog(const char *tex, const char *filename)
|
||||
{
|
||||
if (strlen(tex) < 1) return;
|
||||
|
||||
if (m_logFileHandle == NULL)
|
||||
{
|
||||
|
||||
//open 'er up
|
||||
m_logFileHandle = fopen(filename, "wb");
|
||||
if (!m_logFileHandle)
|
||||
{
|
||||
assert(!"huh?");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_logFileHandle) return;
|
||||
fwrite(tex, strlen(tex), 1, m_logFileHandle);
|
||||
|
||||
}
|
||||
|
||||
//our custom LogMsg that isn't slow as shit
|
||||
void LogMsg(const char* traceStr, ...)
|
||||
{
|
||||
va_list argsVA;
|
||||
const int logSize = 1024 * 10;
|
||||
char buffer[logSize];
|
||||
memset((void*)buffer, 0, logSize);
|
||||
|
||||
va_start(argsVA, traceStr);
|
||||
vsnprintf_s(buffer, logSize, logSize, traceStr, argsVA);
|
||||
va_end(argsVA);
|
||||
|
||||
|
||||
OutputDebugString(buffer);
|
||||
OutputDebugString("\n");
|
||||
|
||||
if (IsBaseAppInitted())
|
||||
{
|
||||
GetBaseApp()->GetConsole()->AddLine(buffer);
|
||||
strcat(buffer, "\r\n");
|
||||
//OutputDebugString( (string("writing to ")+GetSavePath()+"log.txt\n").c_str());
|
||||
|
||||
//this is the slow part. Or was...
|
||||
|
||||
|
||||
|
||||
GetApp()->AddTextToLog(buffer, (GetSavePath() + "log.txt").c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ public:
|
|||
void OnMessage( Message &m );
|
||||
void OnLoadSurfaces();
|
||||
void OnUnloadSurfaces();
|
||||
void AddTextToLog(const char *tex, const char *filename);
|
||||
void AddDroidKeyboardKeys();
|
||||
void RemoveAndroidKeyboardKeys();
|
||||
void AddIcadeProvider();
|
||||
|
@ -115,6 +116,8 @@ private:
|
|||
int m_desktopBuild;
|
||||
bool m_bHasDMODSupport;
|
||||
bool m_bCheatsEnabled;
|
||||
FILE * m_logFileHandle;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -82,9 +82,14 @@ void CursorComponent::OnInput( VariantList *pVList )
|
|||
case MESSAGE_TYPE_GUI_CLICK_START:
|
||||
//HandleClickStart(pt);
|
||||
OnUpdatePos(pt);
|
||||
g_dglo.m_dirInput[DINK_INPUT_BUTTON1] = true;
|
||||
g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON1] = true;
|
||||
g_dinkMouseRightClick = true;
|
||||
|
||||
if (!m_bDisable)
|
||||
{
|
||||
|
||||
g_dglo.m_dirInput[DINK_INPUT_BUTTON1] = true;
|
||||
g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON1] = true;
|
||||
g_dinkMouseRightClick = true;
|
||||
}
|
||||
|
||||
break;
|
||||
case MESSAGE_TYPE_GUI_CLICK_END:
|
||||
|
|
|
@ -1,405 +1,401 @@
|
|||
#include "PlatformPrecomp.h"
|
||||
#include "DMODInstallMenu.h"
|
||||
#include "Entity/EntityUtils.h"
|
||||
#include "DMODMenu.h"
|
||||
#include "dink/dink.h"
|
||||
#include "GameMenu.h"
|
||||
#include "Entity/UnpackArchiveComponent.h"
|
||||
#include "Network/NetUtils.h"
|
||||
#include "MainMenu.h"
|
||||
#include "BrowseMenu.h"
|
||||
#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
|
||||
{
|
||||
Entity *pEntClicked = pVList->m_variant[1].GetEntity();
|
||||
Entity *pMenu = pEntClicked->GetParent();
|
||||
|
||||
LogMsg("Clicked %s entity", pEntClicked->GetName().c_str());
|
||||
|
||||
if (pEntClicked->GetName() == "Back")
|
||||
{
|
||||
//slide it off the screen and then kill the whole menu tree
|
||||
SlideScreen(pEntClicked->GetParent(), false);
|
||||
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
|
||||
if (pMenu->GetVar("exitto")->GetString() == "main")
|
||||
{
|
||||
MainMenuCreate(pMenu->GetParent());
|
||||
} else if (pMenu->GetVar("exitto")->GetString() == "browse")
|
||||
{
|
||||
BrowseMenuCreate(pEntClicked->GetParent()->GetParent());
|
||||
|
||||
} else if (pMenu->GetVar("exitto")->GetString() == "play")
|
||||
{
|
||||
|
||||
InitDinkPaths(GetBaseAppPath(), "dink", pMenu->GetVar("dmoddir")->GetString());
|
||||
|
||||
GameCreate(pMenu->GetParent(), 0, "");
|
||||
} else
|
||||
{
|
||||
DMODMenuCreate(pEntClicked->GetParent()->GetParent());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
void DMODInstallUpdateStatus(Entity *pMenu, string msg)
|
||||
{
|
||||
if (!pMenu)
|
||||
{
|
||||
pMenu = GetEntityRoot()->GetEntityByName("DMODInstall");
|
||||
}
|
||||
|
||||
Entity *pStatus = pMenu->GetEntityByName("status");
|
||||
if (pStatus)
|
||||
{
|
||||
pStatus->GetComponentByName("TextRender")->GetVar("text")->Set(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");
|
||||
if (pLabel)
|
||||
{
|
||||
pLabel->RemoveComponentByName("Typer"); // a thing that types stuff
|
||||
|
||||
if (!bSuccess)
|
||||
{
|
||||
pLabel->GetComponentByName("TextRender")->GetVar("text")->Set("Error!");
|
||||
} else
|
||||
{
|
||||
pLabel->GetComponentByName("TextRender")->GetVar("text")->Set("New quest added successfully.");
|
||||
}
|
||||
}
|
||||
|
||||
if (pMsg)
|
||||
{
|
||||
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);
|
||||
|
||||
#include "PlatformPrecomp.h"
|
||||
#include "DMODInstallMenu.h"
|
||||
#include "Entity/EntityUtils.h"
|
||||
#include "DMODMenu.h"
|
||||
#include "dink/dink.h"
|
||||
#include "GameMenu.h"
|
||||
#include "Entity/UnpackArchiveComponent.h"
|
||||
#include "Network/NetUtils.h"
|
||||
#include "MainMenu.h"
|
||||
#include "BrowseMenu.h"
|
||||
#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
|
||||
{
|
||||
Entity *pEntClicked = pVList->m_variant[1].GetEntity();
|
||||
Entity *pMenu = pEntClicked->GetParent();
|
||||
|
||||
LogMsg("Clicked %s entity", pEntClicked->GetName().c_str());
|
||||
|
||||
if (pEntClicked->GetName() == "Back")
|
||||
{
|
||||
//slide it off the screen and then kill the whole menu tree
|
||||
SlideScreen(pEntClicked->GetParent(), false);
|
||||
GetMessageManager()->CallEntityFunction(pEntClicked->GetParent(), 500, "OnDelete", NULL);
|
||||
if (pMenu->GetVar("exitto")->GetString() == "main")
|
||||
{
|
||||
MainMenuCreate(pMenu->GetParent());
|
||||
} else if (pMenu->GetVar("exitto")->GetString() == "browse")
|
||||
{
|
||||
BrowseMenuCreate(pEntClicked->GetParent()->GetParent());
|
||||
|
||||
} else if (pMenu->GetVar("exitto")->GetString() == "play")
|
||||
{
|
||||
|
||||
InitDinkPaths(GetBaseAppPath(), "dink", pMenu->GetVar("dmoddir")->GetString());
|
||||
|
||||
GameCreate(pMenu->GetParent(), 0, "");
|
||||
} else
|
||||
{
|
||||
DMODMenuCreate(pEntClicked->GetParent()->GetParent());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
void DMODInstallUpdateStatus(Entity *pMenu, string msg)
|
||||
{
|
||||
if (!pMenu)
|
||||
{
|
||||
pMenu = GetEntityRoot()->GetEntityByName("DMODInstall");
|
||||
}
|
||||
|
||||
Entity *pStatus = pMenu->GetEntityByName("status");
|
||||
if (pStatus)
|
||||
{
|
||||
pStatus->GetComponentByName("TextRender")->GetVar("text")->Set(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");
|
||||
if (pLabel)
|
||||
{
|
||||
pLabel->RemoveComponentByName("Typer"); // a thing that types stuff
|
||||
|
||||
if (!bSuccess)
|
||||
{
|
||||
pLabel->GetComponentByName("TextRender")->GetVar("text")->Set("Error!");
|
||||
} else
|
||||
{
|
||||
pLabel->GetComponentByName("TextRender")->GetVar("text")->Set("New quest added successfully.");
|
||||
}
|
||||
}
|
||||
|
||||
if (pMsg)
|
||||
{
|
||||
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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DMODSetTitleLabel(Entity *pMenu, string myMsg)
|
||||
{
|
||||
|
||||
Entity *pLabel = pMenu->GetEntityByName("title_label");
|
||||
if (pLabel)
|
||||
{
|
||||
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));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void DMODInstallOnError(VariantList *pVList)
|
||||
{
|
||||
NetHTTP::eError e = (NetHTTP::eError)pVList->m_variant[1].GetUINT32();
|
||||
|
||||
string msg = "`4Unable to connect to the\nnetwork.``\nPlease try again later.";
|
||||
|
||||
switch (e)
|
||||
{
|
||||
|
||||
case NetHTTP::ERROR_COMMUNICATION_TIMEOUT:
|
||||
msg = "`4Connection timed out. Try Later?";
|
||||
break;
|
||||
|
||||
case NetHTTP::ERROR_CANT_RESOLVE_URL:
|
||||
msg = "`4Can't find website. Bad url?";
|
||||
break;
|
||||
|
||||
case NetHTTP::ERROR_WRITING_FILE:
|
||||
msg = "`4Error writing file. Out of space?";
|
||||
break;
|
||||
|
||||
case NetHTTP::ERROR_404_FILE_NOT_FOUND:
|
||||
msg = "`4Server gave a 404: File not found. Bad url?";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
DMODInstallShowMsg(pVList->m_variant[0].GetComponent()->GetParent(), msg);
|
||||
}
|
||||
|
||||
|
||||
void DMODUnpackOnError(VariantList *pVList)
|
||||
{
|
||||
int error = pVList->m_variant[1].GetUINT32();
|
||||
|
||||
string msg = "`4Error "+toString(error)+" unpacking. Out of space or malformed .dmod file?";
|
||||
|
||||
DMODInstallShowMsg(pVList->m_variant[0].GetComponent()->GetParent(), msg);
|
||||
}
|
||||
|
||||
void DMODInstallSetProgressBar(float progress)
|
||||
{
|
||||
Entity *pBar = GetEntityRoot()->GetEntityByName("bar");
|
||||
|
||||
if (pBar)
|
||||
{
|
||||
pBar->GetComponentByName("ProgressBar")->GetVar("progress")->Set(progress);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OnDMODUnpackStatusUpdate(VariantList *pVList)
|
||||
{
|
||||
int curBytes = pVList->Get(1).GetUINT32();
|
||||
int totalBytes = pVList->Get(2).GetUINT32();
|
||||
|
||||
int barSize = 1024*1024*5; //5 megs of unpacking will fill up one bar
|
||||
float progress = float( (curBytes%barSize)) /float(barSize);
|
||||
|
||||
//LogMsg("prog: %.2f", progress);
|
||||
DMODInstallUpdateStatus(NULL, "Writing "+toString(curBytes/1024)+"K");
|
||||
DMODInstallSetProgressBar(progress);
|
||||
}
|
||||
|
||||
void OnDMODUnpackFinish(VariantList *pVList)
|
||||
{
|
||||
Entity *pMenu = pVList->m_variant[0].GetComponent()->GetParent();
|
||||
|
||||
DMODInstallSetProgressBar(1);
|
||||
DMODInstallShowMsg(pMenu, pMenu->GetVar("originalFileName")->GetString()+" installed.", true);
|
||||
|
||||
RemoveFile(GetDMODRootPath()+"temp.dmod");
|
||||
RemoveFile("temp.dmod");
|
||||
|
||||
if (pMenu->GetVar("autoplay")->GetUINT32() == 1)
|
||||
{
|
||||
pMenu->GetVar("exitto")->Set("play");
|
||||
pMenu->GetVar("dmoddir")->Set(GetDMODRootPath()+ pVList->m_variant[0].GetComponent()->GetVar("firstDirCreated")->GetString());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void OnDMODInstallHTTPFinish(VariantList *pVList)
|
||||
{
|
||||
Entity *pMenu = pVList->m_variant[0].GetComponent()->GetParent();
|
||||
|
||||
#ifdef _DEBUG
|
||||
LogMsg("Finish signal received");
|
||||
#endif
|
||||
|
||||
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));
|
||||
|
||||
pUnpack->GetVar("destDirectory")->Set(pMenu->GetVar("installDirectory")->GetString());
|
||||
DMODInstallSetProgressBar(0);
|
||||
|
||||
pUnpack->GetFunction("OnError")->sig_function.connect(&DMODUnpackOnError);
|
||||
pUnpack->GetFunction("OnFinish")->sig_function.connect(&OnDMODUnpackFinish);
|
||||
pUnpack->GetFunction("OnStatusUpdate")->sig_function.connect(&OnDMODUnpackStatusUpdate);
|
||||
|
||||
}
|
||||
|
||||
void OnDMODInstallStatusUpdate(VariantList *pVList)
|
||||
{
|
||||
int curBytes = pVList->Get(1).GetUINT32();
|
||||
int totalBytes = pVList->Get(2).GetUINT32();
|
||||
|
||||
if (totalBytes == 0)
|
||||
{
|
||||
DMODInstallUpdateStatus(NULL, "Network active, getting file data...");
|
||||
} else
|
||||
{
|
||||
DMODInstallUpdateStatus(NULL, ""+toString(curBytes/1024)+"K/"+toString(totalBytes/1024)+"K");
|
||||
}
|
||||
|
||||
//also update the progress bar thingie
|
||||
if (totalBytes == 0) totalBytes = 1; //avoid /1 error
|
||||
DMODInstallSetProgressBar(float(curBytes)/float(totalBytes));
|
||||
}
|
||||
|
||||
void InitNetStuff(VariantList *pVList)
|
||||
{
|
||||
Entity *pMenu = pVList->m_variant[0].GetEntity();
|
||||
//get the internet stuff going
|
||||
EntityComponent *pComp = pMenu->AddComponent(new HTTPComponent);
|
||||
|
||||
string url = pMenu->GetVar("dmodURL")->GetString();
|
||||
string tempFileName = pMenu->GetVar("tempFileName")->GetString();
|
||||
|
||||
string domain;
|
||||
string request;
|
||||
int port = 80;
|
||||
|
||||
BreakDownURLIntoPieces(url, domain, request, port);
|
||||
VariantList v;
|
||||
v.m_variant[0].Set(tempFileName);
|
||||
pComp->GetFunction("SetFileOutput")->sig_function(&v);
|
||||
|
||||
v.Reset();
|
||||
|
||||
v.m_variant[0].Set(domain);
|
||||
v.m_variant[1].Set(uint32(port));
|
||||
v.m_variant[2].Set(request);
|
||||
pComp->GetFunction("Init")->sig_function(&v);
|
||||
|
||||
pComp->GetFunction("OnError")->sig_function.connect(&DMODInstallOnError);
|
||||
pComp->GetFunction("OnFinish")->sig_function.connect(&OnDMODInstallHTTPFinish);
|
||||
pComp->GetFunction("OnStatusUpdate")->sig_function.connect(&OnDMODInstallStatusUpdate);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
Entity *pButtonEntity;
|
||||
float x = GetScreenSizeXf()/2;
|
||||
float yStart = iPhoneMapY(230);
|
||||
float y = yStart;
|
||||
float ySpacer = iPhoneMapY(50);
|
||||
Entity *pProgressBar = pBG->AddEntity(new Entity("bar"));
|
||||
Entity *pTitleLabel = CreateTextLabelEntity(pBG, "title_label", iPhoneMapX(100), iPhoneMapY(80), "Please wait");
|
||||
|
||||
//save these for later
|
||||
pBG->GetVar("dmodURL")->Set(dmodURL);
|
||||
pBG->GetVar("dmodName")->Set(dmodName);
|
||||
pBG->GetVar("installDirectory")->Set(installDirectory);
|
||||
pBG->GetVar("tempFileName")->Set(GetDMODRootPath()+"temp.dmod");
|
||||
pBG->GetVar("originalFileName")->Set(GetFileNameFromString(dmodURL));
|
||||
pBG->GetVar("fromBrowseMenu")->Set(uint32(bFromBrowseMenu));
|
||||
|
||||
if (IsLargeScreen())
|
||||
{
|
||||
//SetupTextEntity(pTitleLabel, FONT_LARGE);
|
||||
}
|
||||
//SetAlignmentEntity(pTitleLabel, ALIGNMENT_CENTER);
|
||||
|
||||
EntityComponent *pTyper = pTitleLabel->AddComponent(new TyperComponent);
|
||||
pTyper->GetVar("text")->Set(".......");
|
||||
pTyper->GetVar("speedMS")->Set(uint32(500));
|
||||
|
||||
EntityComponent *pBar = pProgressBar->AddComponent(new ProgressBarComponent);
|
||||
pProgressBar->GetVar("pos2d")->Set(CL_Vec2f(iPhoneMapX(80),iPhoneMapY(120)));
|
||||
pProgressBar->GetVar("size2d")->Set(CL_Vec2f(iPhoneMapX(310),iPhoneMapY(15)));
|
||||
pProgressBar->GetVar("color")->Set(MAKE_RGBA(200,200,0,60));
|
||||
pBar->GetVar("interpolationTimeMS")->Set(uint32(1)); //update faster
|
||||
pBar->GetVar("borderColor")->Set(MAKE_RGBA(200,200,0,180));
|
||||
|
||||
pButtonEntity = CreateTextButtonEntity(pBG, "Back", x, y, "Cancel"); y += ySpacer;
|
||||
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DMODInstallMenuOnSelect);
|
||||
SetAlignmentEntity(pButtonEntity, ALIGNMENT_CENTER);
|
||||
AddHotKeyToButton(pButtonEntity, VIRTUAL_KEY_BACK);
|
||||
|
||||
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+" =-");
|
||||
|
||||
SetAlignmentEntity(pStatus, ALIGNMENT_CENTER);
|
||||
pBG->GetVar("exitto")->Set("browse");
|
||||
|
||||
}
|
||||
|
||||
if (!sourceFileName.empty())
|
||||
{
|
||||
//don't download, we already have the file
|
||||
pBG->GetVar("tempFileName")->Set(sourceFileName);
|
||||
pBG->GetVar("originalFileName")->Set(GetFileNameFromString(sourceFileName));
|
||||
|
||||
EntityComponent *pCrapComp = pBG->AddComponent(new EntityComponent("CRAP")); //I don't need this, but the function want a component and gets the parent for the menu, so fine
|
||||
pBG->GetVar("exitto")->Set("main");
|
||||
|
||||
//start the install in 500 ms, so we don't lag out the screen transition
|
||||
pBG->GetFunction("StartInstall")->sig_function.connect(&OnDMODInstallHTTPFinish);
|
||||
VariantList vList(pCrapComp);
|
||||
GetMessageManager()->CallEntityFunction(pBG, 500, "StartInstall", &vList);
|
||||
pStatus->GetVar("text")->Set("New .dmod file detected");
|
||||
} else
|
||||
{
|
||||
pBG->GetVar("autoplay")->Set(uint32(1));
|
||||
|
||||
pBG->GetFunction("InitNetStuff")->sig_function.connect(&InitNetStuff);
|
||||
VariantList vList(pBG);
|
||||
GetMessageManager()->CallEntityFunction(pBG, 500, "InitNetStuff", &vList);
|
||||
}
|
||||
|
||||
|
||||
SlideScreen(pBG, true, 500);
|
||||
return pBG;
|
||||
}
|
||||
|
||||
pEnt->GetFunction("OnButtonSelected")->sig_function.connect(&DMODInstallMenuOnSelect);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pSkip)
|
||||
{
|
||||
pSkip->GetComponentByName("TextRender")->GetVar("text")->Set("`wContinue");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DMODSetTitleLabel(Entity *pMenu, string myMsg)
|
||||
{
|
||||
|
||||
Entity *pLabel = pMenu->GetEntityByName("title_label");
|
||||
if (pLabel)
|
||||
{
|
||||
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));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void DMODInstallOnError(VariantList *pVList)
|
||||
{
|
||||
NetHTTP::eError e = (NetHTTP::eError)pVList->m_variant[1].GetUINT32();
|
||||
|
||||
string msg = "`4Unable to connect to the\nnetwork.``\nPlease try again later.";
|
||||
|
||||
switch (e)
|
||||
{
|
||||
|
||||
case NetHTTP::ERROR_COMMUNICATION_TIMEOUT:
|
||||
msg = "`4Connection timed out. Try Later?";
|
||||
break;
|
||||
|
||||
case NetHTTP::ERROR_CANT_RESOLVE_URL:
|
||||
msg = "`4Can't find website. Bad url?";
|
||||
break;
|
||||
|
||||
case NetHTTP::ERROR_WRITING_FILE:
|
||||
msg = "`4Error writing file. Out of space?";
|
||||
break;
|
||||
|
||||
case NetHTTP::ERROR_404_FILE_NOT_FOUND:
|
||||
msg = "`4Server gave a 404: File not found. Bad url?";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
DMODInstallShowMsg(pVList->m_variant[0].GetComponent()->GetParent(), msg);
|
||||
}
|
||||
|
||||
|
||||
void DMODUnpackOnError(VariantList *pVList)
|
||||
{
|
||||
int error = pVList->m_variant[1].GetUINT32();
|
||||
|
||||
string msg = "`4Error "+toString(error)+" unpacking. Out of space or malformed .dmod file?";
|
||||
|
||||
DMODInstallShowMsg(pVList->m_variant[0].GetComponent()->GetParent(), msg);
|
||||
}
|
||||
|
||||
void DMODInstallSetProgressBar(float progress)
|
||||
{
|
||||
Entity *pBar = GetEntityRoot()->GetEntityByName("bar");
|
||||
|
||||
if (pBar)
|
||||
{
|
||||
pBar->GetComponentByName("ProgressBar")->GetVar("progress")->Set(progress);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OnDMODUnpackStatusUpdate(VariantList *pVList)
|
||||
{
|
||||
int curBytes = pVList->Get(1).GetUINT32();
|
||||
int totalBytes = pVList->Get(2).GetUINT32();
|
||||
|
||||
int barSize = 1024*1024*5; //5 megs of unpacking will fill up one bar
|
||||
float progress = float( (curBytes%barSize)) /float(barSize);
|
||||
|
||||
//LogMsg("prog: %.2f", progress);
|
||||
DMODInstallUpdateStatus(NULL, "Writing "+toString(curBytes/1024)+"K");
|
||||
DMODInstallSetProgressBar(progress);
|
||||
}
|
||||
|
||||
void OnDMODUnpackFinish(VariantList *pVList)
|
||||
{
|
||||
Entity *pMenu = pVList->m_variant[0].GetComponent()->GetParent();
|
||||
|
||||
DMODInstallSetProgressBar(1);
|
||||
DMODInstallShowMsg(pMenu, pMenu->GetVar("originalFileName")->GetString()+" installed.", true);
|
||||
|
||||
RemoveFile(GetDMODRootPath()+"temp.dmod");
|
||||
RemoveFile("temp.dmod");
|
||||
|
||||
if (pMenu->GetVar("autoplay")->GetUINT32() == 1)
|
||||
{
|
||||
pMenu->GetVar("exitto")->Set("play");
|
||||
pMenu->GetVar("dmoddir")->Set(GetDMODRootPath()+ pVList->m_variant[0].GetComponent()->GetVar("firstDirCreated")->GetString());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void OnDMODInstallHTTPFinish(VariantList *pVList)
|
||||
{
|
||||
Entity *pMenu = pVList->m_variant[0].GetComponent()->GetParent();
|
||||
|
||||
#ifdef _DEBUG
|
||||
LogMsg("Finish signal received");
|
||||
#endif
|
||||
|
||||
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));
|
||||
|
||||
pUnpack->GetVar("destDirectory")->Set(pMenu->GetVar("installDirectory")->GetString());
|
||||
DMODInstallSetProgressBar(0);
|
||||
|
||||
pUnpack->GetFunction("OnError")->sig_function.connect(&DMODUnpackOnError);
|
||||
pUnpack->GetFunction("OnFinish")->sig_function.connect(&OnDMODUnpackFinish);
|
||||
pUnpack->GetFunction("OnStatusUpdate")->sig_function.connect(&OnDMODUnpackStatusUpdate);
|
||||
|
||||
}
|
||||
|
||||
void OnDMODInstallStatusUpdate(VariantList *pVList)
|
||||
{
|
||||
int curBytes = pVList->Get(1).GetUINT32();
|
||||
int totalBytes = pVList->Get(2).GetUINT32();
|
||||
|
||||
if (totalBytes == 0)
|
||||
{
|
||||
DMODInstallUpdateStatus(NULL, "Network active, getting file data...");
|
||||
} else
|
||||
{
|
||||
DMODInstallUpdateStatus(NULL, ""+toString(curBytes/1024)+"K/"+toString(totalBytes/1024)+"K");
|
||||
}
|
||||
|
||||
//also update the progress bar thingie
|
||||
if (totalBytes == 0) totalBytes = 1; //avoid /1 error
|
||||
DMODInstallSetProgressBar(float(curBytes)/float(totalBytes));
|
||||
}
|
||||
|
||||
void InitNetStuff(VariantList *pVList)
|
||||
{
|
||||
Entity *pMenu = pVList->m_variant[0].GetEntity();
|
||||
//get the internet stuff going
|
||||
EntityComponent *pComp = pMenu->AddComponent(new HTTPComponent);
|
||||
|
||||
string url = pMenu->GetVar("dmodURL")->GetString();
|
||||
string tempFileName = pMenu->GetVar("tempFileName")->GetString();
|
||||
|
||||
string domain;
|
||||
string request;
|
||||
int port = 80;
|
||||
|
||||
BreakDownURLIntoPieces(url, domain, request, port);
|
||||
VariantList v;
|
||||
v.m_variant[0].Set(tempFileName);
|
||||
pComp->GetFunction("SetFileOutput")->sig_function(&v);
|
||||
|
||||
v.Reset();
|
||||
|
||||
v.m_variant[0].Set(domain);
|
||||
v.m_variant[1].Set(uint32(port));
|
||||
v.m_variant[2].Set(request);
|
||||
pComp->GetFunction("Init")->sig_function(&v);
|
||||
|
||||
pComp->GetFunction("OnError")->sig_function.connect(&DMODInstallOnError);
|
||||
pComp->GetFunction("OnFinish")->sig_function.connect(&OnDMODInstallHTTPFinish);
|
||||
pComp->GetFunction("OnStatusUpdate")->sig_function.connect(&OnDMODInstallStatusUpdate);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
||||
Entity *pButtonEntity;
|
||||
float x = GetScreenSizeXf()/2;
|
||||
float yStart = iPhoneMapY(230);
|
||||
float y = yStart;
|
||||
float ySpacer = iPhoneMapY(50);
|
||||
Entity *pProgressBar = pBG->AddEntity(new Entity("bar"));
|
||||
Entity *pTitleLabel = CreateTextLabelEntity(pBG, "title_label", iPhoneMapX(100), iPhoneMapY(80), "Please wait");
|
||||
|
||||
//save these for later
|
||||
pBG->GetVar("dmodURL")->Set(dmodURL);
|
||||
pBG->GetVar("dmodName")->Set(dmodName);
|
||||
pBG->GetVar("installDirectory")->Set(installDirectory);
|
||||
pBG->GetVar("tempFileName")->Set(GetDMODRootPath()+"temp.dmod");
|
||||
pBG->GetVar("originalFileName")->Set(GetFileNameFromString(dmodURL));
|
||||
pBG->GetVar("fromBrowseMenu")->Set(uint32(bFromBrowseMenu));
|
||||
|
||||
if (IsLargeScreen())
|
||||
{
|
||||
//SetupTextEntity(pTitleLabel, FONT_LARGE);
|
||||
}
|
||||
//SetAlignmentEntity(pTitleLabel, ALIGNMENT_CENTER);
|
||||
|
||||
EntityComponent *pTyper = pTitleLabel->AddComponent(new TyperComponent);
|
||||
pTyper->GetVar("text")->Set(".......");
|
||||
pTyper->GetVar("speedMS")->Set(uint32(500));
|
||||
|
||||
EntityComponent *pBar = pProgressBar->AddComponent(new ProgressBarComponent);
|
||||
pProgressBar->GetVar("pos2d")->Set(CL_Vec2f(iPhoneMapX(80),iPhoneMapY(120)));
|
||||
pProgressBar->GetVar("size2d")->Set(CL_Vec2f(iPhoneMapX(310),iPhoneMapY(15)));
|
||||
pProgressBar->GetVar("color")->Set(MAKE_RGBA(200,200,0,60));
|
||||
pBar->GetVar("interpolationTimeMS")->Set(uint32(1)); //update faster
|
||||
pBar->GetVar("borderColor")->Set(MAKE_RGBA(200,200,0,180));
|
||||
|
||||
pButtonEntity = CreateTextButtonEntity(pBG, "Back", x, y, "Cancel"); y += ySpacer;
|
||||
pButtonEntity->GetShared()->GetFunction("OnButtonSelected")->sig_function.connect(&DMODInstallMenuOnSelect);
|
||||
SetAlignmentEntity(pButtonEntity, ALIGNMENT_CENTER);
|
||||
AddHotKeyToButton(pButtonEntity, VIRTUAL_KEY_BACK);
|
||||
|
||||
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+" =-");
|
||||
|
||||
SetAlignmentEntity(pStatus, ALIGNMENT_CENTER);
|
||||
pBG->GetVar("exitto")->Set("browse");
|
||||
|
||||
}
|
||||
|
||||
if (!sourceFileName.empty())
|
||||
{
|
||||
//don't download, we already have the file
|
||||
pBG->GetVar("tempFileName")->Set(sourceFileName);
|
||||
pBG->GetVar("originalFileName")->Set(GetFileNameFromString(sourceFileName));
|
||||
|
||||
EntityComponent *pCrapComp = pBG->AddComponent(new EntityComponent("CRAP")); //I don't need this, but the function want a component and gets the parent for the menu, so fine
|
||||
pBG->GetVar("exitto")->Set("main");
|
||||
|
||||
//start the install in 500 ms, so we don't lag out the screen transition
|
||||
pBG->GetFunction("StartInstall")->sig_function.connect(&OnDMODInstallHTTPFinish);
|
||||
VariantList vList(pCrapComp);
|
||||
GetMessageManager()->CallEntityFunction(pBG, 500, "StartInstall", &vList);
|
||||
pStatus->GetVar("text")->Set("New .dmod file detected");
|
||||
} else
|
||||
{
|
||||
pBG->GetVar("autoplay")->Set(uint32(1));
|
||||
|
||||
pBG->GetFunction("InitNetStuff")->sig_function.connect(&InitNetStuff);
|
||||
VariantList vList(pBG);
|
||||
GetMessageManager()->CallEntityFunction(pBG, 500, "InitNetStuff", &vList);
|
||||
}
|
||||
|
||||
|
||||
SlideScreen(pBG, true, 500);
|
||||
return pBG;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.7f;
|
||||
const float SAVE_FORMAT_VERSION = 2.8f;
|
||||
const int C_DINK_FADE_TIME_MS = 300;
|
||||
|
||||
const float G_TRANSITION_SCALE_TRICK = 1.01f;
|
||||
|
@ -915,6 +915,7 @@ void load_map(const int num)
|
|||
int holdme,lsize;
|
||||
|
||||
LogMsg("Loading map %d...",num);
|
||||
g_dglos.m_bRenderBackgroundOnLoad = true;
|
||||
|
||||
StreamingInstance *pFile = GetFileManager()->GetStreaming(GetFileLocationString(g_dglos.current_map), NULL, false);
|
||||
|
||||
|
@ -1627,6 +1628,8 @@ bool LoadSpriteSingleFrame(string fNameBase, int seq, int oo, int picIndex, eTra
|
|||
g_dglos.g_picInfo[picIndex].box.left = 0;
|
||||
g_dglos.g_picInfo[picIndex].box.right = surfSizeX;
|
||||
g_dglos.g_picInfo[picIndex].box.bottom = surfSizeY;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1803,7 +1806,7 @@ bool load_sprites(char org[512], int seq, int speed, int xoffset, int yoffset, r
|
|||
g_dglos.g_seq[seq].s = g_dglos.g_curPicIndex -1;
|
||||
}
|
||||
|
||||
if (bScanOnly)
|
||||
if (bScanOnly || g_dglos.g_seq[seq].frame[1] == 0)
|
||||
{
|
||||
if (reload)
|
||||
{
|
||||
|
@ -1839,7 +1842,8 @@ bool load_sprites(char org[512], int seq, int speed, int xoffset, int yoffset, r
|
|||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
if (bScanOnly)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2028,7 +2032,7 @@ bool ReloadSequence(int seqID, int frame, bool bScanOnly)
|
|||
if (g_dglos.g_seq[seqID].m_bFrameSetUsed)
|
||||
{
|
||||
//a set_frame_frame has been used here. This means we may reference another sprite that isn't loaded yet, better check
|
||||
for (int i = 0; i < C_MAX_SPRITE_FRAMES; i++)
|
||||
for (int i = 1; i < C_MAX_SPRITE_FRAMES; i++)
|
||||
{
|
||||
if (g_dglos.g_seq[seqID].frame[i] == 0)
|
||||
{
|
||||
|
@ -2082,7 +2086,7 @@ bool figure_out(const char *line, int load_seq)
|
|||
int seqID = atol(ev[3]);
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (seqID == 104)
|
||||
if (seqID == 131)
|
||||
{
|
||||
|
||||
LogMsg("Loading sand stuff");
|
||||
|
@ -2162,14 +2166,15 @@ bool pre_figure_out(const char *line, int load_seq, bool bLoadSpriteOnly)
|
|||
int seqID = atol(ev[3]);
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (seqID == 453)
|
||||
if (seqID == 131)
|
||||
{
|
||||
|
||||
// LogMsg("Loading sand stuff prefigure out");
|
||||
LogMsg("Loading sand stuff prefigure out");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
if (compare(ev[1], "LOAD_SEQUENCE") && g_dglos.g_seq[seqID].active == true)
|
||||
{
|
||||
//detect if this was already set somewhere first in the ini, on original Dink, this is a bug but doesn't matter because it doesn't load it, where with Dink HD LOAD_SEQUENCE_NOW's are
|
||||
|
@ -2180,6 +2185,8 @@ bool pre_figure_out(const char *line, int load_seq, bool bLoadSpriteOnly)
|
|||
return bReturn;
|
||||
|
||||
}
|
||||
*/
|
||||
//ignore above, we need it for dmods
|
||||
|
||||
|
||||
ReadFromLoadSequenceString(ev);
|
||||
|
@ -2294,7 +2301,12 @@ bool pre_figure_out(const char *line, int load_seq, bool bLoadSpriteOnly)
|
|||
if (special == -1)
|
||||
g_dglos.g_seq[myseq].frame[myframe] = special;
|
||||
else
|
||||
{
|
||||
g_dglos.g_seq[myseq].frame[myframe] = g_dglos.g_seq[special].frame[special2];
|
||||
|
||||
//also copy over the details...
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -2900,12 +2912,19 @@ bool get_box (int spriteID, rtRect32 * pDstRect, rtRect32 * pSrcRect )
|
|||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (g_sprite[spriteID].pseq == 75 )
|
||||
if (g_sprite[spriteID].pseq == 204 )
|
||||
{
|
||||
LogMsg("Yo");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (g_sprite[spriteID].pseq == 202)
|
||||
{
|
||||
LogMsg("Original");
|
||||
}
|
||||
#endif
|
||||
|
||||
int picID = getpic(spriteID);
|
||||
if (g_sprite[spriteID].size == 0) g_sprite[spriteID].size = 100;
|
||||
|
||||
|
@ -2922,11 +2941,22 @@ bool get_box (int spriteID, rtRect32 * pDstRect, rtRect32 * pSrcRect )
|
|||
{
|
||||
//wait.. this isn't the original picture, a set_frame_frame has been used! We want the offset from the original.
|
||||
|
||||
/*
|
||||
//is the parent seq of the original an anim?
|
||||
if (g_dglos.g_seq[g_dglos.g_picInfo[originalSurfPic].m_parentSeq].m_bIsAnim && g_dglos.g_picInfo[originalSurfPic].xoffset == 0 && g_dglos.g_picInfo[originalSurfPic].yoffset == 0)
|
||||
if (g_dglos.g_seq[g_dglos.g_picInfo[originalSurfPic].m_parentSeq].m_bIsAnim )
|
||||
{
|
||||
txoffset = g_dglos.g_seq[g_dglos.g_picInfo[originalSurfPic].m_parentSeq].m_xoffset;
|
||||
tyoffset = g_dglos.g_seq[g_dglos.g_picInfo[originalSurfPic].m_parentSeq].m_yoffset;
|
||||
|
||||
//first, does the original pic have stuff set for it?
|
||||
txoffset = g_dglos.g_picInfo[originalSurfPic].xoffset;
|
||||
tyoffset = g_dglos.g_picInfo[originalSurfPic].yoffset;
|
||||
|
||||
if (txoffset == 0 && tyoffset == 0)
|
||||
{
|
||||
//No? Well, how about the whole anim in general
|
||||
txoffset = g_dglos.g_seq[g_dglos.g_picInfo[originalSurfPic].m_parentSeq].m_xoffset;
|
||||
tyoffset = g_dglos.g_seq[g_dglos.g_picInfo[originalSurfPic].m_parentSeq].m_yoffset;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2934,6 +2964,13 @@ bool get_box (int spriteID, rtRect32 * pDstRect, rtRect32 * pSrcRect )
|
|||
tyoffset = g_dglos.g_picInfo[originalSurfPic].yoffset;
|
||||
|
||||
}
|
||||
*/
|
||||
// picID = originalSurfPic;
|
||||
// txoffset = g_dglos.g_picInfo[picID].xoffset;
|
||||
//tyoffset = g_dglos.g_picInfo[picID].yoffset;
|
||||
|
||||
txoffset = g_dglos.g_picInfo[picID].xoffset;
|
||||
tyoffset = g_dglos.g_picInfo[picID].yoffset;
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -4748,7 +4785,7 @@ morestuff:
|
|||
//this was also in the original dink, amazing nobody saw it?
|
||||
g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON1] = false;
|
||||
g_dglo.m_dirInput[DINK_INPUT_BUTTON1] = false;
|
||||
|
||||
g_dglos.g_playerInfo.mouse = 0;
|
||||
g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON2] = false;
|
||||
g_dglo.m_dirInput[DINK_INPUT_BUTTON2] = false;
|
||||
sjoy.button[1] = false;
|
||||
|
@ -5059,7 +5096,7 @@ void draw_sprite_game(LPDIRECTDRAWSURFACE lpdest,int h)
|
|||
DDBLTFX ddbltfx;
|
||||
ddbltfx.dwSize = sizeof( ddbltfx);
|
||||
ddbltfx.dwFillColor = 0;
|
||||
|
||||
|
||||
if (getpic(h) < 1) return;
|
||||
|
||||
|
||||
|
@ -5089,7 +5126,7 @@ void draw_sprite_game(LPDIRECTDRAWSURFACE lpdest,int h)
|
|||
//LogMsg("Drawing the rock");
|
||||
}
|
||||
|
||||
if (g_sprite[h].pseq == 75)
|
||||
if (g_sprite[h].pseq == 133)
|
||||
{
|
||||
LogMsg("Drawing a wall");
|
||||
|
||||
|
@ -5104,61 +5141,16 @@ void draw_sprite_game(LPDIRECTDRAWSURFACE lpdest,int h)
|
|||
return;
|
||||
assert(!"Bad rect");
|
||||
}
|
||||
|
||||
//check_seq_status(h);
|
||||
|
||||
//redink1 error checking for out-of-bounds clipping
|
||||
/*if (box_crap.left < 0)
|
||||
box_crap.left = 0;
|
||||
if (box_crap.top < box_real.top)
|
||||
box_crap.top = box_crap.top;
|
||||
if (box_crap.right > box_real.right)
|
||||
box_crap.right = box_real.right;
|
||||
if (box_crap.bottom > box_real.bottom)
|
||||
box_crap.bottom = box_real.bottom;*/
|
||||
|
||||
// Msg("Box_crap: %d %d %d %d, Box_real: %d %d %d %d",box_crap.left,box_crap.top,
|
||||
// box_crap.right, box_crap.bottom,box_real.left,box_real.top,
|
||||
// box_real.right, box_real.bottom);
|
||||
|
||||
/*
|
||||
if (g_sprite[h].pseq != 0)
|
||||
{
|
||||
if (!check_seq_status(g_sprite[h].pseq)) return;
|
||||
assert(!"Bad sprite");
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
if (lpdest->m_pSurf && lpdest->m_pSurf->GetSurfaceType() == SoftSurface::SURFACE_RGBA)
|
||||
{
|
||||
if (g_dglos.g_picInfo[getpic(h)].pSurface->m_pSurf->GetSurfaceType() == SoftSurface::SURFACE_RGBA)
|
||||
{
|
||||
|
||||
LogMsg("Doing rgba to rgba..");
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//check to see if we need a 32 bit buffer for this or not
|
||||
if (lpdest->m_pSurf && lpdest->m_pSurf->GetSurfaceType() == SoftSurface::SURFACE_PALETTE_8BIT)
|
||||
{
|
||||
if (g_pSpriteSurface[getpic(h)]->m_pSurf->GetSurfaceType() == SoftSurface::SURFACE_RGBA)
|
||||
{
|
||||
|
||||
|
||||
//yep, convert what we've got to 32 bit. We don't lose what we've done so far.
|
||||
|
||||
|
||||
assert(lpdest == lpDDSBackGround);
|
||||
|
||||
//convert it to a high color surface on the fly, without losing the data on it
|
||||
|
||||
LPDIRECTDRAWSURFACE pNewSurf = InitOffscreenSurface(C_DINK_SCREENSIZE_X, C_DINK_SCREENSIZE_Y, IDirectDrawSurface::MODE_SHADOW_GL, true, lpdest->m_pSurf);
|
||||
|
||||
|
||||
|
||||
LogMsg("Detected high color bmps that need to drawn to the static landscape, converting backbuffers to 32 bit on the fly.");
|
||||
delete lpDDSBackGround;
|
||||
|
||||
|
@ -5179,9 +5171,7 @@ void draw_sprite_game(LPDIRECTDRAWSURFACE lpdest,int h)
|
|||
g_forceBuildBackgroundFromScratch = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -5726,7 +5716,7 @@ 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);
|
||||
//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);
|
||||
}
|
||||
|
@ -10603,7 +10593,7 @@ void init_scripts(void)
|
|||
if (locate(k,"main"))
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
LogMsg("Screendraw: running main of script %s..", g_scriptInstance[k]->name);
|
||||
//LogMsg("Screendraw: running main of script %s..", g_scriptInstance[k]->name);
|
||||
#endif
|
||||
run_script(k);
|
||||
}
|
||||
|
@ -14847,10 +14837,12 @@ void DinkSetCursorPosition(CL_Vec2f vPos)
|
|||
|
||||
}
|
||||
|
||||
if (g_dglos.g_gameMode == 1) //dialog select?
|
||||
if (g_dglos.g_talkInfo.active != 0 && fabs(difY) < 100) //dialog select? the 100 is an ugly hack to get rid of accumulated pixels due to .. something
|
||||
{
|
||||
|
||||
//LogMsg("Mouse diff: %.2f", difY);
|
||||
#ifdef _DEBUG
|
||||
LogMsg("Mouse diff: %.2f", difY);
|
||||
#endif
|
||||
g_dglos.g_playerInfo.mouse += difY;
|
||||
}
|
||||
|
||||
|
@ -15781,6 +15773,7 @@ void DrawDinkText(int max_s, int32 *rank)
|
|||
|
||||
void updateFrame()
|
||||
{
|
||||
|
||||
if (!lpDDSBack || g_dglo.m_curLoadState != FINISHED_LOADING) return;
|
||||
bool bRenderDinkText = true;
|
||||
g_dinkFadeAlpha = 0;
|
||||
|
@ -16197,8 +16190,12 @@ void load_batch(int linesToProcess, float &percentOut)
|
|||
return;
|
||||
}
|
||||
|
||||
g_sprite[1].x = 200;
|
||||
g_sprite[1].y = 300;
|
||||
// g_sprite[1].x = 200;
|
||||
// g_sprite[1].y = 300;
|
||||
|
||||
|
||||
// g_sprite[1].x = 0;
|
||||
// g_sprite[1].y = 450;
|
||||
}
|
||||
|
||||
for (int i=0; i < linesToProcess; i++)
|
||||
|
@ -17318,6 +17315,11 @@ bool LoadState(string const &path, bool bLoadPathsOnly)
|
|||
|
||||
if ( g_dglos.g_gameMode > 2 || g_dglos.m_bRenderBackgroundOnLoad)
|
||||
{
|
||||
if (g_dglos.m_bRenderBackgroundOnLoad && g_sprite[1].brain != 13)
|
||||
{
|
||||
g_forceBuildBackgroundFromScratch = true;
|
||||
}
|
||||
|
||||
if (g_sprite[1].brain != 13)
|
||||
BuildScreenBackground(false, true);
|
||||
}
|
||||
|
@ -17618,7 +17620,7 @@ void DinkOnForeground()
|
|||
}
|
||||
|
||||
//reinit any lost surfaces that we need to
|
||||
if ( g_dglos.g_gameMode > 2 || g_dglos.m_bRenderBackgroundOnLoad)
|
||||
if ( g_dglos.g_gameMode > 2 || g_dglos.m_bRenderBackgroundOnLoad )
|
||||
{
|
||||
if (g_dglos.m_bRenderBackgroundOnLoad && g_sprite[1].brain != 13)
|
||||
{
|
||||
|
|
|
@ -386,7 +386,7 @@
|
|||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\source;..\..\shared;..\..\shared\win\;..\..\shared\util\boost;..\..\shared\ClanLib-2.0\Sources;..\..\shared\win\include;..\..\shared\FliteTTS\include;..\..\shared\Irrlicht\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;BOOST_ALL_NO_LIB;C_GL_MODE;_HAS_ITERATOR_DEBUGGING=0;_SECURE_SCL=0;_NO_DEBUG_HEAP=1;RT_JPG_SUPPORT;RT_DONT_DO_MOVE_TIMER_TRICK;RT_RUNS_IN_BACKGROUND_DISABLED;RT_IPV6;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;BOOST_ALL_NO_LIB;C_GL_MODE;_HAS_ITERATOR_DEBUGGING=0;_SECURE_SCL=0;_NO_DEBUG_HEAP=1;RT_JPG_SUPPORT;RT_DONT_DO_MOVE_TIMER_TRICK;RT_RUNS_IN_BACKGROUND_DISABLED;RT_IPV6;_USE_32BIT_TIME_T;RT_CUSTOM_LOGMSG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
|
@ -431,7 +431,7 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release GL|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\source;..\..\shared;..\..\shared\win\;..\..\shared\util\boost;..\..\shared\ClanLib-2.0\Sources;..\..\shared\win\include;..\..\shared\FliteTTS\include;..\dxsdk\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;BOOST_ALL_NO_LIB;_USE_32BIT_TIME_T;C_GL_MODE;RT_JPG_SUPPORT;RT_DONT_DO_MOVE_TIMER_TRICK;RT_IPV6;RT_RUNS_IN_BACKGROUNDD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;BOOST_ALL_NO_LIB;_USE_32BIT_TIME_T;C_GL_MODE;RT_JPG_SUPPORT;RT_DONT_DO_MOVE_TIMER_TRICK;RT_IPV6;RT_CUSTOM_LOGMSG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>PlatformPrecomp.h</PrecompiledHeaderFile>
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug GL|Win32'">
|
||||
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommandArguments>-game dmods/akt2</LocalDebuggerCommandArguments>
|
||||
<LocalDebuggerCommandArguments>
|
||||
</LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Common Debug|Win32'">
|
||||
<LocalDebuggerCommandArguments>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue