ScummVM API documentation
walk_mgr.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 PINK_WALK_MGR_H
23 #define PINK_WALK_MGR_H
24 
25 #include "common/rect.h"
26 
27 #include "pink/objects/object.h"
28 #include "pink/objects/walk/walk_shortest_path.h"
29 #include "pink/utils.h"
30 
31 namespace Pink {
32 
33 class WalkLocation;
34 class LeadActor;
35 class WalkAction;
36 
37 struct Coordinates {
38  Common::Point point;
39  int z;
40 };
41 
42 class WalkMgr : public Object {
43 public:
44  WalkMgr();
45  ~WalkMgr() override;
46  void deserialize(Archive &archive) override;
47  void toConsole() const override;
48 
49  WalkLocation *findLocation(const Common::String &name);
50  void start(WalkLocation *destination);
51  void update();
52 
53  double getLengthBetweenLocations(WalkLocation *first, WalkLocation *second);
54  void setCurrentWayPoint(WalkLocation *location);
55 
56  void loadState(Archive &archive);
57  void saveState(Archive &archive);
58 
59  void skip();
60 
61  const Coordinates &getStartCoords() { return _current.coords; }
62  const Coordinates &getEndCoords() { return _next.coords; }
63 
64 private:
65  struct WayPoint {
66  Common::String name;
67  Coordinates coords;
68  };
69 
70  Coordinates getLocationCoordinates(const Common::String &locationName);
71  void end();
72  void initNextWayPoint(WalkLocation *location);
73  WalkAction *getWalkAction();
74 
75  LeadActor *_leadActor;
76  WalkLocation *_destination;
77  Array<WalkLocation *> _locations;
78  WayPoint _current;
79  WayPoint _next;
80  bool _isWalking;
81 };
82 
83 } // End of namespace Pink
84 
85 #endif
Definition: archive.h:39
Definition: str.h:59
Definition: walk_action.h:29
Definition: walk_location.h:28
Definition: walk_mgr.h:37
Definition: object.h:31
Definition: archive.h:35
Definition: lead_actor.h:41
Definition: rect.h:45
Definition: utils.h:30
Definition: walk_mgr.h:42