diff --git a/linker_scripts/code_script.txt b/linker_scripts/code_script.txt index b39255f0cd..19cc9eb1f7 100644 --- a/linker_scripts/code_script.txt +++ b/linker_scripts/code_script.txt @@ -8564,8 +8564,9 @@ SECTIONS ovl_En_Ending_Hero : AT(RomLocation) { build/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.o(.text) - build/asm/ovl_En_Ending_Hero_data.o(.data) - build/asm/ovl_En_Ending_Hero_rodata.o(.rodata) + build/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.o(.data) + build/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.o(.rodata) + build/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero_overlay.o(.ovl) } SegmentEnd = .; SegmentSize = SegmentEnd - SegmentStart; diff --git a/linker_scripts/object_script.txt b/linker_scripts/object_script.txt index 4740bf809b..9095150e98 100644 --- a/linker_scripts/object_script.txt +++ b/linker_scripts/object_script.txt @@ -61,3 +61,15 @@ D_0600DEF0 = 0x0600DEF0; /* arms_hook */ D_0601D960 = 0x0601D960; + +/* en_ending_hero */ +D_0600B0CC = 0x0600B0CC; +D_06000BE0 = 0x06000BE0; +D_06007350 = 0x06007350; +D_06009590 = 0x06009590; +D_06009F90 = 0x06009F90; +D_0600A790 = 0x0600A790; +D_0600AB90 = 0x0600AB90; +D_06007750 = 0x06007750; +D_0600A390 = 0x0600A390; +D_0600A490 = 0x0600A490; diff --git a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c index ad62015bab..7ce355697f 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c +++ b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.c @@ -9,7 +9,9 @@ void EnEndingHero_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnEndingHero_Update(Actor* thisx, GlobalContext* globalCtx); void EnEndingHero_Draw(Actor* thisx, GlobalContext* globalCtx); -/* +void func_80C1E748(EnEndingHero* this); +void func_80C1E764(EnEndingHero* this, GlobalContext* globalCtx); + const ActorInit En_Ending_Hero_InitVars = { ACTOR_EN_ENDING_HERO, ACTORTYPE_NPC, @@ -21,16 +23,81 @@ const ActorInit En_Ending_Hero_InitVars = { (ActorFunc)EnEndingHero_Update, (ActorFunc)EnEndingHero_Draw }; -*/ -GLOBAL_ASM("asm/non_matchings/ovl_En_Ending_Hero_0x80C1E690/EnEndingHero_Init.asm") +extern SkeletonHeader D_0600B0CC; +extern AnimationHeader D_06000BE0; +extern UNK_PTR D_06007350[]; +extern UNK_PTR D_06009590[]; +extern UNK_PTR D_06009F90[]; +extern UNK_PTR D_0600A790[]; +extern UNK_PTR D_0600AB90[]; +extern UNK_PTR D_06007750[]; +extern UNK_PTR D_0600A390[]; +extern UNK_PTR D_0600A490[]; -GLOBAL_ASM("asm/non_matchings/ovl_En_Ending_Hero_0x80C1E690/EnEndingHero_Destroy.asm") +void EnEndingHero_Init(Actor* thisx, GlobalContext* globalCtx) { + EnEndingHero* this = THIS; -GLOBAL_ASM("asm/non_matchings/ovl_En_Ending_Hero_0x80C1E690/func_80C1E748.asm") + this->actor.unkA0.mass = 0xFF; + Actor_SetScale(&this->actor, 0.01f); + this->actor.unk1F = 6; + this->actor.gravity = -3.0f; + SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600B0CC, &D_06000BE0, this->limbDrawTable, + this->transitionDrawTable, 15); + Actor_SetDrawParams(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f); + func_80C1E748(this); +} -GLOBAL_ASM("asm/non_matchings/ovl_En_Ending_Hero_0x80C1E690/func_80C1E764.asm") +void EnEndingHero_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} -GLOBAL_ASM("asm/non_matchings/ovl_En_Ending_Hero_0x80C1E690/EnEndingHero_Update.asm") +void func_80C1E748(EnEndingHero* this) { + this->unk244 = 1; + this->actionFunc = func_80C1E764; +} -GLOBAL_ASM("asm/non_matchings/ovl_En_Ending_Hero_0x80C1E690/EnEndingHero_Draw.asm") +void func_80C1E764(EnEndingHero* this, GlobalContext* globalCtx) { + SkelAnime_FrameUpdateMatrix(&this->skelAnime); +} + +void EnEndingHero_Update(Actor* thisx, GlobalContext* globalCtx) { + EnEndingHero* this = THIS; + + if (this->unk240 == 0) { + this->unk242 += 1; + if (this->unk242 > 2) { + this->unk242 = 0; + this->unk240 = (s16)randZeroOneScaled(60.0f) + 0x14; + } + } + this->actionFunc(this, globalCtx); + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + func_800B78B8(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); +} + +static UNK_PTR D_80C1E970[] = { D_06007350, D_06009590, D_06009F90, D_0600A790, D_0600AB90 }; +static UNK_PTR D_80C1E984[] = { D_06007750, D_0600A390, D_0600A490 }; + +void EnEndingHero_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnEndingHero* this = THIS; + s32 index = 0; + + { + s32 pad; + OPEN_DISPS(globalCtx->state.gfxCtx); + func_8012C28C(globalCtx->state.gfxCtx); + func_8012C2DC(globalCtx->state.gfxCtx); + + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Lib_PtrSegToVirt(D_80C1E970[this->unk242])); + + if (this->unk242 < 3) { + index = this->unk242; + } + + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, Lib_PtrSegToVirt(D_80C1E984[index])); + SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, + 0, 0, &this->actor); + + CLOSE_DISPS(globalCtx->state.gfxCtx); + } +} diff --git a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.h b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.h index 9bf4c113a1..e93107424f 100644 --- a/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.h +++ b/src/overlays/actors/ovl_En_Ending_Hero/z_en_ending_hero.h @@ -5,9 +5,17 @@ struct EnEndingHero; +typedef void (*EnEndingHeroActionFunc)(struct BgHakaCurtain*, GlobalContext*); + typedef struct EnEndingHero { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x104]; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s limbDrawTable[15]; + /* 0x1E2 */ Vec3s transitionDrawTable[15]; + /* 0x23C */ EnEndingHeroActionFunc actionFunc; + /* 0x240 */ s16 unk240; + /* 0x242 */ s16 unk242; + /* 0x244 */ u16 unk244; } EnEndingHero; // size = 0x248 extern const ActorInit En_Ending_Hero_InitVars;