aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/walking.h
diff options
context:
space:
mode:
authorRobert Špalek2009-11-04 00:42:37 +0000
committerRobert Špalek2009-11-04 00:42:37 +0000
commit14f268513487f0eafbe1cbf7c9b7b928d77a6148 (patch)
tree7a6829fd0cae0a2b66c75eae36b6914023387c3c /engines/draci/walking.h
parent692aea8e8d09163da3e05181784fd0b79efea8af (diff)
downloadscummvm-rg350-14f268513487f0eafbe1cbf7c9b7b928d77a6148.tar.gz
scummvm-rg350-14f268513487f0eafbe1cbf7c9b7b928d77a6148.tar.bz2
scummvm-rg350-14f268513487f0eafbe1cbf7c9b7b928d77a6148.zip
Implemented and debugged the walking framework.
The hero does not walk yet (it still teleports to the target immediately), but that is just because the actual walking algorithm is left trivial first. However, the main game loop, callbacks, and waiting all already work with the general framework. svn-id: r45648
Diffstat (limited to 'engines/draci/walking.h')
-rw-r--r--engines/draci/walking.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/engines/draci/walking.h b/engines/draci/walking.h
index 4e368fdfe5..bc53231d5a 100644
--- a/engines/draci/walking.h
+++ b/engines/draci/walking.h
@@ -99,21 +99,32 @@ struct GPL2Program;
class WalkingState {
public:
- explicit WalkingState(DraciEngine *vm) : _vm(vm) { clearPath(); }
+ explicit WalkingState(DraciEngine *vm) : _vm(vm) { stopWalking(); }
~WalkingState() {}
- void clearPath();
- void setPath(const Common::Point &p1, const Common::Point &p2, const Common::Point &mouse, const Common::Point &delta, const WalkingPath& path);
+ void stopWalking();
+ void startWalking(const Common::Point &p1, const Common::Point &p2,
+ const Common::Point &mouse, SightDirection dir,
+ const Common::Point &delta, const WalkingPath& path);
const WalkingPath& getPath() const { return _path; }
void setCallback(const GPL2Program *program, uint16 offset);
void callback();
+ bool isActive() const { return _path.size() > 0; }
+
+ // Advances the hero along the path and changes animation accordingly.
+ // Walking MUST be active when calling this method. When the hero has
+ // arrived to the target, clears the path and returns false, but leaves
+ // the callback untouched (the caller must call it).
+ bool continueWalking();
+
private:
DraciEngine *_vm;
WalkingPath _path;
Common::Point _mouse;
+ SightDirection _dir;
const GPL2Program *_callback;
uint16 _callbackOffset;