TITANIC: Change CParrot::_v4 to _state

This commit is contained in:
Paul Gilbert 2016-12-26 23:22:10 -05:00
parent a5f01bbfb8
commit 3603ed73f0
6 changed files with 41 additions and 36 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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;