diff options
author | Paul Gilbert | 2017-02-13 21:46:12 -0500 |
---|---|---|
committer | Paul Gilbert | 2017-02-13 21:46:12 -0500 |
commit | 534ec946dd3448e71956cee54bdc40f26bb976f7 (patch) | |
tree | b80ed1ff52cba0eb8ab3d86f024986946fecdcfb /engines | |
parent | 7886ca6a4f9da6a8b974359371387347e3853b14 (diff) | |
download | scummvm-rg350-534ec946dd3448e71956cee54bdc40f26bb976f7.tar.gz scummvm-rg350-534ec946dd3448e71956cee54bdc40f26bb976f7.tar.bz2 scummvm-rg350-534ec946dd3448e71956cee54bdc40f26bb976f7.zip |
TITANIC: Some phonograph cleanup, fix record button
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/carry/phonograph_cylinder.cpp | 1 | ||||
-rw-r--r-- | engines/titanic/game/phonograph.cpp | 51 | ||||
-rw-r--r-- | engines/titanic/game/phonograph.h | 4 | ||||
-rw-r--r-- | engines/titanic/game/record_phonograph_button.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/game/restaurant_cylinder_holder.cpp | 22 | ||||
-rw-r--r-- | engines/titanic/game/restaurant_cylinder_holder.h | 2 | ||||
-rw-r--r-- | engines/titanic/game/restaurant_phonograph.cpp | 14 | ||||
-rw-r--r-- | engines/titanic/messages/messages.h | 4 |
8 files changed, 51 insertions, 49 deletions
diff --git a/engines/titanic/carry/phonograph_cylinder.cpp b/engines/titanic/carry/phonograph_cylinder.cpp index 67ea301681..fa260ef876 100644 --- a/engines/titanic/carry/phonograph_cylinder.cpp +++ b/engines/titanic/carry/phonograph_cylinder.cpp @@ -104,6 +104,7 @@ void CPhonographCylinder::load(SimpleFile *file) { bool CPhonographCylinder::UseWithOtherMsg(CUseWithOtherMsg *msg) { CPhonograph *phonograph = dynamic_cast<CPhonograph *>(msg->_other); if (phonograph) { + // Below is redundant, since original never actually executes message CSetVarMsg varMsg("m_RecordStatus", 1); return true; } else { diff --git a/engines/titanic/game/phonograph.cpp b/engines/titanic/game/phonograph.cpp index 408cfa3413..26163a74df 100644 --- a/engines/titanic/game/phonograph.cpp +++ b/engines/titanic/game/phonograph.cpp @@ -34,15 +34,15 @@ BEGIN_MESSAGE_MAP(CPhonograph, CMusicPlayer) END_MESSAGE_MAP() CPhonograph::CPhonograph() : CMusicPlayer(), - _fieldE0(false), _fieldE4(0), _fieldE8(0), _fieldEC(0), + _isPlaying(false), _isRecording(false), _fieldE8(0), _fieldEC(0), _fieldF0(0), _fieldF4(0) { } void CPhonograph::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string2, indent); - file->writeNumberLine(_fieldE0, indent); - file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_isPlaying, indent); + file->writeNumberLine(_isRecording, indent); file->writeNumberLine(_fieldE8, indent); file->writeNumberLine(_fieldEC, indent); file->writeNumberLine(_fieldF0, indent); @@ -54,8 +54,8 @@ void CPhonograph::save(SimpleFile *file, int indent) { void CPhonograph::load(SimpleFile *file) { file->readNumber(); _string2 = file->readString(); - _fieldE0 = file->readNumber(); - _fieldE4 = file->readNumber(); + _isPlaying = file->readNumber(); + _isRecording = file->readNumber(); _fieldE8 = file->readNumber(); _fieldEC = file->readNumber(); _fieldF0 = file->readNumber(); @@ -67,8 +67,8 @@ void CPhonograph::load(SimpleFile *file) { bool CPhonograph::PhonographPlayMsg(CPhonographPlayMsg *msg) { CQueryCylinderHolderMsg holderMsg; holderMsg.execute(this); - if (!holderMsg._value2) { - _fieldE0 = false; + if (!holderMsg._isPresent) { + _isPlaying = false; return true; } @@ -76,16 +76,16 @@ bool CPhonograph::PhonographPlayMsg(CPhonographPlayMsg *msg) { cylinderMsg.execute(holderMsg._target); if (cylinderMsg._name.empty()) { - _fieldE0 = false; + _isPlaying = false; } else if (cylinderMsg._name.hasPrefix("STMusic")) { CStartMusicMsg startMsg(this); startMsg.execute(this); - _fieldE0 = true; + _isPlaying = true; msg->_value = 1; } else { stopGlobalSound(0, -1); playGlobalSound(cylinderMsg._name, -2, true, true, 0); - _fieldE0 = true; + _isPlaying = true; msg->_value = 1; } @@ -95,14 +95,14 @@ bool CPhonograph::PhonographPlayMsg(CPhonographPlayMsg *msg) { bool CPhonograph::PhonographStopMsg(CPhonographStopMsg *msg) { CQueryCylinderHolderMsg holderMsg; holderMsg.execute(this); - if (!holderMsg._value2) + if (!holderMsg._isPresent) return true; - _fieldE0 = false; + _isPlaying = false; CQueryCylinderMsg cylinderMsg; cylinderMsg.execute(holderMsg._target); - if (_fieldE0) { + if (_isPlaying) { if (!cylinderMsg._name.empty()) { if (cylinderMsg._name.hasPrefix("STMusic")) { CStopMusicMsg stopMsg; @@ -114,9 +114,9 @@ bool CPhonograph::PhonographStopMsg(CPhonographStopMsg *msg) { } if (!msg->_value3) - _fieldE0 = false; - } else if (_fieldE4) { - _fieldE4 = false; + _isPlaying = false; + } else if (_isRecording) { + _isRecording = false; msg->_value2 = 1; } @@ -124,16 +124,17 @@ bool CPhonograph::PhonographStopMsg(CPhonographStopMsg *msg) { } bool CPhonograph::PhonographRecordMsg(CPhonographRecordMsg *msg) { - if (!_fieldE0 && !_fieldE4 && !_fieldE8) { + if (!_isPlaying && !_isRecording && !_fieldE8) { CQueryCylinderHolderMsg holderMsg; holderMsg.execute(this); - if (holderMsg._value2) { - _fieldE4 = true; + if (holderMsg._isPresent) { + _isRecording = true; + msg->_canRecord = true; CErasePhonographCylinderMsg eraseMsg; eraseMsg.execute(holderMsg._target); } else { - _fieldE4 = false; + _isRecording = false; } } @@ -141,7 +142,7 @@ bool CPhonograph::PhonographRecordMsg(CPhonographRecordMsg *msg) { } bool CPhonograph::EnterRoomMsg(CEnterRoomMsg *msg) { - if (_fieldE0) { + if (_isPlaying) { CPhonographPlayMsg playMsg; playMsg.execute(this); } @@ -150,7 +151,7 @@ bool CPhonograph::EnterRoomMsg(CEnterRoomMsg *msg) { } bool CPhonograph::LeaveRoomMsg(CLeaveRoomMsg *msg) { - if (_fieldE0) { + if (_isPlaying) { CPhonographStopMsg stopMsg; stopMsg._value1 = 1; stopMsg.execute(this); @@ -160,14 +161,14 @@ bool CPhonograph::LeaveRoomMsg(CLeaveRoomMsg *msg) { } bool CPhonograph::MusicHasStartedMsg(CMusicHasStartedMsg *msg) { - if (_fieldE4) { + if (_isRecording) { CQueryCylinderHolderMsg holderMsg; holderMsg.execute(this); - if (holderMsg._value2) { + if (holderMsg._isPresent) { CRecordOntoCylinderMsg recordMsg; recordMsg.execute(holderMsg._target); } else { - _fieldE4 = false; + _isRecording = false; } } diff --git a/engines/titanic/game/phonograph.h b/engines/titanic/game/phonograph.h index b13a5ea910..3c4fb86f32 100644 --- a/engines/titanic/game/phonograph.h +++ b/engines/titanic/game/phonograph.h @@ -38,8 +38,8 @@ class CPhonograph : public CMusicPlayer { bool MusicHasStartedMsg(CMusicHasStartedMsg *msg); protected: CString _string2; - bool _fieldE0; - int _fieldE4; + bool _isPlaying; + bool _isRecording; int _fieldE8; int _fieldEC; int _fieldF0; diff --git a/engines/titanic/game/record_phonograph_button.cpp b/engines/titanic/game/record_phonograph_button.cpp index 1ffaec4228..1bd2060193 100644 --- a/engines/titanic/game/record_phonograph_button.cpp +++ b/engines/titanic/game/record_phonograph_button.cpp @@ -45,7 +45,7 @@ bool CRecordPhonographButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { CPhonographRecordMsg recordMsg; recordMsg.execute(getParent()); - if (recordMsg._value) { + if (recordMsg._canRecord) { playSound("z#58.wav"); loadFrame(1); _active = true; diff --git a/engines/titanic/game/restaurant_cylinder_holder.cpp b/engines/titanic/game/restaurant_cylinder_holder.cpp index 5fb8c97cde..05f731d32d 100644 --- a/engines/titanic/game/restaurant_cylinder_holder.cpp +++ b/engines/titanic/game/restaurant_cylinder_holder.cpp @@ -34,13 +34,13 @@ BEGIN_MESSAGE_MAP(CRestaurantCylinderHolder, CDropTarget) END_MESSAGE_MAP() CRestaurantCylinderHolder::CRestaurantCylinderHolder() : CDropTarget(), - _field118(0), _field11C(0), _field12C(0), _field130(0), + _isOpen(false), _field11C(0), _field12C(0), _field130(0), _ejectSoundName("z#61.wav"), _defaultCursorId(CURSOR_ARROW) { } void CRestaurantCylinderHolder::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_field118, indent); + file->writeNumberLine(_isOpen, indent); file->writeNumberLine(_field11C, indent); file->writeQuotedLine(_target, indent); file->writeNumberLine(_field12C, indent); @@ -53,7 +53,7 @@ void CRestaurantCylinderHolder::save(SimpleFile *file, int indent) { void CRestaurantCylinderHolder::load(SimpleFile *file) { file->readNumber(); - _field118 = file->readNumber(); + _isOpen = file->readNumber(); _field11C = file->readNumber(); _target = file->readString(); _field12C = file->readNumber(); @@ -68,7 +68,7 @@ bool CRestaurantCylinderHolder::EjectCylinderMsg(CEjectCylinderMsg *msg) { _field11C = true; bool hasCylinder = findByName("Phonograph Cylinder") != nullptr; - if (_field118) { + if (_isOpen) { playClip(hasCylinder ? "CloseHolder_Full" : "CloseHolder_Empty", MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); _dropEnabled = true; @@ -82,7 +82,7 @@ bool CRestaurantCylinderHolder::EjectCylinderMsg(CEjectCylinderMsg *msg) { } bool CRestaurantCylinderHolder::EnterViewMsg(CEnterViewMsg *msg) { - if (_field118) { + if (_isOpen) { CTreeItem *cylinder = findByName("Phonograph Cylinder", true); if (cylinder) { loadFrame(_dropFrame); @@ -101,14 +101,14 @@ bool CRestaurantCylinderHolder::EnterViewMsg(CEnterViewMsg *msg) { bool CRestaurantCylinderHolder::MovieEndMsg(CMovieEndMsg *msg) { _field11C = false; - if (_field118) { - _field118 = false; + if (_isOpen) { + _isOpen = false; _cursorId = _defaultCursorId; CPhonographReadyToPlayMsg readyMsg; readyMsg.execute(_target); } else { - _field118 = true; + _isOpen = true; _dropEnabled = false; _cursorId = findByName("Phonograph Cylinder") ? _dropCursorId : _dragCursorId; } @@ -121,9 +121,9 @@ bool CRestaurantCylinderHolder::MovieEndMsg(CMovieEndMsg *msg) { bool CRestaurantCylinderHolder::QueryCylinderHolderMsg(CQueryCylinderHolderMsg *msg) { CNamedItem *cylinder = findByName("Phonograph Cylinder", true); - msg->_value1 = _field118; + msg->_isOpen = _isOpen; if (cylinder) { - msg->_value2 = 1; + msg->_isPresent = true; msg->_target = cylinder; } @@ -143,7 +143,7 @@ bool CRestaurantCylinderHolder::QueryCylinderNameMsg(CQueryCylinderNameMsg *msg) } bool CRestaurantCylinderHolder::MouseDragStartMsg(CMouseDragStartMsg *msg) { - if (_field118) + if (_isOpen) return CDropTarget::MouseDragStartMsg(msg); else return true; diff --git a/engines/titanic/game/restaurant_cylinder_holder.h b/engines/titanic/game/restaurant_cylinder_holder.h index cd0b0783bd..7be73df074 100644 --- a/engines/titanic/game/restaurant_cylinder_holder.h +++ b/engines/titanic/game/restaurant_cylinder_holder.h @@ -36,7 +36,7 @@ class CRestaurantCylinderHolder : public CDropTarget { bool QueryCylinderNameMsg(CQueryCylinderNameMsg *msg); bool MouseDragStartMsg(CMouseDragStartMsg *msg); private: - int _field118; + bool _isOpen; int _field11C; CString _target; int _field12C; diff --git a/engines/titanic/game/restaurant_phonograph.cpp b/engines/titanic/game/restaurant_phonograph.cpp index 881079e020..22f86dc8ab 100644 --- a/engines/titanic/game/restaurant_phonograph.cpp +++ b/engines/titanic/game/restaurant_phonograph.cpp @@ -60,14 +60,14 @@ void CRestaurantPhonograph::load(SimpleFile *file) { } bool CRestaurantPhonograph::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - if (!_fieldF8 && !_fieldE0) { + if (!_fieldF8 && !_isPlaying) { CQueryCylinderHolderMsg holderMsg; holderMsg.execute(this); - if (!holderMsg._value1) { + if (!holderMsg._isOpen) { CPhonographPlayMsg playMsg; playMsg.execute(this); - } else if (holderMsg._value2) { + } else if (holderMsg._isPresent) { CEjectCylinderMsg ejectMsg; ejectMsg.execute(this); @@ -83,7 +83,7 @@ bool CRestaurantPhonograph::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { } bool CRestaurantPhonograph::PhonographPlayMsg(CPhonographPlayMsg *msg) { - if (_fieldE0) { + if (_isPlaying) { if (findView() == getView() && (!_fieldE8 || !_field114)) { loadFrame(_fieldEC); playSound(_ejectSoundName); @@ -101,10 +101,10 @@ bool CRestaurantPhonograph::PhonographPlayMsg(CPhonographPlayMsg *msg) { } bool CRestaurantPhonograph::PhonographStopMsg(CPhonographStopMsg *msg) { - bool flag = _fieldE0; + bool flag = _isPlaying; CPhonograph::PhonographStopMsg(msg); - if (_fieldE0) { + if (_isPlaying) { loadFrame(_fieldF0); if (flag) playSound(_string3); @@ -126,7 +126,7 @@ bool CRestaurantPhonograph::PhonographReadyToPlayMsg(CPhonographReadyToPlayMsg * } bool CRestaurantPhonograph::EjectCylinderMsg(CEjectCylinderMsg *msg) { - if (_fieldE0) { + if (_isPlaying) { CPhonographStopMsg stopMsg; stopMsg.execute(this); } diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 6832c69f3c..82f6931352 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -304,7 +304,7 @@ MESSAGE2(CParrotSpeakMsg, CString, target, "", CString, action, ""); MESSAGE2(CParrotTriesChickenMsg, int, value1, 0, int, value2, 0); MESSAGE1(CPhonographPlayMsg, int, value, 0); MESSAGE0(CPhonographReadyToPlayMsg); -MESSAGE1(CPhonographRecordMsg, int, value, 0); +MESSAGE1(CPhonographRecordMsg, bool, canRecord, false); MESSAGE3(CPhonographStopMsg, int, value1, 0, int, value2, 0, int, value3, 0); MESSAGE2(CPlayRangeMsg, int, value1, 0, int, value2, 0); MESSAGE2(CPlayerTriesRestaurantTableMsg, int, tableId, 0, bool, result, false); @@ -314,7 +314,7 @@ MESSAGE2(CPumpingMsg, int, value, 0, CGameObject *, object, nullptr); MESSAGE1(CPutBotBackInHisBoxMsg, int, value, 0); MESSAGE1(CPutParrotBackMsg, int, value, 0); MESSAGE0(CPuzzleSolvedMsg); -MESSAGE3(CQueryCylinderHolderMsg, int, value1, 0, int, value2, 0, CTreeItem *, target, (CTreeItem *)nullptr); +MESSAGE3(CQueryCylinderHolderMsg, bool, isOpen, false, bool, isPresent, false, CTreeItem *, target, (CTreeItem *)nullptr); MESSAGE1(CQueryCylinderMsg, CString, name, ""); MESSAGE1(CQueryCylinderNameMsg, CString, name, ""); MESSAGE3(CQueryCylinderTypeMsg, int, value1, 0, int, value2, 0, int, value3, 0); |