mirror of
https://github.com/zeldaret/mm.git
synced 2024-11-27 06:40:36 +00:00
ovl_Dm_Char02 decompiled (#869)
* ovl_Dm_Char02 decompiled * remove m2c comments * remove ovl_Dm_Char02 data in spec * ran format.sh * fix format version * use our reloc * fix reviews * rename context/playstate structs * format * more review fixing * even more review fixing
This commit is contained in:
parent
8856e07166
commit
78a29fb17b
@ -307,6 +307,7 @@ typedef enum {
|
||||
/* 0x3D */ GI_KEY_BOSS,
|
||||
/* 0x3E */ GI_MAP,
|
||||
/* 0x3F */ GI_COMPASS,
|
||||
/* 0x4C */ GI_OCARINA = 0x4C,
|
||||
/* 0x50 */ GI_50 = 0x50,
|
||||
/* 0x52 */ GI_SCALE_GOLD = 0x52, // Assumed, used in En_Fishing
|
||||
/* 0x59 */ GI_BOTTLE_POTION_RED = 0x59,
|
||||
|
3
spec
3
spec
@ -3152,8 +3152,7 @@ beginseg
|
||||
name "ovl_Dm_Char02"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.o"
|
||||
include "build/data/ovl_Dm_Char02/ovl_Dm_Char02.data.o"
|
||||
include "build/data/ovl_Dm_Char02/ovl_Dm_Char02.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_Dm_Char02/ovl_Dm_Char02_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "z_dm_char02.h"
|
||||
#include "objects/object_stk2/object_stk2.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)
|
||||
|
||||
@ -17,7 +18,6 @@ void DmChar02_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
void func_80AAB04C(DmChar02* this, PlayState* play);
|
||||
|
||||
#if 0
|
||||
const ActorInit Dm_Char02_InitVars = {
|
||||
ACTOR_DM_CHAR02,
|
||||
ACTORCAT_ITEMACTION,
|
||||
@ -28,30 +28,148 @@ const ActorInit Dm_Char02_InitVars = {
|
||||
(ActorFunc)DmChar02_Destroy,
|
||||
(ActorFunc)DmChar02_Update,
|
||||
(ActorFunc)DmChar02_Draw,
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
static AnimationInfo sAnimations[] = {
|
||||
{ &object_stk2_Anim_00A2BC, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, 0.0f },
|
||||
{ &object_stk2_Anim_00A4C4, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, 0.0f },
|
||||
{ &object_stk2_Anim_00A6D4, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f },
|
||||
{ &object_stk2_Anim_00A104, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, 0.0f },
|
||||
};
|
||||
|
||||
extern UNK_TYPE D_0600AD68;
|
||||
void DmChar02_ChangeAnimationByInfo(SkelAnime* skelAnime, AnimationInfo* animInfo, u16 index) {
|
||||
f32 frameCount;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char02/func_80AAAE30.s")
|
||||
animInfo += index;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char02/func_80AAAECC.s")
|
||||
if (animInfo->frameCount < 0.0f) {
|
||||
frameCount = Animation_GetLastFrame(animInfo->animation);
|
||||
} else {
|
||||
frameCount = animInfo->frameCount;
|
||||
}
|
||||
Animation_Change(skelAnime, animInfo->animation, animInfo->playSpeed, animInfo->startFrame, frameCount,
|
||||
animInfo->mode, animInfo->morphFrames);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char02/func_80AAAF2C.s")
|
||||
void func_80AAAECC(Actor* actor, PlayState* play) {
|
||||
switch (play->csCtx.frames) {
|
||||
case 95:
|
||||
Actor_PlaySfxAtPos(actor, NA_SE_EV_OCARINA_BOUND_0);
|
||||
return;
|
||||
case 101:
|
||||
case 105:
|
||||
case 112:
|
||||
Actor_PlaySfxAtPos(actor, NA_SE_EV_OCARINA_BOUND_1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char02/DmChar02_Init.s")
|
||||
void func_80AAAF2C(DmChar02* this, PlayState* play) {
|
||||
if ((play->csCtx.state != 0) && (play->sceneNum == SCENE_OKUJOU) && (play->csCtx.currentCsIndex == 1)) {
|
||||
func_80AAAECC(&this->actor, play);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char02/DmChar02_Destroy.s")
|
||||
void DmChar02_Init(Actor* thisx, PlayState* play) {
|
||||
DmChar02* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char02/func_80AAB04C.s")
|
||||
if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) {
|
||||
this->animIndex = 0;
|
||||
this->actor.targetArrowOffset = 3000.0f;
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f);
|
||||
SkelAnime_InitFlex(play, &this->skelAnime, &gClockTowerOcarinaOfTimeSkel, NULL, NULL, NULL, 0);
|
||||
DmChar02_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0);
|
||||
Actor_SetScale(&this->actor, 0.01f);
|
||||
this->actionFunc = func_80AAB04C;
|
||||
} else {
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char02/DmChar02_Update.s")
|
||||
void DmChar02_Destroy(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char02/func_80AAB23C.s")
|
||||
void func_80AAB04C(DmChar02* this, PlayState* play) {
|
||||
u8 sp2F = true;
|
||||
s32 actionIndex;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char02/func_80AAB258.s")
|
||||
if (Cutscene_CheckActorAction(play, 0x83)) {
|
||||
actionIndex = Cutscene_GetActorActionIndex(play, 0x83);
|
||||
if (play->csCtx.frames == play->csCtx.actorActions[actionIndex]->startFrame) {
|
||||
switch (play->csCtx.actorActions[actionIndex]->action) {
|
||||
default:
|
||||
this->animIndex = 0;
|
||||
sp2F = false;
|
||||
break;
|
||||
case 1:
|
||||
this->animIndex = 0;
|
||||
break;
|
||||
case 2:
|
||||
this->animIndex = 1;
|
||||
break;
|
||||
case 4:
|
||||
this->animIndex = 3;
|
||||
break;
|
||||
}
|
||||
if (sp2F) {
|
||||
DmChar02_ChangeAnimationByInfo(&this->skelAnime, &sAnimations[this->animIndex], 0);
|
||||
}
|
||||
}
|
||||
Cutscene_ActorTranslateAndYaw(&this->actor, play, actionIndex);
|
||||
}
|
||||
if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
|
||||
if (this->animIndex == 1) {
|
||||
this->animIndex++;
|
||||
DmChar02_ChangeAnimationByInfo(&this->skelAnime, &sAnimations[this->animIndex], 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char02/func_80AAB270.s")
|
||||
void DmChar02_Update(Actor* thisx, PlayState* play) {
|
||||
DmChar02* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Char02/DmChar02_Draw.s")
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
this->unk2F0 = this->unk2F0;
|
||||
this->actionFunc(this, play);
|
||||
if (!Actor_HasParent(&this->actor, play)) {
|
||||
Actor_PickUp(&this->actor, play, GI_OCARINA, 30.0f, 80.0f);
|
||||
} else {
|
||||
gSaveContext.save.playerForm = PLAYER_FORM_HUMAN;
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
}
|
||||
func_80AAAF2C(this, play);
|
||||
}
|
||||
|
||||
s32 DmChar02_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void DmChar02_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
|
||||
}
|
||||
|
||||
void DmChar02_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
|
||||
}
|
||||
|
||||
void DmChar02_Draw(Actor* thisx, PlayState* play) {
|
||||
s32 pad[2];
|
||||
DmChar02* this = THIS;
|
||||
s32 sp30 = false;
|
||||
|
||||
if ((play->csCtx.state == 0) && (this->actor.world.pos.y < 100.0f)) {
|
||||
sp30 = true;
|
||||
} else if (Cutscene_CheckActorAction(play, 0x6B)) {
|
||||
switch (play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 0x6B)]->action) {
|
||||
case 0x17:
|
||||
case 0x1C:
|
||||
case 0x26:
|
||||
sp30 = true;
|
||||
}
|
||||
}
|
||||
if (sp30) {
|
||||
func_8012C28C(play->state.gfxCtx);
|
||||
SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable,
|
||||
this->skelAnime.dListCount, DmChar02_OverrideLimbDraw, DmChar02_PostLimbDraw,
|
||||
DmChar02_TransformLimbDraw, &this->actor);
|
||||
}
|
||||
}
|
||||
|
@ -8,10 +8,14 @@ struct DmChar02;
|
||||
typedef void (*DmChar02ActionFunc)(struct DmChar02*, PlayState*);
|
||||
|
||||
typedef struct DmChar02 {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x0144 */ char unk_144[0x14C];
|
||||
/* 0x0290 */ DmChar02ActionFunc actionFunc;
|
||||
/* 0x0294 */ char unk_294[0x60];
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ SkelAnime skelAnime;
|
||||
/* 0x188 */ UNK_TYPE1 pad188[0x108];
|
||||
/* 0x290 */ DmChar02ActionFunc actionFunc;
|
||||
/* 0x294 */ UNK_TYPE1 pad294[0x4C];
|
||||
/* 0x2E0 */ s16 animIndex;
|
||||
/* 0x2E2 */ UNK_TYPE1 pad2E2[0xE];
|
||||
/* 0x2F0 */ u32 unk2F0;
|
||||
} DmChar02; // size = 0x2F4
|
||||
|
||||
extern const ActorInit Dm_Char02_InitVars;
|
||||
|
@ -11547,7 +11547,7 @@
|
||||
0x80AA90F4:("func_80AA90F4",),
|
||||
0x80AA9140:("DmChar01_Update",),
|
||||
0x80AA922C:("DmChar01_Draw",),
|
||||
0x80AAAE30:("func_80AAAE30",),
|
||||
0x80AAAE30:("DmChar02_ChangeAnimationByInfo",),
|
||||
0x80AAAECC:("func_80AAAECC",),
|
||||
0x80AAAF2C:("func_80AAAF2C",),
|
||||
0x80AAAF78:("DmChar02_Init",),
|
||||
|
Loading…
Reference in New Issue
Block a user