From 27c80f012a15d0255881df363041217c2a8a7836 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 27 Feb 2017 19:45:00 -0500 Subject: TITANIC: Fix PET not showing on savegame load in front of nav helmet --- engines/titanic/core/resource_key.cpp | 9 ++++----- engines/titanic/core/resource_key.h | 5 ++--- engines/titanic/core/room_item.cpp | 4 ++-- engines/titanic/core/view_item.cpp | 2 +- engines/titanic/game_manager.cpp | 2 +- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/engines/titanic/core/resource_key.cpp b/engines/titanic/core/resource_key.cpp index 3db5812d7d..e10b3be4cb 100644 --- a/engines/titanic/core/resource_key.cpp +++ b/engines/titanic/core/resource_key.cpp @@ -58,7 +58,7 @@ void CResourceKey::setValue(const CString &name) { _value = _value.mid(idx + 1); } -CString CResourceKey::exists() const { +CString CResourceKey::getFilename() const { CString name = _key; // Check for a resource being specified within an ST container @@ -68,10 +68,9 @@ CString CResourceKey::exists() const { name += ".st"; } - // The original did tests for the file in the different - // asset paths, which aren't needed in ScummVM - Common::File f; - return f.exists(name) ? name : CString(); + // The original did tests for the file in the different asset paths, + // which aren't needed in ScummVM, so just return full name + return name; } bool CResourceKey::scanForFile() const { diff --git a/engines/titanic/core/resource_key.h b/engines/titanic/core/resource_key.h index 27b23ed1e7..f9c37a7de0 100644 --- a/engines/titanic/core/resource_key.h +++ b/engines/titanic/core/resource_key.h @@ -55,10 +55,9 @@ public: const CString &getString() const { return _key; } /** - * Checks whether a file for the given key exists, - * and returns it's filename if it does + * Extracts a filename from the resource key */ - CString exists() const; + CString getFilename() const; /** * Scans for a file with a matching name diff --git a/engines/titanic/core/room_item.cpp b/engines/titanic/core/room_item.cpp index 1c360c7571..afac3ec5d4 100644 --- a/engines/titanic/core/room_item.cpp +++ b/engines/titanic/core/room_item.cpp @@ -103,10 +103,10 @@ void CRoomItem::load(SimpleFile *file) { } void CRoomItem::postLoad() { - if (!_exitMovieKey.exists().empty()) + if (!_exitMovieKey.getFilename().empty()) return; - CString name = _transitionMovieKey.exists(); + CString name = _transitionMovieKey.getFilename(); if (name.right(7) == "nav.avi") { _exitMovieKey = CResourceKey(name.left(name.size() - 7) + "exit.avi"); } diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 15d187e194..15797438cb 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -81,7 +81,7 @@ void CViewItem::load(SimpleFile *file) { bool CViewItem::getResourceKey(CResourceKey *key) { *key = _resourceKey; - CString filename = key->exists(); + CString filename = key->getFilename(); return !filename.empty(); } diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 5f51498e93..da6048a663 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -132,7 +132,7 @@ void CGameManager::roomTransition(CRoomItem *oldRoom, CRoomItem *newRoom) { CResourceKey movieKey = (oldRoom == newRoom) ? oldRoom->getTransitionMovieKey() : oldRoom->getExitMovieKey(); - CString filename = movieKey.exists(); + CString filename = movieKey.getFilename(); if (g_vm->_filesManager->fileExists(filename)) { _movieSurface->freeSurface(); _movie = g_vm->_movieManager.createMovie(filename, _movieSurface); -- cgit v1.2.3