Doc code 80005fd0 (#697)

* Document code_80005FD0.c
This commit is contained in:
coco875
2025-01-19 01:24:09 +01:00
committed by GitHub
parent 5e1ce53a4c
commit 731b24eabf
126 changed files with 10427 additions and 10050 deletions
+3 -3
View File
@@ -17,7 +17,7 @@
#define BOMB_STATE_UNKNOWN 5
typedef struct {
/* 0x00 */ u16 waypointIndex;
/* 0x00 */ u16 pathPointIndex;
/* 0x02 */ u16 startingState;
/* 0x04 */ f32 unk_04; // Used to set the value of unk_3C in BombKart
/* 0x08 */ f32 startingXPos;
@@ -42,8 +42,8 @@ typedef struct {
/* 0x24 */ Vec3f wheel3Pos;
/* 0x30 */ Vec3f wheel4Pos;
/* 0x3C */ f32 unk_3C;
/* 0x40 */ u16 someRot; // seems like an angle of some variety, can't figure out its purpose
/* 0x42 */ u16 waypointIndex; // probably the waypoint that the bomb circles
/* 0x40 */ u16 someRot; // seems like an angle of some variety, can't figure out its purpose
/* 0x42 */ u16 pathPointIndex; // probably the pathPoint that the bomb circles
/* 0x44 */ u16 state;
/* 0x46 */ u16 bounceTimer; // timer? state? height?
/* 0x48 */ u16 circleTimer; // timer? state? Somehow controls how it circles around
+6 -6
View File
@@ -27,10 +27,10 @@ typedef enum { A = 0x80, B = 0x40, Z = 0x20, R = 0x10 } GhostController;
/*** types.h ***/
typedef struct {
/* 0x0 */ s16 waypointStart;
/* 0x2 */ s16 waypointEnd;
/* 0x0 */ s16 pathPointStart;
/* 0x2 */ s16 pathPointEnd;
/* 0x4 */ s32 type;
} KartAIBehaviour; // size = 0x8
} CPUBehaviour; // size = 0x8
enum SpTaskState {
SPTASK_STATE_NOT_STARTED,
@@ -281,7 +281,7 @@ typedef struct {
/* 0x0088 */ f32 unk_088;
/* 0x008C */ f32 unk_08C;
/* 0x0090 */ f32 unk_090;
/* 0x0094 */ f32 unk_094;
/* 0x0094 */ f32 speed;
/* 0x0098 */ f32 unk_098;
/* 0x009C */ f32 currentSpeed;
/* 0x00A0 */ f32 unk_0A0;
@@ -336,12 +336,12 @@ typedef struct {
/* 0x0214 */ f32 topSpeed;
/* 0x0218 */ f32 unk_218;
/* 0x021C */ f32 unk_21C;
/* 0x0220 */ s16 nearestWaypointId; // ??
/* 0x0220 */ s16 nearestPathPointId; // ??
/* 0x0222 */ s16 unk_222;
/* 0x0224 */ f32 size;
/* 0x0228 */ s16 unk_228;
/* 0x022A */ s16 unk_22A;
/* 0x022C */ f32 unk_22C;
/* 0x022C */ f32 previousSpeed;
/* 0x0230 */ f32 unk_230;
/* 0x0234 */ s16 unk_234;
/* 0x0236 */ s16 unk_236;
+24 -21
View File
@@ -4,7 +4,7 @@
#include <ultra64.h>
#include <PR/gbi.h>
#include <macros.h>
#include "waypoints.h"
#include "path.h"
/**
* @file Include for course gfx.inc.c.
@@ -18,10 +18,10 @@ typedef struct {
} TrackSections;
struct _struct_gCoursePathSizes_0x10 {
/* 0x00 */ u16 unk0;
/* 0x02 */ u16 unk2;
/* 0x04 */ u16 unk4;
/* 0x06 */ u16 unk6;
/* 0x00 */ u16 firstPath;
/* 0x02 */ u16 secondPath;
/* 0x04 */ u16 thirdPath;
/* 0x06 */ u16 fourthPath;
/* 0x08 */ u16 unk8;
/* 0x0A */ char padA[6];
}; // size 0x10
@@ -83,20 +83,20 @@ typedef enum {
extern s16 gCurrentCourseId;
extern s16* D_800DCBB4[];
#define GET_COURSE_800DCBB4(n) D_800DCBB4[gCurrentCourseId][n]
extern f32 gKartAICourseMaximumSeparation[];
#define GET_COURSE_AIMaximumSeparation gKartAICourseMaximumSeparation[gCurrentCourseId]
extern f32 cpu_CourseMaximumSeparation[];
#define GET_COURSE_AIMaximumSeparation cpu_CourseMaximumSeparation[gCurrentCourseId]
extern struct _struct_gCoursePathSizes_0x10 gCoursePathSizes[];
#define GET_COURSE_PathSizes gCoursePathSizes[gCurrentCourseId]
extern s16 gKartAISteeringSensitivity[];
#define GET_COURSE_AISteeringSensitivity gKartAISteeringSensitivity[gCurrentCourseId]
extern f32 gKartAICourseMinimumSeparation[];
#define GET_COURSE_AIMinimumSeparation gKartAICourseMinimumSeparation[gCurrentCourseId]
extern TrackWaypoint* gCoursePathTable[][4];
extern s16 cpu_SteeringSensitivity[];
#define GET_COURSE_AISteeringSensitivity cpu_SteeringSensitivity[gCurrentCourseId]
extern f32 cpu_CourseMinimumSeparation[];
#define GET_COURSE_AIMinimumSeparation cpu_CourseMinimumSeparation[gCurrentCourseId]
extern TrackPathPoint* gCoursePathTable[][4];
#define GET_COURSE_PathTable(p) segmented_to_virtual_dupe_2(gCoursePathTable[gCurrentCourseId][p])
extern TrackWaypoint* gCoursePathTable2[][4];
extern TrackPathPoint* gCoursePathTable2[][4];
#define GET_COURSE_PathTable2(p) segmented_to_virtual_dupe_2(gCoursePathTable2[gCurrentCourseId][p])
extern KartAIBehaviour* gKartAIBehaviourLUT[];
#define GET_COURSE_AIBehaviour segmented_to_virtual_dupe_2(gKartAIBehaviourLUT[i])
extern CPUBehaviour* cpu_BehaviourLUT[];
#define GET_COURSE_AIBehaviour segmented_to_virtual_dupe_2(cpu_BehaviourLUT[i])
extern char* gCourseNames[];
#define GET_COURSE_Name gCourseNames[gCurrentCourseId]
extern char* gCourseNamesDup[];
@@ -108,9 +108,12 @@ extern f32 gCourseFarPersp;
extern f32 gCourseNearPersp;
#define gCourseNearPersp gCourseNearPersp
#define GET_COURSE_D_0D0096B8(cc) *(f32*) segmented_to_virtual_dupe_2(&D_0D0096B8[gCurrentCourseId][cc])
#define GET_COURSE_D_0D009808(cc) *(f32*) segmented_to_virtual_dupe_2(&D_0D009808[gCurrentCourseId][cc])
#define GET_COURSE_D_0D009418(cc) *(f32*) segmented_to_virtual_dupe_2(&D_0D009418[gCurrentCourseId][cc])
#define GET_COURSE_D_0D009568(cc) *(f32*) segmented_to_virtual_dupe_2(&D_0D009568[gCurrentCourseId][cc])
#define GET_COURSE_cpu_OffTrackTargetSpeed(cc) \
*(f32*) segmented_to_virtual_dupe_2(&cpu_OffTrackTargetSpeed[gCurrentCourseId][cc])
#define GET_COURSE_cpu_CurveTargetSpeed(cc) \
*(f32*) segmented_to_virtual_dupe_2(&cpu_CurveTargetSpeed[gCurrentCourseId][cc])
#define GET_COURSE_cpu_NormalTargetSpeed(cc) \
*(f32*) segmented_to_virtual_dupe_2(&cpu_NormalTargetSpeed[gCurrentCourseId][cc])
#else
#define gCurrentCourseId
#define GET_COURSE_800DCBB4(n)
@@ -127,9 +130,9 @@ extern f32 gCourseNearPersp;
#define gCourseFarPersp
#define gCourseNearPersp
#define GET_COURSE_D_0D0096B8(cc)
#define GET_COURSE_D_0D009808(cc)
#define GET_COURSE_D_0D009418(cc)
#define GET_COURSE_D_0D009568(cc)
#define GET_COURSE_cpu_OffTrackTargetSpeed(cc)
#define GET_COURSE_cpu_CurveTargetSpeed(cc)
#define GET_COURSE_cpu_NormalTargetSpeed(cc)
#endif
#endif // COURSE_H
+29 -14
View File
@@ -74,13 +74,13 @@
#define PLAYER_STAGING (1 << 9) // 0x0200
#define PLAYER_UNKNOWN (1 << 10) // 0x0400 // unused ?
#define PLAYER_CINEMATIC_MODE (1 << 11) // 0x0800 // Also used to track eliminations in Battle mode.
#define PLAYER_KART_AI (1 << 12) // 0x1000
#define PLAYER_CPU (1 << 12) // 0x1000
#define PLAYER_START_SEQUENCE (1 << 13) // 0x2000
#define PLAYER_HUMAN (1 << 14) // 0x4000
#define PLAYER_EXISTS (1 << 15) // 0x8000
// Compiles to -0x1000 in diff.py
#define PLAYER_HUMAN_AND_KART_AI PLAYER_EXISTS | PLAYER_HUMAN | PLAYER_KART_AI | PLAYER_START_SEQUENCE
#define PLAYER_HUMAN_AND_CPU PLAYER_EXISTS | PLAYER_HUMAN | PLAYER_CPU | PLAYER_START_SEQUENCE
#define ZERO_PLAYERS_SELECTED 0
#define ONE_PLAYERS_SELECTED 1
@@ -273,13 +273,13 @@ enum ITEMS {
/* 0x0F */ ITEM_SUPER_MUSHROOM
};
enum KART_AI_BEHAVIOURS {
enum CPU_BEHAVIOURS {
BEHAVIOUR_NONE = 0,
BEHAVIOUR_1,
BEHAVIOUR_HOP,
BEHAVIOUR_3,
BEHAVIOUR_4,
BEHAVIOUR_5,
BEHAVIOUR_DRIVE_CENTER,
BEHAVIOUR_DRIVE_LEFT,
BEHAVIOUR_DRIVE_OUTER,
BEHAVIOUR_NORMAL_SPEED,
BEHAVIOUR_FAST_SPEED,
BEHAVIOUR_SLOW_SPEED,
@@ -290,6 +290,8 @@ enum KART_AI_BEHAVIOURS {
enum DIRECTION { NORTH, EAST, SOUTH, WEST };
enum PLACE { FIRST_PLACE, SECOND_PLACE, THIRD_PLACE, FOURTH_PLACE };
/**
* @brief Balloon status
*/
@@ -321,14 +323,27 @@ enum DIRECTION { NORTH, EAST, SOUTH, WEST };
* @brief effect of player's
* for effects
*/
#define BOOST_RAMP_WOOD_EFFECT 0x4 // being boosted by a ramp
#define STAR_EFFECT 0x200 // being a star
#define BOOST_EFFECT 0x2000 // being boosted by trigger a mushroom
#define BOOST_RAMP_ASPHALT_EFFECT 0x100000 // being boosted by a boost pad
#define HIT_BY_ITEM_EFFECT 0x2000000 // being hit by an item
#define HIT_EFFECT 0x4000000 // hitting an object
#define LIGHTNING_EFFECT 0x40000000 // being hit by lightning
#define BOO_EFFECT 0x80000000 // being a boo
#define UNKNOWN_EFFECT_0x1 0x1 //
#define BOOST_RAMP_WOOD_EFFECT 0x4 // being boosted by a ramp
#define UNKNOWN_EFFECT_0x10 0x10 //
#define UNKNOWN_EFFECT_0x40 0x40 //
#define UNKNOWN_EFFECT_0x80 0x80 //
#define UNKNOWN_EFFECT_0xC 0xC //
#define UNKNOWN_EFFECT_0x10 0x10 //
#define UNKNOWN_EFFECT_0x100 0x100 //
#define UNKNOWN_EFFECT_0x1000 0x1000 //
#define STAR_EFFECT 0x200 // being a star
#define BOOST_EFFECT 0x2000 // being boosted by trigger a mushroom
#define UNKNOWN_EFFECT_0x10000 0x10000 //
#define BOOST_RAMP_ASPHALT_EFFECT 0x100000 // being boosted by a boost pad
#define UNKNOWN_EFFECT_0x200000 0x200000 //
#define REVERSE_EFFECT 0x400000 // being in reverse of the course
#define UNKNOWN_EFFECT_0x1000000 0x1000000 //
#define HIT_BY_ITEM_EFFECT 0x2000000 // being hit by an item
#define HIT_EFFECT 0x4000000 // hitting an object
#define UNKNOWN_EFFECT_0x10000000 0x10000000 //
#define LIGHTNING_EFFECT 0x40000000 // being hit by lightning
#define BOO_EFFECT 0x80000000 // being a boo
/**
* @brief shell state
+98
View File
@@ -0,0 +1,98 @@
#ifndef PATH_H
#define PATH_H
#include <common_structs.h>
typedef struct {
/* 0x00 */ s16 posX;
/* 0x02 */ s16 posY;
/* 0x04 */ s16 posZ;
/* 0x06 */ u16 trackSectionId;
} TrackPathPoint; // size = 0x08
enum {
RIGHT_LEANING_CURVE = 0,
LEFT_LEANING_CURVE = 1,
RIGHT_CURVE = 2, // strong curve
LEFT_CURVE = 3, // strong curve
STRAIGHT = 4
};
/**
* These are per-path arrays that contain some information relating to path
* The arrays in gTrackPaths contain X/Y/Z and track segment information
* The arrays in gTrackLeftPaths and gCurrentTrackRightPath track some other X/Y/Z, but the track segment is always 0
*(so, untracked/unused) Its unclear how these arrays relate to each other
**/
extern TrackPathPoint* gTrackPaths[];
extern TrackPathPoint* gTrackLeftPaths[];
extern TrackPathPoint* gTrackRightPaths[];
/**
* Don't know what exactly these are, but like gTrackPaths, gTrackLeftPaths, and gCurrentTrackRightPath
* they track something about the path on a per-path basis
**/
// PathPoint types?
extern s16* gTrackSectionTypes[];
// Based on analyse_angle_path this may be angles between path
// gPathExpectedRotation[i] = atan2(pathPoint_i, pathPoint_i+1)?
extern s16* gPathExpectedRotation[];
// No idea. Adjacency list?
extern s16* gTrackConsecutiveCurveCounts[];
/**
* Certain parts of the pathPoint logic will copy some path/player specific data to a temporary variable.
* For example: gCurrentTrackPath is always a value from gTrackPaths. Depending on which path
* a given player is on, the specific value may change
**/
// Shadows values from gNearestPathPointByPlayerId
extern s16 sSomeNearestPathPoint;
// Shadows values from gPathIndexByPlayerId
extern s32 gPlayerPathIndex;
// Shadows values from gTrackLeftPaths
extern TrackPathPoint* gCurrentTrackLeftPath;
// Shadows values from gCurrentTrackRightPath
extern TrackPathPoint* gCurrentTrackRightPath;
// Shadows values from gTrackSectionTypes
extern s16* gCurrentTrackSectionTypesPath;
// Shadows values from gPathExpectedRotation
extern s16* gCurrentPathPointExpectedRotationPath;
// Shadowd values from gPathCountByPathIndex
extern u16 gSelectedPathCount;
// Shadows values from gTrackPaths
extern TrackPathPoint* gCurrentTrackPath;
// Shadows values from gTrackConsecutiveCurveCounts
extern s16* gCurrentTrackConsecutiveCurveCountsPath;
extern u16 gNearestPathPointByPlayerId[]; // D_80164438
// Total path passed by playerId?
extern s32 gNumPathPointsTraversed[];
extern u16 gPathIndexByPlayerId[]; // D_801645B0
extern u16 gPathCountByPathIndex[]; // D_801645C8
// These values are only used when the camera is in "cinematic" mode
extern s16 gNearestPathPointByCameraId[]; // D_80164668
/**
* Stuff that may not be directly related to path, but are only referenced in cpu_vehicles_camera_path.
* So they are at least pathPoint adjacent.
**/
// Tracks something on a per-player basis, no idea what though
extern f32 gTrackPositionFactor[];
// Track segment by playerId, although it curiously does NOT track values for human players
// So, in 2 Player Grand Prix, the first 2 entries are always 0
extern u16 gPlayersTrackSectionId[];
// Seems to be a per-path overcount of the pathPoint count
extern s32 D_80163368[];
// Seemingly the Z position of the 1st pathPoint in the 0th path?
extern f32 gPathStartZ;
// These seem to track whether a player has entered or exited the "unknown" zone in yoshi's valley
// See yoshi_valley_cpu_path and update_cpu_path_completion
// Is 1 when a player is in the "unknown" zone in yoshi's valley
extern s16 cpu_enteringPathIntersection[];
// Is 1 when a player leaves the "unknown" zone in yoshi's valley
extern s16 cpu_exitingPathIntersection[];
// Tracks whether a given player is in the "unknown" zone of yoshi's valley
extern s16 bInMultiPathSection[];
#endif
+15 -15
View File
@@ -40,7 +40,7 @@ typedef struct {
/* 0x02 */ s16 compilerPadding;
/* 0x04 */ Vec3f position;
/* 0x10 */ Vec3f velocity;
/* 0x1C */ u16 waypointIndex;
/* 0x1C */ u16 pathPointIndex;
/* 0x1E */ s16 actorIndex;
/* 0x20 */ s32 unused; // Not read or written. Could be padding?
} TrainCarStuff; // size = 0x24;
@@ -56,19 +56,19 @@ typedef struct {
} TrainStuff; // size = 0x10C
typedef struct {
/* 0x00 */ s16 isActive; // The paddle wheel boat only shows up if the number of players is < 3
/* 0x02 */ // s16 compilerPadding;
/* 0x04 */ Vec3f position; //
/* 0x10 */ Vec3f velocity; //
/* 0x1C */ u16 waypointIndex; //
/* 0x1E */ s16 actorIndex; //
/* 0x20 */ f32 speed; //
/* 0x24 */ s16 rotY; // Only Y rotation is tracked in this struct
/* 0x26 */ // s16 compilerPadding2;
/**
* Bit field that tracks whether a given human player is within a certain distance of the boat
* Probably audio related
**/
/* 0x00 */ s16 isActive; // The paddle wheel boat only shows up if the number of players is < 3
/* 0x02 */ // s16 compilerPadding;
/* 0x04 */ Vec3f position; //
/* 0x10 */ Vec3f velocity; //
/* 0x1C */ u16 pathPointIndex; //
/* 0x1E */ s16 actorIndex; //
/* 0x20 */ f32 speed; //
/* 0x24 */ s16 rotY; // Only Y rotation is tracked in this struct
/* 0x26 */ // s16 compilerPadding2;
/**
* Bit field that tracks whether a given human player is within a certain distance of the boat
* Probably audio related
**/
/* 0x28 */ s32 someFlags;
} PaddleBoatStuff; // size = 0x2C
@@ -77,7 +77,7 @@ typedef struct {
/* 0x02 */ // s16 compilerPadding;
/* 0x04 */ Vec3f position;
/* 0x10 */ Vec3f velocity;
/* 0x1C */ u16 waypointIndex;
/* 0x1C */ u16 pathPointIndex;
/* 0x1E */ s16 actorIndex;
/* 0x20 */ f32 speed; //
/* 0x24 */ f32 someMultiplierTheSequel; //
-90
View File
@@ -1,90 +0,0 @@
#ifndef WAYPOINTS_H
#define WAYPOINTS_H
#include <common_structs.h>
typedef struct {
/* 0x00 */ s16 posX;
/* 0x02 */ s16 posY;
/* 0x04 */ s16 posZ;
/* 0x06 */ u16 trackSectionId;
} TrackWaypoint; // size = 0x08
/**
* These are per-path arrays that contain some information relating to waypoints
* The arrays in D_80164550 contain X/Y/Z and track segment information
* The arrays in D_80164560 and D_80164570 track some other X/Y/Z, but the track segment is always 0 (so,
*untracked/unused) Its unclear how these arrays relate to each other
**/
extern TrackWaypoint* D_80164550[];
extern TrackWaypoint* D_80164560[];
extern TrackWaypoint* D_80164570[];
/**
* Don't know what exactly these are, but like D_80164550, D_80164560, and D_80164570
* they track something about the waypoints on a per-path basis
**/
// Waypoint types?
extern s16* D_80164580[];
// Based on func_80010DBC this may be angles between waypoints
// D_80164590[i] = atan2(waypoint_i, waypoint_i+1)?
extern s16* D_80164590[];
// No idea. Adjacency list?
extern s16* D_801645A0[];
/**
* Certain parts of the waypoint logic will copy some path/player specific data to a temporary variable.
* For example: D_80164490 is always a value from D_80164550. Depending on which path
* a given player is on, the specific value may change
**/
// Shadows values from gNearestWaypointByPlayerId
extern s16 sSomeNearestWaypoint;
// Shadows values from gPathIndexByPlayerId
extern s32 D_80163448;
// Shadows values from D_80164560
extern TrackWaypoint* D_801631D0;
// Shadows values from D_80164570
extern TrackWaypoint* D_801631D4;
// Shadows values from D_80164580
extern s16* D_801631D8;
// Shadows values from D_80164590
extern s16* D_801631DC;
// Shadowd values from gWaypointCountByPathIndex
extern u16 D_80164430;
// Shadows values from D_80164550
extern TrackWaypoint* D_80164490;
// Shadows values from D_801645A0
extern s16* D_801645E0;
extern u16 gNearestWaypointByPlayerId[]; // D_80164438
// Total waypoints passed by playerId?
extern s32 D_80164450[];
extern u16 gPathIndexByPlayerId[]; // D_801645B0
extern u16 gWaypointCountByPathIndex[]; // D_801645C8
// These values are only used when the camera is in "cinematic" mode
extern s16 gNearestWaypointByCameraId[]; // D_80164668
/**
* Stuff that may not be directly related to waypoints, but are only referenced in code_80005FD0.
* So they are at least waypoint adjacent.
**/
// Tracks something on a per-player basis, no idea what though
extern f32 D_80163068[];
// Track segment by playerId, although it curiously does NOT track values for human players
// So, in 2 Player Grand Prix, the first 2 entries are always 0
extern u16 D_80163318[];
// Seems to be a per-path overcount of the waypoint count
extern s32 D_80163368[];
// Seemingly the Z position of the 1st waypoint in the 0th path?
extern f32 D_8016344C;
// These seem to track whether a player has entered or exited the "unknown" zone in yoshi's valley
// See func_80009000 and func_800090F0
// Is 1 when a player is in the "unknown" zone in yoshi's valley
extern s16 D_80163490[];
// Is 1 when a player leaves the "unknown" zone in yoshi's valley
extern s16 D_801634A8[];
// Tracks whether a given player is in the "unknown" zone of yoshi's valley
extern s16 D_801644F8[];
#endif