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);
77 MapEdge Swapped(void) const;
78 bool HasRoom(RoomNum);
85 MapPage(): pos(0, 0) {}
86 bool operator==(const MapPage & o) const { return pos == o.pos; }
97 MapRoom(const MapRoom & o);
98 MapRoom & operator=(const MapRoom & source);
100 QRect getTranslatedRect(QPoint);
101 QPoint GetCenter(void);
102 RoomFlags isCorner(void) const;
103 bool operator!=(const MapRoom & mr) const;
107 typedef string::size_type StrIdx;
108 typedef string::iterator StrItr;
109 typedef string::const_iterator StrConstItr;
111 typedef vector<uint8_t> ByteVec;
112 typedef ByteVec::iterator ByteItr;
113 typedef ByteVec::const_iterator ByteConstItr;
114 //typedef ByteVec::size_type VecSize;
116 typedef vector<uint16_t> WordVec;
118 typedef vector<MapEdge> EdgeVec;
119 typedef EdgeVec::iterator EdgeItr;
120 typedef EdgeVec::const_iterator EdgeConstItr;
122 typedef vector<MapPage> PageVec;
123 typedef PageVec::iterator PageItr;
124 typedef PageVec::const_iterator PageConstItr;
126 typedef vector<MapRoom *> RoomVec;
127 typedef RoomVec::iterator RoomItr;
128 typedef RoomVec::const_iterator RoomConstItr;
129 //typedef Array<MapRoom, RoomVec> RoomArray;
131 typedef ByteVec PageNumVec;
132 typedef ByteVec::iterator PNItr;
133 typedef ByteVec::const_iterator PNConstItr;
135 typedef WordVec RoomNumVec;
136 typedef WordVec::iterator RNItr;
137 typedef WordVec::const_iterator RNConstItr;
141 // Exported functions
142 void trimLeft(string & s);
143 void trimRight(string & s);
144 QAction * CreateAction(QString name, QString tooltip, QString statustip,
145 QIcon icon, QKeySequence key, bool checkable = false, QObject * parent = 0);
146 QAction * CreateAction(QString name, QString tooltip, QString statustip,
147 QIcon icon, QKeySequence key1, QKeySequence key2, bool checkable = false,
148 QObject * parent = 0);
149 double Magnitude(QPointF);
150 QPointF UnitVector(QPointF);
151 double Angle(QPointF);
152 double Angle(QPoint);
153 double Dot(QPointF, QPointF);
154 double Determinant(QPointF, QPointF);
155 double ParameterOfLineAndPoint(QPointF tail, QPointF head, QPointF point);
157 #endif // __GLOBALS_H__