aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2016-12-26 23:22:10 -0500
committerPaul Gilbert2016-12-26 23:22:10 -0500
commit3603ed73f0e95c286362f089ccffad42f2f40182 (patch)
tree756d8399e110ea75a88cec4c8554de67e0641d33 /engines
parenta5f01bbfb8ad72a983a08fb18ae940931702ccab (diff)
downloadscummvm-rg350-3603ed73f0e95c286362f089ccffad42f2f40182.tar.gz
scummvm-rg350-3603ed73f0e95c286362f089ccffad42f2f40182.tar.bz2
scummvm-rg350-3603ed73f0e95c286362f089ccffad42f2f40182.zip
TITANIC: Change CParrot::_v4 to _state
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/carry/carry_parrot.cpp22
-rw-r--r--engines/titanic/game/cage.cpp8
-rw-r--r--engines/titanic/game/parrot/parrot_perch_holder.cpp2
-rw-r--r--engines/titanic/game/tow_parrot_nav.cpp2
-rw-r--r--engines/titanic/npcs/parrot.cpp36
-rw-r--r--engines/titanic/npcs/parrot.h7
6 files changed, 41 insertions, 36 deletions
diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp
index 0f577211de..8b332610e2 100644
--- a/engines/titanic/carry/carry_parrot.cpp
+++ b/engines/titanic/carry/carry_parrot.cpp
@@ -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;
@@ -120,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());
@@ -147,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);
@@ -158,7 +158,7 @@ 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);
@@ -171,7 +171,7 @@ bool CCarryParrot::PassOnDragStartMsg(CPassOnDragStartMsg *msg) {
_fieldE0 = 0;
playSound("z#475.wav");
moveUnder(findRoom());
- CParrot::_v4 = 2;
+ CParrot::_state = PARROT_ESCAPED;
msg->_value4 = 1;
return true;
@@ -189,13 +189,13 @@ 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)) {
+ 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);
@@ -203,7 +203,7 @@ bool CCarryParrot::ActMsg(CActMsg *msg) {
setVisible(false);
_fieldE0 = 0;
- if (CParrot::_v4 == 4) {
+ if (CParrot::_state == PARROT_4) {
playSound("z#475.wav");
if (!_feathersFlag) {
@@ -225,7 +225,7 @@ bool CCarryParrot::ActMsg(CActMsg *msg) {
actMsg.execute("ParrotCage");
}
- CParrot::_v4 = 2;
+ CParrot::_state = PARROT_ESCAPED;
stopAnimTimer(_timerId);
_timerId = 0;
}
diff --git a/engines/titanic/game/cage.cpp b/engines/titanic/game/cage.cpp
index bbac384cea..11f5837e4c 100644
--- a/engines/titanic/game/cage.cpp
+++ b/engines/titanic/game/cage.cpp
@@ -53,7 +53,7 @@ void CCage::load(SimpleFile *file) {
}
bool CCage::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
- if (CParrot::_v4 && !CParrot::_v5) {
+ if (CParrot::_state != PARROT_IN_CAGE && !CParrot::_v5) {
CActMsg actMsg(_open ? "Open" : "Shut");
actMsg.execute(this);
}
@@ -88,7 +88,7 @@ bool CCage::MovieEndMsg(CMovieEndMsg *msg) {
_open = clipExistsByEnd("Shut", msg->_endFrame);
CStatusChangeMsg statusMsg;
- statusMsg._newStatus = _open ? 1 : (CParrot::_v4 == 0 ? 1 : 0);
+ statusMsg._newStatus = _open ? 1 : (CParrot::_state == PARROT_IN_CAGE ? 1 : 0);
statusMsg.execute("PerchCoreHolder");
return true;
@@ -96,14 +96,14 @@ bool CCage::MovieEndMsg(CMovieEndMsg *msg) {
bool CCage::PreEnterViewMsg(CPreEnterViewMsg *msg) {
loadSurface();
- _open = CParrot::_v4 != 0;
+ _open = CParrot::_state != PARROT_IN_CAGE;
loadFrame(_open ? 8 : 0);
return true;
}
bool CCage::MouseMoveMsg(CMouseMoveMsg *msg) {
- _cursorId = CParrot::_v4 && !CParrot::_v5 ? CURSOR_ACTIVATE : CURSOR_ARROW;
+ _cursorId = CParrot::_state != PARROT_IN_CAGE && !CParrot::_v5 ? CURSOR_ACTIVATE : CURSOR_ARROW;
return true;
}
diff --git a/engines/titanic/game/parrot/parrot_perch_holder.cpp b/engines/titanic/game/parrot/parrot_perch_holder.cpp
index ee1d308765..557f70437a 100644
--- a/engines/titanic/game/parrot/parrot_perch_holder.cpp
+++ b/engines/titanic/game/parrot/parrot_perch_holder.cpp
@@ -48,7 +48,7 @@ bool CParrotPerchHolder::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
if (!CParrot::_v1) {
if (CCage::_open) {
petDisplayMessage(CANNOT_TAKE_CAGE_LOCKED);
- } else if (!CParrot::_v4) {
+ } else if (CParrot::_state == PARROT_IN_CAGE) {
CTrueTalkTriggerActionMsg triggerMsg(280252, 0, 0);
triggerMsg.execute(getRoot(), CParrot::_type,
MSGFLAG_CLASS_DEF | MSGFLAG_BREAK_IF_HANDLED | MSGFLAG_SCAN);
diff --git a/engines/titanic/game/tow_parrot_nav.cpp b/engines/titanic/game/tow_parrot_nav.cpp
index 57f1649add..b8a99a5f1b 100644
--- a/engines/titanic/game/tow_parrot_nav.cpp
+++ b/engines/titanic/game/tow_parrot_nav.cpp
@@ -44,7 +44,7 @@ bool CTOWParrotNav::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
actMsg.execute("PerchedParrot");
CString clipString = "_EXIT,36,1,N,9,3,N";
- if (CParrot::_v4)
+ if (CParrot::_state != PARROT_IN_CAGE)
clipString += 'a';
changeView("ParrotLobby.Node 3.N", clipString);
diff --git a/engines/titanic/npcs/parrot.cpp b/engines/titanic/npcs/parrot.cpp
index 65c05e81a1..e039b15dfe 100644
--- a/engines/titanic/npcs/parrot.cpp
+++ b/engines/titanic/npcs/parrot.cpp
@@ -48,7 +48,7 @@ END_MESSAGE_MAP()
int CParrot::_v1;
int CParrot::_v2;
int CParrot::_v3;
-int CParrot::_v4;
+ParrotState CParrot::_state;
int CParrot::_v5;
CParrot::CParrot() : CTrueTalkNPC() {
@@ -131,7 +131,7 @@ void CParrot::save(SimpleFile *file, int indent) {
file->writeNumberLine(_newXc, indent);
file->writeNumberLine(_field12C, indent);
file->writeNumberLine(_field130, indent);
- file->writeNumberLine(_v4, indent);
+ file->writeNumberLine(_state, indent);
file->writeNumberLine(_v5, indent);
CTrueTalkNPC::save(file, indent);
@@ -155,7 +155,7 @@ void CParrot::load(SimpleFile *file) {
_newXc = file->readNumber();
_field12C = file->readNumber();
_field130 = file->readNumber();
- _v4 = file->readNumber();
+ _state = (ParrotState)file->readNumber();
_v5 = file->readNumber();
CTrueTalkNPC::load(file);
@@ -175,13 +175,13 @@ bool CParrot::ActMsg(CActMsg *msg) {
statusMsg.execute("PerchCoreHolder");
}
} else if (msg->_action == "StartChickenDrag") {
- if (!_v4) {
+ if (_state == PARROT_IN_CAGE) {
stopMovie();
startTalking(this, 280275, findView());
_field12C = 0;
}
} else if (msg->_action == "EnteringFromTOW" &&
- (_v4 == 0 || _v4 == 2)) {
+ (_state == PARROT_IN_CAGE || _state == PARROT_ESCAPED)) {
if (_v2) {
_v2 = 2;
} else {
@@ -190,7 +190,7 @@ bool CParrot::ActMsg(CActMsg *msg) {
detach();
attach(cageBar);
- _v4 = 0;
+ _state = PARROT_IN_CAGE;
CActMsg actMsg1("OpenNow");
actMsg1.execute("ParrotCage");
CActMsg actMsg2("GainParrot");
@@ -229,7 +229,7 @@ bool CParrot::MovieEndMsg(CMovieEndMsg *msg) {
}
_npcFlags &= ~NPCFLAG_2000000;
- _v4 = 2;
+ _state = PARROT_ESCAPED;
} else if (_npcFlags & NPCFLAG_10000) {
if (_npcFlags & NPCFLAG_20000) {
_npcFlags = (_npcFlags & ~NPCFLAG_20000) | NPCFLAG_40000;
@@ -347,7 +347,7 @@ bool CParrot::EnterViewMsg(CEnterViewMsg *msg) {
"Talking5", "Talking6", "Talking7", nullptr
};
- if (!_v4) {
+ if (_state == PARROT_IN_CAGE) {
setPosition(Point(_newXp, _bounds.top));
_field118 = 1;
_npcFlags &= ~(NPCFLAG_10000 | NPCFLAG_20000 | NPCFLAG_40000 | NPCFLAG_80000 | NPCFLAG_100000 | NPCFLAG_200000 | NPCFLAG_400000);
@@ -369,7 +369,7 @@ bool CParrot::EnterViewMsg(CEnterViewMsg *msg) {
}
bool CParrot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) {
- if (_v4 != 3) {
+ if (_state != PARROT_MAILED) {
CViewItem *view = msg->_param2 ? findView() : nullptr;
startTalking(this, msg->_action, view);
}
@@ -378,7 +378,7 @@ bool CParrot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) {
}
bool CParrot::MouseDragStartMsg(CMouseDragStartMsg *msg) {
- if (_field118 && !_v4 && checkPoint(msg->_mousePos, false, true)) {
+ if (_field118 && _state == PARROT_IN_CAGE && checkPoint(msg->_mousePos, false, true)) {
setVisible(false);
CRoomItem *room = findRoom();
@@ -416,7 +416,7 @@ bool CParrot::ParrotSpeakMsg(CParrotSpeakMsg *msg) {
"Lift", "ServiceElevator", "Dome", "Home", "MoonEmbLobby", nullptr
};
- if (!stateGetParrotMet() || _v4 == 3 || compareViewNameTo("Titania.Node 18.N"))
+ if (!stateGetParrotMet() || _state == PARROT_MAILED || compareViewNameTo("Titania.Node 18.N"))
return true;
// Check for rooms not to speak in
@@ -484,7 +484,7 @@ bool CParrot::NPCPlayTalkingAnimationMsg(CNPCPlayTalkingAnimationMsg *msg) {
};
if (!(_npcFlags & (NPCFLAG_10000 | NPCFLAG_20000 | NPCFLAG_40000 | NPCFLAG_80000 | NPCFLAG_100000 | NPCFLAG_200000 | NPCFLAG_400000))
- && _visible && !_v4) {
+ && _visible && _state == PARROT_IN_CAGE) {
if (!compareViewNameTo("ParrotLobby.Node 1.N"))
msg->_names = NAMES;
}
@@ -499,7 +499,7 @@ bool CParrot::NPCPlayIdleAnimationMsg(CNPCPlayIdleAnimationMsg *msg) {
};
if (!(_npcFlags & (NPCFLAG_10000 | NPCFLAG_20000 | NPCFLAG_40000 | NPCFLAG_80000 | NPCFLAG_100000 | NPCFLAG_200000 | NPCFLAG_400000))
- && _visible && !_v4 && !compareViewNameTo("ParrotLobby.Node 1.N")) {
+ && _visible && _state == PARROT_IN_CAGE && !compareViewNameTo("ParrotLobby.Node 1.N")) {
CGameObject *dragItem = getDraggingObject();
if (!dragItem || dragItem->getName() == "Chicken") {
if (!_v5 ||getRandomNumber(3) != 0) {
@@ -566,7 +566,7 @@ bool CParrot::NPCPlayIdleAnimationMsg(CNPCPlayIdleAnimationMsg *msg) {
bool CParrot::FrameMsg(CFrameMsg *msg) {
if (!compareViewNameTo("ParrotLobby.Node 1.N"))
return false;
- if (_v4)
+ if (_state != PARROT_IN_CAGE)
return true;
Point pt = getMousePos();
@@ -709,7 +709,7 @@ bool CParrot::PutParrotBackMsg(CPutParrotBackMsg *msg) {
int xp = CLIP(msg->_value, 230, 480);
setVisible(true);
moveToView();
- _v4 = 0;
+ _state = PARROT_IN_CAGE;
setPosition(Point(xp - _bounds.width() / 2, _bounds.top));
playRandomClip(NAMES, MOVIE_NOTIFY_OBJECT);
@@ -721,7 +721,7 @@ bool CParrot::PutParrotBackMsg(CPutParrotBackMsg *msg) {
}
bool CParrot::PreEnterViewMsg(CPreEnterViewMsg *msg) {
- if (!_v4) {
+ if (_state == PARROT_IN_CAGE) {
loadMovie("z167.avi", false);
loadFrame(0);
}
@@ -730,7 +730,7 @@ bool CParrot::PreEnterViewMsg(CPreEnterViewMsg *msg) {
}
bool CParrot::PanningAwayFromParrotMsg(CPanningAwayFromParrotMsg *msg) {
- if (_v4) {
+ if (_state != PARROT_IN_CAGE) {
CActMsg actMsg("PanAwayFromParrot");
actMsg.execute(msg->_target);
_panTarget = nullptr;
@@ -750,7 +750,7 @@ bool CParrot::PanningAwayFromParrotMsg(CPanningAwayFromParrotMsg *msg) {
}
bool CParrot::LeaveRoomMsg(CLeaveRoomMsg *msg) {
- if (!_v4)
+ if (_state == PARROT_IN_CAGE)
startTalking(this, 280259);
return true;
diff --git a/engines/titanic/npcs/parrot.h b/engines/titanic/npcs/parrot.h
index 66a199efc1..ce0397fb71 100644
--- a/engines/titanic/npcs/parrot.h
+++ b/engines/titanic/npcs/parrot.h
@@ -28,6 +28,11 @@
namespace Titanic {
+enum ParrotState {
+ PARROT_IN_CAGE = 0, PARROT_1 = 1, PARROT_ESCAPED = 2,
+ PARROT_MAILED = 3, PARROT_4 = 4
+};
+
class CParrot : public CTrueTalkNPC {
DECLARE_MESSAGE_MAP;
bool ActMsg(CActMsg *msg);
@@ -50,7 +55,7 @@ public:
static int _v1;
static int _v2;
static int _v3;
- static int _v4;
+ static ParrotState _state;
static int _v5;
private:
int _field108;