-
Notifications
You must be signed in to change notification settings - Fork 3
/
CKLogic.h
1647 lines (1446 loc) · 50.3 KB
/
CKLogic.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
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#pragma once
#include "KObject.h"
#include <vector>
#include <array>
#include "vecmat.h"
#include "Shape.h"
#include "Events.h"
#include "DynArray.h"
#include "CKUtils.h"
#include <variant>
struct CKHook;
struct CKHookLife;
struct CKGroup;
struct CKGroupLife;
struct CKCinematicNode;
struct CKCinematicDoor;
struct CKStartDoor;
struct CAnimationDictionary;
struct CKSoundDictionary;
struct CKSoundDictionaryID;
struct CKSceneNode;
struct CSGSectorRoot;
struct CKMeshKluster;
struct CKBeaconKluster;
struct CKPFGraphNode;
struct CKCinematicSceneData;
struct CKServiceLife;
struct CKGroupRoot;
struct CKTriggerSynchro;
struct CBillboard2d;
struct CNode;
struct CAnimatedNode;
struct CParticlesNodeFx;
struct CKShadowCpnt;
struct CClone;
struct CTrailNodeFx;
struct CKCamera;
struct CKSekensEntry;
// Default-construct the variant's holding value with specified type index
// if holding value's type is different, else keep the value unchanged.
template<typename T, size_t N = 0> void changeVariantType(T& var, size_t index) {
if constexpr (N < std::variant_size_v<T>) {
if (index == N) {
if (var.index() != N)
var.emplace<N>();
}
else {
changeVariantType<T, N + 1>(var, index);
}
}
}
struct CKLogic : CKCategory<12> {};
struct CKReflectableLogic : CKMRSubclass<CKReflectableLogic, CKMemberReflectable<CKLogic>, 0xBADB01> {
void reflectMembers2(MemberListener &r, KEnvironment* kenv) {}
};
struct CKPFGraphTransition : CKSubclass<CKLogic, 2> {
uint32_t unk1; // XXL1: byte with value 0/1, XXL2+: u32 with first bit set/clear, remaining bits are random
kobjref<CKPFGraphNode> node;
uint32_t unk2;
float x2UnkA = 1.0f, ogUnkB = 0.2f, ogUnkC = 1.0f; // TODO: ogUnkC before or after x2UnkA?
struct Thing {
std::array<float, 12> matrix;
uint32_t unk;
};
std::vector<Thing> things;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CKBundle : CKSubclass<CKLogic, 3> {
kobjref<CKBundle> next;
uint32_t flags;
kobjref<CKGroupLife> grpLife;
kobjref<CKHookLife> firstHookLife, otherHookLife;
// XXL2+
kobjref<CKGroup> x2Group;
kobjref<CKHook> firstHook, otherHook;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CKSector : CKSubclass<CKLogic, 4> {
KPostponedRef<CKObject> sgRoot;
uint16_t strId = 0, unk1 = 1;
//uint32_t numSas;
std::vector<kobjref<CKObject>> sases;
KPostponedRef<CKObject> soundDictionary;
KPostponedRef<CKBeaconKluster> beaconKluster;
KPostponedRef<CKMeshKluster> meshKluster;
AABoundingBox boundaries;
EventNode evt1, evt2;
// XXL2+:
kobjref<CKObject> x2sectorDetector;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
void onLevelLoaded(KEnvironment* kenv) override;
};
struct CKLevel : CKSubclass<CKLogic, 5> {
uint32_t lvlNumber;
std::vector<kobjref<CKSector>> sectors;
std::vector<kobjref<CKObject>> objs;
std::array<uint32_t, 20> initialSector = { 0 };
std::array<std::string, 20> lvlRemasterCheatSpawnNames;
uint8_t lvlUnk2 = 0;
uint32_t lvlUnk3 = 0x107;
// OG
kobjref<CKTriggerSynchro> triggerSynchro;
kuuid levelUuid;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CKCameraSector : CKMRSubclass<CKCameraSector, CKReflectableLogic, 8> {
uint8_t ckcsUnk0 = 3;
std::array<float, 6> ckcsUnk1;
kobjref<CKCamera> ckcsUnk2;
float ckcsUnk3 = 1.0f;
uint8_t ckcsUnk4 = 1;
kobjref<CKCameraSector> ckcsUnk5; // XXL1 only
// XXL2+
std::vector<kobjref<CKCamera>> ckcsCameras;
uint8_t ckcsUnk6 = 0;
uint8_t ckcsUnk7 = 0;
// OG
uint32_t ckcsOgUnk1, ckcsOgUnk2;
kobjref<CKObject> ckcsOgUnkRef;
uint8_t ckcsOgUnk4, ckcsOgUnk5, ckcsOgUnk6, ckcsOgUnk7;
uint32_t ckcsOgSector;
EventNode ckcsOgEvent1, ckcsOgEvent2;
float ckcsOgUnk9 = -1.0f;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKCoreManager : CKSubclass<CKLogic, 9> {
kobjref<CKGroupRoot> groupRoot;
kobjref<CKServiceLife> srvLife;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
void init(KEnvironment *kenv) override;
};
struct CKSpline4 : CKMRSubclass<CKSpline4, CKReflectableLogic, 11> {
uint8_t cksNumParts = 0;
float cksTotalLength = 0.0f;
float cksDelta = 0.01f;
uint8_t cksUnk3 = 1;
std::vector<Vector3> cksPoints;
std::vector<float> cksPartLengths; // size = cksNumParts
std::vector<uint8_t> cksSplRangeToPartIndices;
std::vector<float> cksSplRangeToPartRange;
std::vector<float> cksUnk13; // size = cksNumParts
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKChoreoKey : CKSubclass<CKLogic, 15> {
//uint32_t numSlots;
struct ChoreoSlot {
Vector3 position = Vector3(0,0,0), direction = Vector3(0,0,1);
int16_t enemyGroup = -1;
};
std::vector<ChoreoSlot> slots;
float unk1 = 5.0f, unk2 = 10.0f, unk3 = 0.5f; // Only in XXL1
float x2unk1 = 3.0f; // Only in XXL2+
uint16_t flags = 0;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CKPFGraphNode : CKSubclass<CKLogic, 16> {
Vector3 lowBBCorner, highBBCorner;
uint8_t numCellsX, numCellsZ;
std::vector<uint8_t> cells;
std::vector<kobjref<CKPFGraphTransition>> transitions;
std::vector<kobjref<CKPFGraphNode>> others; // XXL1: only at most one single ref, XXL2+: multiple refs
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
float getCellWidth() const { return (highBBCorner.x - lowBBCorner.x) / numCellsX; }
float getCellHeight() const { return (highBBCorner.z - lowBBCorner.z) / numCellsZ; }
};
struct CKSas : CKSubclass<CKLogic, 17> {
std::array<uint32_t, 2> sector;
std::array<AABoundingBox, 2> boxes;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CGround : CKSubclass<CKLogic, 18> {
struct Triangle {
std::array<uint16_t, 3> indices;
};
struct InfiniteWall {
std::array<uint16_t, 2> baseIndices;
};
struct FiniteWall {
std::array<uint16_t, 2> baseIndices;
std::array<float, 2> heights;
};
//uint32_t numa;
std::vector<Triangle> triangles;
std::vector<Vector3> vertices;
AABoundingBox aabb;
uint16_t param1 = 0, param2 = 1;
// ... new stuff from XXL2/OG
uint8_t x2neoByte = 0;
kobjref<CKObject> x4unkRef;
kobjref<CKSector> x2sectorObj;
uint32_t alValue = 0;
std::vector<InfiniteWall> infiniteWalls;
std::vector<FiniteWall> finiteWalls;
float param3 = 0.0f, param4 = 0.0f;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
uint32_t computeSize() const {
return static_cast<uint32_t>(((6 * triangles.size() + 12 * vertices.size() + 4 * infiniteWalls.size() + 12 * finiteWalls.size()) + 3) & ~3);
}
};
struct CDynamicGround : CKSubclass<CGround, 19> {
Vector3 mpos, mrot;
kobjref<CKSceneNode> node; uint32_t nodeId;
Matrix transform;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
void onLevelLoaded(KEnvironment *kenv) override;
};
struct CWall : CKSubclass<CKLogic, 20> {
uint32_t numa;
std::vector<CGround::Triangle> triangles;
std::vector<Vector3> vertices;
AABoundingBox aabb;
uint16_t param1, param2;
Matrix wallMat1, wallMat2;
void deserialize(KEnvironment* kenv, File* file, size_t length) override;
void serialize(KEnvironment* kenv, File* file) override;
};
struct CKFlaggedPath : CKSubclass<CKLogic, 23> {
kobjref<CKObject> line;
uint32_t numPoints;
float fpSomeFloat;
std::vector<float> pntValues;
std::vector<EventNode> pntEvents;
// Arthur+
std::vector<std::pair<int32_t, float>> arPathThings;
// sector at which the path is used, set by onLevelLoaded from the hooks using it (assuming hooks are loaded before misc classes!)
int usingSector = -1;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CKMsgAction : CKSubclass<CKLogic, 24> {
using MAParameter = std::variant<uint32_t, uint32_t, float, kobjref<CKObject>, MarkerIndex>;
struct MAAction {
uint8_t num;
std::vector<MAParameter> parameters;
};
struct MAMessage {
uint32_t event;
std::vector<MAAction> actions;
};
struct MAState {
std::vector<MAMessage> messageHandlers;
std::string name; // Addendum
};
std::vector<MAState> states;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
int getAddendumVersion() override;
void deserializeAddendum(KEnvironment* kenv, File* file, int version) override;
void serializeAddendum(KEnvironment* kenv, File* file) override;
};
struct CKChoreography : CKSubclass<CKLogic, 27> {
float unkfloat = 0.0f;
uint8_t unk2 = 0;
uint8_t numKeys = 0;
// XXL2+ have pointers to ChoreoKeys inside CKCheoreography, whereas XXL1 has them in the Squad
std::vector<kobjref<CKChoreoKey>> keys;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CKLine : CKSubclass<CKLogic, 30> {
uint8_t numSegments = 0;
float totalLength = 0.0f;
std::vector<Vector3> points;
std::vector<float> segmentLengths;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CKSpline4L : CKSubclass<CKLogic, 31> {
uint8_t cksNumParts = 0;
float cksTotalLength = 0.0f;
float cksDelta = 0.01f;
uint8_t unkchar2 = 0;
//uint32_t numBings;
std::vector<Vector3> cksPoints;
//uint32_t numDings;
std::vector<Vector3> cksPrecomputedPoints;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CKCinematicScene : CKSubclass<CKLogic, 37> {
uint16_t csFlags = 0, arcsUnk1a;
std::vector<kobjref<CKCinematicSceneData>> cineDatas;
std::vector<kobjref<CKCinematicNode>> cineNodes;
kobjref<CKStartDoor> startDoor;
uint8_t csUnk2 = 0;
uint32_t csBarsColor = 0xFF000000; float csUnk4 = 0.2f, csUnk5 = 0.5f, csUnk6 = 0.5f, csUnk7 = 0.5f, csUnk8 = 0.5f, csUnk9 = 1.0f, csUnkA = 0.0f;
EventNode onSceneEnded, ogOnSceneStart, spyroOnSceneSkipped;
std::vector<kobjref<CKObject>> groups;
KPostponedRef<CKSoundDictionaryID> sndDict;
uint8_t csUnkF = 1;
float x2CameraEndDuration = 0.0f;
uint8_t arthurOnlyByte = 0;
kobjref<CKCinematicScene> spyroSkipScene;
std::array<uint8_t, 19> otherUnkFromRomaster;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
void init(KEnvironment* kenv) override;
size_t findEdge(CKCinematicNode* source, CKCinematicNode* dest, bool isFinish);
std::tuple<CKCinematicNode*, CKCinematicNode*, bool> getEdgeInfo(size_t edgeIndex, KEnvironment* kenv);
void addEdge(CKCinematicNode* source, CKCinematicNode* dest, bool isFinish, KEnvironment* kenv);
void removeEdge(CKCinematicNode* source, CKCinematicNode* dest, bool isFinish, KEnvironment* kenv);
};
struct CLightComponent : CKMRSubclass<CLightComponent, CKReflectableLogic, 41> {
int32_t clcUnk0;
int32_t clcUnk1;
float clcUnk2;
float clcUnk3;
std::array<float, 3> clcUnk4;
// when clcUnk0 & 8 != 0
float clcUnk5;
uint32_t clcUnk6;
//int32_t clcUnk7;
std::vector<std::pair<float, int32_t>> fipVec;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKCinematicSceneData : CKSubclass<CKLogic, 42> {
kobjref<CKHook> hook;
KPostponedRef<CAnimationDictionary> animDict;
uint8_t csdUnkA;
MarkerIndex csdUnkB; // looks special
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CKDefaultGameManager : CKMRSubclass<CKDefaultGameManager, CKReflectableLogic, 49> {
kobjref<CKObject> dgmGrpEnemy;
kobjref<CKObject> dgmGrpTrio;
kobjref<CKObject> dgmGrpMeca;
kobjref<CKObject> dgmGrpBonus;
void reflectMembers2(MemberListener &r, KEnvironment* kenv);
};
struct CKAsterixGameManager : CKMRSubclass<CKAsterixGameManager, CKDefaultGameManager, 51> {
std::array<uint8_t, 0x44> dgmGlobalBytes;
kobjref<CKObject> dgmBillboard;
EventNode dgmUnk1;
EventNode dgmUnk2;
EventNode dgmUnk3;
EventNode dgmUnk4;
EventNode dgmUnk5;
EventNode dgmUnk6;
EventNode dgmUnk7;
EventNode dgmUnk8;
EventNode dgmUnk9;
EventNode dgmUnk10;
EventNode dgmUnk11;
EventNode dgmUnk12;
EventNode dgmUnk13;
EventNode dgmUnk14;
EventNode dgmUnk15;
EventNode dgmUnk16;
EventNode dgmUnk17;
EventNode dgmUnk18;
EventNode dgmUnk19;
EventNode dgmUnk20;
EventNode dgmUnk21;
EventNode dgmUnk22;
EventNode dgmUnk23;
EventNode dgmUnk24;
EventNode dgmUnk25;
EventNode dgmUnk26;
EventNode dgmUnk27;
EventNode dgmUnk28;
EventNode dgmUnk29;
EventNode dgmUnk30;
EventNode dgmUnk31;
EventNode dgmUnk32;
EventNode dgmUnk33;
EventNode dgmUnk34;
EventNode dgmUnk35;
EventNode dgmUnk36;
EventNode dgmUnk37;
EventNode dgmUnk38;
EventNode dgmUnk39;
EventNode dgmUnk40;
EventNode dgmUnk41;
EventNode dgmUnk42;
EventNode dgmUnk43;
EventNode dgmUnk44;
EventNode dgmUnk45;
EventNode dgmUnk46;
EventNode dgmUnk47;
EventNode dgmUnk48;
EventNode dgmUnk49;
EventNode dgmUnk50;
EventNode dgmUnk51;
EventNode dgmUnk52;
EventNode dgmUnk53;
EventNode dgmUnk54;
EventNode dgmUnk55;
EventNode dgmUnk56;
EventNode dgmUnk57;
EventNode dgmUnk58;
EventNode dgmUnk59;
EventNode dgmUnk60;
EventNode dgmUnk61;
EventNode dgmUnk62;
EventNode dgmUnk63;
EventNode dgmUnk64;
EventNode dgmUnk65;
EventNode dgmUnk66;
EventNode dgmUnk67;
EventNode dgmUnk68;
EventNode dgmUnk69;
EventNode dgmUnk70;
EventNode dgmUnk71;
EventNode dgmUnk72;
EventNode dgmUnk73;
EventNode dgmUnk74;
EventNode dgmUnk75;
EventNode dgmUnk76;
EventNode dgmUnk77;
EventNode dgmUnk78;
EventNode dgmUnk79;
EventNode dgmUnk80;
EventNode dgmUnk81;
EventNode dgmUnk82;
EventNode dgmUnk83;
EventNode dgmUnk84;
EventNode dgmUnk85;
EventNode dgmUnk86;
EventNode dgmUnk87;
EventNode dgmUnk88;
EventNode dgmUnk89;
EventNode dgmUnk90;
EventNode dgmUnk91;
EventNode dgmUnk92;
EventNode dgmUnk93;
EventNode dgmUnk94;
EventNode dgmUnk95;
EventNode dgmUnk96;
EventNode dgmUnk97;
EventNode dgmUnk98;
EventNode dgmUnk99;
EventNode dgmUnk100;
EventNode dgmUnk101;
EventNode dgmUnk102;
EventNode dgmUnk103;
kobjref<CKObject> dgmUnk104;
kobjref<CKObject> dgmCamera;
EventNode dgmUnk106;
kobjref<CKObject> dgmUnk107;
kobjref<CKObject> dgmUnk108;
kobjref<CKObject> dgmUnk109;
float dgmUnk110 = 3.0f;
uint32_t dgmUnk111 = -1; // makes CMenuManager2d work
EventNode dgmUnk112;
uint8_t dgmUnk113 = 20;
float dgmUnk114 = 1.0f;
EventNode dgmUnk115;
kobjref<CKObject> dgmGrpCheckpoint;
EventNode dgmUnk117;
EventNode dgmUnk118;
uint32_t dgmDrmValue = 0x24011980;
uint32_t dgmUnk120 = 0xFFFFFFFF;
uint32_t dgmUnk121 = 0xFFFFFFFF;
kobjref<CKObject> dgmUnk122;
float dgmUnk123 = 4.0f;
float dgmUnk124 = 100.0f;
float dgmUnk125 = 1.0f;
float dgmUnk126 = 1.0f;
std::string dgmUnk127;
uint32_t dgmUnk128 = 0xFFFAFAFA;
std::string dgmUnk129;
float dgmUnk130 = 50.0f;
float dgmUnk131 = 50.0f;
float dgmUnk132 = 0.01f;
uint8_t dgmUnk133 = 1;
uint8_t dgmUnk134 = 1;
float dgmUnk135 = 0.01f;
uint32_t dgmUnk136 = 0xFFFF0000;
uint8_t dgmUnk137 = 0;
float dgmUnk138 = 15.0f;
float dgmUnk139 = 6.0f;
kobjref<CKObject> dgmSkyLife;
float dgmUnk141 = 0.05f;
float dgmUnk142 = 2.5f;
float dgmUnk143 = 5.0f;
uint8_t dgmUnk144 = 0;
float dgmUnk145 = 1.0f;
uint32_t dgmUnk146 = 0xCDCDCDCD;
float dgmUnk147 = 100.0f;
uint32_t dgmUnk148 = 0x32FF6464;
uint32_t dgmUnk149 = 0x00ff0000;
std::string dgmUnk150;
uint8_t dgmUnk151 = 1;
float dgmUnk152;
float dgmUnk153 = 0.5f;
kobjref<CKObject> dgmCam1;
kobjref<CKObject> dgmCam2;
float dgmUnk156 = 5.0f;
void reflectMembers2(MemberListener &r, KEnvironment *kenv);
void deserializeGlobal(KEnvironment* kenv, File* file, size_t length) override;
};
struct CKVibrationData : CKMRSubclass<CKVibrationData, CKReflectableLogic, 51> {
uint8_t ckvdUnk0;
uint8_t ckvdUnk1;
uint8_t ckvdUnk2;
float ckvdUnk3;
uint8_t ckvdUnk4;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CLocManager : CKSubclass<CKLogic, 59> {
struct Ding { uint32_t lmdUnk1, lmdUnk2, lmdUnk3; };
// Global only:
uint32_t lmUnk0, numTrcStrings, lmNumDings, numStdStrings;
std::vector<Ding> lmDings;
std::vector<uint32_t> lmArStdStrInfo; // Arthur only, has numStdStrings elements
// XXL1 PS2 + Romaster have numLanguages + language IDs in GAME.K*
// GC+PC have them in *GLOC.K* (see Loc_CLocManager)
uint16_t numLanguages;
std::vector<uint32_t> langStrIndices, langIDs;
// OG+:
std::vector<kobjref<CKObject>> stdStringRefs;
std::vector<std::pair<uint32_t, kobjref<CKObject>>> trcStringRefs;
void deserialize(KEnvironment* kenv, File* file, size_t length) override {}
void serialize(KEnvironment* kenv, File* file) override {}
void deserializeGlobal(KEnvironment* kenv, File* file, size_t length) override;
void serializeGlobal(KEnvironment* kenv, File* file) override;
};
struct CKSekens : CKMRSubclass<CKSekens, CKReflectableLogic, 61> {
struct SLine {
uint32_t mUnk0;
float mUnk1;
float mUnk2;
int32_t x2hdValue = -1;
uint8_t mArByte1;
uint8_t mArByte2;
void reflectMembers(MemberListener &r);
};
kobjref<CKObject> sekManager2d;
kobjref<CKObject> sekSndManager;
// uint32_t sizeFor_sekLines;
std::vector<SLine> sekLines;
kobjref<CKObject> sekRomaSndDictID;
std::vector<std::string> sekRomaLineNames;
uint32_t sekUnk4;
uint8_t sekUnk5;
// OG
std::vector<kobjref<CKSekensEntry>> ogLines;
int32_t ogUnk0;
uint8_t ogUnk1;
uint8_t ogUnk2;
uint8_t ogUnk3;
uint8_t ogUnk4;
int32_t ogUnk5;
int32_t ogUnk6;
EventNode ogUnk7;
EventNode ogUnk8;
int32_t ogUnk9;
std::array<int32_t, 4> ogUnk10; // could be a UUID?
void reflectMembers2(MemberListener &r, KEnvironment *kenv);
};
struct CKMeshKluster : CKSubclass<CKLogic, 66> {
AABoundingBox aabb;
//uint16_t numGrounds, numWalls, unk2;
std::vector<kobjref<CGround>> grounds;
std::vector<kobjref<CKObject>> walls;
kobjref<CKObject> unkRef;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CColorizedScreenData : CKMRSubclass<CColorizedScreenData, CKReflectableLogic, 68> {
uint32_t ccsdColor0;
uint32_t ccsdColor1;
float ccsdUnk2;
float ccsdUnk3;
uint8_t ccsdUnk4;
uint8_t ccsdUnk5;
uint8_t ccsdUnk6;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKBeaconKluster : CKSubclass<CKLogic, 73> {
struct Beacon {
int16_t posx, posy, posz; uint16_t params;
Vector3 getPosition() { return Vector3(posx, posy, posz) * 0.1f; }
void setPosition(const Vector3 &ts) { posx = (int16_t)(ts.x * 10); posy = (int16_t)(ts.y * 10); posz = (int16_t)(ts.z * 10); }
};
struct Bing {
bool active = false;
//uint32_t numBeacons;
uint8_t unk2a, numBits, handlerId;
uint16_t sectorIndex; uint32_t klusterIndex; uint16_t handlerIndex;
uint16_t bitIndex;
kobjref<CKObject> handler;
uint32_t unk6; // class ID? (12,74), (12,78)
std::vector<Beacon> beacons;
};
kobjref<CKBeaconKluster> nextKluster;
BoundingSphere bounds;
uint16_t numUsedBings = 0;
std::vector<Bing> bings;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
};
struct CKProjectileTypeBase : CKMRSubclass<CKProjectileTypeBase, CKReflectableLogic, 76> {
uint8_t ckptbpfxUnk0;
int32_t ckptbpfxUnk1;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKProjectileTypeScrap : CKMRSubclass<CKProjectileTypeScrap, CKProjectileTypeBase, 77> {
std::array<float, 6> ckptsUnk2;
std::vector<kobjref<CClone>> ckptsUnk3;
std::array<float, 4> x2FloatExt;
kobjref<CParticlesNodeFx> x2Particle1, x2Particle2;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKProjectileTypeAsterixBomb : CKMRSubclass<CKProjectileTypeAsterixBomb, CKProjectileTypeBase, 79> {
std::array<float, 8> ckptabUnk2;
std::array<kobjref<CParticlesNodeFx>, 5> ckptabUnk3;
float ckptabUnk4;
float ckptabUnk5;
float ckptabUnk6;
float ckptabUnk7;
float ckptabUnk8;
float ckptabUnk9;
float ckptabUnk10;
kobjref<CKSoundDictionaryID> ckptabUnk11;
kobjref<CKShadowCpnt> ckptabUnk12;
std::vector<kobjref<CClone>> ckptabUnk13;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKExplosionFxData;
struct CKShockWaveFxData;
struct CKFireBallFxData;
struct CKProjectileTypeBallisticPFX : CKMRSubclass<CKProjectileTypeBallisticPFX, CKProjectileTypeBase, 80> {
std::array<float, 7> ckptbpfxUnk2;
kobjref<CParticlesNodeFx> ckptbpfxUnk3;
kobjref<CParticlesNodeFx> ckptbpfxUnk4;
kobjref<CTrailNodeFx> ckptbpfxUnk5;
uint16_t ckptbpfxUnk6;
uint8_t ckptbpfxUnk7;
std::vector<kobjref<CClone>> ckptbpfxUnk8;
kobjref<CKExplosionFxData> x2ExplosionFxData;
kobjref<CKShockWaveFxData> x2ShockWaveFxData;
kobjref<CKFireBallFxData> x2FireBallFxData;
int32_t x2LastInt = -1;
std::array<float, 2> ogFloatExt;
uint8_t ogByte1, ogByte2;
kobjref<CKSoundDictionaryID> soundDictId;
float soundValue;
uint8_t ogByte3;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKFlashNode2dFx : CKMRSubclass<CKFlashNode2dFx, CKReflectableLogic, 87> {
kobjref<CBillboard2d> billboard;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKElectricArcNodeFx : CKMRSubclass<CKElectricArcNodeFx, CKReflectableLogic, 89> {
kobjref<CNode> node;
std::array<uint8_t, 3> x2Bytes;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKQuadNodeFx : CKMRSubclass<CKQuadNodeFx, CKReflectableLogic, 94> {
kobjref<CNode> node;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKDefaultPlayer : CKSubclass<CKLogic, 97> {
// game
kobjref<CKObject> playerStage;
void deserialize(KEnvironment* kenv, File* file, size_t length) {}
void serialize(KEnvironment* kenv, File* file) {}
void deserializeGlobal(KEnvironment* kenv, File* file, size_t length);
void serializeGlobal(KEnvironment* kenv, File* file);
};
struct CKLightningObjectNodeFx : CKMRSubclass<CKLightningObjectNodeFx, CKReflectableLogic, 101> {
kobjref<CAnimatedNode> node;
kobjref<CAnimationDictionary> animDict;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKFilterNode2dFx : CKMRSubclass<CKFilterNode2dFx, CKReflectableLogic, 103> {
kobjref<CBillboard2d> billboard;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKExplosionNodeFx : CKMRSubclass<CKExplosionNodeFx, CKReflectableLogic, 105> {
kobjref<CNode> node, node2;
kobjref<CParticlesNodeFx> partNode;
kobjref<CKObject> x2Node3;
std::array<int32_t, 2> x2IntArr;
uint8_t x2Byte;
std::vector<std::pair<int32_t, kobjref<CKObject>>> ogParticleAccessors;
uint8_t ogByte;
kobjref<CKObject> ogCameraQuakeLauncher;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKTimeCounter : CKMRSubclass<CKTimeCounter, CKReflectableLogic, 135> {
float time = 1.0f, time2 = 1.0f;
int32_t flags = 1;
EventNode event1, event2;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKIntegerCounter : CKMRSubclass<CKIntegerCounter, CKReflectableLogic, 136> {
int32_t icunk1 = 0, icunk2 = 0;
int32_t value = 0, flags = 1;
EventNode event1, event2, event3;
int32_t alNewThing = 0; // Alice+: Event node or just int32??? Not even sure if it's at the correct place.
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKConditionNode : CKMRSubclass<CKConditionNode, CKReflectableLogic, 138> {
kobjref<CKConditionNode> nextCondNode; // XXL2 only, removed in Arthur+ in favor of a vector in CKCombiner
uint32_t condNodeType = 0;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKCombiner : CKMRSubclass<CKCombiner, CKConditionNode, 139> {
kobjref<CKConditionNode> childCondNode; // XXL2
std::vector<kobjref<CKConditionNode>> condNodeChildren; // Arthur+
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
void onLevelLoaded(KEnvironment* kenv) override;
void onLevelSave(KEnvironment* kenv) override;
};
struct CKComparedData;
struct CKComparator : CKMRSubclass<CKComparator, CKConditionNode, 140> {
kobjref<CKComparedData> leftCmpData, rightCmpData;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKTrigger;
struct CKComparedData : CKMRSubclass<CKComparedData, CKReflectableLogic, 141> {
uint32_t cmpdatType = 0;
struct CmpDataObjectProperty {
kobjref<CKObject> cmpdatT0Ref;
uint32_t cmpdatT0Unk1, cmpdatT0Unk2, cmpdatT0Unk3;
};
struct CmpDataConstant {
std::variant<uint8_t, uint32_t, float, KPostponedRef<CKObject>> value;
};
struct CmpDataEventNode {
uint8_t cmpdatT2Unk1 = 0;
kobjref<CKTrigger> cmpdatT2Trigger;
};
std::variant<CmpDataObjectProperty, CmpDataConstant, CmpDataEventNode> cmpdatValue;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
int getDataType() const { return (cmpdatType >> 2) & 3; }
};
struct CKTrigger : CKSubclass<CKLogic, 142> {
struct Action {
KPostponedRef<CKObject> target;
uint16_t event = 0;
std::variant<uint8_t, uint32_t, float, KPostponedRef<CKObject>> value;
};
kobjref<CKConditionNode> condition;
std::vector<Action> actions;
// OG+:
std::vector<kobjref<CKObject>> ogDatas;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
void onLevelLoaded(KEnvironment* kenv) override;
void onLevelSave(KEnvironment* kenv) override;
};
struct CKProjectileTypeTargetLock : CKMRSubclass<CKProjectileTypeTargetLock, CKProjectileTypeBallisticPFX, 146> {
float ckpttlUnk30;
float ckpttlUnk31;
float ckpttlUnk32;
uint8_t ckpttOgByte = 1;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CMultiGeometry;
struct CKDetectedMovable;
struct CKDetectorBase : CKMRSubclass<CKDetectorBase, CKReflectableLogic, 156> {
uint32_t dbFlags;
kobjref<CMultiGeometry> dbGeometry;
kobjref<CKDetectedMovable> dbMovable;
uint32_t dbSectorIndex;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKSectorDetector : CKMRSubclass<CKSectorDetector, CKReflectableLogic, 157> {
std::vector<kobjref<CKDetectorBase>> sdDetectors;
std::vector<kobjref<CMultiGeometry>> sdGeometries;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CMultiGeometryBasic : CKMRSubclass<CMultiGeometry, CKReflectableLogic, 197> {
std::variant<AABoundingBox, BoundingSphere, AARectangle> mgShape;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CMultiGeometry : CKSubclass<CMultiGeometryBasic, 158> {};
struct CKDetectorEvent : CKMRSubclass<CKDetectorEvent, CKDetectorBase, 160> {
EventNode deOnExit, deOnPresence, deOnEnter;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKDetectedMovable : CKMRSubclass<CKDetectedMovable, CKReflectableLogic, 161> {
struct Movable {
KPostponedRef<CKSceneNode> dtmovSceneNode;
uint32_t dtmovSectorIndex = 0;
uint8_t dtmovUnkFlag = 0;
void reflectMembers(MemberListener& r);
};
std::vector<Movable> dtmovMovables;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
void onLevelLoaded(KEnvironment* kenv) override;
};
struct CKTriggerDomain : CKSubclass<CKLogic, 163> {
kobjref<CKObject> unkRef;
uint32_t activeSector;
uint32_t flags;
std::vector<kobjref<CKTriggerDomain>> subdomains;
std::vector<kobjref<CKTrigger>> triggers;
// OG+:
kobjref<CKTriggerSynchro> triggerSynchro;
void deserialize(KEnvironment* kenv, File *file, size_t length) override;
void serialize(KEnvironment* kenv, File *file) override;
void onLevelLoaded(KEnvironment* kenv) override;
};
struct CKSound : CKMRSubclass<CKSound, CKReflectableLogic, 171> {
int32_t sndIndex = -1;
KPostponedRef<CKObject> sndWaveObj;
float sndVolume = 1.0f;
float sndSpeed = 1.0f;
float sndVal3 = 0.0f;
int32_t sndFlags = 0;
std::variant<Vector3, KPostponedRef<CKSceneNode>> sndPosition;
float sndVal4 = 15.0f;
float sndVal5 = 40.0f;
float sndVal6 = 0.0f;
Vector3 sndBoxHigh = { 15.0f,15.0f,15.0f }, sndBoxLow = { -15.0f,-15.0f,-15.0f };
int32_t sndSector = 0;
float ogVal1 = 0.0f, ogVal2 = 0.0f, ogVal3 = 0.0f;
int32_t ogVal4 = 10, ogVal5 = 1, ogLastVal = 1;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
void onLevelLoaded(KEnvironment* kenv) override;
};
struct CSGHotSpot : CKMRSubclass<CSGHotSpot, CKReflectableLogic, 173> {
KPostponedRef<CKSceneNode> csghsUnk0;
uint8_t csghsUnk1 = 255;
std::array<float, 7> csghsUnk2;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKAnyGeometry;
struct CMaterial : CKMRSubclass<CMaterial, CKReflectableLogic, 175> {
// TODO: Check Arthur, OG X360, Spyro
struct Extension {
int extensionType = 0;
uint32_t extUnkCom_1 = 0, extUnkCom_2 = 0;
uint8_t extUnk0_1, extUnk0_2; uint32_t extUnk0_3, extUnk0_4;
uint32_t extUnk2_1 = 0, extUnk2_2 = 0, extUnk2_3 = 0;
uint32_t extUnk4_1 = 0, extUnk4_2 = 0; uint8_t extUnk4_3 = 0;
void reflectMembers(MemberListener& r);
};
kobjref<CKAnyGeometry> geometry;
uint32_t flags = 0;
std::vector<Extension> extensions;
// Type data
kobjref<CKObject> t78_kpbufferRef; // Arthur+
uint32_t t78_unk1; // Arthur+
uint32_t t78_unk2;
uint32_t t8_unk3;
std::string t8_texName;
// Arthur+:
uint8_t ogUnkA1; std::array<uint8_t, 7> ogUnkA2;
uint32_t arPfx1, arPfx2, arPfx3, arPfx4;
kobjref<CMaterial> arPfxAnotherMaterial;
kobjref<CKAnyGeometry> arPfxGeometry;
// Olympic+:
float ogUnkFlt = 50.0f;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKFlashMessageIn;
struct CKFlashPlaySoundEvent : CKMRSubclass<CKFlashPlaySoundEvent, CKReflectableLogic, 185> {
kobjref<CKFlashMessageIn> ckfpseUnk0;
int32_t ckfpseUnk1;
void reflectMembers2(MemberListener& r, KEnvironment* kenv);
};
struct CKStreamObject;
struct CKMusicPlayList : CKMRSubclass<CKMusicPlayList, CKReflectableLogic, 187> {
struct X2Stream {
int32_t streamIndex = 0;
float param1 = 0.0f, param2 = 0.0f, param3 = 1.0f, param4 = 1.0f;
int32_t x2Unk1 = 1;
};