From b5d64f9c20611eb99b4d908d72e6cfd05f1a4c65 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 16 Mar 2016 21:35:41 -0400 Subject: TITANIC: Renames/fixes for OSVideoSurface methods --- engines/titanic/string.cpp | 6 ++++-- engines/titanic/video_surface.cpp | 16 ++++++++-------- engines/titanic/video_surface.h | 12 +++++++++--- 3 files changed, 21 insertions(+), 13 deletions(-) (limited to 'engines') diff --git a/engines/titanic/string.cpp b/engines/titanic/string.cpp index dbe0617f06..44e0e627f3 100644 --- a/engines/titanic/string.cpp +++ b/engines/titanic/string.cpp @@ -26,11 +26,13 @@ namespace Titanic { CString CString::left(uint count) const { - return (count > size()) ? *this : CString(c_str(), c_str() + count); + return (count > size()) ? CString() : CString(c_str(), c_str() + count); } CString CString::right(uint count) const { - return (count > size()) ? *this : CString(c_str() - count, c_str()); + int strSize = size(); + return (count > strSize) ? CString() : + CString(c_str() + strSize - count, c_str() + strSize); } CString CString::mid(uint start, uint count) const { diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index 771c7779e0..44b91c0ed0 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -29,7 +29,7 @@ int CVideoSurface::_videoSurfaceCounter = 0; CVideoSurface::CVideoSurface(CScreenManager *screenManager) : _screenManager(screenManager), _pixels(nullptr), - _field34(0), _field38(0), _field3C(0), _field40(0), + _field34(0), _pendingLoad(false), _field3C(0), _field40(0), _field44(4), _field48(0), _field50(1) { _videoSurfaceNum = _videoSurfaceCounter++; } @@ -46,12 +46,12 @@ OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface _ddSurface = surface; } -OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, const CResourceKey &key, bool flag) : +OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, const CResourceKey &key, bool pendingLoad) : CVideoSurface(screenManager) { _ddSurface = nullptr; - _field38 = flag; + _pendingLoad = pendingLoad; - if (_field38) { + if (_pendingLoad) { loadResource(key); } else { _resourceKey = key; @@ -61,7 +61,7 @@ OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, const CResourceKey void OSVideoSurface::loadResource(const CResourceKey &key) { _resourceKey = key; - _field38 = 1; + _pendingLoad = true; if (hasSurface()) load(); @@ -80,7 +80,7 @@ void OSVideoSurface::loadMovie() { } bool OSVideoSurface::lock() { - if (!proc42()) + if (!loadIfReady()) return false; ++_lockCount; @@ -141,12 +141,12 @@ bool OSVideoSurface::load() { } } -bool OSVideoSurface::proc42() { +bool OSVideoSurface::loadIfReady() { _videoSurfaceNum = _videoSurfaceCounter; if (hasSurface()) { return true; - } else if (_field38) { + } else if (_pendingLoad) { _field50 = 1; load(); return true; diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index 445165c9df..d03e322d03 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -43,7 +43,7 @@ protected: DirectDrawSurface *_ddSurface; uint16 *_pixels; int _field34; - bool _field38; + bool _pendingLoad; int _field3C; int _field40; int _field44; @@ -114,7 +114,10 @@ public: */ virtual bool load() = 0; - virtual bool proc42() = 0; + /** + * Loads the surface's resource if there's one pending + */ + virtual bool loadIfReady() = 0; }; class OSVideoSurface : public CVideoSurface { @@ -177,7 +180,10 @@ public: */ virtual bool load(); - virtual bool proc42(); + /** + * Loads the surface's resource if there's one pending + */ + virtual bool loadIfReady(); }; } // End of namespace Titanic -- cgit v1.2.3