aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/star_control
diff options
context:
space:
mode:
authorPaul Gilbert2016-07-02 18:04:37 -0400
committerPaul Gilbert2016-07-15 19:26:24 -0400
commited06a1a44e508fe671d05a3b5de96fdc2a415ba7 (patch)
tree1688cbf51ef17755a46201c920a30d42471a22f2 /engines/titanic/star_control
parent79b4754b3318c21479dfccaf91dcf09fabf23fd4 (diff)
downloadscummvm-rg350-ed06a1a44e508fe671d05a3b5de96fdc2a415ba7.tar.gz
scummvm-rg350-ed06a1a44e508fe671d05a3b5de96fdc2a415ba7.tar.bz2
scummvm-rg350-ed06a1a44e508fe671d05a3b5de96fdc2a415ba7.zip
TITANIC: Added bulk ofCStarView draw
Diffstat (limited to 'engines/titanic/star_control')
-rw-r--r--engines/titanic/star_control/star_control.cpp5
-rw-r--r--engines/titanic/star_control/star_view.cpp41
-rw-r--r--engines/titanic/star_control/star_view.h18
-rw-r--r--engines/titanic/star_control/surface_fader_base.h16
4 files changed, 65 insertions, 15 deletions
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:
@@ -59,6 +62,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
*/
void draw(CScreenManager *screenManager);
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
@@ -36,18 +36,21 @@ private:
*/
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