diff options
| author | petrie911 <69443847+petrie911@users.noreply.github.com> | 2024-04-15 18:38:19 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-15 20:38:19 -0300 |
| commit | 0e54a134335f924ac7d1b8de7ccfb97bf37abff0 (patch) | |
| tree | 26048feed9974328eab779cff435581ede11ae85 /include | |
| parent | 1ee676279710594486d656cc0af40e605b74a24b (diff) | |
Docs relating to fox_360. Also a UB fix in audio_load. (#215)
* docs
* format
* format plz
Diffstat (limited to 'include')
| -rw-r--r-- | include/context.h | 2 | ||||
| -rw-r--r-- | include/functions.h | 61 | ||||
| -rw-r--r-- | include/global.h | 22 | ||||
| -rw-r--r-- | include/sf64math.h | 71 | ||||
| -rw-r--r-- | include/sf64player.h | 37 | ||||
| -rw-r--r-- | include/structs.h | 4 | ||||
| -rw-r--r-- | include/sys.h | 2 |
7 files changed, 133 insertions, 66 deletions
diff --git a/include/context.h b/include/context.h index e161f955..f41dbb56 100644 --- a/include/context.h +++ b/include/context.h @@ -151,7 +151,7 @@ extern f32 D_ctx_80178470[3]; extern f32 gCameraShakeY; extern s32 gCameraShake; extern s32 D_ctx_80178484; -extern bool D_ctx_80178488; +extern bool gLoadLevelObjects; extern UNK_TYPE F_8017848C; extern UNK_TYPE F_80178490; extern s32 D_ctx_80178494; diff --git a/include/functions.h b/include/functions.h index 7b4224b0..1ea682f5 100644 --- a/include/functions.h +++ b/include/functions.h @@ -8,26 +8,26 @@ #include "sf64mesg.h" // fox_360 -void func_360_8002ED60(Player*); -void func_360_8002E3E0(Actor*); +void AllRange_FortunaIntro(Player*); +void AllRange_GetStarWolfHits(Actor*); void AllRange_UpdateCountdown(void); -void func_360_8002E5E0(Boss*); -void func_360_8002E604(Boss*); -void func_360_8002E628(Boss*); -void func_360_8002E64C(Boss*); -void func_360_8002E670(Actor*); -void func_360_8002E694(Actor*); -void func_360_8002E6B8(Actor*); -void func_360_8002E6DC(Actor*); -bool func_360_8002E4F8(u16*, RadioCharacterId); -void func_360_8002E700(Player*); -void func_360_8002EE34(void); -void func_360_8002EE64(Actor* actor); +void Boss309_Update(Boss*); +void Boss309_Draw(Boss*); +void Boss310_Update(Boss*); +void Boss310_Draw(Boss*); +void Actor271_Update(Actor*); +void Actor271_Draw(Actor*); +void Actor272_Update(Actor*); +void Actor272_Draw(Actor*); +bool AllRange_PlayMessage(u16*, RadioCharacterId); +void AllRange_GreatFoxRepair(Player*); +void AllRange_ClearRadio(void); +void func_360_8002EE64(Actor* this); void func_360_8002F180(void); -void func_360_8002F5F4(u16* msg, RadioCharacterId character); +void ActorAllRange_PlayMessage(u16* msg, RadioCharacterId character); void func_360_8002F69C(Actor*); void func_360_8002FC00(Actor*); -void func_360_8003088C(Actor*); +void ActorAllRange_ApplyDamage(Actor*); bool func_360_80031900(Actor*); void ActorAllRange_Update(Actor* this); void ActorAllRange_Draw(Actor* this); @@ -73,16 +73,16 @@ void func_tank_80047504(Player* player); void func_tank_80046358(Player*); // fox_demo -void func_demo_8004D440(Player*); +void Cutscene_KillPlayer(Player*); void func_demo_80048AC0(s32 teamId); -void func_demo_80049C0C(Player*); -void func_demo_8004A52C(Player*); +void Cutscene_EnterWarpZone(Player*); +void Cutscene_LevelStart(Player*); void func_demo_8004AA84(void); -void func_demo_8004AAF4(Player*); -void func_demo_8004C930(Player*); -void func_demo_8004CCC0(Player*); -void func_demo_8004D440(Player* player); -void func_demo_8004E3D8(Player*); +void Cutscene_AllRangeMode(Player*); +void Cutscene_LevelComplete(Player*); +void Cutscene_UTurn(Player*); +void Cutscene_KillPlayer(Player* player); +void Cutscene_PlayerDown(Player*); void func_demo_8004F8AC(Actor*); void func_demo_8004FEC0(Actor*); void func_demo_800515C4(void); @@ -159,10 +159,10 @@ void Object_Load(ObjectInit* , f32 , f32 , f32 , f32 ); void func_enmy_80062568(void); void func_enmy_80062B60(f32 xPos, f32 zPos, s32 state, f32 scale); void func_enmy_80062C38(f32, f32); -bool func_enmy_80062DBC(Vec3f* pos, f32* hitboxData, Object* obj, f32 xRot, f32 yRot, f32 zRot); -bool func_enmy_800631A8(Vec3f*, f32*, Vec3f*); -bool func_enmy_8006326C(Vec3f* , Vec3f* , ObjectId , Object* ); -s32 func_enmy_8006351C(s32 , Vec3f* , Vec3f* , s32 ); +bool Object_CheckHitboxCollision(Vec3f* pos, f32* hitboxData, Object* obj, f32 xRot, f32 yRot, f32 zRot); +bool Object_CheckSingleHitbox(Vec3f*, f32*, Vec3f*); +bool Object_CheckPolyCollision(Vec3f* , Vec3f* , ObjectId , Object* ); +s32 Object_CheckCollision(s32 , Vec3f* , Vec3f* , s32 ); void func_enmy_800652CC(Object_80*); void func_enmy_800654E4(Object*); void func_enmy_800656D4(Actor*); @@ -433,10 +433,11 @@ void func_hud_80096A74(Player* player); // fox_97F80 void func_col1_80098860(PlaneF* plane, Vec3f* point, Vec3f* normal); s32 func_col1_800988B4(Vec3f* vec, PlaneF* plane); -bool func_col1_800998FC(Vec3f*, Vec3f*, Vec3f*, s32, Vec3f*, f32*); +bool func_col1_800998FC(Vec3f* objPos, Vec3f* colliderPos, Vec3f* objVel, s32 colId, Vec3f* hitPosOut, + f32* hitAnglesOut); // fox_A4290 -bool func_col2_800A3690(Vec3f*, Vec3f*, s32, Vec3f*); +bool func_col2_800A3690(Vec3f* objPos, Vec3f* colliderPos, s32 colId, Vec3f* hitDataOut); // fox_A48A0 void func_800A3CA0(void); diff --git a/include/global.h b/include/global.h index 9811992c..a17e6200 100644 --- a/include/global.h +++ b/include/global.h @@ -3,6 +3,26 @@ #include "sys.h" +typedef enum OverlayCalls { + /* 90 */ OVLCALL_FO_CS_COMPLETE = 90, + /* 91 */ OVLCALL_BOSS309_UPDATE, + /* 92 */ OVLCALL_BOSS309_DRAW, + /* 93 */ OVLCALL_BOSS310_UPDATE, + /* 94 */ OVLCALL_BOSS310_DRAW, + /* 95 */ OVLCALL_ACTOR271_UPDATE, + /* 96 */ OVLCALL_ACTOR271_DRAW, + /* 97 */ OVLCALL_ACTOR272_UPDATE, + /* 98 */ OVLCALL_ACTOR272_DRAW, + /* 103 */ OVLCALL_TITLE_UPDATE = 103, + /* 104 */ OVLCALL_TITLE_DRAW, + /* 105 */ OVLCALL_MAP_UPDATE, + /* 106 */ OVLCALL_MAP_DRAW, + /* 107 */ OVLCALL_OPTION_UPDATE, + /* 108 */ OVLCALL_OPTION_DRAW, + /* 109 */ OVLCALL_GAME_OVER_UPDATE, + /* 110 */ OVLCALL_UNKMAP_DRAW, +} OverlayCalls; + #include "sf64audio_external.h" #include "functions.h" #include "variables.h" @@ -22,4 +42,6 @@ #include "i6.h" #include "assets/ast_common.h" + + #endif // GLOBAL_H diff --git a/include/sf64math.h b/include/sf64math.h index 939d0736..7fe5a7c2 100644 --- a/include/sf64math.h +++ b/include/sf64math.h @@ -3,6 +3,9 @@ #include "libultra/ultra64.h" +#define MTXF_NEW 0 +#define MTXF_APPLY 1 + typedef struct { /* 0x0 */ f32 x; /* 0x4 */ f32 y; @@ -71,24 +74,66 @@ s32 Math_PursueVec3f(Vec3f *pos, Vec3f *target, Vec3f *rot, f32 stepSize, f32 sc void Math_Vec3fFromAngles(Vec3f *step, f32 xRot, f32 yRot, f32 stepsize); f32 Math_RadToDeg(f32 rAngle); -void Matrix_Copy(Matrix*, Matrix*); +// Copies src Matrix into dst +void Matrix_Copy(Matrix* dst, Matrix* src); + +// Makes a copy of the stack's current matrix and puts it on the top of the stack void Matrix_Push(Matrix** mtxStack); + +// Removes the top matrix of the stack void Matrix_Pop(Matrix** mtxStack); -void Matrix_Mult(Matrix*, Matrix*, u8); -void Matrix_Translate(Matrix*, f32, f32, f32, u8); + +// Copies tf into mtx (MTXF_NEW) or applies it to mtx (MTXF_APPLY) +void Matrix_Mult(Matrix* mtx, Matrix* tf, u8 mode); + +// Creates a translation matrix in mtx (MTXF_NEW) or applies one to mtx (MTXF_APPLY) +void Matrix_Translate(Matrix* mtx, f32 x, f32 y, f32 z, u8 mode); + +// Creates a scale matrix in mtx (MTXF_NEW) or applies one to mtx (MTXF_APPLY) void Matrix_Scale(Matrix* mtx, f32 xScale, f32 yScale, f32 zScale, u8 mode); -void Matrix_RotateX(Matrix*, f32, u8); -void Matrix_RotateY(Matrix*, f32, u8); -void Matrix_RotateZ(Matrix*, f32, u8); -void Matrix_RotateAxis(Matrix*, f32, f32, f32, f32, u8); -void Matrix_ToMtx(Mtx *dest); -void Matrix_FromMtx(Mtx *src, Matrix *dest); + +// Creates rotation matrix about the X axis in mtx (MTXF_NEW) or applies one to mtx (MTXF_APPLY) +void Matrix_RotateX(Matrix* mtx, f32 angle, u8 mode); + +// Creates rotation matrix about the Y axis in mtx (MTXF_NEW) or applies one to mtx (MTXF_APPLY) +void Matrix_RotateY(Matrix* mtx, f32 angle, u8 mode); + +// Creates rotation matrix about the Z axis in mtx (MTXF_NEW) or applies one to mtx (MTXF_APPLY) +void Matrix_RotateZ(Matrix* mtx, f32 angle, u8 mode); + +// Creates rotation matrix about a given vector axis in mtx (MTXF_NEW) or applies one to mtx (MTXF_APPLY). +// The vector specifying the axis does not need to be a unit vector. +void Matrix_RotateAxis(Matrix* mtx, f32 angle, f32 axisX, f32 axisY, f32 axisZ, u8 mode); + +// Converts the current Gfx matrix to a Mtx +void Matrix_ToMtx(Mtx* dest); + +// Converts the Mtx src to a Matrix, putting the result in dest +void Matrix_FromMtx(Mtx* src, Matrix* dest); + +// Applies the transform matrix mtx to the vector src, putting the result in dest void Matrix_MultVec3f(Matrix* mtx, Vec3f* src, Vec3f* dest); + +// Applies the linear part of the transformation matrix mtx to the vector src, ignoring any translation that mtx might +// have. Puts the result in dest. void Matrix_MultVec3fNoTranslate(Matrix* mtx, Vec3f* src, Vec3f* dest); -void Matrix_GetYRPAngles(Matrix*, Vec3f*); -void Matrix_GetXYZAngles(Matrix*, Vec3f*); -void Matrix_LookAt(Matrix*, f32, f32, f32, f32, f32, f32, f32, f32, f32, u8); -void Matrix_SetGfxMtx(Gfx**); + +// Expresses the rotational part of the transform mtx as Tait-Bryan angles, in the yaw-pitch-roll (intrinsic YXZ) +// convention used in worldspace calculations +void Matrix_GetYRPAngles(Matrix* mtx, Vec3f* rot); + +// Expresses the rotational part of the transform mtx as Tait-Bryan angles, in the extrinsic XYZ convention used in +// modelspace calculations +void Matrix_GetXYZAngles(Matrix* mtx, Vec3f* rot); + +// Creates a look-at matrix from Eye, At, and Up in mtx (MTXF_NEW) or applies one to mtx (MTXF_APPLY). +// A look-at matrix is a rotation-translation matrix that maps y to Up, z to (At - Eye), and translates to Eye +void Matrix_LookAt(Matrix* mtx, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp, + u8 mode); + +// Converts the current Gfx matrix to a Mtx and sets it to the display list +void Matrix_SetGfxMtx(Gfx** gfx); + f32 Math_FAtanF(f32); f32 Math_FAtan2F(f32, f32); diff --git a/include/sf64player.h b/include/sf64player.h index a18044ea..9504ab37 100644 --- a/include/sf64player.h +++ b/include/sf64player.h @@ -57,20 +57,20 @@ typedef enum LevelMode { } LevelMode; typedef enum PlayerState1C8 { - /* 0 */ PLAYERSTATE_1C8_0, - /* 1 */ PLAYERSTATE_1C8_1, - /* 2 */ PLAYERSTATE_1C8_2, - /* 3 */ PLAYERSTATE_1C8_3, - /* 4 */ PLAYERSTATE_1C8_4, - /* 5 */ PLAYERSTATE_1C8_5, - /* 6 */ PLAYERSTATE_1C8_6, - /* 7 */ PLAYERSTATE_1C8_7, - /* 8 */ PLAYERSTATE_1C8_8, - /* 9 */ PLAYERSTATE_1C8_9, - /* 10 */ PLAYERSTATE_1C8_10, - /* 11 */ PLAYERSTATE_1C8_11, + /* 0 */ PLAYERSTATE_1C8_STANDBY, + /* 1 */ PLAYERSTATE_1C8_INIT, + /* 2 */ PLAYERSTATE_1C8_LEVEL_INTRO, + /* 3 */ PLAYERSTATE_1C8_ACTIVE, + /* 4 */ PLAYERSTATE_1C8_DOWN, + /* 5 */ PLAYERSTATE_1C8_U_TURN, + /* 6 */ PLAYERSTATE_1C8_NEXT, + /* 7 */ PLAYERSTATE_1C8_LEVEL_COMPLETE, + /* 8 */ PLAYERSTATE_1C8_ENTER_WARP_ZONE, + /* 9 */ PLAYERSTATE_1C8_START_360, + /* 10 */ PLAYERSTATE_1C8_GFOX_REPAIR, + /* 11 */ PLAYERSTATE_1C8_ANDROSS_MOUTH, /* 12 */ PLAYERSTATE_1C8_12, - /* 13 */ PLAYERSTATE_1C8_13, + /* 13 */ PLAYERSTATE_1C8_VS_STANDBY, } PlayerState1C8; typedef enum { @@ -127,7 +127,7 @@ typedef struct { /* 0x20 */ f32 unk_20; /* 0x24 */ f32 unk_24; /* 0x28 */ f32 unk_28; - /* 0x2C */ u8 unk_2C; + /* 0x2C */ u8 modelId; /* 0x30 */ f32 unk_30; /* 0x34 */ f32 unk_34; /* 0x38 */ f32 unk_38; @@ -159,12 +159,11 @@ typedef struct Player { /* 0x028 */ f32 unk_028; /* 0x02C */ f32 unk_02C; /* 0x030 */ f32 unk_030; - /* 0x034 */ f32 unk_034; + /* 0x034 */ f32 camRoll; /* 0x038 */ char pad38[8]; - /* 0x040 */ Vec3f camEye; - /* 0x04C */ Vec3f camAt; - /* 0x058 */ f32 unk_058; - /* 0x05C */ f32 unk_05C; + /* 0x040 */ CameraPoint cam; + /* 0x058 */ f32 camYaw; + /* 0x05C */ f32 camPitch; /* 0x05C */ f32 unk_060; /* 0x064 */ f32 unk_064; /* 0x068 */ f32 unk_068; diff --git a/include/structs.h b/include/structs.h index 332d943c..7bd35c8c 100644 --- a/include/structs.h +++ b/include/structs.h @@ -5,8 +5,8 @@ #include "sf64math.h" typedef struct { - /* 0x00 */ u8 unk_00; - /* 0x02 */ u16 unk_02; + /* 0x00 */ u8 status; + /* 0x02 */ u16 type; /* 0x04 */ Vec3f pos; /* 0x10 */ f32 unk_10; /* 0x14 */ char pad14[0x14]; diff --git a/include/sys.h b/include/sys.h index e9a403ff..da2c0952 100644 --- a/include/sys.h +++ b/include/sys.h @@ -47,7 +47,7 @@ extern f32 D_game_80161A10; extern f32 D_game_80161A14; extern s32 gPlayerInactive[4]; extern s32 D_game_80161A28; -extern u8 D_game_80161A2C; +extern u8 gShowHud; extern u16 gNextLevelStage; extern u16 gNextLevel; extern u16 gNextGameState; |
