aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/game/music_room_stop_phonograph_button.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-25 22:13:04 -0400
committerPaul Gilbert2016-08-25 22:13:04 -0400
commit9a71c9166b1ef8c7d0e57cfdfac6eb25f5332c69 (patch)
tree60bea0262805a98f2cdaf5ea0a34f4e9e198e72e /engines/titanic/game/music_room_stop_phonograph_button.cpp
parent1f0b9cb68d02d956ec745bef16f0dbddaa743bec (diff)
downloadscummvm-rg350-9a71c9166b1ef8c7d0e57cfdfac6eb25f5332c69.tar.gz
scummvm-rg350-9a71c9166b1ef8c7d0e57cfdfac6eb25f5332c69.tar.bz2
scummvm-rg350-9a71c9166b1ef8c7d0e57cfdfac6eb25f5332c69.zip
TITANIC: Implemented more game classes and music widget classes
Diffstat (limited to 'engines/titanic/game/music_room_stop_phonograph_button.cpp')
-rw-r--r--engines/titanic/game/music_room_stop_phonograph_button.cpp40
1 files changed, 38 insertions, 2 deletions
diff --git a/engines/titanic/game/music_room_stop_phonograph_button.cpp b/engines/titanic/game/music_room_stop_phonograph_button.cpp
index 44342fc2d6..dee2c0883e 100644
--- a/engines/titanic/game/music_room_stop_phonograph_button.cpp
+++ b/engines/titanic/game/music_room_stop_phonograph_button.cpp
@@ -24,16 +24,52 @@
namespace Titanic {
+BEGIN_MESSAGE_MAP(CMusicRoomStopPhonographButton, CEjectPhonographButton)
+ ON_MESSAGE(MouseButtonDownMsg)
+ ON_MESSAGE(FrameMsg)
+END_MESSAGE_MAP()
+
void CMusicRoomStopPhonographButton::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_field100, indent);
+ file->writeNumberLine(_ticks, indent);
CEjectPhonographButton::save(file, indent);
}
void CMusicRoomStopPhonographButton::load(SimpleFile *file) {
file->readNumber();
- _field100 = file->readNumber();
+ _ticks = file->readNumber();
CEjectPhonographButton::load(file);
}
+bool CMusicRoomStopPhonographButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ if (!_ejected) {
+ loadFrame(1);
+ playSound(_soundName);
+ _readyFlag = true;
+
+ CPhonographStopMsg stopMsg;
+ stopMsg.execute(getParent(), nullptr, MSGFLAG_SCAN);
+ if (stopMsg._value2) {
+ _ticks = getTicksCount();
+ } else {
+ CEjectCylinderMsg ejectMsg;
+ ejectMsg.execute(getParent(), nullptr, MSGFLAG_SCAN);
+ _ejected = true;
+ }
+ }
+
+ return true;
+}
+
+bool CMusicRoomStopPhonographButton::FrameMsg(CFrameMsg *msg) {
+ if (_readyFlag && _ticks && msg->_ticks >= (_ticks + 100)) {
+ loadFrame(0);
+ playSound(_readySoundName);
+ _ticks = 0;
+ _readyFlag = false;
+ }
+
+ return true;
+}
+
} // End of namespace Titanic