ScummVM API documentation
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_PEOPLE_H
23 #define SHERLOCK_PEOPLE_H
24 
25 #include "common/scummsys.h"
26 #include "common/queue.h"
27 #include "sherlock/objects.h"
28 #include "sherlock/saveload.h"
29 
30 namespace Sherlock {
31 
32 enum PeopleId {
33  HOLMES = 0,
34  WATSON = 1,
35  MAX_NPC_PATH = 200
36 };
37 
38 enum {
39  MAP_UP = 1, MAP_UPRIGHT = 2, MAP_RIGHT = 1, MAP_DOWNRIGHT = 4,
40  MAP_DOWN = 5, MAP_DOWNLEFT = 6, MAP_LEFT = 2, MAP_UPLEFT = 8
41 };
42 
43 #define NUM_IN_WALK_LIB 10
44 extern const char *const WALK_LIB_NAMES[10];
45 
46 #define MAX_CHARACTERS (IS_SERRATED_SCALPEL ? 1 : 6)
47 
48 struct PersonData {
49  const char *_name;
50  const char *_portrait;
51  const byte *_stillSequences;
52  const byte *_talkSequences;
53 
54  PersonData(const char *name, const char *portrait, const byte *stillSequences, const byte *talkSequences) :
55  _name(name), _portrait(portrait), _stillSequences(stillSequences), _talkSequences(talkSequences) {}
56 };
57 
58 class Person : public Sprite {
59 protected:
63  virtual Common::Point getSourcePoint() const = 0;
64 public:
66  int _srcZone, _destZone;
67  bool _walkLoaded;
68  Common::String _portrait;
69  Common::Point _walkDest;
70  Common::String _npcName;
71 
72  // Rose Tattoo fields
73  Common::Path _walkVGSName; // Name of walk library person is using
74 public:
75  Person();
76  ~Person() override {}
77 
83  void goAllTheWay();
84 
88  virtual void walkToCoords(const Point32 &destPos, int destDir) = 0;
89 
93  virtual void centerScreenOnPerson() {}
94 };
95 
96 class SherlockEngine;
97 
98 class People {
99 protected:
100  SherlockEngine *_vm;
102 
103  People(SherlockEngine *vm);
104 public:
105  Common::Array<PersonData> _characters;
106  ImageFile *_talkPics;
107  PositionFacing _savedPos;
108  bool _holmesOn;
109  bool _portraitLoaded;
110  bool _portraitsOn;
111  Object _portrait;
112  bool _clearingThePortrait;
113  bool _allowWalkAbort;
114  int _portraitSide;
115  bool _speakerFlip;
116  bool _holmesFlip;
117  int _holmesQuotient;
118  bool _forceWalkReload;
119  bool _useWalkLib;
120 
121  int _walkControl;
122 public:
123  static People *init(SherlockEngine *vm);
124  virtual ~People();
125 
126  Person &operator[](PeopleId id) { return *_data[id]; }
127  Person &operator[](int idx) { return *_data[idx]; }
128 
132  void reset();
133 
137  bool freeWalk();
138 
142  void clearTalking();
143 
147  virtual int findSpeaker(int speaker);
148 
152  virtual void synchronize(Serializer &s) = 0;
153 
157  virtual void setTalkSequence(int speaker, int sequenceNum = 1) = 0;
158 
162  virtual bool loadWalk() = 0;
163 
167  virtual const Common::Point restrictToZone(int zoneId, const Common::Point &destPos) = 0;
168 
178  virtual void setListenSequence(int speaker, int sequenceNum = 1) = 0;
179 };
180 
181 } // End of namespace Sherlock
182 
183 #endif
Definition: objects.h:120
Definition: str.h:59
Definition: people.h:48
Definition: animation.h:29
Definition: path.h:52
Definition: serializer.h:79
virtual void centerScreenOnPerson()
Definition: people.h:93
Definition: sherlock.h:76
Definition: rect.h:45
Definition: objects.h:363
Definition: people.h:58
Definition: image_file.h:78
Definition: objects.h:101
Definition: objects.h:280
Definition: people.h:98