[Scummvm-cvs-logs] scummvm master -> 8cf1688535f5da02157e2d0f10bed2b9e7f3666a

dreammaster dreammaster at scummvm.org
Tue Aug 2 19:25:28 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
8cf1688535 TITANIC: Fleshing out cViewItem class


Commit: 8cf1688535f5da02157e2d0f10bed2b9e7f3666a
    https://github.com/scummvm/scummvm/commit/8cf1688535f5da02157e2d0f10bed2b9e7f3666a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-02T13:25:00-04:00

Commit Message:
TITANIC: Fleshing out cViewItem class

Changed paths:
    engines/titanic/core/view_item.cpp
    engines/titanic/core/view_item.h



diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp
index dff9351..119ffe4 100644
--- a/engines/titanic/core/view_item.cpp
+++ b/engines/titanic/core/view_item.cpp
@@ -40,24 +40,22 @@ END_MESSAGE_MAP()
 CViewItem::CViewItem() : CNamedItem() {
 	Common::fill(&_buttonUpTargets[0], &_buttonUpTargets[4], (CTreeItem *)nullptr);
 	_field24 = 0;
-	_field28 = 0.0;
+	_angle = 0.0;
 	_viewNumber = 0;
-	_field50 = 0;
-	_field54 = 0;
-	setData(0.0);
+	setAngle(0.0);
 }
 
-void CViewItem::setData(double v) {
-	_field28 = v;
-	_field50 = cos(_field28) * 30.0;
-	_field54 = sin(_field28) * -30.0;
+void CViewItem::setAngle(double angle) {
+	_angle = angle;
+	_position.x = (int16)(cos(_angle) * 30.0);
+	_position.y = (int16)(sin(_angle) * -30.0);
 }
 
 void CViewItem::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
 	_resourceKey.save(file, indent);
 	file->writeQuotedLine("V", indent);
-	file->writeFloatLine(_field28, indent + 1);
+	file->writeFloatLine(_angle, indent + 1);
 	file->writeNumberLine(_viewNumber, indent + 1);
 
 	CNamedItem::save(file, indent);
@@ -73,7 +71,7 @@ void CViewItem::load(SimpleFile *file) {
 
 	default:
 		file->readBuffer();
-		setData(file->readFloat());
+		setAngle(file->readFloat());
 		_viewNumber = file->readNumber();
 		break;
 	}
@@ -310,4 +308,18 @@ void CViewItem::fn1(double val1, double val2, double val3) {
 	warning("TODO: CViewItem::fn1");
 }
 
+CString CViewItem::getFullViewName() const {
+	CNodeItem *node = findNode();
+	CRoomItem *room = node->findRoom();
+
+	return CString::format("%s.%s.%s", room->getName().c_str(),
+		node->getName().c_str(), getName().c_str());
+}
+
+CString CViewItem::getNodeViewName() const {
+	CNodeItem *node = findNode();
+
+	return CString::format("%s.%s", node->getName().c_str(), getName().c_str());
+}
+
 } // End of namespace Titanic
diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h
index 6e8003d..9dc6e96 100644
--- a/engines/titanic/core/view_item.h
+++ b/engines/titanic/core/view_item.h
@@ -39,7 +39,10 @@ class CViewItem : public CNamedItem {
 private:
 	CTreeItem *_buttonUpTargets[4];
 private:
-	void setData(double v);
+	/**
+	 * Sets the angle of the view item
+	 */
+	void setAngle(double angle);
 
 	/**
 	 * Called to handle mouse messagaes on the view
@@ -52,10 +55,9 @@ private:
 	void handleButtonUpMsg(CMouseButtonUpMsg *msg);
 protected:
 	int _field24;
-	double _field28;
 	CResourceKey _resourceKey;
-	int _field50;
-	int _field54;
+	double _angle;
+	Point _position;
 public:
 	int _viewNumber;
 public:
@@ -97,6 +99,18 @@ public:
 	 */
 	CLinkItem *findLink(CViewItem *newView);
 
+	/**
+	 * Return the full Id of the current view in a
+	 * room.node.view tuplet form
+	 */
+	CString getFullViewName() const;
+
+	/**
+	 * Return the Id of the current view in a
+	 * room.node.view tuplet form
+	 */
+	CString getNodeViewName() const;
+
 	void fn1(double val1, double val2, double val3);
 };
 






More information about the Scummvm-git-logs mailing list