aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/carry
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-15 22:30:50 -0400
committerPaul Gilbert2016-07-10 16:11:11 -0400
commitbc716fda4b11b69eecfc0931afd3b12ef0afb589 (patch)
tree9d33925d2b042630bb7d6e1c8c324a64bed97ea0 /engines/titanic/carry
parent95c885f877ac1fa243479d113b59e6f83a360c71 (diff)
downloadscummvm-rg350-bc716fda4b11b69eecfc0931afd3b12ef0afb589.tar.gz
scummvm-rg350-bc716fda4b11b69eecfc0931afd3b12ef0afb589.tar.bz2
scummvm-rg350-bc716fda4b11b69eecfc0931afd3b12ef0afb589.zip
TITANIC: Implemented CCarryParrot msg handlers and support methods
Diffstat (limited to 'engines/titanic/carry')
-rw-r--r--engines/titanic/carry/carry_parrot.cpp116
-rw-r--r--engines/titanic/carry/carry_parrot.h4
2 files changed, 107 insertions, 13 deletions
diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp
index 1081980121..4b2b637fa1 100644
--- a/engines/titanic/carry/carry_parrot.cpp
+++ b/engines/titanic/carry/carry_parrot.cpp
@@ -21,8 +21,12 @@
*/
#include "titanic/carry/carry_parrot.h"
+#include "titanic/core/project_item.h"
+#include "titanic/core/room_item.h"
#include "titanic/game/cage.h"
#include "titanic/npcs/parrot.h"
+#include "titanic/npcs/succubus.h"
+#include "titanic/pet_control/pet_control.h"
namespace Titanic {
@@ -39,14 +43,14 @@ BEGIN_MESSAGE_MAP(CCarryParrot, CCarry)
END_MESSAGE_MAP()
CCarryParrot::CCarryParrot() : CCarry(), _string6("PerchedParrot"),
- _field138(0), _field13C(0), _field140(0), _field144(10),
+ _timerId(0), _field13C(0), _field140(false), _field144(10),
_field148(25), _field14C(0), _field150(8) {
}
void CCarryParrot::save(SimpleFile *file, int indent) const {
file->writeNumberLine(1, indent);
file->writeQuotedLine(_string6, indent);
- file->writeNumberLine(_field138, indent);
+ file->writeNumberLine(_timerId, indent);
file->writeNumberLine(_field13C, indent);
file->writeNumberLine(_field140, indent);
@@ -56,7 +60,7 @@ void CCarryParrot::save(SimpleFile *file, int indent) const {
void CCarryParrot::load(SimpleFile *file) {
file->readNumber();
_string6 = file->readString();
- _field138 = file->readNumber();
+ _timerId = file->readNumber();
_field13C = file->readNumber();
_field140 = file->readNumber();
@@ -109,34 +113,124 @@ bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) {
if (msg->_mousePos.x >= 75 && msg->_mousePos.x <= 565 &&
!CParrot::_v2 && !CCage::_v2) {
setVisible(false);
- // TODO
+ _fieldE0 = 0;
+ CTreeItem *perchedParrot = findUnder(getRoot(), "PerchedParrot");
+ detach();
+ addUnder(perchedParrot);
+ sound8(true);
+
+ CPutParrotBackMsg backMsg(msg->_mousePos.x);
+ backMsg.execute(perchedParrot);
} else {
- // TODO
+ setVisible(false);
+ _fieldE0 = 0;
+ CParrot::_v4 = 2;
+ playSound("z#475.wav", 100, 0, 0);
+ sound8(true);
+ moveUnder(findRoom());
+
+ CActMsg actMsg("Shut");
+ actMsg.execute("ParrotCage");
}
} else {
- // TODO
+ CCharacter *character = static_cast<CCharacter *>(msg->_dropTarget);
+ if (character) {
+ CUseWithCharMsg charMsg(character);
+ charMsg.execute(this, nullptr, 0);
+ } else {
+ setVisible(false);
+ _fieldE0 = 0;
+ playSound("z#475.wav", 100, 0, 0);
+ sound8(true);
+ moveUnder(findRoom());
+ }
}
return true;
}
bool CCarryParrot::PassOnDragStartMsg(CPassOnDragStartMsg *msg) {
- // TODO
+ if (CParrot::_v4 != 3) {
+ moveToView();
+ setPosition(Point(0, 0));
+ setVisible(true);
+ playClip("Pick Up", 2);
+ playClip("Flapping", 1);
+
+ stopTimer(_timerId);
+ _timerId = addTimer(1000, 1000);
+
+ _field13C = 0;
+ CParrot::_v4 = 1;
+ msg->_value3 = 1;
+
+ return CCarry::PassOnDragStartMsg(msg);
+ }
+
+ CTreeItem *treeItem = getRoot()->findByName(_string6);
+ if (treeItem)
+ trueTalkFn1(treeItem, 0x446BF, 0);
+
+ _fieldE0 = 0;
+ playSound("z#475.wav", 100, 0, 0);
+ moveUnder(findRoom());
+ msg->_value4 = 1;
+
return true;
}
bool CCarryParrot::PreEnterViewMsg(CPreEnterViewMsg *msg) {
- // TODO
+ loadSurface();
+ CCarryParrot *parrot = static_cast<CCarryParrot *>(getRoot()->findByName("CarryParrot"));
+ if (parrot)
+ parrot->_fieldE0 = 0;
+
return true;
}
bool CCarryParrot::UseWithCharMsg(CUseWithCharMsg *msg) {
- // TODO
- return true;
+ CSuccUBus *succubus = static_cast<CSuccUBus *>(msg->_character);
+ if (succubus)
+ CParrot::_v4 = 3;
+
+ return CCarry::UseWithCharMsg(msg);
}
bool CCarryParrot::ActMsg(CActMsg *msg) {
- // TODO
+ if (msg->_action == "FreeParrot" && (CParrot::_v4 == 4 || CParrot::_v4 == 1)) {
+ CTreeItem *treeItem = getRoot()->findByName(_string6);
+ if (treeItem)
+ trueTalkFn1(treeItem, 0x446BF, 0);
+
+ setVisible(false);
+ _fieldE0 = 0;
+
+ if (CParrot::_v4 == 4) {
+ CActMsg actMsg("Shut");
+ actMsg.execute("ParrotCage");
+ } else {
+ playSound("z#475.wav", 100, 0, 0);
+
+ if (!_field140) {
+ CCarry *feathers = static_cast<CCarry *>(getRoot()->findByName("Feathers"));
+ if (feathers) {
+ feathers->setVisible(true);
+ feathers->dropOnPet();
+ }
+
+ _field140 = true;
+ }
+
+ getPetControl()->removeFromInventory(this);
+ getPetControl()->setC8(true);
+ moveUnder(getRoom());
+ }
+
+ CParrot::_v4 = 2;
+ stopTimer(_timerId);
+ _timerId = 0;
+ }
+
return true;
}
diff --git a/engines/titanic/carry/carry_parrot.h b/engines/titanic/carry/carry_parrot.h
index fc1bbba255..1c5cc2e890 100644
--- a/engines/titanic/carry/carry_parrot.h
+++ b/engines/titanic/carry/carry_parrot.h
@@ -43,9 +43,9 @@ class CCarryParrot : public CCarry {
bool ActMsg(CActMsg *msg);
private:
CString _string6;
- int _field138;
+ int _timerId;
int _field13C;
- int _field140;
+ bool _field140;
int _field144;
int _field148;
int _field14C;