1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-10 19:20:13 +00:00

start z_skelanime.c

This commit is contained in:
KrimtonZ 2020-03-17 22:15:19 -05:00
parent 458593fcd7
commit aa2d45310d
3 changed files with 139 additions and 19 deletions

View file

@ -1149,7 +1149,7 @@ void func_800A5240(SkelAnime *skelAnime, u32 animation, f32 unk0);
void func_800A529C(SkelAnime *skelAnime, u32 animation, f32 unk0, Actor *actor);
// ? func_800A52F8(?);
// ? func_800A54FC(?);
UNK_TYPE func_800A56C8(SkelAnime* skelAnime, f32 arg1);
s32 func_800A56C8(SkelAnime* skelAnime, f32 arg1);
// ? func_800A56F0(?);
// ? func_800A5774(?);
// ? func_800A57C0(?);

View file

@ -1003,15 +1003,15 @@ typedef struct LoadedParticleEntry
/* 0x005F */ u8 type;
} LoadedParticleEntry; // size = 0x60
typedef struct
typedef struct SkelAnime
{
/* 0x00 */ u8 limbCount;
/* 0x01 */ char unk_01[0x01];
/* 0x01 */ u8 unk_01;
/* 0x02 */ u8 dListCount;
/* 0x03 */ char unk_03[0x01]; /* Probably Padding */
/* 0x03 */ u8 unk_03;
/* 0x04 */ u32 limbIndex;
/* 0x08 */ u32 animCurrent;
/* 0x0C */ char unk_0C[0x04];
/* 0x0C */ f32 unk_0C;
/* 0x10 */ f32 animFrameCount;
/* 0x14 */ f32 unk_14;
/* 0x18 */ f32 animCurrentFrame;
@ -1020,12 +1020,17 @@ typedef struct
/* 0x24 */ u32 unk_24;
/* 0x28 */ u32 unk_28;
/* 0x2C */ u32 unk_2C;
/* 0x30 */ void* funcUnk30; /* Some function pointer */
/* 0x34 */ s32 unk_34;
/* 0x38 */ s32 unk_38;
/* 0x3C */ u16 unk_3C;
/* 0x3E */ u16 unk_3E; /* Probably Padding */
} SkelAnime; // size = 0x40
/* 0x30 */ s32 (*mtxUpdate)(struct SkelAnime*);
/* 0x34 */ char unk_34[1];
/* 0x35 */ u8 unk_35;
/* 0x36 */ s16 unk_36;
/* 0x38 */ s16 unk_38;
/* 0x3A */ s16 unk_3A;
/* 0x3C */ s16 unk_3C;
/* 0x3E */ s16 unk_3E;
/* 0x40 */ s16 unk_40;
/* 0x42 */ s16 unk_42;
} SkelAnime; // size = 0x44
typedef struct
{

View file

@ -1,6 +1,8 @@
#include <ultra64.h>
#include <global.h>
s32 func_800A4478(SkelAnime*,f32,f32);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A08A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A0B40.s")
@ -21,7 +23,12 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A1FC8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/SkelAnime_GetFrameCount.s")
s32 SkelAnime_GetFrameCount(u32 animation)
{
u16* virt = (u16*)SEGMENTED_TO_VIRTUAL(animation);
return (s16)(*virt - 1);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A2044.s")
@ -71,7 +78,23 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A37F0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A3874.s")
typedef struct {
Actor* actor;
SkelAnime* skelAnime;
f32 unk_8;
} UNK_800A3874_A1;
void func_800A54FC(SkelAnime*,Vec3f*,s16);
void func_800A3874(s32 arg0, UNK_800A3874_A1* arg1)
{
char pad[4];
Actor* temp_v0 = arg1->actor;
Vec3f pos;
func_800A54FC(arg1->skelAnime, &pos, temp_v0->shape.rot.y);
temp_v0->posRot.pos.x += pos.x * temp_v0->scale.x;
temp_v0->posRot.pos.y += pos.y * temp_v0->scale.y * arg1->unk_8;
temp_v0->posRot.pos.z += pos.z * temp_v0->scale.z;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A390C.s")
@ -129,7 +152,9 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A49B0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/SkelAnime_FrameUpdateMatrix.s")
s32 SkelAnime_FrameUpdateMatrix(SkelAnime* skelAnime){
return skelAnime->mtxUpdate(skelAnime);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A4A20.s")
@ -145,7 +170,10 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A4FE4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/SkelAnime_ChangeAnimation.s")
void SkelAnime_ChangeAnimation(SkelAnime* skelAnime, u32 animation, f32 playbackSpeed, f32 unk0, /* 0x10 */ f32 frameCount, /* 0x14 */ u8 unk1, /* 0x18 */ f32 transitionRate)
{
func_800A4FE4(skelAnime, animation, playbackSpeed, unk0, frameCount, unk1, transitionRate, 0);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A51E8.s")
@ -167,11 +195,98 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A5490.s")
#ifdef NON_MATCHING
void func_800A54FC(SkelAnime* skelAnime, Vec3f* pos, s16 angle)
{
f32 temp_f20;
f32 temp_f20_2;
f32 temp_f22;
f32 temp_f22_2;
f32 temp_f24;
f32 temp_f24_2;
f32 temp_ret;
f32 temp_ret_2;
if ((skelAnime->unk_35 & 0x10) != 0)
{
pos->z = 0.0f;
pos->x = 0.0f;
}
else
{
temp_f20 = (f32) *(s16*)(skelAnime->actorDrawTbl);
temp_f22 = (f32) ((s16*)skelAnime->actorDrawTbl)[2];
temp_f24 = Math_Sins(angle);
temp_ret = Math_Coss(angle);
pos->x = (f32) ((temp_f20 * temp_ret) + (temp_f22 * temp_f24));
pos->z = (f32) ((temp_f22 * temp_ret) - (temp_f20 * temp_f24));
temp_f20_2 = (f32) skelAnime->unk_38;
temp_f22_2 = (f32) skelAnime->unk_3C;
temp_f24_2 = Math_Sins(skelAnime->unk_36);
temp_ret_2 = Math_Coss(skelAnime->unk_36);
pos->x -= ((temp_f20_2 * temp_ret_2) + (temp_f22_2 * temp_f24_2));
pos->z -= ((temp_f22_2 * temp_ret_2) - (temp_f20_2 * temp_f24_2));
//arg1->unk0 = (f32) (arg1->unk0 - ((temp_f20_2 * temp_ret_2) + (temp_f22_2 * temp_f24_2)));
//arg1->unk8 = (f32) (arg1->unk8 - ((temp_f22_2 * temp_ret_2) - (temp_f20_2 * temp_f24_2)));
}
skelAnime->unk_36 = angle;
skelAnime->unk_38 = *(s16*)(skelAnime->actorDrawTbl);
*(s16*)(skelAnime->actorDrawTbl) = skelAnime->unk_3E;
skelAnime->unk_3C = ((s16*)skelAnime->actorDrawTbl)[2];
((s16*)skelAnime->actorDrawTbl)[2] = skelAnime->unk_42;
if ((skelAnime->unk_35 & 2) != 0)
{
if ((skelAnime->unk_35 & 0x10) != 0)
{
pos->y = 0.0f;
}
else
{
pos->y = (f32) ((s16*)skelAnime->actorDrawTbl)[1];
}
skelAnime->unk_3A = ((s16*)skelAnime->actorDrawTbl)[1];
((s16*)skelAnime->actorDrawTbl)[1] = skelAnime->unk_40;
}
else
{
pos->y = 0.0f;
skelAnime->unk_3A = ((s16*)skelAnime->actorDrawTbl)[1];
}
skelAnime->unk_35 &= ~0x10;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A54FC.s")
#endif
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A56C8.s")
s32 func_800A56C8(SkelAnime *skelAnime, f32 arg1)
{
return func_800A4478(skelAnime, arg1, 1.0f);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A56F0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A5774.s")
void func_800A56F0(SkelAnime *skelAnime, s32 arg1)
{
if (skelAnime->actorDrawTbl != 0)
{
ZeldaArena_FreeDebug(skelAnime->actorDrawTbl, "../z_skelanime.c", 3729);
}
else
{
osSyncPrintf("now_joint あきまへん!!\n"); // now_joint Akimane! !
}
if (skelAnime->unk_24 != 0)
{
ZeldaArena_FreeDebug(skelAnime->unk_24, "../z_skelanime.c", 3731);
return;
}
osSyncPrintf("morf_joint あきまへん!!\n"); // "morf_joint Akimane !!"
}
s32 func_800A5774(SkelAnime* skelAnime, Vec3s *dst, Vec3s *src)
{
s32 i;
for(i = 0; i < skelAnime->limbCount; i++)
{
*dst++ = *src++;
}
}