diff --git a/include/game.h b/include/game.h index fe9b6d479..7d4a76109 100644 --- a/include/game.h +++ b/include/game.h @@ -1163,7 +1163,7 @@ typedef struct { /* 8003C80C */ Entity* (*func_80118970)(void); /* 8003C810 */ s32 (*func_80118B18)(Entity* ent1, Entity* ent2, s32 arg2); /* 8003C814 */ s32 (*UpdateUnarmedAnim)(s8* frameProps, u16** frames); - /* 8003C818 */ void (*func_8010DBFC)(s32*, s32*); + /* 8003C818 */ void (*func_8010DBFC)(s8*, s32*); /* 8003C81C */ void (*func_80118C28)(s32 arg0); /* 8003C820 */ void (*func_8010E168)(s32 arg0, s16 arg1); /* 8003C824 */ void (*func_8010DFF0)(s32 arg0, s32 arg1); @@ -1231,7 +1231,7 @@ extern u16* (*g_api_func_80106A28)(u16 arg0, u16 kind); extern void (*g_api_func_80118894)(Entity*); extern EnemyDef* g_api_enemyDefs; extern u32 (*g_api_UpdateUnarmedAnim)(s8* frameProps, u16** frames); -extern void (*g_api_func_8010DBFC)(s32*, s32*); +extern void (*g_api_func_8010DBFC)(s8*, s32*); extern void (*g_api_func_8010E168)(s32 arg0, s16 arg1); extern void (*g_api_func_8010DFF0)(s32 arg0, s32 arg1); extern u16 (*g_api_DealDamage)(Entity* enemyEntity, Entity* attackerEntity); diff --git a/src/dra/6D59C.c b/src/dra/6D59C.c index 1571fc4d3..02cd2cbf1 100644 --- a/src/dra/6D59C.c +++ b/src/dra/6D59C.c @@ -161,7 +161,51 @@ u32 UpdateUnarmedAnim(s8* frameProps, u16** frames) { return PLAYER.animFrameDuration >= 0 ? 0 : -1; } -INCLUDE_ASM("dra/nonmatchings/6D59C", func_8010DBFC); +void func_8010DBFC(s8* frameProps, s32* frames) { + AnimationFrame* animFrame; + + animFrame = func_8010DA70(frames); + if (g_CurrentEntity->animFrameDuration != -1) { + if (g_CurrentEntity->animFrameDuration == 0) { + g_CurrentEntity->animFrameDuration = animFrame->duration; + } else if (--g_CurrentEntity->animFrameDuration == 0) { + g_CurrentEntity->animFrameIdx++; + animFrame = func_8010DA70(frames); + // Using a switch doesn't work + if (animFrame->duration == 0x0) { + g_CurrentEntity->animFrameIdx = animFrame->unk2; + animFrame = func_8010DA70(frames); + g_CurrentEntity->animFrameDuration = animFrame->duration; + } else if (animFrame->duration == 0xFFFF) { + g_CurrentEntity->animFrameIdx--; + g_CurrentEntity->animFrameDuration = -1; + animFrame = func_8010DA70(frames); + } else if (animFrame->duration == 0xFFFE) { + g_CurrentEntity->ext.generic.unkAC = animFrame->unk2; + g_CurrentEntity->animFrameIdx = animFrame->unk2 >> 8; + animFrame = func_8010DA70(frames); + g_CurrentEntity->animFrameDuration = animFrame->duration; + } else { + g_CurrentEntity->animFrameDuration = animFrame->duration; + } + } + } + + if (frameProps != NULL) { + // This is ugly - theoretically the type for frameProps should be + // FrameProperty* but anything besides this where we assign this big + // expression fails. + + // Please check function u32 UpdateAnim(s8* frameProps, s32* frames) + // down below + frameProps = &frameProps[animFrame->unk2 >> 9 << 2]; + g_CurrentEntity->hitboxOffX = *frameProps++; + g_CurrentEntity->hitboxOffY = *frameProps++; + g_CurrentEntity->hitboxWidth = *frameProps++; + g_CurrentEntity->hitboxHeight = *frameProps++; + } + g_CurrentEntity->animCurFrame = animFrame->unk2 & 0x1FF; +} u32 UpdateAnim(s8* frameProps, s32* frames) { AnimationFrame* animFrame; diff --git a/src/dra/dra.h b/src/dra/dra.h index 3701080fd..91336fe8a 100644 --- a/src/dra/dra.h +++ b/src/dra/dra.h @@ -945,7 +945,7 @@ bool CheckQuarterCircleForwardInput(); bool CheckBackForwardInput(); bool CheckDarkMetamorphosisInput(); bool CheckSummonSpiritInput(); -void func_8010DBFC(s32*, s32*); +void func_8010DBFC(s8*, s32*); bool CheckHellfireInput(); bool CheckTetraSpiritInput(); bool CheckSoulStealInput();