mirror of https://github.com/zeldaret/mm.git
ovl_Dm_Ah Decompiled (#988)
* current progress * all functions matching * data imported correctly (thanks @Maide) * ovl_Dm_Ah Decompiled * warnings * moved the (Player *) casting for cb consistency * renamings * thank you @hensldm * Jenkins being Jenkins * correction
This commit is contained in:
parent
f3c6e451fb
commit
1aaf0fbc7e
3
spec
3
spec
|
|
@ -5044,8 +5044,7 @@ beginseg
|
|||
name "ovl_Dm_Ah"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.o"
|
||||
include "build/data/ovl_Dm_Ah/ovl_Dm_Ah.data.o"
|
||||
include "build/data/ovl_Dm_Ah/ovl_Dm_Ah.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_Dm_Ah/ovl_Dm_Ah_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
|
|
|||
|
|
@ -15,10 +15,6 @@ void DmAh_Destroy(Actor* thisx, PlayState* play);
|
|||
void DmAh_Update(Actor* thisx, PlayState* play);
|
||||
void DmAh_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
void func_80C1D7FC(DmAh* this, PlayState* play);
|
||||
void func_80C1D92C(DmAh* this, PlayState* play);
|
||||
|
||||
#if 0
|
||||
const ActorInit Dm_Ah_InitVars = {
|
||||
ACTOR_DM_AH,
|
||||
ACTORCAT_NPC,
|
||||
|
|
@ -31,32 +27,232 @@ const ActorInit Dm_Ah_InitVars = {
|
|||
(ActorFunc)DmAh_Draw,
|
||||
};
|
||||
|
||||
#endif
|
||||
static AnimationInfoS sAnimations[] = {
|
||||
{ &object_ah_Anim_001860, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
|
||||
{ &object_ah_Anim_000DDC, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
|
||||
};
|
||||
|
||||
extern UNK_TYPE D_06009E70;
|
||||
s32 func_80C1D410(DmAh* this, s32 animationIndex) {
|
||||
s32 ret = false;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D410.s")
|
||||
if (animationIndex != this->animationIndex) {
|
||||
this->animationIndex = animationIndex;
|
||||
ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimations, animationIndex);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D458.s")
|
||||
void func_80C1D458(DmAh* this) {
|
||||
if (DECR(this->unk_286) == 0) {
|
||||
this->unk_284++;
|
||||
if (this->unk_284 >= 4) {
|
||||
this->unk_286 = Rand_S16Offset(30, 30);
|
||||
this->unk_284 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D4D0.s")
|
||||
s32 func_80C1D4D0(DmAh* this, s32 arg1) {
|
||||
s32 pad;
|
||||
Vec3f sp40;
|
||||
Vec3f sp34;
|
||||
s16 temp_v0;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D6E0.s")
|
||||
Math_Vec3f_Copy(&sp40, &this->unk_280->world.pos);
|
||||
Math_Vec3f_Copy(&sp34, &this->actor.world.pos);
|
||||
temp_v0 = Math_Vec3f_Yaw(&sp34, &sp40);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D78C.s")
|
||||
Math_ApproachS(&this->unk_28C, (temp_v0 - this->unk_290) - this->actor.shape.rot.y, 4, 0x2AA8);
|
||||
this->unk_28C = CLAMP(this->unk_28C, -0x1FFE, 0x1FFE);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D7FC.s")
|
||||
Math_ApproachS(&this->unk_290, (temp_v0 - this->unk_28C) - this->actor.shape.rot.y, 4, 0x2AA8);
|
||||
this->unk_290 = CLAMP(this->unk_290, -0x1C70, 0x1C70);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1D92C.s")
|
||||
if (this->unk_280->id == ACTOR_PLAYER) {
|
||||
sp40.y = ((Player*)this->unk_280)->bodyPartsPos[7].y + 3.0f;
|
||||
} else {
|
||||
Math_Vec3f_Copy(&sp40, &this->unk_280->focus.pos);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/DmAh_Init.s")
|
||||
Math_Vec3f_Copy(&sp34, &this->actor.focus.pos);
|
||||
Math_ApproachS(&this->unk_28A, Math_Vec3f_Pitch(&sp34, &sp40) - this->unk_28E, 4, 0x2AA8);
|
||||
this->unk_28A = CLAMP(this->unk_28A, -0x1C70, 0x1C70);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/DmAh_Destroy.s")
|
||||
Math_ApproachS(&this->unk_28E, Math_Vec3f_Pitch(&sp34, &sp40) - this->unk_28A, 4, 0x2AA8);
|
||||
this->unk_28E = CLAMP(this->unk_28E, -0x1C70, 0x1C70);
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/DmAh_Update.s")
|
||||
s32 func_80C1D6E0(DmAh* this, PlayState* play) {
|
||||
if (this->unk_280 != NULL) {
|
||||
func_80C1D4D0(this, play);
|
||||
this->unk_27C &= ~1;
|
||||
this->unk_27C |= 2;
|
||||
} else if (this->unk_27C & 2) {
|
||||
this->unk_27C &= ~2;
|
||||
this->unk_28A = 0;
|
||||
this->unk_28C = 0;
|
||||
this->unk_28E = 0;
|
||||
this->unk_290 = 0;
|
||||
this->unk_288 = 20;
|
||||
} else if (DECR(this->unk_288) == 0) {
|
||||
this->unk_27C |= 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1DAD4.s")
|
||||
Actor* func_80C1D78C(PlayState* play) {
|
||||
Actor* tempActor;
|
||||
Actor* foundActor = NULL;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/func_80C1DB24.s")
|
||||
while (true) {
|
||||
foundActor = SubS_FindActor(play, foundActor, ACTORCAT_NPC, ACTOR_DM_AN);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Ah/DmAh_Draw.s")
|
||||
if ((foundActor == NULL) || (foundActor->update != NULL)) {
|
||||
break;
|
||||
}
|
||||
|
||||
tempActor = foundActor->next;
|
||||
if (tempActor == NULL || false) {
|
||||
foundActor = NULL;
|
||||
break;
|
||||
}
|
||||
foundActor = tempActor;
|
||||
}
|
||||
return foundActor;
|
||||
}
|
||||
|
||||
void func_80C1D7FC(DmAh* this, PlayState* play) {
|
||||
s32 D_80C1DE00[] = { 0, 0, 0, 0, 0 };
|
||||
u16 csAction;
|
||||
s32 actionIndex;
|
||||
|
||||
if (play->csCtx.state != 0) {
|
||||
if (!this->unk_29C) {
|
||||
this->action = 0xFF;
|
||||
this->unk_29C = true;
|
||||
this->animationIndex2 = this->animationIndex;
|
||||
}
|
||||
if (Cutscene_CheckActorAction(play, 0x232)) {
|
||||
actionIndex = Cutscene_GetActorActionIndex(play, 0x232);
|
||||
csAction = play->csCtx.actorActions[actionIndex]->action;
|
||||
if (this->action != (u8)csAction) {
|
||||
this->action = csAction;
|
||||
func_80C1D410(this, D_80C1DE00[csAction]);
|
||||
}
|
||||
Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex);
|
||||
}
|
||||
} else if (this->unk_29C) {
|
||||
this->unk_29C = false;
|
||||
func_80C1D410(this, this->animationIndex2);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80C1D92C(DmAh* this, PlayState* play) {
|
||||
}
|
||||
|
||||
void DmAh_Init(Actor* thisx, PlayState* play) {
|
||||
DmAh* this = THIS;
|
||||
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f);
|
||||
SkelAnime_InitFlex(play, &this->skelAnime, &object_ah_Skel_009E70, NULL, this->morphTable, this->jointTable,
|
||||
OBJECT_AH_LIMB_MAX);
|
||||
this->animationIndex = -1;
|
||||
func_80C1D410(this, 0);
|
||||
this->actor.flags &= ~ACTOR_FLAG_1;
|
||||
Actor_SetScale(&this->actor, 0.01f);
|
||||
this->unk_27C |= 1;
|
||||
if ((play->sceneNum == SCENE_YADOYA) && (play->curSpawn == 4)) {
|
||||
this->unk_280 = func_80C1D78C(play);
|
||||
func_80C1D410(this, 1);
|
||||
this->actionFunc = func_80C1D92C;
|
||||
} else {
|
||||
this->actionFunc = func_80C1D7FC;
|
||||
}
|
||||
}
|
||||
|
||||
void DmAh_Destroy(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
void DmAh_Update(Actor* thisx, PlayState* play) {
|
||||
DmAh* this = THIS;
|
||||
|
||||
this->actionFunc(this, play);
|
||||
func_80C1D6E0(this, play);
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
func_80C1D458(this);
|
||||
Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, 4);
|
||||
}
|
||||
|
||||
static Vec3f D_80C1DE14 = { 1000.0f, 0.0f, 0.0f };
|
||||
|
||||
void DmAh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
|
||||
if (limbIndex == OBJECT_AH_LIMB_07) {
|
||||
Matrix_MultVec3f(&D_80C1DE14, &thisx->focus.pos);
|
||||
Math_Vec3s_Copy(&thisx->focus.rot, &thisx->world.rot);
|
||||
}
|
||||
}
|
||||
|
||||
void DmAh_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
|
||||
DmAh* this = THIS;
|
||||
s32 stepRot;
|
||||
s32 overrideRot;
|
||||
|
||||
if (!(this->unk_27C & 1)) {
|
||||
if (this->unk_27C & 2) {
|
||||
overrideRot = true;
|
||||
} else {
|
||||
overrideRot = false;
|
||||
}
|
||||
stepRot = true;
|
||||
} else {
|
||||
stepRot = false;
|
||||
overrideRot = false;
|
||||
}
|
||||
|
||||
if (limbIndex == OBJECT_AH_LIMB_07) {
|
||||
SubS_UpdateLimb(BINANG_ADD(this->unk_28A + this->unk_28E, 0x4000),
|
||||
BINANG_ADD(this->unk_28C + this->unk_290 + this->actor.shape.rot.y, 0x4000), &this->unk_18C,
|
||||
&this->unk_1A4, stepRot, overrideRot);
|
||||
Matrix_Pop();
|
||||
Matrix_Translate(this->unk_18C.x, this->unk_18C.y, this->unk_18C.z, MTXMODE_NEW);
|
||||
Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY);
|
||||
Matrix_RotateYS(this->unk_1A4.y, MTXMODE_APPLY);
|
||||
Matrix_RotateXS(this->unk_1A4.x, MTXMODE_APPLY);
|
||||
Matrix_RotateZS(this->unk_1A4.z, MTXMODE_APPLY);
|
||||
Matrix_Push();
|
||||
} else if (limbIndex == OBJECT_AH_LIMB_02) {
|
||||
SubS_UpdateLimb(BINANG_ADD(this->unk_28E, 0x4000), BINANG_ADD(this->unk_290 + this->actor.shape.rot.y, 0x4000),
|
||||
&this->unk_198, &this->unk_1AA, stepRot, overrideRot);
|
||||
Matrix_Pop();
|
||||
Matrix_Translate(this->unk_198.x, this->unk_198.y, this->unk_198.z, MTXMODE_NEW);
|
||||
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
|
||||
Matrix_RotateYS(this->unk_1AA.y, MTXMODE_APPLY);
|
||||
Matrix_RotateXS(this->unk_1AA.x, MTXMODE_APPLY);
|
||||
Matrix_RotateZS(this->unk_1AA.z, MTXMODE_APPLY);
|
||||
Matrix_Push();
|
||||
}
|
||||
}
|
||||
|
||||
static TexturePtr D_80C1DE20[] = { object_ah_Tex_008D70, object_ah_Tex_009570 };
|
||||
|
||||
static TexturePtr D_80C1DE28[] = {
|
||||
object_ah_Tex_006D70, object_ah_Tex_007570, object_ah_Tex_007D70, object_ah_Tex_007570, object_ah_Tex_008570,
|
||||
};
|
||||
|
||||
void DmAh_Draw(Actor* thisx, PlayState* play) {
|
||||
DmAh* this = THIS;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
func_8012C28C(play->state.gfxCtx);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80C1DE28[this->unk_284]));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80C1DE20[0]));
|
||||
|
||||
SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable,
|
||||
this->skelAnime.dListCount, NULL, DmAh_PostLimbDraw, DmAh_TransformLimbDraw,
|
||||
&this->actor);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#define Z_DM_AH_H
|
||||
|
||||
#include "global.h"
|
||||
#include "objects/object_ah/object_ah.h"
|
||||
|
||||
struct DmAh;
|
||||
|
||||
|
|
@ -9,9 +10,27 @@ typedef void (*DmAhActionFunc)(struct DmAh*, PlayState*);
|
|||
|
||||
typedef struct DmAh {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ char unk_144[0x44];
|
||||
/* 0x144 */ SkelAnime skelAnime;
|
||||
/* 0x188 */ DmAhActionFunc actionFunc;
|
||||
/* 0x18C */ char unk_18C[0x114];
|
||||
/* 0x18C */ Vec3f unk_18C;
|
||||
/* 0x198 */ Vec3f unk_198;
|
||||
/* 0x1A4 */ Vec3s unk_1A4;
|
||||
/* 0x1AA */ Vec3s unk_1AA;
|
||||
/* 0x1B0 */ Vec3s morphTable[OBJECT_AH_LIMB_MAX];
|
||||
/* 0x216 */ Vec3s jointTable[OBJECT_AH_LIMB_MAX];
|
||||
/* 0x27C */ u16 unk_27C;
|
||||
/* 0x27E */ u8 action;
|
||||
/* 0x280 */ Actor* unk_280;
|
||||
/* 0x284 */ s16 unk_284;
|
||||
/* 0x286 */ s16 unk_286;
|
||||
/* 0x288 */ s16 unk_288;
|
||||
/* 0x28A */ s16 unk_28A;
|
||||
/* 0x28C */ s16 unk_28C;
|
||||
/* 0x28E */ s16 unk_28E;
|
||||
/* 0x290 */ s16 unk_290;
|
||||
/* 0x294 */ s32 animationIndex;
|
||||
/* 0x298 */ s32 animationIndex2;
|
||||
/* 0x29C */ s32 unk_29C;
|
||||
} DmAh; // size = 0x2A0
|
||||
|
||||
extern const ActorInit Dm_Ah_InitVars;
|
||||
|
|
|
|||
|
|
@ -16964,8 +16964,8 @@
|
|||
0x80C1D93C:("DmAh_Init",),
|
||||
0x80C1DA48:("DmAh_Destroy",),
|
||||
0x80C1DA58:("DmAh_Update",),
|
||||
0x80C1DAD4:("func_80C1DAD4",),
|
||||
0x80C1DB24:("func_80C1DB24",),
|
||||
0x80C1DAD4:("DmAh_PostLimbDraw",),
|
||||
0x80C1DB24:("DmAh_TransformLimbDraw",),
|
||||
0x80C1DCD8:("DmAh_Draw",),
|
||||
0x80C1DED0:("func_80C1DED0",),
|
||||
0x80C1DF18:("func_80C1DF18",),
|
||||
|
|
|
|||
Loading…
Reference in New Issue