ovl_En_Dnh decompiled (#1289)

* all func except func_80A50D40

* func_80A50D40

* decompiled

* forgot an line

* improvements

* SkeletonHeader

* format

* forgot to remove wrong include

* D_80A5143C and improvements

* improvements

* added limb

* format

* forgot the header

* object_tro

* OutName fix

* improvements

* THIS upcast

* limb rename
This commit is contained in:
Nuss 2023-06-21 15:27:42 +02:00 committed by GitHub
parent 35a0f70538
commit 763830b185
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 171 additions and 29 deletions

View File

@ -1,14 +1,18 @@
<Root>
<File Name="object_tro" Segment="6">
<Animation Name="object_tro_Anim_0000A0" Offset="0xA0" />
<DList Name="object_tro_DL_0006B0" Offset="0x6B0" />
<Texture Name="object_tro_TLUT_000AE0" OutName="tlut_000AE0" Format="rgba16" Width="16" Height="16" Offset="0xAE0" />
<Texture Name="object_tro_TLUT_000CE0" OutName="tlut_000CE0" Format="rgba16" Width="16" Height="16" Offset="0xCE0" />
<Texture Name="object_tro_Tex_000EE0" OutName="tex_000EE0" Format="rgba16" Width="2" Height="8" Offset="0xEE0" />
<Texture Name="object_tro_Tex_000F00" OutName="tex_000F00" Format="ci8" Width="16" Height="8" Offset="0xF00" />
<Texture Name="object_tro_Tex_000F80" OutName="tex_000F80" Format="rgba16" Width="16" Height="8" Offset="0xF80" />
<Texture Name="object_tro_Tex_001080" OutName="tex_001080" Format="rgba16" Width="8" Height="8" Offset="0x1080" />
<Texture Name="object_tro_Tex_001100" OutName="tex_001100" Format="ci8" Width="8" Height="8" Offset="0x1100" />
<!-- <Blob Name="object_tro_Blob_001140" Size="0x1820" Offset="0x1140" /> -->
<Animation Name="gKioskKoumeHeadMoving" Offset="0xA0" />
<DList Name="gKioskKoumeDL" Offset="0x6B0" />
<Texture Name="gKioskKoumeNoseTLUT" OutName="kiosk_koume_nose_tlut" Format="rgba16" Width="16" Height="16" Offset="0xAE0" />
<Texture Name="gKioskKoumeNostrilsTLUT" OutName="kiosk_koume_nostrils_tlut" Format="rgba16" Width="16" Height="16" Offset="0xCE0" />
<Texture Name="gKioskKoumeShadowedSkinTex" OutName="kiosk_koume_shadowed_skin" Format="rgba16" Width="2" Height="8" Offset="0xEE0" />
<Texture Name="gKioskKoumeNoseTex" OutName="kiosk_koume_nose" Format="ci8" Width="16" Height="8" Offset="0xF00" />
<Texture Name="gKioskKoumeJewelHolderTex" OutName="kiosk_koume_jewel_holder" Format="rgba16" Width="16" Height="8" Offset="0xF80" />
<Texture Name="gKioskKoumeJewelTex" OutName="kiosk_koume_jewel" Format="rgba16" Width="8" Height="8" Offset="0x1080" />
<Texture Name="gKioskKoumeNostrilsTex" OutName="kiosk_koume_nostrils" Format="ci8" Width="8" Height="8" Offset="0x1100" />
<Texture Name="gKioskKoumeEyeOpenTex" OutName="kiosk_koume_eye_open" Format="rgba16" Width="32" Height="32" Offset="0x1140"/>
<Texture Name="gKioskKoumeEyeHalfTex" OutName="kiosk_koume_eye_half" Format="rgba16" Width="32" Height="32" Offset="0x1940"/>
<Texture Name="gKioskKoumeEyeClosedTex" OutName="kiosk_koume_eye_closed" Format="rgba16" Width="32" Height="32" Offset="0x2140"/>
<Limb Name="gKioskKoumeHeadLimb" Type="Standard" EnumName="KIOSK_KOUME_LIMB_HEAD" Offset="0x2940" />
<Skeleton Name="gKioskKoumeSkeleton" Type="Normal" LimbType="Standard" LimbNone="KIOSK_KOUME_LIMB_NONE" LimbMax="KIOSK_KOUME_LIMB_MAX" EnumName="KioskKoumeLimb" Offset="0x2950" />
</File>
</Root>

3
spec
View File

@ -2741,8 +2741,7 @@ beginseg
name "ovl_En_Dnh"
compress
include "build/src/overlays/actors/ovl_En_Dnh/z_en_dnh.o"
include "build/data/ovl_En_Dnh/ovl_En_Dnh.data.o"
include "build/data/ovl_En_Dnh/ovl_En_Dnh.reloc.o"
include "build/src/overlays/actors/ovl_En_Dnh/ovl_En_Dnh_reloc.o"
endseg
beginseg

View File

@ -16,9 +16,32 @@ void EnDnh_Update(Actor* thisx, PlayState* play);
void EnDnh_Draw(Actor* thisx, PlayState* play);
void func_80A50F38(EnDnh* this, PlayState* play);
void func_80A50F9C(EnDnh* this, PlayState* play);
void EnDnh_DoNothing(EnDnh* this, PlayState* play);
UNK_TYPE D_80A51250[] = {
0x000C0800, 0x080E0862, 0x0C111101, 0x10040005, 0x0E08670C, 0x10001402, 0x007A0019, 0x1000300E, 0x08590C25,
0x000D0018, 0x0F08630C, 0x12060043, 0x00001300, 0x430C0700, 0x000E088D, 0x0C190007, 0x0F088D0C, 0x19000012,
0x11191009, 0x00001000, 0x1A100016, 0x0E085A11, 0x1A100C0F, 0x085B0C0F, 0x085C0C05, 0x00060024, 0x00060E08,
0x5B19FFEE, 0x300F085E, 0x0C08000A, 0x00050F08, 0x750C1014, 0xFFF60F08, 0x600C1211, 0x19100900, 0x0010310F,
0x085F0C10, 0x00192000, 0x49001A10, 0x003D0E08, 0x68111A10, 0x0C0F0869, 0x0C0F086A, 0x0C0F086B, 0x0C0F086C,
0x0C050000, 0x00190000, 0x300E086E, 0x1119201C, 0x03201D03, 0x401D0380, 0x1D04010C, 0x12090000, 0x10310E08,
0x6D0C100E, 0x08700C19, 0xFFCB0019, 0x2000070E, 0x08710C19, 0xFFBB0E08, 0x720C0F08, 0x730C0500, 0x00001700,
0x0008000A, 0x0006320F, 0x08750C10, 0x3014FFF6, 0x001A4000, 0x0919FFA8, 0x310E0874, 0x0C100E08, 0x76111920,
0x1C03201D, 0x03401D03, 0x801D0401, 0x0C120900, 0x00100000,
};
UNK_TYPE D_80A51384[] = {
0x0E08610C,
0x16100000,
};
UNK_TYPE D_80A5138C[] = {
0x1B034000, 0x67001A40, 0x003A1B03, 0x80001A0E, 0x087C0C00, 0x5B20000A, 0x0F087E0C, 0x115B2019,
0x004E0F08, 0x7B0C1900, 0x470E087D, 0x0C120600, 0x0C000013, 0x000C0C07, 0x00000E08, 0x7E0C111A,
0x4019002C, 0x1B038000, 0x0B0E087A, 0x0C0F087B, 0x0C19001C, 0x0E08780C, 0x12060005, 0x00001300,
0x050C0700, 0x000E0879, 0x0C190004, 0x0E08770C, 0x1D03201D, 0x03401D03, 0x801D0401, 0x16100000,
};
#if 0
ActorInit En_Dnh_InitVars = {
ACTOR_EN_DNH,
ACTORCAT_NPC,
@ -31,28 +54,133 @@ ActorInit En_Dnh_InitVars = {
(ActorFunc)EnDnh_Draw,
};
#endif
static AnimationInfoS sAnimationInfo[] = {
{ &gKioskKoumeHeadMoving, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
};
extern UNK_TYPE D_06002950;
static TexturePtr sEyeTextures[] = {
gKioskKoumeEyeOpenTex,
gKioskKoumeEyeHalfTex,
gKioskKoumeEyeClosedTex,
gKioskKoumeEyeHalfTex,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/func_80A50D40.s")
s32 func_80A50D40(Actor* actor, PlayState* play) {
func_800B7298(play, actor, PLAYER_CSMODE_WAIT);
if (CHECK_EVENTINF(EVENTINF_35)) {
play->nextEntrance = ENTRANCE(SOUTHERN_SWAMP_CLEARED, 6);
} else {
play->nextEntrance = ENTRANCE(SOUTHERN_SWAMP_POISONED, 6);
}
gSaveContext.nextCutsceneIndex = 0;
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_FADE_WHITE;
gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE_SLOW;
CLEAR_WEEKEVENTREG(WEEKEVENTREG_90_40);
CLEAR_EVENTINF(EVENTINF_50);
return 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/func_80A50DF8.s")
void* func_80A50DF8(EnDnh* this, PlayState* play) {
switch (this->unk198) {
case 1:
return D_80A51384;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/func_80A50E40.s")
case 2:
return D_80A5138C;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/func_80A50EC0.s")
default:
return D_80A51250;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/func_80A50F38.s")
s32 func_80A50E40(EnDnh* this, PlayState* play) {
if (!(this->unk18C & 7) || !Actor_ProcessTalkRequest(&this->actor, &play->state)) {
return 0;
}
SubS_UpdateFlags(&this->unk18C, 0, 7);
this->msgEventScript = func_80A50DF8(this, play);
this->actionFunc = func_80A50F38;
return 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/func_80A50F9C.s")
s32 func_80A50EC0(EnDnh* this) {
if (DECR(this->blinkTimer) == 0) {
this->eyeTexIndex++;
if (this->eyeTexIndex >= ARRAY_COUNT(sEyeTextures)) {
this->blinkTimer = Rand_S16Offset(30, 30);
this->eyeTexIndex = 0;
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/EnDnh_Init.s")
void func_80A50F38(EnDnh* this, PlayState* play) {
if (func_8010BF58(&this->actor, play, this->msgEventScript, this->msgEventCallback, &this->unk194)) {
SubS_UpdateFlags(&this->unk18C, 3, 7);
this->unk194 = 0;
this->unk198 = 0;
this->actionFunc = EnDnh_DoNothing;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/EnDnh_Destroy.s")
void EnDnh_DoNothing(EnDnh* this, PlayState* play) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/EnDnh_Update.s")
void EnDnh_Init(Actor* thisx, PlayState* play) {
EnDnh* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/func_80A51168.s")
ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f);
SkelAnime_Init(play, &this->skelAnime, &gKioskKoumeSkeleton, NULL, this->jointTable, this->morphTable,
KIOSK_KOUME_LIMB_MAX);
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 0);
this->actor.shape.yOffset = 1100.0f;
if (gSaveContext.save.entrance != ENTRANCE(TOURIST_INFORMATION, 1)) {
SubS_UpdateFlags(&this->unk18C, 3, 7);
this->unk198 = 0;
} else {
SubS_UpdateFlags(&this->unk18C, 4, 7);
this->unk198 = CHECK_EVENTINF(EVENTINF_35) ? 2 : 1;
}
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_12_08)) {
this->actor.draw = NULL;
}
this->msgEventCallback = func_80A50D40;
this->unk194 = 0;
this->actionFunc = EnDnh_DoNothing;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dnh/EnDnh_Draw.s")
void EnDnh_Destroy(Actor* thisx, PlayState* play) {
}
void EnDnh_Update(Actor* thisx, PlayState* play) {
EnDnh* this = THIS;
func_80A50E40(this, play);
this->actionFunc(this, play);
func_80A50EC0(this);
SkelAnime_Update(&this->skelAnime);
func_8013C964(&this->actor, play, 60.0f, 30.0f, 0, this->unk18C & 7);
Actor_SetFocus(&this->actor, 26.0f);
}
s32 EnDnh_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnDnh* this = THIS;
if (limbIndex == KIOSK_KOUME_LIMB_HEAD) {
Matrix_Translate(0.0f, this->actor.shape.yOffset, 0.0f, MTXMODE_APPLY);
}
return false;
}
void EnDnh_Draw(Actor* thisx, PlayState* play) {
EnDnh* this = THIS;
OPEN_DISPS(play->state.gfxCtx);
Gfx_SetupDL25_Opa(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnDnh_OverrideLimbDraw, NULL,
&this->actor);
CLOSE_DISPS(play->state.gfxCtx);
}

View File

@ -2,15 +2,27 @@
#define Z_EN_DNH_H
#include "global.h"
#include "objects/object_tro/object_tro.h"
struct EnDnh;
typedef void (*EnDnhActionFunc)(struct EnDnh*, PlayState*);
typedef s32 (*MsgEventFunc)(Actor*, PlayState*);
typedef struct EnDnh {
/* 0x000 */ Actor actor;
/* 0x144 */ EnDnhActionFunc actionFunc;
/* 0x148 */ char unk_148[0x74];
/* 0x148 */ SkelAnime skelAnime;
/* 0x18C */ u16 unk18C;
/* 0x190 */ s32 msgEventScript;
/* 0x194 */ s32 unk194;
/* 0x198 */ s16 unk198;
/* 0x19A */ UNK_TYPE1 pad19A[0x2];
/* 0x19C */ s16 blinkTimer;
/* 0x19E */ s16 eyeTexIndex;
/* 0x1A0 */ MsgEventFunc msgEventCallback;
/* 0x1A4 */ Vec3s jointTable[KIOSK_KOUME_LIMB_MAX];
/* 0x1B0 */ Vec3s morphTable[KIOSK_KOUME_LIMB_MAX];
} EnDnh; // size = 0x1BC
#endif // Z_EN_DNH_H

View File

@ -2058,7 +2058,6 @@
0x801D03C8:("D_801D03C8","UNK_TYPE1","",0x1),
0x801D03E8:("D_801D03E8","UNK_TYPE1","",0x1),
0x801D03F0:("D_801D03F0","UNK_TYPE1","",0x1),
0x801D0401:("D_801D0401","UNK_TYPE1","",0x1),
0x801D0408:("D_801D0408","UNK_TYPE1","",0x1),
0x801D0428:("D_801D0428","UNK_TYPE1","",0x1),
0x801D045A:("D_801D045A","UNK_TYPE1","",0x1),