ScummVM API documentation
tattoo_people.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef SHERLOCK_TATTOO_PEOPLE_H
23 #define SHERLOCK_TATTOO_PEOPLE_H
24 
25 #include "common/scummsys.h"
26 #include "common/stack.h"
27 #include "sherlock/people.h"
28 
29 namespace Sherlock {
30 
31 class SherlockEngine;
32 
33 namespace Tattoo {
34 
35 // Animation sequence identifiers for characters
36 enum TattooSequences {
37  // Walk Sequences Numbers for NPCs
38  WALK_UP = 0,
39  WALK_UPRIGHT = 1,
40  WALK_RIGHT = 2,
41  WALK_DOWNRIGHT = 3,
42  WALK_DOWN = 4,
43  WALK_DOWNLEFT = 5,
44  WALK_LEFT = 6,
45  WALK_UPLEFT = 7,
46 
47  // Stop Sequences Numbers for NPCs
48  STOP_UP = 8,
49  STOP_UPRIGHT = 9,
50  STOP_RIGHT = 10,
51  STOP_DOWNRIGHT = 11,
52  STOP_DOWN = 12,
53  STOP_DOWNLEFT = 13,
54  STOP_LEFT = 14,
55  STOP_UPLEFT = 15,
56 
57  // NPC Talk Sequence Numbers
58  TALK_UPRIGHT = 16,
59  TALK_RIGHT = 17,
60  TALK_DOWNRIGHT = 18,
61  TALK_DOWNLEFT = 19,
62  TALK_LEFT = 20,
63  TALK_UPLEFT = 21,
64 
65  // NPC Listen Sequence Numbers
66  LISTEN_UPRIGHT = 22,
67  LISTEN_RIGHT = 23,
68  LISTEN_DOWNRIGHT = 24,
69  LISTEN_DOWNLEFT = 25,
70  LISTEN_LEFT = 26,
71  LISTEN_UPLEFT = 27
72 };
73 
74 enum NpcPath {
75  NPCPATH_SET_DEST = 1,
76  NPCPATH_PAUSE = 2,
77  NPCPATH_SET_TALK_FILE = 3,
78  NPCPATH_CALL_TALK_FILE = 4,
79  NPCPATH_TAKE_NOTES = 5,
80  NPCPATH_FACE_HOLMES = 6,
81  NPCPATH_PATH_LABEL = 7,
82  NPCPATH_GOTO_LABEL = 8,
83  NPCPATH_IFFLAG_GOTO_LABEL = 9
84 };
85 
86 struct SavedNPCPath {
87  byte _path[MAX_NPC_PATH];
88  int _npcIndex;
89  int _npcPause;
90  Point32 _position;
91  int _npcFacing;
92  bool _lookHolmes;
93 
94  SavedNPCPath();
95  SavedNPCPath(byte path[MAX_NPC_PATH], int npcIndex, int npcPause, const Point32 &position,
96  int npcFacing, bool lookHolmes);
97 };
98 
99 class TattooPerson: public Person {
100 private:
101  Point32 _nextDest;
102 private:
103  bool checkCollision() const;
104 
108  void freeAltGraphics();
109 protected:
113  Common::Point getSourcePoint() const override;
114 public:
115  Common::Stack<SavedNPCPath> _pathStack;
116  int _npcIndex;
117  int _npcPause;
118  byte _npcPath[MAX_NPC_PATH];
119  bool _npcMoved;
120  int _npcFacing;
121  bool _resetNPCPath;
122  int _savedNpcSequence;
123  int _savedNpcFrame;
124  int _tempX;
125  int _tempScaleVal;
126  bool _updateNPCPath;
127  bool _lookHolmes;
128 public:
129  TattooPerson();
130  ~TattooPerson() override;
131 
135  void clearNPC();
136 
145  void updateNPC();
146 
151  void pushNPCPath();
152 
165  void pullNPCPath();
166 
171  void checkWalkGraphics();
172 
176  void synchronize(Serializer &s);
177 
178 
182  void walkHolmesToNPC();
183 
187  void walkBothToCoords(const PositionFacing &holmesDest, const PositionFacing &npcDest);
188 
192  void adjustSprite() override;
193 
197  void gotoStand() override;
198 
203  void setWalking() override;
204 
208  void walkToCoords(const Point32 &destPos, int destDir) override;
209 
217  void setObjTalkSequence(int seq) override;
218 
222  void centerScreenOnPerson() override;
223 };
224 
225 class TattooPeople : public People {
226 public:
228  ~TattooPeople() override {}
229 
230  TattooPerson &operator[](PeopleId id) { return *(TattooPerson *)_data[id]; }
231  TattooPerson &operator[](int idx) { return *(TattooPerson *)_data[idx]; }
232 
236  void pullNPCPaths();
237 
241  int findSpeaker(int speaker) override;
242 
246  void synchronize(Serializer &s) override;
247 
251  void setTalkSequence(int speaker, int sequenceNum = 1) override;
252 
256  bool loadWalk() override;
257 
261  const Common::Point restrictToZone(int zoneId, const Common::Point &destPos) override;
262 
272  void setListenSequence(int speaker, int sequenceNum = 1) override;
273 };
274 
275 } // End of namespace Tattoo
276 
277 } // End of namespace Sherlock
278 
279 #endif
Definition: objects.h:120
Definition: animation.h:29
Definition: tattoo_people.h:86
Definition: serializer.h:79
Definition: sherlock.h:76
Definition: rect.h:45
Definition: tattoo_people.h:99
Definition: people.h:58
Definition: objects.h:101
Definition: tattoo_people.h:225
Definition: stack.h:102
Definition: people.h:98