* 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:
parent
20f8a6a856
commit
e0b2d2e5f0
17 changed files with 353 additions and 36 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue