-
Notifications
You must be signed in to change notification settings - Fork 3
/
CKNode.h
341 lines (274 loc) · 9.21 KB
/
CKNode.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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
#pragma once
#include "KObject.h"
#include "vecmat.h"
//struct CKGeometry;
#include "CKGeometry.h"
#include "CKPartlyUnknown.h"
#include "CKUtils.h"
#include "Shape.h"
struct CMultiGeometryBasic;
//struct CSGMovable : CKSubclass<CKSceneNode, 5> {
// Matrix transform;
//};
struct CKSceneNode : CKCategory<11> {
Matrix transform = Matrix::getIdentity();
kobjref<CKSceneNode> parent, next;
uint32_t unk1 = 0;
uint8_t unk2 = 0xFF;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
Matrix getGlobalMatrix() const;
};
struct CSGLeaf : CKSubclass<CKSceneNode, 8> {
};
struct CSGBranch : CKSubclass<CSGLeaf, 9> {
kobjref<CKSceneNode> child;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
void insertChild(CKSceneNode *newChild);
void removeChild(CKSceneNode *toremove);
};
struct CSGRootNode : CKSubclass<CSGBranch, 1> {
};
struct CNode : CKSubclass<CSGBranch, 3> {
kobjref<CKAnyGeometry> geometry;
std::string romSomeName; // XXL1 Romaster only
float ogUnkFloat = 1.0f;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CSGSectorRoot : CKSubclass<CNode, 2> {
uint32_t sectorNum = 0;
// texture dictionary reference
kobjref<CKObject> texDictionary;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CClone : CKSubclass<CNode, 12> {
uint32_t cloneInfo;
// remaster
std::string hdKifName;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct RwFrameList;
struct CAnyAnimatedNode : CKSubclass<CNode, 1024> {
kobjref<CKSceneNode> branchs;
// XXL2 Romaster
std::vector<std::string> hdBoneNames;
void deserialize(KEnvironment *kenv, File *file, size_t length) override = 0;
};
struct CAnimatedNode : CKSubclass<CAnyAnimatedNode, 21> {
//kobjref<CSGBranch> branchs;
kobjref<CKObject> unkref;
uint32_t numBones;
std::shared_ptr<RwFrameList> frameList;
// XXL2+
int32_t x2someNum = -1;
// Arthur+
std::array<uint8_t, 16> ogBlendBytes;
kobjref<CKObject> ogBlender;
float ogBlendFloat = 1.0f;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CAnimatedClone : CKSubclass<CAnyAnimatedNode, 22> {
//kobjref<CSGBranch> branchs; // in common with CAnimatedNode!!!
uint32_t cloneInfo;
// XXL2+
int32_t x2someNum = -1;
// XXL2 Remaster
std::string hdKifName;
// Arthur+
kobjref<CKObject> ogBlender;
std::array<uint8_t, 16> ogBlendBytes;
float ogBlendFloat = 1.0f;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CKBoundingShape : CKSubclass<CSGLeaf, 13> {
uint16_t unk1, unk2;
float radius;
kobjref<CKObject> object;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CKBoundingSphere : CKSubclass<CKBoundingShape, 14> {};
struct CKDynamicBoundingSphere : CKSubclass<CKBoundingShape, 15> {};
struct CKBoundingBox : CKSubclass<CKBoundingShape, 16> {
Vector3 boxSize; // or corner position?
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CKAABB : CKSubclass<CKBoundingBox, 17> {};
struct CKOBB : CKSubclass<CKBoundingBox, 18> {};
struct CKAACylinder : CKSubclass<CKBoundingShape, 24> {
float cylinderRadius, cylinderHeight; // I guess, but which one begins first?
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CNodeFx : CKSubclass<CNode, 20> {
uint8_t fxUnkByte = 0; // only for Arthur+
uint8_t fxUnkByte2 = 0; // " " Spyro+/OG360
uint8_t fxUnkByte3 = 0; // " " Spyro+
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CGlowNodeFx : CKSubclass<CNodeFx, 11> {
int32_t cgnfUnk0;
float cgnfUnk1;
float cgnfUnk1a;
int32_t cgnfUnk2;
std::vector<float> cgnfUnk3;
std::string cgnfUnk4;
float cgnfUnk5;
float cgnfUnk6;
float cgnfUnk7;
uint8_t cgnfUnk8;
uint8_t cgnfUnk9;
void deserialize(KEnvironment* kenv, File* file, size_t length) override;
void serialize(KEnvironment* kenv, File* file) override;
};
struct CParticlesNodeFx : CKSubclass<CNodeFx, 19> {
uint8_t pfxUnk1;
uint8_t pfxUnk2;
float pfxUnk3 = 1.0f;
uint32_t pfxUnk4;
float pfxUnk5; // OG
std::string hdName;
std::vector<uint8_t> hdData;
void deserialize(KEnvironment* kenv, File* file, size_t length) override;
void serialize(KEnvironment* kenv, File* file) override;
};
struct CSkyNodeFx : CKSubclass<CNodeFx, 25> {
std::array<float, 4> skyVal1;
std::array<uint32_t, 2> skyVal2;
uint8_t skyVal3 = 11;
void deserialize(KEnvironment* kenv, File* file, size_t length) override;
void serialize(KEnvironment* kenv, File* file) override;
};
struct CFogBoxNodeFx : CKSubclass<CNodeFx, 26> {
uint32_t fogUnk01;
// u32 count for matrices
std::vector<std::array<float, 16>> matrices;
std::string fogUnk02;
uint8_t fogType, fogUnk04, fogUnk05, fogUnk06, fogUnk07;
uint32_t fogUnk08, fogUnk09 /* !!! 20 */, fogUnk10;
Vector3 fogUnk11;
float fogUnk12;
// u32 count
std::vector<std::array<float, 2>> coords;
std::vector<uint8_t> x2coordStuff;
uint8_t fogUnk13, fogUnk14;
uint32_t fogUnk15;
// u32 count for dings
struct Ding {
float flt1,flt2;
uint32_t color1, color2;
void reflectMembers(MemberListener &r);
};
std::vector<Ding> fogDings;
// { cond
std::vector<std::array<float, 7>> fogVec3;
// }
float fogUnk16, fogUnk17;
uint32_t fogX2Unk1, fogX2Unk2, fogX2Unk3, fogX2Unk4;
// { cond
std::vector<float> fogVecA, fogVecB;
// }
float fogUnk18, fogUnk19, fogUnk20, fogUnk21;
Vector3 fogUnk22;
float fogOgUnk1, fogOgUnk2, fogOgUnk3, fogOgUnk4; // OG specific
std::array<float, 2> fogUnk23;
float fogUnk24;
std::string fogRomaName;
// OG specific:
float fogOgUnk5, fogOgUnk6;
uint8_t fogOgUnk7;
std::vector<uint8_t> fogOgUnk8;
// Spryo+/OG360:
float fogOgUnk5New, fogOgUnk6New;
uint8_t fogOgUnk7New;
std::vector<uint32_t> fogOgUnk8a; // replaces fogOgUnk8
void reflectFog(MemberListener &r, KEnvironment *kenv);
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CTrailNodeFx : CKSubclass<CNodeFx, 27> {
struct TrailPart {
uint8_t unk1, unk2;
uint32_t unk3;
kobjref<CKObject> branch1, branch2; // branch or CSGHotSpot
// XXL2+:
uint32_t tnUnk2, tnUnk3;
// Spyro+/OG360:
float tnUnk4;
uint32_t tnUnk5, tnUnk6;
};
uint32_t tnUnk1, tnUnk2, tnUnk3;
std::vector<TrailPart> parts;
// Alice:
float tnUnk7;
uint8_t tnUnk8, tnUnk9;
// XXL1 Romaster:
std::string romFxName, romTexName;
uint8_t romUnkByte;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
// Looks similar to CKBoundingSphere :thinking:
struct CKDynBSphereProjectile : CKSubclass<CSGLeaf, 6> {
uint16_t unk1, unk2;
float radius;
kobjref<CKObject> cameraService;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
// XXL2+:
// TODO: deserialize refs!!!
struct CSGLight : CKSubclass<CSGLeaf, 32> {
int32_t sglUnk0 = 0;
std::vector<kobjref<CKObject>> lightComponents;
AABoundingBox bbox;
std::vector<kobjref<CKObject>> lightSets;
int32_t sglUnkLast = 0;
void deserialize(KEnvironment* kenv, File* file, size_t length) override;
void serialize(KEnvironment* kenv, File* file) override;
};
struct CCloudsNodeFx : CKSubclass<CNodeFx, 33> {
float cloudUnk1;
float cloudUnk2;
std::array<float, 8> cloudUnk3;
std::array<int32_t, 3> cloudUnk4;
std::array<int32_t, 2> cloudColors;
kobjref<CKParticleGeometry> particleGeo;
void deserialize(KEnvironment* kenv, File* file, size_t length) override;
void serialize(KEnvironment* kenv, File* file) override;
};
struct CZoneNode : CKSubclass<CNode, 34> {
uint8_t ogByte = 0;
std::vector<kobjref<CMultiGeometryBasic>> zoneGeos;
uint32_t arNumTypeA = 0, arNumTypeB = 0;
void deserialize(KEnvironment* kenv, File* file, size_t length) override;
void serialize(KEnvironment* kenv, File* file) override;
};
struct CSpawnNode : CKSubclass<CNode, 35> {
kobjref<CKObject> spawnPool;
int32_t sector = 0;
Vector3 spawnVec;
float spawnUnk2;
// OG
Vector3 ogSpawnVec2;
float ogSpawnUnk2;
AABoundingBox ogBBox;
void deserialize(KEnvironment* kenv, File* file, size_t length) override;
void serialize(KEnvironment* kenv, File* file) override;
};
struct CSpawnAnimatedNode : CKPartlyUnknown<CNode, 36> {}; // not sure about subclass
// Arthur/OG+:
struct CSGAnchor : CKSubclass<CSGLeaf, 4> {
kobjref<CKObject> cameraBeacon;
void deserialize(KEnvironment* kenv, File* file, size_t length) override;
void serialize(KEnvironment* kenv, File* file) override;
};
struct CSGBkgRootNode : CKSubclass<CNode, 10> {};