3 // (C) 1997-2007 Christopher J. Madsen
4 // (C) 2019 James Hammons
6 // GUEmap is licensed under either version 2 of the GPL, or (at your option)
7 // any later version. See LICENSE file for details.
21 #define ASSERT(x) assert(x)
25 typedef uint16_t RoomNum;
26 typedef uint8_t EdgeType;
27 typedef uint8_t RoomFlags;
30 gridX = 120, // PORT 0.25 in
31 gridY = 72, // PORT 0.15 in
34 roomWidth = 3 * gridX,
35 roomHeight = 3 * gridY;
49 etNoRoom2 = etNoExit | etUnexplored | etLoopBack,
50 etSpecial = etObstructed | etNoExit | etOneWay | etUnexplored | etLoopBack;
60 rcNE, rcNW, rcSE, rcSW,
61 rcNNE, rcNNW, rcSSE, rcSSW,
64 rcUp = rcNumCorners, rcDown, rcIn, rcOut,
71 RoomCorner end1, end2;
72 EdgeType type1, type2;
75 MapEdge(RoomNum r1, RoomNum r2, EdgeType t1, EdgeType t2, RoomCorner e1, RoomCorner e2);
78 MapEdge Swapped(void) const;
79 bool HasRoom(RoomNum);
86 MapPage(): pos(0, 0) {}
87 bool operator==(const MapPage & o) const { return pos == o.pos; }
98 MapRoom(const MapRoom & o);
99 MapRoom & operator=(const MapRoom & source);
101 QRect getTranslatedRect(QPoint);
102 QPoint GetCenter(void);
103 RoomFlags isCorner(void) const;
104 bool operator!=(const MapRoom & mr) const;
108 typedef string::size_type StrIdx;
109 typedef string::iterator StrItr;
110 typedef string::const_iterator StrConstItr;
112 typedef vector<uint8_t> ByteVec;
113 typedef ByteVec::iterator ByteItr;
114 typedef ByteVec::const_iterator ByteConstItr;
115 //typedef ByteVec::size_type VecSize;
117 typedef vector<uint16_t> WordVec;
119 typedef vector<MapEdge> EdgeVec;
120 typedef EdgeVec::iterator EdgeItr;
121 typedef EdgeVec::const_iterator EdgeConstItr;
123 typedef vector<MapPage> PageVec;
124 typedef PageVec::iterator PageItr;
125 typedef PageVec::const_iterator PageConstItr;
127 typedef vector<MapRoom *> RoomVec;
128 typedef RoomVec::iterator RoomItr;
129 typedef RoomVec::const_iterator RoomConstItr;
130 //typedef Array<MapRoom, RoomVec> RoomArray;
132 typedef ByteVec PageNumVec;
133 typedef ByteVec::iterator PNItr;
134 typedef ByteVec::const_iterator PNConstItr;
136 typedef WordVec RoomNumVec;
137 typedef WordVec::iterator RNItr;
138 typedef WordVec::const_iterator RNConstItr;
142 // Exported functions
143 void trimLeft(string & s);
144 void trimRight(string & s);
145 QAction * CreateAction(QString name, QString tooltip, QString statustip,
146 QIcon icon, QKeySequence key, bool checkable = false, QObject * parent = 0);
147 QAction * CreateAction(QString name, QString tooltip, QString statustip,
148 QIcon icon, QKeySequence key1, QKeySequence key2, bool checkable = false,
149 QObject * parent = 0);
150 double Magnitude(QPointF);
151 QPointF UnitVector(QPointF);
152 double Angle(QPointF);
153 double Angle(QPoint);
154 double Dot(QPointF, QPointF);
155 double Determinant(QPointF, QPointF);
156 double ParameterOfLineAndPoint(QPointF tail, QPointF head, QPointF point);
158 #endif // __GLOBALS_H__