ScummVM API documentation
floor.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 #ifndef SLUDGE_FLOOR_H
22 #define SLUDGE_FLOOR_H
23 
24 namespace Common {
25 struct Point;
26 class SeekableReadStream;
27 class WriteStream;
28 }
29 
30 namespace Sludge {
31 
32 class SludgeEngine;
33 struct OnScreenPerson;
34 
35 struct FloorPolygon {
36  int numVertices;
37  int *vertexID;
38 };
39 
40 struct Floor {
41  int originalNum;
42  Common::Point *vertex;
43  int numPolygons;
44  FloorPolygon *polygon;
45  int **matrix;
46 };
47 
48 class FloorManager {
49 public:
51  ~FloorManager();
52 
53  bool init();
54  void kill();
55 
56  void setFloorNull();
57  bool setFloor(int fileNum);
58  void drawFloor();
59  int inFloor(int x, int y);
60  bool isFloorNoPolygon() { return !_currentFloor || _currentFloor->numPolygons == 0; }
61 
62  // For Person collision detection
63  bool handleClosestPoint(int &setX, int &setY, int &setPoly);
64  bool doBorderStuff(OnScreenPerson *moveMe);
65 
66  // Save & load
67  void save(Common::WriteStream *stream);
68  bool load(Common::SeekableReadStream *stream);
69 
70 private:
71  Floor *_currentFloor;
72  SludgeEngine *_vm;
73 
74  bool getMatchingCorners(FloorPolygon &, FloorPolygon &, int &, int &);
75  bool closestPointOnLine(int &closestX, int &closestY, int x1, int y1, int x2, int y2, int xP, int yP);
76  bool pointInFloorPolygon(FloorPolygon &floorPoly, int x, int y);
77  bool polysShareSide(FloorPolygon &a, FloorPolygon &b);
78  void dumpFloor(int fileNum);
79 };
80 
81 } // End of namespace Sludge
82 
83 #endif
Definition: people.h:76
Definition: stream.h:77
Definition: display_client.h:58
Definition: stream.h:745
Definition: sludge.h:68
Definition: builtin.h:27
Definition: algorithm.h:29
Definition: rect.h:45
Definition: floor.h:40
Definition: floor.h:35
Definition: floor.h:48