aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Mettifogo2009-02-24 09:18:20 +0000
committerNicola Mettifogo2009-02-24 09:18:20 +0000
commit5dff53a2fa8d2f7314d23e229d3c79aa3c0fc3bc (patch)
tree2af6dea8863444fe458f40484c36a8728f00daa7
parent659c9fb901bcbc3db1252ed0c9a7eb49c09853b4 (diff)
downloadscummvm-rg350-5dff53a2fa8d2f7314d23e229d3c79aa3c0fc3bc.tar.gz
scummvm-rg350-5dff53a2fa8d2f7314d23e229d3c79aa3c0fc3bc.tar.bz2
scummvm-rg350-5dff53a2fa8d2f7314d23e229d3c79aa3c0fc3bc.zip
Added preliminary code for following walker support in BRA.
svn-id: r38837
-rw-r--r--engines/parallaction/exec_br.cpp8
-rw-r--r--engines/parallaction/exec_ns.cpp4
-rw-r--r--engines/parallaction/input.cpp2
-rw-r--r--engines/parallaction/parallaction.h11
-rw-r--r--engines/parallaction/parallaction_br.cpp25
-rw-r--r--engines/parallaction/parallaction_ns.cpp2
6 files changed, 37 insertions, 15 deletions
diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp
index adc89b8e94..09d8043ab7 100644
--- a/engines/parallaction/exec_br.cpp
+++ b/engines/parallaction/exec_br.cpp
@@ -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);
}
diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp
index b2922cedae..0c802f3249 100644
--- a/engines/parallaction/exec_ns.cpp
+++ b/engines/parallaction/exec_ns.cpp
@@ -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);
}
diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp
index b2bee2fce1..8dd17cd322 100644
--- a/engines/parallaction/input.cpp
+++ b/engines/parallaction/input.cpp
@@ -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() {
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index c332c5d860..55eeabfa85 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -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
diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index 4bb239d197..4cfada2bc7 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -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) {
- _walker->setFollowerPath(_follower, x, y);
+
+ 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
diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp
index 23df87b903..9cd8d5cf84 100644
--- a/engines/parallaction/parallaction_ns.cpp
+++ b/engines/parallaction/parallaction_ns.cpp
@@ -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) {