From 6072055c8561c2504eb874b5005e2ab9c56d216e Mon Sep 17 00:00:00 2001 From: KrimtonZ Date: Sun, 22 Mar 2020 20:57:25 -0500 Subject: [PATCH] fix merge conflics --- include/functions.h | 27 ++--- include/z64.h | 43 ------- include/z64animation.h | 6 +- src/code/z_skelanime.c | 112 +++++++++++++++++- .../actors/ovl_En_Wallmas/z_en_wallmas.c | 2 +- undefined_syms.txt | 2 + 6 files changed, 120 insertions(+), 72 deletions(-) diff --git a/include/functions.h b/include/functions.h index 5e599656f6..0e703d2a2d 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1143,7 +1143,8 @@ void func_800A1AC8(GlobalContext* globalCtx, u32 limbIndex, u32 actorDrawTbl, u3 s32 SkelAnime_GetFrameCount(u32 animation); // ? func_800A2044(?); // ? func_800A24A0(?); -Gfx* func_800A273C(GlobalContext* globalCtx, u32 limbIndex, u32 adt, u8 limbDListCnt, void* internal0, void* internal1, +Gfx* func_800A273C(GlobalContext* globalCtx, u32* limbTable, Vec3s* actorDrawTable, s32 dListCount, + SkelAnime_LimbUpdateMatrix2 updateMtxFunc, SkelAnime_LimbAppendDlist2 appendDlistFunc, Actor* actor, Gfx* gfx); // ? func_800A2E70(?); // ? func_800A32EC(?); @@ -1159,15 +1160,10 @@ Gfx* func_800A273C(GlobalContext* globalCtx, u32 limbIndex, u32 adt, u8 limbDLis // ? func_800A3F08(?); // ? func_800A3D70(?); // ? func_800A4478(?); -<<<<<<< HEAD -void SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 skelAnimeInitSeg, u32 animation, Vec3s* actorDrawTable, s32 arg5, s32 limbCount); -void func_800A46F8(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 skelAnimeInitSeg, u32 animation, Vec3s* actorDrawTable, s32 arg5, s32 limbCount); -======= -void SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 skeleton, u32 animation, u16* unk0, u16* unk1, - u8 unk2); -void func_800A46F8(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 skeleton, u32 animation, u16* unk0, u16* unk1, - u8 unk2); ->>>>>>> master +void SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 skelAnimeInitSeg, u32 animation, Vec3s* actorDrawTable, + s32 arg5, s32 limbCount); +void func_800A46F8(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 skelAnimeInitSeg, u32 animation, Vec3s* actorDrawTable, + s32 arg5, s32 limbCount); // ? func_800A4A20(?); // ? func_800A4AD8(?); // ? func_800A4D9C(?); @@ -1177,18 +1173,11 @@ void func_800A46F8(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 skeleton, s32 SkelAnime_FrameUpdateMatrix(SkelAnime* skelAnime); // ? func_800A4C58(?); // ? func_800A4FE4(?); -<<<<<<< HEAD -void SkelAnime_ChangeAnimation(SkelAnime* skelAnime, u32 animation, f32 playbackSpeed, f32 unk0, f32 frameCount, u8 unk1, f32 transitionRate); +void SkelAnime_ChangeAnimation(SkelAnime* skelAnime, u32 animation, f32 playbackSpeed, f32 unk0, f32 frameCount, + u8 unk1, f32 transitionRate); void func_800A51E8(SkelAnime *skelAnime, u32 animation); void func_800A5240(SkelAnime *skelAnime, u32 animation, f32 unk0); void func_800A529C(SkelAnime *skelAnime, u32 animation, f32 unk0); -======= -void SkelAnime_ChangeAnimation(SkelAnime* skelAnime, u32 animation, f32 playbackSpeed, f32 unk0, f32 frameCount, - u8 unk1, f32 transitionRate); -void func_800A51E8(SkelAnime* skelAnime, u32 animation); -void func_800A5240(SkelAnime* skelAnime, u32 animation, f32 unk0); -void func_800A529C(SkelAnime* skelAnime, u32 animation, f32 unk0, Actor* actor); ->>>>>>> master // ? func_800A52F8(?); // ? func_800A54FC(?); s32 func_800A56C8(SkelAnime* skelAnime, f32 arg1); diff --git a/include/z64.h b/include/z64.h index 7b3dea7138..d75cbb87a0 100644 --- a/include/z64.h +++ b/include/z64.h @@ -501,17 +501,6 @@ typedef struct { /* 0xE40E */ char unk_E40E[0x0A]; } MessageContext; // size = 0xE418 -typedef struct { - /* 0x00 */ u32 vromAddr; // VROM address (source) - /* 0x04 */ void* dramAddr; // DRAM address (destination) - /* 0x08 */ u32 size; // File Transfer size - /* 0x0C */ char* filename; // Filename for debugging - /* 0x10 */ s32 line; // Line for debugging - /* 0x14 */ s32 unk_14; - /* 0x18 */ OSMesgQueue* notifyQueue; // Message queue for the notification message - /* 0x1C */ OSMesg notifyMsg; // Completion notification message -} DmaRequest; // size = 0x20 - typedef struct { /* 0x0000 */ View view; /* 0x0128 */ Vtx* vtx_128; @@ -975,31 +964,6 @@ typedef struct { /* 0x14 */ f32 transitionRate; } struct_80034EC0_Entry; // size = 0x18 -typedef struct { - /* 0x00 */ u8 limbCount; - /* 0x01 */ char unk_01[0x01]; - /* 0x02 */ u8 dListCount; - /* 0x03 */ char unk_03[0x01]; /* Probably Padding */ - /* 0x04 */ u32 limbIndex; - /* 0x08 */ u32* animCurrent; - /* 0x0C */ char unk_0C[0x04]; - /* 0x10 */ f32 animFrameCount; - /* 0x14 */ f32 unk_14; - /* 0x18 */ f32 animCurrentFrame; - /* 0x1C */ f32 animPlaybackSpeed; - /* 0x20 */ u32 actorDrawTbl; - /* 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; - /* 0x40 */ u16 unk_40; - /* 0x42 */ u16 unk_42; -} SkelAnime; // size = 0x44 - typedef struct { /* 0x00 */ u32 unk_00; /* 0x04 */ u32(*init)(GlobalContext*, u32, LoadedParticleEntry*, void*); @@ -1203,13 +1167,6 @@ typedef struct { /* 0x20 */ u8 data[0x10000-0x20]; } ISVDbg; -typedef struct { - /* 0x00 */ u32 vromStart; - /* 0x04 */ u32 vromEnd; - /* 0x08 */ u32 romStart; - /* 0x0C */ u32 romEnd; -} DmaEntry; - typedef struct { char name[0x18]; u32 mediaFormat; diff --git a/include/z64animation.h b/include/z64animation.h index e7905d6312..993faa78fb 100755 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -49,7 +49,7 @@ typedef struct SkelAnime /* 0x02 */ u8 dListCount; /* 0x03 */ s8 unk_03; /* 0x04 */ u32 limbIndex; - /* 0x08 */ u32 animCurrent; + /* 0x08 */ u32* animCurrent; /* 0x0C */ f32 unk_0C; /* 0x10 */ f32 animFrameCount; // ending frame? /* 0x14 */ f32 unk_14; // Loop frame? @@ -96,7 +96,7 @@ typedef enum { ANIMATION_TYPE2, ANIMATION_TYPE3, ANIMATION_TYPE4, - ANIMATION_TYPE5, + ANIMATION_TYPE5 } AnimationType; typedef struct @@ -202,4 +202,4 @@ extern u32 link_animetion_segment; // 0x07000000 #define LIMB_DONE 0xFF -#define LOG(file,line,msg,arg) LogUtils_LogThreadId(file, line); osSyncPrintf(msg, arg) \ No newline at end of file +#define LOG(file,line,msg,arg) LogUtils_LogThreadId(file, line); osSyncPrintf(msg, arg) diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 9c376faa3a..b258a412aa 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -1671,15 +1671,115 @@ void func_800A5408(SkelAnime* skelAnime) } #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A5408.s") +#endif -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A5428.s") +void func_800A5428(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* arg3) +{ + s32 i; + for(i = 0; i < skelAnime->limbCount; i++, dst++, src++) + { + if(*arg3++) + { + *dst = *src; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A5490.s") +void func_800A5490(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* arg3) +{ + s32 i; + for(i = 0;i < skelAnime->limbCount; i++, dst++, src++) + { + if(*arg3++ < 1U){ + *dst = *src; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A54FC.s") +void func_800A54FC(SkelAnime* skelAnime, Vec3f* pos, s16 angle) +{ + f32 x; + f32 z; + f32 sin; + f32 cos; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A56C8.s") + if((skelAnime->unk_35 & 0x10) != 0) + { + pos->z = 0.0f; + pos->x = 0.0f; + } + else + { + x = (f32)skelAnime->actorDrawTbl->x; + z = (f32)skelAnime->actorDrawTbl->z; + sin = Math_Sins(angle); + cos = Math_Coss(angle); + pos->x = x * cos + z * sin; + pos->z = z * cos - x * sin; + x = (f32)skelAnime->unk_38; + z = (f32)skelAnime->unk_3C; + sin = Math_Sins(skelAnime->unk_36); + cos = Math_Coss(skelAnime->unk_36); + pos->x -= x * cos + z * sin; + pos->z -= z * cos - x * sin; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A56F0.s") + skelAnime->unk_36 = angle; + skelAnime->unk_38 = skelAnime->actorDrawTbl->x; + skelAnime->actorDrawTbl->x = skelAnime->unk_3E; + skelAnime->unk_3C = skelAnime->actorDrawTbl->z; + skelAnime->actorDrawTbl->z = skelAnime->unk_42; + if((skelAnime->unk_35 & 2) != 0) + { + if((skelAnime->unk_35 & 0x10) != 0) + { + pos->y = 0.0f; + } + else + { + pos->y = (f32)(skelAnime->actorDrawTbl->y - skelAnime->unk_3A); + } + skelAnime->unk_3A = skelAnime->actorDrawTbl->y; + skelAnime->actorDrawTbl->y = skelAnime->unk_40; + } + else + { + pos->y = 0.0f; + skelAnime->unk_3A = skelAnime->actorDrawTbl->y; + } + skelAnime->unk_35 &= ~0x10; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A5774.s") +s32 func_800A56C8(SkelAnime *skelAnime, f32 arg1) +{ + return func_800A4478(skelAnime, arg1, 1.0f); +} + +// SkelAnime_Free +void func_800A56F0(SkelAnime *skelAnime, s32 arg1) +{ + if (skelAnime->actorDrawTbl != NULL) + { + ZeldaArena_FreeDebug(skelAnime->actorDrawTbl, "../z_skelanime.c", 3729); + } + else + { + osSyncPrintf("now_joint あきまへん!!\n"); // now_joint Akimane! ! + } + if (skelAnime->unk_24 != NULL) + { + ZeldaArena_FreeDebug(skelAnime->unk_24, "../z_skelanime.c", 3731); + return; + } + osSyncPrintf("morf_joint あきまへん!!\n"); // "morf_joint Akimane !!" +} + +// SkelAnime_CopyVec3s +void func_800A5774(SkelAnime* skelAnime, Vec3s *dst, Vec3s *src) +{ + s32 i; + for(i = 0; i < skelAnime->limbCount; i++) + { + *dst++ = *src++; + } +} diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index ffcb83d1b8..630a054739 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -169,7 +169,7 @@ static void EnWallmas_StandStart(EnWallmas* this) { } static void EnWallmas_WalkStart(EnWallmas* this) { - func_800A529C(&this->skelAnime, &D_060041F4, 3.0f, &this->actor); + func_800A529C(&this->skelAnime, &D_060041F4, 3.0f); this->actionFunc = (ActorFunc)&EnWallmas_Walk; this->actor.speedXZ = 3.0f; } diff --git a/undefined_syms.txt b/undefined_syms.txt index 7980357d0d..3b7ec95c4c 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -436,3 +436,5 @@ D_060009E0 = 0x060009E0; // z_bg_toki_swd D_06001BD0 = 0x06001BD0; +// z_skelanime +link_animetion_segment = 0x07000000;