diff options
author | Paul Gilbert | 2017-03-01 23:07:08 -0500 |
---|---|---|
committer | Paul Gilbert | 2017-03-01 23:07:08 -0500 |
commit | e229e3c4a45e0b3a64e522d1dae18cfeee790f93 (patch) | |
tree | 6a62d5c84b1f593128cde035f98c62d51705ef17 /engines/titanic/star_control | |
parent | 49218970131904419777873019fbc8067d1d7a30 (diff) | |
download | scummvm-rg350-e229e3c4a45e0b3a64e522d1dae18cfeee790f93.tar.gz scummvm-rg350-e229e3c4a45e0b3a64e522d1dae18cfeee790f93.tar.bz2 scummvm-rg350-e229e3c4a45e0b3a64e522d1dae18cfeee790f93.zip |
TITANIC: Added starfield button down code
Diffstat (limited to 'engines/titanic/star_control')
-rw-r--r-- | engines/titanic/star_control/base_star.h | 9 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub2.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub2.h | 9 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub8.cpp | 18 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub8.h | 9 | ||||
-rw-r--r-- | engines/titanic/star_control/star_field.cpp | 16 | ||||
-rw-r--r-- | engines/titanic/star_control/star_field.h | 6 | ||||
-rw-r--r-- | engines/titanic/star_control/star_view.cpp | 10 | ||||
-rw-r--r-- | engines/titanic/star_control/star_view.h | 2 |
9 files changed, 74 insertions, 13 deletions
diff --git a/engines/titanic/star_control/base_star.h b/engines/titanic/star_control/base_star.h index f3e16f154e..c3e489976a 100644 --- a/engines/titanic/star_control/base_star.h +++ b/engines/titanic/star_control/base_star.h @@ -92,10 +92,15 @@ public: virtual void draw(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStarControlSub5 *sub5); virtual bool loadYale(int v1) { return true; } - virtual bool proc4(int v1, int v2, int v3, int v4, int v5) { return false; } + + /** + * Selects a star + */ + virtual bool selectStar(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, + int flags, const Common::Point &pt) { return false; } + virtual bool proc5(int v1) { return false; } virtual bool loadStar() { return false; } - virtual bool proc7(int v1, int v2) { return true; } /** * Load the item's data diff --git a/engines/titanic/star_control/star_control_sub2.cpp b/engines/titanic/star_control/star_control_sub2.cpp index f020e2ceb5..cf7190fb34 100644 --- a/engines/titanic/star_control/star_control_sub2.cpp +++ b/engines/titanic/star_control/star_control_sub2.cpp @@ -30,7 +30,8 @@ bool CStarControlSub2::loadYale(int v1) { return true; } -bool CStarControlSub2::proc4(int v1, int v2, int v3, int v4, int v5) { +bool CStarControlSub2::selectStar(CSurfaceArea *surfaceArea, + CStarControlSub12 *sub12, int flags, const Common::Point &pt) { // TODO return true; } @@ -40,11 +41,6 @@ bool CStarControlSub2::loadStar() { return true; } -bool CStarControlSub2::proc7(int v1, int v2) { - // TODO - return true; -} - bool CStarControlSub2::setup() { // TODO return true; diff --git a/engines/titanic/star_control/star_control_sub2.h b/engines/titanic/star_control/star_control_sub2.h index c3d756e793..9de2da4583 100644 --- a/engines/titanic/star_control/star_control_sub2.h +++ b/engines/titanic/star_control/star_control_sub2.h @@ -32,9 +32,14 @@ public: virtual ~CStarControlSub2() {} virtual bool loadYale(int v1); - virtual bool proc4(int v1, int v2, int v3, int v4, int v5); + + /** + * Selects a star + */ + virtual bool selectStar(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, + int flags, const Common::Point &pt); + virtual bool loadStar(); - virtual bool proc7(int v1, int v2); /** * Setup the control diff --git a/engines/titanic/star_control/star_control_sub8.cpp b/engines/titanic/star_control/star_control_sub8.cpp index 78fdfa7f84..ff5ca354ca 100644 --- a/engines/titanic/star_control/star_control_sub8.cpp +++ b/engines/titanic/star_control/star_control_sub8.cpp @@ -21,6 +21,8 @@ */ #include "titanic/star_control/star_control_sub8.h" +#include "titanic/star_control/star_control_sub7.h" +#include "titanic/star_control/star_field.h" namespace Titanic { @@ -30,4 +32,20 @@ CStarControlSub8::CStarControlSub8() : _field8(-1) { #endif } +bool MouseButtonDown(const Common::Point &pt) { + // TODO + return true; +} + +int CStarControlSub8::findStar(const Common::Point &pt) { + // TODO + return -1; +} + +void CStarControlSub8::selectStar(int index, CVideoSurface *surface, + CStarField *starField, CStarControlSub7 *sub7) { + // TODO +} + + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub8.h b/engines/titanic/star_control/star_control_sub8.h index 71aa8fb472..ab05316075 100644 --- a/engines/titanic/star_control/star_control_sub8.h +++ b/engines/titanic/star_control/star_control_sub8.h @@ -24,9 +24,13 @@ #define TITANIC_STAR_CONTROL_SUB8_H #include "titanic/support/simple_file.h" +#include "titanic/support/video_surface.h" namespace Titanic { +class CStarField; +class CStarControlSub7; + class CStarControlSub8 { struct StructEntry { int _field0; @@ -55,6 +59,11 @@ public: * Save the data for the class to file */ void save(SimpleFile *file, int indent) {} + + int findStar(const Common::Point &pt); + + void selectStar(int starNum, CVideoSurface *surface, CStarField *starField, + CStarControlSub7 *sub7); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp index 31e75f3c13..3cc859b3f4 100644 --- a/engines/titanic/star_control/star_field.cpp +++ b/engines/titanic/star_control/star_field.cpp @@ -131,4 +131,20 @@ void CStarField::fn1(CErrorCode *errorCode) { _sub5.proc3(errorCode); } +bool CStarField::mouseButtonDown(CVideoSurface *surface, CStarControlSub12 *sub12, + int flags, const Common::Point &pt) { + if (!_val3) { + CSurfaceArea surfaceArea(surface); + return selectStar(&surfaceArea, sub12, 0, pt); + } else { + int starNum = _sub8.findStar(pt); + if (starNum >= 0) { + _sub8.selectStar(starNum, surface, this, &_sub7); + return true; + } + + return false; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_field.h b/engines/titanic/star_control/star_field.h index 9e8b732f45..24b22a99ef 100644 --- a/engines/titanic/star_control/star_field.h +++ b/engines/titanic/star_control/star_field.h @@ -93,6 +93,12 @@ public: } void fn1(CErrorCode *errorCode); + + /** + * Called when the starfield is clicked + */ + bool mouseButtonDown(CVideoSurface *surface, CStarControlSub12 *sub12, + int flags, const Common::Point &pt); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp index 46e4702caa..32003b678d 100644 --- a/engines/titanic/star_control/star_view.cpp +++ b/engines/titanic/star_control/star_view.cpp @@ -105,8 +105,14 @@ void CStarView::draw(CScreenManager *screenManager) { } } -void CStarView::MouseButtonDownMsg(int unused, const Point &pt) { - // TODO +bool CStarView::MouseButtonDownMsg(int flags, const Point &pt) { + if (_starField) { + return _starField->mouseButtonDown( + _showingPhoto ? _videoSurface2 : _videoSurface, + &_sub12, flags, pt); + } + + return false; } bool CStarView::MouseMoveMsg(int unused, const Point &pt) { diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h index 4fd640cb9d..a39d058371 100644 --- a/engines/titanic/star_control/star_view.h +++ b/engines/titanic/star_control/star_view.h @@ -81,7 +81,7 @@ public: /** * Handles mouse down messages */ - void MouseButtonDownMsg(int unused, const Point &pt); + bool MouseButtonDownMsg(int unused, const Point &pt); /** * Handles mouse move messages |