1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-14 05:19:36 +00:00

Small Skin system documentation pass (#1017)

* some docs

* rename a bunch of callbacks

* more cleanup

* format

* last cleanup

* some updates

* more docs

* done i think

* name flag and format

* name unused variable

* comments

* revert unwanted change

* z64skin.h

* format

* Address review

* Rename PostLimbDraw callbacks to PostDraw and some PR addressing

* add true/false for setTranslation

* ahhhh

* remove "you"

Co-authored-by: fig02 <fig02srl@gmail.com>
This commit is contained in:
Anghelo Carvajal 2022-01-12 20:00:28 -03:00 committed by GitHub
parent e5ecdfd559
commit 9fec455805
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 442 additions and 345 deletions

View file

@ -1277,24 +1277,19 @@ 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_800A57C0(MtxF* mtx, Struct_800A57C0* arg1, Struct_800A598C* arg2, Vtx* arg3, Vec3f* arg4);
void func_800A598C(GraphicsContext* gfxCtx, PSkinAwb* skin, s32 limbIndex, s32 arg3);
void func_800A5E28(GraphicsContext* gfxCtx, PSkinAwb* skin, s32 limbIndex, s32 arg3, s32 arg4);
void func_800A5F60(GraphicsContext* gfxCtx, PSkinAwb* skin, s32 limbIndex, Gfx* arg3, s32 arg4);
void func_800A60D8(Actor* actor, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, SkinCallback2 arg4,
s32 arg5, s32 arg6, s32 arg7);
void func_800A6330(Actor* actor, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, s32 arg4);
void func_800A6360(Actor* this, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, SkinCallback2 arg4,
s32 arg5);
void func_800A63CC(Actor* actor, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, SkinCallback2 arg4,
s32 arg5, s32 arg6, s32 arg7);
void func_800A6408(PSkinAwb* skin, s32 joint, Vec3f* arg2, Vec3f* arg3);
void func_800A6460(GlobalContext* globalCtx, PSkinAwb* skin, s32 arg2);
void func_800A663C(GlobalContext* globalCtx, PSkinAwb* skin, SkeletonHeader* skeletonHeader,
AnimationHeader* animationHeader);
void func_800A6888(GlobalContext* globalCtx, PSkinAwb* skin);
s32 func_800A698C(PSkinAwb* skin, SkinLimb** limbs, MtxF* arg2, u8 arg3, u8 arg4);
s32 func_800A6AC4(PSkinAwb* skin, MtxF* arg1, Actor* actor, s32 arg3);
void Skin_UpdateVertices(MtxF* mtx, SkinVertex* skinVertices, SkinLimbModif* modifEntry, Vtx* vtxBuf, Vec3f* pos);
void Skin_DrawAnimatedLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, s32 arg3, s32 drawFlags);
void Skin_DrawLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, Gfx* dlistOverride, s32 drawFlags);
void func_800A6330(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, s32 setTranslation);
void func_800A6360(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation);
void func_800A6394(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6);
void func_800A63CC(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags);
void Skin_GetLimbPos(Skin* skin, s32 limbIndex, Vec3f* arg2, Vec3f* dst);
void Skin_Init(GlobalContext* globalCtx, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader);
void Skin_Free(GlobalContext* globalCtx, Skin* skin);
s32 Skin_ApplyAnimTransformations(Skin* skin, MtxF* mf, Actor* actor, s32 setTranslation);
void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDest);
void SkinMatrix_Vec3fMtxFMultXYZ(MtxF* mf, Vec3f* src, Vec3f* dest);
void SkinMatrix_MtxFMtxFMult(MtxF* mfA, MtxF* mfB, MtxF* dest);

View file

@ -21,6 +21,7 @@
#include "z64dma.h"
#include "z64math.h"
#include "z64map_mark.h"
#include "z64skin.h"
#include "z64transition.h"
#include "z64interface.h"
#include "sequence.h"

View file

@ -45,14 +45,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
typedef struct LegacyLimb {
/* 0x000 */ Gfx* dList;
/* 0x004 */ Vec3f trans;
@ -271,53 +263,4 @@ typedef struct SkelAnime {
/* 0x3E */ Vec3s baseTransl; // Base modelspace translation.
} SkelAnime; // size = 0x44
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
typedef struct {
/* 0x000 */ u8 unk_0;
/* 0x002 */ s16 x;
/* 0x004 */ s16 y;
/* 0x006 */ s16 z;
/* 0x008 */ u8 unk_8;
} Struct_800A598C_2; // size = 0xA
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
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 {
/* 0x000 */ u8 unk_0;
/* 0x004 */ Vtx* buf[2];
} SkinAvb; // size = 0xC
typedef struct {
/* 0x000 */ SkeletonHeader* skeletonHeader;
/* 0x004 */ MtxF mtx;
/* 0x044 */ s32 avbCount;
/* 0x048 */ SkinAvb* avbTbl;
/* 0x04C */ SkelAnime skelAnime;
} PSkinAwb; // size = 0x90
typedef void (*SkinCallback)(struct Actor*, struct GlobalContext*, PSkinAwb*);
typedef s32 (*SkinCallback2)(struct Actor*, struct GlobalContext*, s32, PSkinAwb*);
#endif

85
include/z64skin.h Normal file
View file

@ -0,0 +1,85 @@
#ifndef Z64_SKIN_H
#define Z64_SKIN_H
#include "z64animation.h"
/**
* Holds a compact version of a vertex used in the Skin system
* It is used to initialise the Vtx used by an animated limb
*/
typedef struct {
/* 0x00 */ u16 index;
/* 0x02 */ s16 s; // s and t are texture coordinates (also known as u and v)
/* 0x04 */ s16 t;
/* 0x06 */ s8 normX;
/* 0x07 */ s8 normY;
/* 0x08 */ s8 normZ;
/* 0x09 */ u8 alpha;
} SkinVertex; // size = 0xA
/**
* Describes a position displacement and a scale to be applied to a limb at index `limbIndex`
*/
typedef struct {
/* 0x00 */ u8 limbIndex;
/* 0x02 */ s16 x;
/* 0x04 */ s16 y;
/* 0x06 */ s16 z;
/* 0x08 */ u8 scale;
} SkinTransformation; // size = 0xA
typedef struct {
/* 0x00 */ u16 vtxCount; // number of vertices in this modif entry
/* 0x02 */ u16 transformCount;
/* 0x04 */ u16 unk_4; // 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;
/* 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 {
/* 0x000 */ u8 index; // alternates every draw cycle
/* 0x004 */ 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)
#define SKIN_TRANSFORM_IS_FHG 0x23
#endif

View file

@ -63,9 +63,9 @@ void MapMark_Init(GlobalContext* globalCtx) {
Overlay_Load(overlay->vromStart, overlay->vromEnd, overlay->vramStart, overlay->vramEnd, overlay->loadedRamAddr);
sLoadedMarkDataTable = gMapMarkDataTable;
sLoadedMarkDataTable = (void*)(u32)(
(overlay->vramTable != NULL)
? (void*)((u32)overlay->vramTable - (s32)((u32)overlay->vramStart - (u32)overlay->loadedRamAddr))
sLoadedMarkDataTable = (void*)(u32)((overlay->vramTable != NULL)
? (void*)((u32)overlay->vramTable -
(s32)((u32)overlay->vramStart - (u32)overlay->loadedRamAddr))
: NULL);
}

View file

@ -1,149 +1,178 @@
#include "global.h"
MtxF D_801600C0[60];
char D_80160FC0[0x10];
MtxF gSkinLimbMatrices[60]; // holds matrices for each limb of the skeleton currently being drawn
void func_800A57C0(MtxF* mtx, Struct_800A57C0* arg1, Struct_800A598C* arg2, Vtx* arg3, Vec3f* arg4) {
Vtx* temp_s2;
Struct_800A57C0* phi_s1;
f32 temp_x;
f32 temp_y;
f32 temp_z;
Vec3f sp70;
static s32 sUnused;
void Skin_UpdateVertices(MtxF* mtx, SkinVertex* skinVertices, SkinLimbModif* modifEntry, Vtx* vtxBuf, Vec3f* pos) {
Vtx* vtx;
SkinVertex* vertexEntry;
f32 xwTemp;
f32 ywTemp;
f32 zwTemp;
Vec3f normal;
Vec3f sp64;
for (phi_s1 = arg1; phi_s1 < arg1 + arg2->unk_0; phi_s1++) {
temp_s2 = &arg3[phi_s1->unk_0];
temp_s2->n.ob[0] = arg4->x;
temp_s2->n.ob[1] = arg4->y;
temp_s2->n.ob[2] = arg4->z;
temp_x = mtx->xw;
temp_y = mtx->yw;
temp_z = mtx->zw;
mtx->zw = 0.0f;
mtx->yw = 0.0f;
mtx->xw = 0.0f;
sp64.x = phi_s1->unk_6;
sp64.y = phi_s1->unk_7;
sp64.z = phi_s1->unk_8;
SkinMatrix_Vec3fMtxFMultXYZ(mtx, &sp64, &sp70);
temp_s2->n.n[0] = sp70.x;
temp_s2->n.n[1] = sp70.y;
temp_s2->n.n[2] = sp70.z;
mtx->xw = temp_x;
mtx->yw = temp_y;
mtx->zw = temp_z;
for (vertexEntry = skinVertices; vertexEntry < &skinVertices[modifEntry->vtxCount]; vertexEntry++) {
vtx = &vtxBuf[vertexEntry->index];
vtx->n.ob[0] = pos->x;
vtx->n.ob[1] = pos->y;
vtx->n.ob[2] = pos->z;
xwTemp = mtx->xw;
ywTemp = mtx->yw;
zwTemp = mtx->zw;
mtx->xw = mtx->yw = mtx->zw = 0.0f;
sp64.x = vertexEntry->normX;
sp64.y = vertexEntry->normY;
sp64.z = vertexEntry->normZ;
SkinMatrix_Vec3fMtxFMultXYZ(mtx, &sp64, &normal);
vtx->n.n[0] = normal.x;
vtx->n.n[1] = normal.y;
vtx->n.n[2] = normal.z;
mtx->xw = xwTemp;
mtx->yw = ywTemp;
mtx->zw = zwTemp;
}
}
void func_800A598C(GraphicsContext* gfxCtx, PSkinAwb* skin, s32 limbIndex, s32 arg3) {
s32 temp_1;
void Skin_ApplyLimbModifications(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, s32 arg3) {
s32 modifCount;
SkinLimb** skeleton;
SkinLimb* limb;
Struct_800A5E28* data;
Struct_800A598C* phi_s6;
SkinAvb* avb;
s32 temp_a0_2;
f32 temp_f20;
Struct_800A57C0* temp_v0;
Struct_800A598C_2* temp_s3;
Vtx* spEC;
Struct_800A598C* temp_2;
Vec3f spDC;
SkinAnimatedLimbData* data;
SkinLimbModif* modif;
SkinLimbVtx* vtxEntry;
s32 transformCount;
f32 scale;
SkinVertex* skinVertices;
SkinTransformation* limbTransformations;
Vtx* vtxBuf;
SkinLimbModif* modifications;
Vec3f vtxPoint;
Vec3f spD0;
Struct_800A598C_2* phi_s0;
SkinTransformation* transformationEntry;
OPEN_DISPS(gfxCtx, "../z_skin.c", 254);
skeleton = (SkinLimb**)SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
data = SEGMENTED_TO_VIRTUAL(((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]))->segment);
temp_2 = (Struct_800A598C*)SEGMENTED_TO_VIRTUAL(data->unk_4);
modifications = (SkinLimbModif*)SEGMENTED_TO_VIRTUAL(data->limbModifications);
avb = &skin->avbTbl[limbIndex];
vtxEntry = &skin->vtxTable[limbIndex];
vtxBuf = vtxEntry->buf[vtxEntry->index];
modifCount = data->limbModifCount;
spEC = avb->buf[avb->unk_0];
temp_1 = data->unk_2;
for (modif = modifications; modif < modifications + modifCount; modif++) {
transformCount = modif->transformCount;
skinVertices = (SkinVertex*)SEGMENTED_TO_VIRTUAL(modif->skinVertices);
limbTransformations = (SkinTransformation*)SEGMENTED_TO_VIRTUAL(modif->limbTransformations);
for (phi_s6 = temp_2; phi_s6 < temp_2 + temp_1; phi_s6++) {
temp_a0_2 = phi_s6->unk_2;
temp_v0 = (Struct_800A57C0*)SEGMENTED_TO_VIRTUAL(phi_s6->unk_8);
temp_s3 = (Struct_800A598C_2*)SEGMENTED_TO_VIRTUAL(phi_s6->unk_C);
if (temp_a0_2 == 1) {
if (transformCount == 1) {
Vec3f spAC;
spAC.x = temp_s3[0].x;
spAC.y = temp_s3[0].y;
spAC.z = temp_s3[0].z;
SkinMatrix_Vec3fMtxFMultXYZ(&D_801600C0[temp_s3[0].unk_0], &spAC, &spDC);
spAC.x = limbTransformations[0].x;
spAC.y = limbTransformations[0].y;
spAC.z = limbTransformations[0].z;
SkinMatrix_Vec3fMtxFMultXYZ(&gSkinLimbMatrices[limbTransformations[0].limbIndex], &spAC, &vtxPoint);
} else if (arg3 == 1) {
Vec3f spA0;
phi_s0 = &temp_s3[phi_s6->unk_4];
transformationEntry = &limbTransformations[modif->unk_4];
spA0.x = phi_s0->x;
spA0.y = phi_s0->y;
spA0.z = phi_s0->z;
SkinMatrix_Vec3fMtxFMultXYZ(&D_801600C0[phi_s0->unk_0], &spA0, &spDC);
spA0.x = transformationEntry->x;
spA0.y = transformationEntry->y;
spA0.z = transformationEntry->z;
SkinMatrix_Vec3fMtxFMultXYZ(&gSkinLimbMatrices[transformationEntry->limbIndex], &spA0, &vtxPoint);
} else {
Vec3f phi_f20;
Vec3f sp88;
phi_f20.x = phi_f20.y = phi_f20.z = 0.0f;
for (phi_s0 = &temp_s3[0]; phi_s0 < &temp_s3[temp_a0_2]; phi_s0++) {
temp_f20 = phi_s0->unk_8 * 0.01f;
for (transformationEntry = &limbTransformations[0];
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);
spD0.x *= scale;
spD0.y *= scale;
spD0.z *= scale;
sp88.x = phi_s0->x;
sp88.y = phi_s0->y;
sp88.z = phi_s0->z;
SkinMatrix_Vec3fMtxFMultXYZ(&D_801600C0[phi_s0->unk_0], &sp88, &spD0);
spD0.x *= temp_f20;
spD0.y *= temp_f20;
spD0.z *= temp_f20;
phi_f20.x += spD0.x;
phi_f20.y += spD0.y;
phi_f20.z += spD0.z;
}
spDC.x = phi_f20.x;
spDC.y = phi_f20.y;
spDC.z = phi_f20.z;
}
func_800A57C0(&D_801600C0[temp_s3[phi_s6->unk_4].unk_0], temp_v0, phi_s6, spEC, &spDC);
}
gSPSegment(POLY_OPA_DISP++, 0x08, avb->buf[avb->unk_0]);
avb->unk_0 = (avb->unk_0 == 0) ? 1 : 0;
vtxPoint.x = phi_f20.x;
vtxPoint.y = phi_f20.y;
vtxPoint.z = phi_f20.z;
}
Skin_UpdateVertices(&gSkinLimbMatrices[limbTransformations[modif->unk_4].limbIndex], skinVertices, modif,
vtxBuf, &vtxPoint);
}
gSPSegment(POLY_OPA_DISP++, 0x08, vtxEntry->buf[vtxEntry->index]);
vtxEntry->index = (vtxEntry->index == 0) ? 1 : 0;
CLOSE_DISPS(gfxCtx, "../z_skin.c", 344);
}
void func_800A5E28(GraphicsContext* gfxCtx, PSkinAwb* skin, s32 limbIndex, s32 arg3, s32 arg4) {
/**
* 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;
Struct_800A5E28* temp_t9;
SkinAnimatedLimbData* data;
OPEN_DISPS(gfxCtx, "../z_skin.c", 364);
skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
temp_t9 = SEGMENTED_TO_VIRTUAL(((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]))->segment);
if (!(arg4 & 1)) {
func_800A598C(gfxCtx, skin, limbIndex, arg3);
data = SEGMENTED_TO_VIRTUAL(((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]))->segment);
if (!(drawFlags & SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS)) {
Skin_ApplyLimbModifications(gfxCtx, skin, limbIndex, arg3);
}
gSPDisplayList(POLY_OPA_DISP++, temp_t9->unk_8);
gSPDisplayList(POLY_OPA_DISP++, data->dlist);
CLOSE_DISPS(gfxCtx, "../z_skin.c", 377);
}
void func_800A5F60(GraphicsContext* gfxCtx, PSkinAwb* skin, s32 limbIndex, Gfx* arg3, s32 arg4) {
Gfx* gfx = arg3;
/**
* 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;
s32 pad;
OPEN_DISPS(gfxCtx, "../z_skin.c", 395);
skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
if (arg3 == NULL) {
if (dlistOverride == NULL) {
gfx = ((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]))->segment;
}
if (gfx != NULL) {
Mtx* mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &D_801600C0[limbIndex]);
Mtx* mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &gSkinLimbMatrices[limbIndex]);
if (mtx != NULL) {
gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
@ -152,74 +181,89 @@ void func_800A5F60(GraphicsContext* gfxCtx, PSkinAwb* skin, s32 limbIndex, Gfx*
gDPPipeSync(POLY_OPA_DISP++);
}
}
CLOSE_DISPS(gfxCtx, "../z_skin.c", 433);
}
void func_800A60D8(Actor* actor, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, SkinCallback2 arg4,
s32 arg5, s32 arg6, s32 arg7) {
void Skin_DrawImpl(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw,
SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags) {
s32 i;
s32 dataType;
s32 segmentType;
SkinLimb** skeleton;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
s32 pad;
OPEN_DISPS(gfxCtx, "../z_skin.c", 471);
if ((arg7 & 1) == 0) {
func_800A6AC4(skin, &D_801600C0[0], actor, arg5);
if (!(drawFlags & SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS)) {
Skin_ApplyAnimTransformations(skin, gSkinLimbMatrices, actor, setTranslation);
}
skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
if ((arg7 & 2) == 0) {
if (!(drawFlags & SKIN_DRAW_FLAG_CUSTOM_MATRIX)) {
Mtx* mtx;
gSPMatrix(POLY_OPA_DISP++, &gMtxClear, 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 phi_a0 = 1;
if (arg4 != NULL) {
phi_a0 = arg4(actor, globalCtx, i, skin);
for (i = 0; i < skin->skeletonHeader->limbCount; i++) {
s32 shouldDraw = true;
if (overrideLimbDraw != NULL) {
shouldDraw = overrideLimbDraw(actor, globalCtx, i, skin);
}
dataType = ((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[i]))->unk_8;
if (dataType == 4 && phi_a0 == 1) {
func_800A5E28(gfxCtx, skin, i, arg6, arg7);
} else if (dataType == 0xB && phi_a0 == 1) {
func_800A5F60(gfxCtx, skin, i, NULL, arg7);
segmentType = ((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[i]))->segmentType;
if (segmentType == SKIN_LIMB_TYPE_ANIMATED && shouldDraw == true) {
Skin_DrawAnimatedLimb(gfxCtx, skin, i, arg6, drawFlags);
} else if (segmentType == SKIN_LIMB_TYPE_NORMAL && shouldDraw == true) {
Skin_DrawLimb(gfxCtx, skin, i, NULL, drawFlags);
}
}
if (callback != NULL) {
callback(actor, globalCtx, skin);
if (postDraw != NULL) {
postDraw(actor, globalCtx, skin);
}
close_disps:
CLOSE_DISPS(gfxCtx, "../z_skin.c", 534);
}
void func_800A6330(Actor* this, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, s32 arg4) {
func_800A60D8(this, globalCtx, skin, callback, NULL, arg4, 0, 0);
// allows specifying PostLimbDraw and setTranslation
void func_800A6330(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw, s32 setTranslation) {
Skin_DrawImpl(actor, globalCtx, skin, postDraw, NULL, setTranslation, false, 0);
}
void func_800A6360(Actor* this, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, SkinCallback2 arg4,
s32 arg5) {
func_800A60D8(this, globalCtx, skin, callback, arg4, arg5, 0, 0);
// allows specifying OverrideLimbDraw, PostLimbDraw and setTranslation
void func_800A6360(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw,
SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation) {
Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, false, 0);
}
void func_800A6394(Actor* this, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, SkinCallback2 arg4,
s32 arg5, s32 arg6) {
func_800A60D8(this, globalCtx, skin, callback, arg4, arg5, arg6, 0);
// allows specifying OverrideLimbDraw, PostLimbDraw, setTranslation, and arg6
void func_800A6394(Actor* actor, GlobalContext* globalCtx, Skin* skin, SkinPostDraw postDraw,
SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6) {
Skin_DrawImpl(actor, globalCtx, skin, postDraw, overrideLimbDraw, setTranslation, arg6, 0);
}
void func_800A63CC(Actor* this, GlobalContext* globalCtx, PSkinAwb* skin, SkinCallback callback, SkinCallback2 arg4,
s32 arg5, s32 arg6, s32 arg7) {
func_800A60D8(this, globalCtx, skin, callback, arg4, arg5, arg6, arg7);
// allows specifying all variables
void func_800A63CC(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 func_800A6408(PSkinAwb* skin, s32 joint, Vec3f* arg2, Vec3f* arg3) {
MtxF sp18;
void Skin_GetLimbPos(Skin* skin, s32 limbIndex, Vec3f* offset, Vec3f* dst) {
MtxF mtxf;
SkinMatrix_MtxFMtxFMult(&skin->mtx, &D_801600C0[joint], &sp18);
SkinMatrix_Vec3fMtxFMultXYZ(&sp18, arg2, arg3);
SkinMatrix_MtxFMtxFMult(&skin->mtx, &gSkinLimbMatrices[limbIndex], &mtxf);
SkinMatrix_Vec3fMtxFMultXYZ(&mtxf, offset, dst);
}

View file

@ -1,131 +1,155 @@
#include "global.h"
#include "overlays/actors/ovl_En_fHG/z_en_fhg.h"
void func_800A6460(GlobalContext* globalCtx, PSkinAwb* skin, s32 limbIndex) {
/**
* Initialises the Vtx buffers used for limb at index `limbIndex`
*/
void Skin_InitAnimatedLimb(GlobalContext* globalCtx, Skin* skin, s32 limbIndex) {
s32 i;
SkinLimb** skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
Struct_800A5E28* temp_v1 = SEGMENTED_TO_VIRTUAL(((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]))->segment);
Struct_800A598C* temp_v0 = SEGMENTED_TO_VIRTUAL(temp_v1->unk_4);
Struct_800A598C* phi_s0;
Struct_800A57C0* temp_s1;
SkinAnimatedLimbData* animatedLimbData =
SEGMENTED_TO_VIRTUAL(((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]))->segment);
SkinLimbModif* limbModifications = SEGMENTED_TO_VIRTUAL(animatedLimbData->limbModifications);
SkinLimbModif* modifEntry;
SkinVertex* skinVtxEntry;
for (i = 0; i < 2; i++) {
Vtx* temp2 = skin->avbTbl[limbIndex].buf[i];
for (i = 0; i < ARRAY_COUNT(skin->vtxTable->buf); i++) {
Vtx* vtxBuf = skin->vtxTable[limbIndex].buf[i];
for (phi_s0 = temp_v0; phi_s0 < temp_v0 + temp_v1->unk_2; phi_s0++) {
Struct_800A57C0* phi_s1 = SEGMENTED_TO_VIRTUAL(phi_s0->unk_8);
for (modifEntry = limbModifications; modifEntry < limbModifications + animatedLimbData->limbModifCount;
modifEntry++) {
SkinVertex* skinVertices = SEGMENTED_TO_VIRTUAL(modifEntry->skinVertices);
for (temp_s1 = phi_s1; temp_s1 < phi_s1 + phi_s0->unk_0; temp_s1++) {
Vtx* temp_t5_3 = &temp2[temp_s1->unk_0];
for (skinVtxEntry = skinVertices; skinVtxEntry < &skinVertices[modifEntry->vtxCount]; skinVtxEntry++) {
Vtx* vtx = &vtxBuf[skinVtxEntry->index];
temp_t5_3->v.flag = 0;
temp_t5_3->v.tc[0] = temp_s1->unk_2;
temp_t5_3->v.tc[1] = temp_s1->unk_4;
temp_t5_3->v.cn[3] = temp_s1->unk_9;
vtx->n.flag = 0;
vtx->n.tc[0] = skinVtxEntry->s;
vtx->n.tc[1] = skinVtxEntry->t;
vtx->n.a = skinVtxEntry->alpha;
}
}
}
}
void func_800A663C(GlobalContext* globalCtx, PSkinAwb* skin, SkeletonHeader* skeletonHeader,
AnimationHeader* animationHeader) {
/**
* Initializes a skin skeleton to looping animation, dynamically allocating the frame tables,
* and dynamically allocating and initializing the Vtx and SkinLimbVtx buffers for its animated limbs
*/
void Skin_Init(GlobalContext* globalCtx, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader) {
s32 limbCount;
s32 i;
SkinLimb** skeleton;
SkeletonHeader* virtSkelHeader = SEGMENTED_TO_VIRTUAL(skeletonHeader);
skin->avbCount = virtSkelHeader->limbCount;
skin->limbCount = virtSkelHeader->limbCount;
skin->skeletonHeader = virtSkelHeader;
skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
limbCount = skin->skeletonHeader->limbCount;
skin->avbTbl = ZeldaArena_MallocDebug(limbCount * sizeof(SkinAvb), "../z_skin_awb.c", 212);
ASSERT(skin->avbTbl != NULL, "pskin_awb->avb_tbl != NULL", "../z_skin_awb.c", 214);
skin->vtxTable = ZeldaArena_MallocDebug(limbCount * sizeof(SkinLimbVtx), "../z_skin_awb.c", 212);
ASSERT(skin->vtxTable != NULL, "pskin_awb->avb_tbl != NULL", "../z_skin_awb.c", 214);
for (i = 0; i < limbCount; i++) {
SkinAvb* avbEntry = &skin->avbTbl[i];
SkinLimbVtx* vtxEntry = &skin->vtxTable[i];
SkinLimb* limb = SEGMENTED_TO_VIRTUAL(skeleton[i]);
if ((limb->unk_8 != 4) || (limb->segment == NULL)) {
avbEntry->unk_0 = 0;
if ((limb->segmentType != SKIN_LIMB_TYPE_ANIMATED) || (limb->segment == NULL)) {
vtxEntry->index = 0;
avbEntry->buf[0] = NULL;
avbEntry->buf[1] = NULL;
vtxEntry->buf[0] = NULL;
vtxEntry->buf[1] = NULL;
} else {
Struct_800A5E28* temp_s1 = SEGMENTED_TO_VIRTUAL(((void)0, limb->segment));
SkinAnimatedLimbData* animatedLimbData = SEGMENTED_TO_VIRTUAL(((void)0, limb->segment));
avbEntry->unk_0 = 0;
avbEntry->buf[0] = ZeldaArena_MallocDebug(temp_s1->unk_0 * sizeof(Vtx), "../z_skin_awb.c", 235);
ASSERT(avbEntry->buf[0] != NULL, "psavb->buf[0] != NULL", "../z_skin_awb.c", 237);
avbEntry->buf[1] = ZeldaArena_MallocDebug(temp_s1->unk_0 * sizeof(Vtx), "../z_skin_awb.c", 240);
ASSERT(avbEntry->buf[1] != NULL, "psavb->buf[1] != NULL", "../z_skin_awb.c", 242);
func_800A6460(globalCtx, skin, i);
vtxEntry->index = 0;
vtxEntry->buf[0] =
ZeldaArena_MallocDebug(animatedLimbData->totalVtxCount * sizeof(Vtx), "../z_skin_awb.c", 235);
ASSERT(vtxEntry->buf[0] != NULL, "psavb->buf[0] != NULL", "../z_skin_awb.c", 237);
vtxEntry->buf[1] =
ZeldaArena_MallocDebug(animatedLimbData->totalVtxCount * sizeof(Vtx), "../z_skin_awb.c", 240);
ASSERT(vtxEntry->buf[1] != NULL, "psavb->buf[1] != NULL", "../z_skin_awb.c", 242);
Skin_InitAnimatedLimb(globalCtx, skin, i);
}
if (1) {}
}
SkelAnime_InitSkin(globalCtx, &skin->skelAnime, skeletonHeader, animationHeader);
}
void func_800A6888(GlobalContext* globalCtx, PSkinAwb* arg1) {
if (arg1->avbTbl != NULL) {
/**
* Frees the dynamically allocated Vtx and SkinLimbVtx buffers and tables
*/
void Skin_Free(GlobalContext* globalCtx, Skin* skin) {
if (skin->vtxTable != NULL) {
s32 i;
for (i = 0; i < arg1->avbCount; i++) {
if (arg1->avbTbl[i].buf[0] != 0) {
ZeldaArena_FreeDebug(arg1->avbTbl[i].buf[0], "../z_skin_awb.c", 276);
arg1->avbTbl[i].buf[0] = 0;
for (i = 0; i < skin->limbCount; i++) {
if (skin->vtxTable[i].buf[0] != NULL) {
ZeldaArena_FreeDebug(skin->vtxTable[i].buf[0], "../z_skin_awb.c", 276);
skin->vtxTable[i].buf[0] = NULL;
}
if (arg1->avbTbl[i].buf[1] != 0) {
ZeldaArena_FreeDebug(arg1->avbTbl[i].buf[1], "../z_skin_awb.c", 280);
arg1->avbTbl[i].buf[1] = 0;
}
}
if (arg1->avbTbl != NULL) {
ZeldaArena_FreeDebug(arg1->avbTbl, "../z_skin_awb.c", 286);
}
SkelAnime_Free(&arg1->skelAnime, globalCtx);
if (skin->vtxTable[i].buf[1] != NULL) {
ZeldaArena_FreeDebug(skin->vtxTable[i].buf[1], "../z_skin_awb.c", 280);
skin->vtxTable[i].buf[1] = NULL;
}
}
s32 func_800A698C(PSkinAwb* skin, SkinLimb** skeleton, MtxF* mf, u8 parentIndex, u8 limbIndex) {
if (skin->vtxTable != NULL) {
ZeldaArena_FreeDebug(skin->vtxTable, "../z_skin_awb.c", 286);
}
SkelAnime_Free(&skin->skelAnime, globalCtx);
}
}
s32 func_800A698C(Skin* skin, SkinLimb** skeleton, MtxF* limbMatrices, u8 parentIndex, u8 limbIndex) {
s32 pad;
SkinLimb* limb = SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]);
MtxF* mtx;
s32 temp_ret;
s32 ret;
MtxF sp28;
if (parentIndex == 0xFF) {
if (parentIndex == LIMB_DONE) {
SkinMatrix_GetClear(&mtx);
} else {
mtx = &mf[(s32)parentIndex];
mtx = &limbMatrices[(s32)parentIndex];
}
SkinMatrix_MtxFMtxFMult(mtx, &mf[limbIndex], &sp28);
SkinMatrix_MtxFCopy(&sp28, &mf[limbIndex]);
SkinMatrix_MtxFMtxFMult(mtx, &limbMatrices[limbIndex], &sp28);
SkinMatrix_MtxFCopy(&sp28, &limbMatrices[limbIndex]);
if (limb->child != 0xFF) {
temp_ret = func_800A698C(skin, skeleton, mf, limbIndex, limb->child);
if (temp_ret) { // func_800A698C only returns false
return temp_ret;
if (limb->child != LIMB_DONE) {
ret = func_800A698C(skin, skeleton, limbMatrices, limbIndex, limb->child);
if (ret) {
return ret;
}
}
if (limb->sibling != 0xFF) {
temp_ret = func_800A698C(skin, skeleton, mf, parentIndex, limb->sibling);
if (temp_ret) { // func_800A698C only returns false
return temp_ret;
if (limb->sibling != LIMB_DONE) {
ret = func_800A698C(skin, skeleton, limbMatrices, parentIndex, limb->sibling);
if (ret) {
return ret;
}
}
return false;
}
s32 func_800A6AC4(PSkinAwb* skin, MtxF* arg1, Actor* actor, s32 arg3) {
/**
* 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 temp_ret;
s32 ret;
f32 yTransl;
f32 xTransl;
f32 zTransl;
@ -133,28 +157,33 @@ s32 func_800A6AC4(PSkinAwb* skin, MtxF* arg1, Actor* actor, s32 arg3) {
Vec3s* jointRot = &skin->skelAnime.jointTable[0];
jointRot++;
xRot = jointRot[0].x;
yRot = jointRot[0].y;
zRot = jointRot[0].z;
if (arg3 != 0) {
xRot = jointRot->x;
yRot = jointRot->y;
zRot = jointRot->z;
if (setTranslation) {
jointRot--; // access joint table entry 0 for translation data
xTransl = jointRot->x;
yTransl = jointRot->y;
zTransl = jointRot->z;
jointRot--;
xTransl = jointRot[0].x;
yTransl = jointRot[0].y;
zTransl = jointRot[0].z;
jointRot++;
if (arg3 == 0x23) {
if (setTranslation == SKIN_TRANSFORM_IS_FHG) {
EnfHG* horse = (EnfHG*)actor;
yRot += horse->turnRot;
}
SkinMatrix_SetTranslateRotateZYX(arg1, xRot, yRot, zRot, xTransl, yTransl, zTransl);
SkinMatrix_SetTranslateRotateZYX(&limbMatrices[0], xRot, yRot, zRot, xTransl, yTransl, zTransl);
} else {
SkinMatrix_SetTranslateRotateZYX(arg1, xRot, yRot, zRot, 0.0f, 0.0f, 0.0f);
SkinMatrix_SetTranslateRotateZYX(&limbMatrices[0], xRot, yRot, zRot, 0.0f, 0.0f, 0.0f);
}
jointRot++;
for (i = 1; i < skin->skeletonHeader->limbCount; i++) {
SkinLimb* limb = SEGMENTED_TO_VIRTUAL(skeleton[i]);
@ -165,7 +194,7 @@ s32 func_800A6AC4(PSkinAwb* skin, MtxF* arg1, Actor* actor, s32 arg3) {
yRot = jointRot->y;
zRot = jointRot->z;
jointRot++;
SkinMatrix_SetTranslateRotateZYX(&arg1[i], xRot, yRot, zRot, xTransl, yTransl, zTransl);
SkinMatrix_SetTranslateRotateZYX(&limbMatrices[i], xRot, yRot, zRot, xTransl, yTransl, zTransl);
}
SkinMatrix_SetTranslateRotateYXZScale(
@ -173,9 +202,10 @@ s32 func_800A6AC4(PSkinAwb* skin, MtxF* arg1, Actor* actor, s32 arg3) {
actor->shape.rot.z, actor->world.pos.x, actor->world.pos.y + (actor->shape.yOffset * actor->scale.y),
actor->world.pos.z);
temp_ret = func_800A698C(skin, SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment), arg1, 0xFF, 0);
if (!temp_ret) { // func_800A698C only returns false
return temp_ret;
ret = func_800A698C(skin, SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment), limbMatrices, LIMB_DONE, 0);
if (!ret) {
return ret;
}
return 0;
return false;
}

View file

@ -851,8 +851,7 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) {
this->stateFlags |= ENHORSE_UNRIDEABLE;
}
func_800A663C(globalCtx, &this->skin, sSkeletonHeaders[this->type],
sAnimationHeaders[this->type][ENHORSE_ANIM_IDLE]);
Skin_Init(globalCtx, &this->skin, sSkeletonHeaders[this->type], sAnimationHeaders[this->type][ENHORSE_ANIM_IDLE]);
this->animationIdx = ENHORSE_ANIM_IDLE;
Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx]);
this->numBoosts = 6;
@ -901,7 +900,7 @@ void EnHorse_Destroy(Actor* thisx, GlobalContext* globalCtx) {
if (this->stateFlags & ENHORSE_DRAW) {
Audio_StopSfxByPos(&this->unk_21C);
}
func_800A6888(globalCtx, &this->skin);
Skin_Free(globalCtx, &this->skin);
Collider_DestroyCylinder(globalCtx, &this->cyl1);
Collider_DestroyCylinder(globalCtx, &this->cyl2);
Collider_DestroyJntSph(globalCtx, &this->jntSph);
@ -3651,7 +3650,7 @@ void EnHorse_RandomOffset(Vec3f* src, f32 dist, Vec3f* dst) {
dst->z = (Rand_ZeroOne() * (dist * 2.0f) + src->z) - dist;
}
void EnHorse_SkinCallback1(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* skin) {
void EnHorse_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) {
EnHorse* this = (EnHorse*)thisx;
s32 pad;
Vec3f sp94 = { 0.0f, 0.0f, 0.0f };
@ -3669,7 +3668,7 @@ void EnHorse_SkinCallback1(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* ski
f32 sp28;
if (!(this->stateFlags & ENHORSE_CALC_RIDER_POS)) {
func_800A6408(skin, 30, &riderOffset, &this->riderPos);
Skin_GetLimbPos(skin, 30, &riderOffset, &this->riderPos);
this->riderPos.x = this->riderPos.x - this->actor.world.pos.x;
this->riderPos.y = this->riderPos.y - this->actor.world.pos.y;
this->riderPos.z = this->riderPos.z - this->actor.world.pos.z;
@ -3677,14 +3676,14 @@ void EnHorse_SkinCallback1(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* ski
this->stateFlags &= ~ENHORSE_CALC_RIDER_POS;
}
func_800A6408(skin, 13, &sp94, &sp2C);
Skin_GetLimbPos(skin, 13, &sp94, &sp2C);
SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->viewProjectionMtxF, &sp2C, &this->unk_228, &sp28);
if ((this->animationIdx == ENHORSE_ANIM_IDLE && this->action != ENHORSE_ACT_FROZEN) &&
((frame > 40.0f && frame < 45.0f && this->type == HORSE_EPONA) ||
(frame > 28.0f && frame < 33.0f && this->type == HORSE_HNI))) {
if (Rand_ZeroOne() < 0.6f) {
this->dustFlags |= 1;
func_800A6408(skin, 28, &hoofOffset, &this->frontRightHoof);
Skin_GetLimbPos(skin, 28, &hoofOffset, &this->frontRightHoof);
this->frontRightHoof.y = this->frontRightHoof.y - 5.0f;
}
} else {
@ -3692,12 +3691,12 @@ void EnHorse_SkinCallback1(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* ski
if ((frame > 10.0f && frame < 13.0f) || (frame > 25.0f && frame < 33.0f)) {
if (Rand_ZeroOne() < 0.7f) {
this->dustFlags |= 2;
func_800A6408(skin, 20, &hoofOffset, &sp70);
Skin_GetLimbPos(skin, 20, &hoofOffset, &sp70);
EnHorse_RandomOffset(&sp70, 10.0f, &this->frontLeftHoof);
}
if (Rand_ZeroOne() < 0.7f) {
this->dustFlags |= 1;
func_800A6408(skin, 28, &hoofOffset, &sp70);
Skin_GetLimbPos(skin, 28, &hoofOffset, &sp70);
EnHorse_RandomOffset(&sp70, 10.0f, &this->frontRightHoof);
}
}
@ -3705,7 +3704,7 @@ void EnHorse_SkinCallback1(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* ski
if ((frame > 6.0f && frame < 10.0f) || (frame > 23.0f && frame < 29.0f)) {
if (Rand_ZeroOne() < 0.7f) {
this->dustFlags |= 8;
func_800A6408(skin, 37, &hoofOffset, &sp70);
Skin_GetLimbPos(skin, 37, &hoofOffset, &sp70);
EnHorse_RandomOffset(&sp70, 10.0f, &this->backLeftHoof);
}
}
@ -3713,60 +3712,60 @@ void EnHorse_SkinCallback1(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* ski
if ((frame > 7.0f && frame < 14.0f) || (frame > 26.0f && frame < 30.0f)) {
if (Rand_ZeroOne() < 0.7f) {
this->dustFlags |= 4;
func_800A6408(skin, 45, &hoofOffset, &sp70);
Skin_GetLimbPos(skin, 45, &hoofOffset, &sp70);
EnHorse_RandomOffset(&sp70, 10.0f, &this->backRightHoof);
}
}
} else if (this->animationIdx == ENHORSE_ANIM_GALLOP) {
if ((frame > 14.0f) && (frame < 16.0f)) {
this->dustFlags |= 1;
func_800A6408(skin, 28, &hoofOffset, &sp70);
Skin_GetLimbPos(skin, 28, &hoofOffset, &sp70);
EnHorse_RandomOffset(&sp70, 5.0f, &this->frontRightHoof);
} else if (frame > 8.0f && frame < 10.0f) {
this->dustFlags |= 2;
func_800A6408(skin, 20, &hoofOffset, &sp70);
Skin_GetLimbPos(skin, 20, &hoofOffset, &sp70);
EnHorse_RandomOffset(&sp70, 10.0f, &this->frontLeftHoof);
} else if (frame > 1.0f && frame < 3.0f) {
this->dustFlags |= 4;
func_800A6408(skin, 45, &hoofOffset, &sp70);
Skin_GetLimbPos(skin, 45, &hoofOffset, &sp70);
EnHorse_RandomOffset(&sp70, 10.0f, &this->backRightHoof);
} else if ((frame > 26.0f) && (frame < 28.0f)) {
this->dustFlags |= 8;
func_800A6408(skin, 37, &hoofOffset, &sp70);
Skin_GetLimbPos(skin, 37, &hoofOffset, &sp70);
EnHorse_RandomOffset(&sp70, 10.0f, &this->backLeftHoof);
}
} else if (this->action == ENHORSE_ACT_LOW_JUMP && frame > 6.0f &&
Rand_ZeroOne() < 1.0f - (frame - 6.0f) * (1.0f / 17.0f)) {
if (Rand_ZeroOne() < 0.5f) {
this->dustFlags |= 8;
func_800A6408(skin, 37, &hoofOffset, &sp70);
Skin_GetLimbPos(skin, 37, &hoofOffset, &sp70);
EnHorse_RandomOffset(&sp70, 10.0f, &this->backLeftHoof);
}
if (Rand_ZeroOne() < 0.5f) {
this->dustFlags |= 4;
func_800A6408(skin, 45, &hoofOffset, &sp70);
Skin_GetLimbPos(skin, 45, &hoofOffset, &sp70);
EnHorse_RandomOffset(&sp70, 10.0f, &this->backRightHoof);
}
} else if (this->action == ENHORSE_ACT_HIGH_JUMP && frame > 5.0f &&
Rand_ZeroOne() < 1.0f - (frame - 5.0f) * (1.0f / 25.0f)) {
if (Rand_ZeroOne() < 0.5f) {
this->dustFlags |= 8;
func_800A6408(skin, 37, &hoofOffset, &sp70);
Skin_GetLimbPos(skin, 37, &hoofOffset, &sp70);
EnHorse_RandomOffset(&sp70, 10.0f, &this->backLeftHoof);
}
if (Rand_ZeroOne() < 0.5f) {
this->dustFlags |= 4;
func_800A6408(skin, 45, &hoofOffset, &sp70);
Skin_GetLimbPos(skin, 45, &hoofOffset, &sp70);
EnHorse_RandomOffset(&sp70, 10.0f, &this->backRightHoof);
}
} else if (this->action == ENHORSE_ACT_BRIDGE_JUMP && Rand_ZeroOne() < 0.5f) {
if (Rand_ZeroOne() < 0.5f) {
this->dustFlags |= 8;
func_800A6408(skin, 37, &hoofOffset, &sp70);
Skin_GetLimbPos(skin, 37, &hoofOffset, &sp70);
EnHorse_RandomOffset(&sp70, 10.0f, &this->backLeftHoof);
} else {
this->dustFlags |= 4;
func_800A6408(skin, 45, &hoofOffset, &sp70);
Skin_GetLimbPos(skin, 45, &hoofOffset, &sp70);
EnHorse_RandomOffset(&sp70, 10.0f, &this->backRightHoof);
}
}
@ -3777,7 +3776,7 @@ void EnHorse_SkinCallback1(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* ski
center.y = this->jntSph.elements[i].dim.modelSphere.center.y;
center.z = this->jntSph.elements[i].dim.modelSphere.center.z;
func_800A6408(skin, this->jntSph.elements[i].dim.limb, &center, &newCenter);
Skin_GetLimbPos(skin, this->jntSph.elements[i].dim.limb, &center, &newCenter);
this->jntSph.elements[i].dim.worldSphere.center.x = newCenter.x;
this->jntSph.elements[i].dim.worldSphere.center.y = newCenter.y;
this->jntSph.elements[i].dim.worldSphere.center.z = newCenter.z;
@ -3797,7 +3796,7 @@ void EnHorse_SkinCallback1(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* ski
// unused
static s32 D_80A667DC[] = { 0, 3, 7, 14 };
s32 EnHorse_SkinCallback2(Actor* thisx, GlobalContext* globalCtx, s32 limbIndex, PSkinAwb* arg3) {
s32 EnHorse_OverrideLimbDraw(Actor* thisx, GlobalContext* globalCtx, s32 limbIndex, Skin* arg3) {
static void* eyeTextures[] = {
gEponaEyeOpenTex,
gEponaEyeHalfTex,
@ -3813,7 +3812,7 @@ s32 EnHorse_SkinCallback2(Actor* thisx, GlobalContext* globalCtx, s32 limbIndex,
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[index]));
} else if (this->type == HORSE_HNI && this->stateFlags & ENHORSE_FLAG_18 && limbIndex == 30) {
func_800A5F60(globalCtx->state.gfxCtx, &this->skin, limbIndex, gHorseIngoGerudoSaddleDL, 0);
Skin_DrawLimb(globalCtx->state.gfxCtx, &this->skin, limbIndex, gHorseIngoGerudoSaddleDL, 0);
drawOriginalLimb = false;
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_horse.c", 8601);
@ -3827,9 +3826,9 @@ void EnHorse_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_80093D18(globalCtx->state.gfxCtx);
this->stateFlags |= ENHORSE_DRAW;
if (this->stateFlags & ENHORSE_JUMPING) {
func_800A6360(thisx, globalCtx, &this->skin, EnHorse_SkinCallback1, EnHorse_SkinCallback2, 0);
func_800A6360(thisx, globalCtx, &this->skin, EnHorse_PostDraw, EnHorse_OverrideLimbDraw, false);
} else {
func_800A6360(thisx, globalCtx, &this->skin, EnHorse_SkinCallback1, EnHorse_SkinCallback2, 1);
func_800A6360(thisx, globalCtx, &this->skin, EnHorse_PostDraw, EnHorse_OverrideLimbDraw, true);
}
if (this->postDrawFunc != NULL) {
this->postDrawFunc(this, globalCtx);

View file

@ -98,7 +98,7 @@ typedef struct EnHorse {
/* 0x0154 */ s32 noInputTimerMax;
/* 0x0158 */ s32 type;
/* 0x015C */ s8 bankIndex;
/* 0x0160 */ PSkinAwb skin;
/* 0x0160 */ Skin skin;
/* 0x01F0 */ u32 stateFlags;
/* 0x01F4 */ Vec3f lastPos;
/* 0x0200 */ s16 lastYaw;

View file

@ -177,7 +177,7 @@ void EnHorseGanon_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.focus.pos = this->actor.world.pos;
this->action = 0;
this->actor.focus.pos.y += 70.0f;
func_800A663C(globalCtx, &this->skin, &gHorseGanonSkel, &gHorseGanonIdleAnim);
Skin_Init(globalCtx, &this->skin, &gHorseGanonSkel, &gHorseGanonIdleAnim);
this->currentAnimation = 0;
Animation_PlayOnce(&this->skin.skelAnime, sAnimations[0]);
@ -193,7 +193,7 @@ void EnHorseGanon_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnHorseGanon_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnHorseGanon* this = (EnHorseGanon*)thisx;
func_800A6888(globalCtx, &this->skin);
Skin_Free(globalCtx, &this->skin);
Collider_DestroyCylinder(globalCtx, &this->colliderBody);
Collider_DestroyJntSph(globalCtx, &this->colliderHead);
}
@ -296,7 +296,7 @@ void EnHorseGanon_Update(Actor* thisx, GlobalContext* globalCtx) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderBody.base);
}
void func_80A68FA8(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* skin) {
void EnHorseGanon_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) {
Vec3f sp4C;
Vec3f sp40;
EnHorseGanon* this = (EnHorseGanon*)thisx;
@ -307,7 +307,7 @@ void func_80A68FA8(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* skin) {
sp4C.y = this->colliderHead.elements[index].dim.modelSphere.center.y;
sp4C.z = this->colliderHead.elements[index].dim.modelSphere.center.z;
func_800A6408(skin, this->colliderHead.elements[index].dim.limb, &sp4C, &sp40);
Skin_GetLimbPos(skin, this->colliderHead.elements[index].dim.limb, &sp4C, &sp40);
this->colliderHead.elements[index].dim.worldSphere.center.x = sp40.x;
this->colliderHead.elements[index].dim.worldSphere.center.y = sp40.y;
@ -326,5 +326,5 @@ void EnHorseGanon_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_80A68E14(this, globalCtx);
func_80093D18(globalCtx->state.gfxCtx);
func_800A6330(&this->actor, globalCtx, &this->skin, func_80A68FA8, 1);
func_800A6330(&this->actor, globalCtx, &this->skin, EnHorseGanon_PostDraw, true);
}

View file

@ -12,7 +12,7 @@ typedef struct EnHorseGanon {
/* 0x0000 */ Actor actor;
/* 0x014C */ s32 action;
/* 0x0150 */ s32 currentAnimation;
/* 0x0154 */ PSkinAwb skin;
/* 0x0154 */ Skin skin;
/* 0x01E4 */ u8 unk_1E4[0x04];
/* 0x01E8 */ s32 soundCount;
/* 0x01EC */ s32 unk_1EC;

View file

@ -151,7 +151,7 @@ void EnHorseLinkChild_Init(Actor* thisx, GlobalContext* globalCtx) {
this->action = 1;
this->actor.focus.pos = this->actor.world.pos;
this->actor.focus.pos.y += 70.0f;
func_800A663C(globalCtx, &this->skin, &gChildEponaSkel, &gChildEponaGallopingAnim);
Skin_Init(globalCtx, &this->skin, &gChildEponaSkel, &gChildEponaGallopingAnim);
this->animationIdx = 0;
Animation_PlayOnce(&this->skin.skelAnime, sAnimations[0]);
Collider_InitCylinder(globalCtx, &this->bodyCollider);
@ -181,7 +181,7 @@ void EnHorseLinkChild_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnHorseLinkChild_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnHorseLinkChild* this = (EnHorseLinkChild*)thisx;
func_800A6888(globalCtx, &this->skin);
Skin_Free(globalCtx, &this->skin);
Collider_DestroyCylinder(globalCtx, &this->bodyCollider);
Collider_DestroyJntSph(globalCtx, &this->headCollider);
}
@ -578,7 +578,7 @@ void EnHorseLinkChild_Update(Actor* thisx, GlobalContext* globalCtx) {
func_80A6948C(this);
}
void func_80A6ABF8(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* skin) {
void EnHorseLinkChild_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) {
Vec3f center;
Vec3f newCenter;
EnHorseLinkChild* this = (EnHorseLinkChild*)thisx;
@ -588,7 +588,7 @@ void func_80A6ABF8(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* skin) {
center.x = this->headCollider.elements[i].dim.modelSphere.center.x;
center.y = this->headCollider.elements[i].dim.modelSphere.center.y;
center.z = this->headCollider.elements[i].dim.modelSphere.center.z;
func_800A6408(skin, this->headCollider.elements[i].dim.limb, &center, &newCenter);
Skin_GetLimbPos(skin, this->headCollider.elements[i].dim.limb, &center, &newCenter);
this->headCollider.elements[i].dim.worldSphere.center.x = newCenter.x;
this->headCollider.elements[i].dim.worldSphere.center.y = newCenter.y;
this->headCollider.elements[i].dim.worldSphere.center.z = newCenter.z;
@ -600,7 +600,7 @@ void func_80A6ABF8(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* skin) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->headCollider.base);
}
s32 func_80A6AD84(Actor* thisx, GlobalContext* globalCtx, s32 arg2, PSkinAwb* arg3) {
s32 EnHorseLinkChild_OverrideLimbDraw(Actor* thisx, GlobalContext* globalCtx, s32 arg2, Skin* skin) {
EnHorseLinkChild* this = (EnHorseLinkChild*)thisx;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_horse_link_child.c", 1467);
@ -620,5 +620,6 @@ void EnHorseLinkChild_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnHorseLinkChild* this = (EnHorseLinkChild*)thisx;
func_80093D18(globalCtx->state.gfxCtx);
func_800A6360(&this->actor, globalCtx, &this->skin, func_80A6ABF8, func_80A6AD84, 1);
func_800A6360(&this->actor, globalCtx, &this->skin, EnHorseLinkChild_PostDraw, EnHorseLinkChild_OverrideLimbDraw,
true);
}

View file

@ -12,7 +12,7 @@ typedef struct EnHorseLinkChild {
/* 0x0000 */ Actor actor;
/* 0x014C */ s32 action;
/* 0x0150 */ s32 animationIdx;
/* 0x0154 */ PSkinAwb skin;
/* 0x0154 */ Skin skin;
/* 0x01E4 */ s32 timer;
/* 0x01E8 */ s32 unk_1E8;
/* 0x01EC */ u8 eyeTexIndex;

View file

@ -226,7 +226,7 @@ void EnHorseNormal_Init(Actor* thisx, GlobalContext* globalCtx) {
return;
}
this->actor.home.rot.z = this->actor.world.rot.z = this->actor.shape.rot.z = 0;
func_800A663C(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim);
Skin_Init(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim);
Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animationIdx]);
if ((this->actor.world.pos.x == -730.0f && this->actor.world.pos.y == 0.0f &&
this->actor.world.pos.z == -1100.0f) ||
@ -240,7 +240,7 @@ void EnHorseNormal_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_Kill(&this->actor);
return;
} else {
func_800A663C(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim);
Skin_Init(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim);
Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animationIdx]);
func_80A6C6B0(this);
return;
@ -248,15 +248,15 @@ void EnHorseNormal_Init(Actor* thisx, GlobalContext* globalCtx) {
} else if (globalCtx->sceneNum == SCENE_SPOT12) {
if (this->actor.world.pos.x == 3707.0f && this->actor.world.pos.y == 1413.0f &&
this->actor.world.pos.z == -665.0f) {
func_800A663C(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim);
Skin_Init(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim);
Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animationIdx]);
func_80A6C4CC(this);
return;
}
func_800A663C(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim);
Skin_Init(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim);
Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animationIdx]);
} else {
func_800A663C(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim);
Skin_Init(globalCtx, &this->skin, &gHorseNormalSkel, &gHorseNormalIdleAnim);
Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animationIdx]);
}
if ((this->actor.params & 0xF0) == 0x10 && (this->actor.params & 0xF) != 0xF) {
@ -269,7 +269,7 @@ void EnHorseNormal_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnHorseNormal_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnHorseNormal* this = (EnHorseNormal*)thisx;
func_800A6888(globalCtx, &this->skin);
Skin_Free(globalCtx, &this->skin);
Collider_DestroyCylinder(globalCtx, &this->bodyCollider);
Collider_DestroyCylinder(globalCtx, &this->cloneCollider);
Collider_DestroyJntSph(globalCtx, &this->headCollider);
@ -587,7 +587,7 @@ void EnHorseNormal_Update(Actor* thisx, GlobalContext* globalCtx) {
}
}
void func_80A6CAFC(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* skin) {
void EnHorseNormal_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) {
Vec3f sp4C;
Vec3f sp40;
EnHorseNormal* this = (EnHorseNormal*)thisx;
@ -597,7 +597,7 @@ void func_80A6CAFC(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* skin) {
sp4C.x = this->headCollider.elements[i].dim.modelSphere.center.x;
sp4C.y = this->headCollider.elements[i].dim.modelSphere.center.y;
sp4C.z = this->headCollider.elements[i].dim.modelSphere.center.z;
func_800A6408(skin, this->headCollider.elements[i].dim.limb, &sp4C, &sp40);
Skin_GetLimbPos(skin, this->headCollider.elements[i].dim.limb, &sp4C, &sp40);
this->headCollider.elements[i].dim.worldSphere.center.x = sp40.x;
this->headCollider.elements[i].dim.worldSphere.center.y = sp40.y;
this->headCollider.elements[i].dim.worldSphere.center.z = sp40.z;
@ -642,7 +642,7 @@ void EnHorseNormal_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_80A6C8E0(this, globalCtx);
}
func_80093D18(globalCtx->state.gfxCtx);
func_800A6330(&this->actor, globalCtx, &this->skin, func_80A6CAFC, 1);
func_800A6330(&this->actor, globalCtx, &this->skin, EnHorseNormal_PostDraw, true);
if (this->action == HORSE_WAIT_CLONE) {
MtxF skinMtx;
@ -692,7 +692,8 @@ void EnHorseNormal_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(POLY_OPA_DISP++, mtx1, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
func_800A63CC(&this->actor, globalCtx, &this->skin, NULL, NULL, 1, 0, 3);
func_800A63CC(&this->actor, globalCtx, &this->skin, NULL, NULL, true, 0,
SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS | SKIN_DRAW_FLAG_CUSTOM_MATRIX);
this->cloneCollider.dim.pos.x = clonePos.x;
this->cloneCollider.dim.pos.y = clonePos.y;
this->cloneCollider.dim.pos.z = clonePos.z;

View file

@ -12,7 +12,7 @@ typedef struct EnHorseNormal {
/* 0x0000 */ Actor actor;
/* 0x014C */ s32 action;
/* 0x0150 */ s32 animationIdx;
/* 0x0154 */ PSkinAwb skin;
/* 0x0154 */ Skin skin;
/* 0x01E4 */ u16 unk_1E4;
/* 0x01E8 */ Vec3f unk_1E8;
/* 0x01F4 */ Vec3f unk_1F4;

View file

@ -157,7 +157,7 @@ void EnHorseZelda_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.focus.pos = this->actor.world.pos;
this->action = 0;
this->actor.focus.pos.y += 70.0f;
func_800A663C(globalCtx, &this->skin, &gHorseZeldaSkel, &gHorseZeldaGallopingAnim);
Skin_Init(globalCtx, &this->skin, &gHorseZeldaSkel, &gHorseZeldaGallopingAnim);
this->animationIndex = 0;
Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[0]);
Collider_InitCylinder(globalCtx, &this->colliderCylinder);
@ -174,7 +174,7 @@ void EnHorseZelda_Destroy(Actor* thisx, GlobalContext* globalCtx) {
Collider_DestroyCylinder(globalCtx, &this->colliderCylinder);
Collider_DestroyJntSph(globalCtx, &this->colliderSphere);
func_800A6888(globalCtx, &this->skin);
Skin_Free(globalCtx, &this->skin);
}
void func_80A6DC7C(EnHorseZelda* this) {
@ -240,7 +240,7 @@ void EnHorseZelda_Update(Actor* thisx, GlobalContext* globalCtx) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base);
}
void func_80A6DFD4(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* skin) {
void EnHorseZelda_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) {
Vec3f sp4C;
Vec3f sp40;
EnHorseZelda* this = (EnHorseZelda*)thisx;
@ -251,7 +251,7 @@ void func_80A6DFD4(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* skin) {
sp4C.y = this->colliderSphere.elements[i].dim.modelSphere.center.y;
sp4C.z = this->colliderSphere.elements[i].dim.modelSphere.center.z;
func_800A6408(skin, this->colliderSphere.elements[i].dim.limb, &sp4C, &sp40);
Skin_GetLimbPos(skin, this->colliderSphere.elements[i].dim.limb, &sp4C, &sp40);
this->colliderSphere.elements[i].dim.worldSphere.center.x = sp40.x;
this->colliderSphere.elements[i].dim.worldSphere.center.y = sp40.y;
@ -270,5 +270,5 @@ void EnHorseZelda_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_80A6DE38(this, globalCtx);
func_80093D18(globalCtx->state.gfxCtx);
func_800A6330(&this->actor, globalCtx, &this->skin, func_80A6DFD4, 1);
func_800A6330(&this->actor, globalCtx, &this->skin, EnHorseZelda_PostDraw, true);
}

View file

@ -12,7 +12,7 @@ typedef struct EnHorseZelda {
/* 0x0000 */ Actor actor;
/* 0x014C */ s32 action;
/* 0x0150 */ s32 animationIndex;
/* 0x0154 */ PSkinAwb skin;
/* 0x0154 */ Skin skin;
/* 0x01E4 */ char unk_1E4[0x8];
/* 0x01EC */ s32 unk_1EC;
/* 0x01F0 */ char unk_1F0[0x4];

View file

@ -108,7 +108,7 @@ void EnViewer_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnViewer_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnViewer* this = (EnViewer*)thisx;
func_800A6888(globalCtx, &this->skin);
Skin_Free(globalCtx, &this->skin);
}
void EnViewer_InitAnimGanondorfOrZelda(EnViewer* this, GlobalContext* globalCtx, void* skeletonHeaderSeg,
@ -140,7 +140,7 @@ void EnViewer_InitAnimImpa(EnViewer* this, GlobalContext* globalCtx, void* skele
void EnViewer_InitAnimHorse(EnViewer* this, GlobalContext* globalCtx, void* skeletonHeaderSeg, AnimationHeader* anim) {
u8 type;
func_800A663C(globalCtx, &this->skin, skeletonHeaderSeg, anim);
Skin_Init(globalCtx, &this->skin, skeletonHeaderSeg, anim);
type = this->actor.params >> 8;
if (!(type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_4_HORSE_GANONDORF ||
type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF ||
@ -576,7 +576,7 @@ void EnViewer_DrawGanondorf(EnViewer* this, GlobalContext* globalCtx) {
}
void EnViewer_DrawHorse(EnViewer* this, GlobalContext* globalCtx) {
func_800A6330(&this->actor, globalCtx, &this->skin, NULL, 1);
func_800A6330(&this->actor, globalCtx, &this->skin, NULL, true);
}
s32 EnViewer_ZeldaOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,

View file

@ -60,7 +60,7 @@ typedef struct {
typedef struct EnViewer {
/* 0x0000 */ Actor actor;
/* 0x014C */ PSkinAwb skin;
/* 0x014C */ Skin skin;
/* 0x01DC */ s8 animObjBankIndex;
/* 0x01DD */ u8 drawFuncIndex;
/* 0x01E0 */ EnViewerActionFunc actionFunc;

View file

@ -45,8 +45,6 @@ void EnfHG_Damage(EnfHG* this, GlobalContext* globalCtx);
void EnfHG_Retreat(EnfHG* this, GlobalContext* globalCtx);
void EnfHG_Done(EnfHG* this, GlobalContext* globalCtx);
void EnfHG_Noop(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* skin);
const ActorInit En_fHG_InitVars = {
ACTOR_EN_FHG,
ACTORCAT_BG,
@ -82,7 +80,7 @@ void EnfHG_Init(Actor* thisx, GlobalContext* globalCtx2) {
this->actor.speedXZ = 0.0f;
this->actor.focus.pos = this->actor.world.pos;
this->actor.focus.pos.y += 70.0f;
func_800A663C(globalCtx, &this->skin, &gPhantomHorseSkel, &gPhantomHorseRunningAnim);
Skin_Init(globalCtx, &this->skin, &gPhantomHorseSkel, &gPhantomHorseRunningAnim);
if (this->actor.params >= GND_FAKE_BOSS) {
EnfHG_SetupApproach(this, globalCtx, this->actor.params - GND_FAKE_BOSS);
@ -96,7 +94,7 @@ void EnfHG_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnfHG* this = (EnfHG*)thisx;
osSyncPrintf("F DT1\n");
func_800A6888(globalCtx, &this->skin);
Skin_Free(globalCtx, &this->skin);
osSyncPrintf("F DT2\n");
}
@ -708,7 +706,7 @@ void EnfHG_Update(Actor* thisx, GlobalContext* globalCtx) {
this->actor.shape.rot.z = (s16)(Math_SinS(this->hitTimer * 0x7000) * 1500.0f) * (this->hitTimer / 20.0f);
}
void EnfHG_Noop(Actor* thisx, GlobalContext* globalCtx, PSkinAwb* skin) {
void EnfHG_PostDraw(Actor* thisx, GlobalContext* globalCtx, Skin* skin) {
}
void EnfHG_Draw(Actor* thisx, GlobalContext* globalCtx) {
@ -724,7 +722,7 @@ void EnfHG_Draw(Actor* thisx, GlobalContext* globalCtx) {
: Gfx_SetFog(POLY_OPA_DISP, (u32)this->warpColorFilterR, (u32)this->warpColorFilterG,
(u32)this->warpColorFilterB, 0, (s32)this->warpColorFilterUnk1 + 995,
(s32)this->warpColorFilterUnk2 + 1000);
func_800A6330(&this->actor, globalCtx, &this->skin, EnfHG_Noop, 0x23);
func_800A6330(&this->actor, globalCtx, &this->skin, EnfHG_PostDraw, SKIN_TRANSFORM_IS_FHG);
POLY_OPA_DISP = Gameplay_SetFog(globalCtx, POLY_OPA_DISP);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fhg.c", 2480);
}

View file

@ -58,7 +58,7 @@ typedef struct EnfHG {
/* 0x01F8 */ f32 warpColorFilterUnk2;
/* 0x01FC */ EnfHGActionFunc actionFunc;
/* 0x0200 */ char unk_200[4];
/* 0x0204 */ PSkinAwb skin;
/* 0x0204 */ Skin skin;
} EnfHG; // size = 0x0294
#endif