ScummVM API documentation
route.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 /*
23  * This code is based on original Hugo Trilogy source code
24  *
25  * Copyright (c) 1989-1995 David P. Gray
26  *
27  */
28 
29 #ifndef HUGO_ROUTE_H
30 #define HUGO_ROUTE_H
31 
32 #include "common/rect.h"
33 
34 namespace Hugo {
35 
39 enum RouteType {kRouteSpace, kRouteExit, kRouteLook, kRouteGet};
40 
41 struct Segment { // Search segment
42  int16 _y; // y position
43  int16 _x1, _x2; // Range of segment
44 };
45 
46 class Route {
47 public:
48  Route(HugoEngine *vm);
49 
50  void resetRoute();
51  int16 getRouteIndex() const;
52 
53  void processRoute();
54  bool startRoute(const RouteType routeType, const int16 objId, int16 cx, int16 cy);
55  void setDirection(const uint16 direction);
56  void setWalk(const uint16 direction);
57 
58 private:
59  HugoEngine *_vm;
60 
61  static const int kMapBound = 1; // Mark a boundary outline
62  static const int kMapFill = 2; // Mark a boundary filled
63  static const int kMaxSeg = 256; // Maximum number of segments
64  static const int kMaxNodes = 256; // Maximum nodes in route
65 
66  uint16 _oldWalkDirection; // Last direction char
67 
68  int16 _routeIndex; // Index into route list, or -1
69  RouteType _routeType; // Purpose of an automatic route
70  int16 _routeObjId; // Index of exit of object walking to
71 
72  byte _boundaryMap[kYPix][kXPix]; // Boundary byte map
73  Segment _segment[kMaxSeg]; // List of points in fill-path
74  Common::Point _route[kMaxNodes]; // List of nodes in route (global)
75  int16 _segmentNumb; // Count number of segments
76  int16 _routeListIndex; // Index into route list
77  int16 _destX;
78  int16 _destY;
79  int16 _heroWidth; // Hero width
80  bool _routeFoundFl; // TRUE when path found
81  bool _fullSegmentFl; // Segments exhausted
82 
83  // CHECKME: Never set to true, could be removed
84  bool _fullStackFl; // TRUE if stack exhausted
85 
86  void segment(int16 x, int16 y);
87  bool findRoute(const int16 cx, const int16 cy);
88  Common::Point *newNode();
89 };
90 
91 } // End of namespace Hugo
92 
93 #endif //HUGO_ROUTE_H
Definition: console.h:27
Definition: route.h:46
Definition: rect.h:45
Definition: route.h:41
RouteType
Definition: route.h:39
Definition: hugo.h:210