aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/game/eject_phonograph_button.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-19 20:48:05 -0400
committerPaul Gilbert2016-08-19 20:48:05 -0400
commita5a1a08c503d9e32352f67b90650bc604959ea5a (patch)
treebe608ff67f5c7150f69c61510e9ff4349ad575e2 /engines/titanic/game/eject_phonograph_button.cpp
parent5ec6f572c1b7888b4111566fcf6727ade3f043ea (diff)
downloadscummvm-rg350-a5a1a08c503d9e32352f67b90650bc604959ea5a.tar.gz
scummvm-rg350-a5a1a08c503d9e32352f67b90650bc604959ea5a.tar.bz2
scummvm-rg350-a5a1a08c503d9e32352f67b90650bc604959ea5a.zip
TITANIC: Implemented more game classes
Diffstat (limited to 'engines/titanic/game/eject_phonograph_button.cpp')
-rw-r--r--engines/titanic/game/eject_phonograph_button.cpp49
1 files changed, 41 insertions, 8 deletions
diff --git a/engines/titanic/game/eject_phonograph_button.cpp b/engines/titanic/game/eject_phonograph_button.cpp
index 4657f04126..b2ff441ef8 100644
--- a/engines/titanic/game/eject_phonograph_button.cpp
+++ b/engines/titanic/game/eject_phonograph_button.cpp
@@ -24,24 +24,57 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CEjectPhonographButton, CBackground)
+ ON_MESSAGE(MouseButtonDownMsg)
+ ON_MESSAGE(CylinderHolderReadyMsg)
+END_MESSAGE_MAP()
+
void CEjectPhonographButton::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_fieldE0, indent);
- file->writeNumberLine(_fieldE4, indent);
- file->writeQuotedLine(_string3, indent);
- file->writeQuotedLine(_string4, indent);
+ file->writeNumberLine(_ejected, indent);
+ file->writeNumberLine(_readyFlag, indent);
+ file->writeQuotedLine(_soundName, indent);
+ file->writeQuotedLine(_readySoundName, indent);
CBackground::save(file, indent);
}
void CEjectPhonographButton::load(SimpleFile *file) {
file->readNumber();
- _fieldE0 = file->readNumber();
- _fieldE4 = file->readNumber();
- _string3 = file->readString();
- _string4 = file->readString();
+ _ejected = file->readNumber();
+ _readyFlag = file->readNumber();
+ _soundName = file->readString();
+ _readySoundName = file->readString();
CBackground::load(file);
}
+bool CEjectPhonographButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ CQueryPhonographState queryMsg;
+ queryMsg.execute(getParent(), nullptr, MSGFLAG_SCAN);
+
+ if (!_ejected && !queryMsg._value) {
+ loadFrame(1);
+ playSound(_soundName);
+ _readyFlag = true;
+
+ CEjectCylinderMsg ejectMsg;
+ ejectMsg.execute(getParent(), nullptr, MSGFLAG_SCAN);
+ _ejected = true;
+ }
+
+ return true;
+}
+
+bool CEjectPhonographButton::CylinderHolderReadyMsg(CCylinderHolderReadyMsg *msg) {
+ if (_readyFlag) {
+ loadFrame(0);
+ playSound(_readySoundName);
+ _readyFlag = 0;
+ }
+
+ _ejected = false;
+ return true;
+}
+
} // End of namespace Titanic