From 14f268513487f0eafbe1cbf7c9b7b928d77a6148 Mon Sep 17 00:00:00 2001 From: Robert Špalek Date: Wed, 4 Nov 2009 00:42:37 +0000 Subject: 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 --- engines/draci/walking.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'engines/draci/walking.h') 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; -- cgit v1.2.3