aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/walking.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/draci/walking.cpp')
-rw-r--r--engines/draci/walking.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/engines/draci/walking.cpp b/engines/draci/walking.cpp
index 87cd1b3284..f50a90732a 100644
--- a/engines/draci/walking.cpp
+++ b/engines/draci/walking.cpp
@@ -27,6 +27,8 @@
#include "common/stream.h"
+#include "draci/animation.h"
+#include "draci/draci.h"
#include "draci/walking.h"
#include "draci/sprite.h"
@@ -420,8 +422,15 @@ bool WalkingMap::managedToOblique(WalkingPath *path) const {
return improved;
}
-void WalkingState::setPath(const Common::Point &p1, const Common::Point &p2, const Common::Point &delta, const WalkingPath& path) {
+void WalkingState::clearPath() {
+ _path.clear();
+ _callback = NULL;
+}
+
+void WalkingState::setPath(const Common::Point &p1, const Common::Point &p2, const Common::Point &mouse, const Common::Point &delta, const WalkingPath& path) {
_path = path;
+ _mouse = mouse;
+
if (!_path.size()) {
return;
}
@@ -443,4 +452,26 @@ void WalkingState::setPath(const Common::Point &p1, const Common::Point &p2, con
}
}
+void WalkingState::setCallback(const GPL2Program *program, uint16 offset) {
+ _callback = program;
+ _callbackOffset = offset;
+}
+
+void WalkingState::callback() {
+ if (!_callback) {
+ return;
+ }
+
+ // Fetch the dedicated objects' title animation / current frame
+ Animation *titleAnim = _vm->_anims->getAnimation(kTitleText);
+ Text *title = reinterpret_cast<Text *>(titleAnim->getCurrentFrame());
+
+ _vm->_mouse->cursorOff();
+ titleAnim->markDirtyRect(_vm->_screen->getSurface());
+ title->setText("");
+
+ _vm->_script->run(*_callback, _callbackOffset);
+ _vm->_mouse->cursorOn();
+}
+
}