Added preliminary code for following walker support in BRA.

svn-id: r38837
This commit is contained in:
Nicola Mettifogo 2009-02-24 09:18:20 +00:00
parent 659c9fb901
commit 5dff53a2fa
6 changed files with 37 additions and 15 deletions

View file

@ -154,7 +154,7 @@ DECLARE_COMMAND_OPCODE(drop) {
DECLARE_COMMAND_OPCODE(move) {
_vm->scheduleWalk(_ctxt.cmd->u._move.x, _ctxt.cmd->u._move.y);
_vm->scheduleWalk(_ctxt.cmd->u._move.x, _ctxt.cmd->u._move.y, false);
suspend();
}
@ -174,7 +174,11 @@ DECLARE_COMMAND_OPCODE(character) {
DECLARE_COMMAND_OPCODE(followme) {
warning("Parallaction_br::cmdOp_followme not yet implemented");
Common::String s(_ctxt.cmd->u._string);
if (!s.compareToIgnoreCase("NULL")) {
s.clear();
}
_vm->setFollower(s);
}

View file

@ -175,7 +175,7 @@ DECLARE_INSTRUCTION_OPCODE(move) {
int16 x = inst->_opA.getValue();
int16 y = inst->_opB.getValue();
_vm->scheduleWalk(x, y);
_vm->scheduleWalk(x, y, false);
}
DECLARE_INSTRUCTION_OPCODE(endscript) {
@ -286,7 +286,7 @@ DECLARE_COMMAND_OPCODE(quit) {
DECLARE_COMMAND_OPCODE(move) {
_vm->scheduleWalk(_ctxt.cmd->u._move.x, _ctxt.cmd->u._move.y);
_vm->scheduleWalk(_ctxt.cmd->u._move.x, _ctxt.cmd->u._move.y, false);
}

View file

@ -269,7 +269,7 @@ void Input::takeAction(ZonePtr z) {
void Input::walkTo(const Common::Point &dest) {
stopHovering();
setArrowCursor();
_vm->scheduleWalk(dest.x, dest.y);
_vm->scheduleWalk(dest.x, dest.y, true);
}
bool Input::translateGameInput() {

View file

@ -367,7 +367,7 @@ public:
virtual void runPendingZones() = 0;
virtual void cleanupGame() = 0;
virtual void updateWalkers() = 0;
virtual void scheduleWalk(int16 x, int16 y) = 0;
virtual void scheduleWalk(int16 x, int16 y, bool fromUser) = 0;
virtual DialogueManager *createDialogueManager(ZonePtr z) = 0;
};
@ -391,7 +391,7 @@ public:
virtual void runPendingZones();
virtual void cleanupGame();
virtual void updateWalkers();
virtual void scheduleWalk(int16 x, int16 y);
virtual void scheduleWalk(int16 x, int16 y, bool fromUser);
virtual DialogueManager *createDialogueManager(ZonePtr z);
@ -490,8 +490,7 @@ public:
virtual void runPendingZones();
virtual void cleanupGame();
virtual void updateWalkers();
virtual void scheduleWalk(int16 x, int16 y);
virtual void scheduleWalk(int16 x, int16 y, bool fromUser);
virtual DialogueManager *createDialogueManager(ZonePtr z);
void setupSubtitles(char *s, char *s2, int y);
@ -504,6 +503,8 @@ public:
int getCounterValue(const Common::String &name);
void setCounterValue(const Common::String &name, int value);
void setFollower(const Common::String &name);
const char **_audioCommandsNamesRes;
static const char *_partNames[];
int _part;
@ -537,6 +538,8 @@ private:
const Callable *_callables;
static const Callable _dosCallables[6];
Common::String _followerName;
AnimationPtr _follower;
PathWalker_BR *_walker;
// dos callables

View file

@ -261,6 +261,8 @@ void Parallaction_br::changeLocation(char *location) {
// load new location
parseLocation(location);
setFollower(_followerName);
if (_location._startPosition.x != -1000) {
_char.setFoot(_location._startPosition);
_char._ani->setF(_location._startFrame);
@ -401,7 +403,7 @@ void Parallaction_br::updateWalkers() {
_walker->walk();
}
void Parallaction_br::scheduleWalk(int16 x, int16 y) {
void Parallaction_br::scheduleWalk(int16 x, int16 y, bool fromUser) {
AnimationPtr a = _char._ani;
if ((a->_flags & kFlagsRemove) || (a->_flags & kFlagsActive) == 0) {
@ -409,13 +411,26 @@ void Parallaction_br::scheduleWalk(int16 x, int16 y) {
}
_walker->setCharacterPath(a, x, y);
#if 0
if (_follower && _userEvent) {
if (!fromUser) {
_walker->stopFollower();
} else {
if (_follower) {
_walker->setFollowerPath(_follower, x, y);
}
#endif
}
_engineFlags |= kEngineWalking;
}
void Parallaction_br::setFollower(const Common::String &name) {
if (name.empty()) {
_followerName.clear();
_follower.reset();
} else {
_followerName = name;
_follower = _location.findAnimation(name.c_str());
}
}
} // namespace Parallaction

View file

@ -497,7 +497,7 @@ void Parallaction_ns::updateWalkers() {
}
void Parallaction_ns::scheduleWalk(int16 x, int16 y) {
void Parallaction_ns::scheduleWalk(int16 x, int16 y, bool fromUser) {
AnimationPtr a = _char._ani;
if ((a->_flags & kFlagsRemove) || (a->_flags & kFlagsActive) == 0) {