[Scummvm-git-logs] scummvm master -> 7eb49883f22664b54bac9784665929ca5ca406f3
dreammaster
paulfgilbert at gmail.com
Tue Jan 14 05:16:31 UTC 2020
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
2480630e08 TITANIC: Cleanup of camera class
365674ca77 TITANIC: Cleanup of CCamera class methods
7eb49883f2 TITANIC: Cleanup of camera mover & navigation info
Commit: 2480630e08109512fee74efb63b0421c658c6a4b
https://github.com/scummvm/scummvm/commit/2480630e08109512fee74efb63b0421c658c6a4b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-01-13T21:15:53-08:00
Commit Message:
TITANIC: Cleanup of camera class
Changed paths:
engines/titanic/star_control/camera.cpp
engines/titanic/star_control/camera.h
diff --git a/engines/titanic/star_control/camera.cpp b/engines/titanic/star_control/camera.cpp
index 8c79ead..7809070 100644
--- a/engines/titanic/star_control/camera.cpp
+++ b/engines/titanic/star_control/camera.cpp
@@ -240,11 +240,11 @@ FVector CCamera::getRelativePosNoCentering(int index, const FVector &src) {
return _viewport.getRelativePosNoCentering(index, src);
}
-FVector CCamera::proc30(int index, const FVector &v) {
+FVector CCamera::getRelativePosCentering(int index, const FVector &v) {
return _viewport.getRelativePosCentering(index, v);
}
-FVector CCamera::proc31(int index, const FVector &v) {
+FVector CCamera::getRelativePosCenteringRaw(int index, const FVector &v) {
return _viewport.getRelativePosCenteringRaw(index, v);
}
diff --git a/engines/titanic/star_control/camera.h b/engines/titanic/star_control/camera.h
index 06b1957..318265e 100644
--- a/engines/titanic/star_control/camera.h
+++ b/engines/titanic/star_control/camera.h
@@ -161,8 +161,8 @@ public:
virtual FVector getRelativePos(int index, const FVector &src);
virtual FVector getRelativePosNoCentering(int index, const FVector &src);
- virtual FVector proc30(int index, const FVector &v);
- virtual FVector proc31(int index, const FVector &v);
+ virtual FVector getRelativePosCentering(int index, const FVector &v);
+ virtual FVector getRelativePosCenteringRaw(int index, const FVector &v);
/**
* Sets the viewport position within the starfield
Commit: 365674ca7725a87b3090449538b7b60295a1863d
https://github.com/scummvm/scummvm/commit/365674ca7725a87b3090449538b7b60295a1863d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-01-13T21:15:53-08:00
Commit Message:
TITANIC: Cleanup of CCamera class methods
Changed paths:
engines/titanic/star_control/base_stars.cpp
engines/titanic/star_control/camera.cpp
engines/titanic/star_control/camera.h
engines/titanic/star_control/const_boundaries.cpp
engines/titanic/star_control/constellations.cpp
engines/titanic/star_control/star_closeup.cpp
engines/titanic/star_control/star_field.cpp
engines/titanic/star_control/star_markers.cpp
engines/titanic/star_control/star_ref.cpp
engines/titanic/star_control/star_view.cpp
engines/titanic/star_control/viewport.cpp
engines/titanic/star_control/viewport.h
diff --git a/engines/titanic/star_control/base_stars.cpp b/engines/titanic/star_control/base_stars.cpp
index 8475b1e..4f9373f 100644
--- a/engines/titanic/star_control/base_stars.cpp
+++ b/engines/titanic/star_control/base_stars.cpp
@@ -167,7 +167,7 @@ void CBaseStars::draw1(CSurfaceArea *surfaceArea, CCamera *camera, CStarCloseup
const double MAX_VAL = 1.0e9 * 1.0e9;
FPoint centroid = surfaceArea->_centroid + FPoint(0.5, 0.5);
- double threshold = camera->getThreshold();
+ double threshold = camera->getFrontClip();
double minVal = threshold - 9216.0;
int width1 = surfaceArea->_width - 1;
int height1 = surfaceArea->_height - 1;
@@ -252,7 +252,7 @@ void CBaseStars::draw2(CSurfaceArea *surfaceArea, CCamera *camera, CStarCloseup
const double MAX_VAL = 1.0e9 * 1.0e9;
FPoint centroid = surfaceArea->_centroid + FPoint(0.5, 0.5);
- double threshold = camera->getThreshold();
+ double threshold = camera->getFrontClip();
double minVal = threshold - 9216.0;
int width1 = surfaceArea->_width - 1;
int height1 = surfaceArea->_height - 1;
@@ -338,7 +338,7 @@ void CBaseStars::draw3(CSurfaceArea *surfaceArea, CCamera *camera, CStarCloseup
const double MAX_VAL = 1.0e9 * 1.0e9;
FPoint centroid = surfaceArea->_centroid + FPoint(0.5, 0.5);
- double threshold = camera->getThreshold();
+ double threshold = camera->getFrontClip();
double minVal = threshold - 9216.0;
int width1 = surfaceArea->_width - 1;
int height1 = surfaceArea->_height - 1;
@@ -445,7 +445,7 @@ void CBaseStars::draw4(CSurfaceArea *surfaceArea, CCamera *camera, CStarCloseup
const double MAX_VAL = 1.0e9 * 1.0e9;
FPoint centroid = surfaceArea->_centroid + FPoint(0.5, 0.5);
- double threshold = camera->getThreshold();
+ double threshold = camera->getFrontClip();
double minVal = threshold - 9216.0;
int width1 = surfaceArea->_width - 1;
int height1 = surfaceArea->_height - 1;
diff --git a/engines/titanic/star_control/camera.cpp b/engines/titanic/star_control/camera.cpp
index 7809070..3ecf879 100644
--- a/engines/titanic/star_control/camera.cpp
+++ b/engines/titanic/star_control/camera.cpp
@@ -72,11 +72,11 @@ CCamera::~CCamera() {
removeMover();
}
-void CCamera::proc2(const CViewport *src) {
+void CCamera::setViewport(const CViewport *src) {
_viewport.copyFrom(src);
}
-void CCamera::proc3(const CNavigationInfo *src) {
+void CCamera::setMotion(const CNavigationInfo *src) {
_mover->copyFrom(src);
}
@@ -93,21 +93,21 @@ void CCamera::setOrientation(const FVector &v) {
}
// This never gets called
-void CCamera::proc6(int v) {
+void CCamera::setRoleAngle(double angle) {
if (!isLocked())
- _viewport.setC(v);
+ _viewport.SetRoleAngle(angle);
}
// This never gets called
-void CCamera::proc7(int v) {
+void CCamera::setFrontClip(double n) {
if (!isLocked())
- _viewport.set10(v);
+ _viewport.setFrontClip(n);
}
// This never gets called
-void CCamera::proc8(int v) {
+void CCamera::SetBackClip(double f) {
if (!isLocked())
- _viewport.set14(v);
+ _viewport.setBackClip(f);
}
// This never gets called
@@ -132,10 +132,6 @@ void CCamera::setFields(StarMode mode, double val) {
_viewport.changeStarColorPixel(mode, val);
}
-void CCamera::proc13(CViewport *dest) {
- *dest = _viewport;
-}
-
void CCamera::setDestination(const FVector &v) {
FMatrix orientation = _viewport.getOrientation();
FVector oldPos = _viewport._position;
@@ -207,12 +203,12 @@ FPose CCamera::getRawPose() {
return _viewport.getRawPose();
}
-double CCamera::getThreshold() const {
- return _viewport._field10;
+double CCamera::getFrontClip() const {
+ return _viewport._frontClip;
}
-double CCamera::proc26() const {
- return _viewport._field14;
+double CCamera::getBackClip() const {
+ return _viewport._backClip;
}
StarColor CCamera::getStarColor() const {
@@ -481,7 +477,7 @@ bool CCamera::lockMarker1(FVector v1, FVector firstStarPosition, FVector v3) {
double val6, val7, val8, val9;
val1 = _viewport._centerVector._y * v1._x;
- tempV._z = _viewport._field10;
+ tempV._z = _viewport._frontClip;
val2 = _viewport._centerVector._y * tempV._z * v3._x;
val3 = _viewport._centerVector._z * v1._y;
val4 = _viewport._centerVector._z * tempV._z;
diff --git a/engines/titanic/star_control/camera.h b/engines/titanic/star_control/camera.h
index 318265e..c130bd2 100644
--- a/engines/titanic/star_control/camera.h
+++ b/engines/titanic/star_control/camera.h
@@ -76,8 +76,15 @@ public:
CCamera(CViewport *src);
virtual ~CCamera();
- virtual void proc2(const CViewport *src);
- virtual void proc3(const CNavigationInfo *src);
+ /**
+ * Copy the state from a specified viewport
+ */
+ virtual void setViewport(const CViewport *src);
+
+ /**
+ * Set motion from the passed navigation info
+ */
+ virtual void setMotion(const CNavigationInfo *src);
/**
* The mover/view is not currently homing in on a new star
@@ -96,14 +103,25 @@ public:
*/
virtual void setOrientation(const FVector &v);
- virtual void proc6(int v);
- virtual void proc7(int v);
- virtual void proc8(int v);
+ /**
+ * Assigns a roll angle about the view direction
+ */
+ virtual void setRoleAngle(double angle);
+
+ /**
+ * Assign a near clip plane distance
+ */
+ virtual void setFrontClip(double n);
+
+ /**
+ * Assign a far clipping plane distance
+ */
+ virtual void SetBackClip(double f);
+
virtual void setCenterYAngle(int v);
virtual void setCenterZAngle(int v);
virtual void randomizeOrientation();
virtual void setFields(StarMode mode, double val);
- virtual void proc13(CViewport *dest);
/**
* Sets the destination to move the camera to
@@ -150,9 +168,18 @@ public:
virtual FPose getPose();
virtual FPose getRawPose();
- virtual double getThreshold() const;
- virtual double proc26() const;
+ /**
+ * Get the front clipping distance
+ */
+ virtual double getFrontClip() const;
+
+ /**
+ * Get the back clipping distance
+ */
+ virtual double getBackClip() const;
+
+
virtual StarColor getStarColor() const;
/**
diff --git a/engines/titanic/star_control/const_boundaries.cpp b/engines/titanic/star_control/const_boundaries.cpp
index 3761973..2853fee 100644
--- a/engines/titanic/star_control/const_boundaries.cpp
+++ b/engines/titanic/star_control/const_boundaries.cpp
@@ -74,7 +74,7 @@ void CConstBoundaries::draw(CSurfaceArea *surface, CCamera *camera) {
// get the current camera transform.
FPose pose = camera->getPose();
- float threshold = camera->getThreshold();
+ float threshold = camera->getFrontClip();
float centerX = (float)surface->_width / 2.0f;
float centerY = (float)surface->_height / 2.0f;
diff --git a/engines/titanic/star_control/constellations.cpp b/engines/titanic/star_control/constellations.cpp
index 4d422fc..1543100 100644
--- a/engines/titanic/star_control/constellations.cpp
+++ b/engines/titanic/star_control/constellations.cpp
@@ -75,7 +75,7 @@ void CConstellations::draw(CSurfaceArea *surface, CCamera *camera) {
return;
FPose pose = camera->getPose();
- double threshold = camera->getThreshold();
+ double threshold = camera->getFrontClip();
double centerX = (double)surface->_width / 2.0F;
double centerY = (double)surface->_height / 2.0F;
FVector ec0, ec1;
diff --git a/engines/titanic/star_control/star_closeup.cpp b/engines/titanic/star_control/star_closeup.cpp
index 766445b..e11e733 100644
--- a/engines/titanic/star_control/star_closeup.cpp
+++ b/engines/titanic/star_control/star_closeup.cpp
@@ -194,7 +194,7 @@ bool CStarCloseup::setup2(int val1, int val2) {
void CStarCloseup::draw(const FPose &pose, const FVector &vector, const FVector &vector2,
CSurfaceArea *surfaceArea, CCamera *camera) {
const int VALUES[] = { 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4 };
- float val1 = camera->getThreshold();
+ float val1 = camera->getFrontClip();
StarColor starColor = camera->getStarColor();
if (!_flag)
return;
diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp
index fb05474..fef62a6 100644
--- a/engines/titanic/star_control/star_field.cpp
+++ b/engines/titanic/star_control/star_field.cpp
@@ -201,7 +201,7 @@ double CStarField::lockDistance(CSurfaceArea *surfaceArea, CCamera *camera,
worldCoord = dataP->_position;
FVector tv = camera->getRelativePosNoCentering(2, worldCoord);
- if (camera->getThreshold() >= tv._z)
+ if (camera->getFrontClip() >= tv._z)
return -1.0;
tv = camera->getRelativePos(2, tv);
diff --git a/engines/titanic/star_control/star_markers.cpp b/engines/titanic/star_control/star_markers.cpp
index 6c2a484..e1840c5 100644
--- a/engines/titanic/star_control/star_markers.cpp
+++ b/engines/titanic/star_control/star_markers.cpp
@@ -31,7 +31,7 @@ void CStarMarkers::draw(CSurfaceArea *surfaceArea, CCamera *camera, CStarCloseup
return;
FPose pose = camera->getPose();
- double threshold = camera->getThreshold();
+ double threshold = camera->getFrontClip();
FPoint center((double)surfaceArea->_width * 0.5,
surfaceArea->_height * 0.5);
FVector newV;
diff --git a/engines/titanic/star_control/star_ref.cpp b/engines/titanic/star_control/star_ref.cpp
index 6ba7d07..5ed04a0 100644
--- a/engines/titanic/star_control/star_ref.cpp
+++ b/engines/titanic/star_control/star_ref.cpp
@@ -32,7 +32,7 @@ void CBaseStarRef::process(CSurfaceArea *surface, CCamera *camera) {
const double MAX_VAL = 1.0e9 * 1.0e9;
FPose pose = camera->getPose();
- double threshold = camera->getThreshold();
+ double threshold = camera->getFrontClip();
double vWidth2 = (double)surface->_width * 0.5;
double vHeight2 = (double)surface->_height * 0.5;
FVector vTemp, vector1, vector2;
diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp
index 68d54c2..1fb5b6a 100644
--- a/engines/titanic/star_control/star_view.cpp
+++ b/engines/titanic/star_control/star_view.cpp
@@ -41,7 +41,7 @@ CStarView::CStarView() : _camera((const CNavigationInfo *)nullptr), _owner(nullp
_stereoPair(false), _showingPhoto(false) {
CNavigationInfo data = { 0, 0, 100000.0, 0, 20.0, 1.0, 1.0, 1.0 };
- _camera.proc3(&data);
+ _camera.setMotion(&data);
}
CStarView::~CStarView() {
diff --git a/engines/titanic/star_control/viewport.cpp b/engines/titanic/star_control/viewport.cpp
index 59ada40..3c3b7ce 100644
--- a/engines/titanic/star_control/viewport.cpp
+++ b/engines/titanic/star_control/viewport.cpp
@@ -31,9 +31,9 @@
namespace Titanic {
CViewport::CViewport() {
- _fieldC = 0; // doesn't get used
- _field10 = 800.0; // doesn't get used
- _field14 = 10000.0; // doesn't get used
+ _spin = 0.0;
+ _frontClip = 800.0;
+ _backClip = 10000.0;
_centerYAngleDegrees = 20.0;
_centerZAngleDegrees = 20.0;
_width = 600;
@@ -49,9 +49,9 @@ CViewport::CViewport() {
CViewport::CViewport(CViewport *src) :
_orientation(src->_orientation), _currentPose(src->_currentPose), _rawPose(src->_rawPose) {
_position = src->_position;
- _fieldC = src->_fieldC;
- _field10 = src->_field10;
- _field14 = src->_field14;
+ _spin = src->_spin;
+ _frontClip = src->_frontClip;
+ _backClip = src->_backClip;
_centerYAngleDegrees = src->_centerYAngleDegrees;
_centerZAngleDegrees = src->_centerZAngleDegrees;
_width = src->_width;
@@ -76,9 +76,9 @@ void CViewport::load(SimpleFile *file, int param) {
_position._x = file->readFloat();
_position._y = file->readFloat();
_position._z = file->readFloat();
- _fieldC = file->readFloat();
- _field10 = file->readFloat();
- _field14 = file->readFloat();
+ _spin = file->readFloat();
+ _frontClip = file->readFloat();
+ _backClip = file->readFloat();
_centerYAngleDegrees = file->readFloat();
_centerZAngleDegrees = file->readFloat();
@@ -103,9 +103,9 @@ void CViewport::save(SimpleFile *file, int indent) {
file->writeFloatLine(_position._x, indent);
file->writeFloatLine(_position._y, indent);
file->writeFloatLine(_position._z, indent);
- file->writeFloatLine(_fieldC, indent);
- file->writeFloatLine(_field10, indent);
- file->writeFloatLine(_field14, indent);
+ file->writeFloatLine(_spin, indent);
+ file->writeFloatLine(_frontClip, indent);
+ file->writeFloatLine(_backClip, indent);
file->writeFloatLine(_centerYAngleDegrees, indent);
file->writeFloatLine(_centerZAngleDegrees, indent);
file->writeNumberLine(_width | (_height << 16), indent);
@@ -143,21 +143,18 @@ void CViewport::setOrientation(const FVector &v) {
_poseUpToDate = false;
}
-// This never gets called
-void CViewport::setC(double v) {
- _fieldC = v;
+void CViewport::SetRoleAngle(double angle) {
+ _spin = angle;
_poseUpToDate = false;
}
-// This never gets called
-void CViewport::set10(double v) {
- _field10 = v;
+void CViewport::setFrontClip(double dist) {
+ _frontClip = dist;
_poseUpToDate = false;
}
-// This never gets called
-void CViewport::set14(double v) {
- _field10 = v;
+void CViewport::setBackClip(double dist) {
+ _backClip = dist;
}
void CViewport::setCenterYAngle(double angleDegrees) {
diff --git a/engines/titanic/star_control/viewport.h b/engines/titanic/star_control/viewport.h
index df82620..9a2be8d 100644
--- a/engines/titanic/star_control/viewport.h
+++ b/engines/titanic/star_control/viewport.h
@@ -44,7 +44,7 @@ enum StarColor { WHITE = 0, PINK = 2 };
*/
class CViewport {
private:
- double _fieldC;
+ double _spin;
double _centerYAngleDegrees;
double _centerZAngleDegrees;
int _width;
@@ -58,8 +58,8 @@ private:
void reset();
public:
FVector _position;
- double _field10;
- double _field14;
+ double _frontClip;
+ double _backClip;
StarColor _starColor; // Used in CBaseStars::draw
double _valArray[2]; // has value 0.0 or 30.0
double _isZero;
@@ -141,9 +141,20 @@ public:
*/
const FMatrix &getOrientation() const;
- void setC(double v);
- void set10(double v);
- void set14(double v);
+ /**
+ * Assigns a roll angle about the view direction
+ */
+ void SetRoleAngle(double angle);
+
+ /**
+ * Assign a near clip plane distance
+ */
+ void setFrontClip(double dist);
+
+ /**
+ * Assign a far clipping plane distance
+ */
+ void setBackClip(double dist);
/**
* Sets the center vector y angle
Commit: 7eb49883f22664b54bac9784665929ca5ca406f3
https://github.com/scummvm/scummvm/commit/7eb49883f22664b54bac9784665929ca5ca406f3
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-01-13T21:15:53-08:00
Commit Message:
TITANIC: Cleanup of camera mover & navigation info
Changed paths:
engines/titanic/star_control/camera.cpp
engines/titanic/star_control/camera_mover.cpp
engines/titanic/star_control/camera_mover.h
engines/titanic/star_control/marked_camera_mover.cpp
engines/titanic/star_control/unmarked_camera_mover.cpp
diff --git a/engines/titanic/star_control/camera.cpp b/engines/titanic/star_control/camera.cpp
index 3ecf879..069e3ec 100644
--- a/engines/titanic/star_control/camera.cpp
+++ b/engines/titanic/star_control/camera.cpp
@@ -77,7 +77,7 @@ void CCamera::setViewport(const CViewport *src) {
}
void CCamera::setMotion(const CNavigationInfo *src) {
- _mover->copyFrom(src);
+ _mover->setMotion(src);
}
void CCamera::setPosition(const FVector &v) {
@@ -397,7 +397,7 @@ bool CCamera::addLockedStar(const FVector v) {
return false;
CNavigationInfo data;
- _mover->copyTo(&data);
+ _mover->getMotion(&data);
removeMover();
FVector &row = _lockedStarsPos[(int)_starLockState];
@@ -412,7 +412,7 @@ bool CCamera::removeLockedStar() {
return false;
CNavigationInfo data;
- _mover->copyTo(&data);
+ _mover->getMotion(&data);
removeMover();
_starLockState = StarLockState((int)_starLockState - 1);
diff --git a/engines/titanic/star_control/camera_mover.cpp b/engines/titanic/star_control/camera_mover.cpp
index 13fd673..8669aee 100644
--- a/engines/titanic/star_control/camera_mover.cpp
+++ b/engines/titanic/star_control/camera_mover.cpp
@@ -33,7 +33,7 @@ CCameraMover::CCameraMover(const CNavigationInfo *src) {
_starVector = nullptr;
if (src) {
- copyFrom(src);
+ setMotion(src);
} else {
reset();
}
@@ -51,14 +51,14 @@ void CCameraMover::clear() {
}
void CCameraMover::reset() {
- _speed = 0.0;
- _speedChangeCtr = 0.0;
- _speedChangeInc = 20.0;
- _unused = 0.0;
- _maxSpeed = 50000.0;
- _unusedX = 1.0;
- _unusedY = 1.0;
- _unusedZ = 0.0;
+ _currVelocity = 0.0;
+ _incVelocity = 0.0;
+ _incAcceleration = 20.0;
+ _minVelocity = 0.0;
+ _maxVelocity = 50000.0;
+ _rotationX = 1.0;
+ _rotationY = 1.0;
+ _rotationZ = 0.0;
}
void CCameraMover::setVector(CStarVector *sv) {
@@ -66,77 +66,77 @@ void CCameraMover::setVector(CStarVector *sv) {
_starVector = sv;
}
-void CCameraMover::copyFrom(const CNavigationInfo *src) {
- _speed = src->_speed;
- _unused = src->_speedChangeCtr;
- _maxSpeed = src->_speedChangeInc;
- _speedChangeCtr = src->_unused;
- _speedChangeInc = src->_maxSpeed;
- _unusedX = src->_unusedX;
- _unusedY = src->_unusedY;
- _unusedZ = src->_unusedZ;
+void CCameraMover::setMotion(const CNavigationInfo *src) {
+ _currVelocity = src->_initialVelocity;
+ _minVelocity = src->_minVelocity;
+ _maxVelocity = src->_maxVelocity;
+ _incVelocity = src->_velocity;
+ _incAcceleration = src->_acceleration;
+ _rotationX = src->_rotationX;
+ _rotationY = src->_rotationY;
+ _rotationZ = src->_rotationZ;
}
-void CCameraMover::copyTo(CNavigationInfo *dest) {
- dest->_speed = _speed;
- dest->_speedChangeCtr = _unused;
- dest->_speedChangeInc = _maxSpeed;
- dest->_unused = _speedChangeCtr;
- dest->_maxSpeed = _speedChangeInc;
- dest->_unusedX = _unusedX;
- dest->_unusedY = _unusedY;
- dest->_unusedZ = _unusedZ;
+void CCameraMover::getMotion(CNavigationInfo *dest) {
+ dest->_initialVelocity = _currVelocity;
+ dest->_minVelocity = _minVelocity;
+ dest->_maxVelocity = _maxVelocity;
+ dest->_velocity = _incVelocity;
+ dest->_acceleration = _incAcceleration;
+ dest->_rotationX = _rotationX;
+ dest->_rotationY = _rotationY;
+ dest->_rotationZ = _rotationZ;
}
void CCameraMover::accelerate() {
- if (!isLocked() && _speed < _maxSpeed) {
- _speedChangeCtr += _speedChangeInc;
- _speed += ABS(_speedChangeCtr);
+ if (!isLocked() && _currVelocity < _maxVelocity) {
+ _incVelocity += _incAcceleration;
+ _currVelocity += ABS(_incVelocity);
}
}
void CCameraMover::deccelerate() {
- if (!isLocked() && _speed > -_maxSpeed) {
- _speedChangeCtr -= _speedChangeInc;
- _speed -= ABS(_speedChangeCtr);
+ if (!isLocked() && _currVelocity > -_maxVelocity) {
+ _incVelocity -= _incAcceleration;
+ _currVelocity -= ABS(_incVelocity);
}
}
void CCameraMover::fullSpeed() {
if (!isLocked())
- _speed = _maxSpeed;
+ _currVelocity = _maxVelocity;
}
void CCameraMover::stop() {
if (!isLocked()) {
- _speed = 0.0;
- _speedChangeCtr = 0.0;
+ _currVelocity = 0.0;
+ _incVelocity = 0.0;
}
}
// TODO: this is confusing to negate the val value
void CCameraMover::load(SimpleFile *file, int val) {
if (!val) {
- _speed = file->readFloat();
- _speedChangeCtr = file->readFloat();
- _speedChangeInc = file->readFloat();
- _unused = file->readFloat();
- _maxSpeed = file->readFloat();
- _unusedX = file->readFloat();
- _unusedY = file->readFloat();
- _unusedZ = file->readFloat();
+ _currVelocity = file->readFloat();
+ _incVelocity = file->readFloat();
+ _incAcceleration = file->readFloat();
+ _minVelocity = file->readFloat();
+ _maxVelocity = file->readFloat();
+ _rotationX = file->readFloat();
+ _rotationY = file->readFloat();
+ _rotationZ = file->readFloat();
}
}
void CCameraMover::save(SimpleFile *file, int indent) {
- file->writeFloatLine(_speed, indent);
- file->writeFloatLine(_speedChangeCtr, indent);
- file->writeFloatLine(_speedChangeInc, indent);
- file->writeFloatLine(_unused, indent);
- file->writeFloatLine(_maxSpeed, indent);
- file->writeFloatLine(_unusedX, indent);
- file->writeFloatLine(_unusedY, indent);
- file->writeFloatLine(_unusedZ, indent);
+ file->writeFloatLine(_currVelocity, indent);
+ file->writeFloatLine(_incVelocity, indent);
+ file->writeFloatLine(_incAcceleration, indent);
+ file->writeFloatLine(_minVelocity, indent);
+ file->writeFloatLine(_maxVelocity, indent);
+ file->writeFloatLine(_rotationX, indent);
+ file->writeFloatLine(_rotationY, indent);
+ file->writeFloatLine(_rotationZ, indent);
}
void CCameraMover::incLockCount() {
diff --git a/engines/titanic/star_control/camera_mover.h b/engines/titanic/star_control/camera_mover.h
index 2f01eaf..28800fa 100644
--- a/engines/titanic/star_control/camera_mover.h
+++ b/engines/titanic/star_control/camera_mover.h
@@ -32,17 +32,26 @@ class FVector;
class SimpleFile;
struct CNavigationInfo {
- double _speed;
- double _speedChangeCtr;
- double _speedChangeInc;
- double _unused;
- double _maxSpeed;
- double _unusedX;
- double _unusedY;
- double _unusedZ;
+ double _initialVelocity;
+ double _minVelocity;
+ double _maxVelocity;
+ double _velocity;
+ double _acceleration;
+ double _rotationX;
+ double _rotationY;
+ double _rotationZ;
};
-class CCameraMover : public CNavigationInfo {
+class CCameraMover {
+protected:
+ double _currVelocity;
+ double _incVelocity;
+ double _incAcceleration;
+ double _minVelocity;
+ double _maxVelocity;
+ double _rotationX;
+ double _rotationY;
+ double _rotationZ;
public:
int _lockCounter;
CStarVector *_starVector;
@@ -50,8 +59,8 @@ public:
CCameraMover(const CNavigationInfo *src);
virtual ~CCameraMover();
- virtual void copyFrom(const CNavigationInfo *src);
- virtual void copyTo(CNavigationInfo *dest);
+ virtual void setMotion(const CNavigationInfo *src);
+ virtual void getMotion(CNavigationInfo *dest);
/**
* delete _starVector
diff --git a/engines/titanic/star_control/marked_camera_mover.cpp b/engines/titanic/star_control/marked_camera_mover.cpp
index df6edbe..e22dd8b 100644
--- a/engines/titanic/star_control/marked_camera_mover.cpp
+++ b/engines/titanic/star_control/marked_camera_mover.cpp
@@ -52,10 +52,10 @@ void CMarkedCameraMover::updatePosition(CErrorCode &errorCode, FVector &pos, FMa
if (_starVector)
_starVector->apply();
}
- } else if (_speed != 0.0) {
- pos._x += orientation._row3._x * _speed;
- pos._y += orientation._row3._y * _speed;
- pos._z += orientation._row3._z * _speed;
+ } else if (_currVelocity != 0.0) {
+ pos._x += orientation._row3._x * _currVelocity;
+ pos._y += orientation._row3._y * _currVelocity;
+ pos._z += orientation._row3._z * _currVelocity;
errorCode.set();
}
}
diff --git a/engines/titanic/star_control/unmarked_camera_mover.cpp b/engines/titanic/star_control/unmarked_camera_mover.cpp
index 401f550..8ecd900 100644
--- a/engines/titanic/star_control/unmarked_camera_mover.cpp
+++ b/engines/titanic/star_control/unmarked_camera_mover.cpp
@@ -22,12 +22,11 @@
#include "titanic/star_control/unmarked_camera_mover.h"
#include "titanic/debugger.h"
-#include "titanic/star_control/base_stars.h" // includes class CStarVector
+#include "titanic/star_control/base_stars.h"
#include "titanic/star_control/fpose.h"
#include "titanic/star_control/error_code.h"
-#include "titanic/star_control/fmatrix.h" // includes class FVector
+#include "titanic/star_control/fmatrix.h"
#include "titanic/titanic.h"
-// Not currently being used: #include "common/textconsole.h"
namespace Titanic {
@@ -69,10 +68,10 @@ void CUnmarkedCameraMover::updatePosition(CErrorCode &errorCode, FVector &pos, F
if (_starVector)
_starVector->apply();
}
- } else if (_speed != 0.0) {
- pos._x += orientation._row3._x * _speed;
- pos._y += orientation._row3._y * _speed;
- pos._z += orientation._row3._z * _speed;
+ } else if (_currVelocity != 0.0) {
+ pos._x += orientation._row3._x * _currVelocity;
+ pos._y += orientation._row3._y * _currVelocity;
+ pos._z += orientation._row3._z * _currVelocity;
errorCode.set();
}
}
More information about the Scummvm-git-logs
mailing list