- fixed file checks for Blood cutscenes.

The stripped drive-less name wasn't passed to the calling code.
This commit is contained in:
Christoph Oelckers 2020-01-26 11:42:02 +01:00
parent 245aa5d3bc
commit 3be4364d6e

View file

@ -161,17 +161,18 @@ void credReset(void)
DoUnFade(1); DoUnFade(1);
} }
FileReader credKOpen4Load(FString pzFile) bool credKOpen4Load(FString &pzFile)
{ {
int nLen = strlen(pzFile); int nLen = strlen(pzFile);
FixPathSeperator(pzFile); FixPathSeperator(pzFile);
auto nHandle = fileSystem.OpenFileReader(pzFile, 0); auto nHandle = fileSystem.FindFile(pzFile);
if (!nHandle.isOpen()) if (nHandle < 0)
{ {
// Hack // Strip the drive letter and retry.
if (nLen >= 3 && isalpha(pzFile[0]) && pzFile[1] == ':' && pzFile[2] == '/') if (nLen >= 3 && isalpha(pzFile[0]) && pzFile[1] == ':' && pzFile[2] == '/')
{ {
nHandle = fileSystem.OpenFileReader(pzFile.GetChars()+3, 0); pzFile = pzFile.Mid(3);
nHandle = fileSystem.FindFile(pzFile);
} }
} }
return nHandle; return nHandle;
@ -200,7 +201,7 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav)
FString pzSMK = _pzSMK; FString pzSMK = _pzSMK;
FString pzWAV = _pzWAV; FString pzWAV = _pzWAV;
auto nHandleSMK = credKOpen4Load(pzSMK); auto nHandleSMK = credKOpen4Load(pzSMK);
if (!nHandleSMK.isOpen()) if (!nHandleSMK)
{ {
return; return;
} }
@ -238,7 +239,7 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav)
else else
{ {
auto nHandleWAV = credKOpen4Load(pzWAV); auto nHandleWAV = credKOpen4Load(pzWAV);
if (nHandleWAV.isOpen()) if (nHandleWAV)
{ {
sndStartWavDisk(pzWAV, 255); sndStartWavDisk(pzWAV, 255);
} }