aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2017-02-27 08:55:56 -0500
committerPaul Gilbert2017-02-27 08:55:56 -0500
commit93cd3eced23dba0099cc713a7d2323a901dbca75 (patch)
treeb562ea1e5f77c169461e94e1f60dcb2ed96031f5 /engines
parent64b05a8693531b455389466bcaa16572f96ecc0a (diff)
downloadscummvm-rg350-93cd3eced23dba0099cc713a7d2323a901dbca75.tar.gz
scummvm-rg350-93cd3eced23dba0099cc713a7d2323a901dbca75.tar.bz2
scummvm-rg350-93cd3eced23dba0099cc713a7d2323a901dbca75.zip
TITANIC: Implemented CStarControl doAction
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/carry/photograph.cpp2
-rw-r--r--engines/titanic/core/game_object.cpp2
-rw-r--r--engines/titanic/core/game_object.h7
-rw-r--r--engines/titanic/game/nav_helmet.cpp12
-rw-r--r--engines/titanic/pet_control/pet_control.cpp4
-rw-r--r--engines/titanic/pet_control/pet_control.h4
-rw-r--r--engines/titanic/star_control/star_control.cpp117
-rw-r--r--engines/titanic/star_control/star_control.h4
-rw-r--r--engines/titanic/star_control/star_points1.cpp16
-rw-r--r--engines/titanic/star_control/star_view.cpp73
-rw-r--r--engines/titanic/star_control/star_view.h24
-rw-r--r--engines/titanic/star_control/surface_area.cpp13
12 files changed, 258 insertions, 20 deletions
diff --git a/engines/titanic/carry/photograph.cpp b/engines/titanic/carry/photograph.cpp
index d35837798f..cdf46488f0 100644
--- a/engines/titanic/carry/photograph.cpp
+++ b/engines/titanic/carry/photograph.cpp
@@ -64,7 +64,7 @@ bool CPhotograph::MouseDragEndMsg(CMouseDragEndMsg *msg) {
moveUnder(getDontSave());
makeDirty();
playSound("a#46.wav");
- starFn(14);
+ starFn(STAR_SET_REFERENCE);
showMouse();
return true;
} else {
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 589d026fad..50c5dc6d1e 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -1637,7 +1637,7 @@ CStarControl *CGameObject::getStarControl() const {
return starControl;
}
-void CGameObject::starFn(int action) {
+void CGameObject::starFn(StarControlAction action) {
CStarControl *starControl = getStarControl();
if (starControl)
starControl->doAction(action);
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index 2025c574a5..a04860f7a4 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -42,6 +42,11 @@ namespace Titanic {
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_8, STAR_9, STAR_10, STAR_11, STAR_12, STAR_13, STAR_SET_REFERENCE, STAR_FADE_IN,
+ STAR_FADE_OUT, STAR_17, STAR_18, STAR_19
+};
class CDontSaveFileItem;
class CMailMan;
@@ -948,7 +953,7 @@ public:
/**
* Executes an action in the StarControl subsystem
*/
- void starFn(int action);
+ void starFn(StarControlAction action);
/**
* Returns true if the starmap puzzle has been solved
diff --git a/engines/titanic/game/nav_helmet.cpp b/engines/titanic/game/nav_helmet.cpp
index ab86bd7582..aaaa17defd 100644
--- a/engines/titanic/game/nav_helmet.cpp
+++ b/engines/titanic/game/nav_helmet.cpp
@@ -58,8 +58,8 @@ bool CNavHelmet::MovieEndMsg(CMovieEndMsg *msg) {
pet->incAreaLocks();
}
- starFn(0);
- starFn(12);
+ starFn(STAR_SHOW);
+ starFn(STAR_12);
}
return true;
@@ -81,7 +81,7 @@ bool CNavHelmet::PETHelmetOnOffMsg(CPETHelmetOnOffMsg *msg) {
if (_flag) {
_flag = false;
setVisible(true);
- starFn(1);
+ starFn(STAR_HIDE);
playMovie(61, 120, MOVIE_NOTIFY_OBJECT);
playSound("a#47.wav");
playSound("a#48.wav");
@@ -106,7 +106,7 @@ bool CNavHelmet::PETHelmetOnOffMsg(CPETHelmetOnOffMsg *msg) {
bool CNavHelmet::PETPhotoOnOffMsg(CPETPhotoOnOffMsg *msg) {
if (_flag)
- starFn(9);
+ starFn(STAR_9);
return true;
}
@@ -115,10 +115,10 @@ bool CNavHelmet::PETStarFieldLockMsg(CPETStarFieldLockMsg *msg) {
if (_flag) {
if (msg->_value) {
playSound("a#6.wav");
- starFn(17);
+ starFn(STAR_17);
} else {
playSound("a#5.wav");
- starFn(18);
+ starFn(STAR_18);
}
}
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp
index 55b2ecc24b..0388859cb2 100644
--- a/engines/titanic/pet_control/pet_control.cpp
+++ b/engines/titanic/pet_control/pet_control.cpp
@@ -712,8 +712,8 @@ void CPetControl::starsSetButtons(int val1, int val2) {
_starfield.makePetDirty();
}
-void CPetControl::starsSetReference(bool hasRef) {
- _starfield.setHasReference(hasRef);
+void CPetControl::starsSetReference() {
+ _starfield.setHasReference(true);
}
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h
index 554157e166..18a6d400f6 100644
--- a/engines/titanic/pet_control/pet_control.h
+++ b/engines/titanic/pet_control/pet_control.h
@@ -588,9 +588,9 @@ public:
void starsSetButtons(int val1, int val2);
/**
- * Set whether the user has the galactic reference material
+ * Sets that the user has the galactic reference material
*/
- void starsSetReference(bool hasRef);
+ void starsSetReference();
};
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp
index 2aaf5d7640..5874d01760 100644
--- a/engines/titanic/star_control/star_control.cpp
+++ b/engines/titanic/star_control/star_control.cpp
@@ -21,11 +21,16 @@
*/
#include "titanic/support/screen_manager.h"
+#include "titanic/pet_control/pet_control.h"
#include "titanic/star_control/star_control.h"
#include "titanic/star_control/dmatrix.h"
#include "titanic/star_control/error_code.h"
#include "titanic/star_control/star_control_sub6.h"
#include "titanic/star_control/star_control_sub12.h"
+#include "titanic/game_manager.h"
+#include "titanic/core/dont_save_file_item.h"
+#include "titanic/core/project_item.h"
+#include "titanic/core/view_item.h"
namespace Titanic {
@@ -36,7 +41,7 @@ BEGIN_MESSAGE_MAP(CStarControl, CGameObject)
ON_MESSAGE(FrameMsg)
END_MESSAGE_MAP()
-CStarControl::CStarControl() : _fieldBC(0),
+CStarControl::CStarControl() : _enabled(false),
_starRect(20, 10, 620, 350) {
CStarControlSub6::init();
CStarControlSub12::init();
@@ -72,7 +77,7 @@ void CStarControl::load(SimpleFile *file) {
_view.setup(screenManager, &_starField, this);
_view.reset();
- _fieldBC = 1;
+ _enabled = true;
}
CGameObject::load(file);
@@ -129,7 +134,113 @@ void CStarControl::newFrame() {
// TODO
}
-void CStarControl::doAction(int action) {
+void CStarControl::doAction(StarControlAction action) {
+ if (!_enabled)
+ return;
+
+ switch (action) {
+ case STAR_SHOW: {
+ CGameManager *gameManager = getGameManager();
+ CViewItem *view = gameManager ? gameManager->getView() : nullptr;
+ if (view) {
+ detach();
+ addUnder(view);
+ _view.fn2();
+ _view.fn3(true);
+ _visible = true;
+ }
+ break;
+ }
+
+ case STAR_HIDE: {
+ CProjectItem *root = getRoot();
+ CDontSaveFileItem *fileItem = root ? root->getDontSaveFileItem() : nullptr;
+ if (fileItem) {
+ detach();
+ addUnder(fileItem);
+ _visible = false;
+ }
+ break;
+ }
+
+ case STAR_2:
+ _view.fn4();
+ break;
+
+ case STAR_RESET_POS:
+ _view.resetPosition();
+ break;
+
+ case STAR_4:
+ _view.fn5();
+ break;
+
+ case STAR_5:
+ _view.fn6();
+ break;
+
+ case STAR_6:
+ _view.fn7();
+ break;
+
+ case STAR_7:
+ _view.fn8();
+ break;
+
+ case STAR_8:
+ _view.fn9();
+ break;
+
+ case STAR_9:
+ _view.fn10();
+ break;
+
+ case STAR_10:
+ _view.fn11();
+ break;
+
+ case STAR_11:
+ _view.fn12();
+ break;
+
+ case STAR_12:
+ _view.fn13();
+ break;
+
+ case STAR_13:
+ _view.fn14();
+ break;
+
+ case STAR_SET_REFERENCE: {
+ _view.fn15();
+ CPetControl *pet = getPetControl();
+ if (pet)
+ pet->starsSetReference();
+ break;
+ }
+
+ case STAR_FADE_IN:
+ _view.fn3(true);
+ break;
+
+ case STAR_FADE_OUT:
+ _view.fn3(false);
+ break;
+
+ case STAR_17:
+ _view.fn16();
+ break;
+
+ case STAR_18:
+ _view.fn17();
+ break;
+
+ case STAR_19:
+ _view.petDestinationSet();
+ break;
+
+ }
+
// TODO
}
diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h
index 1a07e66ab7..830d586db1 100644
--- a/engines/titanic/star_control/star_control.h
+++ b/engines/titanic/star_control/star_control.h
@@ -36,7 +36,7 @@ class CStarControl : public CGameObject {
bool KeyCharMsg(CKeyCharMsg *msg);
bool FrameMsg(CFrameMsg *msg);
private:
- int _fieldBC;
+ bool _enabled;
CStarField _starField;
CStarView _view;
Rect _starRect;
@@ -71,7 +71,7 @@ public:
/**
* Does an action in the star control
*/
- void doAction(int action);
+ void doAction(StarControlAction action);
/**
* Returns true if the starfield puzzle has been solved
diff --git a/engines/titanic/star_control/star_points1.cpp b/engines/titanic/star_control/star_points1.cpp
index 8719551746..b31fb5d698 100644
--- a/engines/titanic/star_control/star_points1.cpp
+++ b/engines/titanic/star_control/star_points1.cpp
@@ -63,9 +63,21 @@ void CStarPoints1::draw(CSurfaceArea *surface, CStarControlSub12 *sub12) {
CStarControlSub6 sub6 = sub12->proc23();
sub12->proc25();
-
+ /*
FVector &v0 = _data[0];
-
+ double vx = v0._x, vy = v0._y, vz = v0._z;
+
+ | (vx*sub6._matrix.row1._z + vy*sub6._matrix.row2._z + vy) |
+ | vz*sub6._matrix.row3._x |
+ | surface->_width |
+ | vy |
+ | vx*sub6._matrix.row1._x |
+ | vz |
+ | vy*sub6._matrix.row2._x*sub6._matrix.row1._y*sub6._matrix.row3._z |
+ | vz*sub6._matrix.row2._y |
+ | vy*sub6._matrix.row2._z + vx*sub6._matrix.row1._z + vy*sub6._matrix.row2._z |
+ | vx |
+ */
// TODO
}
diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp
index c82f89335d..d10e0ee094 100644
--- a/engines/titanic/star_control/star_view.cpp
+++ b/engines/titanic/star_control/star_view.cpp
@@ -128,8 +128,81 @@ void CStarView::starDestinationSet() {
// TODO
}
+void CStarView::petDestinationSet() {
+ // TODO
+}
+
+void CStarView::resetPosition() {
+ // TODO
+}
+
void CStarView::fn1() {
// TODO
}
+void CStarView::fn2() {
+ // TODO
+}
+
+void CStarView::fn3(bool fadeIn) {
+ // TODO
+}
+
+void CStarView::fn4() {
+ // TODO
+}
+
+void CStarView::fn5() {
+ // TODO
+}
+
+void CStarView::fn6() {
+ // TODO
+}
+
+void CStarView::fn7() {
+ // TODO
+}
+
+void CStarView::fn8() {
+ // TODO
+}
+
+void CStarView::fn9() {
+ // TODO
+}
+
+void CStarView::fn10() {
+ // TODO
+}
+
+void CStarView::fn11() {
+ // TODO
+}
+
+void CStarView::fn12() {
+ // TODO
+}
+
+void CStarView::fn13() {
+ // TODO
+}
+
+void CStarView::fn14() {
+ // TODO
+}
+
+void CStarView::fn15() {
+ // TODO
+}
+
+void CStarView::fn16() {
+ // TODO
+}
+
+void CStarView::fn17() {
+ // TODO
+}
+
+
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h
index 7ebbcb218b..5e958c8053 100644
--- a/engines/titanic/star_control/star_view.h
+++ b/engines/titanic/star_control/star_view.h
@@ -102,6 +102,30 @@ public:
* Called when a star destination is set
*/
void starDestinationSet();
+
+ /**
+ * Resets back to the origin position
+ */
+ void resetPosition();
+ void petDestinationSet();
+
+ void fn2();
+ void fn3(bool fadeIn);
+ void fn4();
+ void fn5();
+ void fn6();
+ void fn7();
+ void fn8();
+ void fn9();
+ void fn10();
+ void fn11();
+ void fn12();
+ void fn13();
+ void fn14();
+ void fn15();
+ void fn16();
+ void fn17();
+
};
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/surface_area.cpp b/engines/titanic/star_control/surface_area.cpp
index 5d72725636..9b46cf03b7 100644
--- a/engines/titanic/star_control/surface_area.cpp
+++ b/engines/titanic/star_control/surface_area.cpp
@@ -172,6 +172,19 @@ double CSurfaceArea::fn1(const FRect &rect) {
SWAP(rr.top, rr.bottom);
}
+ // TODO: initial setup
+ if (_mode == SA_NONE) {
+ switch (_bpp) {
+ default:
+ break;
+ }
+ } else {
+ switch (_bpp) {
+ default:
+ break;
+ }
+ }
+
// TODO: Lots more functionality
return r.top;