aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/game/cdrom_tray.cpp
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/game/cdrom_tray.cpp
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/game/cdrom_tray.cpp')
-rw-r--r--engines/titanic/game/cdrom_tray.cpp74
1 files changed, 66 insertions, 8 deletions
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;
}