diff --git a/include/z64collision_check.h b/include/z64collision_check.h index 26c1a3f5b..07f4939b8 100644 --- a/include/z64collision_check.h +++ b/include/z64collision_check.h @@ -10,100 +10,100 @@ struct PlayState; typedef struct { /* 0x00 */ struct Actor* actor; // Attached actor - /* 0x04 */ struct Actor* at; // Actor attached to what it collided with as an AT collider. - /* 0x08 */ struct Actor* ac; // Actor attached to what it collided with as an AC collider. - /* 0x0C */ struct Actor* oc; // Actor attached to what it collided with as an OC collider. - /* 0x10 */ u8 atFlags; // Information flags for AT collisions. - /* 0x11 */ u8 acFlags; // Information flags for AC collisions. - /* 0x12 */ u8 ocFlags1; // Information flags for OC collisions. - /* 0x13 */ u8 ocFlags2; // Flags related to which colliders it can OC collide with. - /* 0x14 */ u8 colType; // Determines hitmarks and sound effects during AC collisions. - /* 0x15 */ u8 shape; // JntSph, Cylinder, Tris, or Quad + /* 0x04 */ struct Actor* at; // Actor attached to what it collided with as an AT collider. + /* 0x08 */ struct Actor* ac; // Actor attached to what it collided with as an AC collider. + /* 0x0C */ struct Actor* oc; // Actor attached to what it collided with as an OC collider. + /* 0x10 */ u8 atFlags; // Information flags for AT collisions. + /* 0x11 */ u8 acFlags; // Information flags for AC collisions. + /* 0x12 */ u8 ocFlags1; // Information flags for OC collisions. + /* 0x13 */ u8 ocFlags2; // Flags related to which colliders it can OC collide with. + /* 0x14 */ u8 colType; // Determines hitmarks and sound effects during AC collisions. + /* 0x15 */ u8 shape; // JntSph, Cylinder, Tris, or Quad } Collider; // size = 0x18 typedef struct { - /* 0x0 */ u8 colType; // Determines hitmarks and sound effects during AC collisions. - /* 0x1 */ u8 atFlags; // Information flags for AT collisions. - /* 0x2 */ u8 acFlags; // Information flags for OC collisions. + /* 0x0 */ u8 colType; // Determines hitmarks and sound effects during AC collisions. + /* 0x1 */ u8 atFlags; // Information flags for AT collisions. + /* 0x2 */ u8 acFlags; // Information flags for OC collisions. /* 0x3 */ u8 ocFlags1; // Information flags for OC collisions. /* 0x4 */ u8 ocFlags2; // Flags related to which colliders it can OC collide with. - /* 0x5 */ u8 shape; // JntSph, Cylinder, Tris, or Quad + /* 0x5 */ u8 shape; // JntSph, Cylinder, Tris, or Quad } ColliderInit; // size = 0x6 typedef struct { - /* 0x0 */ u8 colType; // Determines hitmarks and sound effects during AC collisions. - /* 0x1 */ u8 atFlags; // Information flags for AT collisions. - /* 0x2 */ u8 acFlags; // Information flags for AC collisions. + /* 0x0 */ u8 colType; // Determines hitmarks and sound effects during AC collisions. + /* 0x1 */ u8 atFlags; // Information flags for AT collisions. + /* 0x2 */ u8 acFlags; // Information flags for AC collisions. /* 0x3 */ u8 ocFlags1; // Information flags for OC collisions. - /* 0x4 */ u8 shape; // JntSph, Cylinder, Tris, or Quad + /* 0x4 */ u8 shape; // JntSph, Cylinder, Tris, or Quad } ColliderInitType1; // size = 0x5 typedef struct { /* 0x0 */ struct Actor* actor; // Attached actor - /* 0x4 */ u8 atFlags; // Information flags for AT collisions. - /* 0x5 */ u8 acFlags; // Information flags for AC collisions. - /* 0x6 */ u8 ocFlags1; // Information flags for OC collisions. - /* 0x7 */ u8 shape; // JntSph, Cylinder, Tris, or Quad + /* 0x4 */ u8 atFlags; // Information flags for AT collisions. + /* 0x5 */ u8 acFlags; // Information flags for AC collisions. + /* 0x6 */ u8 ocFlags1; // Information flags for OC collisions. + /* 0x7 */ u8 shape; // JntSph, Cylinder, Tris, or Quad } ColliderInitToActor; // size = 0x8 typedef struct { - /* 0x0 */ u32 dmgFlags; // Toucher damage type flags. - /* 0x4 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) - /* 0x5 */ u8 damage; // Damage or Stun Timer + /* 0x0 */ u32 dmgFlags; // Toucher damage type flags. + /* 0x4 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) + /* 0x5 */ u8 damage; // Damage or Stun Timer } ColliderTouch; // size = 0x8 typedef struct { - /* 0x0 */ u32 dmgFlags; // Toucher damage type flags. - /* 0x4 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) - /* 0x5 */ u8 damage; // Damage or Stun Timer + /* 0x0 */ u32 dmgFlags; // Toucher damage type flags. + /* 0x4 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) + /* 0x5 */ u8 damage; // Damage or Stun Timer } ColliderTouchInit; // size = 0x8 typedef struct { - /* 0x0 */ u32 dmgFlags; // Bumper damage type flags. - /* 0x4 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) - /* 0x5 */ u8 defense; // Damage Resistance - /* 0x6 */ Vec3s hitPos; // Point of contact + /* 0x0 */ u32 dmgFlags; // Bumper damage type flags. + /* 0x4 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) + /* 0x5 */ u8 defense; // Damage Resistance + /* 0x6 */ Vec3s hitPos; // Point of contact } ColliderBump; // size = 0xC typedef struct { - /* 0x0 */ u32 dmgFlags; // Bumper exclusion mask - /* 0x4 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) - /* 0x5 */ u8 defense; // Damage Resistance + /* 0x0 */ u32 dmgFlags; // Bumper exclusion mask + /* 0x4 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) + /* 0x5 */ u8 defense; // Damage Resistance } ColliderBumpInit; // size = 0x8 typedef struct ColliderInfo { - /* 0x00 */ ColliderTouch toucher; // Damage properties when acting as an AT collider - /* 0x08 */ ColliderBump bumper; // Damage properties when acting as an AC collider - /* 0x14 */ u8 elemType; // Affects sfx reaction when attacked by Link and hookability. Full purpose unknown. - /* 0x15 */ u8 toucherFlags; // Information flags for AT collisions - /* 0x16 */ u8 bumperFlags; // Information flags for AC collisions - /* 0x17 */ u8 ocElemFlags; // Information flags for OC collisions - /* 0x18 */ Collider* atHit; // object touching this element's AT collider - /* 0x1C */ Collider* acHit; // object touching this element's AC collider - /* 0x20 */ struct ColliderInfo* atHitInfo; // element that hit the AT collider - /* 0x24 */ struct ColliderInfo* acHitInfo; // element that hit the AC collider + /* 0x00 */ ColliderTouch toucher; // Damage properties when acting as an AT collider + /* 0x08 */ ColliderBump bumper; // Damage properties when acting as an AC collider + /* 0x14 */ u8 elemType; // Affects sfx reaction when attacked by Link and hookability. Full purpose unknown. + /* 0x15 */ u8 toucherFlags; // Information flags for AT collisions + /* 0x16 */ u8 bumperFlags; // Information flags for AC collisions + /* 0x17 */ u8 ocElemFlags; // Information flags for OC collisions + /* 0x18 */ Collider* atHit; // object touching this element's AT collider + /* 0x1C */ Collider* acHit; // object touching this element's AC collider + /* 0x20 */ struct ColliderInfo* atHitInfo; // element that hit the AT collider + /* 0x24 */ struct ColliderInfo* acHitInfo; // element that hit the AC collider } ColliderInfo; // size = 0x28 typedef struct { - /* 0x00 */ u8 elemType; // Affects sfx reaction when attacked by Link and hookability. Full purpose unknown. - /* 0x04 */ ColliderTouchInit toucher; // Damage properties when acting as an AT collider - /* 0x0C */ ColliderBumpInit bumper; // Damage properties when acting as an AC collider - /* 0x14 */ u8 toucherFlags; // Information flags for AT collisions - /* 0x15 */ u8 bumperFlags; // Information flags for AC collisions - /* 0x16 */ u8 ocElemFlags; // Information flags for OC collisions + /* 0x00 */ u8 elemType; // Affects sfx reaction when attacked by Link and hookability. Full purpose unknown. + /* 0x04 */ ColliderTouchInit toucher; // Damage properties when acting as an AT collider + /* 0x0C */ ColliderBumpInit bumper; // Damage properties when acting as an AC collider + /* 0x14 */ u8 toucherFlags; // Information flags for AT collisions + /* 0x15 */ u8 bumperFlags; // Information flags for AC collisions + /* 0x16 */ u8 ocElemFlags; // Information flags for OC collisions } ColliderInfoInit; // size = 0x18 typedef struct { - /* 0x00 */ Sphere16 modelSphere; // model space sphere - /* 0x08 */ Sphere16 worldSphere; // world space sphere - /* 0x10 */ f32 scale; // worldsphere = modelsphere * scale * 0.01 - /* 0x14 */ u8 limb; // attached limb + /* 0x00 */ Sphere16 modelSphere; // model space sphere + /* 0x08 */ Sphere16 worldSphere; // world space sphere + /* 0x10 */ f32 scale; // worldsphere = modelsphere * scale * 0.01 + /* 0x14 */ u8 limb; // attached limb } ColliderJntSphElementDim; // size = 0x18 typedef struct { - /* 0x0 */ u8 limb; // attached limb - /* 0x2 */ Sphere16 modelSphere; // model space sphere - /* 0xA */ s16 scale; // world space sphere = model * scale * 0.01 + /* 0x0 */ u8 limb; // attached limb + /* 0x2 */ Sphere16 modelSphere; // model space sphere + /* 0xA */ s16 scale; // world space sphere = model * scale * 0.01 } ColliderJntSphElementDimInit; // size = 0xC typedef struct { @@ -141,27 +141,27 @@ typedef struct { } ColliderJntSphInitToActor; // size = 0x10 typedef struct { - /* 0x00 */ Collider base; + /* 0x00 */ Collider base; /* 0x18 */ ColliderInfo info; - /* 0x40 */ Cylinder16 dim; + /* 0x40 */ Cylinder16 dim; } ColliderCylinder; // size = 0x4C typedef struct { - /* 0x00 */ ColliderInit base; + /* 0x00 */ ColliderInit base; /* 0x08 */ ColliderInfoInit info; - /* 0x20 */ Cylinder16 dim; + /* 0x20 */ Cylinder16 dim; } ColliderCylinderInit; // size = 0x2C typedef struct { /* 0x00 */ ColliderInitType1 base; - /* 0x08 */ ColliderInfoInit info; - /* 0x20 */ Cylinder16 dim; + /* 0x08 */ ColliderInfoInit info; + /* 0x20 */ Cylinder16 dim; } ColliderCylinderInitType1; // size = 0x2C typedef struct { /* 0x00 */ ColliderInitToActor base; - /* 0x08 */ ColliderInfoInit info; - /* 0x20 */ Cylinder16 dim; + /* 0x08 */ ColliderInfoInit info; + /* 0x20 */ Cylinder16 dim; } ColliderCylinderInitToActor; // size = 0x2C typedef struct { @@ -170,7 +170,7 @@ typedef struct { typedef struct { /* 0x00 */ ColliderInfo info; - /* 0x28 */ TriNorm dim; + /* 0x28 */ TriNorm dim; } ColliderTrisElement; // size = 0x5C typedef struct { @@ -198,9 +198,9 @@ typedef struct { typedef struct { /* 0x00 */ Vec3f quad[4]; - /* 0x30 */ Vec3s dcMid; // midpoint of vectors d, c - /* 0x36 */ Vec3s baMid; // midpoint of vectors b, a - /* 0x3C */ f32 acDist; // distance to nearest AC collision this frame. + /* 0x30 */ Vec3s dcMid; // midpoint of vectors d, c + /* 0x36 */ Vec3s baMid; // midpoint of vectors b, a + /* 0x3C */ f32 acDist; // distance to nearest AC collision this frame. } ColliderQuadDim; // size = 0x40 typedef struct { @@ -208,50 +208,50 @@ typedef struct { } ColliderQuadDimInit; // size = 0x30 typedef struct { - /* 0x00 */ Collider base; - /* 0x18 */ ColliderInfo info; + /* 0x00 */ Collider base; + /* 0x18 */ ColliderInfo info; /* 0x40 */ ColliderQuadDim dim; } ColliderQuad; // size = 0x80 typedef struct { - /* 0x00 */ ColliderInit base; - /* 0x08 */ ColliderInfoInit info; + /* 0x00 */ ColliderInit base; + /* 0x08 */ ColliderInfoInit info; /* 0x20 */ ColliderQuadDimInit dim; } ColliderQuadInit; // size = 0x50 typedef struct { - /* 0x00 */ ColliderInitType1 base; - /* 0x08 */ ColliderInfoInit info; + /* 0x00 */ ColliderInitType1 base; + /* 0x08 */ ColliderInfoInit info; /* 0x20 */ ColliderQuadDimInit dim; } ColliderQuadInitType1; // size = 0x50 typedef struct { - /* 0x00 */ Collider base; + /* 0x00 */ Collider base; /* 0x18 */ ColliderInfo info; /* 0x40 */ ColliderJntSphElementDim dim; } ColliderSphere; // size = 0x58 typedef struct { - /* 0x00 */ ColliderInit base; + /* 0x00 */ ColliderInit base; /* 0x08 */ ColliderInfoInit info; /* 0x20 */ ColliderJntSphElementDimInit dim; } ColliderSphereInit; // size = 0x2C typedef struct { /* 0x00 */ Linef line; - /* 0x18 */ u16 ocFlags; + /* 0x18 */ u16 ocFlags; } OcLine; // size = 0x1C typedef struct { - /* 0x000 */ s16 colATCount; - /* 0x002 */ u16 sacFlags; // Controls whether new collidors can be added or removed, or only swapped + /* 0x000 */ s16 colATCount; + /* 0x002 */ u16 sacFlags; // Controls whether new collidors can be added or removed, or only swapped /* 0x004 */ Collider* colAT[50]; - /* 0x0CC */ s32 colACCount; + /* 0x0CC */ s32 colACCount; /* 0x0D0 */ Collider* colAC[60]; - /* 0x1C0 */ s32 colOCCount; + /* 0x1C0 */ s32 colOCCount; /* 0x1C4 */ Collider* colOC[50]; - /* 0x28C */ s32 colLineCount; - /* 0x290 */ OcLine* colLine[3]; + /* 0x28C */ s32 colLineCount; + /* 0x290 */ OcLine* colLine[3]; } CollisionCheckContext; // size = 0x29C typedef struct { diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c index 076ed9e38..3710c1e1e 100644 --- a/src/code/sys_math3d.c +++ b/src/code/sys_math3d.c @@ -247,7 +247,7 @@ f32 Math3D_Cos(Vec3f* a, Vec3f* b) { } /** - * Calculates the cosine between vectors `a` and `b` and places the result in `ret` + * Calculates the cosine between vectors `a` and `b` and places the result in `dst` * returns true if the cosine cannot be calculated because the product of the magnitudes is zero */ s32 Math3D_CosOut(Vec3f* a, Vec3f* b, f32* dst) {