Collision Documentation (#640)

* Collision related renames
This commit is contained in:
MegaMech
2024-06-26 19:22:38 -06:00
committed by GitHub
parent 975b96265c
commit 3d7cdcee8a
47 changed files with 2435 additions and 2415 deletions
+21 -37
View File
@@ -139,11 +139,11 @@ typedef struct {
/* 0x00 */ u16 unk30;
/* 0x02 */ u16 unk32;
/* 0x04 */ u16 unk34;
/* 0x06 */ u16 unk36;
/* 0x08 */ u16 unk38;
/* 0x06 */ u16 meshIndexYX;
/* 0x08 */ u16 meshIndexZY;
// This may be an index to the tilemap?
/* 0x0A */ u16 unk3A;
/* 0x0C */ Vec3f unk3C;
/* 0x0A */ u16 meshIndexZX;
/* 0x0C */ Vec3f surfaceDistance; // Appears to be distance from actor to surface for zx, yx, and zy planes.
/* 0x18 */ Vec3f unk48;
/* 0x24 */ Vec3f unk54;
/* 0x30 */ Vec3f orientationVector;
@@ -185,7 +185,6 @@ typedef struct {
s16 ob[3]; /* x, y, z */
s16 tc[2]; /* texture coord */
s8 ca[4]; /* color & alpha */
} CourseVtx;
/*
@@ -214,44 +213,29 @@ typedef struct {
/* 0x10 */ Vtx *vtx1; //pointer to the 3 vertices of this poly
Vtx *vtx2;
Vtx *vtx3;
//unsure why this exists along with a copy of two of the vertices.
//both are involved in hit detection.
/* 0x1C */ f32 height;
//normally 0; read at 0x802AB1A4. this value is added to the height Lakitu
//drops you at. changing it seems to make the surface intangible.
/* 0x20 */ f32 gravity;
//normally 1. The height Lakitu drops you off at is divided by this value
//(before adding the value at 0x1C), although if set to zero, he just tries
//to drop you at about the height of the finish line banner. Changing it
//has various unusual effects, making the polygon intangible or
//significantly reducing the gravity above it, probably depending on its Y
//position.
/* 0x24 */ f32 rotation; //normally about -0.001. no idea what this actually is.
/* 0x28 */ f32 height2; //changes Y position of all vertices (but not graphics or
//Lakitu drop position). Normally set to (track_height * -1) + about 6.
// Face normal. Should really be Vec3f normal
/* 0x1C */ f32 normalX;
/* 0x20 */ f32 normalY;
/* 0x24 */ f32 normalZ;
/* 0x28 */ f32 distance;
} CollisionTriangle; // size = 0x2C
typedef struct {
/* 0x00 */ Vec3f cornerPos;
// Type of surface the corner is above
/* 0x0C */ u8 surfaceType;
// Close to being a copy of the top byte of the CollisionTriangle "flags" member
/* 0x00 */ Vec3f pos;
/* 0x0C */ u8 surfaceType; // Surface type that the tyre is touching.
/* 0x0D */ u8 surfaceFlags;
// Don't know if "tile" is right the right term
// gCollisionMesh is a pointer to an array of "tile" structs. This is an index to that array
/* 0x0E */ u16 collisionMeshIndex;
// cornerPos places the corner "in the air" as it were, this member indicates the Y position of the corner's "on the ground" sibling
// On flat ground this value should be cornerY - gKartBoundingBoxTable[characterId]
/* 0x10 */ f32 cornerGroundY;
/* 0x0E */ u16 collisionMeshIndex; // Index into gCollisionMesh
// Height of tyre attached to ground. When flying it floats with the kart.
/* 0x10 */ f32 baseHeight;
// Something lighting related. 1 when in a shaded region, 2 when in a tree's shadow
// 3 when getting crushed by a whomp, but curiously only the front left tyre will ever have this value
/* 0x14 */ s32 unk_14;
} KartBoundingBoxCorner; // size = 0x18
} KartTyre; // size = 0x18
#define FRONT_LEFT_TYRE 0
#define FRONT_RIGHT_TYRE 1
#define BACK_LEFT_TYRE 2
#define BACK_RIGHT_TYRE 3
#define FRONT_LEFT 0
#define FRONT_RIGHT 1
#define BACK_LEFT 2
#define BACK_RIGHT 3
struct UnkPlayerInner {
/* 0xDB4 */ s16 unk0;
@@ -345,10 +329,10 @@ typedef struct {
/* 0x0108 */ f32 unk_108;
/* 0x010C */ s16 unk_10C;
/* 0x010E */ char unk_10E[0x2];
/* 0x0110 */ Collision unk_110;
/* 0x0110 */ Collision collision;
/* 0x0150 */ Mat3 unk_150;
/* 0x0174 */ Mat3 orientationMatrix;
/* 0x0198 */ KartBoundingBoxCorner boundingBoxCorners[4];
/* 0x0198 */ KartTyre tyres[4];
/* 0x01F8 */ f32 unk_1F8;
/* 0x01FC */ f32 unk_1FC;
/* 0x0200 */ u32 unk_200; // May be s32. but less casting required if u32
+13
View File
@@ -384,3 +384,16 @@ enum KART_AI_BEHAVIOURS {
#define COLOR_BLACK GPACK_RGB888(0, 0, 0)
#endif // DEFINES_H
/**
*
* Collision mesh flags
*
*/
#define GRID_SIZE 32
#define FACING_Y_AXIS 0x4000
#define FACING_X_AXIS 0x8000
#define FACING_Z_AXIS 0x2000
+3 -3
View File
@@ -16,7 +16,7 @@ typedef struct
/* 0x28 */ Vec3f offset;
/* 0x34 */ f32 unk_034;
/* 0x38 */ Vec3f velocity; // acceleration
/* 0x44 */ f32 unk_044;
/* 0x44 */ f32 surfaceHeight;
/* 0x48 */ s32 unk_048;
/* 0x4C */ s32 unk_04C;
/* 0x50 */ s32 unk_050;
@@ -79,9 +79,9 @@ typedef struct
/* 0xDD */ u8 unk_0DD;
/* 0xDE */ s8 unk_0DE;
/* 0xDF */ u8 unk_0DF;
} Objects; // size = 0xE0
} Object; // size = 0xE0
extern Objects gObjectList[];
extern Object gObjectList[];
typedef struct
{
+11
View File
@@ -10,6 +10,11 @@
#define NUM_TRAINS 2
#define LOCOMOTIVE_ONLY 0
#define NUM_CROSSINGS 2
// This allows karts to jump the train despite the crossing being activated.
// but still stop for the train once it's close
#define FRAMES_SINCE_CROSSING_ACTIVATED 240
// It seems like there's room for 2 Ferries, but only 1 is ever active
#define NUM_ACTIVE_PADDLE_BOATS 1
#define NUM_PADDLE_BOATS 2
@@ -24,6 +29,12 @@
#define NUM_TIME_TRIAL_TANKER_TRUCKS (NUM_RACE_TANKER_TRUCKS + 1)
#define NUM_TIME_TRIAL_CARS (NUM_RACE_CARS + 1)
#define TRAIN_SMOKE_RENDER_DISTANCE 2000.0f
#define TRAIN_CROSSING_AI_DISTANCE 1000.0f
#define BOAT_SMOKE_RENDER_DISTANCE 2000.0f
#define RENDER_VEHICLE 1
typedef struct {
/* 0x00 */ s16 isActive; // Only used for Tender and Passenger Cars, unused for Locomotives
/* 0x02 */ s16 compilerPadding;
+1 -1
View File
@@ -38,7 +38,7 @@ extern s16 *D_801645A0[];
* a given player is on, the specific value may change
**/
// Shadows values from gNearestWaypointByPlayerId
extern s16 D_80162FCE;
extern s16 sSomeNearestWaypoint;
// Shadows values from gPathIndexByPlayerId
extern s32 D_80163448;
// Shadows values from D_80164560