diff options
author | Paul Gilbert | 2016-08-02 17:49:41 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-02 17:49:41 -0400 |
commit | ceb49fc839a28408f24217abaef41d88eace0247 (patch) | |
tree | 0d3e3731f522c50e939b3f88edb09743fa1d65b4 /engines/titanic | |
parent | 8cf1688535f5da02157e2d0f10bed2b9e7f3666a (diff) | |
download | scummvm-rg350-ceb49fc839a28408f24217abaef41d88eace0247.tar.gz scummvm-rg350-ceb49fc839a28408f24217abaef41d88eace0247.tar.bz2 scummvm-rg350-ceb49fc839a28408f24217abaef41d88eace0247.zip |
TITANIC: Further work on view and node positioning
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/core/node_item.cpp | 7 | ||||
-rw-r--r-- | engines/titanic/core/node_item.h | 7 | ||||
-rw-r--r-- | engines/titanic/core/view_item.cpp | 15 | ||||
-rw-r--r-- | engines/titanic/core/view_item.h | 9 | ||||
-rw-r--r-- | engines/titanic/support/proximity.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/support/proximity.h | 6 | ||||
-rw-r--r-- | engines/titanic/true_talk/true_talk_manager.cpp | 4 |
7 files changed, 39 insertions, 17 deletions
diff --git a/engines/titanic/core/node_item.cpp b/engines/titanic/core/node_item.cpp index 1de065a49d..85d3f548c0 100644 --- a/engines/titanic/core/node_item.cpp +++ b/engines/titanic/core/node_item.cpp @@ -21,6 +21,7 @@ */ #include "titanic/core/node_item.h" +#include "titanic/core/room_item.h" namespace Titanic { @@ -53,4 +54,10 @@ void CNodeItem::load(SimpleFile *file) { CNamedItem::load(file); } +void CNodeItem::getPosition(double &xp, double &yp, double &zp) { + CRoomItem *room = findRoom(); + room->calcNodePosition(_nodePos, xp, yp); + zp = 0.0; +} + } // End of namespace Titanic diff --git a/engines/titanic/core/node_item.h b/engines/titanic/core/node_item.h index 8fda9464ec..ea403ddc3a 100644 --- a/engines/titanic/core/node_item.h +++ b/engines/titanic/core/node_item.h @@ -44,7 +44,12 @@ public: /** * Load the data for the class from file */ - virtual void load(SimpleFile *file); + virtual void load(SimpleFile *file); + + /** + * Gets the relative position of the node within the owning room + */ + void getPosition(double &xp, double &yp, double &zp); }; } // End of namespace Titanic diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 119ffe431c..03e2753839 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -47,8 +47,8 @@ CViewItem::CViewItem() : CNamedItem() { void CViewItem::setAngle(double angle) { _angle = angle; - _position.x = (int16)(cos(_angle) * 30.0); - _position.y = (int16)(sin(_angle) * -30.0); + _viewPos.x = (int16)(cos(_angle) * 30.0); + _viewPos.y = (int16)(sin(_angle) * -30.0); } void CViewItem::save(SimpleFile *file, int indent) { @@ -304,8 +304,15 @@ void CViewItem::handleButtonUpMsg(CMouseButtonUpMsg *msg) { } } -void CViewItem::fn1(double val1, double val2, double val3) { - warning("TODO: CViewItem::fn1"); +void CViewItem::getPosition(double &xp, double &yp, double &zp) { + // Get the position of the owning node within the room + CNodeItem *node = findNode(); + node->getPosition(xp, yp, zp); + + // Adjust the position slightly to compensate for view's angle, + // ensuring different direction views don't all have the same position + xp += cos(_angle) * 0.5; + yp -= sin(_angle) * 0.5; } CString CViewItem::getFullViewName() const { diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index 9dc6e96768..d653c3a4f3 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -40,7 +40,7 @@ private: CTreeItem *_buttonUpTargets[4]; private: /** - * Sets the angle of the view item + * Sets the angle of the view relative to the node it belongs to */ void setAngle(double angle); @@ -57,7 +57,7 @@ protected: int _field24; CResourceKey _resourceKey; double _angle; - Point _position; + Point _viewPos; public: int _viewNumber; public: @@ -111,7 +111,10 @@ public: */ CString getNodeViewName() const; - void fn1(double val1, double val2, double val3); + /** + * Gets the relative position of the view within the owning room + */ + void getPosition(double &xp, double &yp, double &zp); }; } // End of namespace Titanic diff --git a/engines/titanic/support/proximity.cpp b/engines/titanic/support/proximity.cpp index a9a2fdba8c..9784ae353b 100644 --- a/engines/titanic/support/proximity.cpp +++ b/engines/titanic/support/proximity.cpp @@ -28,10 +28,10 @@ namespace Titanic { CProximity::CProximity() : _field4(0), _field8(100), _fieldC(0), _speechHandle(-1), _field14(0), _field18(0), _field1C(1.875), _field20(0), _field24(10), _field28(0), _field2C(0.0), - _field30(0.5), _field34(0), _double1(0.0), _double2(0.0), - _double3(0.0), _field44(0), _field48(0), _field4C(0), - _field50(0), _field54(0), _field58(0), _field5C(0), - _field60(0), _endTalkerFn(nullptr), _talker(nullptr), _field6C(0) { + _field30(0.5), _field34(0), _posX(0.0), _posY(0.0), _posZ(0.0), + _field44(0), _field48(0), _field4C(0), _field50(0), _field54(0), + _field58(0), _field5C(0), _field60(0), _endTalkerFn(nullptr), + _talker(nullptr), _field6C(0) { } } // End of namespace Titanic diff --git a/engines/titanic/support/proximity.h b/engines/titanic/support/proximity.h index 79d86c6764..4427574f40 100644 --- a/engines/titanic/support/proximity.h +++ b/engines/titanic/support/proximity.h @@ -46,9 +46,9 @@ public: double _field2C; double _field30; int _field34; - double _double1; - double _double2; - double _double3; + double _posX; + double _posY; + double _posZ; int _field44; int _field48; int _field4C; diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 55f4501d7e..072832af4d 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -510,7 +510,7 @@ void CTrueTalkManager::playSpeech(TTtalker *talker, TTroomScript *roomScript, CV p3._field30 = 1.0; p3._field34 = 0; - p3._field8 = (index * 3) / 4; + p2._field8 = (index * 3) / 4; p2._field28 = 0; p2._field2C = 135.0; p2._field30 = 1.0; @@ -520,7 +520,7 @@ void CTrueTalkManager::playSpeech(TTtalker *talker, TTroomScript *roomScript, CV _gameManager->_sound.managerProc8(p1._field24); if (view) { p1._field28 = 2; - view->fn1(p1._double1, p1._double2, p1._double3); + view->getPosition(p1._posX, p1._posY, p1._posZ); } for (uint idx = 0; idx < _titleEngine._indexes.size(); ++idx) { |