diff options
author | Paul Gilbert | 2016-05-09 21:03:21 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-10 16:39:01 -0400 |
commit | 0820c3ffaee211270ab75a14cd1d42047354aa34 (patch) | |
tree | 3c97672d3fb1f1f7b534e6013d53cbcf64f6bcb8 /engines/titanic/support | |
parent | b99fa6ba8c7f4a5407ff59812e5e6023c8a3301c (diff) | |
download | scummvm-rg350-0820c3ffaee211270ab75a14cd1d42047354aa34.tar.gz scummvm-rg350-0820c3ffaee211270ab75a14cd1d42047354aa34.tar.bz2 scummvm-rg350-0820c3ffaee211270ab75a14cd1d42047354aa34.zip |
TITANIC: Refactor CTitleEngine to use CFilesManager for PE resources
Diffstat (limited to 'engines/titanic/support')
-rw-r--r-- | engines/titanic/support/files_manager.cpp | 16 | ||||
-rw-r--r-- | engines/titanic/support/files_manager.h | 2 | ||||
-rw-r--r-- | engines/titanic/support/font.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/support/mouse_cursor.cpp | 2 |
4 files changed, 8 insertions, 14 deletions
diff --git a/engines/titanic/support/files_manager.cpp b/engines/titanic/support/files_manager.cpp index 8e70387a5f..eb2f95e92e 100644 --- a/engines/titanic/support/files_manager.cpp +++ b/engines/titanic/support/files_manager.cpp @@ -26,13 +26,12 @@ namespace Titanic { -CFilesManager::CFilesManager() : _gameManager(nullptr), - _assetsPath("Assets"), _exeResources(nullptr), _field0(0), - _drive(-1), _field18(0), _field1C(0), _field3C(0) { +CFilesManager::CFilesManager() : _gameManager(nullptr), _assetsPath("Assets"), + _field0(0), _drive(-1), _field18(0), _field1C(0), _field3C(0) { + _exeResources.loadFromEXE("st.exe"); } CFilesManager::~CFilesManager() { - delete _exeResources; } bool CFilesManager::fileExists(const CString &name) { @@ -94,13 +93,8 @@ void CFilesManager::preload(const CString &name) { } Common::SeekableReadStream *CFilesManager::getResource( - Common::WinResourceID area, Common::WinResourceID name) { - if (!_exeResources) { - _exeResources = new Common::PEResources(); - _exeResources->loadFromEXE("st.exe"); - } - - return _exeResources->getResource(area, name); + Common::WinResourceID area, Common::WinResourceID name) { + return _exeResources.getResource(area, name); } } // End of namespace Titanic diff --git a/engines/titanic/support/files_manager.h b/engines/titanic/support/files_manager.h index 185670c764..6be6a13166 100644 --- a/engines/titanic/support/files_manager.h +++ b/engines/titanic/support/files_manager.h @@ -37,7 +37,7 @@ class CFilesManagerList : public List<ListItem> { class CFilesManager { private: CGameManager *_gameManager; - Common::PEResources *_exeResources; + Common::PEResources _exeResources; CFilesManagerList _list; CString _string1; CString _string2; diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp index cc93bbb3c2..916f02097b 100644 --- a/engines/titanic/support/font.cpp +++ b/engines/titanic/support/font.cpp @@ -41,7 +41,7 @@ STFont::~STFont() { void STFont::load(int fontNumber) { assert(!_dataPtr); - Common::SeekableReadStream *stream = g_vm->_filesManager.getResource( + Common::SeekableReadStream *stream = g_vm->_filesManager->getResource( Common::WinResourceID("STFONT"), fontNumber); if (!stream) error("Could not locate the specified font"); diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp index 6ddfecfd2a..6ebf4f2164 100644 --- a/engines/titanic/support/mouse_cursor.cpp +++ b/engines/titanic/support/mouse_cursor.cpp @@ -63,7 +63,7 @@ CMouseCursor::~CMouseCursor() { void CMouseCursor::loadCursorImages() { const CString name("ycursors.avi"); - g_vm->_filesManager.fn4(name); + g_vm->_filesManager->fn4(name); // WORKAROUND: We need to manipulate ycursors.avi file so it can be read // by the ScummVM AVIDecoder, by removing the redundant second video track |