aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-07 19:14:25 -0400
committerPaul Gilbert2016-04-07 19:14:25 -0400
commit31934ac4ba62546d66e565e6caa0da0caa666d23 (patch)
tree7e087f38dac878b72e283da2b6add12530a9aafc /engines/titanic
parentcdfd9f3703050a36e16455f4bf8c343b36dd4b39 (diff)
downloadscummvm-rg350-31934ac4ba62546d66e565e6caa0da0caa666d23.tar.gz
scummvm-rg350-31934ac4ba62546d66e565e6caa0da0caa666d23.tar.bz2
scummvm-rg350-31934ac4ba62546d66e565e6caa0da0caa666d23.zip
TITANIC: Fleshed out CCDROMTray class
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/core/game_object.cpp6
-rw-r--r--engines/titanic/core/game_object.h4
-rw-r--r--engines/titanic/game/cdrom.cpp2
-rw-r--r--engines/titanic/game/cdrom_tray.cpp74
-rw-r--r--engines/titanic/game/cdrom_tray.h9
5 files changed, 77 insertions, 18 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 2bac988b31..0570008a09 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -410,15 +410,15 @@ int CGameObject::getSurface45() const {
return _surface ? _surface->proc45() : 0;
}
-void CGameObject::calcProximity(const CString &name, int val2, int val3, int val4) {
+void CGameObject::soundProximity(const CString &name, int val2, int val3, int val4) {
CProximity prox;
prox._field8 = val2;
prox._fieldC = val3;
prox._field20 = val4;
- calcProximity(name, prox);
+ soundProximity(name, prox);
}
-void CGameObject::calcProximity(const CString &name, CProximity &prox) {
+void CGameObject::soundProximity(const CString &name, CProximity &prox) {
if (prox._field28 == 2) {
// TODO
}
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index 7391a6b079..72192425f4 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -56,7 +56,6 @@ private:
void loadImage(const CString &name, bool pendingFlag = true);
void processClipList2();
- void calcProximity(const CString &name, CProximity &obj6C);
protected:
Rect _bounds;
double _field34;
@@ -181,7 +180,8 @@ public:
*/
void loadFrame(int frameNumber);
- void calcProximity(const CString &name, int val2, int val3, int val4);
+ void soundProximity(const CString &name, int val2, int val3, int val4);
+ void soundProximity(const CString &name, CProximity &obj6C);
};
} // End of namespace Titanic
diff --git a/engines/titanic/game/cdrom.cpp b/engines/titanic/game/cdrom.cpp
index d4e4eac4d1..4f4089de73 100644
--- a/engines/titanic/game/cdrom.cpp
+++ b/engines/titanic/game/cdrom.cpp
@@ -55,7 +55,7 @@ bool CCDROM::handleMessage(CMouseDragEndMsg &msg) {
if (msg._dropTarget && msg._dropTarget->getName() == "newComputer") {
CCDROMTray *newTray = dynamic_cast<CCDROMTray *>(getRoom()->findByName("newTray"));
- if (newTray->_state && newTray->_string1 == "None") {
+ if (newTray->_state && newTray->_insertedCD == "None") {
CActMsg actMsg(getName());
actMsg.execute(newTray);
}
diff --git a/engines/titanic/game/cdrom_tray.cpp b/engines/titanic/game/cdrom_tray.cpp
index 7265332c02..77ee539c57 100644
--- a/engines/titanic/game/cdrom_tray.cpp
+++ b/engines/titanic/game/cdrom_tray.cpp
@@ -20,17 +20,26 @@
*
*/
+#include "titanic/core/room_item.h"
#include "titanic/game/cdrom_tray.h"
+#include "titanic/messages/messages.h"
namespace Titanic {
+BEGIN_MESSAGE_MAP(CCDROMTray, CGameObject)
+ ON_MESSAGE(ActMsg)
+ ON_MESSAGE(MovieEndMsg)
+ ON_MESSAGE(StatusChangeMsg)
+END_MESSAGE_MAP()
+
+
CCDROMTray::CCDROMTray() : CGameObject(), _state(0) {
}
void CCDROMTray::save(SimpleFile *file, int indent) const {
file->writeNumberLine(1, indent);
file->writeNumberLine(_state, indent);
- file->writeQuotedLine(_string1, indent);
+ file->writeQuotedLine(_insertedCD, indent);
CGameObject::save(file, indent);
}
@@ -38,23 +47,72 @@ void CCDROMTray::save(SimpleFile *file, int indent) const {
void CCDROMTray::load(SimpleFile *file) {
file->readNumber();
_state = file->readNumber();
- _string1 = file->readString();
+ _insertedCD = file->readString();
CGameObject::load(file);
}
-bool CCDROMTray::handleMessage(CActMsg &msg) {
- // TODO
+bool CCDROMTray::ActMsg(CActMsg *msg) {
+ if (msg->_action == "ClickedOn") {
+ if (_state) {
+ if (_insertedCD == "None") {
+ fn1(55, 65, 0);
+ soundProximity("a#35.wav", 50, 0, 0);
+ _state = 0;
+ } else {
+ CTreeItem *treeItem = getRoom()->findByName(_insertedCD);
+ if (treeItem) {
+ CActMsg actMsg("Ejected");
+ actMsg.execute(treeItem);
+ }
+
+ _insertedCD = "None";
+ loadFrame(52);
+ }
+ } else if (_insertedCD == "None") {
+ fn1(44, 54, 0);
+ soundProximity("a#34.wav", 50, 0, 0);
+ _state = 1;
+ } else if (_insertedCD == "newCD1" || _insertedCD == "newCD2") {
+ fn1(22, 32, 0);
+ soundProximity("a#34.wav", 50, 0, 0);
+ _state = 1;
+ } else if (_insertedCD == "newSTCD") {
+ fn1(0, 10, 0);
+ soundProximity("a#34.wav", 50, 0, 0);
+ _state = 1;
+ }
+ } else if (_state) {
+ if (msg->_action == "newCD1" || msg->_action == "newCD2") {
+ fn1(33, 43, 4);
+ soundProximity("a#35.wav", 50, 0, 0);
+ } else if (msg->_action == "newSTCD") {
+ fn1(11, 21, 4);
+ soundProximity("a#35.wav", 50, 0, 0);
+ } else {
+ return true;
+ }
+
+ _insertedCD = msg->_action;
+ _state = 0;
+ }
+
return true;
}
-bool CCDROMTray::handleMessage(CMovieEndMsg &msg) {
- // TODO
+bool CCDROMTray::MovieEndMsg(CMovieEndMsg *msg) {
+ CTreeItem *treeItem = getRoom()->findByName("newScreen");
+
+ if (treeItem) {
+ CActMsg actMsg(_insertedCD);
+ actMsg.execute(treeItem);
+ }
+
return true;
}
-bool CCDROMTray::handleMessage(CStatusChangeMsg &msg) {
- // TODO
+bool CCDROMTray::StatusChangeMsg(CStatusChangeMsg *msg) {
+ msg->_success = _state;
return true;
}
diff --git a/engines/titanic/game/cdrom_tray.h b/engines/titanic/game/cdrom_tray.h
index 0833847530..728471c654 100644
--- a/engines/titanic/game/cdrom_tray.h
+++ b/engines/titanic/game/cdrom_tray.h
@@ -29,13 +29,14 @@
namespace Titanic {
class CCDROMTray : public CGameObject {
+ DECLARE_MESSAGE_MAP
public:
int _state;
- CString _string1;
+ CString _insertedCD;
protected:
- virtual bool handleMessage(CActMsg &msg);
- virtual bool handleMessage(CMovieEndMsg &msg);
- virtual bool handleMessage(CStatusChangeMsg &msg);
+ virtual bool ActMsg(CActMsg *msg);
+ virtual bool MovieEndMsg(CMovieEndMsg *msg);
+ virtual bool StatusChangeMsg(CStatusChangeMsg *msg);
public:
CLASSDEF
CCDROMTray();