[Scummvm-cvs-logs] scummvm master -> ceb49fc839a28408f24217abaef41d88eace0247

dreammaster dreammaster at scummvm.org
Tue Aug 2 23:49:56 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:
ceb49fc839 TITANIC: Further work on view and node positioning


Commit: ceb49fc839a28408f24217abaef41d88eace0247
    https://github.com/scummvm/scummvm/commit/ceb49fc839a28408f24217abaef41d88eace0247
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-08-02T17:49:41-04:00

Commit Message:
TITANIC: Further work on view and node positioning

Changed paths:
    engines/titanic/core/node_item.cpp
    engines/titanic/core/node_item.h
    engines/titanic/core/view_item.cpp
    engines/titanic/core/view_item.h
    engines/titanic/support/proximity.cpp
    engines/titanic/support/proximity.h
    engines/titanic/true_talk/true_talk_manager.cpp



diff --git a/engines/titanic/core/node_item.cpp b/engines/titanic/core/node_item.cpp
index 1de065a..85d3f54 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 8fda946..ea403dd 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 119ffe4..03e2753 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 9dc6e96..d653c3a 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 a9a2fdb..9784ae3 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 79d86c6..4427574 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 55f4501..072832a 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) {






More information about the Scummvm-git-logs mailing list