-
Notifications
You must be signed in to change notification settings - Fork 131
/
Copy pathcommon_structs.h
2591 lines (2411 loc) · 84.9 KB
/
common_structs.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
#ifndef _COMMON_STRUCTS_H_
#define _COMMON_STRUCTS_H_
#include "macros.h"
#include "ultra64.h"
#include "types.h"
#include "evt.h"
#include "enums.h"
struct Evt;
typedef ApiStatus(*ApiFunc)(struct Evt*, s32);
typedef Bytecode EvtScript[];
typedef void NoArgCallback(void*);
#define MSG_PTR u8*
#define IMG_PTR u8*
#define PAL_PTR u16*
#define MSG_BIN u8
#define IMG_BIN u8
#define PAL_BIN u16
typedef s32 b32;
typedef s16 b16;
typedef s8 b8;
typedef s32 HitID;
typedef u32 AnimID;
typedef s32 HudElemID;
typedef struct {
u8 r, g, b, a;
} Color_RGBA8;
typedef struct {
u8 r, g, b;
} Color_RGB8;
typedef struct Vec2b {
/* 0x00 */ s8 x;
/* 0x01 */ s8 y;
} Vec2b; // size = 0x02
typedef struct Vec2bu {
/* 0x00 */ u8 x;
/* 0x01 */ u8 y;
} Vec2bu; // size = 0x02
typedef struct Vec3b {
/* 0x00 */ s8 x;
/* 0x01 */ s8 y;
/* 0x02 */ s8 z;
} Vec3b; // size = 0x03
typedef struct Vec2s {
/* 0x00 */ s16 x;
/* 0x02 */ s16 y;
} Vec2s; // size = 0x04
typedef struct Vec2su {
/* 0x00 */ u16 x;
/* 0x02 */ u16 y;
} Vec2su; // size = 0x04
typedef struct Vec3s {
/* 0x00 */ s16 x;
/* 0x02 */ s16 y;
/* 0x04 */ s16 z;
} Vec3s; // size = 0x06
typedef struct Vec2i {
/* 0x00 */ s32 x;
/* 0x04 */ s32 y;
} Vec2i; // size = 0x08
typedef struct VecXZi {
/* 0x00 */ s32 x;
/* 0x04 */ s32 z;
} VecXZi; // size = 0x08
typedef struct Vec3i {
/* 0x00 */ s32 x;
/* 0x04 */ s32 y;
/* 0x08 */ s32 z;
} Vec3i; // size = 0x0C
typedef struct Vec2f {
/* 0x00 */ f32 x;
/* 0x04 */ f32 y;
} Vec2f; // size = 0x08
typedef struct VecXZf {
/* 0x00 */ f32 x;
/* 0x04 */ f32 z;
} VecXZf; // size = 0x08
typedef struct Vec3f {
/* 0x00 */ f32 x;
/* 0x04 */ f32 y;
/* 0x08 */ f32 z;
} Vec3f; // size = 0x0C
typedef struct Vec4f {
/* 0x00 */ f32 x;
/* 0x04 */ f32 y;
/* 0x08 */ f32 z;
/* 0x0C */ f32 yaw;
} Vec4f; // size = 0x10
typedef struct Color4f {
/* 0x00 */ f32 r;
/* 0x04 */ f32 g;
/* 0x08 */ f32 b;
/* 0x0C */ f32 a;
} Color4f; // size = 0x10
typedef struct Color3i {
/* 0x00 */ s32 r;
/* 0x04 */ s32 g;
/* 0x08 */ s32 b;
} Color3i; // size = 0xC
typedef struct Color4i {
/* 0x00 */ s32 r;
/* 0x04 */ s32 g;
/* 0x08 */ s32 b;
/* 0x0C */ s32 a;
} Color4i; // size = 0x10
typedef f32 Matrix4f[4][4]; // size = 0x40
typedef struct Matrix4s {
/* 0x00 */ s16 whole[4][4];
/* 0x20 */ s16 frac[4][4];
} Matrix4s; // size = 0x40
typedef struct CameraRig {
/* 0x00 */ f32 boomYaw;
/* 0x04 */ f32 boomLength;
/* 0x08 */ f32 boomPitch;
/* 0x0C */ f32 viewPitch;
/* 0x10 */ Vec3f targetPos;
} CameraRig; // size = 0x1C
typedef struct DmaTable {
/* 0x00 */ u8* start;
/* 0x04 */ u8* end;
/* 0x08 */ u8* dest;
} DmaTable;
typedef struct PartnerData {
/* 0x00 */ u8 enabled;
/* 0x01 */ s8 level;
/* 0x02 */ s16 unk_02[3];
} PartnerData; // size = 0x08
typedef struct HeapNode {
/* 0x00 */ struct HeapNode* next;
/* 0x04 */ u32 length;
/* 0x08 */ u16 allocated;
/* 0x0A */ u16 entryID;
/* 0x0C */ u32 capacity;
} HeapNode; // size = 0x10
#define NPC_BLUR_FRAMES 20
/// Ring buffer of an NPC's position over the past 20 frames.
typedef struct NpcMotionBlur {
/* 0x00 */ s8 unused;
/* 0x01 */ s8 index; ///< Current blur ring buffer index
/* 0x02 */ char unk_02[2]; // padding?
/* 0x04 */ f32 posX[NPC_BLUR_FRAMES];
/* 0x54 */ f32 posY[NPC_BLUR_FRAMES];
/* 0xA4 */ f32 posZ[NPC_BLUR_FRAMES];
} NpcMotionBlur; // size = 0xF4
typedef struct NpcChompBlur {
/* 0x00 */ struct Npc* npc;
/* 0x04 */ Vec3f offset;
} NpcChompBlur; // size = 0x10;
typedef struct NpcQuizmoBlur {
/* 0x00 */ s32 flags;
/* 0x04 */ char unk_04[0x4];
} NpcQuizmoBlur; // size = 0x8;
typedef struct NpcHistoryPoint {
/* 0x00 */ b8 isAirborne;
/* 0x01 */ char unk_01[0x3];
/* 0x04 */ Vec3f pos;
} NpcHistoryPoint; // size = 0x10
typedef struct FollowAnims {
/* 0x00 */ AnimID walk;
/* 0x04 */ AnimID jump;
/* 0x08 */ AnimID fall;
/* 0x0C */ AnimID land;
/* 0x10 */ AnimID idle;
/* 0x14 */ AnimID run;
} FollowAnims; // size = 0x18
typedef struct NpcFollowData {
/* 0x000 */ NpcHistoryPoint moveHistory[40];
/* 0x280 */ s32 lastPointIdx;
/* 0x284 */ s32 targetPointIdx;
/* 0x288 */ s32 followState;
/* 0x28C */ s32 targetNpcID;
/* 0x290 */ FollowAnims* anims;
/* 0x294 */ f32 walkSpeed;
/* 0x298 */ f32 runSpeed;
/* 0x29C */ f32 idleRadius;
/* 0x2A0 */ f32 walkRadius;
} NpcFollowData; // size = 0x2A4
#define MAX_NPC_DECORATIONS 2
typedef struct Npc {
/* 0x000 */ s32 flags;
/* 0x004 */ void (*onUpdate)(struct Npc*); ///< Run before anything else for this NPC in update_npcs()
/* 0x008 */ void (*onRender)(struct Npc*); ///< Run after the display list for this NPC is built
/* 0x00C */ f32 yaw;
/* 0x010 */ f32 planarFlyDist; /* also used for speech, temp0? */
/* 0x014 */ f32 jumpScale; /* also used for speech, temp1? */
/* 0x018 */ f32 moveSpeed;
/* 0x01C */ f32 jumpVel;
/* 0x020 */ union {
void* any;
NpcMotionBlur* motion; ///< Null unless flag NPC_FLAG_MOTION_BLUR is set.
NpcChompBlur* chomp;
NpcQuizmoBlur* quizmo;
NpcFollowData* followData;
struct Npc* keepAwayNpc;
s32* keepAwayStarted;
} blur;
/* 0x024 */ s32 spriteInstanceID;
/* 0x028 */ AnimID curAnim;
/* 0x02C */ s32 animNotifyValue;
/* 0x030 */ f32 animationSpeed;
/* 0x034 */ f32 renderYaw;
/* 0x038 */ Vec3f pos;
/* 0x044 */ Vec3f rot;
/* 0x050 */ f32 rotPivotOffsetY;
/* 0x054 */ Vec3f scale;
/* 0x060 */ Vec3f moveToPos;
/* 0x06C */ Vec3f colliderPos; /* used during collision with player */
/* 0x078 */ s32 shadowIndex;
/* 0x07C */ f32 shadowScale;
/* 0x080 */ s32 collisionChannel; /* flags used with collision tracing */
/* 0x084 */ s16 curFloor; /* colliderID */
/* 0x086 */ s16 curWall; /* colliderID */
/* 0x088 */ b16 isFacingAway;
/* 0x08A */ s16 yawCamOffset;
/* 0x08C */ s16 turnAroundYawAdjustment;
/* 0x08E */ s16 duration; // TODO: name less vaguely
/* 0x090 */ Vec3s homePos;
/* 0x096 */ s16 unk_96;
/* 0x098 */ s16 imgfxType;
/* 0x09A */ s16 imgfxArg1;
/* 0x09C */ s16 imgfxArg2;
/* 0x09E */ s16 imgfxArg3;
/* 0x0A0 */ s16 imgfxArg4;
/* 0x0A2 */ u16 imgfxFlags;
/* 0x0A4 */ s8 npcID;
/* 0x0A5 */ char unk_A5;
/* 0x0A6 */ s16 collisionDiameter;
/* 0x0A8 */ s16 collisionHeight;
/* 0x0AA */ s8 renderMode;
/* 0x0AB */ s8 verticalRenderOffset;
/* 0x0AC */ u8 alpha;
/* 0x0AD */ u8 hideAlpha; ///< Used when hiding NPCs; Multiplied with Npc::alpha
/* 0x0AE */ char unk_AE[2];
/* 0x0B0 */ AnimID* extraAnimList;
/* 0x0B4 */ s8 palSwapType; // 0..4 inclusive
/* 0x0B5 */ s8 palSwapPrevType;
/* 0x0B6 */ s8 resetPalAdjust;
/* 0x0B7 */ s8 palAnimState;
/* 0x0B8 */ char unk_B8[4];
/* 0x0BC */ s16 nextPalTime;
/* 0x0BE */ s16 palBlendAlpha;
/* 0x0C0 */ s8 spriteColorVariations;
/* 0x0C1 */ s8 originalPalettesCount;
/* 0x0C2 */ char unk_C2[2];
/* 0x0C4 */ PAL_PTR* originalPalettesList;
/* 0x0C8 */ PAL_BIN copiedPalettes[16][SPR_PAL_SIZE];
/* 0x2C8 */ PAL_PTR adjustedPalettes[16];
/* 0x308 */ s16 blendPalA;
/* 0x30A */ s16 blendPalB;
/* 0x30C */ u16 palswapTimeHoldA;
/* 0x30E */ s16 palswapTimeAtoB;
/* 0x310 */ s16 palswapTimeHoldB;
/* 0x312 */ s16 palswapTimeBtoA;
/* 0x314 */ s16 blendPalC;
/* 0x316 */ s16 blendPalD;
/* 0x318 */ f32 screenSpaceOffset2D[2];
/* 0x320 */ f32 verticalStretch;
/* 0x324 */ struct EffectInstance* decorations[MAX_NPC_DECORATIONS];
/* 0x32C */ s8 decorationType[MAX_NPC_DECORATIONS];
/* 0x32E */ s8 changedDecoration[MAX_NPC_DECORATIONS];
/* 0x330 */ s8 decorationInitialized[MAX_NPC_DECORATIONS];
/* 0x332 */ s16 decorationGlowPhase[MAX_NPC_DECORATIONS];
/* 0x336 */ char unk_336[10];
} Npc; // size = 0x340
typedef Npc* NpcList[MAX_NPCS];
typedef struct PlayerData {
/* 0x000 */ s8 bootsLevel;
/* 0x001 */ s8 hammerLevel;
/* 0x002 */ s8 curHP;
/* 0x003 */ s8 curMaxHP;
/* 0x004 */ s8 hardMaxHP;
/* 0x005 */ s8 curFP;
/* 0x006 */ s8 curMaxFP;
/* 0x007 */ s8 hardMaxFP;
/* 0x008 */ s8 maxBP;
/* 0x009 */ s8 level;
/* 0x00A */ b8 hasActionCommands;
/* 0x00B */ char pad_00B;
/* 0x00C */ s16 coins;
/* 0x00E */ s8 fortressKeyCount;
/* 0x00F */ u8 starPieces;
/* 0x010 */ s8 starPoints;
/* 0x011 */ s8 unused_011;
/* 0x012 */ s8 curPartner;
/* 0x013 */ char pad_013;
/* 0x014 */ struct PartnerData partners[12];
/* 0x074 */ s16 keyItems[32];
/* 0x0B4 */ s16 badges[128];
/* 0x1B4 */ s16 invItems[10];
/* 0x1C8 */ s16 storedItems[32];
/* 0x208 */ s16 equippedBadges[64];
/* 0x288 */ s8 unused_288;
/* 0x289 */ s8 merleeSpellType;
/* 0x28A */ s8 merleeCastsLeft;
/* 0x28B */ char pad_28B;
/* 0x28C */ s16 merleeTurnCount;
/* 0x28E */ s8 maxStarPower;
/* 0x28F */ char pad_28F;
/* 0x290 */ s16 starPower;
/* 0x292 */ s8 starBeamLevel;
/* 0x293 */ char pad_293;
/* 0x294 */ u16 actionCommandAttempts;
/* 0x296 */ u16 actionCommandSuccesses;
/* 0x298 */ u16 hitsTaken;
/* 0x29A */ u16 hitsBlocked;
/* 0x29C */ u16 playerFirstStrikes;
/* 0x29E */ u16 enemyFirstStrikes;
/* 0x2A0 */ u16 powerBounces;
/* 0x2A2 */ u16 battlesCount;
/* 0x2A4 */ u16 battlesWon;
/* 0x2A6 */ u16 fleeAttempts;
/* 0x2A8 */ u16 battlesFled;
/* 0x2AA */ u16 trainingsDone;
/* 0x2AC */ s32 walkingStepsTaken;
/* 0x2B0 */ s32 runningStepsTaken;
/* 0x2B4 */ u32 totalCoinsEarned;
/* 0x2B8 */ s16 idleFrameCounter; /* frames with no inputs, overflows ever ~36 minutes of idling */
/* 0x2BA */ char pad_2BA[2];
/* 0x2BC */ u32 frameCounter; /* increases by 2 per frame */
/* 0x2C0 */ u16 quizzesAnswered;
/* 0x2C2 */ u16 quizzesCorrect;
/* 0x2C4 */ s32 partnerUnlockedTime[12];
/* 0x2F4 */ s32 partnerUsedTime[12];
/* 0x324 */ s32 tradeEventStartTime;
/* 0x328 */ s32 droTreeHintTime;
/* 0x32C */ u16 starPiecesCollected;
/* 0x32E */ u16 jumpGamePlays;
/* 0x330 */ u32 jumpGameTotal; /* all-time winnings, max = 99999 */
/* 0x334 */ u16 jumpGameRecord;
/* 0x336 */ u16 smashGamePlays;
/* 0x338 */ u32 smashGameTotal; /* all-time winnings, max = 99999 */
/* 0x33C */ u16 smashGameRecord;
/* 0x33E */ char pad_33E[2];
/* 0x340 */ char reserved[0xE8]; // unused
} PlayerData; // size = 0x428
typedef struct Trigger {
/* 0x00 */ s32 flags;
/* 0x04 */ s32 varIndex;
/* 0x08 */ union {
/* */ s32 colliderID;
/* */ struct BombTrigger* blast;
/* */ } location;
/* 0x0C */ s32 (*onActivateFunc)(struct Trigger*);
/* 0x10 */ EvtScript* onTriggerEvt;
/* 0x14 */ struct Evt* runningScript;
/* 0x18 */ s32 priority;
/* 0x1C */ union {
/* */ s32 varTable[3];
/* */ f32 varTableF[3];
/* */ void* varTablePtr[3];
/* */ };
/* 0x28 */ s32* itemList;
/* 0x2C */ s32 tattleMsg;
/* 0x30 */ u8 hasPlayerInteractPrompt;
/* 0x31 */ char unk_31[3];
/* 0x34 */ s32 runningScriptID;
} Trigger; // size = 0x38
typedef Trigger* TriggerList[MAX_TRIGGERS];
typedef struct TriggerBlueprint {
/* 0x00 */ s32 flags;
/* 0x04 */ s16 varIndex;
/* 0x06 */ char unk_06[2];
/* 0x08 */ s32 colliderID;
/* 0x0C */ s32 (*onActivateFunc)(struct Trigger*);
/* 0x10 */ char unk_10[4];
/* 0x14 */ s32 tattleMsg;
/* 0x18 */ s32 hasPlayerInteractPrompt;
/* 0x1C */ s32* itemList;
} TriggerBlueprint; // size = 0x20
typedef struct Evt {
/* 0x000 */ u8 stateFlags;
/* 0x001 */ u8 curArgc;
/* 0x002 */ u8 curOpcode;
/* 0x003 */ u8 priority;
/* 0x004 */ u8 groupFlags;
/* 0x005 */ s8 blocked; /* 1 = blocking */
/* 0x006 */ s8 loopDepth; /* how many nested loops we are in, >= 8 hangs forever */
/* 0x007 */ s8 switchDepth; /* how many nested switches we are in, max = 8 */
/* 0x008 */ Bytecode* ptrNextLine;
/* 0x00C */ Bytecode* ptrReadPos;
/* 0x010 */ s8 labelIndices[16];
/* 0x020 */ UNK_PTR labelPositions[16];
/* 0x060 */ UNK_PTR userData; /* unknown pointer; allocated on the heap, free'd in kill_script() */
/* 0x064 */ struct Evt* blockingParent; /* parent? */
/* 0x068 */ struct Evt* childScript;
/* 0x06C */ struct Evt* parentScript; /* brother? */
/* 0x070 */ union {
/* */ s32 functionTemp[4];
/* */ f32 functionTempF[4];
/* */ void* functionTempPtr[4];
/* */ };
/* 0x080 */ ApiFunc callFunction;
/* 0x084 */ union {
/* */ s32 varTable[16];
/* */ f32 varTableF[16];
/* */ void* varTablePtr[16];
/* */ };
/* 0x0C4 */ s32 varFlags[3];
/* 0x0D0 */ s32 loopStartTable[8];
/* 0x0F0 */ s32 loopCounterTable[8];
/* 0x110 */ s8 switchBlockState[8];
/* 0x118 */ s32 switchBlockValue[8];
/* 0x138 */ s32* buffer;
/* 0x13C */ s32* array;
/* 0x140 */ s32* flagArray;
/* 0x144 */ s32 id;
/* 0x148 */ union {
s32 enemyID;
s32 actorID;
struct Enemy* enemy; ///< For overworld scripts owned by an Npc
struct Actor* actor; ///< For battle scripts
} owner1; ///< Initially -1
/* 0x14C */ union {
s32 npcID;
s32 triggerID;
struct Npc* npc; ///< For overworld scripts owned by an Npc
struct Trigger* trigger;
} owner2; ///< Initially -1
/* 0x150 */ f32 timeScale;
/* 0x154 */ f32 frameCounter;
/* 0x158 */ s32 unk_158;
/* 0x15C */ Bytecode* ptrFirstLine;
/* 0x160 */ Bytecode* ptrSavedPos;
/* 0x164 */ Bytecode* ptrCurLine;
} Evt; // size = 0x168
typedef Evt* ScriptList[MAX_SCRIPTS];
struct Entity;
struct SaveBlockData;
struct SwitchData;
struct ShatteringBlockData;
struct BlockData;
struct WoodenCrateData;
struct ChestData;
struct BlueWarpPipeData;
struct HeartBlockContentData;
struct SuperBlockContentData;
struct SimpleSpringData;
struct HiddenPanelData;
struct SignpostData;
struct PadlockData;
struct BoardedFloorData;
struct BombableRockData;
struct TweesterData;
struct StarBoxLauncherData;
struct CymbalPlantData;
struct PinkFlowerData;
struct SpinningFlowerData;
struct TrumpetPlantData;
struct MunchlesiaData;
struct ArrowSignData;
typedef s32 (*EntityCallback)(struct Entity*);
typedef struct DmaEntry {
void* start;
void* end;
} DmaEntry;
typedef struct EntityBlueprint {
/* 0x00 */ u16 flags;
/* 0x02 */ u16 typeDataSize;
/* 0x04 */ UNK_PTR renderCommandList;
/* 0x08 */ UNK_PTR modelAnimationNodes;
/* 0x0C */ void (*fpInit)(struct Entity*);
/* 0x10 */ UNK_PTR updateEntityScript;
/* 0x14 */ EntityCallback fpHandleCollision;
/* 0x18 */ union {
DmaEntry dma;
DmaEntry* dmaList;
};
/* 0x20 */ u8 entityType;
/* 0x21 */ u8 aabbSize[3];
} EntityBlueprint; // size = 0x24
typedef union {
s32* any;
struct SaveBlockData* saveBlock;
struct SwitchData* swtch;
struct ShatteringBlockData* shatteringBlock;
struct BlockData* block;
struct WoodenCrateData* crate;
struct ChestData* chest;
struct BlueWarpPipeData* bluePipe;
struct HeartBlockContentData* heartBlockContent;
struct SuperBlockContentData* superBlockContent;
struct SimpleSpringData* simpleSpring;
struct HiddenPanelData* hiddenPanel;
struct SignpostData* signPost;
struct PadlockData* padlock;
struct BoardedFloorData* boardedFloor;
struct BombableRockData* bombableRock;
struct TweesterData* tweester;
struct StarBoxLauncherData* starBoxLauncher;
struct CymbalPlantData* cymbalPlant;
struct PinkFlowerData* pinkFlower;
struct SpinningFlowerData* spinningFlower;
struct TrumpetPlantData* trumpetPlant;
struct MunchlesiaData* munchlesia;
struct ArrowSignData* arrowSign;
} EntityData;
typedef struct Entity {
/* 0x00 */ s32 flags;
/* 0x04 */ u8 listIndex;
/* 0x05 */ s8 unk_05;
/* 0x06 */ u8 collisionFlags;
/* 0x07 */ s8 collisionTimer;
/* 0x08 */ u8 unk_08;
/* 0x09 */ u8 scriptDelay;
/* 0x0A */ u8 type;
/* 0x0B */ u8 alpha;
/* 0x0C */ Vec3s aabb;
/* 0x12 */ s16 vertexSegment;
/* 0x14 */ s16 virtualModelIndex;
/* 0x16 */ s16 shadowIndex;
/* 0x18 */ s32* scriptReadPos;
/* 0x1C */ EntityCallback updateScriptCallback;
/* 0x20 */ EntityCallback updateMatrixOverride;
/* 0x24 */ Evt* boundScript;
/* 0x28 */ EvtScript* boundScriptBytecode;
/* 0x2C */ s32* savedReadPos[3];
/* 0x38 */ EntityBlueprint* blueprint;
/* 0x3C */ void (*renderSetupFunc)(s32);
/* 0x40 */ EntityData dataBuf;
/* 0x44 */ void* gfxBaseAddr;
/* 0x48 */ Vec3f pos;
/* 0x54 */ Vec3f scale;
/* 0x60 */ Vec3f rot;
/* 0x6C */ f32 shadowPosY;
/* 0x70 */ Matrix4f inverseTransformMatrix; /* world-to-local */
/* 0xB0 */ f32 effectiveSize;
/* 0xB4 */ char unk_B4[4];
/* 0xB8 */ Mtx transformMatrix;
} Entity; // size = 0xF8
typedef Entity* EntityList[MAX_ENTITIES];
struct Shadow;
typedef void (*ShadowCallback)(struct Shadow*);
// same as EntityBlueprint
typedef struct ShadowBlueprint {
/* 0x00 */ u16 flags;
/* 0x02 */ s16 typeDataSize;
/* 0x04 */ UNK_PTR renderCommandList;
/* 0x08 */ struct StaticAnimatorNode** animModelNode;
/* 0x0C */ ShadowCallback(onCreateCallback);
/* 0x10 */ char unk_10[0x10];
/* 0x20 */ u8 entityType;
/* 0x21 */ char aabbSize[3];
} ShadowBlueprint; // size = 0x24
typedef struct Shadow {
/* 0x00 */ s32 flags;
/* 0x04 */ u8 listIndex;
/* 0x05 */ u8 alpha;
/* 0x06 */ u8 unk_06;
/* 0x07 */ char unk_07;
/* 0x08 */ s16 entityModelID;
/* 0x0A */ s16 vertexSegment;
/* 0x0C */ Vec3s* vertexArray;
/* 0x10 */ Vec3f pos;
/* 0x1C */ Vec3f scale;
/* 0x28 */ Vec3f rot;
/* 0x34 */ char unk_34[0x4];
/* 0x38 */ Mtx transformMatrix;
} Shadow; // size = 0x78
typedef Shadow* ShadowList[MAX_SHADOWS];
typedef struct Worker {
/* 0x00 */ s32 flags;
/* 0x04 */ void (*update)(void);
/* 0x08 */ void (*draw)(void);
} Worker;
typedef Worker* WorkerList[MAX_WORKERS];
typedef struct MusicSettings {
/* 0x00 */ u16 flags;
/* 0x02 */ s16 state;
/* 0x04 */ s32 fadeOutTime;
/* 0x08 */ s32 fadeInTime;
/* 0x0C */ s16 fadeStartVolume;
/* 0x0E */ s16 fadeEndVolume;
/* 0x10 */ s32 songID;
/* 0x14 */ s32 variation;
/* 0x18 */ s32 songName;
/* 0x1C */ s32 battleSongID;
/* 0x20 */ s32 battleVariation;
/* 0x24 */ s32 savedSongID;
/* 0x28 */ s32 savedVariation;
/* 0x2C */ s32 savedSongName;
} MusicSettings; // size = 0x30
typedef struct MusicProximityTrigger {
/* 0x00 */ VecXZf pos;
/* 0x08 */ f32 innerDist;
/* 0x0C */ f32 outerDist;
/* 0x10 */ s32 unk;
/* 0x14 */ s32 manualActivationFlag;
} MusicProximityTrigger; // size = 0x18
typedef struct StatusBar {
/* 0x00 */ HudElemID hpIconHIDs[2];
/* 0x08 */ HudElemID fpIconHIDs[2];
/* 0x10 */ HudElemID coinIconHID;
/* 0x14 */ HudElemID coinSparkleHID;
/* 0x18 */ HudElemID spIconHID;
/* 0x1C */ HudElemID spShineHID;
/* 0x20 */ HudElemID hpTimesHID;
/* 0x24 */ HudElemID fpTimesHID;
/* 0x28 */ HudElemID spTimesHID;
/* 0x2C */ HudElemID coinTimesHID;
/* 0x30 */ HudElemID starIconHID;
/* 0x34 */ s16 drawPosX; // base position of the whole bar
/* 0x36 */ s16 drawPosY; // base position of the whole bar, animated when it appears
/* 0x38 */ s16 showTimer;
/* 0x3A */ b8 hidden; // current state of the status bar's visiblity
/* 0x3B */ b8 unk_3B;
/* 0x3C */ b8 unk_3C;
/* 0x3D */ s8 displayHP;
/* 0x3E */ s8 displayFP;
/* 0x3F */ char pad_3F;
/* 0x40 */ s16 displayCoins;
/* 0x42 */ s16 displayStarpoints;
/* 0x44 */ s8 ignoreChanges; /* set != 0 to prevent automatic opening from HP/FP changes */
/* 0x45 */ s8 openInputDisabled;
/* 0x45 */ s8 alwaysShown; // when set, the status bar will always be shown. used while browsing a shop.
/* 0x47 */ s8 disabled; /* set != 0 for menu to be disabled completely */
/* 0x48 */ s16 displayStarPower;
/* 0x4A */ b8 hpBlinking;
/* 0x4B */ s8 hpBlinkAnimTime;
/* 0x4C */ s8 hpBlinkTimeLeft;
/* 0x4D */ b8 fpBlinking;
/* 0x4E */ s8 fpBlinkAnimTime;
/* 0x4F */ s8 fpBlinkTimeLeft;
/* 0x50 */ b8 starPowerBlinking;
/* 0x51 */ s8 starPowerBlinkCounter;
/* 0x52 */ b8 starpointsBlinking;
/* 0x53 */ s8 starpointsBlinkAnimTime;
/* 0x54 */ b8 coinsBlinking;
/* 0x55 */ s8 coinsBlinkAnimTime;
/* 0x56 */ s8 coinsBlinkTimeLeft;
/* 0x57 */ s8 shimmerState;
/* 0x58 */ s8 shimmerTime;
/* 0x59 */ s8 shimmerLimit;
/* 0x5A */ s8 powBarsToBlink; // how many star power bars to blink
/* 0x5B */ char pad_5B;
/* 0x5C */ HudElemID coinCountTimesHID;
/* 0x60 */ HudElemID coinCountIconHID;
/* 0x64 */ HudElemID iconIndex12;
/* 0x68 */ HudElemID iconIndex13;
/* 0x6C */ s8 coinCounterHideDelay;
/* 0x6D */ s8 coinCountDisposeTime;
/* 0x6E */ s8 prevIgnoreChanges; // while the coin counter is open, ignoreChanges count is pushed here
/* 0x6F */ char pad_6F;
} StatusBar; // size = 0x70
typedef struct CameraInitData {
/* 0x00 */ s16 flags;
/* 0x02 */ s8 updateMode;
/* 0x03 */ char unk_03;
/* 0x04 */ s16 viewWidth;
/* 0x06 */ s16 viewHeight;
/* 0x08 */ s16 viewStartX;
/* 0x0A */ s16 viewStartY;
/* 0x0C */ s16 nearClip;
/* 0x0E */ s16 farClip;
/* 0x10 */ s16 vfov;
} CameraInitData; // size = 0x12;
typedef struct CameraUnk {
/* 0x00 */ s16 unk_00;
/* 0x02 */ s16 unk_02;
/* 0x04 */ char unk_04[0x8];
/* 0x0C */ s32 unk_0C;
/* 0x10 */ char unk_10[0x54];
/* 0x64 */ s32 unk_64;
/* 0x68 */ char unk_68[0x24];
} CameraUnk; // size = 0x8C
typedef struct CameraControlSettings {
/* 0x00 */ s32 type;
/* 0x04 */ f32 boomLength;
/* 0x08 */ f32 boomPitch;
union {
struct {
f32 Ax;
f32 Ay;
f32 Az;
f32 Bx;
f32 By;
f32 Bz;
} two;
struct {
f32 Ax;
f32 Cx;
f32 Az;
f32 Bx;
f32 Cz;
f32 Bz;
} three;
} points;
/* 0x24 */ f32 viewPitch;
/* 0x28 */ b32 flag;
} CameraControlSettings; // size = 0x2C
typedef struct Camera {
/* 0x000 */ u16 flags;
/* 0x002 */ s16 moveFlags;
/* 0x004 */ s16 updateMode;
/* 0x006 */ b16 needsInit;
/* 0x008 */ b16 needsReinit; // used when loading from a save point or calling SetCamPerspective
/* 0x00A */ s16 viewportW;
/* 0x00C */ s16 viewportH;
/* 0x00E */ s16 viewportStartX;
/* 0x010 */ s16 viewportStartY;
/* 0x012 */ s16 nearClip;
/* 0x014 */ s16 farClip;
/* 0x016 */ char unk_16[2];
/* 0x018 */ f32 vfov;
union {
struct {
/* 0x01C */ s16 camParam1;
/* 0x01E */ s16 camParam2;
/* 0x020 */ s16 camParam3;
/* 0x022 */ s16 camParam4;
/* 0x024 */ s16 camParam5;
/* 0x026 */ s16 camParam6;
/* 0x028 */ s16 camParam7;
/* 0x02A */ s16 zoomPercent;
} world;
struct {
/* 0x01C */ b16 skipRecalc;
/* 0x01E */ s16 dist;
/* 0x020 */ s16 fovScale; // 100 --> vfov = 25, scales as 1/x so larger values mean smaller vfov
/* 0x022 */ s16 pitch;
/* 0x024 */ s16 yaw;
/* 0x026 */ s16 offsetY;
/* 0x028 */ s16 camParam7;
/* 0x02A */ s16 zoomPercent;
} basic;
struct {
/* 0x01C */ s16 pitch;
/* 0x01E */ s16 yaw;
/* 0x020 */ s16 dist;
/* 0x022 */ s16 offsetY;
} interp;
struct {
/* 0x01C */ s16 pitch;
/* 0x01E */ s16 minRadius;
/* 0x020 */ s16 dist;
/* 0x022 */ s16 offsetY;
} radial;
struct {
/* 0x01C */ s16 xLimit;
/* 0x01E */ s16 zLimit;
/* 0x020 */ s16 dist;
/* 0x022 */ s16 offsetY;
} confined;
} params;
/* 0x02C */ s16 bgColor[3];
/* 0x032 */ Vec3s targetScreenCoords; // screen coords corresponding to targetPos
/* 0x038 */ u16 perspNorm;
/* 0x03A */ char unk_3A[2];
/* 0x03C */ Vec3f lookAt_eye; // used to construct the view matrix
/* 0x048 */ Vec3f lookAt_obj; // used to construct the view matrix
/* 0x054 */ Vec3f lookAt_obj_target;
/* 0x060 */ Vec3f targetPos; // target for camera rig, often but not necessarily the player position
/* 0x06C */ f32 curYaw;
/* 0x070 */ f32 interpYaw; // no camera mode actually uses this for interpolation
/* 0x074 */ f32 curBoomPitch;
/* 0x078 */ f32 curBoomLength;
/* 0x07C */ f32 targetOffsetY;
/* 0x080 */ char unk_80[4];
/* 0x084 */ f32 curBoomYaw;
/* 0x088 */ f32 targetBoomYaw; // only used by CAM_UPDATE_UNUSED_RADIAL
/* 0x08C */ f32 unk_8C;
/* 0x090 */ f32 lookAt_yaw;
/* 0x094 */ f32 lookAt_pitch;
/* 0x098 */ f32 unk_98;
/* 0x09C */ f32 unk_9C;
/* 0x0A0 */ Vp vp;
/* 0x0B0 */ Vp vpAlt;
/* 0x0C0 */ s32 unk_C0;
/* 0x0C4 */ f32 unk_C4;
/* 0x0C8 */ char unk_C8[0xC];
/* 0x0D4 */ Matrix4f mtxPerspective;
/* 0x114 */ Matrix4f mtxViewPlayer; // centers on player
/* 0x154 */ Matrix4f mtxViewLeading; // leads player slightly
/* 0x194 */ Matrix4f mtxViewShaking; // used while ShakeCam is active
/* 0x1D4 */ char unk_1D4[0x28];
/* 0x1FC */ void (*fpDoPreRender)(struct Camera*);
/* 0x200 */ void (*fpDoPostRender)(struct Camera*);
/* 0x204 */ Mtx* mtxBillboard; // rotation matrix created from -curBoomYaw
/* 0x208 */ s32 unk_208;
/* 0x20C */ Matrix4s* unkEffectMatrix;
/* 0x210 */ char unk_210[0x2];
/* 0x212 */ s16 unk_212;
/* 0x214 */ CameraUnk unk_214[4];
/* 0x444 */ CameraControlSettings* prevSettings;
/* 0x448 */ CameraControlSettings* curSettings;
/* 0x44C */ CameraRig prevRig;
/* 0x468 */ CameraRig nextRig;
/* 0x484 */ f32 interpAlpha;
/* 0x488 */ f32 linearInterp;
/* 0x48C */ f32 linearInterpRate;
/* 0x490 */ f32 moveSpeed;
/* 0x494 */ f32 yinterpGoal;
/* 0x498 */ f32 yinterpAlpha;
/* 0x49C */ f32 yinterpRate; // smaller is faster; not valid for values less than 1.0, unstable below 0.5
/* 0x4A0 */ f32 yinterpCur;
/* 0x4A4 */ Vec3f prevTargetPos;
/* 0x4B0 */ Vec3f movePos;
/* 0x4BC */ Vec3f prevPrevMovePos;
/* 0x4C8 */ Vec3f prevMovePos;
/* 0x4D4 */ u16 prevPrevFollowPlayer;
/* 0x4D6 */ u16 prevFollowPlayer;
/* 0x4D8 */ CameraControlSettings controlSettings;
/* 0x504 */ u16 followPlayer;
/* 0x506 */ u16 panActive;
/* 0x508 */ f32 interpEasingParameter; // controls whether easing for camera rig interpolation is more cosine-like (values near 0) or quadratic (values near 1)
/* 0x50C */ f32 leadAmount;
/* 0x510 */ f32 targetLeadAmount;
/* 0x514 */ f32 leadInterpAlpha;
/* 0x518 */ f32 accumulatedStickLead;
/* 0x51C */ s32 increasingLeadInterp;
/* 0x520 */ f32 leadAmtScale;
/* 0x524 */ f32 prevLeadPosX;
/* 0x528 */ f32 prevLeadPosZ;
/* 0x52C */ s32 leadConstrainDir;
/* 0x530 */ b32 needsInitialConstrainDir;
/* 0x534 */ CameraControlSettings* prevLeadSettings;
/* 0x538 */ char unk_538[0x18];
/* 0x550 */ f32 unusedLeadAmt;
/* 0x554 */ s16 unusedLeadCounter;
/* 0x556 */ s16 unusedLeadDir;
} Camera; // size = 0x558
typedef struct BattleStatus {
/* 0x000 */ s32 flags1;
/* 0x004 */ s32 flags2;
/* 0x008 */ union {
/* */ s32 varTable[16];
/* */ f32 varTableF[16];
/* */ void* varTablePtr[16];
/* */ };
/* 0x048 */ s8 curSubmenu;
/* 0x049 */ s8 unk_49;
/* 0x04A */ s8 curPartnerSubmenu;
/* 0x04B */ s8 unk_4B;
/* 0x04C */ s8 lastPlayerMenuSelection[16];
/* 0x05C */ s8 lastPartnerMenuSelection[16];
/* 0x06C */ s16 cancelTargetMenuSubstate; // might be more generally for returning from nested 'inner' state
/* 0x06E */ s16 acceptTargetMenuSubstate; // might be more generally for returning from nested 'inner' state
/* 0x070 */ s16 enabledMenusFlags; // zero'd bits will be unavailable, used only for tutorial battles
/* 0x072 */ char unk_72[2];
/* 0x074 */ s32 enabledStarPowersFlags; // zero'd bits will be unavailable, used only for tutorial battles
/* 0x078 */ s8 totalStarPoints;
/* 0x079 */ s8 pendingStarPoints; /* how many to add */
/* 0x07A */ s8 incrementStarPointDelay; /* related to star points, set to 0x28 when they are dropped */
/* 0x07B */ u8 damageTaken;
/* 0x07C */ s8 changePartnerAllowed;
/* 0x07D */ s8 menuStatus[4]; ///< -1 = automatically pick the first move, 0 = disabled, 1 = enabled
/* 0x081 */ s8 actionQuality; // degree of success for action command, -1 indicates failure, 0 is in progress, >0 is some degree of success
/* 0x082 */ s8 maxActionQuality; // seems to indicate the maximum positive value for actionQuality; never read and inconsistently used between various action commands
/* 0x083 */ s8 actionCommandMode;
/* 0x084 */ s8 actionProgress;
/* 0x085 */ s8 resultTier;
/* 0x086 */ s8 actionResult; // see enum ActionResult
/* 0x087 */ s8 blockResult; // see enum BlockResult
/* 0x088 */ s8 itemUsesLeft; /* set to 2 for double dip, 3 for triple dip */
/* 0x089 */ s8 hpDrainCount;
/* 0x08A */ s8 nextMerleeSpellType;
/* 0x08B */ s8 hustleTurns; /* numTurns from hustle drink, normally 0 */
/* 0x08C */ s8 stateFreezeCount;
/* 0x08D */ s8 endBattleFadeOutRate;
/* 0x08E */ s8 initialEnemyCount; /* used for SP award bonus */
/* 0x08F */ char unk_8F[1];
/* 0x090 */ s16 unk_90;
/* 0x092 */ s8 reflectFlags;
/* 0x093 */ s8 unk_93;
/* 0x094 */ s8 unk_94;
/* 0x095 */ s8 waitForState;
/* 0x096 */ s8 hammerCharge;
/* 0x097 */ s8 jumpCharge;
/* 0x098 */ char unk_98;
/* 0x099 */ u8 rushFlags; /* 1 = mega rush, 2 = power rush */
/* 0x09A */ s8 outtaSightActive;
/* 0x09B */ s8 turboChargeTurnsLeft;
/* 0x09C */ u8 turboChargeAmount; /* unused? */
/* 0x09D */ s8 waterBlockTurnsLeft;
/* 0x09E */ u8 waterBlockAmount; /* unused? */
/* 0x09F */ char unk_9F;
/* 0x0A0 */ struct EffectInstance* waterBlockEffect;
/* 0x0A4 */ s8 cloudNineTurnsLeft;
/* 0x0A5 */ s8 cloudNineDodgeChance; /* = 50/101 ≈ 49.5% */
/* 0x0A6 */ char unk_A6[2];
/* 0x0A8 */ struct EffectInstance* cloudNineEffect;
/* 0x0AC */ s8 merleeAttackBoost;
/* 0x0AD */ s8 merleeDefenseBoost;
/* 0x0AE */ s8 hammerLossTurns;
/* 0x0AF */ s8 jumpLossTurns;
/* 0x0B0 */ s8 itemLossTurns;
/* 0x0B1 */ char unk_B1[3];
/* 0x0B4 */ UNK_FUN_PTR(preUpdateCallback);
/* 0x0B8 */ UNK_FUN_PTR(initBattleCallback);
/* 0x0BC */ struct Evt* controlScript; /* control handed over to this when changing partners */
/* 0x0C0 */ s32 controlScriptID;
/* 0x0C4 */ struct Evt* camMovementScript;
/* 0x0C8 */ s32 camMovementScriptID;
/* 0x0CC */ Vec3f camLookatObjPos;
/* 0x0D8 */ struct Actor* playerActor;
/* 0x0DC */ struct Actor* partnerActor;
/* 0x0E0 */ struct Actor* enemyActors[MAX_ENEMY_ACTORS];
/* 0x140 */ s16 enemyIDs[MAX_ENEMY_ACTORS];
/* 0x170 */ s8 nextEnemyIndex; /* (during enemy turn) who should go next */
/* 0x171 */ s8 numEnemyActors;
/* 0x172 */ s16 activeEnemyActorID; /* (during enemy turn) enemy currently using their move */
/* 0x174 */ struct Actor* curTurnEnemy;
/* 0x178 */ s8 moveCategory; ///< 0 = jump, 1 = hammer, 5 = partner, ...
/* 0x179 */ char unk_179;
/* 0x17A */ s16 moveArgument; // argument provided for move; can be hammer/boots level, itemID, etc
/* 0x17C */ s16 selectedMoveID;
/* 0x17E */ s16 curAttackDamage;
/* 0x180 */ s16 lastAttackDamage;
/* 0x182 */ char unk_182[2];
/* 0x184 */ s32 curTargetListFlags; /* set when creating a target list, also obtain from the flags field of moves */
/* 0x188 */ s32 curAttackElement;
/* 0x18C */ s32 curAttackEventSuppression;
/* 0x190 */ s32 curAttackStatus;
/* 0x194 */ u8 statusChance;
/* 0x195 */ s8 statusDuration;
/* 0x196 */ char unk_196;
/* 0x197 */ s8 sampleTargetHomeIndex;
/* 0x198 */ s8 powerBounceCounter;
/* 0x199 */ s8 wasStatusInflicted; /* during last attack */
/* 0x19A */ u8 curDamageSource;
/* 0x19B */ char unk_19B[5];
/* 0x1A0 */ s16 curTargetID; /* selected? */
/* 0x1A2 */ s8 curTargetPart; /* selected? */
/* 0x1A3 */ char unk_1A3;
/* 0x1A4 */ s16 curTargetID2;
/* 0x1A6 */ s8 curTargetPart2;
/* 0x1A7 */ s8 battlePhase;
/* 0x1A8 */ s16 attackerActorID;
/* 0x1AA */ s16 unk_1AA;
/* 0x1AC */ s8 unk_1AC;
/* 0x1AD */ char unk_1AD;