-
Notifications
You must be signed in to change notification settings - Fork 1
/
mapobjects.h
198 lines (147 loc) · 4.74 KB
/
mapobjects.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#ifndef MAPOBJECTS_H
#define MAPOBJECTS_H
#include <QtCore>
// Movable Object Baseclass
class MovableObject
{
public:
MovableObject();
virtual ~MovableObject() {}
qint32 getx() { return x; }
qint32 gety() { return y; }
qint32 getz() { return z; }
qint32 getoffsetx() { return offsetx; }
qint32 getoffsetz() { return offsetz; }
qint32 getwidth() { return width; }
qint32 getheight() { return height; }
void setx(quint32 x) { this->x = x; }
void sety(quint32 y) { this->y = y; }
void setz(quint32 z) { this->z = z; }
void setoffsetx(quint32 offsetx) { this->offsetx = offsetx; }
void setoffsetz(quint32 offsetz) { this->offsetz = offsetz; }
void setwidth(quint32 width) { this->width = width; }
void setheight(quint32 height) { this->height = height; }
bool clickDetection(int x, int y);
protected:
qint32 x, y, z;
qint32 offsetx, offsetz;
qint32 width, height; // For click detection and rendering
};
// Path
struct Path
{
quint8 endingNodeId;
quint8 animationId;
quint8 settings;
quint8 unk;
};
// Node
class Node: public MovableObject
{
public:
Node();
Node(qint32 x, qint32 y, qint32 z);
Node(QXmlStreamReader* xmlReader);
~Node();
void writeXml(QXmlStreamWriter* xmlWriter);
quint8 getAreaId() { return areaId; }
quint8 getIconId() { return iconId; }
quint8 getSettings() { return settings; }
bool getSetting(int bit) { return ((settings >> bit) & 1); }
int getBowserJrPath();
quint8 getUnk0() { return unk0; }
quint8 getUnk1() { return unk1; }
quint8 getUnlock(int index) { return unlockedPaths[index]; }
quint8 getUnlockSecret(int index) { return unlockedPathsSecret[index]; }
quint8 getCameraScroll() { return cameraScroll; }
quint8 getCameraScrollSecret() { return cameraScrollSecret; }
void setAreaId(quint8 areaId) { this->areaId = areaId; }
void setIconId(quint8 iconId) { this->iconId = iconId; }
void setSettings(quint8 settings) { this->settings = settings; }
void setSetting(bool val, int bit) { settings ^= (-val ^ settings) & (1 << bit); }
void setBowserJrPath(int index);
void setUnk0(quint8 unk0) { this->unk0 = unk0; }
void setUnk1(quint8 unk1) { this->unk1 = unk1; }
void setUnlock(int index, quint8 val) { this->unlockedPaths[index] = val; }
void setUnlockSecret(int index, quint8 val) { this->unlockedPathsSecret[index] = val; }
void setCameraScroll(quint8 cameraScroll) { this->cameraScroll = cameraScroll; }
void setCameraScrollSecret(quint8 cameraScrollSecret) { this->cameraScrollSecret = cameraScrollSecret; }
QList<Path*> *pathList() { return &paths; }
bool clickDetection(int x, int y);
private:
// Data Node
QList<Path*> paths;
quint8 areaId;
quint8 iconId;
quint8 settings;
quint8 unk0;
quint8 unk1;
// Visible Node
quint8 unlockedPaths[4];
quint8 unlockedPathsSecret[4];
quint8 cameraScroll;
quint8 cameraScrollSecret;
void clearValues();
};
// Path Behavior
class PathBehavior
{
public:
PathBehavior();
PathBehavior(QXmlStreamReader* xmlReader);
void writeXml(QXmlStreamWriter* xmlWriter);
quint8 getAnimationId() { return animationId; }
quint8 getStarCoinCost() { return starCoinCost; }
quint8 getSettings() { return settings; }
void setAnimationId(quint8 animationId) { this->animationId = animationId; }
void setStarCoinCost(quint8 starCoinCost) { this->starCoinCost = starCoinCost; }
void setSettings(quint8 settings) { this->settings = settings; }
private:
quint8 animationId;
quint8 starCoinCost;
quint8 settings;
void clearValues();
};
// Map Object
class MapObject: public MovableObject
{
public:
MapObject(quint8 type);
MapObject(QXmlStreamReader* xmlReader, quint8 type);
void writeXml(QXmlStreamWriter* xmlWriter);
quint8 getNodeId() { return nodeId; }
void setNodeId(quint8 nodeId) { this->nodeId = nodeId; }
quint8 getType() { return type; }
private:
quint8 type;
quint8 nodeId;
};
// Keyframe
class Keyframe: public MovableObject
{
public:
Keyframe();
Keyframe(QXmlStreamReader* xmlReader);
void writeXml(QXmlStreamWriter* xmlWriter);
qint32 getRot() { return rot; }
quint32 getPace() { return pace; }
void setRot(qint32 rot) { this->rot = rot; }
void setPace(quint32 pace) { this->pace = pace; }
private:
void clearValues();
qint32 rot;
quint32 pace;
};
// Animation Path
class AnimationPath
{
public:
AnimationPath();
AnimationPath(QXmlStreamReader* xmlReader);
~AnimationPath();
void writeXml(QXmlStreamWriter* xmlWriter);
QList<Keyframe*>* keyframeList() { return &keyframes; }
private:
QList<Keyframe*> keyframes;
};
#endif // MAPOBJECTS_H