diff options
author | Paul Gilbert | 2017-01-16 07:34:52 -0500 |
---|---|---|
committer | Paul Gilbert | 2017-01-16 07:34:52 -0500 |
commit | 70dc84e383bfb4a81785b30ce91f7e089a94c031 (patch) | |
tree | 2ab742d8640708af8c5c4151b1154e97bb3488e2 | |
parent | 480532c2096451cd594cdce944e2345e738039c5 (diff) | |
download | scummvm-rg350-70dc84e383bfb4a81785b30ce91f7e089a94c031.tar.gz scummvm-rg350-70dc84e383bfb4a81785b30ce91f7e089a94c031.tar.bz2 scummvm-rg350-70dc84e383bfb4a81785b30ce91f7e089a94c031.zip |
TITANIC: Renamings and cleanup for chicken, sauce, and dispensor
-rw-r--r-- | engines/titanic/carry/chicken.cpp | 46 | ||||
-rw-r--r-- | engines/titanic/carry/chicken.h | 6 | ||||
-rw-r--r-- | engines/titanic/carry/glass.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/carry/napkin.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/game/chicken_cooler.cpp | 25 | ||||
-rw-r--r-- | engines/titanic/game/chicken_cooler.h | 6 | ||||
-rw-r--r-- | engines/titanic/game/chicken_dispensor.cpp | 17 | ||||
-rw-r--r-- | engines/titanic/game/sauce_dispensor.cpp | 25 | ||||
-rw-r--r-- | engines/titanic/game/sauce_dispensor.h | 4 |
9 files changed, 61 insertions, 72 deletions
diff --git a/engines/titanic/carry/chicken.cpp b/engines/titanic/carry/chicken.cpp index e3577f2fb8..851b7b81e7 100644 --- a/engines/titanic/carry/chicken.cpp +++ b/engines/titanic/carry/chicken.cpp @@ -40,18 +40,20 @@ BEGIN_MESSAGE_MAP(CChicken, CCarry) ON_MESSAGE(PETLostObjectMsg) END_MESSAGE_MAP() -int CChicken::_v1; +int CChicken::_temperature; + +#define HOT_TEMPERATURE 120 CChicken::CChicken() : CCarry(), _condiment("None"), - _field12C(1), _field13C(0), _timerId(0) { + _greasy(true), _inactive(false), _timerId(0) { } void CChicken::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_field12C, indent); + file->writeNumberLine(_greasy, indent); file->writeQuotedLine(_condiment, indent); - file->writeNumberLine(_v1, indent); - file->writeNumberLine(_field13C, indent); + file->writeNumberLine(_temperature, indent); + file->writeNumberLine(_inactive, indent); file->writeNumberLine(_timerId, indent); CCarry::save(file, indent); @@ -59,10 +61,10 @@ void CChicken::save(SimpleFile *file, int indent) { void CChicken::load(SimpleFile *file) { file->readNumber(); - _field12C = file->readNumber(); + _greasy = file->readNumber(); _condiment = file->readString(); - _v1 = file->readNumber(); - _field13C = file->readNumber(); + _temperature = file->readNumber(); + _inactive = file->readNumber(); _timerId = file->readNumber(); CCarry::load(file); @@ -70,7 +72,7 @@ void CChicken::load(SimpleFile *file) { bool CChicken::UseWithOtherMsg(CUseWithOtherMsg *msg) { if (msg->_other->getName() == "Napkin") { - if (_field12C || _condiment == "None") { + if (_greasy || _condiment != "None") { CActMsg actMsg("Clean"); actMsg.execute(this); petAddToInventory(); @@ -129,21 +131,21 @@ bool CChicken::ActMsg(CActMsg *msg) { } else if (msg->_action == "Clean") { _condiment = "None"; loadFrame(3); - _field12C = 0; + _greasy = false; _visibleFrame = 3; } else if (msg->_action == "Dispense Chicken") { _condiment = "None"; - _field13C = 0; - _field12C = 1; + _inactive = false; + _greasy = true; loadFrame(1); _visibleFrame = 1; - _v1 = 120; + _temperature = HOT_TEMPERATURE; } else if (msg->_action == "Hot") { - _v1 = 120; + _temperature = HOT_TEMPERATURE; } else if (msg->_action == "Eaten") { setVisible(false); petMoveToHiddenRoom(); - _field13C = 1; + _inactive = true; } return true; @@ -164,10 +166,10 @@ bool CChicken::TimerMsg(CTimerMsg *msg) { bool flag = false; if (obj) { - flag = _v1; - } else if (_v1 > 0) { - --_v1; - flag = _v1; + flag = _temperature; + } else if (_temperature > 0) { + --_temperature; + flag = _temperature; } if (flag) { @@ -185,7 +187,7 @@ bool CChicken::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { } bool CChicken::ParrotTriesChickenMsg(CParrotTriesChickenMsg *msg) { - if (_v1 > 0) + if (_temperature > 0) msg->_value1 = 1; if (_condiment == "Tomato") { @@ -200,7 +202,7 @@ bool CChicken::ParrotTriesChickenMsg(CParrotTriesChickenMsg *msg) { } bool CChicken::MouseDragEndMsg(CMouseDragEndMsg *msg) { - if (_field13C) { + if (_inactive) { showMouse(); return true; } else { @@ -209,7 +211,7 @@ bool CChicken::MouseDragEndMsg(CMouseDragEndMsg *msg) { } bool CChicken::PETObjectStateMsg(CPETObjectStateMsg *msg) { - if (_v1 > 0) + if (_temperature > 0) msg->_value = 2; return true; diff --git a/engines/titanic/carry/chicken.h b/engines/titanic/carry/chicken.h index 47d25b39a4..e9fd6cbc9d 100644 --- a/engines/titanic/carry/chicken.h +++ b/engines/titanic/carry/chicken.h @@ -42,11 +42,11 @@ class CChicken : public CCarry { bool PETObjectStateMsg(CPETObjectStateMsg *msg); bool PETLostObjectMsg(CPETLostObjectMsg *msg); public: - static int _v1; + static int _temperature; public: - int _field12C; + bool _greasy; CString _condiment; - int _field13C; + bool _inactive; int _timerId; public: CLASSDEF; diff --git a/engines/titanic/carry/glass.cpp b/engines/titanic/carry/glass.cpp index 6751d8456d..fe8e10dbdb 100644 --- a/engines/titanic/carry/glass.cpp +++ b/engines/titanic/carry/glass.cpp @@ -60,7 +60,7 @@ bool CGlass::UseWithOtherMsg(CUseWithOtherMsg *msg) { useMsg.execute(dispensor); } else if (msg->_other->isEquals("Chicken") && _condiment == "None") { if (chicken->_condiment != "None") { - if (!chicken->_field12C) { + if (!chicken->_greasy) { CActMsg actMsg(_condiment); actMsg.execute("Chicken"); } diff --git a/engines/titanic/carry/napkin.cpp b/engines/titanic/carry/napkin.cpp index eaafd8b34c..7b9c1e91c9 100644 --- a/engines/titanic/carry/napkin.cpp +++ b/engines/titanic/carry/napkin.cpp @@ -45,7 +45,7 @@ void CNapkin::load(SimpleFile *file) { bool CNapkin::UseWithOtherMsg(CUseWithOtherMsg *msg) { CChicken *chicken = dynamic_cast<CChicken *>(msg->_other); if (chicken) { - if (chicken->_condiment == "None" || chicken->_field12C) { + if (chicken->_condiment != "None" || chicken->_greasy) { CActMsg actMsg("Clean"); actMsg.execute("Chicken"); } else { diff --git a/engines/titanic/game/chicken_cooler.cpp b/engines/titanic/game/chicken_cooler.cpp index d10405de38..514ab07de8 100644 --- a/engines/titanic/game/chicken_cooler.cpp +++ b/engines/titanic/game/chicken_cooler.cpp @@ -32,29 +32,26 @@ END_MESSAGE_MAP() void CChickenCooler::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_newTemperature, indent); + file->writeNumberLine(_triggerOnRoomEntry, indent); CGameObject::save(file, indent); } void CChickenCooler::load(SimpleFile *file) { file->readNumber(); - _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); + _newTemperature = file->readNumber(); + _triggerOnRoomEntry = file->readNumber(); CGameObject::load(file); } bool CChickenCooler::EnterRoomMsg(CEnterRoomMsg *msg) { - if (_fieldC0) { + if (_triggerOnRoomEntry) { CGameObject *obj = getMailManFirstObject(); - if (obj) { - // WORKAROUND: Redundant loop for chicken in originalhere - } else { - getNextMail(nullptr); - if (CChicken::_v1 > _fieldBC) - CChicken::_v1 = _fieldBC; + if (!obj) { + if (CChicken::_temperature > _newTemperature) + CChicken::_temperature = _newTemperature; } } @@ -62,15 +59,15 @@ bool CChickenCooler::EnterRoomMsg(CEnterRoomMsg *msg) { } bool CChickenCooler::EnterViewMsg(CEnterViewMsg *msg) { - if (!_fieldC0) { + if (!_triggerOnRoomEntry) { for (CGameObject *obj = getMailManFirstObject(); obj; obj = getNextMail(obj)) { if (obj->isEquals("Chicken")) return true; } - if (CChicken::_v1 > _fieldBC) - CChicken::_v1 = _fieldBC; + if (CChicken::_temperature > _newTemperature) + CChicken::_temperature = _newTemperature; } return true; diff --git a/engines/titanic/game/chicken_cooler.h b/engines/titanic/game/chicken_cooler.h index 54dba90686..e1ad7cb8fa 100644 --- a/engines/titanic/game/chicken_cooler.h +++ b/engines/titanic/game/chicken_cooler.h @@ -33,11 +33,11 @@ class CChickenCooler : public CGameObject { bool EnterRoomMsg(CEnterRoomMsg *msg); bool EnterViewMsg(CEnterViewMsg *msg); private: - int _fieldBC; - int _fieldC0; + int _newTemperature; + bool _triggerOnRoomEntry; public: CLASSDEF; - CChickenCooler() : CGameObject(), _fieldBC(0), _fieldC0(0) {} + CChickenCooler() : CGameObject(), _newTemperature(0), _triggerOnRoomEntry(false) {} /** * Save the data for the class to file diff --git a/engines/titanic/game/chicken_dispensor.cpp b/engines/titanic/game/chicken_dispensor.cpp index a1070c312a..dd87848456 100644 --- a/engines/titanic/game/chicken_dispensor.cpp +++ b/engines/titanic/game/chicken_dispensor.cpp @@ -77,28 +77,16 @@ bool CChickenDispensor::StatusChangeMsg(CStatusChangeMsg *msg) { } } - if (dispenseMode != DISPENSE_NONE) - _dispensed = true; - switch (dispenseMode) { case DISPENSE_NONE: petDisplayMessage(1, ONE_ALLOCATED_CHICKEN_PER_CUSTOMER); break; case DISPENSE_HOT: - setVisible(true); - if (_disabled) { - playMovie(0, 12, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); - playSound("z#400.wav"); - } else { - playMovie(12, 16, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); - _dispensed = true; - } - _dispenseMode = DISPENSE_NONE; - break; - case DISPENSE_COLD: + _dispensed = true; setVisible(true); + if (_disabled) { playMovie(0, 12, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); playSound("z#400.wav"); @@ -106,6 +94,7 @@ bool CChickenDispensor::StatusChangeMsg(CStatusChangeMsg *msg) { playMovie(12, 16, MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); _dispensed = true; } + _dispenseMode = DISPENSE_NONE; break; default: diff --git a/engines/titanic/game/sauce_dispensor.cpp b/engines/titanic/game/sauce_dispensor.cpp index b58de99a62..7b395e5b11 100644 --- a/engines/titanic/game/sauce_dispensor.cpp +++ b/engines/titanic/game/sauce_dispensor.cpp @@ -36,14 +36,15 @@ BEGIN_MESSAGE_MAP(CSauceDispensor, CBackground) END_MESSAGE_MAP() CSauceDispensor::CSauceDispensor() : CBackground(), - _pouringCondiment(false), _fieldF0(0), _field104(0), _field108(0) { + _pouringCondiment(false), _starlingsDead(false), + _field104(0), _field108(0) { } void CSauceDispensor::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeQuotedLine(_string3, indent); + file->writeQuotedLine(_condimentName, indent); file->writeNumberLine(_pouringCondiment, indent); - file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_starlingsDead, indent); file->writePoint(_pos1, indent); file->writePoint(_pos2, indent); file->writeNumberLine(_field104, indent); @@ -54,9 +55,9 @@ void CSauceDispensor::save(SimpleFile *file, int indent) { void CSauceDispensor::load(SimpleFile *file) { file->readNumber(); - _string3 = file->readString(); + _condimentName = file->readString(); _pouringCondiment = file->readNumber(); - _fieldF0 = file->readNumber(); + _starlingsDead = file->readNumber(); _pos1 = file->readPoint(); _pos2 = file->readPoint(); _field104 = file->readNumber(); @@ -71,7 +72,7 @@ bool CSauceDispensor::Use(CUse *msg) { if (msg->_item->isEquals("Chicken")) { CChicken *chicken = static_cast<CChicken *>(msg->_item); _field104 = true; - if (_fieldF0) { + if (_starlingsDead) { playSound("b#15.wav", 50); if (chicken->_condiment != "None") { @@ -79,17 +80,17 @@ bool CSauceDispensor::Use(CUse *msg) { msg->execute("Chicken"); } else { setVisible(true); - if (chicken->_field12C) { + if (chicken->_greasy) { _pouringCondiment = true; playMovie(_pos1.x, _pos1.y, MOVIE_NOTIFY_OBJECT); } else { - CActMsg actMsg(_string3); + CActMsg actMsg(_condimentName); actMsg.execute("Chicken"); playMovie(_pos2.x, _pos2.y, MOVIE_NOTIFY_OBJECT); } } - if (_fieldF0) + if (_starlingsDead) return true; } @@ -103,7 +104,7 @@ bool CSauceDispensor::Use(CUse *msg) { assert(glass); _field108 = true; - if (_field104 != 1 || _fieldF0 != 1) { + if (_field104 != 1 || !_starlingsDead) { glass->petAddToInventory(); } else if (glass->_condiment != "None") { visibleMsg.execute("BeerGlass"); @@ -113,7 +114,7 @@ bool CSauceDispensor::Use(CUse *msg) { 300)); setVisible(true); - CActMsg actMsg(_string3); + CActMsg actMsg(_condimentName); actMsg.execute("BeerGlass"); } } @@ -138,7 +139,7 @@ bool CSauceDispensor::MovieEndMsg(CMovieEndMsg *msg) { bool CSauceDispensor::ActMsg(CActMsg *msg) { if (msg->_action == "StarlingsDead") - _fieldF0 = true; + _starlingsDead = true; return true; } diff --git a/engines/titanic/game/sauce_dispensor.h b/engines/titanic/game/sauce_dispensor.h index cdcd592546..7d7d921429 100644 --- a/engines/titanic/game/sauce_dispensor.h +++ b/engines/titanic/game/sauce_dispensor.h @@ -36,9 +36,9 @@ class CSauceDispensor : public CBackground { bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); bool StatusChangeMsg(CStatusChangeMsg *msg); public: - CString _string3; + CString _condimentName; bool _pouringCondiment; - int _fieldF0; + bool _starlingsDead; Point _pos1; Point _pos2; int _field104; |