diff options
author | Paul Gilbert | 2016-08-27 20:44:44 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-27 20:44:44 -0400 |
commit | 67be58f56204d6662a56f902b0a0f017c176b643 (patch) | |
tree | 9a95bf73bdc01556734064ca8afd1c30cbcd51dd | |
parent | 311006c84cd85897cb9c536e948bc6f5d36b3805 (diff) | |
download | scummvm-rg350-67be58f56204d6662a56f902b0a0f017c176b643.tar.gz scummvm-rg350-67be58f56204d6662a56f902b0a0f017c176b643.tar.bz2 scummvm-rg350-67be58f56204d6662a56f902b0a0f017c176b643.zip |
TITANIC: Implemented more game classes, fleshed out season handling
26 files changed, 520 insertions, 179 deletions
diff --git a/engines/titanic/carry/glass.h b/engines/titanic/carry/glass.h index 85443840a1..608d45cb66 100644 --- a/engines/titanic/carry/glass.h +++ b/engines/titanic/carry/glass.h @@ -35,7 +35,7 @@ class CGlass : public CCarry { bool MouseDragEndMsg(CMouseDragEndMsg *msg); bool TurnOn(CTurnOn *msg); bool TurnOff(CTurnOff *msg); -private: +public: CString _string6; public: CLASSDEF; diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 0289e78823..f450e028d2 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -1025,12 +1025,12 @@ void CGameObject::moveToView(const CString &name) { addUnder(view); } -void CGameObject::stateInc14() { - getGameManager()->_gameState.inc14(); +void CGameObject::stateChangeSeason() { + getGameManager()->_gameState.changeSeason(); } -int CGameObject::stateGet14() const { - return getGameManager()->_gameState._field14; +Season CGameObject::stateGetSeason() const { + return getGameManager()->_gameState._seasonNum; } void CGameObject::stateSet24() { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 53e26b5f6b..39cdb609c2 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -33,6 +33,7 @@ #include "titanic/core/named_item.h" #include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_text.h" +#include "titanic/game_state.h" namespace Titanic { @@ -941,8 +942,17 @@ public: /*--- CGameState Methods ---*/ void setState1C(bool flag); - void stateInc14(); - int stateGet14() const; + + /** + * Change to the next season + */ + void stateChangeSeason(); + + /** + * Returns the currently active season + */ + Season stateGetSeason() const; + void stateSet24(); int stateGet24() const; void stateInc38(); diff --git a/engines/titanic/game/arboretum_gate.cpp b/engines/titanic/game/arboretum_gate.cpp index 4c3ca03b7a..1435e3e204 100644 --- a/engines/titanic/game/arboretum_gate.cpp +++ b/engines/titanic/game/arboretum_gate.cpp @@ -21,7 +21,6 @@ */ #include "titanic/game/arboretum_gate.h" -#include "titanic/game/seasonal_adjustment.h" namespace Titanic { @@ -45,30 +44,30 @@ CArboretumGate::CArboretumGate() : CBackground() { _viewName2 = "NULL"; _seasonNum = 0; _fieldF0 = 0; - _winterOffStartFrame = 244; - _winterOffEndFrame = 304; - _springOffStartFrame = 122; - _springOffEndFrame = 182; - _summerOffStartFrame1 = 183; - _summerOffEndFrame1 = 243; - _summerOffStartFrame2 = 665; - _summerOffEndFrame2 = 724; - _autumnOffStartFrame1 = 61; - _autumnOffEndFrame1 = 121; - _autumnOffStartFrame2 = 0; - _autumnOffEndFrame2 = 60; - _winterOnStartFrame = 485; - _winterOnEndFrame = 544; - _springOnStartFrame = 425; - _springOnEndFrame = 484; - _summerOnStartFrame1 = 545; - _summerOnEndFrame1 = 604; - _summerOnStartFrame2 = 605; - _summerOnEndFrame2 = 664; - _autumnOnStartFrame1 = 305; - _autumnOnEndFrame1 = 364; - _autumnOnStartFrame2 = 365; - _autumnOnEndFrame2 = 424; + _startFrameSpringOff = 244; + _endFrameSpringOff = 304; + _startFrameSummerOff = 122; + _endFrameSummerOff = 182; + _startFrameAutumnOff1 = 183; + _endFrameAutumnOff1 = 243; + _startFrameAutumnOff2 = 665; + _endFrameAutumnOff2 = 724; + _startFrameWinterOff1 = 61; + _endFrameWinterOff1 = 121; + _startFrameWinterOff2 = 0; + _endFrameWinterOff2 = 60; + _startFrameSpringOn = 485; + _endFrameSpringOn = 544; + _startFrameSummerOn = 425; + _endFrameSummerOn = 484; + _startFrameAutumnOn1 = 545; + _endFrameAutumnOn1 = 604; + _startFrameAutumnOn2 = 605; + _endFrameAutumnOn2 = 664; + _startFrameWinterOn1 = 305; + _endFrameWinterOn1 = 364; + _startFrameWinterOn2 = 365; + _endFrameWinterOn2 = 424; } void CArboretumGate::save(SimpleFile *file, int indent) { @@ -79,30 +78,30 @@ void CArboretumGate::save(SimpleFile *file, int indent) { file->writeNumberLine(_v3, indent); file->writeQuotedLine(_viewName1, indent); file->writeNumberLine(_fieldF0, indent); - file->writeNumberLine(_winterOffStartFrame, indent); - file->writeNumberLine(_winterOffEndFrame, indent); - file->writeNumberLine(_springOffStartFrame, indent); - file->writeNumberLine(_springOffEndFrame, indent); - file->writeNumberLine(_summerOffStartFrame1, indent); - file->writeNumberLine(_summerOffEndFrame1, indent); - file->writeNumberLine(_summerOffStartFrame2, indent); - file->writeNumberLine(_summerOffEndFrame2, indent); - file->writeNumberLine(_autumnOffStartFrame1, indent); - file->writeNumberLine(_autumnOffEndFrame1, indent); - file->writeNumberLine(_autumnOffStartFrame2, indent); - file->writeNumberLine(_autumnOffEndFrame2, indent); - file->writeNumberLine(_winterOnStartFrame, indent); - file->writeNumberLine(_winterOnEndFrame, indent); - file->writeNumberLine(_springOnStartFrame, indent); - file->writeNumberLine(_springOnEndFrame, indent); - file->writeNumberLine(_summerOnStartFrame1, indent); - file->writeNumberLine(_summerOnEndFrame1, indent); - file->writeNumberLine(_summerOnStartFrame2, indent); - file->writeNumberLine(_summerOnEndFrame2, indent); - file->writeNumberLine(_autumnOnStartFrame1, indent); - file->writeNumberLine(_autumnOnEndFrame1, indent); - file->writeNumberLine(_autumnOnStartFrame2, indent); - file->writeNumberLine(_autumnOnEndFrame2, indent); + file->writeNumberLine(_startFrameSpringOff, indent); + file->writeNumberLine(_endFrameSpringOff, indent); + file->writeNumberLine(_startFrameSummerOff, indent); + file->writeNumberLine(_endFrameSummerOff, indent); + file->writeNumberLine(_startFrameAutumnOff1, indent); + file->writeNumberLine(_endFrameAutumnOff1, indent); + file->writeNumberLine(_startFrameAutumnOff2, indent); + file->writeNumberLine(_endFrameAutumnOff2, indent); + file->writeNumberLine(_startFrameWinterOff1, indent); + file->writeNumberLine(_endFrameWinterOff1, indent); + file->writeNumberLine(_startFrameWinterOff2, indent); + file->writeNumberLine(_endFrameWinterOff2, indent); + file->writeNumberLine(_startFrameSpringOn, indent); + file->writeNumberLine(_endFrameSpringOn, indent); + file->writeNumberLine(_startFrameSummerOn, indent); + file->writeNumberLine(_endFrameSummerOn, indent); + file->writeNumberLine(_startFrameAutumnOn1, indent); + file->writeNumberLine(_endFrameAutumnOn1, indent); + file->writeNumberLine(_startFrameAutumnOn2, indent); + file->writeNumberLine(_endFrameAutumnOn2, indent); + file->writeNumberLine(_startFrameWinterOn1, indent); + file->writeNumberLine(_endFrameWinterOn1, indent); + file->writeNumberLine(_startFrameWinterOn2, indent); + file->writeNumberLine(_endFrameWinterOn2, indent); file->writeQuotedLine(_viewName2, indent); CBackground::save(file, indent); @@ -116,30 +115,30 @@ void CArboretumGate::load(SimpleFile *file) { _v3 = file->readNumber(); _viewName1 = file->readString(); _fieldF0 = file->readNumber(); - _winterOffStartFrame = file->readNumber(); - _winterOffEndFrame = file->readNumber(); - _springOffStartFrame = file->readNumber(); - _springOffEndFrame = file->readNumber(); - _summerOffStartFrame1 = file->readNumber(); - _summerOffEndFrame1 = file->readNumber(); - _summerOffStartFrame2 = file->readNumber(); - _summerOffEndFrame2 = file->readNumber(); - _autumnOffStartFrame1 = file->readNumber(); - _autumnOffEndFrame1 = file->readNumber(); - _autumnOffStartFrame2 = file->readNumber(); - _autumnOffEndFrame2 = file->readNumber(); - _winterOnStartFrame = file->readNumber(); - _winterOnEndFrame = file->readNumber(); - _springOnStartFrame = file->readNumber(); - _springOnEndFrame = file->readNumber(); - _summerOnStartFrame1 = file->readNumber(); - _summerOnEndFrame1 = file->readNumber(); - _summerOnStartFrame2 = file->readNumber(); - _summerOnEndFrame2 = file->readNumber(); - _autumnOnStartFrame1 = file->readNumber(); - _autumnOnEndFrame1 = file->readNumber(); - _autumnOnStartFrame2 = file->readNumber(); - _autumnOnEndFrame2 = file->readNumber(); + _startFrameSpringOff = file->readNumber(); + _endFrameSpringOff = file->readNumber(); + _startFrameSummerOff = file->readNumber(); + _endFrameSummerOff = file->readNumber(); + _startFrameAutumnOff1 = file->readNumber(); + _endFrameAutumnOff1 = file->readNumber(); + _startFrameAutumnOff2 = file->readNumber(); + _endFrameAutumnOff2 = file->readNumber(); + _startFrameWinterOff1 = file->readNumber(); + _endFrameWinterOff1 = file->readNumber(); + _startFrameWinterOff2 = file->readNumber(); + _endFrameWinterOff2 = file->readNumber(); + _startFrameSpringOn = file->readNumber(); + _endFrameSpringOn = file->readNumber(); + _startFrameSummerOn = file->readNumber(); + _endFrameSummerOn = file->readNumber(); + _startFrameAutumnOn1 = file->readNumber(); + _endFrameAutumnOn1 = file->readNumber(); + _startFrameAutumnOn2 = file->readNumber(); + _endFrameAutumnOn2 = file->readNumber(); + _startFrameWinterOn1 = file->readNumber(); + _endFrameWinterOn1 = file->readNumber(); + _startFrameWinterOn2 = file->readNumber(); + _endFrameWinterOn2 = file->readNumber(); _viewName2 = file->readString(); CBackground::load(file); @@ -213,28 +212,28 @@ bool CArboretumGate::LeaveViewMsg(CLeaveViewMsg *msg) { bool CArboretumGate::TurnOff(CTurnOff *msg) { if (!_v3) { switch (_seasonNum) { - case SPRING: - playMovie(_springOffStartFrame, _springOffEndFrame, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + case SEASON_SUMMER: + playMovie(_startFrameSummerOff, _endFrameSummerOff, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); break; - case SUMMER: + case SEASON_AUTUMN: if (_v1) { - playMovie(_summerOffStartFrame2, _summerOffEndFrame2, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameAutumnOff2, _endFrameAutumnOff2, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); } else { - playMovie(_summerOffStartFrame1, _summerOffEndFrame1, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameAutumnOff1, _endFrameAutumnOff1, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); } break; - case AUTUMN: + case SEASON_WINTER: if (_v1) { - playMovie(_autumnOffStartFrame2, _autumnOffEndFrame2, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameWinterOff2, _endFrameWinterOff2, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); } else { - playMovie(_autumnOffStartFrame1, _autumnOffEndFrame1, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameWinterOff1, _endFrameWinterOff1, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); } break; - case WINTER: - playMovie(_winterOffStartFrame, _winterOffEndFrame, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + case SEASON_SPRING: + playMovie(_startFrameSpringOff, _endFrameSpringOff, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); break; default: @@ -256,28 +255,28 @@ bool CArboretumGate::TurnOn(CTurnOn *msg) { setVisible(true); switch (_seasonNum) { - case SPRING: - playMovie(_springOnStartFrame, _springOnEndFrame, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + case SEASON_SUMMER: + playMovie(_startFrameSummerOn, _endFrameSummerOn, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); break; - case SUMMER: + case SEASON_AUTUMN: if (_v1) { - playMovie(_summerOnStartFrame2, _summerOnEndFrame2, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameAutumnOn2, _endFrameAutumnOn2, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); } else { - playMovie(_summerOnStartFrame1, _summerOnEndFrame1, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameAutumnOn1, _endFrameAutumnOn1, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); } break; - case AUTUMN: + case SEASON_WINTER: if (_v1) { - playMovie(_autumnOnStartFrame2, _autumnOnEndFrame2, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameWinterOn2, _endFrameWinterOn2, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); } else { - playMovie(_autumnOnStartFrame1, _autumnOnEndFrame1, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + playMovie(_startFrameWinterOn1, _endFrameWinterOn1, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); } break; - case WINTER: - playMovie(_winterOnStartFrame, _winterOnEndFrame, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + case SEASON_SPRING: + playMovie(_startFrameSpringOn, _endFrameSpringOn, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); break; default: @@ -302,20 +301,20 @@ bool CArboretumGate::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { bool CArboretumGate::EnterViewMsg(CEnterViewMsg *msg) { if (!_v3) { switch (_seasonNum) { - case SPRING: - _initialFrame = _springOffStartFrame; + case SEASON_SUMMER: + _initialFrame = _startFrameSummerOff; break; - case SUMMER: - _initialFrame = _v1 ? _summerOffStartFrame2 : _summerOffStartFrame1; + case SEASON_AUTUMN: + _initialFrame = _v1 ? _startFrameAutumnOff2 : _startFrameAutumnOff1; break; - case AUTUMN: - _initialFrame = _v1 ? _autumnOffStartFrame1 : _autumnOffStartFrame2; + case SEASON_WINTER: + _initialFrame = _v1 ? _startFrameWinterOff1 : _startFrameWinterOff2; break; - case WINTER: - _initialFrame = _winterOffStartFrame; + case SEASON_SPRING: + _initialFrame = _startFrameSpringOff; break; default: diff --git a/engines/titanic/game/arboretum_gate.h b/engines/titanic/game/arboretum_gate.h index 62c9200a64..b1c06cf773 100644 --- a/engines/titanic/game/arboretum_gate.h +++ b/engines/titanic/game/arboretum_gate.h @@ -47,30 +47,30 @@ private: int _seasonNum; CString _viewName1; int _fieldF0; - int _winterOffStartFrame; - int _winterOffEndFrame; - int _springOffStartFrame; - int _springOffEndFrame; - int _summerOffStartFrame2; - int _summerOffEndFrame2; - int _summerOffStartFrame1; - int _summerOffEndFrame1; - int _autumnOffStartFrame2; - int _autumnOffEndFrame2; - int _autumnOffStartFrame1; - int _autumnOffEndFrame1; - int _winterOnStartFrame; - int _winterOnEndFrame; - int _springOnStartFrame; - int _springOnEndFrame; - int _summerOnStartFrame1; - int _summerOnEndFrame1; - int _summerOnStartFrame2; - int _summerOnEndFrame2; - int _autumnOnStartFrame1; - int _autumnOnEndFrame1; - int _autumnOnStartFrame2; - int _autumnOnEndFrame2; + int _startFrameSpringOff; + int _endFrameSpringOff; + int _startFrameSummerOff; + int _endFrameSummerOff; + int _startFrameAutumnOff2; + int _endFrameAutumnOff2; + int _startFrameAutumnOff1; + int _endFrameAutumnOff1; + int _startFrameWinterOff2; + int _endFrameWinterOff2; + int _startFrameWinterOff1; + int _endFrameWinterOff1; + int _startFrameSpringOn; + int _endFrameSpringOn; + int _startFrameSummerOn; + int _endFrameSummerOn; + int _startFrameAutumnOn1; + int _endFrameAutumnOn1; + int _startFrameAutumnOn2; + int _endFrameAutumnOn2; + int _startFrameWinterOn1; + int _endFrameWinterOn1; + int _startFrameWinterOn2; + int _endFrameWinterOn2; CString _viewName2; public: CLASSDEF; diff --git a/engines/titanic/game/head_smash_lever.cpp b/engines/titanic/game/head_smash_lever.cpp index d5c2eaf8c4..dabed26478 100644 --- a/engines/titanic/game/head_smash_lever.cpp +++ b/engines/titanic/game/head_smash_lever.cpp @@ -32,13 +32,13 @@ BEGIN_MESSAGE_MAP(CHeadSmashLever, CBackground) END_MESSAGE_MAP() CHeadSmashLever::CHeadSmashLever() : CBackground(), - _enabled(false), _fieldE4(false), _ticksCount(0) {} + _enabled(false), _fieldE4(false), _ticks(0) {} void CHeadSmashLever::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_enabled, indent); file->writeNumberLine(_fieldE4, indent); - file->writeNumberLine(_ticksCount, indent); + file->writeNumberLine(_ticks, indent); CBackground::save(file, indent); } @@ -47,7 +47,7 @@ void CHeadSmashLever::load(SimpleFile *file) { file->readNumber(); _enabled = file->readNumber(); _fieldE4 = file->readNumber(); - _ticksCount = file->readNumber(); + _ticks = file->readNumber(); CBackground::load(file); } @@ -58,7 +58,7 @@ bool CHeadSmashLever::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { playSound("z#54.wav"); int soundHandle = playSound("z#45.wav"); queueSound("z#49.wav", soundHandle); - _ticksCount = getTicksCount(); + _ticks = getTicksCount(); _fieldE4 = true; } else { playMovie(0); @@ -78,7 +78,7 @@ bool CHeadSmashLever::ActMsg(CActMsg *msg) { } bool CHeadSmashLever::FrameMsg(CFrameMsg *msg) { - if (_fieldE4 && msg->_ticks > (_ticksCount + 750)) { + if (_fieldE4 && msg->_ticks > (_ticks + 750)) { CActMsg actMsg1("CreatorsChamber.Node 1.S"); actMsg1.execute("MoveToCreators"); CActMsg actMsg2("PlayToEnd"); @@ -93,7 +93,7 @@ bool CHeadSmashLever::FrameMsg(CFrameMsg *msg) { bool CHeadSmashLever::LoadSuccessMsg(CLoadSuccessMsg *msg) { if (_fieldE4) - _ticksCount = getTicksCount(); + _ticks = getTicksCount(); return true; } diff --git a/engines/titanic/game/head_smash_lever.h b/engines/titanic/game/head_smash_lever.h index e2426b68da..19de07922a 100644 --- a/engines/titanic/game/head_smash_lever.h +++ b/engines/titanic/game/head_smash_lever.h @@ -36,7 +36,7 @@ class CHeadSmashLever : public CBackground { public: bool _enabled; bool _fieldE4; - int _ticksCount; + uint _ticks; public: CLASSDEF; CHeadSmashLever(); diff --git a/engines/titanic/game/sauce_dispensor.cpp b/engines/titanic/game/sauce_dispensor.cpp index 8dc818d917..29f0be7ee4 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 = static_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 diff --git a/engines/titanic/game/sauce_dispensor.h b/engines/titanic/game/sauce_dispensor.h index aa177050d5..f8021f368b 100644 --- a/engines/titanic/game/sauce_dispensor.h +++ b/engines/titanic/game/sauce_dispensor.h @@ -28,6 +28,13 @@ namespace Titanic { class CSauceDispensor : public CBackground { + DECLARE_MESSAGE_MAP; + bool Use(CUse *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool ActMsg(CActMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); public: CString _string3; int _fieldEC; diff --git a/engines/titanic/game/search_point.cpp b/engines/titanic/game/search_point.cpp index f60a3132b7..bbe923267a 100644 --- a/engines/titanic/game/search_point.cpp +++ b/engines/titanic/game/search_point.cpp @@ -24,6 +24,10 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CSearchPoint, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + void CSearchPoint::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); @@ -36,4 +40,21 @@ void CSearchPoint::load(SimpleFile *file) { CGameObject::load(file); } +bool CSearchPoint::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_value > 0) { + CGameObject *child = dynamic_cast<CGameObject *>(getFirstChild()); + if (child) { + child->petAddToInventory(); + CVisibleMsg visibleMsg(true); + visibleMsg.execute(child->getName()); + playSound("z#47.wav"); + } + + if (--_value == 0) + _cursorId = CURSOR_ARROW; + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/search_point.h b/engines/titanic/game/search_point.h index 3c5639b104..421f272804 100644 --- a/engines/titanic/game/search_point.h +++ b/engines/titanic/game/search_point.h @@ -28,6 +28,8 @@ namespace Titanic { class CSearchPoint : public CGameObject { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); public: int _value; public: diff --git a/engines/titanic/game/seasonal_adjustment.cpp b/engines/titanic/game/seasonal_adjustment.cpp index 33a0ae89c5..1f1cb88afb 100644 --- a/engines/titanic/game/seasonal_adjustment.cpp +++ b/engines/titanic/game/seasonal_adjustment.cpp @@ -21,9 +21,20 @@ */ #include "titanic/game/seasonal_adjustment.h" +#include "titanic/core/project_item.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CSeasonalAdjustment, CBackground) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseButtonUpMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + void CSeasonalAdjustment::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); @@ -40,4 +51,86 @@ void CSeasonalAdjustment::load(SimpleFile *file) { CBackground::load(file); } +bool CSeasonalAdjustment::StatusChangeMsg(CStatusChangeMsg *msg) { + CChangeSeasonMsg changeMsg; + switch (stateGetSeason()) { + case SEASON_SUMMER: + changeMsg._season = "Summer"; + break; + case SEASON_AUTUMN: + changeMsg._season = "Autumn"; + break; + case SEASON_WINTER: + changeMsg._season = "Winter"; + break; + case SEASON_SPRING: + changeMsg._season = "Spring"; + break; + default: + break; + } + + changeMsg.execute(getRoot(), nullptr, MSGFLAG_SCAN); + return true; +} + +bool CSeasonalAdjustment::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + +bool CSeasonalAdjustment::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + playSound("z#42.wav"); + if (!_fieldE4) { + petDisplayMessage(1, "The Seasonal Adjustment switch is not operational at the present time."); + } else if (!_fieldE0) { + playMovie(0, 6, MOVIE_NOTIFY_OBJECT); + playMovie(6, 18, 0); + } + + return true; +} + +bool CSeasonalAdjustment::MovieEndMsg(CMovieEndMsg *msg) { + if (msg->_endFrame == 6) { + stateChangeSeason(); + CStatusChangeMsg changeMsg; + changeMsg.execute(this); + CTurnOff offMsg; + offMsg.execute(this); + offMsg.execute("LeftPanExit"); + offMsg.execute("RightPanExit"); + } + + return true; +} + +bool CSeasonalAdjustment::TurnOn(CTurnOn *msg) { + if (_fieldE0) { + _fieldE0 = false; + CTurnOn onMsg; + onMsg.execute("LeftPanExit"); + onMsg.execute("RightPanExit"); + } + + return true; +} + +bool CSeasonalAdjustment::TurnOff(CTurnOff *msg) { + _fieldE0 = true; + return true; +} + +bool CSeasonalAdjustment::ActMsg(CActMsg *msg) { + if (msg->_action == "PlayerGetsSpeechCentre") { + msg->execute("SeasonBackground"); + msg->execute("ArbGate"); + } else if (msg->_action == "EnableObject") { + _fieldE4 = true; + } else if (msg->_action == "DisableObject") { + _fieldE4 = false; + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/seasonal_adjustment.h b/engines/titanic/game/seasonal_adjustment.h index f96c13619d..4b7ef3d4f6 100644 --- a/engines/titanic/game/seasonal_adjustment.h +++ b/engines/titanic/game/seasonal_adjustment.h @@ -27,15 +27,16 @@ namespace Titanic { -enum Season { - SPRING = 0, - SUMMER = 1, - AUTUMN = 2, - WINTER = 3 -}; - class CSeasonalAdjustment : public CBackground { -public: + DECLARE_MESSAGE_MAP; + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *msg); + bool ActMsg(CActMsg *msg); +private: int _fieldE0; int _fieldE4; public: diff --git a/engines/titanic/game/sgt/bedhead.cpp b/engines/titanic/game/sgt/bedhead.cpp index f911a83ae3..216d22ee71 100644 --- a/engines/titanic/game/sgt/bedhead.cpp +++ b/engines/titanic/game/sgt/bedhead.cpp @@ -43,7 +43,7 @@ void BedheadEntry::load(Common::SeekableReadStream *s) { void BedheadEntries::load(Common::SeekableReadStream *s, int count) { resize(count); - for (uint idx = 0; idx < count; ++idx) + for (int idx = 0; idx < count; ++idx) (*this)[idx].load(s); } diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index 5628161558..8814dba831 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -47,7 +47,7 @@ bool CGameStateMovieList::clear() { CGameState::CGameState(CGameManager *gameManager) : _gameManager(gameManager), _gameLocation(this), _passengerClass(0), _priorClass(0), _mode(GSMODE_NONE), - _field14(0), _petActive(false), _field1C(false), _quitGame(false), + _seasonNum(SEASON_SUMMER), _petActive(false), _field1C(false), _quitGame(false), _field24(0), _nodeChangeCtr(0), _nodeEnterTicks(0), _field38(0) { } @@ -55,7 +55,7 @@ void CGameState::save(SimpleFile *file) const { file->writeNumber(_petActive); file->writeNumber(_passengerClass); file->writeNumber(_priorClass); - file->writeNumber(_field14); + file->writeNumber(_seasonNum); file->writeNumber(_field24); file->writeNumber(_field38); _gameLocation.save(file); @@ -66,7 +66,7 @@ void CGameState::load(SimpleFile *file) { _petActive = file->readNumber() != 0; _passengerClass = file->readNumber(); _priorClass = file->readNumber(); - _field14 = file->readNumber(); + _seasonNum = (Season)file->readNumber(); _field24 = file->readNumber(); _field38 = file->readNumber(); _gameLocation.load(file); diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 0bfa0d5b31..0fe47ab25a 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -38,6 +38,13 @@ enum GameStateMode { GSMODE_3 = 3, GSMODE_4 = 4, GSMODE_5 = 5, GSMODE_PENDING_LOAD = 6 }; +enum Season { + SEASON_SUMMER = 0, + SEASON_AUTUMN = 1, + SEASON_WINTER = 2, + SEASON_SPRING = 3 +}; + PTR_LIST_ITEM(CMovie); class CGameStateMovieList : public List<CMovieListItem> { public: @@ -60,7 +67,7 @@ public: int _passengerClass; int _priorClass; GameStateMode _mode; - int _field14; + Season _seasonNum; bool _petActive; bool _field1C; bool _quitGame; @@ -127,7 +134,13 @@ public: */ void addMovie(CMovie *movie); - void inc14() { _field14 = (_field14 + 1) & 3; } + /** + * Change to the next season + */ + void changeSeason() { + _seasonNum = (Season)(((int)_seasonNum + 1) & 3); + } + void set24(int v) { _field24 = v; } int get24() const { return _field24; } int getNodeChangedCtr() const { return _nodeChangeCtr; } diff --git a/engines/titanic/moves/exit_arboretum.cpp b/engines/titanic/moves/exit_arboretum.cpp index e0c2ab9c9d..ba162843b5 100644 --- a/engines/titanic/moves/exit_arboretum.cpp +++ b/engines/titanic/moves/exit_arboretum.cpp @@ -57,7 +57,7 @@ void CExitArboretum::load(SimpleFile *file) { bool CExitArboretum::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (_enabled) { CActMsg actMsg; - if (_seasonNum == AUTUMN) { + if (_seasonNum == SEASON_WINTER) { switch (_fieldCC) { case 0: actMsg._action = "ExitLFrozen"; diff --git a/engines/titanic/moves/restaurant_pan_handler.h b/engines/titanic/moves/restaurant_pan_handler.h index 745cd5d564..9684fd07f5 100644 --- a/engines/titanic/moves/restaurant_pan_handler.h +++ b/engines/titanic/moves/restaurant_pan_handler.h @@ -31,7 +31,7 @@ class CRestaurantPanHandler : public CMovePlayerTo { DECLARE_MESSAGE_MAP; bool ArmPickedUpFromTableMsg(CArmPickedUpFromTableMsg *msg); bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); -private: +protected: CString _armDestination; CString _armlessDestination; public: diff --git a/engines/titanic/moves/restricted_move.cpp b/engines/titanic/moves/restricted_move.cpp index 5f18dab8ff..37cb1c46dc 100644 --- a/engines/titanic/moves/restricted_move.cpp +++ b/engines/titanic/moves/restricted_move.cpp @@ -24,21 +24,59 @@ namespace Titanic { -CRestrictedMove::CRestrictedMove() : CMovePlayerTo(), _fieldC8(0) { +BEGIN_MESSAGE_MAP(CRestrictedMove, CMovePlayerTo) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + +CRestrictedMove::CRestrictedMove() : CMovePlayerTo(), _classNum(0) { } void CRestrictedMove::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_classNum, indent); CMovePlayerTo::save(file, indent); } void CRestrictedMove::load(SimpleFile *file) { file->readNumber(); - _fieldC8 = file->readNumber(); + _classNum = file->readNumber(); CMovePlayerTo::load(file); } +bool CRestrictedMove::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + int classNum = getPassengerClass(); + if (classNum <= _classNum) { + // Okay to change to the given destination + changeView(_destination); + } else if (classNum != 4) { + petDisplayMessage(1, "Passengers of your class are not permitted to enter this area."); + } else if (compareRoomNameTo("EmbLobby")) { + playSound("a#17.wav"); + petDisplayMessage(1, "Please check in at the reception desk."); + } else if (compareViewNameTo("Titania.Node 1.S")) { + playSound("z#226.wav"); + changeView(_destination); + } + + return true; +} + +bool CRestrictedMove::EnterViewMsg(CEnterViewMsg *msg) { + int classNum = getPassengerClass(); + bool flag = classNum > _classNum; + + if (classNum == 4) { + if (compareRoomNameTo("EmbLobby")) + flag = false; + else if (compareViewNameTo("Titania.Node 1.S")) + flag = true; + } + + _cursorId = flag ? CURSOR_MOVE_FORWARD : CURSOR_INVALID; + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/moves/restricted_move.h b/engines/titanic/moves/restricted_move.h index bdf093c353..639b024701 100644 --- a/engines/titanic/moves/restricted_move.h +++ b/engines/titanic/moves/restricted_move.h @@ -28,8 +28,11 @@ namespace Titanic { class CRestrictedMove : public CMovePlayerTo { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); protected: - int _fieldC8; + int _classNum; public: CLASSDEF; CRestrictedMove(); diff --git a/engines/titanic/moves/scraliontis_table.cpp b/engines/titanic/moves/scraliontis_table.cpp index 77d2f9df60..8d39e2104f 100644 --- a/engines/titanic/moves/scraliontis_table.cpp +++ b/engines/titanic/moves/scraliontis_table.cpp @@ -24,15 +24,21 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CScraliontisTable, CRestaurantPanHandler) + ON_MESSAGE(MouseMoveMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MaitreDDefeatedMsg) +END_MESSAGE_MAP() + CScraliontisTable::CScraliontisTable() : CRestaurantPanHandler(), - _fieldE0(0), _fieldE4(0), _fieldE8(0), _fieldEC(0) { + _fieldE0(false), _counter(0), _ticks(0), _fieldEC(false) { } void CScraliontisTable::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); - file->writeNumberLine(_fieldE4, indent); - file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_counter, indent); + file->writeNumberLine(_ticks, indent); file->writeNumberLine(_fieldEC, indent); CRestaurantPanHandler::save(file, indent); @@ -41,11 +47,42 @@ void CScraliontisTable::save(SimpleFile *file, int indent) { void CScraliontisTable::load(SimpleFile *file) { file->readNumber(); _fieldE0 = file->readNumber(); - _fieldE4 = file->readNumber(); - _fieldE8 = file->readNumber(); + _counter = file->readNumber(); + _ticks = file->readNumber(); _fieldEC = file->readNumber(); CRestaurantPanHandler::load(file); } +bool CScraliontisTable::MouseMoveMsg(CMouseMoveMsg *msg) { + if (!_fieldEC && !_fieldE0) { + if (++_counter > 20) { + CTriggerNPCEvent triggerMsg; + triggerMsg.execute("MaitreD"); + _fieldE0 = true; + } + } + + return true; +} + +bool CScraliontisTable::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_fieldEC) { + changeView(_destination, _armPickedUp ? _armDestination : _armlessDestination); + } + else if (!_ticks || (getTicksCount() - _ticks) >= 5000) { + CTriggerNPCEvent triggerMsg(119); + triggerMsg.execute("MaitreD"); + _ticks = getTicksCount(); + } + + return true; +} + +bool CScraliontisTable::MaitreDDefeatedMsg(CMaitreDDefeatedMsg *msg) { + _cursorId = CURSOR_MOVE_FORWARD; + _fieldEC = true; + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/moves/scraliontis_table.h b/engines/titanic/moves/scraliontis_table.h index 2ce3745654..b0d8c6b5af 100644 --- a/engines/titanic/moves/scraliontis_table.h +++ b/engines/titanic/moves/scraliontis_table.h @@ -28,11 +28,15 @@ namespace Titanic { class CScraliontisTable : public CRestaurantPanHandler { + DECLARE_MESSAGE_MAP; + bool MouseMoveMsg(CMouseMoveMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MaitreDDefeatedMsg(CMaitreDDefeatedMsg *msg); private: - int _fieldE0; - int _fieldE4; - int _fieldE8; - int _fieldEC; + bool _fieldE0; + int _counter; + uint _ticks; + bool _fieldEC; public: CLASSDEF; CScraliontisTable(); diff --git a/engines/titanic/sound/titania_speech.cpp b/engines/titanic/sound/titania_speech.cpp index a07cc79334..d0ff423342 100644 --- a/engines/titanic/sound/titania_speech.cpp +++ b/engines/titanic/sound/titania_speech.cpp @@ -59,7 +59,7 @@ bool CTitaniaSpeech::ActMsg(CActMsg *msg) { movieSetAudioTiming(true); loadSound("a#12.wav"); sleep(1000); - playMovie(0, 187, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + playMovie(0, 187, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); movieEvent(0); break; @@ -78,7 +78,7 @@ bool CTitaniaSpeech::ActMsg(CActMsg *msg) { visibleMsg._visible = false; visibleMsg.execute("TitaniaStillControl"); loadSound("a#10.wav"); - playMovie(585, 706, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + playMovie(585, 706, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); playSound("a#10.wav"); break; @@ -86,7 +86,7 @@ bool CTitaniaSpeech::ActMsg(CActMsg *msg) { visibleMsg._visible = false; visibleMsg.execute("TitaniaStillControl"); loadSound("a#9.wav"); - playMovie(707, 905, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + playMovie(707, 905, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); playSound("a#9.wav"); break; @@ -94,7 +94,7 @@ bool CTitaniaSpeech::ActMsg(CActMsg *msg) { visibleMsg._visible = false; visibleMsg.execute("TitaniaStillControl"); loadSound("a#8.wav"); - playMovie(906, 938, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT); + playMovie(906, 938, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); playSound("a#8.wav"); break; diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 19beee9796..9913f55a8d 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -589,9 +589,9 @@ int CTrueTalkManager::getPassengerClass() const { return gameState ? gameState->_passengerClass : 4; } -int CTrueTalkManager::getState14() const { +Season CTrueTalkManager::getCurrentSeason() const { CGameState *gameState = getGameState(); - return gameState ? gameState->_field14 : 0; + return gameState ? gameState->_seasonNum : SEASON_SUMMER; } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 8a8895917a..f77c9640db 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -31,6 +31,7 @@ #include "titanic/true_talk/tt_quotes_tree.h" #include "titanic/true_talk/tt_scripts.h" #include "titanic/true_talk/tt_talker.h" +#include "titanic/game_state.h" namespace Titanic { @@ -237,7 +238,7 @@ public: */ int getPassengerClass() const; - int getState14() const; + Season getCurrentSeason() const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 61c3b0e00c..280894c05a 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -579,14 +579,14 @@ int TTnpcScript::getValue(int testNum) const { case 4: if (g_vm->_trueTalkManager) { - switch (g_vm->_trueTalkManager->getState14()) { - case 1: + switch (g_vm->_trueTalkManager->getCurrentSeason()) { + case SEASON_AUTUMN: CTrueTalkManager::_v6 = 3; break; - case 2: + case SEASON_WINTER: CTrueTalkManager::_v6 = 0; break; - case 3: + case SEASON_SPRING: CTrueTalkManager::_v6 = 1; break; default: |