Decompile DRA func_8010DBFC (#903)

Function looks like function `u32 UpdateAnim(s8* frameProps, s32*
frames)` without any value returned.

Next step will be `func_8010DA70` as it is used with it.

scratch : https://decomp.me/scratch/Ib0tn
This commit is contained in:
Julien Augugliaro 2023-12-28 09:00:55 +01:00 committed by GitHub
parent 9796b148ce
commit 9a5fe7cea1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 4 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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();