ovl_Dm_Char04 Decompiled (#925)

* all functions matching

* Data imported

* ovl_Dm_Char04 Decompiled

* ovl_Dm_Char04 Decompiled

* pr reviews

* number

* parenthesis

* renamings i forgot

* more renamings

* Elliptic number magic

* cast remove

* timer
This commit is contained in:
Alejandro Asenjo 2022-07-22 01:43:36 -03:00 committed by GitHub
parent a935cbc6ae
commit d1d1bf8ec6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 135 additions and 19 deletions

3
spec
View File

@ -3146,8 +3146,7 @@ beginseg
name "ovl_Dm_Char04"
compress
include "build/src/overlays/actors/ovl_Dm_Char04/z_dm_char04.o"
include "build/data/ovl_Dm_Char04/ovl_Dm_Char04.data.o"
include "build/data/ovl_Dm_Char04/ovl_Dm_Char04.reloc.o"
include "build/src/overlays/actors/ovl_Dm_Char04/ovl_Dm_Char04_reloc.o"
endseg
beginseg

View File

@ -899,7 +899,7 @@ s32 DmChar00_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f
Vec3f sp1C;
if (limbIndex == 6) {
sp28 = ((Math_SinS(this->unk_262 * 0x1000) * 0.1f) + 1.0f) * 0.012f * (this->actor.scale.x * 124.99999f);
sp28 = ((Math_SinS(this->unk_262 * 0x1000) * 0.1f) + 1.0f) * 0.012f * (this->actor.scale.x * (1.0f / 0.008f));
Matrix_MultVec3f(&D_80AA7808, &sp1C);
Matrix_Translate(sp1C.x, sp1C.y, sp1C.z, MTXMODE_NEW);
Matrix_Scale(sp28, sp28, sp28, MTXMODE_APPLY);

View File

@ -5,6 +5,7 @@
*/
#include "z_dm_char04.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)
@ -15,7 +16,8 @@ void DmChar04_Destroy(Actor* thisx, PlayState* play);
void DmChar04_Update(Actor* thisx, PlayState* play);
void DmChar04_Draw(Actor* thisx, PlayState* play);
#if 0
void func_80AABE34(DmChar04* this, PlayState* play);
const ActorInit Dm_Char04_InitVars = {
ACTOR_DM_CHAR04,
ACTORCAT_ITEMACTION,
@ -28,18 +30,127 @@ const ActorInit Dm_Char04_InitVars = {
(ActorFunc)DmChar04_Draw,
};
#endif
void DmChar04_ChangeAnim(SkelAnime* skelAnime, AnimationInfo* animation, u16 index) {
f32 endFrame;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char04/func_80AABC40.s")
animation += index;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char04/DmChar04_Init.s")
if (animation->frameCount < 0.0f) {
endFrame = Animation_GetLastFrame(animation->animation);
} else {
endFrame = animation->frameCount;
}
Animation_Change(skelAnime, animation->animation, animation->playSpeed, animation->startFrame, endFrame,
animation->mode, animation->morphFrames);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char04/DmChar04_Destroy.s")
static AnimationInfo sAnimations[] = {
{ &gameplay_keep_Anim_02B2E8, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f },
{ &gameplay_keep_Anim_029140, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f },
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char04/func_80AABE34.s")
Color_RGBAf sPrimColors[] = {
{ 250.0f, 255.0f, 230.0f, 255.0f },
{ 10.0f, 10.0f, 40.0f, 255.0f },
{ 255.0f, 235.0f, 220.0f, 255.0f },
};
Color_RGBAf sEnvColors[] = {
{ 220.0f, 160.0f, 80.0f, 255.0f },
{ 120.0f, 255.0f, 255.0f, 255.0f },
{ 255.0f, 235.0f, 220.0f, 255.0f },
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char04/DmChar04_Update.s")
void DmChar04_Init(Actor* thisx, PlayState* play) {
DmChar04* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char04/func_80AABF74.s")
this->primColors = sPrimColors[this->actor.params];
this->envColors = sEnvColors[this->actor.params];
this->actor.targetArrowOffset = 3000.0f;
this->csAction = 0x63;
this->timer = this->actor.params << 0xB;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f);
SkelAnime_Init(play, &this->skelAnime, &gameplay_keep_Skel_02AF58.sh, &gameplay_keep_Anim_029140, this->jointTable,
this->morphTable, 7);
ActorShape_Init(&this->actor.shape, 0.0f, NULL, 15.0f);
DmChar04_ChangeAnim(&this->skelAnime, sAnimations, 0);
Actor_SetScale(&this->actor, 0.01f);
this->actionFunc = func_80AABE34;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char04/DmChar04_Draw.s")
void DmChar04_Destroy(Actor* thisx, PlayState* play) {
}
void func_80AABE34(DmChar04* this, PlayState* play) {
u16 params = this->actor.params + 0x71;
if (Cutscene_CheckActorAction(play, params)) {
s32 actionIndex = Cutscene_GetActorActionIndex(play, params);
if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) {
if (this->csAction != play->csCtx.actorActions[actionIndex]->action) {
this->csAction = play->csCtx.actorActions[actionIndex]->action;
if (play->csCtx.actorActions[actionIndex]->action == 1) {
this->animationIndex = 0;
} else {
this->animationIndex = 0;
}
DmChar04_ChangeAnim(&this->skelAnime, &sAnimations[this->animationIndex], 0);
}
}
Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex);
} else {
this->csAction = 0x63;
}
}
void DmChar04_Update(Actor* thisx, PlayState* play) {
DmChar04* this = THIS;
SkelAnime_Update(&this->skelAnime);
this->actionFunc(this, play);
this->timer++;
}
static Vec3f D_80AAC4F0 = { 0.0f, 0.0f, 0.0f };
s32 DmChar04_OverrideLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx,
Gfx** gfx) {
PlayState* play = play2;
f32 sp28;
Vec3f sp1C;
DmChar04* this = THIS;
if (limbIndex == 6) {
sp28 = ((Math_SinS(this->timer << 0xC) * 0.1f) + 1.0f) * 0.012f * (this->actor.scale.x * (1.0f / 0.008f));
Matrix_MultVec3f(&D_80AAC4F0, &sp1C);
Matrix_Translate(sp1C.x, sp1C.y, sp1C.z, MTXMODE_NEW);
Matrix_Scale(sp28, sp28, sp28, MTXMODE_APPLY);
}
return false;
}
void DmChar04_Draw(Actor* thisx, PlayState* play) {
Gfx* gfx = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Gfx) * 4);
s32 alpha;
s32 pad;
DmChar04* this = THIS;
OPEN_DISPS(play->state.gfxCtx);
func_8012C94C(play->state.gfxCtx);
alpha = (this->timer * 50) & 0x1FF;
if (alpha > 255) {
alpha = 511 - alpha;
}
gSPSegment(POLY_XLU_DISP++, 0x08, &gfx[0]);
gDPPipeSync(gfx++);
gDPSetPrimColor(gfx++, 0, 0x01, (u8)this->primColors.r, (u8)this->primColors.g, (u8)this->primColors.b,
(u8)(this->primColors.a * 1));
gDPSetRenderMode(gfx++, G_RM_PASS, G_RM_ZB_CLD_SURF2);
gSPEndDisplayList(gfx);
gDPSetEnvColor(POLY_XLU_DISP++, (u8)(s8)this->envColors.r, (u8)(s8)this->envColors.g, (u8)(s8)this->envColors.b,
(u8)(s8)((f32)alpha * 1));
gDPSetDither(POLY_XLU_DISP++, G_CD_BAYER);
POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable,
DmChar04_OverrideLimbDraw, NULL, &this->actor, POLY_XLU_DISP);
CLOSE_DISPS(play->state.gfxCtx);
}

View File

@ -8,10 +8,16 @@ struct DmChar04;
typedef void (*DmChar04ActionFunc)(struct DmChar04*, PlayState*);
typedef struct DmChar04 {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0xF8];
/* 0x23C */ DmChar04ActionFunc actionFunc;
/* 0x240 */ char unk_240[0x24];
/* 0x0000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ Vec3s jointTable[15];
/* 0x1E2 */ Vec3s morphTable[15];
/* 0x023C */ DmChar04ActionFunc actionFunc;
/* 0x240 */ Color_RGBAf primColors;
/* 0x250 */ Color_RGBAf envColors;
/* 0x260 */ u8 csAction;
/* 0x261 */ u8 animationIndex;
/* 0x262 */ u16 timer;
} DmChar04; // size = 0x264
extern const ActorInit Dm_Char04_InitVars;

View File

@ -1555,7 +1555,7 @@ s32 EnElf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
if (this->fairyFlags & 0x200) {
scale *= 2.0f;
}
scale *= this->actor.scale.x * 124.99999f;
scale *= this->actor.scale.x * (1.0f / 0.008f);
Matrix_MultVec3f(&zeroVec, &sp34);
Matrix_Translate(sp34.x, sp34.y, sp34.z, MTXMODE_NEW);

View File

@ -11572,12 +11572,12 @@
0x80AAB9A8:("func_80AAB9A8",),
0x80AAB9BC:("DmChar03_Draw",),
0x80AABA84:("func_80AABA84",),
0x80AABC40:("func_80AABC40",),
0x80AABC40:("DmChar04_ChangeAnim",),
0x80AABCDC:("DmChar04_Init",),
0x80AABE24:("DmChar04_Destroy",),
0x80AABE34:("func_80AABE34",),
0x80AABF28:("DmChar04_Update",),
0x80AABF74:("func_80AABF74",),
0x80AABF74:("DmChar04_OverrideLimbDraw",),
0x80AAC03C:("DmChar04_Draw",),
0x80AAC5A0:("func_80AAC5A0",),
0x80AAC63C:("func_80AAC63C",),