From 92c4d42f446cc12c79de9b441b9afa341cf294e8 Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Wed, 23 Mar 2022 18:30:34 -0300 Subject: [PATCH] `z_skin` and `z_skin_awb` OK and documented a bit (#415) * oot copypaste * func_8013859C non matching and func_80138700 * protos * the other functions * func_80138300 * progress * func_80137F58 * func_80137EBC * func_80137B34 NON_MATCHING * func_80137970 * func_8013835C * z64skin * some docs * some bits * Match func_80137B34 * Match Skin_DrawImpl * Match Skin_Init tahnks to Anon * Some docs? * AnimatedLimb * SkinVtx * more names * fix merge issue * format * another clean * trailing comma * cleanup * format * add some descriptions * Import bss * last cleanup * Update ZAPD symbol map * Reanme gIdentityMtx and gIdentityMtxF * fix merge issues * bss * review * Update include/z64skin.h Co-authored-by: Derek Hensley * bss * Port @fig02 skin docs * format and a few changes * format * Port over OoT review * fixes * Engineer's review * format * address pr * Fix bss * fix bss * Update src/code/z_skin_awb.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * bss * bss * undo * pr * Skin_Setup Co-authored-by: Derek Hensley Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> --- include/functions.h | 23 +- include/variables.h | 3 - include/z64.h | 3 +- include/z64animation.h | 51 +--- include/z64skin.h | 106 +++++++ spec | 1 - src/code/z_bgcheck.c | 1 + src/code/z_demo.c | 1 + src/code/z_lifemeter.c | 17 +- src/code/z_skelanime.c | 2 +- src/code/z_skin.c | 272 +++++++++++++++++- src/code/z_skin_awb.c | 203 ++++++++++++- src/overlays/actors/ovl_En_Horse/z_en_horse.h | 1 + .../z_en_horse_link_child.h | 1 + tools/ZAPDConfigs/MM/SymbolMap_MM.txt | 2 +- tools/actorfixer.py | 2 + tools/disasm/functions.txt | 24 +- tools/disasm/variables.txt | 3 +- tools/sizes/boot_functions.csv | 2 +- tools/sizes/code_functions.csv | 26 +- 20 files changed, 618 insertions(+), 126 deletions(-) create mode 100644 include/z64skin.h diff --git a/include/functions.h b/include/functions.h index 766c12eeae..16a2ea64bc 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1388,7 +1388,7 @@ s32 func_800E9138(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* s32 func_800E9250(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* param_4, Vec3f param_5); void SaveContext_Init(void); void GameInfo_Init(void); -// void func_800E9470(void); +// void DebugDisplay_Init(void); DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, f32 scaleX, f32 scaleY, f32 scaleZ, u8 red, u8 green, u8 blue, u8 alpha, s16 type, GraphicsContext* gfxCtx); // void func_800E9C90(void); // void func_800E9CA0(s32 param_1, UNK_TYPE1 param_2, s8* param_3); @@ -2386,7 +2386,7 @@ s32 Animation_OnFrameImpl(SkelAnime* skelAnime, f32 frame, f32 updateRate); s32 LinkAnimation_OnFrame(SkelAnime* skelAnime, f32 frame); void SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount); void SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount); -void SkelAnime_InitSkin(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation); +void SkelAnime_InitSkin(GameState* gameState, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animationSeg); void SkelAnime_SetUpdate(SkelAnime* skelAnime); s32 SkelAnime_Update(SkelAnime* skelAnime); s32 SkelAnime_Morph(SkelAnime* skelAnime); @@ -2411,23 +2411,7 @@ void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* pos, s16 angle); s32 Animation_OnFrame(SkelAnime* skelAnime, f32 frame); void SkelAnime_Free(SkelAnime* skelAnime, GlobalContext* globalCtx); void SkelAnime_CopyFrameTable(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src); -// void func_80137970(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); -// void func_80137B34(void); -// void func_80137EBC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); -// void func_80137F58(void); -// void func_80138050(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8); -// void func_80138228(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); -// void func_80138258(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); -// void func_8013828C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); -// void func_801382C4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8); -// void func_80138300(void); -// void func_8013835C(void); -// void func_80138410(void); -// void func_80138424(void); -// void func_8013859C(void); -// void func_80138700(void); -// void func_801387D4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5); -// void func_801388E4(void); + void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDest); void SkinMatrix_Vec3fMtxFMultXYZ(MtxF* mf, Vec3f* src, Vec3f* dest); void SkinMatrix_MtxFMtxFMult(MtxF* mfB, MtxF* mfA, MtxF* dest); @@ -2452,6 +2436,7 @@ void SkinMatrix_MulXRotation(MtxF* mf, s16 a); void SkinMatrix_SetYRotation(MtxF* mf, s16 a); void SkinMatrix_MulYRotation(MtxF* mf, s16 a); void SkinMatrix_SetZRotation(MtxF* mf, s16 a); + s32 func_8013A240(GlobalContext* globalCtx); void func_8013A41C(s32 flag); void func_8013A46C(s32 flag); diff --git a/include/variables.h b/include/variables.h index db29d0c92b..b563d15cf4 100644 --- a/include/variables.h +++ b/include/variables.h @@ -1616,8 +1616,6 @@ extern Vec3f gZeroVec3f; extern Vec3s gZeroVec3s; extern Mtx gIdentityMtx; extern MtxF gIdentityMtxF; -// extern u64* initialgspUcodeText; -// extern u64* initialgspUcodeData; // extern UNK_TYPE1 D_801D1E70; // extern UNK_TYPE1 gLowPassFilterData; // extern UNK_TYPE1 gHighPassFilterData; @@ -3268,7 +3266,6 @@ extern LightsBuffer sLightsBuffer; // extern UNK_TYPE1 D_801F59F0; // extern UNK_TYPE1 D_801F59F4; // extern UNK_TYPE1 D_801F59F8; -// extern UNK_TYPE1 D_801F5AC0; // extern UNK_TYPE1 D_801F69D0; // extern UNK_TYPE1 D_801F6A10; // extern UNK_TYPE1 D_801F6AD4; diff --git a/include/z64.h b/include/z64.h index 51d2bc33b4..7d39504b88 100644 --- a/include/z64.h +++ b/include/z64.h @@ -36,8 +36,9 @@ #include "z64object.h" #include "z64ocarina.h" #include "z64player.h" -#include "z64scene.h" #include "z64save.h" +#include "z64scene.h" +#include "z64skin.h" #include "z64transition.h" #include "regs.h" diff --git a/include/z64animation.h b/include/z64animation.h index 10b145d38a..0e4388ddea 100644 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -1,5 +1,5 @@ -#ifndef _Z64_ANIMATION_H -#define _Z64_ANIMATION_H +#ifndef Z64_ANIMATION_H +#define Z64_ANIMATION_H #include "PR/ultratypes.h" #include "PR/gbi.h" @@ -28,7 +28,7 @@ typedef enum { } AnimationModes; typedef enum { - /* -1 */ ANIMTAPER_DECEL = -1, + /* -1 */ ANIMTAPER_DECEL = -1, /* 0 */ ANIMTAPER_NONE, /* 1 */ ANIMTAPER_ACCEL } AnimationTapers; @@ -49,14 +49,6 @@ typedef struct { /* 0x08 */ Gfx* dLists[2]; // Near and far } LodLimb; // size = 0x10 -typedef struct { - /* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent - /* 0x06 */ u8 child; - /* 0x07 */ u8 sibling; - /* 0x08 */ s32 unk_8; // Type of data contained in segment - /* 0x0C */ void* segment; // Segment address of data. Currently unclear what. -} SkinLimb; // size = 0x10 - // Model has limbs with only rigid meshes typedef struct { /* 0x00 */ void** segment; @@ -279,43 +271,6 @@ typedef s32 (*OverrideCurveLimbDraw)(struct GlobalContext* globalCtx, SkelAnimeC typedef void (*PostCurveLimbDraw)(struct GlobalContext* globalCtx, SkelAnimeCurve* skelCuve, s32 limbIndex, struct Actor* actor); -// TODO the name of this struct is imported from OoT and cannot change until the ZAPD name also changes -typedef struct { - /* 0x000 */ u16 unk_0; - /* 0x002 */ s16 unk_2; - /* 0x004 */ s16 unk_4; - /* 0x006 */ s8 unk_6; - /* 0x007 */ s8 unk_7; - /* 0x008 */ s8 unk_8; - /* 0x009 */ u8 unk_9; -} Struct_800A57C0; // size = 0xA - -// TODO the name of this struct is imported from OoT and cannot change until the ZAPD name also changes -typedef struct { - /* 0x000 */ u8 unk_0; - /* 0x002 */ s16 x; - /* 0x004 */ s16 y; - /* 0x006 */ s16 z; - /* 0x008 */ u8 unk_8; -} Struct_800A598C_2; // size = 0xA - -// TODO the name of this struct is imported from OoT and cannot change until the ZAPD name also changes -typedef struct { - /* 0x000 */ u16 unk_0; - /* 0x002 */ u16 unk_2; - /* 0x004 */ u16 unk_4; - /* 0x008 */ Struct_800A57C0* unk_8; - /* 0x00C */ Struct_800A598C_2* unk_C; -} Struct_800A598C; // size = 0x10 - -// TODO the name of this struct is imported from OoT and cannot change until the ZAPD name also changes -typedef struct { - /* 0x000 */ u16 unk_0; - /* 0x002 */ u16 unk_2; - /* 0x004 */ Struct_800A598C* unk_4; - /* 0x008 */ Gfx* unk_8; -} Struct_800A5E28; // size = 0xC - typedef struct { /* 0x00 */ AnimationHeader* animation; /* 0x04 */ f32 playSpeed; diff --git a/include/z64skin.h b/include/z64skin.h new file mode 100644 index 0000000000..adb2f9b0fb --- /dev/null +++ b/include/z64skin.h @@ -0,0 +1,106 @@ +#ifndef Z64_SKIN_H +#define Z64_SKIN_H + +#include "z64animation.h" + +struct GraphicsContext; +struct GameState; +struct GlobalContext; + +/** + * Holds a compact version of a vertex used in the Skin system (doesn't has the x, y, z positions or the flag member) + * It is used to initialise the Vtx used by an animated limb + */ +typedef struct { + /* 0x0 */ u16 index; + /* 0x2 */ s16 s; // s and t are texture coordinates (also known as u and v) + /* 0x4 */ s16 t; + /* 0x6 */ s8 normX; + /* 0x7 */ s8 normY; + /* 0x8 */ s8 normZ; + /* 0x9 */ u8 alpha; +} SkinVertex; // size = 0xA + +/** + * Describes a position displacement and a scale to be applied to a limb at index `limbIndex` + */ +typedef struct { + /* 0x0 */ u8 limbIndex; + /* 0x2 */ s16 x; + /* 0x4 */ s16 y; + /* 0x6 */ s16 z; + /* 0x8 */ u8 scale; +} SkinTransformation; // size = 0xA + +typedef struct { + /* 0x00 */ u16 vtxCount; // number of vertices in this modif entry + /* 0x02 */ u16 transformCount; + /* 0x04 */ u16 unk_04; // index of limbTransformations + /* 0x08 */ SkinVertex* skinVertices; + /* 0x0C */ SkinTransformation* limbTransformations; +} SkinLimbModif; // size = 0x10 + +typedef struct { + /* 0x00 */ u16 totalVtxCount; // total vertex count for all modif entries + /* 0x02 */ u16 limbModifCount; // count of limbModifCount + /* 0x04 */ SkinLimbModif* limbModifications; + /* 0x08 */ Gfx* dlist; +} SkinAnimatedLimbData; // size = 0xC + +// ZAPD compatibility typedefs +// TODO: Remove when ZAPD adds support for them +typedef SkinVertex Struct_800A57C0; +typedef SkinTransformation Struct_800A598C_2; +typedef SkinAnimatedLimbData Struct_800A5E28; +typedef SkinLimbModif Struct_800A598C; + +#define SKIN_LIMB_TYPE_ANIMATED 4 +#define SKIN_LIMB_TYPE_NORMAL 11 + +typedef struct { + /* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent + /* 0x06 */ u8 child; + /* 0x07 */ u8 sibling; + /* 0x08 */ s32 segmentType; // Type of data contained in segment + /* 0x0C */ void* segment; // Gfx* if segmentType is SKIN_LIMB_TYPE_NORMAL, SkinAnimatedLimbData if segmentType is SKIN_LIMB_TYPE_ANIMATED, NULL otherwise +} SkinLimb; // size = 0x10 + +typedef struct { + /* 0x0 */ u8 index; // alternates every draw cycle + /* 0x4 */ Vtx* buf[2]; // number of vertices in buffer determined by `totalVtxCount` +} SkinLimbVtx; // size = 0xC + +typedef struct { + /* 0x000 */ SkeletonHeader* skeletonHeader; + /* 0x004 */ MtxF mtx; + /* 0x044 */ s32 limbCount; + /* 0x048 */ SkinLimbVtx* vtxTable; // double buffered list of vertices for each limb + /* 0x04C */ SkelAnime skelAnime; +} Skin; // size = 0x90 + +typedef void (*SkinPostDraw)(struct Actor*, struct GlobalContext*, Skin*); +typedef s32 (*SkinOverrideLimbDraw)(struct Actor*, struct GlobalContext*, s32, Skin*); + +#define SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS (1 << 0) +#define SKIN_DRAW_FLAG_CUSTOM_MATRIX (1 << 1) + + +void Skin_UpdateVertices(MtxF* mtx, SkinVertex* skinVertices, SkinLimbModif* modifEntry, Vtx* vtxBuf, Vec3f* pos); +void Skin_ApplyLimbModifications(struct GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, s32 arg3); +void Skin_DrawAnimatedLimb(struct GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, s32 arg3, s32 drawFlags); +void Skin_DrawLimb(struct GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, Gfx* dListOverride, s32 drawFlags); +void func_80138228(Actor* actor, struct GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, s32 setTranslation); +void func_80138258(Actor* actor, struct GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation); +void func_8013828C(Actor* actor, struct GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6); +void func_801382C4(Actor* actor, struct GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags); +void Skin_GetLimbPos(Skin* skin, s32 limbIndex, Vec3f* offset, Vec3f* dst); +void Skin_GetVertexPos(Skin* skin, s32 limbIndex, s32 vtxIndex, Vec3f* dst); + +void Skin_Setup(Skin* skin); +void Skin_InitAnimatedLimb(struct GameState* gameState, Skin* skin, s32 limbIndex); +void Skin_Init(struct GameState* gameState, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader); +void Skin_Free(struct GameState* gameState, Skin* skin); +s32 func_801387D4(Skin* skin, SkinLimb** skeleton, MtxF* limbMatrices, u8 parentIndex, u8 limbIndex); +s32 Skin_ApplyAnimTransformations(Skin* skin, MtxF* limbMatrices, Actor* actor, s32 setTranslation); + +#endif diff --git a/spec b/spec index f719cb5a18..e4be4114e7 100644 --- a/spec +++ b/spec @@ -527,7 +527,6 @@ beginseg include "build/data/code/code_801C5C50.data.o" include "build/src/code/z_skelanime.o" include "build/src/code/z_skin.o" - include "build/data/code/z_skin.bss.o" include "build/src/code/z_skin_awb.o" include "build/src/code/z_skin_matrix.o" include "build/src/code/z_snap.o" diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 3f5583f798..910458b77c 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #include "vt.h" diff --git a/src/code/z_demo.c b/src/code/z_demo.c index fb6f8687ca..785f868568 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #include "overlays/gamestates/ovl_daytelop/z_daytelop.h" diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index 17e73dc341..703b966deb 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -1,15 +1,16 @@ +#include "prevent_bss_reordering.h" #include "global.h" #include "interface/parameter_static/parameter_static.h" #include "prevent_bss_reordering.h" -static s16 sHeartsPrimColors[3][3] = { { 255, 70, 50 }, { 255, 190, 0 }, { 100, 100, 255 } }; -static s16 sHeartsEnvColors[3][3] = { { 50, 40, 60 }, { 255, 0, 0 }, { 0, 0, 255 } }; -static s16 sHeartsPrimFactors[3][3] = { { 0, 0, 0 }, { 0, 120, -50 }, { -155, 30, 205 } }; -static s16 sHeartsEnvFactors[3][3] = { { 0, 0, 0 }, { 205, -40, -60 }, { -50, -40, 195 } }; -static s16 sHeartsDDPrimColors[3][3] = { { 255, 255, 255 }, { 255, 190, 0 }, { 100, 100, 255 } }; -static s16 sHeartsDDEnvColors[3][3] = { { 200, 0, 0 }, { 255, 0, 0 }, { 0, 0, 255 } }; -static s16 sHeartsDDPrimFactors[3][3] = { { 0, 0, 0 }, { 0, -65, -255 }, { -155, -155, 0 } }; -static s16 sHeartsDDEnvFactors[3][3] = { { 0, 0, 0 }, { 55, 0, 0 }, { -200, 0, 255 } }; +s16 sHeartsPrimColors[3][3] = { { 255, 70, 50 }, { 255, 190, 0 }, { 100, 100, 255 } }; +s16 sHeartsEnvColors[3][3] = { { 50, 40, 60 }, { 255, 0, 0 }, { 0, 0, 255 } }; +s16 sHeartsPrimFactors[3][3] = { { 0, 0, 0 }, { 0, 120, -50 }, { -155, 30, 205 } }; +s16 sHeartsEnvFactors[3][3] = { { 0, 0, 0 }, { 205, -40, -60 }, { -50, -40, 195 } }; +s16 sHeartsDDPrimColors[3][3] = { { 255, 255, 255 }, { 255, 190, 0 }, { 100, 100, 255 } }; +s16 sHeartsDDEnvColors[3][3] = { { 200, 0, 0 }, { 255, 0, 0 }, { 0, 0, 255 } }; +s16 sHeartsDDPrimFactors[3][3] = { { 0, 0, 0 }, { 0, -65, -255 }, { -155, -155, 0 } }; +s16 sHeartsDDEnvFactors[3][3] = { { 0, 0, 0 }, { 55, 0, 0 }, { -200, 0, 255 } }; s16 sBeatingHeartsDDPrim[3]; s16 sBeatingHeartsDDEnv[3]; diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 9fc5467e07..f0ed1f5163 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -1577,7 +1577,7 @@ void SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkel /** * Initializes a skeleton with SkinLimbs to a looping animation, dynamically allocating the frame tables. */ -void SkelAnime_InitSkin(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, +void SkelAnime_InitSkin(GameState* gameState, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation) { SkeletonHeader* skeletonHeader; diff --git a/src/code/z_skin.c b/src/code/z_skin.c index f031b007f8..808a00da07 100644 --- a/src/code/z_skin.c +++ b/src/code/z_skin.c @@ -1,23 +1,273 @@ #include "global.h" +#include "z64skin.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_80137970.s") +// 60 is an arbitrary number which specifies the max amount of limbs per skeleton this system supports +MtxF gSkinLimbMatrices[60]; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_80137B34.s") +static s32 sUnused; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_80137EBC.s") +void Skin_UpdateVertices(MtxF* mtx, SkinVertex* skinVertices, SkinLimbModif* modifEntry, Vtx* vtxBuf, Vec3f* pos) { + SkinVertex* vertexEntry; + Vtx* vtx; + Vec3f wTemp; + Vec3f normal; + Vec3f sp44; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_80137F58.s") + wTemp.x = mtx->wx; + wTemp.y = mtx->wy; + wTemp.z = mtx->wz; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_80138050.s") + mtx->wx = 0.0f; + mtx->wy = 0.0f; + mtx->wz = 0.0f; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_80138228.s") + for (vertexEntry = skinVertices; vertexEntry < &skinVertices[modifEntry->vtxCount]; vertexEntry++) { + vtx = &vtxBuf[vertexEntry->index]; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_80138258.s") + vtx->n.ob[0] = pos->x; + vtx->n.ob[1] = pos->y; + vtx->n.ob[2] = pos->z; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_8013828C.s") + sp44.x = vertexEntry->normX; + sp44.y = vertexEntry->normY; + sp44.z = vertexEntry->normZ; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_801382C4.s") + SkinMatrix_Vec3fMtxFMultXYZ(mtx, &sp44, &normal); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_80138300.s") + vtx->n.n[0] = normal.x; + vtx->n.n[1] = normal.y; + vtx->n.n[2] = normal.z; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_8013835C.s") + mtx->wx = wTemp.x; + mtx->wy = wTemp.y; + mtx->wz = wTemp.z; +} + +void Skin_ApplyLimbModifications(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, s32 arg3) { + s32 modifCount; + SkinLimb** skeleton; + s32 pad; + SkinAnimatedLimbData* data; + s32 pad2[5]; + SkinLimbModif* modif; + SkinLimbVtx* vtxEntry; + s32 pad3; + s32 transformCount; + f32 scale; + SkinVertex* skinVertices; + Vec3f sp88; + Vtx* vtxBuf; + SkinTransformation* limbTransformations; + Vec3f spDC; + Vec3f spD0; + SkinTransformation* transformationEntry; + SkinLimb* limb; + SkinLimbModif* modifications; + + OPEN_DISPS(gfxCtx); + + skeleton = (SkinLimb**)Lib_SegmentedToVirtual(skin->skeletonHeader->segment); + limb = (SkinLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]); + data = Lib_SegmentedToVirtual(limb->segment); + modifications = (SkinLimbModif*)Lib_SegmentedToVirtual(data->limbModifications); + + vtxEntry = &skin->vtxTable[limbIndex]; + + vtxBuf = vtxEntry->buf[vtxEntry->index]; + modifCount = data->limbModifCount; + + for (modif = modifications; modif < &modifications[modifCount]; modif++) { + Vec3f spAC; + Vec3f spA0; + + skinVertices = (SkinVertex*)Lib_SegmentedToVirtual(modif->skinVertices); + limbTransformations = (SkinTransformation*)Lib_SegmentedToVirtual(modif->limbTransformations); + transformCount = modif->transformCount; + + if (transformCount == 1) { + spAC.x = limbTransformations[0].x; + spAC.y = limbTransformations[0].y; + spAC.z = limbTransformations[0].z; + + SkinMatrix_Vec3fMtxFMultXYZ(&gSkinLimbMatrices[limbTransformations[0].limbIndex], &spAC, &spDC); + } else if (arg3) { + transformationEntry = &limbTransformations[modif->unk_04]; + + spA0.x = transformationEntry->x; + spA0.y = transformationEntry->y; + spA0.z = transformationEntry->z; + SkinMatrix_Vec3fMtxFMultXYZ(&gSkinLimbMatrices[transformationEntry->limbIndex], &spA0, &spDC); + } else { + spDC.x = 0.0f; + spDC.y = 0.0f; + spDC.z = 0.0f; + + for (transformationEntry = limbTransformations; transformationEntry < &limbTransformations[transformCount]; + transformationEntry++) { + scale = transformationEntry->scale * 0.01f; + + sp88.x = transformationEntry->x; + sp88.y = transformationEntry->y; + sp88.z = transformationEntry->z; + + SkinMatrix_Vec3fMtxFMultXYZ(&gSkinLimbMatrices[transformationEntry->limbIndex], &sp88, &spD0); + + spDC.x += spD0.x * scale; + spDC.y += spD0.y * scale; + spDC.z += spD0.z * scale; + } + } + + Skin_UpdateVertices(&gSkinLimbMatrices[limbTransformations[modif->unk_04].limbIndex], skinVertices, modif, + vtxBuf, &spDC); + } + + gSPSegment(POLY_OPA_DISP++, 0x08, vtxEntry->buf[vtxEntry->index]); + + vtxEntry->index = (vtxEntry->index == 0); + + CLOSE_DISPS(gfxCtx); +} + +/** + * Draw a limb of type SKIN_LIMB_TYPE_ANIMATED, of the skeleton `skin` at index `limbIndex` + * The vertices of this limb are modified dynamically + */ +void Skin_DrawAnimatedLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, s32 arg3, s32 drawFlags) { + SkinLimb** skeleton; + s32 pad[3]; + SkinAnimatedLimbData* data; + + OPEN_DISPS(gfxCtx); + + skeleton = Lib_SegmentedToVirtual(skin->skeletonHeader->segment); + data = Lib_SegmentedToVirtual(((SkinLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]))->segment); + + if (!(drawFlags & SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS)) { + Skin_ApplyLimbModifications(gfxCtx, skin, limbIndex, arg3); + } + + gSPDisplayList(POLY_OPA_DISP++, data->dlist); + + CLOSE_DISPS(gfxCtx); +} + +/** + * Draw a limb of type SKIN_LIMB_TYPE_NORMAL, of the skeleton `skin` at index `limbIndex` + */ +void Skin_DrawLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, Gfx* dListOverride, s32 drawFlags) { + Gfx* gfx = dListOverride; + SkinLimb** skeleton; + + OPEN_DISPS(gfxCtx); + + skeleton = Lib_SegmentedToVirtual(skin->skeletonHeader->segment); + + if (dListOverride == NULL) { + gfx = ((SkinLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]))->segment; + } + + if (gfx != NULL) { + Mtx* mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &gSkinLimbMatrices[limbIndex]); + + if (mtx != NULL) { + gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gfx); + gSPPopMatrix(POLY_OPA_DISP++, G_MTX_MODELVIEW); + gDPPipeSync(POLY_OPA_DISP++); + } + } + + CLOSE_DISPS(gfxCtx); +} + +void Skin_DrawImpl(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, + SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags) { + s32 i; + SkinLimb** skeleton; + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + + OPEN_DISPS(gfxCtx); + + if (!(drawFlags & SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS)) { + Skin_ApplyAnimTransformations(skin, gSkinLimbMatrices, actor, setTranslation); + } + + skeleton = Lib_SegmentedToVirtual(skin->skeletonHeader->segment); + + if (!(drawFlags & SKIN_DRAW_FLAG_CUSTOM_MATRIX)) { + Mtx* mtx; + + gSPMatrix(POLY_OPA_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &skin->mtx); + if (mtx == NULL) { + goto close_disps; + } + gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + } + + for (i = 0; i < skin->skeletonHeader->limbCount; i++) { + s32 shouldDraw = true; + s32 segmentType; + + if (overrideLimbDraw != NULL) { + shouldDraw = overrideLimbDraw(actor, globalCtx, i, skin); + } + + segmentType = ((SkinLimb*)Lib_SegmentedToVirtual(skeleton[i]))->segmentType; + + if (segmentType == SKIN_LIMB_TYPE_ANIMATED && shouldDraw) { + Skin_DrawAnimatedLimb(gfxCtx, skin, i, arg6, drawFlags); + } else if (segmentType == SKIN_LIMB_TYPE_NORMAL && shouldDraw) { + Skin_DrawLimb(gfxCtx, skin, i, NULL, drawFlags); + } + } + + if (postDraw != NULL) { + postDraw(actor, globalCtx, skin); + } + +close_disps:; + CLOSE_DISPS(gfxCtx); +} + +// allows specifying postDraw and setTranslation +void func_80138228(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, s32 setTranslation) { + Skin_DrawImpl(actor, globalCtx, skin, postDraw, NULL, setTranslation, false, 0); +} + +// allows specifying OverrideLimbDraw, postDraw and setTranslation +void func_80138258(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, + SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation) { + Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, false, 0); +} + +// allows specifying OverrideLimbDraw, postDraw, setTranslation, and arg6 +void func_8013828C(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, + SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6) { + Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, arg6, 0); +} + +// allows specifying all variables +void func_801382C4(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, + SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags) { + Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, arg6, drawFlags); +} + +void Skin_GetLimbPos(Skin* skin, s32 limbIndex, Vec3f* offset, Vec3f* dst) { + MtxF mtxf; + + SkinMatrix_MtxFMtxFMult(&skin->mtx, &gSkinLimbMatrices[limbIndex], &mtxf); + SkinMatrix_Vec3fMtxFMultXYZ(&mtxf, offset, dst); +} + +void Skin_GetVertexPos(Skin* skin, s32 limbIndex, s32 vtxIndex, Vec3f* dst) { + Vec3f pos; + Vtx* vtx = &skin->vtxTable[limbIndex].buf[skin->vtxTable[0].index][vtxIndex]; + + pos.x = vtx->n.ob[0]; + pos.y = vtx->n.ob[1]; + pos.z = vtx->n.ob[2]; + SkinMatrix_Vec3fMtxFMultXYZ(&skin->mtx, &pos, dst); +} diff --git a/src/code/z_skin_awb.c b/src/code/z_skin_awb.c index 22a1c637f4..d45b9bc250 100644 --- a/src/code/z_skin_awb.c +++ b/src/code/z_skin_awb.c @@ -1,13 +1,204 @@ #include "global.h" +#include "z64skin.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_awb/func_80138410.s") +void Skin_Setup(Skin* skin) { + skin->skeletonHeader = NULL; + skin->limbCount = 0; + skin->vtxTable = NULL; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_awb/func_80138424.s") +/** + * Initialises the Vtx buffers used for limb at index `limbIndex` + */ +void Skin_InitAnimatedLimb(GameState* gameState, Skin* skin, s32 limbIndex) { + s32 i; + SkinLimb** skeleton = Lib_SegmentedToVirtual(skin->skeletonHeader->segment); + SkinAnimatedLimbData* animatedLimbData = + Lib_SegmentedToVirtual(((SkinLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]))->segment); + SkinLimbModif* limbModifications = Lib_SegmentedToVirtual(animatedLimbData->limbModifications); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_awb/func_8013859C.s") + for (i = 0; i < ARRAY_COUNT(skin->vtxTable->buf); i++) { + Vtx* vertices = skin->vtxTable[limbIndex].buf[i]; + SkinLimbModif* modifEntry; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_awb/func_80138700.s") + for (modifEntry = limbModifications; modifEntry < &limbModifications[animatedLimbData->limbModifCount]; + modifEntry++) { + SkinVertex* skinVertices = Lib_SegmentedToVirtual(modifEntry->skinVertices); + SkinVertex* skinVtxEntry; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_awb/func_801387D4.s") + for (skinVtxEntry = skinVertices; skinVtxEntry < &skinVertices[modifEntry->vtxCount];) { + Vtx* vtx = &vertices[skinVtxEntry->index]; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_awb/func_801388E4.s") + skinVtxEntry++; + + vtx->n.flag = 0; + vtx->n.tc[0] = skinVtxEntry[-1].s; + vtx->n.tc[1] = skinVtxEntry[-1].t; + vtx->n.a = skinVtxEntry[-1].alpha; + } + } + } +} + +/** + * Initializes a skin skeleton to looping animation, dynamically allocating the frame tables, + * and dynamically allocating and initialising the Vtx and SkinLimbVtx buffers for its animated limbs + */ +void Skin_Init(GameState* gameState, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader) { + s32 limbCount; + s32 i; + SkinLimb** skeleton; + SkeletonHeader* virtSkelHeader = Lib_SegmentedToVirtual(skeletonHeader); + + skin->limbCount = virtSkelHeader->limbCount; + skin->skeletonHeader = virtSkelHeader; + limbCount = skin->skeletonHeader->limbCount; + + skeleton = Lib_SegmentedToVirtual(skin->skeletonHeader->segment); + skin->vtxTable = ZeldaArena_Malloc(limbCount * sizeof(SkinLimbVtx)); + + for (i = 0; i < limbCount; i++) { + SkinLimbVtx* vtxEntry = &skin->vtxTable[i]; + + if ((((SkinLimb*)Lib_SegmentedToVirtual(skeleton[i]))->segmentType != SKIN_LIMB_TYPE_ANIMATED) || + (((SkinLimb*)Lib_SegmentedToVirtual(skeleton[i]))->segment == NULL)) { + vtxEntry->index = 0; + + vtxEntry->buf[0] = NULL; + vtxEntry->buf[1] = NULL; + } else { + SkinAnimatedLimbData* animatedLimbData = + Lib_SegmentedToVirtual((((SkinLimb*)Lib_SegmentedToVirtual(skeleton[i]))->segment)); + + { s32 tmp; } + + vtxEntry->index = 0; + vtxEntry->buf[0] = ZeldaArena_Malloc(animatedLimbData->totalVtxCount * sizeof(Vtx)); + vtxEntry->buf[1] = ZeldaArena_Malloc(animatedLimbData->totalVtxCount * sizeof(Vtx)); + + Skin_InitAnimatedLimb(gameState, skin, i); + } + } + + SkelAnime_InitSkin(gameState, &skin->skelAnime, skeletonHeader, animationHeader); +} + +/** + * Frees the dynamically allocated Vtx and SkinLimbVtx buffers and tables + */ +void Skin_Free(GameState* gameState, Skin* skin) { + if (skin->vtxTable != NULL) { + s32 i; + + for (i = 0; i < skin->limbCount; i++) { + if (skin->vtxTable[i].buf[0] != NULL) { + ZeldaArena_Free(skin->vtxTable[i].buf[0]); + skin->vtxTable[i].buf[0] = NULL; + } + if (skin->vtxTable[i].buf[1] != NULL) { + ZeldaArena_Free(skin->vtxTable[i].buf[1]); + skin->vtxTable[i].buf[1] = NULL; + } + } + + if (skin->vtxTable != NULL) { + ZeldaArena_Free(skin->vtxTable); + } + + SkelAnime_Free(&skin->skelAnime, (GlobalContext*)gameState); + } +} + +s32 func_801387D4(Skin* skin, SkinLimb** skeleton, MtxF* limbMatrices, u8 parentIndex, u8 limbIndex) { + s32 pad; + SkinLimb* limb = Lib_SegmentedToVirtual(skeleton[limbIndex]); + MtxF* mtx; + s32 ret; + MtxF sp28; + + if (parentIndex == LIMB_DONE) { + SkinMatrix_GetClear(&mtx); + } else { + mtx = &limbMatrices[(s32)parentIndex]; + } + + SkinMatrix_MtxFMtxFMult(mtx, &limbMatrices[limbIndex], &sp28); + SkinMatrix_MtxFCopy(&sp28, &limbMatrices[limbIndex]); + + if (limb->child != LIMB_DONE) { + ret = func_801387D4(skin, skeleton, limbMatrices, limbIndex, limb->child); + if (ret) { + return ret; + } + } + + if (limb->sibling != LIMB_DONE) { + ret = func_801387D4(skin, skeleton, limbMatrices, parentIndex, limb->sibling); + if (ret) { + return ret; + } + } + + return false; +} + +/** + * Recursively applies matrix tranformations to each limb + */ +s32 Skin_ApplyAnimTransformations(Skin* skin, MtxF* limbMatrices, Actor* actor, s32 setTranslation) { + s32 i; + s32 pad; + f32 yRot; + f32 xRot; + f32 zRot; + s32 ret; + f32 yTransl; + f32 xTransl; + f32 zTransl; + SkinLimb** skeleton = Lib_SegmentedToVirtual(skin->skeletonHeader->segment); + Vec3s* jointRot = skin->skelAnime.jointTable; + + jointRot++; + xRot = jointRot->x; + yRot = jointRot->y; + zRot = jointRot->z; + + if (setTranslation) { + jointRot--; + xTransl = jointRot->x; + yTransl = jointRot->y; + zTransl = jointRot->z; + jointRot++; + + SkinMatrix_SetRotateRPYTranslate(limbMatrices, xRot, yRot, zRot, xTransl, yTransl, zTransl); + } else { + SkinMatrix_SetRotateRPYTranslate(limbMatrices, xRot, yRot, zRot, 0.0f, 0.0f, 0.0f); + } + + jointRot++; + + for (i = 1; i < skin->skeletonHeader->limbCount; i++) { + SkinLimb* limb = Lib_SegmentedToVirtual(skeleton[i]); + + xTransl = limb->jointPos.x; + yTransl = limb->jointPos.y; + zTransl = limb->jointPos.z; + xRot = jointRot->x; + yRot = jointRot->y; + zRot = jointRot->z; + jointRot++; + SkinMatrix_SetRotateRPYTranslate(&limbMatrices[i], xRot, yRot, zRot, xTransl, yTransl, zTransl); + } + + SkinMatrix_SetScaleRotateYRPTranslate( + &skin->mtx, actor->scale.x, actor->scale.y, actor->scale.z, actor->shape.rot.x, actor->shape.rot.y, + actor->shape.rot.z, actor->world.pos.x, actor->world.pos.y + (actor->shape.yOffset * actor->scale.y), + actor->world.pos.z); + + ret = func_801387D4(skin, Lib_SegmentedToVirtual(skin->skeletonHeader->segment), limbMatrices, LIMB_DONE, 0); + if (!ret) { + return ret; + } + + return false; +} diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.h b/src/overlays/actors/ovl_En_Horse/z_en_horse.h index 787fd8b579..05a4065ffd 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.h +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.h @@ -2,6 +2,7 @@ #define Z_EN_HORSE_H #include "global.h" +#include "z64skin.h" struct EnHorse; diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h index 16ac6a6160..ecc816c52b 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h @@ -2,6 +2,7 @@ #define Z_EN_HORSE_LINK_CHILD_H #include "global.h" +#include "z64skin.h" struct EnHorseLinkChild; diff --git a/tools/ZAPDConfigs/MM/SymbolMap_MM.txt b/tools/ZAPDConfigs/MM/SymbolMap_MM.txt index 015e7e88a3..cc7b36b5e6 100644 --- a/tools/ZAPDConfigs/MM/SymbolMap_MM.txt +++ b/tools/ZAPDConfigs/MM/SymbolMap_MM.txt @@ -1 +1 @@ -8012DB20 gMtxClear \ No newline at end of file +801D1DE0 gIdentityMtx diff --git a/tools/actorfixer.py b/tools/actorfixer.py index 5e7d2e3a63..b6aba86c0d 100755 --- a/tools/actorfixer.py +++ b/tools/actorfixer.py @@ -232,6 +232,8 @@ animdict = { "MainHeap_Init": "ZeldaArena_Init", "MainHeap_Cleanup": "ZeldaArena_Cleanup", "MainHeap_IsInitialized": "ZeldaArena_IsInitialized", + "func_80138300": "Skin_GetLimbPos", + "func_8013835C": "Skin_GetVertexPos", # "BgCheck_RelocateMeshHeader": "CollisionHeader_GetVirtual", # "BgCheck_AddActorMesh": "DynaPoly_SetBgActor", # "BgCheck_RemoveActorMesh": "DynaPoly_DeleteBgActor", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 4923739ed0..321bed21da 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2608,23 +2608,23 @@ 0x801378B8:("Animation_OnFrame",), 0x801378E0:("SkelAnime_Free",), 0x8013792C:("SkelAnime_CopyFrameTable",), - 0x80137970:("func_80137970",), - 0x80137B34:("func_80137B34",), - 0x80137EBC:("func_80137EBC",), - 0x80137F58:("func_80137F58",), - 0x80138050:("func_80138050",), + 0x80137970:("Skin_UpdateVertices",), + 0x80137B34:("Skin_ApplyLimbModifications",), + 0x80137EBC:("Skin_DrawAnimatedLimb",), + 0x80137F58:("Skin_DrawLimb",), + 0x80138050:("Skin_DrawImpl",), 0x80138228:("func_80138228",), 0x80138258:("func_80138258",), 0x8013828C:("func_8013828C",), 0x801382C4:("func_801382C4",), - 0x80138300:("func_80138300",), - 0x8013835C:("func_8013835C",), - 0x80138410:("func_80138410",), - 0x80138424:("func_80138424",), - 0x8013859C:("func_8013859C",), - 0x80138700:("func_80138700",), + 0x80138300:("Skin_GetLimbPos",), + 0x8013835C:("Skin_GetVertexPos",), + 0x80138410:("Skin_Setup",), + 0x80138424:("Skin_InitAnimatedLimb",), + 0x8013859C:("Skin_Init",), + 0x80138700:("Skin_Free",), 0x801387D4:("func_801387D4",), - 0x801388E4:("func_801388E4",), + 0x801388E4:("Skin_ApplyAnimTransformations",), 0x80138BA0:("SkinMatrix_Vec3fMtxFMultXYZW",), 0x80138C88:("SkinMatrix_Vec3fMtxFMultXYZ",), 0x80138D38:("SkinMatrix_MtxFMtxFMult",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 83f8ac2e9e..e3d3a84852 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -4072,7 +4072,8 @@ 0x801F5AA8:("sMatAnimAlphaRatio","f32","",0x4), 0x801F5AB0:("sAnimQueueFlags","UNK_TYPE1","",0x1), 0x801F5AB4:("sDisableAnimQueueFlags","UNK_TYPE1","",0x1), - 0x801F5AC0:("D_801F5AC0","UNK_TYPE1","",0x1), + 0x801F5AC0:("gSkinLimbMatrices","MtxF","[60]",0xF00), + 0x801F69C0:("D_801F69C0","UNK_TYPE1","",0x10), 0x801F69D0:("D_801F69D0","UNK_TYPE1","",0x1), 0x801F6A10:("D_801F6A10","UNK_TYPE1","",0x1), 0x801F6AD4:("D_801F6AD4","UNK_TYPE1","",0x1), diff --git a/tools/sizes/boot_functions.csv b/tools/sizes/boot_functions.csv index 3685e3fa9c..8551b4fca4 100644 --- a/tools/sizes/boot_functions.csv +++ b/tools/sizes/boot_functions.csv @@ -162,7 +162,7 @@ asm/non_matchings/boot/boot_800862E0/func_8008641C.s,func_8008641C,0x8008641C,0x asm/non_matchings/boot/boot_800862E0/func_800864EC.s,func_800864EC,0x800864EC,0x27 asm/non_matchings/boot/boot_800862E0/func_80086588.s,func_80086588,0x80086588,0x1C asm/non_matchings/boot/boot_800862E0/SystemArena_Init.s,SystemArena_Init,0x800865F8,0xA -asm/non_matchings/boot/padsetup/func_80086620.s,func_80086620,0x80086620,0x50 +asm/non_matchings/boot/padsetup/PadSetup_Init.s,PadSetup_Init,0x80086620,0x50 asm/non_matchings/boot/boot_80086760/func_80086760.s,func_80086760,0x80086760,0xD asm/non_matchings/boot/boot_80086760/func_80086794.s,func_80086794,0x80086794,0x8 asm/non_matchings/boot/boot_80086760/func_800867B4.s,func_800867B4,0x800867B4,0x8 diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 98d408beef..11dae40bad 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -1034,7 +1034,7 @@ asm/non_matchings/code/code_800E8EA0/func_800E9138.s,func_800E9138,0x800E9138,0x asm/non_matchings/code/code_800E8EA0/func_800E9250.s,func_800E9250,0x800E9250,0x44 asm/non_matchings/code/z_common_data/func_800E9360.s,func_800E9360,0x800E9360,0x20 asm/non_matchings/code/z_debug/GameInfo_Init.s,GameInfo_Init,0x800E93E0,0x24 -asm/non_matchings/code/z_debug_display/func_800E9470.s,func_800E9470,0x800E9470,0x6 +asm/non_matchings/code/z_debug_display/DebugDisplay_Init.s,DebugDisplay_Init,0x800E9470,0x6 asm/non_matchings/code/z_debug_display/DebugDisplay_AddObject.s,DebugDisplay_AddObject,0x800E9488,0x37 asm/non_matchings/code/z_debug_display/DebugDisplay_DrawObjects.s,DebugDisplay_DrawObjects,0x800E9564,0x24 asm/non_matchings/code/z_debug_display/func_800E95F4.s,func_800E95F4,0x800E95F4,0x79 @@ -2122,23 +2122,23 @@ asm/non_matchings/code/z_skelanime/SkelAnime_UpdateTranslation.s,SkelAnime_Updat asm/non_matchings/code/z_skelanime/Animation_OnFrame.s,Animation_OnFrame,0x801378B8,0xA asm/non_matchings/code/z_skelanime/SkelAnime_Free.s,SkelAnime_Free,0x801378E0,0x13 asm/non_matchings/code/z_skelanime/SkelAnime_CopyFrameTable.s,SkelAnime_CopyFrameTable,0x8013792C,0x11 -asm/non_matchings/code/z_skin/func_80137970.s,func_80137970,0x80137970,0x71 -asm/non_matchings/code/z_skin/func_80137B34.s,func_80137B34,0x80137B34,0xE2 -asm/non_matchings/code/z_skin/func_80137EBC.s,func_80137EBC,0x80137EBC,0x27 -asm/non_matchings/code/z_skin/func_80137F58.s,func_80137F58,0x80137F58,0x3E -asm/non_matchings/code/z_skin/func_80138050.s,func_80138050,0x80138050,0x76 +asm/non_matchings/code/z_skin/Skin_UpdateVertices.s,Skin_UpdateVertices,0x80137970,0x71 +asm/non_matchings/code/z_skin/Skin_ApplyLimbModifications.s,Skin_ApplyLimbModifications,0x80137B34,0xE2 +asm/non_matchings/code/z_skin/Skin_DrawAnimatedLimb.s,Skin_DrawAnimatedLimb,0x80137EBC,0x27 +asm/non_matchings/code/z_skin/Skin_DrawLimb.s,Skin_DrawLimb,0x80137F58,0x3E +asm/non_matchings/code/z_skin/Skin_DrawImpl.s,Skin_DrawImpl,0x80138050,0x76 asm/non_matchings/code/z_skin/func_80138228.s,func_80138228,0x80138228,0xC asm/non_matchings/code/z_skin/func_80138258.s,func_80138258,0x80138258,0xD asm/non_matchings/code/z_skin/func_8013828C.s,func_8013828C,0x8013828C,0xE asm/non_matchings/code/z_skin/func_801382C4.s,func_801382C4,0x801382C4,0xF -asm/non_matchings/code/z_skin/func_80138300.s,func_80138300,0x80138300,0x17 -asm/non_matchings/code/z_skin/func_8013835C.s,func_8013835C,0x8013835C,0x2D -asm/non_matchings/code/z_skin_awb/func_80138410.s,func_80138410,0x80138410,0x5 -asm/non_matchings/code/z_skin_awb/func_80138424.s,func_80138424,0x80138424,0x5E -asm/non_matchings/code/z_skin_awb/func_8013859C.s,func_8013859C,0x8013859C,0x59 -asm/non_matchings/code/z_skin_awb/func_80138700.s,func_80138700,0x80138700,0x35 +asm/non_matchings/code/z_skin/Skin_GetLimbPos.s,Skin_GetLimbPos,0x80138300,0x17 +asm/non_matchings/code/z_skin/Skin_GetVertexPos.s,Skin_GetVertexPos,0x8013835C,0x2D +asm/non_matchings/code/z_skin_awb/Skin_Setup.s,Skin_Setup,0x80138410,0x5 +asm/non_matchings/code/z_skin_awb/Skin_InitAnimatedLimb.s,Skin_InitAnimatedLimb,0x80138424,0x5E +asm/non_matchings/code/z_skin_awb/Skin_Init.s,Skin_Init,0x8013859C,0x59 +asm/non_matchings/code/z_skin_awb/Skin_Free.s,Skin_Free,0x80138700,0x35 asm/non_matchings/code/z_skin_awb/func_801387D4.s,func_801387D4,0x801387D4,0x44 -asm/non_matchings/code/z_skin_awb/func_801388E4.s,func_801388E4,0x801388E4,0xAF +asm/non_matchings/code/z_skin_awb/Skin_ApplyAnimTransformations.s,Skin_ApplyAnimTransformations,0x801388E4,0xAF asm/non_matchings/code/z_skin_matrix/SkinMatrix_Vec3fMtxFMultXYZW.s,SkinMatrix_Vec3fMtxFMultXYZW,0x80138BA0,0x3A asm/non_matchings/code/z_skin_matrix/SkinMatrix_Vec3fMtxFMultXYZ.s,SkinMatrix_Vec3fMtxFMultXYZ,0x80138C88,0x2C asm/non_matchings/code/z_skin_matrix/SkinMatrix_MtxFMtxFMult.s,SkinMatrix_MtxFMtxFMult,0x80138D38,0xD7