diff options
Diffstat (limited to 'engines/titanic/carry/carry_parrot.cpp')
-rw-r--r-- | engines/titanic/carry/carry_parrot.cpp | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp index ed86384147..8b332610e2 100644 --- a/engines/titanic/carry/carry_parrot.cpp +++ b/engines/titanic/carry/carry_parrot.cpp @@ -42,13 +42,13 @@ BEGIN_MESSAGE_MAP(CCarryParrot, CCarry) ON_MESSAGE(ActMsg) END_MESSAGE_MAP() -CCarryParrot::CCarryParrot() : CCarry(), _string6("PerchedParrot"), +CCarryParrot::CCarryParrot() : CCarry(), _parrotName("PerchedParrot"), _timerId(0), _freeCounter(0), _feathersFlag(false) { } void CCarryParrot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeQuotedLine(_string6, indent); + file->writeQuotedLine(_parrotName, indent); file->writeNumberLine(_timerId, indent); file->writeNumberLine(_freeCounter, indent); file->writeNumberLine(_feathersFlag, indent); @@ -58,7 +58,7 @@ void CCarryParrot::save(SimpleFile *file, int indent) { void CCarryParrot::load(SimpleFile *file) { file->readNumber(); - _string6 = file->readString(); + _parrotName = file->readString(); _timerId = file->readNumber(); _freeCounter = file->readNumber(); _feathersFlag = file->readNumber(); @@ -67,7 +67,7 @@ void CCarryParrot::load(SimpleFile *file) { } bool CCarryParrot::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { - CParrot::_v4 = 4; + CParrot::_state = PARROT_4; CActMsg actMsg("Shut"); actMsg.execute("ParrotCage"); @@ -75,7 +75,7 @@ bool CCarryParrot::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { } bool CCarryParrot::TimerMsg(CTimerMsg *msg) { - if (CParrot::_v4 == 1 || CParrot::_v4 == 4) { + if (CParrot::_state == PARROT_1 || CParrot::_state == PARROT_4) { if (++_freeCounter >= 30) { CActMsg actMsg("FreeParrot"); actMsg.execute(this); @@ -94,7 +94,7 @@ bool CCarryParrot::LeaveViewMsg(CLeaveViewMsg *msg) { if (_visible) { setVisible(false); _fieldE0 = 0; - CParrot::_v4 = 2; + CParrot::_state = PARROT_ESCAPED; } return true; @@ -105,10 +105,7 @@ bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) { if (msg->_mousePos.y >= 360) { petAddToInventory(); - return true; - } - - if (compareViewNameTo("ParrotLobby.Node 1.N")) { + } else if (compareViewNameTo("ParrotLobby.Node 1.N")) { if (msg->_mousePos.x >= 75 && msg->_mousePos.x <= 565 && !CParrot::_v2 && !CCage::_open) { setVisible(false); @@ -123,7 +120,7 @@ bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) { } else { setVisible(false); _fieldE0 = 0; - CParrot::_v4 = 2; + CParrot::_state = PARROT_ESCAPED; playSound("z#475.wav"); sound8(true); moveUnder(findRoom()); @@ -150,7 +147,7 @@ bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) { } bool CCarryParrot::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { - if (CParrot::_v4 != 3) { + if (CParrot::_state != PARROT_MAILED) { moveToView(); setPosition(Point(0, 0)); setVisible(true); @@ -161,21 +158,22 @@ bool CCarryParrot::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { _timerId = addTimer(1000, 1000); _freeCounter = 0; - CParrot::_v4 = 1; + CParrot::_state = PARROT_1; msg->_value3 = 1; return CCarry::PassOnDragStartMsg(msg); } - CTrueTalkNPC *npc = dynamic_cast<CTrueTalkNPC *>(getRoot()->findByName(_string6)); + CTrueTalkNPC *npc = dynamic_cast<CTrueTalkNPC *>(getRoot()->findByName(_parrotName)); if (npc) startTalking(npc, 0x446BF); _fieldE0 = 0; playSound("z#475.wav"); moveUnder(findRoom()); - msg->_value4 = 1; + CParrot::_state = PARROT_ESCAPED; + msg->_value4 = 1; return true; } @@ -191,24 +189,21 @@ bool CCarryParrot::PreEnterViewMsg(CPreEnterViewMsg *msg) { bool CCarryParrot::UseWithCharMsg(CUseWithCharMsg *msg) { CSuccUBus *succubus = dynamic_cast<CSuccUBus *>(msg->_character); if (succubus) - CParrot::_v4 = 3; + CParrot::_state = PARROT_MAILED; return CCarry::UseWithCharMsg(msg); } bool CCarryParrot::ActMsg(CActMsg *msg) { - if (msg->_action == "FreeParrot" && (CParrot::_v4 == 4 || CParrot::_v4 == 1)) { - CTrueTalkNPC *npc = dynamic_cast<CTrueTalkNPC *>(getRoot()->findByName(_string6)); + if (msg->_action == "FreeParrot" && (CParrot::_state == PARROT_4 || CParrot::_state == PARROT_1)) { + CTrueTalkNPC *npc = dynamic_cast<CTrueTalkNPC *>(getRoot()->findByName(_parrotName)); if (npc) startTalking(npc, 0x446BF); setVisible(false); _fieldE0 = 0; - if (CParrot::_v4 == 4) { - CActMsg actMsg("Shut"); - actMsg.execute("ParrotCage"); - } else { + if (CParrot::_state == PARROT_4) { playSound("z#475.wav"); if (!_feathersFlag) { @@ -221,13 +216,17 @@ bool CCarryParrot::ActMsg(CActMsg *msg) { _feathersFlag = true; } - getPetControl()->removeFromInventory(this); - getPetControl()->setAreaChangeType(1); + CPetControl *pet = getPetControl(); + pet->removeFromInventory(this); + pet->setAreaChangeType(1); moveUnder(getRoom()); + } else { + CActMsg actMsg("Shut"); + actMsg.execute("ParrotCage"); } - CParrot::_v4 = 2; - stopTimer(_timerId); + CParrot::_state = PARROT_ESCAPED; + stopAnimTimer(_timerId); _timerId = 0; } |