diff options
author | Tobia Tesan | 2014-10-15 19:43:26 +0200 |
---|---|---|
committer | Tobia Tesan | 2014-10-15 19:43:26 +0200 |
commit | ba1862ecb8bb80751c58e70f233449dd05e4245c (patch) | |
tree | 660fc97f0cf6e54d2bc6c2640fae3970db2dfe94 /engines/wintermute | |
parent | ec3b8fdde24324fd4a2ad5c37735644a79f1e574 (diff) | |
download | scummvm-rg350-ba1862ecb8bb80751c58e70f233449dd05e4245c.tar.gz scummvm-rg350-ba1862ecb8bb80751c58e70f233449dd05e4245c.tar.bz2 scummvm-rg350-ba1862ecb8bb80751c58e70f233449dd05e4245c.zip |
WINTERMUTE: Use BaseFileManager to load SUB file
Conflicts:
engines/wintermute/video/video_subtitler.cpp
Diffstat (limited to 'engines/wintermute')
-rw-r--r-- | engines/wintermute/video/video_subtitler.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/engines/wintermute/video/video_subtitler.cpp b/engines/wintermute/video/video_subtitler.cpp index 537378963e..072d1e1c99 100644 --- a/engines/wintermute/video/video_subtitler.cpp +++ b/engines/wintermute/video/video_subtitler.cpp @@ -29,6 +29,8 @@ // #include "dcgf.h" #include "engines/wintermute/video/video_subtitler.h" +#include "engines/wintermute/base/base_file_manager.h" + #define S_OK 0 #define BYTE byte #define LONG long @@ -73,9 +75,6 @@ bool CVidSubtitler::LoadSubtitles(char *Filename, char *SubtitleFile) { char NewFile[MAX_PATH]; - char drive[_MAX_DRIVE]; - char dir[_MAX_DIR]; - char fname[_MAX_FNAME]; if (SubtitleFile) { strcpy(NewFile, SubtitleFile); @@ -88,13 +87,14 @@ bool CVidSubtitler::LoadSubtitles(char *Filename, char *SubtitleFile) { #endif DWORD Size; -#if 0 - BYTE *Buffer = _gameRef->m_FileManager->ReadWholeFile(NewFile, &Size, false); - - if (Buffer == NULL) { + Common::SeekableReadStream *file = BaseFileManager::getEngineInstance()->openFile(NewFile, true, false); + if (file == nullptr) { return S_OK; // no subtitles } + Size = file->size(); + BYTE *Buffer = new BYTE[Size]; + file->read(Buffer, Size); LONG Start, End; bool InToken; @@ -105,6 +105,7 @@ bool CVidSubtitler::LoadSubtitles(char *Filename, char *SubtitleFile) { int Pos = 0; int LineLength = 0; + while (Pos < Size) { Start = End = -1; InToken = false; @@ -161,7 +162,7 @@ bool CVidSubtitler::LoadSubtitles(char *Filename, char *SubtitleFile) { Text[TextLength] = '\0'; if (Start != -1 && TextLength > 0 && (Start != 1 || End != 1)) { - m_Subtitles.Add(new CVidSubtitle(Game, Text, Start, End)); + m_Subtitles.push_back(new CVidSubtitle(_gameRef, Text, Start, End)); } delete [] Text; @@ -170,7 +171,7 @@ bool CVidSubtitler::LoadSubtitles(char *Filename, char *SubtitleFile) { } delete [] Buffer; -#endif + return S_OK; } |