4 // This file contains various data types used in Super Mario 64 that don't yet
5 // have an appropriate header.
11 // Certain functions are marked as having return values, but do not
12 // actually return a value. This causes undefined behavior, which we'd rather
13 // avoid on modern GCC. This only impacts -O2 and can matter for both the function
14 // itself and functions that call it.
16 #define BAD_RETURN(cmd) void
18 #define BAD_RETURN(cmd) cmd
24 /*0x00*/ s16 rawStickX
; //
25 /*0x02*/ s16 rawStickY
; //
26 /*0x04*/ float stickX
; // [-64, 64] positive is right
27 /*0x08*/ float stickY
; // [-64, 64] positive is up
28 /*0x0C*/ float stickMag
; // distance from center [0, 64]
29 /*0x10*/ u16 buttonDown
;
30 /*0x12*/ u16 buttonPressed
;
31 /*0x14*/ OSContStatus
*statusData
;
32 /*0x18*/ OSContPad
*controllerData
;
37 typedef f32 Vec3f
[3]; // X, Y, Z, where Y is up
43 typedef f32 Mat4
[4][4];
45 typedef uintptr_t GeoLayout
;
46 typedef uintptr_t LevelScript
;
48 typedef s16 MacroObject
;
49 typedef s16 Collision
;
50 typedef s16 Trajectory
;
51 typedef s16 PaintingData
;
52 typedef uintptr_t BehaviorScript
;
55 SPTASK_STATE_NOT_STARTED
,
57 SPTASK_STATE_INTERRUPTED
,
58 SPTASK_STATE_FINISHED
,
59 SPTASK_STATE_FINISHED_DP
65 /*0x40*/ OSMesgQueue
*msgqueue
;
67 /*0x48*/ enum SpTaskState state
;
68 }; // size = 0x4C, align = 0x8
76 #define ANIM_FLAG_NOLOOP (1 << 0) // 0x01
77 #define ANIM_FLAG_FORWARD (1 << 1) // 0x02
78 #define ANIM_FLAG_2 (1 << 2) // 0x04
79 #define ANIM_FLAG_HOR_TRANS (1 << 3) // 0x08
80 #define ANIM_FLAG_VERT_TRANS (1 << 4) // 0x10
81 #define ANIM_FLAG_5 (1 << 5) // 0x20
82 #define ANIM_FLAG_6 (1 << 6) // 0x40
83 #define ANIM_FLAG_7 (1 << 7) // 0x80
92 /*0x0C*/ const s16
*values
;
93 /*0x10*/ const u16
*index
;
94 /*0x14*/ u32 length
; // only used with Mario animations to determine how much to load. 0 otherwise.
97 #define ANIMINDEX_NUMPARTS(animindex) (sizeof(animindex) / sizeof(u16) / 6 - 1)
101 /*0x00*/ s16 type
; // structure type
102 /*0x02*/ s16 flags
; // hi = drawing layer, lo = rendering modes
103 /*0x04*/ struct GraphNode
*prev
;
104 /*0x08*/ struct GraphNode
*next
;
105 /*0x0C*/ struct GraphNode
*parent
;
106 /*0x10*/ struct GraphNode
*children
;
110 struct GraphNodeObject_sub
112 /*0x00 0x38*/ s16 animID
;
113 /*0x02 0x3A*/ s16 animYTrans
;
114 /*0x04 0x3C*/ struct Animation
*curAnim
;
115 /*0x08 0x40*/ s16 animFrame
;
116 /*0x0A 0x42*/ u16 animTimer
;
117 /*0x0C 0x44*/ s32 animFrameAccelAssist
;
118 /*0x10 0x48*/ s32 animAccel
;
121 struct GraphNodeObject
123 /*0x00*/ struct GraphNode node
;
124 /*0x14*/ struct GraphNode
*sharedChild
;
127 /*0x1A*/ Vec3s angle
;
129 /*0x2C*/ Vec3f scale
;
130 /*0x38*/ struct GraphNodeObject_sub unk38
;
131 /*0x4C*/ struct SpawnInfo
*unk4C
;
132 /*0x50*/ void *throwMatrix
; // matrix ptr
133 /*0x54*/ Vec3f cameraToObject
;
138 struct GraphNodeObject gfx
;
139 struct ObjectNode
*next
;
140 struct ObjectNode
*prev
;
143 // NOTE: Since ObjectNode is the first member of Object, it is difficult to determine
144 // whether some of these pointers point to ObjectNode or Object.
148 /*0x000*/ struct ObjectNode header
;
149 /*0x068*/ struct Object
*parentObj
;
150 /*0x06C*/ struct Object
*prevObj
;
151 /*0x070*/ u32 collidedObjInteractTypes
;
152 /*0x074*/ s16 activeFlags
;
153 /*0x076*/ s16 numCollidedObjs
;
154 /*0x078*/ struct Object
*collidedObjs
[4];
158 // Object fields. See object_fields.h.
166 struct Animation
**asAnims
[0x50];
167 struct Waypoint
*asWaypoint
[0x50];
168 struct ChainSegment
*asChainSegment
[0x50];
169 struct Object
*asObject
[0x50];
170 struct Surface
*asSurface
[0x50];
171 void *asVoidPtr
[0x50];
172 const void *asConstVoidPtr
[0x50];
179 struct Animation
**asAnims
[0x50];
180 struct Waypoint
*asWaypoint
[0x50];
181 struct ChainSegment
*asChainSegment
[0x50];
182 struct Object
*asObject
[0x50];
183 struct Surface
*asSurface
[0x50];
184 void *asVoidPtr
[0x50];
185 const void *asConstVoidPtr
[0x50];
188 /*0x1C8*/ u32 unused1
;
189 /*0x1CC*/ const BehaviorScript
*curBhvCommand
;
190 /*0x1D0*/ u32 bhvStackIndex
;
191 /*0x1D4*/ uintptr_t bhvStack
[8];
192 /*0x1F4*/ s16 bhvDelayTimer
;
193 /*0x1F6*/ s16 respawnInfoType
;
194 /*0x1F8*/ f32 hitboxRadius
;
195 /*0x1FC*/ f32 hitboxHeight
;
196 /*0x200*/ f32 hurtboxRadius
;
197 /*0x204*/ f32 hurtboxHeight
;
198 /*0x208*/ f32 hitboxDownOffset
;
199 /*0x20C*/ const BehaviorScript
*behavior
;
200 /*0x210*/ u32 unused2
;
201 /*0x214*/ struct Object
*platform
;
202 /*0x218*/ void *collisionData
;
203 /*0x21C*/ Mat4 transform
;
204 /*0x25C*/ void *respawnInfo
;
209 /*0x00*/ u32 interactType
;
210 /*0x04*/ u8 downOffset
;
211 /*0x05*/ s8 damageOrCoinValue
;
213 /*0x07*/ s8 numLootCoins
;
216 /*0x0C*/ s16 hurtboxRadius
;
217 /*0x0E*/ s16 hurtboxHeight
;
234 /*0x0A*/ Vec3s vertex1
;
235 /*0x10*/ Vec3s vertex2
;
236 /*0x16*/ Vec3s vertex3
;
242 /*0x28*/ f32 originOffset
;
243 /*0x2C*/ struct Object
*object
;
246 struct MarioBodyState
249 /*0x04*/ s8 capState
; /// see MarioCapGSCId
250 /*0x05*/ s8 eyeState
;
251 /*0x06*/ s8 handState
;
252 /*0x07*/ s8 wingFlutter
; /// whether Mario's wing cap wings are fluttering
253 /*0x08*/ s16 modelState
;
255 /*0x0B*/ u8 punchState
; /// 2 bits for type of punch, 6 bits for punch animation timer
256 /*0x0C*/ Vec3s torsoAngle
;
257 /*0x12*/ Vec3s headAngle
;
258 /*0x18*/ Vec3f heldObjLastPosition
; /// also known as HOLP
262 struct OffsetSizePair
268 struct MarioAnimDmaRelatedThing
272 struct OffsetSizePair anim
[1]; // dynamic size
275 struct MarioAnimation
277 struct MarioAnimDmaRelatedThing
*animDmaTable
;
279 struct Animation
*targetAnim
;
288 /*0x08*/ u32 particleFlags
;
290 /*0x10*/ u32 prevAction
;
291 /*0x14*/ u32 terrainSoundAddend
;
292 /*0x18*/ u16 actionState
;
293 /*0x1A*/ u16 actionTimer
;
294 /*0x1C*/ u32 actionArg
;
295 /*0x20*/ f32 intendedMag
;
296 /*0x24*/ s16 intendedYaw
;
297 /*0x26*/ s16 invincTimer
;
298 /*0x28*/ u8 framesSinceA
;
299 /*0x29*/ u8 framesSinceB
;
300 /*0x2A*/ u8 wallKickTimer
;
301 /*0x2B*/ u8 doubleJumpTimer
;
302 /*0x2C*/ Vec3s faceAngle
;
303 /*0x32*/ Vec3s angleVel
;
304 /*0x38*/ s16 slideYaw
;
305 /*0x3A*/ s16 twirlYaw
;
308 /*0x54*/ f32 forwardVel
;
309 /*0x58*/ f32 slideVelX
;
310 /*0x5C*/ f32 slideVelZ
;
311 /*0x60*/ struct Surface
*wall
;
312 /*0x64*/ struct Surface
*ceil
;
313 /*0x68*/ struct Surface
*floor
;
314 /*0x6C*/ f32 ceilHeight
;
315 /*0x70*/ f32 floorHeight
;
316 /*0x74*/ s16 floorAngle
;
317 /*0x76*/ s16 waterLevel
;
318 /*0x78*/ struct Object
*interactObj
;
319 /*0x7C*/ struct Object
*heldObj
;
320 /*0x80*/ struct Object
*usedObj
;
321 /*0x84*/ struct Object
*riddenObj
;
322 /*0x88*/ struct Object
*marioObj
;
323 /*0x8C*/ struct SpawnInfo
*spawnInfo
;
324 /*0x90*/ struct Area
*area
;
325 /*0x94*/ struct PlayerCameraState
*statusForCamera
;
326 /*0x98*/ struct MarioBodyState
*marioBodyState
;
327 /*0x9C*/ struct Controller
*controller
;
328 /*0xA0*/ struct MarioAnimation
*animation
;
329 /*0xA4*/ u32 collidedObjInteractTypes
;
330 /*0xA8*/ s16 numCoins
;
331 /*0xAA*/ s16 numStars
;
332 /*0xAC*/ s8 numKeys
; // Unused key mechanic
333 /*0xAD*/ s8 numLives
;
336 /*0xB2*/ u8 hurtCounter
;
337 /*0xB3*/ u8 healCounter
;
338 /*0xB4*/ u8 squishTimer
;
339 /*0xB5*/ u8 fadeWarpOpacity
;
340 /*0xB6*/ u16 capTimer
;
342 /*0xBC*/ f32 peakHeight
;
343 /*0xC0*/ f32 quicksandDepth
;