aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/core/game_object.h2
-rw-r--r--engines/titanic/star_control/camera_mover.cpp68
-rw-r--r--engines/titanic/star_control/camera_mover.h33
-rw-r--r--engines/titanic/star_control/star_camera.cpp20
-rw-r--r--engines/titanic/star_control/star_camera.h38
-rw-r--r--engines/titanic/star_control/star_closeup.cpp12
-rw-r--r--engines/titanic/star_control/star_control.cpp4
-rw-r--r--engines/titanic/star_control/star_control_sub21.cpp10
-rw-r--r--engines/titanic/star_control/star_control_sub22.cpp10
-rw-r--r--engines/titanic/star_control/star_view.cpp10
-rw-r--r--engines/titanic/star_control/star_view.h7
11 files changed, 131 insertions, 83 deletions
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index 3f42a872cb..0cd5808741 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -43,7 +43,7 @@ enum Find { FIND_GLOBAL = 1, FIND_ROOM = 2, FIND_PET = 4, FIND_MAILMAN = 8 };
enum Found { FOUND_NONE = 0, FOUND_GLOBAL = 1, FOUND_ROOM = 2, FOUND_PET = 3, FOUND_MAILMAN = 4 };
enum RoomFlagsComparison { RFC_LOCATION = 1, RFC_CLASS_ELEVATOR = 2, RFC_TITANIA = 3 };
enum StarControlAction {
- STAR_SHOW = 0, STAR_HIDE, STAR_2, STAR_RESET_POS, STAR_4, STAR_5, STAR_6, STAR_7,
+ STAR_SHOW = 0, STAR_HIDE, STAR_2, STAR_RESET_POS, STAR_4, STAR_5, STAR_6, STAR_FULL_SPEED,
STAR_8, STAR_TOGGLE_MODE, STAR_10, STAR_11, STAR_12, STAR_13, STAR_SET_REFERENCE, STAR_FADE_IN,
STAR_FADE_OUT, STAR_17, STAR_18, STAR_19
};
diff --git a/engines/titanic/star_control/camera_mover.cpp b/engines/titanic/star_control/camera_mover.cpp
index ab99a2fdf9..07072afbb9 100644
--- a/engines/titanic/star_control/camera_mover.cpp
+++ b/engines/titanic/star_control/camera_mover.cpp
@@ -32,11 +32,11 @@ CCameraMover::CCameraMover(const CNavigationInfo *src) {
if (src) {
copyFrom(src);
} else {
- _size = 0.0;
- _field4 = 0.0;
- _field8 = 20.0;
+ _speed = 0.0;
+ _speedChangeCtr = 0.0;
+ _speedChangeInc = 20.0;
_fieldC = 0.0;
- _field10 = 50000.0;
+ _maxSpeed = 50000.0;
_field14 = 1.0;
_field18 = 1.0;
_field1C = 0.0;
@@ -55,46 +55,46 @@ void CCameraMover::copyTo(CNavigationInfo *dest) {
*dest = *((CNavigationInfo *)this);
}
-void CCameraMover::proc4() {
- if (!isLocked() && _size < _field10) {
- _field4 += _size;
- if (_field8 == _field4)
- _size -= _field4;
+void CCameraMover::increaseSpeed() {
+ if (!isLocked() && _speed < _maxSpeed) {
+ _speedChangeCtr += _speedChangeInc;
+ if (_speedChangeCtr > _speed)
+ _speed -= _speedChangeCtr;
else
- _size += _field4;
+ _speed += _speedChangeCtr;
}
}
-void CCameraMover::proc5() {
+void CCameraMover::decreaseSpeed() {
if (!isLocked()) {
- _field4 -= _field8;
- if (_field4 == _size)
- _size += _field4;
+ _speedChangeCtr -= _speedChangeInc;
+ if (_speedChangeCtr > _speed)
+ _speed -= _speedChangeCtr;
else
- _size -= _field4;
+ _speed += _speedChangeCtr;
- if (_field4 < 0.0)
- _field4 = 0.0;
+ if (_speedChangeCtr < 0.0)
+ _speedChangeCtr = 0.0;
}
}
-void CCameraMover::proc6() {
+void CCameraMover::fullSpeed() {
if (!isLocked())
- _size = _field10;
+ _speed = _maxSpeed;
}
-void CCameraMover::proc7() {
+void CCameraMover::stop() {
if (!isLocked()) {
- _size = 0.0;
- _field4 = 0.0;
+ _speed = 0.0;
+ _speedChangeCtr = 0.0;
}
}
void CCameraMover::updatePosition(CErrorCode &errorCode, FVector &pos, FMatrix &orientation) {
- if (_size > 0.0) {
- pos._x += orientation._row3._x * _size;
- pos._y += orientation._row3._y * _size;
- pos._z += orientation._row3._z * _size;
+ if (_speed > 0.0) {
+ pos._x += orientation._row3._x * _speed;
+ pos._y += orientation._row3._y * _speed;
+ pos._z += orientation._row3._z * _speed;
errorCode.set();
}
@@ -114,11 +114,11 @@ void CCameraMover::clear() {
void CCameraMover::load(SimpleFile *file, int val) {
if (!val) {
- _size = file->readFloat();
- _field4 = file->readFloat();
- _field8 = file->readFloat();
+ _speed = file->readFloat();
+ _speedChangeCtr = file->readFloat();
+ _speedChangeInc = file->readFloat();
_fieldC = file->readFloat();
- _field10 = file->readFloat();
+ _maxSpeed = file->readFloat();
_field14 = file->readFloat();
_field18 = file->readFloat();
_field1C = file->readFloat();
@@ -126,11 +126,11 @@ void CCameraMover::load(SimpleFile *file, int val) {
}
void CCameraMover::save(SimpleFile *file, int indent) {
- file->writeFloatLine(_size, indent);
- file->writeFloatLine(_field4, indent);
- file->writeFloatLine(_field8, indent);
+ file->writeFloatLine(_speed, indent);
+ file->writeFloatLine(_speedChangeCtr, indent);
+ file->writeFloatLine(_speedChangeInc, indent);
file->writeFloatLine(_fieldC, indent);
- file->writeFloatLine(_field10, indent);
+ file->writeFloatLine(_maxSpeed, indent);
file->writeFloatLine(_field14, indent);
file->writeFloatLine(_field18, indent);
file->writeFloatLine(_field1C, indent);
diff --git a/engines/titanic/star_control/camera_mover.h b/engines/titanic/star_control/camera_mover.h
index 1121640578..30fe6ff85b 100644
--- a/engines/titanic/star_control/camera_mover.h
+++ b/engines/titanic/star_control/camera_mover.h
@@ -31,11 +31,11 @@
namespace Titanic {
struct CNavigationInfo {
- double _size;
- double _field4;
- double _field8;
+ double _speed;
+ double _speedChangeCtr;
+ double _speedChangeInc;
double _fieldC;
- double _field10;
+ double _maxSpeed;
double _field14;
double _field18;
double _field1C;
@@ -51,10 +51,27 @@ public:
virtual void copyFrom(const CNavigationInfo *src);
virtual void copyTo(CNavigationInfo *dest);
- virtual void proc4();
- virtual void proc5();
- virtual void proc6();
- virtual void proc7();
+
+ /**
+ * Increases movement speed
+ */
+ virtual void increaseSpeed();
+
+ /**
+ * Decreases movement speed
+ */
+ virtual void decreaseSpeed();
+
+ /**
+ * Increase to full speed
+ */
+ virtual void fullSpeed();
+
+ /**
+ * Completely stop
+ */
+ virtual void stop();
+
virtual void proc8(FVector &oldPos, FVector &newPos,
FMatrix &oldOrientation, FMatrix &newOrientation) {}
diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp
index d4461e88f4..d47111804a 100644
--- a/engines/titanic/star_control/star_camera.cpp
+++ b/engines/titanic/star_control/star_camera.cpp
@@ -146,28 +146,28 @@ void CStarCamera::updatePosition(CErrorCode *errorCode) {
}
}
-void CStarCamera::proc16() {
- _mover->proc4();
+void CStarCamera::increaseSpeed() {
+ _mover->increaseSpeed();
}
-void CStarCamera::proc17() {
- _mover->proc5();
+void CStarCamera::decreaseSpeed() {
+ _mover->decreaseSpeed();
}
-void CStarCamera::proc18() {
- _mover->proc6();
+void CStarCamera::fullSpeed() {
+ _mover->fullSpeed();
}
-void CStarCamera::proc19() {
- _mover->proc7();
+void CStarCamera::stop() {
+ _mover->stop();
}
-void CStarCamera::proc20(double factor) {
+void CStarCamera::reposition(double factor) {
if (!isLocked())
_viewport.reposition(factor);
}
-void CStarCamera::proc21(const FPose &pose) {
+void CStarCamera::setPosition(const FPose &pose) {
if (!isLocked()) {
_viewport.setPosition(pose);
setIsMoved();
diff --git a/engines/titanic/star_control/star_camera.h b/engines/titanic/star_control/star_camera.h
index 3ca653275f..52baa62b3a 100644
--- a/engines/titanic/star_control/star_camera.h
+++ b/engines/titanic/star_control/star_camera.h
@@ -71,7 +71,12 @@ public:
virtual void proc2(const CViewport *src);
virtual void proc3(const CNavigationInfo *src);
+
+ /**
+ * Set the camera position
+ */
virtual void setPosition(const FVector &v);
+
virtual void proc5(const FVector &v);
virtual void proc6(int v);
virtual void proc7(int v);
@@ -92,12 +97,33 @@ public:
*/
virtual void updatePosition(CErrorCode *errorCode);
- virtual void proc16();
- virtual void proc17();
- virtual void proc18();
- virtual void proc19();
- virtual void proc20(double factor);
- virtual void proc21(const FPose &pose);
+ /**
+ * Increases movement speed
+ */
+ virtual void increaseSpeed();
+
+ /**
+ * Decreases movement speed
+ */
+ virtual void decreaseSpeed();
+
+ /**
+ * Increase to full speed
+ */
+ virtual void fullSpeed();
+
+ /**
+ * Completely stop
+ */
+ virtual void stop();
+
+ virtual void reposition(double factor);
+
+ /**
+ * Set the camera position
+ */
+ virtual void setPosition(const FPose &pose);
+
virtual void proc22(FMatrix &m);
/**
diff --git a/engines/titanic/star_control/star_closeup.cpp b/engines/titanic/star_control/star_closeup.cpp
index 0e37670075..51383045b1 100644
--- a/engines/titanic/star_control/star_closeup.cpp
+++ b/engines/titanic/star_control/star_closeup.cpp
@@ -263,12 +263,12 @@ void CStarCloseup::draw(const FPose &pose, const FVector &vector, const FVector
_sub2._vector._x = pose._row1._x * _sub1._vector._x
+ pose._row3._x * _sub1._vector._z
+ pose._row2._x * _sub1._vector._y + pose._vector._x;
- _sub2._vector._y = _sub1._vector._y * pose._row2._y
- + _sub1._vector._z * pose._row3._y
- + _sub1._vector._x * pose._row1._y + pose._vector._y;
- _sub2._vector._z = _sub1._vector._z * pose._row3._z
- + _sub1._vector._x * pose._row1._z
- + _sub1._vector._y * pose._row2._z + pose._vector._z;
+ _sub2._vector._y = pose._row2._y * _sub1._vector._y
+ + pose._row3._y * _sub1._vector._z
+ + pose._row1._y * _sub1._vector._x + pose._vector._y;
+ _sub2._vector._z = pose._row3._z * _sub1._vector._z
+ + pose._row1._z * _sub1._vector._x
+ + pose._row2._z * _sub1._vector._y + pose._vector._z;
size2 = (int)_array[1]._data2.size();
size1 = (int)_array[1]._data1.size();
diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp
index 045dc0369e..bce12efd69 100644
--- a/engines/titanic/star_control/star_control.cpp
+++ b/engines/titanic/star_control/star_control.cpp
@@ -198,8 +198,8 @@ void CStarControl::doAction(StarControlAction action) {
_view.fn7();
break;
- case STAR_7:
- _view.fn8();
+ case STAR_FULL_SPEED:
+ _view.fullSpeed();
break;
case STAR_8:
diff --git a/engines/titanic/star_control/star_control_sub21.cpp b/engines/titanic/star_control/star_control_sub21.cpp
index ef6e8beada..26510c0e7c 100644
--- a/engines/titanic/star_control/star_control_sub21.cpp
+++ b/engines/titanic/star_control/star_control_sub21.cpp
@@ -62,14 +62,14 @@ void CStarControlSub21::updatePosition(CErrorCode &errorCode, FVector &pos, FMat
if (val == 1)
incLockCount();
if (val == 2) {
- proc7();
+ stop();
if (_starVector)
_starVector->apply();
}
- } else if (_size != 0.0) {
- pos._x += orientation._row3._x * _size;
- pos._y += orientation._row3._y * _size;
- pos._z += orientation._row3._z * _size;
+ } else if (_speed != 0.0) {
+ pos._x += orientation._row3._x * _speed;
+ pos._y += orientation._row3._y * _speed;
+ pos._z += orientation._row3._z * _speed;
errorCode.set();
}
}
diff --git a/engines/titanic/star_control/star_control_sub22.cpp b/engines/titanic/star_control/star_control_sub22.cpp
index c0b0c10867..e58935ca09 100644
--- a/engines/titanic/star_control/star_control_sub22.cpp
+++ b/engines/titanic/star_control/star_control_sub22.cpp
@@ -45,14 +45,14 @@ void CStarControlSub22::updatePosition(CErrorCode &errorCode, FVector &pos, FMat
if (val == 1)
incLockCount();
if (val == 2) {
- proc7();
+ stop();
if (_starVector)
_starVector->apply();
}
- } else if (_size != 0.0) {
- pos._x += orientation._row3._x * _size;
- pos._y += orientation._row3._y * _size;
- pos._z += orientation._row3._z * _size;
+ } else if (_speed != 0.0) {
+ pos._x += orientation._row3._x * _speed;
+ pos._y += orientation._row3._y * _speed;
+ pos._z += orientation._row3._z * _speed;
errorCode.set();
}
}
diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp
index 6409e911ef..7583cb00e8 100644
--- a/engines/titanic/star_control/star_view.cpp
+++ b/engines/titanic/star_control/star_view.cpp
@@ -186,7 +186,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
case Common::KEYCODE_SEMICOLON:
if (v == -1) {
- _camera.proc16();
+ _camera.increaseSpeed();
errorCode->set();
return true;
}
@@ -194,7 +194,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
case Common::KEYCODE_PERIOD:
if (v == -1) {
- _camera.proc17();
+ _camera.decreaseSpeed();
errorCode->set();
return true;
}
@@ -202,7 +202,7 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
case Common::KEYCODE_SPACE:
if (v == -1) {
- _camera.proc19();
+ _camera.stop();
errorCode->set();
return true;
}
@@ -317,8 +317,8 @@ void CStarView::fn19(int index) {
}
}
-void CStarView::fn8() {
- _camera.proc18();
+void CStarView::fullSpeed() {
+ _camera.fullSpeed();
}
void CStarView::fn9() {
diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h
index 99f2ef811b..690c5cb782 100644
--- a/engines/titanic/star_control/star_view.h
+++ b/engines/titanic/star_control/star_view.h
@@ -123,7 +123,12 @@ public:
void fn5();
void fn6();
void fn7();
- void fn8();
+
+ /**
+ * Increase starfield movement to full speed
+ */
+ void fullSpeed();
+
void fn9();
/**