diff options
-rw-r--r-- | engines/titanic/star_control/base_star.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub12.cpp | 5 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub12.h | 3 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub13.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub6.cpp | 60 | ||||
-rw-r--r-- | engines/titanic/star_control/star_control_sub6.h | 3 | ||||
-rw-r--r-- | engines/titanic/star_control/star_view.cpp | 76 |
7 files changed, 113 insertions, 40 deletions
diff --git a/engines/titanic/star_control/base_star.cpp b/engines/titanic/star_control/base_star.cpp index 218176af9f..16e79fbe80 100644 --- a/engines/titanic/star_control/base_star.cpp +++ b/engines/titanic/star_control/base_star.cpp @@ -165,8 +165,8 @@ void CBaseStar::draw1(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStar vector._x = entry._val._v1; vector._y = entry._val._v2; vector._z = entry._val._v3; - v4 = vector._x * sub6._matrix._row1._z + vector._y * sub6._matrix._row2._z - + vector._z * sub6._matrix._row3._z + sub6._field2C; + v4 = vector._x * sub6._row1._z + vector._y * sub6._row2._z + + vector._z * sub6._row3._z + sub6._field2C; if (v4 <= minVal) continue; diff --git a/engines/titanic/star_control/star_control_sub12.cpp b/engines/titanic/star_control/star_control_sub12.cpp index b60bb0ae3f..34aed56a87 100644 --- a/engines/titanic/star_control/star_control_sub12.cpp +++ b/engines/titanic/star_control/star_control_sub12.cpp @@ -122,7 +122,7 @@ void CStarControlSub12::proc14(int v) { _handlerP->proc9(&vector, v, &matrix); } -void CStarControlSub12::proc15(int v) { +void CStarControlSub12::proc15(CErrorCode *errorCode) { if (!_matrix1) _matrix1 = new FMatrix(); if (!_matrix2) @@ -133,8 +133,7 @@ void CStarControlSub12::proc15(int v) { FVector v1 = _sub13._position; FVector v2 = _sub13._position; - CErrorCode errorCode; - _handlerP->proc11(errorCode, v2, _matrix2); + _handlerP->proc11(*errorCode, v2, _matrix2); if (v1 != v2) { _sub13.setPosition(v2); diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h index 648225140f..8f0a59da7f 100644 --- a/engines/titanic/star_control/star_control_sub12.h +++ b/engines/titanic/star_control/star_control_sub12.h @@ -28,6 +28,7 @@ #include "titanic/star_control/fpoint.h" #include "titanic/star_control/star_control_sub13.h" #include "titanic/star_control/star_control_sub20.h" +#include "titanic/star_control/error_code.h" namespace Titanic { @@ -77,7 +78,7 @@ public: virtual void proc12(double v1, double v2); virtual void proc13(CStarControlSub13 *dest); virtual void proc14(int v); - virtual void proc15(int v); + virtual void proc15(CErrorCode *errorCode); virtual void proc16(); virtual void proc17(); virtual void proc18(); diff --git a/engines/titanic/star_control/star_control_sub13.cpp b/engines/titanic/star_control/star_control_sub13.cpp index 5da6118a74..7534c2c289 100644 --- a/engines/titanic/star_control/star_control_sub13.cpp +++ b/engines/titanic/star_control/star_control_sub13.cpp @@ -129,7 +129,7 @@ void CStarControlSub13::setPosition(const FVector &v) { void CStarControlSub13::setPosition(const CStarControlSub6 &sub6) { FVector vector; _position.fn5(&vector, &sub6); - _position = sub6._matrix._row1; + _position = sub6._row1; _fieldD4 = 0; } diff --git a/engines/titanic/star_control/star_control_sub6.cpp b/engines/titanic/star_control/star_control_sub6.cpp index a5a1d81aa8..97eb5971ef 100644 --- a/engines/titanic/star_control/star_control_sub6.cpp +++ b/engines/titanic/star_control/star_control_sub6.cpp @@ -48,7 +48,7 @@ void CStarControlSub6::deinit() { } void CStarControlSub6::clear() { - _matrix.clear(); + FMatrix::clear(); _field24 = 0; _field28 = 0; _field2C = 0; @@ -61,39 +61,39 @@ void CStarControlSub6::set(int mode, double amount) { switch (mode) { case 0: - _matrix._row1._x = 1.0; - _matrix._row1._y = 0.0; - _matrix._row1._z = 0.0; - _matrix._row2._x = 0.0; - _matrix._row2._y = cosVal; - _matrix._row2._z = sinVal; - _matrix._row3._x = 0.0; - _matrix._row3._y = -sinVal; - _matrix._row3._z = cosVal; + _row1._x = 1.0; + _row1._y = 0.0; + _row1._z = 0.0; + _row2._x = 0.0; + _row2._y = cosVal; + _row2._z = sinVal; + _row3._x = 0.0; + _row3._y = -sinVal; + _row3._z = cosVal; break; case 1: - _matrix._row1._x = cosVal; - _matrix._row1._y = 0.0; - _matrix._row1._z = sinVal; - _matrix._row2._x = 0.0; - _matrix._row2._y = 1.0; - _matrix._row2._z = 0.0; - _matrix._row3._x = -sinVal; - _matrix._row3._y = 0.0; - _matrix._row3._z = sinVal; + _row1._x = cosVal; + _row1._y = 0.0; + _row1._z = sinVal; + _row2._x = 0.0; + _row2._y = 1.0; + _row2._z = 0.0; + _row3._x = -sinVal; + _row3._y = 0.0; + _row3._z = sinVal; break; case 2: - _matrix._row1._x = cosVal; - _matrix._row1._y = sinVal; - _matrix._row1._z = 0.0; - _matrix._row2._x = -sinVal; - _matrix._row2._y = cosVal; - _matrix._row2._z = 0.0; - _matrix._row3._x = 0.0; - _matrix._row3._y = 0.0; - _matrix._row3._z = 1.0; + _row1._x = cosVal; + _row1._y = sinVal; + _row1._z = 0.0; + _row2._x = -sinVal; + _row2._y = cosVal; + _row2._z = 0.0; + _row3._x = 0.0; + _row3._y = 0.0; + _row3._z = 1.0; break; default: @@ -106,7 +106,9 @@ void CStarControlSub6::set(int mode, double amount) { } void CStarControlSub6::copyFrom(const CStarControlSub6 *src) { - _matrix = src->_matrix; + _row1 = src->_row1; + _row2 = src->_row2; + _row3 = src->_row3; _field24 = src->_field24; _field28 = src->_field28; _field2C = src->_field2C; diff --git a/engines/titanic/star_control/star_control_sub6.h b/engines/titanic/star_control/star_control_sub6.h index 761cc1625f..645eb45c00 100644 --- a/engines/titanic/star_control/star_control_sub6.h +++ b/engines/titanic/star_control/star_control_sub6.h @@ -27,14 +27,13 @@ namespace Titanic { -class CStarControlSub6 { +class CStarControlSub6 : public FMatrix { private: static CStarControlSub6 *_static; public: static void init(); static void deinit(); public: - FMatrix _matrix; int _field24; int _field28; int _field2C; diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp index 405e8d620f..855bca5837 100644 --- a/engines/titanic/star_control/star_view.cpp +++ b/engines/titanic/star_control/star_view.cpp @@ -25,6 +25,7 @@ #include "titanic/star_control/star_control.h" #include "titanic/star_control/star_field.h" #include "titanic/core/game_object.h" +#include "titanic/messages/pet_messages.h" #include "titanic/titanic.h" namespace Titanic { @@ -145,7 +146,7 @@ bool CStarView::MouseMoveMsg(int unused, const Point &pt) { bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) { CStarControlSub6 sub6; -// int v = _starField ? _starField->get88() : -1; + int v = _starField ? _starField->get88() : -1; switch (key) { case Common::KEYCODE_TAB: @@ -155,7 +156,78 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) { } break; - // TODO: More switch cases + case Common::KEYCODE_l: { + CPetControl *pet = _owner->getPetControl(); + if (pet && pet->_remoteTarget) { + CPETStarFieldLockMsg lockMsg(1); + lockMsg.execute(pet->_remoteTarget); + } + return true; + } + + case Common::KEYCODE_d: { + CPetControl *pet = _owner->getPetControl(); + if (pet && pet->_remoteTarget) { + CPETStarFieldLockMsg lockMsg(0); + lockMsg.execute(pet->_remoteTarget); + } + return true; + } + + case Common::KEYCODE_z: + case Common::KEYCODE_c: + if (v == -1) { + sub6.set(key == Common::KEYCODE_z ? MODE_PHOTO : MODE_STARFIELD, 1.0); + _sub12.proc22(sub6); + _sub12.proc15(errorCode); + return true; + } + break; + + case Common::KEYCODE_SEMICOLON: + if (v == -1) { + _sub12.proc16(); + errorCode->set(); + return true; + } + break; + + case Common::KEYCODE_PERIOD: + if (v == -1) { + _sub12.proc17(); + errorCode->set(); + return true; + } + break; + + case Common::KEYCODE_SPACE: + if (v == -1) { + _sub12.proc19(); + errorCode->set(); + return true; + } + break; + + case Common::KEYCODE_x: + if (v == -1) { + sub6.set(MODE_PHOTO, -1.0); + _sub12.proc22(sub6); + _sub12.proc15(errorCode); + return true; + } + break; + + case Common::KEYCODE_QUOTE: + if (v == -1) { + sub6.set(MODE_STARFIELD, -1.0); + _sub12.proc22(sub6); + _sub12.proc15(errorCode); + return true; + } + break; + + default: + break; } return false; |