diff options
author | Paul Gilbert | 2016-03-21 22:44:55 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-03-21 22:44:55 -0400 |
commit | b7746eff425dde0fac89684281541a609ca8e294 (patch) | |
tree | 2559e65b3cbd636649afd4b9fffcb1aa85ebf769 /engines/titanic/core | |
parent | 6a118677ed76a9a4dc1f4eb38c19b99e1b3a2e60 (diff) | |
download | scummvm-rg350-b7746eff425dde0fac89684281541a609ca8e294.tar.gz scummvm-rg350-b7746eff425dde0fac89684281541a609ca8e294.tar.bz2 scummvm-rg350-b7746eff425dde0fac89684281541a609ca8e294.zip |
TITANIC: Implement method for rendering view contents
Diffstat (limited to 'engines/titanic/core')
-rw-r--r-- | engines/titanic/core/game_object.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/core/game_object.h | 5 | ||||
-rw-r--r-- | engines/titanic/core/node_item.cpp | 10 | ||||
-rw-r--r-- | engines/titanic/core/node_item.h | 4 | ||||
-rw-r--r-- | engines/titanic/core/room_item.cpp | 12 | ||||
-rw-r--r-- | engines/titanic/core/room_item.h | 5 | ||||
-rw-r--r-- | engines/titanic/core/tree_item.h | 6 |
7 files changed, 38 insertions, 8 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 06f2ce78af..db1e9ef3d6 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -127,4 +127,8 @@ bool CGameObject::checkPoint(const Point &pt, int v0, int v1) { return false; } +void CGameObject::draw(CScreenManager *screenManager) { + warning("TODO: CGameObject::draw"); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 809f7b8d20..675339e926 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -73,6 +73,11 @@ public: */ virtual void load(SimpleFile *file); + /** + * Allows the item to draw itself + */ + virtual void draw(CScreenManager *screenManager); + void fn2(); bool checkPoint(const Point &pt, int v0, int v1); diff --git a/engines/titanic/core/node_item.cpp b/engines/titanic/core/node_item.cpp index 22c9b9b37f..6b7d6452cb 100644 --- a/engines/titanic/core/node_item.cpp +++ b/engines/titanic/core/node_item.cpp @@ -24,14 +24,14 @@ namespace Titanic { -CNodeItem::CNodeItem() : CNamedItem(), _field24(0), _field28(0), _nodeNumber(0) { +CNodeItem::CNodeItem() : CNamedItem(), _nodeNumber(0) { } void CNodeItem::save(SimpleFile *file, int indent) const { file->writeNumberLine(0, indent); file->writeQuotedLine("N", indent); - file->writeNumberLine(_field24, indent + 1); - file->writeNumberLine(_field28, indent + 1); + file->writeNumberLine(_nodePos.x, indent + 1); + file->writeNumberLine(_nodePos.y, indent + 1); file->writeQuotedLine("N", indent); file->writeNumberLine(_nodeNumber, indent + 1); @@ -42,8 +42,8 @@ void CNodeItem::save(SimpleFile *file, int indent) const { void CNodeItem::load(SimpleFile *file) { file->readNumber(); file->readBuffer(); - _field24 = file->readNumber(); - _field28 = file->readNumber(); + _nodePos.x = file->readNumber(); + _nodePos.y = file->readNumber(); file->readBuffer(); _nodeNumber = file->readNumber(); diff --git a/engines/titanic/core/node_item.h b/engines/titanic/core/node_item.h index 4f0391ae88..32db1c1401 100644 --- a/engines/titanic/core/node_item.h +++ b/engines/titanic/core/node_item.h @@ -28,11 +28,9 @@ namespace Titanic { class CNodeItem : public CNamedItem { -protected: - int _field24; - int _field28; public: int _nodeNumber; + Point _nodePos; public: CLASSDEF CNodeItem(); diff --git a/engines/titanic/core/room_item.cpp b/engines/titanic/core/room_item.cpp index b0cefcaf74..7a6dfd968a 100644 --- a/engines/titanic/core/room_item.cpp +++ b/engines/titanic/core/room_item.cpp @@ -103,4 +103,16 @@ void CRoomItem::loading() { // TODO } +void CRoomItem::calcNodePosition(const Point &nodePos, double &xVal, double &yVal) const { + xVal = yVal = 0.0; + + if (_roomDimensionX >= 0.0 && _roomDimensionY >= 0.0) { + xVal = _roomRect.width() / _roomDimensionX; + yVal = _roomRect.height() / _roomDimensionY; + + xVal = (nodePos.x - _roomRect.left) / xVal; + yVal = (nodePos.y - _roomRect.top) / yVal; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/core/room_item.h b/engines/titanic/core/room_item.h index 7248b4aac3..9e7f553407 100644 --- a/engines/titanic/core/room_item.h +++ b/engines/titanic/core/room_item.h @@ -59,6 +59,11 @@ public: * Return a movie clip for the room by name */ CMovieClip *findClip(const CString &name) { return _clipList.findByName(name); } + + /** + * Calculates the positioning of a node within the overall room + */ + void calcNodePosition(const Point &nodePos, double &xVal, double &yVal) const; }; } // End of namespace Titanic diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index 5669784cd7..e870ad1dc3 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -31,6 +31,7 @@ class CGameManager; class CDontSaveFileItem; class CNamedItem; class CProjectItem; +class CScreenManager; class CTreeItem: public CMessageTarget { private: @@ -120,6 +121,11 @@ public: virtual int compareTo(const CString &name, int maxLen) const { return false; } /** + * Allows the item to draw itself + */ + virtual void draw(CScreenManager *screenManager) {} + + /** * Gets the bounds occupied by the item */ virtual Rect getBounds() { return Rect(); } |