* Some stuff with changing the Dink HD menu key to F1 from Shift-Escape

* Added Dan's .png loading patch (untested)

git-svn-id: svn://rtsoft.com/rtsvn/projects/RTDink@1522 353e56fe-9613-0410-8469-b96ad8e6f29c
This commit is contained in:
seth 2017-10-17 04:33:21 +00:00
parent 20f8a6a856
commit e0b2d2e5f0
17 changed files with 353 additions and 36 deletions

View file

@ -762,8 +762,9 @@ void App::Update()
AddKeyBinding(pComp, "Magic", VIRTUAL_KEY_SHIFT, VIRTUAL_KEY_GAME_MAGIC);
AddKeyBinding(pComp, "Fire", VIRTUAL_KEY_CONTROL, VIRTUAL_KEY_GAME_FIRE);
AddKeyBinding(pComp, "Speedup", 9, 9); //handle tab
AddKeyBinding(pComp, "Quicksave", VIRTUAL_KEY_F1, VIRTUAL_KEY_F1);
AddKeyBinding(pComp, "Quicksave", VIRTUAL_KEY_F4, VIRTUAL_KEY_F4);
AddKeyBinding(pComp, "Quickload", VIRTUAL_KEY_F8, VIRTUAL_KEY_F8);
AddKeyBinding(pComp, "DinkHDMenu", VIRTUAL_KEY_F1, VIRTUAL_KEY_F1);
}
if (GetVar("check_icade")->GetUINT32() == 0)

View file

@ -212,8 +212,9 @@ if (IsDesktop())
"Enter ``- `8Inventory screen/Inventory select\n``"\
"M ``- `8Show map\n\n``"\
"TAB ``- `8Speed up game (hold it down)\n``"\
"F1 ``- `8Quick state save\n``"\
"F4 ``- `8Quick state save\n``"\
"F8 ``- `8Quick state load\n``"\
"F1 ``- `8Dink HD Menu\n``"\
"Alt-Enter ``- `8Toggle fullscreen\n``"\
"Drag window corners ``- `8Changes screensize. Hold Shift to allow any aspect ratio\n``"\
"\n`6Stuck? Try visiting `wdinknetwork.com`` or use google to find a walkthrough.\n"\

View file

@ -89,6 +89,7 @@ void GameOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent fr
{
#ifdef WINAPI
/*
if (GetKeyState(VK_SHIFT) & 0xfe)
{
if (!pMenu->GetEntityByName("PauseMenu"))
@ -98,12 +99,13 @@ void GameOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sent fr
}
return;
}
*/
#endif
g_dglo.m_dirInput[DINK_INPUT_BUTTON5] = true;
g_dglo.m_dirInputFinished[DINK_INPUT_BUTTON5] = true;
ShowQuickMessageBottom("(Use Shift-Escape to bring up the Dink HD menu!)");
ShowQuickMessageBottom("(Use `wF1`` to bring up the Dink HD menu!)");
return;
}
else
@ -1121,12 +1123,31 @@ void OnArcadeInput(VariantList *pVList)
LogMsg("Quitting");
break;
case VIRTUAL_KEY_F1:
case VIRTUAL_KEY_F4:
if (bIsDown)
SaveStateWithExtra();
break;
case VIRTUAL_KEY_F1:
if (bIsDown)
{
Entity *pMenu = GetEntityRoot()->GetEntityByName("GameMenu");
if (pMenu)
{
if (!pMenu->GetEntityByName("PauseMenu"))
{
pMenu->RemoveComponentByName("FocusInput");
PauseMenuCreate(pMenu);
}
}
}
break;
case VIRTUAL_KEY_F8:
{
if (bIsDown)

View file

@ -211,6 +211,8 @@ void MainMenuOnSelect(VariantList *pVList) //0=vec2 point of click, 1=entity sen
string GetNextDMODToInstall(bool &bIsCommandLineInstall, const bool bDeleteCommandLineParms)
{
bIsCommandLineInstall = false;
//if (!GetApp()->CanDownloadDMODS()) return ""; //ignore it
if (IsDesktop())

View file

@ -403,6 +403,14 @@ Entity * PauseMenuCreate(Entity *pParentEnt)
pKeys->GetVar("disabled")->Set(uint32(1));
GetMessageManager()->SetComponentVariable(pKeys, 500, "disabled", uint32(0)); //enable it again
if (IsDesktop())
{
EntityComponent *pKeys = AddHotKeyToButton(pButtonEntity, VIRTUAL_KEY_F1);
//work around problem of it instantly closing
pKeys->GetVar("disabled")->Set(uint32(1));
GetMessageManager()->SetComponentVariable(pKeys, 500, "disabled", uint32(0)); //enable it again
}
/*
pKeys = AddHotKeyToButton(pButtonEntity, VIRTUAL_KEY_PROPERTIES);
//work around problem of it instantly closing

View file

@ -8,7 +8,7 @@
// "SetUnhandledExceptionFilter" and VC8
// http://blog.kalmbachnet.de/?postid=75
// and
// Unhandled exceptions in VC8 and abovefor x86 and x64
// Unhandled exceptions in VC8 and abovefor x86 and x64
// http://blog.kalmbach-software.de/2008/04/02/unhandled-exceptions-in-vc8-and-above-for-x86-and-x64/
// Even better: http://blog.kalmbach-software.de/2013/05/23/improvedpreventsetunhandledexceptionfilter/

View file

@ -192,6 +192,21 @@ byte * FFReader::LoadFFIntoMemory(int index, int *pSizeOut)
return pMem;
}
inline bool ends_with(const std::string & value, const std::string & ending)
{
if (ending.size() > value.size()) return false;
return std::equal(ending.rbegin(), ending.rend(), value.rbegin());
}
inline bool isBmpFile(const std::string& path)
{
return ends_with(path, ".bmp");
}
inline std::string getPngPath(const std::string& path)
{
return path.substr(0, path.size() - 4) + ".png";
}
byte * FFReader::LoadFileIntoMemory( string const &fName, int *pSizeOut, const string &fFirstFrame)
{
@ -199,7 +214,6 @@ byte * FFReader::LoadFileIntoMemory( string const &fName, int *pSizeOut, const s
#ifdef _DEBUG
//LogMsg("loading for %s", (m_basePath+fName).c_str());
#endif
int len;
byte *pBuff = NULL;
bool bUsingDMODDirOnly = false;
@ -208,7 +222,8 @@ byte * FFReader::LoadFileIntoMemory( string const &fName, int *pSizeOut, const s
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))
if (FileExists(m_dmodGamePath + m_basePath + fFirstFrame) ||
(isBmpFile(fFirstFrame) && FileExists(getPngPath(m_dmodGamePath + m_basePath + fFirstFrame))))
{
bUsingDMODDirOnly = true;
}
@ -220,10 +235,18 @@ byte * FFReader::LoadFileIntoMemory( string const &fName, int *pSizeOut, const s
{
//you know what? Let's do a last minute try in the dmod dir as well.
if (FileExists(m_dmodGamePath + m_dmodBasePath + fName))
if (isBmpFile(fName) && FileExists(getPngPath(m_dmodGamePath + m_dmodBasePath + fName)))
{
//pBuff = LoadFileIntoMemoryBasic(m_dmodGamePath+m_basePath+fName, &len, false, false);
pBuff = GetFileManager()->Get(m_dmodGamePath + m_dmodBasePath + fName, &len, false);
pBuff = GetFileManager()->Get(getPngPath(m_dmodGamePath + m_dmodBasePath + fName), pSizeOut, false);
if (!pBuff) SetError(ERROR_LOW_MEM);
return pBuff;
}
else if (FileExists(m_dmodGamePath + m_dmodBasePath + fName))
{
//pBuff = LoadFileIntoMemoryBasic(m_dmodGamePath+m_basePath+fName, &len, false, false);
pBuff = GetFileManager()->Get(m_dmodGamePath + m_dmodBasePath + fName, pSizeOut, false);
if (!pBuff) SetError(ERROR_LOW_MEM);
return pBuff;
@ -246,11 +269,17 @@ byte * FFReader::LoadFileIntoMemory( string const &fName, int *pSizeOut, const s
if (!m_dmodGamePath.empty())
{
if (FileExists(m_dmodGamePath+m_dmodBasePath+fName))
if (isBmpFile(fName) && FileExists(getPngPath(m_dmodGamePath + m_dmodBasePath + fName)))
{
//pBuff = LoadFileIntoMemoryBasic(m_dmodGamePath+m_basePath+fName, &len, false, false);
pBuff = GetFileManager()->Get(m_dmodGamePath+m_dmodBasePath+fName, &len,false);
pBuff = GetFileManager()->Get(getPngPath(m_dmodGamePath + m_dmodBasePath + fName), pSizeOut, false);
if (!pBuff) SetError(ERROR_LOW_MEM);
return pBuff;
}
else if (FileExists(m_dmodGamePath+m_dmodBasePath+fName))
{
//pBuff = LoadFileIntoMemoryBasic(m_dmodGamePath+m_basePath+fName, &len, false, false);
pBuff = GetFileManager()->Get(m_dmodGamePath+m_dmodBasePath+fName, pSizeOut,false);
if (!pBuff) SetError(ERROR_LOW_MEM);
return pBuff;
}
@ -258,10 +287,20 @@ byte * FFReader::LoadFileIntoMemory( string const &fName, int *pSizeOut, const s
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;
if (isBmpFile(fName) && FileExists(getPngPath(m_gamePath + m_basePath + fName)))
{
//pBuff = LoadFileIntoMemoryBasic(m_gamePath+m_basePath+fName, &len, false, false);
pBuff = GetFileManager()->Get(getPngPath(m_gamePath + m_basePath + fName), pSizeOut, false);
if (*pSizeOut == UINT_MAX) SetError(ERROR_LOW_MEM);
return pBuff;
}
else if (FileExists(m_gamePath + m_basePath + fName))
{
//pBuff = LoadFileIntoMemoryBasic(m_gamePath+m_basePath+fName, &len, false, false);
pBuff = GetFileManager()->Get(m_gamePath + m_basePath + fName, pSizeOut, false);
if (*pSizeOut == UINT_MAX) SetError(ERROR_LOW_MEM);
return pBuff;
}
}

View file

@ -1561,8 +1561,8 @@ bool LoadSpriteSingleFrame(string fNameBase, int seq, int oo, int picIndex, eTra
if (oo < 10) fName += "0";
fName += toString(oo) + ".bmp";
byte *pMem = pReader->LoadFileIntoMemory(fName, NULL, fNameBase + "01.bmp");
int pMemSize = 0;
byte *pMem = pReader->LoadFileIntoMemory(fName, &pMemSize, fNameBase + "01.bmp");
if (g_dglos.g_seq[seq].m_spaceAllowed != 0)
{
@ -1633,7 +1633,7 @@ bool LoadSpriteSingleFrame(string fNameBase, int seq, int oo, int picIndex, eTra
transType = TRANSPARENT_WHITE;
}
g_pSpriteSurface[picIndex] = LoadBitmapIntoSurface("", transType, IDirectDrawSurface::MODE_SHADOW_GL, pMem, bUseCheckerboardFix);
g_pSpriteSurface[picIndex] = LoadBitmapIntoSurface("", transType, IDirectDrawSurface::MODE_SHADOW_GL, pMem, pMemSize, bUseCheckerboardFix);
}
else
{
@ -1858,10 +1858,11 @@ bool load_sprites(char org[512], int seq, int speed, int xoffset, int yoffset, r
// LogMsg("Loading seq %d frame %d", seq, oo);
}
#endif
if (oo <= C_MAX_SPRITE_FRAMES && reader.DoesFileExist(fNameBase+string(hold)+toString(oo)+".bmp", fNameBase + "01.bmp"))
// 2 hours of debugging found that this is key to make 'png' graphics work.
if (oo <= C_MAX_SPRITE_FRAMES && (reader.DoesFileExist(fNameBase+string(hold)+toString(oo)+".bmp", fNameBase + "01.bmp") ||
reader.DoesFileExist(fNameBase+string(hold)+toString(oo)+".png", fNameBase + "01.png")))
{
g_dglos.g_curPicIndex++;
} else
{
if (oo == 1)

View file

@ -28,7 +28,7 @@ void KillVideoEngine()
void dderror(int hErr){};
IDirectDrawSurface * LoadBitmapIntoSurface(const char *pName, eTransparencyType trans, IDirectDrawSurface::eMode mode, byte *pMem, bool bUseCheckerboardFix)
IDirectDrawSurface * LoadBitmapIntoSurface(const char *pName, eTransparencyType trans, IDirectDrawSurface::eMode mode, byte *pMem, int pMemSize, bool bUseCheckerboardFix)
{
IDirectDrawSurface * pSurf;
@ -45,7 +45,7 @@ IDirectDrawSurface * LoadBitmapIntoSurface(const char *pName, eTransparencyType
//LogMsg("loading DDRAW bmp from mem");
#endif
//if this is set, ignore the filename
pSurf->m_pSurf->LoadFileFromMemory(pMem, SoftSurface::eColorKeyType(trans), 0, false, bUseCheckerboardFix);
pSurf->m_pSurf->LoadFileFromMemory(pMem, SoftSurface::eColorKeyType(trans), pMemSize, false, bUseCheckerboardFix);
} else
{
#ifdef _DEBUG

View file

@ -112,7 +112,7 @@ bool InitializeVideoSystem();
void KillVideoEngine();
void GetSizeOfSurface(IDirectDrawSurface *pdds, int *pX, int *pY);
IDirectDrawSurface * LoadBitmapIntoSurface(const char *pName, eTransparencyType trans= TRANSPARENT_NONE, IDirectDrawSurface::eMode mode = IDirectDrawSurface::MODE_SHADOW_GL, byte *pMem = NULL,
IDirectDrawSurface * LoadBitmapIntoSurface(const char *pName, eTransparencyType trans= TRANSPARENT_NONE, IDirectDrawSurface::eMode mode = IDirectDrawSurface::MODE_SHADOW_GL, byte *pMem = NULL, int pMemSize = 0,
bool bUseCheckerboardFix = false);
#endif // video_dx_h__