diff options
author | Paul Gilbert | 2017-02-18 18:34:27 -0500 |
---|---|---|
committer | Paul Gilbert | 2017-02-18 18:34:27 -0500 |
commit | 80ba4b5592c2e88a7f9f85067cff8c462677fd49 (patch) | |
tree | 26b78a83148381e78d76d0df267ca01b4f5c15f2 /engines/titanic/game/gondolier | |
parent | 0343c0d3378fac49af4e0e0c8c82d4bf3c6404b6 (diff) | |
download | scummvm-rg350-80ba4b5592c2e88a7f9f85067cff8c462677fd49.tar.gz scummvm-rg350-80ba4b5592c2e88a7f9f85067cff8c462677fd49.tar.bz2 scummvm-rg350-80ba4b5592c2e88a7f9f85067cff8c462677fd49.zip |
TITANIC: Renaming and cleanup for CGondolierSlider
Diffstat (limited to 'engines/titanic/game/gondolier')
-rw-r--r-- | engines/titanic/game/gondolier/gondolier_base.cpp | 24 | ||||
-rw-r--r-- | engines/titanic/game/gondolier/gondolier_base.h | 8 | ||||
-rw-r--r-- | engines/titanic/game/gondolier/gondolier_chest.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/game/gondolier/gondolier_mixer.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/game/gondolier/gondolier_slider.cpp | 99 | ||||
-rw-r--r-- | engines/titanic/game/gondolier/gondolier_slider.h | 15 |
6 files changed, 70 insertions, 84 deletions
diff --git a/engines/titanic/game/gondolier/gondolier_base.cpp b/engines/titanic/game/gondolier/gondolier_base.cpp index f3dc31c9f5..4f87cc48f0 100644 --- a/engines/titanic/game/gondolier/gondolier_base.cpp +++ b/engines/titanic/game/gondolier/gondolier_base.cpp @@ -32,12 +32,12 @@ int CGondolierBase::_v1; bool CGondolierBase::_puzzleSolved; int CGondolierBase::_volume1; int CGondolierBase::_v4; -int CGondolierBase::_v5; int CGondolierBase::_volume2; int CGondolierBase::_v7; -int CGondolierBase::_v8; -int CGondolierBase::_v9; -int CGondolierBase::_v10; +bool CGondolierBase::_rightSliderHooked; +bool CGondolierBase::_leftSliderHooked; +bool CGondolierBase::_priorRightSliderHooked; +bool CGondolierBase::_priorLeftSliderHooked; void CGondolierBase::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); @@ -45,12 +45,12 @@ void CGondolierBase::save(SimpleFile *file, int indent) { file->writeNumberLine(_puzzleSolved, indent); file->writeNumberLine(_volume1, indent); file->writeNumberLine(_v4, indent); - file->writeNumberLine(_v5, indent); + file->writeNumberLine(_rightSliderHooked, indent); file->writeNumberLine(_volume2, indent); file->writeNumberLine(_v7, indent); - file->writeNumberLine(_v8, indent); - file->writeNumberLine(_v9, indent); - file->writeNumberLine(_v10, indent); + file->writeNumberLine(_leftSliderHooked, indent); + file->writeNumberLine(_priorRightSliderHooked, indent); + file->writeNumberLine(_priorLeftSliderHooked, indent); CGameObject::save(file, indent); } @@ -61,12 +61,12 @@ void CGondolierBase::load(SimpleFile *file) { _puzzleSolved = file->readNumber(); _volume1 = file->readNumber(); _v4 = file->readNumber(); - _v5 = file->readNumber(); + _rightSliderHooked = file->readNumber(); _volume2 = file->readNumber(); _v7 = file->readNumber(); - _v8 = file->readNumber(); - _v9 = file->readNumber(); - _v10 = file->readNumber(); + _leftSliderHooked = file->readNumber(); + _priorRightSliderHooked = file->readNumber(); + _priorLeftSliderHooked = file->readNumber(); CGameObject::load(file); } diff --git a/engines/titanic/game/gondolier/gondolier_base.h b/engines/titanic/game/gondolier/gondolier_base.h index 06d77ba85f..5d143c92c1 100644 --- a/engines/titanic/game/gondolier/gondolier_base.h +++ b/engines/titanic/game/gondolier/gondolier_base.h @@ -35,12 +35,12 @@ protected: static bool _puzzleSolved; static int _volume1; static int _v4; - static int _v5; static int _volume2; static int _v7; - static int _v8; - static int _v9; - static int _v10; + static bool _rightSliderHooked; + static bool _leftSliderHooked; + static bool _priorRightSliderHooked; + static bool _priorLeftSliderHooked; public: CLASSDEF; diff --git a/engines/titanic/game/gondolier/gondolier_chest.cpp b/engines/titanic/game/gondolier/gondolier_chest.cpp index cf6656732b..20b2f90a5e 100644 --- a/engines/titanic/game/gondolier/gondolier_chest.cpp +++ b/engines/titanic/game/gondolier/gondolier_chest.cpp @@ -45,7 +45,7 @@ bool CGondolierChest::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { playMovie(0, 14, MOVIE_NOTIFY_OBJECT); else if (msg->_mousePos.y < 330) return false; - else if (!_v8 && !_v5) { + else if (!_leftSliderHooked && !_rightSliderHooked) { playMovie(14, 29, 0); _v1 = 0; } diff --git a/engines/titanic/game/gondolier/gondolier_mixer.cpp b/engines/titanic/game/gondolier/gondolier_mixer.cpp index fc71ddd357..205d1f42da 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.cpp +++ b/engines/titanic/game/gondolier/gondolier_mixer.cpp @@ -141,7 +141,7 @@ bool CGondolierMixer::SignalObject(CSignalObject *msg) { if (msg->_strValue == "Fly") { _v4 = CLIP(msg->_numValue, 0, 10); - if (!_v8) { + if (!_leftSliderHooked) { _v7 = 10 - _v4; CStatusChangeMsg statusMsg; statusMsg._newStatus = _v7; @@ -152,7 +152,7 @@ bool CGondolierMixer::SignalObject(CSignalObject *msg) { if (msg->_strValue == "Tos") { _v7 = CLIP(msg->_numValue, 0, 10); - if (!_v5) { + if (!_rightSliderHooked) { _v4 = 10 - _v7; CStatusChangeMsg statusMsg; statusMsg._newStatus = _v4; @@ -160,7 +160,7 @@ bool CGondolierMixer::SignalObject(CSignalObject *msg) { } } - if (!_v4 && !_v7 && _v5 && _v8) { + if (!_v4 && !_v7 && _rightSliderHooked && _leftSliderHooked) { _puzzleSolved = true; CStatusChangeMsg statusMsg; statusMsg._newStatus = 1; diff --git a/engines/titanic/game/gondolier/gondolier_slider.cpp b/engines/titanic/game/gondolier/gondolier_slider.cpp index e7ca61de9c..dd9bef4511 100644 --- a/engines/titanic/game/gondolier/gondolier_slider.cpp +++ b/engines/titanic/game/gondolier/gondolier_slider.cpp @@ -40,16 +40,14 @@ BEGIN_MESSAGE_MAP(CGondolierSlider, CGondolierBase) END_MESSAGE_MAP() CGondolierSlider::CGondolierSlider() : CGondolierBase(), - _fieldBC(0), _fieldC0(0), _fieldC4(0), _fieldC8(0), - _arrayIndex(0), _string1("NULL"), _fieldFC(0), _field118(0) { + _arrayIndex(0), _stringUnused("NULL"), _sliderNum(0), _dragging(false) { } void CGondolierSlider::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); - file->writeNumberLine(_fieldC4, indent); - file->writeNumberLine(_fieldC8, indent); + file->writeRect(_rectUnused, indent); + file->writeRect(_sliderRect1, indent); + file->writeRect(_sliderRect2, indent); file->writeNumberLine(_sliderRect1.left, indent); file->writeNumberLine(_sliderRect1.top, indent); file->writeNumberLine(_sliderRect1.right, indent); @@ -58,36 +56,27 @@ void CGondolierSlider::save(SimpleFile *file, int indent) { file->writeNumberLine(_sliderRect2.top, indent); file->writeNumberLine(_sliderRect2.right, indent); file->writeNumberLine(_sliderRect2.bottom, indent); - file->writeNumberLine(_sliderRect1.left, indent); - file->writeQuotedLine(_string1, indent); - file->writeNumberLine(_fieldFC, indent); - file->writeQuotedLine(_string2, indent); - file->writeQuotedLine(_string3, indent); - file->writeNumberLine(_field118, indent); + file->writeNumberLine(_arrayIndex, indent); + file->writeQuotedLine(_stringUnused, indent); + file->writeNumberLine(_sliderNum, indent); + file->writeQuotedLine(_armName, indent); + file->writeQuotedLine(_signalTarget, indent); + file->writeNumberLine(_dragging, indent); CGondolierBase::save(file, indent); } void CGondolierSlider::load(SimpleFile *file) { file->readNumber(); - _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); - _fieldC4 = file->readNumber(); - _fieldC8 = file->readNumber(); - _sliderRect1.left = file->readNumber(); - _sliderRect1.top = file->readNumber(); - _sliderRect1.right = file->readNumber(); - _sliderRect1.bottom = file->readNumber(); - _sliderRect2.left = file->readNumber(); - _sliderRect2.top = file->readNumber(); - _sliderRect2.right = file->readNumber(); - _sliderRect2.bottom = file->readNumber(); + _rectUnused = file->readRect(); + _sliderRect1 = file->readRect(); + _sliderRect2 = file->readRect(); _arrayIndex = file->readNumber(); - _string1 = file->readString(); - _fieldFC = file->readNumber(); - _string2 = file->readString(); - _string3 = file->readString(); - _field118 = file->readNumber(); + _stringUnused = file->readString(); + _sliderNum = file->readNumber(); + _armName = file->readString(); + _signalTarget = file->readString(); + _dragging = file->readNumber(); CGondolierBase::load(file); } @@ -95,14 +84,14 @@ void CGondolierSlider::load(SimpleFile *file) { bool CGondolierSlider::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (!_v1) return false; - if (_fieldFC ? _v5 : _v8) + if (_sliderNum ? _rightSliderHooked : _leftSliderHooked) return false; return _sliderRect1.contains(msg->_mousePos); } bool CGondolierSlider::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { - if (!(_fieldFC ? _v5 : _v8)) { + if (!(_sliderNum ? _rightSliderHooked : _leftSliderHooked)) { int minVal = 0x7FFFFFFF; int foundIndex = -1; int yp = (_sliderRect2.top + _sliderRect2.bottom) / 2 @@ -137,11 +126,11 @@ bool CGondolierSlider::EnterViewMsg(CEnterViewMsg *msg) { bool CGondolierSlider::MouseDragStartMsg(CMouseDragStartMsg *msg) { if (!_v1) return false; - if (_fieldFC ? _v5 : _v8) + if (_sliderNum ? _rightSliderHooked : _leftSliderHooked) return false; - _field118 = checkStartDragging(msg); - return _field118; + _dragging = checkStartDragging(msg); + return _dragging; } bool CGondolierSlider::StatusChangeMsg(CStatusChangeMsg *msg) { @@ -155,33 +144,33 @@ bool CGondolierSlider::StatusChangeMsg(CStatusChangeMsg *msg) { } bool CGondolierSlider::MouseDragEndMsg(CMouseDragEndMsg *msg) { - _field118 = false; + _dragging = false; return true; } bool CGondolierSlider::IsHookedOnMsg(CIsHookedOnMsg *msg) { - if (_fieldFC ? _v5 : _v8) + if (_sliderNum ? _rightSliderHooked : _leftSliderHooked) return false; if (!_sliderRect1.intersects(msg->_rect)) { - _string2 = CString(); - msg->_result = false; + _armName = CString(); + msg->_isHooked = false; } else { - _string2 = _string1; - if (_fieldFC) { - _v5 = _v9 = 1; + _armName = msg->_armName; + if (_sliderNum) { + _rightSliderHooked = _priorRightSliderHooked = true; } else { - _v8 = _v10 = 1; + _leftSliderHooked = _priorLeftSliderHooked = true; } - msg->_result = true; + msg->_isHooked = true; } return true; } bool CGondolierSlider::FrameMsg(CFrameMsg *msg) { - if (_fieldFC ? _v5 : _v8) { + if (_sliderNum ? _rightSliderHooked : _leftSliderHooked) { if (_arrayIndex < 10) { ++_arrayIndex; CSignalObject signalMsg; @@ -191,14 +180,14 @@ bool CGondolierSlider::FrameMsg(CFrameMsg *msg) { if (_arrayIndex > 0) yp = ARRAY[_arrayIndex] - ARRAY[_arrayIndex - 1]; - if (!_string2.empty()) { + if (!_armName.empty()) { CTranslateObjectMsg transMsg; transMsg._delta = Point(0, yp); - transMsg.execute(_string2); + transMsg.execute(_armName); } } - } else if (_fieldFC ? _v10 : _v9) { - if (!_field118 && !_puzzleSolved && _arrayIndex > 0) { + } else if (_sliderNum ? _priorLeftSliderHooked : _priorRightSliderHooked) { + if (!_dragging && !_puzzleSolved && _arrayIndex > 0) { CSignalObject signalMsg; signalMsg.execute(this); } @@ -216,20 +205,20 @@ bool CGondolierSlider::SignalObject(CSignalObject *msg) { CSignalObject signalMsg; signalMsg._numValue = 10 - _arrayIndex; - signalMsg._strValue = _fieldFC ? "Fly" : "Tos"; - signalMsg.execute(_string3); + signalMsg._strValue = _sliderNum ? "Fly" : "Tos"; + signalMsg.execute(_signalTarget); return true; } bool CGondolierSlider::ActMsg(CActMsg *msg) { if (msg->_action == "Unhook") { - if (_fieldFC) { - _v5 = _v9 = 0; - _v10 = _v8; + if (_sliderNum) { + _rightSliderHooked = _priorRightSliderHooked = false; + _priorLeftSliderHooked = _leftSliderHooked; } else { - _v8 = _v10 = 0; - _v9 = _v5; + _leftSliderHooked = _priorLeftSliderHooked = false; + _priorRightSliderHooked = _rightSliderHooked; } } diff --git a/engines/titanic/game/gondolier/gondolier_slider.h b/engines/titanic/game/gondolier/gondolier_slider.h index d1562f5b2d..1638d486a3 100644 --- a/engines/titanic/game/gondolier/gondolier_slider.h +++ b/engines/titanic/game/gondolier/gondolier_slider.h @@ -40,18 +40,15 @@ class CGondolierSlider : public CGondolierBase { bool SignalObject(CSignalObject *msg); bool ActMsg(CActMsg *msg); private: - int _fieldBC; - int _fieldC0; - int _fieldC4; - int _fieldC8; + Rect _rectUnused; Rect _sliderRect1; Rect _sliderRect2; int _arrayIndex; - CString _string1; - int _fieldFC; - CString _string2; - CString _string3; - bool _field118; + CString _stringUnused; + int _sliderNum; + CString _armName; + CString _signalTarget; + bool _dragging; public: CLASSDEF; CGondolierSlider(); |