diff options
Diffstat (limited to 'engines/titanic/game/sauce_dispensor.cpp')
-rw-r--r-- | engines/titanic/game/sauce_dispensor.cpp | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/engines/titanic/game/sauce_dispensor.cpp b/engines/titanic/game/sauce_dispensor.cpp index 8dc818d917..fda7082ba6 100644 --- a/engines/titanic/game/sauce_dispensor.cpp +++ b/engines/titanic/game/sauce_dispensor.cpp @@ -21,9 +21,20 @@ */ #include "titanic/game/sauce_dispensor.h" +#include "titanic/carry/chicken.h" +#include "titanic/carry/glass.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CSauceDispensor, CBackground) + ON_MESSAGE(Use) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(StatusChangeMsg) +END_MESSAGE_MAP() + CSauceDispensor::CSauceDispensor() : CBackground(), _fieldEC(0), _fieldF0(0), _field104(0), _field108(0) { } @@ -54,4 +65,105 @@ void CSauceDispensor::load(SimpleFile *file) { CBackground::load(file); } +bool CSauceDispensor::Use(CUse *msg) { + CVisibleMsg visibleMsg(true); + + if (msg->_item->isEquals("Chicken")) { + CChicken *chicken = static_cast<CChicken *>(msg->_item); + _field104 = true; + if (_fieldF0) { + playSound("b#15.wav", 50); + + if (chicken->_string6 != "None") { + petDisplayMessage(1, "This foodstuff is already sufficiently garnished."); + msg->execute("Chicken"); + } else { + setVisible(true); + if (chicken->_field12C) { + playMovie(_pos1.x, _pos1.y, MOVIE_NOTIFY_OBJECT); + } else { + CActMsg actMsg(_string3); + actMsg.execute("Chicken"); + playMovie(_pos2.x, _pos2.y, MOVIE_NOTIFY_OBJECT); + } + } + + if (_fieldF0) + return true; + } + + CMovieEndMsg endMsg(0, 0); + endMsg.execute(this); + playSound("z#120.wav"); + + petDisplayMessage(1, "Sadly, this dispenser is currently empty."); + } else if (msg->_item->isEquals("BeerGlass")) { + CGlass *glass = dynamic_cast<CGlass *>(msg->_item); + _field108 = true; + + if (_field104 || _fieldF0) { + petAddToInventory(); + } else if (glass->_string6 != "None") { + visibleMsg.execute("BeerGlass"); + } else if (_fieldEC) { + glass->setPosition(Point( + _bounds.left + (_bounds.width() / 2) - (glass->_bounds.width() / 2), + 300)); + setVisible(true); + + CActMsg actMsg(_string3); + actMsg.execute("BeerGlass"); + } + } + + return true; +} + +bool CSauceDispensor::MovieEndMsg(CMovieEndMsg *msg) { + setVisible(false); + _fieldEC = false; + + CActMsg actMsg("GoToPET"); + if (_field104) + actMsg.execute("Chicken"); + if (_field108) + actMsg.execute("BeerGlass"); + + _field104 = false; + _field108 = false; + return true; +} + +bool CSauceDispensor::ActMsg(CActMsg *msg) { + if (msg->_action == "StarlingsDead") + _fieldF0 = true; + + return true; +} + +bool CSauceDispensor::LeaveViewMsg(CLeaveViewMsg *msg) { + setVisible(false); + loadFrame(0); + + if (_field108) { + CGameObject *glass = findRoomObject("Beerglass"); + if (glass) + glass->petAddToInventory(); + } + + _field104 = false; + _field108 = false; + return true; +} + +bool CSauceDispensor::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + petDisplayMessage(1, "Please place food source beneath dispenser for sauce delivery."); + return true; +} + +bool CSauceDispensor::StatusChangeMsg(CStatusChangeMsg *msg) { + petDisplayMessage(1, "Please place food source beneath dispenser for sauce delivery."); + return true; +} + } // End of namespace Titanic |