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) { 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(); suspend();
} }
@ -174,7 +174,11 @@ DECLARE_COMMAND_OPCODE(character) {
DECLARE_COMMAND_OPCODE(followme) { 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 x = inst->_opA.getValue();
int16 y = inst->_opB.getValue(); int16 y = inst->_opB.getValue();
_vm->scheduleWalk(x, y); _vm->scheduleWalk(x, y, false);
} }
DECLARE_INSTRUCTION_OPCODE(endscript) { DECLARE_INSTRUCTION_OPCODE(endscript) {
@ -286,7 +286,7 @@ DECLARE_COMMAND_OPCODE(quit) {
DECLARE_COMMAND_OPCODE(move) { 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) { void Input::walkTo(const Common::Point &dest) {
stopHovering(); stopHovering();
setArrowCursor(); setArrowCursor();
_vm->scheduleWalk(dest.x, dest.y); _vm->scheduleWalk(dest.x, dest.y, true);
} }
bool Input::translateGameInput() { bool Input::translateGameInput() {

View file

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

View file

@ -261,6 +261,8 @@ void Parallaction_br::changeLocation(char *location) {
// load new location // load new location
parseLocation(location); parseLocation(location);
setFollower(_followerName);
if (_location._startPosition.x != -1000) { if (_location._startPosition.x != -1000) {
_char.setFoot(_location._startPosition); _char.setFoot(_location._startPosition);
_char._ani->setF(_location._startFrame); _char._ani->setF(_location._startFrame);
@ -401,7 +403,7 @@ void Parallaction_br::updateWalkers() {
_walker->walk(); _walker->walk();
} }
void Parallaction_br::scheduleWalk(int16 x, int16 y) { void Parallaction_br::scheduleWalk(int16 x, int16 y, bool fromUser) {
AnimationPtr a = _char._ani; AnimationPtr a = _char._ani;
if ((a->_flags & kFlagsRemove) || (a->_flags & kFlagsActive) == 0) { 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); _walker->setCharacterPath(a, x, y);
#if 0
if (_follower && _userEvent) { if (!fromUser) {
_walker->setFollowerPath(_follower, x, y); _walker->stopFollower();
} else {
if (_follower) {
_walker->setFollowerPath(_follower, x, y);
}
} }
#endif
_engineFlags |= kEngineWalking; _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 } // 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; AnimationPtr a = _char._ani;
if ((a->_flags & kFlagsRemove) || (a->_flags & kFlagsActive) == 0) { if ((a->_flags & kFlagsRemove) || (a->_flags & kFlagsActive) == 0) {