aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/tattoo/tattoo_people.h
diff options
context:
space:
mode:
authorPaul Gilbert2015-06-17 22:04:52 -0400
committerPaul Gilbert2015-06-17 22:04:52 -0400
commit94d7928dbc7ea1d2de0e82f69a3b5d255f2319fd (patch)
treeca08be388ea7f197a4a317c23d6b6cdf666d5911 /engines/sherlock/tattoo/tattoo_people.h
parent65b794a7505aeb5ab1667e8fd9ac5de687478757 (diff)
downloadscummvm-rg350-94d7928dbc7ea1d2de0e82f69a3b5d255f2319fd.tar.gz
scummvm-rg350-94d7928dbc7ea1d2de0e82f69a3b5d255f2319fd.tar.bz2
scummvm-rg350-94d7928dbc7ea1d2de0e82f69a3b5d255f2319fd.zip
SHERLOCK: RT: Implemented pullNPCPath
Diffstat (limited to 'engines/sherlock/tattoo/tattoo_people.h')
-rw-r--r--engines/sherlock/tattoo/tattoo_people.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/engines/sherlock/tattoo/tattoo_people.h b/engines/sherlock/tattoo/tattoo_people.h
index 36027fd9cb..1abf2d5350 100644
--- a/engines/sherlock/tattoo/tattoo_people.h
+++ b/engines/sherlock/tattoo/tattoo_people.h
@@ -24,6 +24,7 @@
#define SHERLOCK_TATTOO_PEOPLE_H
#include "common/scummsys.h"
+#include "common/stack.h"
#include "sherlock/people.h"
namespace Sherlock {
@@ -83,6 +84,19 @@ enum NpcPath {
NPCPATH_IFFLAG_GOTO_LABEL = 9
};
+struct SavedNPCPath {
+ byte _path[MAX_NPC_PATH];
+ int _npcIndex;
+ int _npcPause;
+ Common::Point _walkDest;
+ int _npcFacing;
+ bool _lookHolmes;
+
+ SavedNPCPath();
+ SavedNPCPath(byte path[MAX_NPC_PATH], int npcIndex, int npcPause, const Common::Point &walkDest,
+ int npcFacing, bool lookHolmes);
+};
+
class TattooPerson: public Person {
private:
Point32 _nextDest;
@@ -99,8 +113,8 @@ protected:
*/
virtual Common::Point getSourcePoint() const;
public:
+ Common::Stack<SavedNPCPath> _pathStack;
int _npcIndex;
- int _npcStack;
int _npcPause;
byte _npcPath[MAX_NPC_PATH];
Common::String _npcName;
@@ -139,6 +153,20 @@ public:
void pushNPCPath();
/**
+ * Pull an NPC's path data that has been previously saved on the path stack for that character.
+ * There are two possibilities for when the NPC was interrupted, and both are handled differently:
+ * 1) The NPC was paused at a position
+ * If the NPC didn't move, we can just restore his pause counter and exit. But if he did move,
+ * he must return to that position, and the path index must be reset to the pause he was executing.
+ * This means that the index must be decremented by 3
+ * 2) The NPC was in route to a position
+ * He must be set to walk to that position again. This is done by moving the path index
+ * so that it points to the code that set the NPC walking there in the first place.
+ * The regular calls to updateNPC will handle the rest
+ */
+ void pullNPCPath();
+
+ /**
* Checks a sprite associated with an NPC to see if the frame sequence specified
* in the sequence number uses alternate graphics, and if so if they need to be loaded
*/