From e7ba2c507d991ce6d1170f3dfa866ebdc4e74861 Mon Sep 17 00:00:00 2001 From: Tom Overton Date: Mon, 3 Jan 2022 23:10:18 -0800 Subject: [PATCH] Document stray fairy related objects (#552) --- assets/xml/objects/gameplay_keep.xml | 63 ++++++++++--------- include/variables.h | 7 --- .../actors/ovl_En_Elforg/z_en_elforg.c | 22 ++++--- .../actors/ovl_En_Elforg/z_en_elforg.h | 18 +++++- 4 files changed, 62 insertions(+), 48 deletions(-) diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml index 134cbc0e39..d8ab73a83c 100644 --- a/assets/xml/objects/gameplay_keep.xml +++ b/assets/xml/objects/gameplay_keep.xml @@ -942,36 +942,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/include/variables.h b/include/variables.h index d7ae1e7a3a..cced17fc8d 100644 --- a/include/variables.h +++ b/include/variables.h @@ -3896,13 +3896,6 @@ extern AnimationHeader D_04029140; extern Gfx D_04029CB0[]; extern Gfx D_04029CF0[]; extern UNK_TYPE D_04029D20; -extern AnimationHeader D_0402B494; -extern AnimatedMaterial D_0402C818; -extern AnimatedMaterial D_0402C890; -extern AnimatedMaterial D_0402C908; -extern AnimatedMaterial D_0402C980; -extern AnimatedMaterial D_0402C9F8; -extern FlexSkeletonHeader D_0402CA98; extern Gfx D_0402E510[]; extern AnimationHeader D_0402E65C; extern AnimationHeader D_0402F0EC; diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c index 6ca10601cd..e0970a76e3 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c @@ -5,6 +5,7 @@ */ #include "z_en_elforg.h" +#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS 0x00000010 @@ -72,7 +73,8 @@ void EnElforg_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.01f); this->flags = 0; this->direction = 0; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0402CA98, &D_0402B494, this->jointTable, this->jointTable, 10); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gStrayFairySkel, &gStrayFairyFlyingAnim, this->jointTable, + this->jointTable, STRAY_FAIRY_LIMB_MAX); this->skelAnime.playSpeed = 1.0f; ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); this->actor.shape.shadowAlpha = 255; @@ -575,13 +577,14 @@ s32 EnElforg_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi EnElforg* this = THIS; if (this->direction < 0) { - if (limbIndex == 9) { + if (limbIndex == STRAY_FAIRY_LIMB_LEFT_FACING_HEAD) { *dList = NULL; } - } else if (limbIndex == 1) { + } else if (limbIndex == STRAY_FAIRY_LIMB_RIGHT_FACING_HEAD) { *dList = NULL; } - return 0; + + return false; } void EnElforg_Draw(Actor* thisx, GlobalContext* globalCtx) { @@ -589,22 +592,23 @@ void EnElforg_Draw(Actor* thisx, GlobalContext* globalCtx) { EnElforg* this = THIS; OPEN_DISPS(globalCtx->state.gfxCtx); + func_8012C2DC(globalCtx->state.gfxCtx); switch (this->area) { case STRAY_FAIRY_AREA_WOODFALL: - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&D_0402C908)); + AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(gStrayFairyWoodfallTexAnim)); break; case STRAY_FAIRY_AREA_SNOWHEAD: - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&D_0402C890)); + AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(gStrayFairySnowheadTexAnim)); break; case STRAY_FAIRY_AREA_GREAT_BAY: - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&D_0402C980)); + AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(gStrayFairyGreatBayTexAnim)); break; case STRAY_FAIRY_AREA_STONE_TOWER: - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&D_0402C9F8)); + AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(gStrayFairyStoneTowerTexAnim)); break; default: - AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&D_0402C818)); + AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(gStrayFairyClockTownTexAnim)); break; } Matrix_InsertMatrix(&globalCtx->billboardMtxF, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.h b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.h index 5195235a31..fbf982beb4 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.h +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.h @@ -33,6 +33,20 @@ typedef enum { STRAY_FAIRY_AREA_MAX } StrayFairyArea; +typedef enum { + /* 0 */ STRAY_FAIRY_LIMB_NONE, + /* 1 */ STRAY_FAIRY_LIMB_RIGHT_FACING_HEAD, + /* 2 */ STRAY_FAIRY_LIMB_LEFT_WING, + /* 3 */ STRAY_FAIRY_LIMB_RIGHT_WING, + /* 4 */ STRAY_FAIRY_LIMB_GLOW, + /* 5 */ STRAY_FAIRY_LIMB_TORSO, + /* 6 */ STRAY_FAIRY_LIMB_RIGHT_ARM, + /* 7 */ STRAY_FAIRY_LIMB_PELVIS_AND_LEGS, + /* 8 */ STRAY_FAIRY_LIMB_LEFT_ARM, + /* 9 */ STRAY_FAIRY_LIMB_LEFT_FACING_HEAD, + /* 10 */ STRAY_FAIRY_LIMB_MAX, +} StrayFairyLimbs; + struct EnElforg; typedef void (*EnElforgActionFunc)(struct EnElforg*, GlobalContext*); @@ -40,11 +54,11 @@ typedef void (*EnElforgActionFunc)(struct EnElforg*, GlobalContext*); typedef struct EnElforg { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[10]; + /* 0x188 */ Vec3s jointTable[STRAY_FAIRY_LIMB_MAX]; /* 0x1C4 */ ColliderCylinder collider; /* 0x210 */ Actor* enemy; /* 0x214 */ u16 flags; - /* 0x216 */ s16 direction; // negative when facing left, positive when facing right + /* 0x216 */ s16 direction; // negative when facing right, positive when facing left /* 0x218 */ s16 area; /* 0x21C */ s32 timer; /* 0x220 */ s32 secondaryTimer;