From ed06a1a44e508fe671d05a3b5de96fdc2a415ba7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 2 Jul 2016 18:04:37 -0400 Subject: TITANIC: Added bulk ofCStarView draw --- engines/titanic/core/game_object.cpp | 4 --- engines/titanic/core/game_object.h | 15 +++------ engines/titanic/star_control/star_control.cpp | 5 ++- engines/titanic/star_control/star_view.cpp | 41 +++++++++++++++++++---- engines/titanic/star_control/star_view.h | 18 +++++++--- engines/titanic/star_control/surface_fader_base.h | 16 ++++++--- 6 files changed, 70 insertions(+), 29 deletions(-) (limited to 'engines') diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index a5657f583a..dcc66f569d 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -1101,10 +1101,6 @@ Point CGameObject::getControid() const { _bounds.top + _bounds.height() / 2); } -void CGameObject::performAction(int actionNum, CViewItem *view) { - // TODO -} - bool CGameObject::clipExistsByStart(const CString &name, int startFrame) const { return _movieClips.existsByStart(name, startFrame); } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 8c53e159be..20059539d9 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -335,11 +335,6 @@ protected: */ void petClear() const; - /** - * Perform an action - */ - void performAction(int actionNum, CViewItem *view = nullptr); - /** * Returns the MailMan */ @@ -360,11 +355,6 @@ protected: */ CRoomItem *getHiddenRoom() const; - /** - * Returns a hidden object - */ - CGameObject *getHiddenObject(const CString &name) const; - /** * Scan the specified room for an item by name */ @@ -658,6 +648,11 @@ public: */ Found find(const CString &name, CGameObject **item, int findAreas); + /** + * Returns a hidden object + */ + CGameObject *getHiddenObject(const CString &name) const; + /** * Sets up credits text */ diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index aa65781e93..ae29f3af83 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -49,7 +49,10 @@ void CStarControl::load(SimpleFile *file) { if (!screenManager) error("There's no screen manager during loading"); - warning("TODO"); + _view.setup(screenManager, &_sub1, this); + _view.reset(); + + _fieldBC = 1; } CGameObject::load(file); diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp index 8af94c6b08..c31a28c4b2 100644 --- a/engines/titanic/star_control/star_view.cpp +++ b/engines/titanic/star_control/star_view.cpp @@ -22,13 +22,15 @@ #include "titanic/support/screen_manager.h" #include "titanic/star_control/star_view.h" +#include "titanic/star_control/star_control.h" +#include "titanic/core/game_object.h" namespace Titanic { -CStarView::CStarView() : - _sub12(nullptr, nullptr), _sub13(nullptr), - _field4(0), _videoSurface(nullptr), _field118(0), _field20C(0), - _field210(0), _field214(0), _field218(0), _field21C(0) { +CStarView::CStarView() : _sub12(nullptr, nullptr), _sub13(nullptr), + _owner(nullptr), _sub1(nullptr), _videoSurface(nullptr), _field118(0), + _videoSurface2(nullptr), _field210(0), _homePhotoMask(nullptr), + _field218(0), _field21C(0) { _sub12.proc3(); } @@ -56,12 +58,39 @@ void CStarView::save(SimpleFile *file, int indent) { file->writeNumberLine(_field21C, indent); } +void CStarView::setup(CScreenManager *screenManager, CStarControlSub1 *sub1, CStarControl *starControl) { + _sub1 = sub1; + _owner = starControl; +} + +void CStarView::reset() { + // TODO +} + void CStarView::draw(CScreenManager *screenManager) { - if (!screenManager) + if (!screenManager || !_videoSurface || !_sub1) return; + if (_fader.isActive()) { + CVideoSurface *surface = _field21C ? _videoSurface2 : _videoSurface; + surface = _fader.fade(screenManager, surface); + screenManager->blitFrom(SURFACE_PRIMARY, surface); + } else { + Point destPos(20, 10); - // TODO + if (_field21C) { + screenManager->blitFrom(SURFACE_PRIMARY, _videoSurface2, &destPos); + + if (!_homePhotoMask && _owner) { + _homePhotoMask = _owner->getHiddenObject("HomePhotoMask"); + } + + if (_homePhotoMask) + _homePhotoMask->draw(screenManager, Point(20, 187)); + } else { + // TODO + } + } } } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h index d625d9bf0f..cfd2c8c94d 100644 --- a/engines/titanic/star_control/star_view.h +++ b/engines/titanic/star_control/star_view.h @@ -31,18 +31,21 @@ namespace Titanic { +class CStarControl; +class CStarControlSub1; + class CStarView { private: - int _field0; - int _field4; + CStarControl *_owner; + CStarControlSub1 *_sub1; CVideoSurface *_videoSurface; CStarControlSub12 _sub12; int _field118; CStarControlSub13 _sub13; CSurfaceFader _fader; - int _field20C; + CVideoSurface *_videoSurface2; int _field210; - int _field214; + CGameObject *_homePhotoMask; int _field218; int _field21C; public: @@ -58,6 +61,13 @@ public: */ void save(SimpleFile *file, int indent); + /** + * Sets references used by the view + */ + void setup(CScreenManager *screenManager, CStarControlSub1 *sub1, CStarControl *starControl); + + void reset(); + /** * Allows the item to draw itself */ diff --git a/engines/titanic/star_control/surface_fader_base.h b/engines/titanic/star_control/surface_fader_base.h index ead4460521..463183537b 100644 --- a/engines/titanic/star_control/surface_fader_base.h +++ b/engines/titanic/star_control/surface_fader_base.h @@ -35,19 +35,22 @@ private: * Sets up an internal surface to match the size of the specified one */ bool setupSurface(CScreenManager *screenManager, CVideoSurface *srcSurface); -protected: - int _index; - int _count; - CVideoSurface *_videoSurface; protected: /** * Create a faded version of the source surface at the given dest */ virtual void copySurface(CSurfaceArea &srcSurface, CSurfaceArea &destSurface) = 0; +public: + int _index; + int _count; + CVideoSurface *_videoSurface; public: CSurfaceFaderBase(); virtual ~CSurfaceFaderBase(); + /** + * Reset fading back to the start + */ virtual void reset(); /** @@ -55,6 +58,11 @@ public: * visibility specified by _index of _count */ virtual CVideoSurface *fade(CScreenManager *screenManager, CVideoSurface *srcSurface); + + /** + * Returns true if a fade is in progress + */ + bool isActive() const { return _index != -1 && _index < _count; } }; } // End of namespace Titanic -- cgit v1.2.3