From 8d2a2a8e46400686c394feaa5559e7f3f6c85a3e Mon Sep 17 00:00:00 2001 From: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> Date: Sat, 10 Apr 2021 17:25:03 +0100 Subject: [PATCH] Gerudo objects (#757) * object_ge1 * more stuff named * object_gla OK, symbols added to C * eff fire fix in gameplay_keep * object_nb OK, fixed gameplay_keep * replaced symbols in EnNb, limb enums * Change EnGeldB limb enums to hex * Use enum in header too * Add descriptions to EnGe2 and EnNb, rearrange xml * Reorder xml * review changes --- assets/xml/objects/gameplay_keep.xml | 4 +- assets/xml/objects/object_ge1.xml | 78 ++++++++++ assets/xml/objects/object_gla.xml | 85 +++++++++++ assets/xml/objects/object_nb.xml | 118 +++++++++++++++ spec | 9 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 91 +++++++----- src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 29 ++-- src/overlays/actors/ovl_En_GeldB/z_en_geldb.h | 50 +++---- src/overlays/actors/ovl_En_Nb/z_en_nb.c | 135 ++++++++---------- src/overlays/actors/ovl_En_Nb/z_en_nb.h | 27 +++- 10 files changed, 466 insertions(+), 160 deletions(-) create mode 100644 assets/xml/objects/object_ge1.xml create mode 100644 assets/xml/objects/object_gla.xml create mode 100644 assets/xml/objects/object_nb.xml diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml index e77e748483..95726e8562 100644 --- a/assets/xml/objects/gameplay_keep.xml +++ b/assets/xml/objects/gameplay_keep.xml @@ -929,8 +929,8 @@ - - + + diff --git a/assets/xml/objects/object_ge1.xml b/assets/xml/objects/object_ge1.xml new file mode 100644 index 0000000000..b5965f2124 --- /dev/null +++ b/assets/xml/objects/object_ge1.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gla.xml b/assets/xml/objects/object_gla.xml new file mode 100644 index 0000000000..36d26d6a40 --- /dev/null +++ b/assets/xml/objects/object_gla.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_nb.xml b/assets/xml/objects/object_nb.xml new file mode 100644 index 0000000000..a957c751bd --- /dev/null +++ b/assets/xml/objects/object_nb.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spec b/spec index 44eb8ee5af..9dce393073 100644 --- a/spec +++ b/spec @@ -4467,7 +4467,8 @@ endseg beginseg name "object_nb" romalign 0x1000 - include "build/baserom/object_nb.o" + include "build/assets/objects/object_nb/object_nb.o" + number 6 endseg beginseg @@ -5089,7 +5090,8 @@ endseg beginseg name "object_ge1" romalign 0x1000 - include "build/baserom/object_ge1.o" + include "build/assets/objects/object_ge1/object_ge1.o" + number 6 endseg beginseg @@ -5594,7 +5596,8 @@ endseg beginseg name "object_gla" romalign 0x1000 - include "build/baserom/object_gla.o" + include "build/assets/objects/object_gla/object_gla.o" + number 6 endseg beginseg diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index 905e248969..d35c00ab63 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -1,5 +1,12 @@ +/* + * File: z_en_ge1.c + * Overlay: ovl_En_Ge1 + * Description: White-clothed Gerudo + */ + #include "z_en_ge1.h" #include "vt.h" +#include "objects/object_ge1/object_ge1.h" #define FLAGS 0x00000009 @@ -13,7 +20,7 @@ typedef enum { /* 00 */ GE1_HAIR_BOB, /* 01 */ GE1_HAIR_STRAIGHT, - /* 02 */ GE1_HAIR_SPIKEY + /* 02 */ GE1_HAIR_SPIKY } EnGe1Hairstyle; void EnGe1_Init(Actor* thisx, GlobalContext* globalCtx); @@ -67,36 +74,31 @@ static ColliderCylinderInit sCylinderInit = { }; static Gfx* sHairstyleDLists[] = { - 0x06009198, // Bob - 0x06009430, // Straight with fringe - 0x06009690, // Spikey + gGerudoWhiteHairstyleBobDL, + gGerudoWhiteHairstyleStraightFringeDL, + gGerudoWhiteHairstyleSpikyDL, }; static Vec3f D_80A327A8 = { 600.0f, 700.0f, 0.0f }; static u64* sEyeTextures[] = { - 0x06000708, // Mostly Open - 0x06000F08, // Half - 0x06001708, // Closed + gGerudoWhiteEyeOpenTex, + gGerudoWhiteEyeHalfTex, + gGerudoWhiteEyeClosedTex, }; -extern AnimationHeader D_06000228; // Idle, arms crossed -extern FlexSkeletonHeader D_06000330; -extern AnimationHeader D_0600A048; // Clap -extern AnimationHeader D_0600A498; // Dismissive gesture - void EnGe1_Init(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnGe1* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06000330, &D_06000228, this->jointTable, this->morphTable, - GE1_LIMB_MAX); - Animation_PlayOnce(&this->skelAnime, &D_06000228); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGerudoWhiteSkel, &gGerudoWhiteIdleAnim, this->jointTable, + this->morphTable, GE1_LIMB_MAX); + Animation_PlayOnce(&this->skelAnime, &gGerudoWhiteIdleAnim); Collider_InitCylinder(globalCtx, &this->collider); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->animation = &D_06000228; + this->animation = &gGerudoWhiteIdleAnim; this->animFunc = EnGe1_CueUpAnimation; this->actor.targetMode = 6; Actor_SetScale(&this->actor, 0.01f); @@ -107,12 +109,13 @@ void EnGe1_Init(Actor* thisx, GlobalContext* globalCtx) { switch (this->actor.params & 0xFF) { case GE1_TYPE_GATE_GUARD: - this->hairstyle = GE1_HAIR_SPIKEY; + this->hairstyle = GE1_HAIR_SPIKY; this->actionFunc = EnGe1_GetReaction_GateGuard; break; case GE1_TYPE_GATE_OPERATOR: this->hairstyle = GE1_HAIR_STRAIGHT; + if (EnGe1_CheckCarpentersFreed()) { this->actionFunc = EnGe1_CheckGate_GateOp; } else { @@ -122,6 +125,7 @@ void EnGe1_Init(Actor* thisx, GlobalContext* globalCtx) { case GE1_TYPE_NORMAL: this->hairstyle = GE1_HAIR_STRAIGHT; + if (EnGe1_CheckCarpentersFreed()) { this->actionFunc = EnGe1_SetNormalText; } else { @@ -169,6 +173,7 @@ void EnGe1_Init(Actor* thisx, GlobalContext* globalCtx) { } break; } + this->stateFlags = 0; } @@ -183,23 +188,25 @@ s32 EnGe1_SetTalkAction(EnGe1* this, GlobalContext* globalCtx, u16 textId, f32 a this->actionFunc = actionFunc; this->animFunc = EnGe1_StopFidget; this->stateFlags &= ~GE1_STATE_IDLE_ANIM; - this->animation = &D_06000228; - Animation_Change(&this->skelAnime, &D_06000228, 1.0f, 0.0f, Animation_GetLastFrame(&D_06000228), ANIMMODE_ONCE, - -8.0f); + this->animation = &gGerudoWhiteIdleAnim; + Animation_Change(&this->skelAnime, &gGerudoWhiteIdleAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gGerudoWhiteIdleAnim), ANIMMODE_ONCE, -8.0f); return true; } + this->actor.textId = textId; if (this->actor.xzDistToPlayer < arg3) { func_8002F2CC(&this->actor, globalCtx, arg3); } + return false; } void EnGe1_SetAnimationIdle(EnGe1* this) { - Animation_Change(&this->skelAnime, &D_06000228, -1.0f, Animation_GetLastFrame(&D_06000228), 0.0f, ANIMMODE_ONCE, - 8.0f); - this->animation = &D_06000228; + Animation_Change(&this->skelAnime, &gGerudoWhiteIdleAnim, -1.0f, Animation_GetLastFrame(&gGerudoWhiteIdleAnim), + 0.0f, ANIMMODE_ONCE, 8.0f); + this->animation = &gGerudoWhiteIdleAnim; this->animFunc = EnGe1_CueUpAnimation; } @@ -225,7 +232,7 @@ void EnGe1_KickPlayer(EnGe1* this, GlobalContext* globalCtx) { if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) { globalCtx->nextEntranceIndex = 0x1A5; - } else if (gSaveContext.eventChkInf[12] & 0x80) { + } else if (gSaveContext.eventChkInf[12] & 0x80) { // Caught previously globalCtx->nextEntranceIndex = 0x5F8; } else { globalCtx->nextEntranceIndex = 0x3B4; @@ -254,6 +261,7 @@ void EnGe1_WatchForPlayerFrontOnly(EnGe1* this, GlobalContext* globalCtx) { if (this->collider.base.acFlags & AC_HIT) { EnGe1_SpotPlayer(this, globalCtx); } + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } @@ -265,13 +273,16 @@ void EnGe1_ChooseActionFromTextId(EnGe1* this, GlobalContext* globalCtx) { case 0x6001: this->actionFunc = EnGe1_SetNormalText; break; + case 0x601A: case 0x6019: this->actionFunc = EnGe1_GetReaction_ValleyFloor; break; + case 0x6018: this->actionFunc = EnGe1_CheckGate_GateOp; break; + default: this->actionFunc = EnGe1_GetReaction_ValleyFloor; break; @@ -333,9 +344,9 @@ void EnGe1_Open_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { void EnGe1_SetupOpen_GTGGuard(EnGe1* this, GlobalContext* globalCtx) { if ((func_8010BDBC(&globalCtx->msgCtx) == 5) && func_80106BC8(globalCtx)) { this->actionFunc = EnGe1_Open_GTGGuard; - Animation_Change(&this->skelAnime, &D_0600A048, 1.0f, 0.0f, Animation_GetLastFrame(&D_0600A048), ANIMMODE_ONCE, - -3.0f); - this->animation = &D_0600A048; + Animation_Change(&this->skelAnime, &gGerudoWhiteClapAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gGerudoWhiteClapAnim), ANIMMODE_ONCE, -3.0f); + this->animation = &gGerudoWhiteClapAnim; this->animFunc = EnGe1_StopFidget; this->stateFlags &= ~GE1_STATE_IDLE_ANIM; } @@ -428,9 +439,9 @@ void EnGe1_SetupOpenGate_GateOp(EnGe1* this, GlobalContext* globalCtx) { if ((func_8010BDBC(&globalCtx->msgCtx) == 5) && func_80106BC8(globalCtx)) { this->actionFunc = EnGe1_OpenGate_GateOp; - Animation_Change(&this->skelAnime, &D_0600A048, 1.0f, 0.0f, Animation_GetLastFrame(&D_0600A048), ANIMMODE_ONCE, - -3.0f); - this->animation = &D_0600A048; + Animation_Change(&this->skelAnime, &gGerudoWhiteClapAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gGerudoWhiteClapAnim), ANIMMODE_ONCE, -3.0f); + this->animation = &gGerudoWhiteClapAnim; this->animFunc = EnGe1_StopFidget; this->stateFlags &= ~GE1_STATE_IDLE_ANIM; } @@ -466,9 +477,9 @@ void EnGe1_GetReaction_GateGuard(EnGe1* this, GlobalContext* globalCtx) { if (EnGe1_SetTalkAction(this, globalCtx, reactionText, 100.0f, EnGe1_Talk_GateGuard)) { this->animFunc = EnGe1_CueUpAnimation; - this->animation = &D_0600A498; - Animation_Change(&this->skelAnime, &D_0600A498, 1.0f, 0.0f, Animation_GetLastFrame(&D_0600A498), ANIMMODE_ONCE, - -8.0f); + this->animation = &gGerudoWhiteDismissiveAnim; + Animation_Change(&this->skelAnime, &gGerudoWhiteDismissiveAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gGerudoWhiteDismissiveAnim), ANIMMODE_ONCE, -8.0f); } } @@ -516,6 +527,7 @@ void EnGe1_BeginGiveItem_Archery(EnGe1* this, GlobalContext* globalCtx) { this->actor.flags &= ~0x10000; this->actionFunc = EnGe1_WaitTillItemGiven_Archery; } + if (this->stateFlags & GE1_STATE_GIVE_QUIVER) { switch (CUR_UPG_VALUE(UPG_QUIVER)) { //! @bug Asschest: the compiler inserts a default assigning *(sp+0x24) to getItemId, which is junk data left @@ -532,6 +544,7 @@ void EnGe1_BeginGiveItem_Archery(EnGe1* this, GlobalContext* globalCtx) { } else { getItemId = GI_HEART_PIECE; } + func_8002F434(&this->actor, globalCtx, getItemId, 10000.0f, 50.0f); } @@ -586,9 +599,11 @@ void EnGe1_BeginGame_Archery(EnGe1* this, GlobalContext* globalCtx) { horse->freezeTimer = 1200; } } + this->actionFunc = EnGe1_WaitDoNothing; } break; + case 1: this->actionFunc = EnGe1_Wait_Archery; func_80106CCC(globalCtx); @@ -615,11 +630,11 @@ void EnGe1_TalkNoPrize_Archery(EnGe1* this, GlobalContext* globalCtx) { void EnGe1_TalkAfterGame_Archery(EnGe1* this, GlobalContext* globalCtx) { gSaveContext.eventInf[0] &= ~0x100; LOG_NUM("z_common_data.yabusame_total", gSaveContext.minigameScore, "../z_en_ge1.c", 1110); - LOG_NUM("z_common_data.memory.information.room_inf[127][ 0 ]", gSaveContext.highScores[0], "../z_en_ge1.c", 1111); + LOG_NUM("z_common_data.memory.information.room_inf[127][ 0 ]", gSaveContext.highScores[HS_HBA], "../z_en_ge1.c", 1111); this->actor.flags |= 0x10000; - if (gSaveContext.highScores[0] < gSaveContext.minigameScore) { - gSaveContext.highScores[0] = gSaveContext.minigameScore; + if (gSaveContext.highScores[HS_HBA] < gSaveContext.minigameScore) { + gSaveContext.highScores[HS_HBA] = gSaveContext.minigameScore; } if (gSaveContext.minigameScore < 1000) { @@ -776,10 +791,12 @@ void EnGe1_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve EnGe1* this = THIS; OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ge1.c", 1419); + if (limbIndex == GE1_LIMB_HEAD) { gSPDisplayList(POLY_OPA_DISP++, sHairstyleDLists[this->hairstyle]); Matrix_MultVec3f(&D_80A327A8, &this->actor.focus.pos); } + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ge1.c", 1427); } @@ -788,9 +805,11 @@ void EnGe1_Draw(Actor* thisx, GlobalContext* globalCtx) { EnGe1* this = THIS; OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ge1.c", 1442); + func_800943C8(globalCtx->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIndex])); SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGe1_OverrideLimbDraw, EnGe1_PostLimbDraw, this); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ge1.c", 1459); } diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c index 0ec9b5ec84..9825e3394e 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -1,6 +1,12 @@ +/* + * File: z_en_ge2.c + * Overlay: ovl_En_Ge2 + * Description: Purple-clothed Gerudo + */ #include "z_en_ge2.h" #include "vt.h" +#include "objects/object_gla/object_gla.h" #define FLAGS 0x00000019 @@ -90,13 +96,9 @@ static EnGe2ActionFunc sActionFuncs[] = { }; static AnimationHeader* sAnimations[] = { - 0x06009ED4, // Walking, spear on shoulder - 0x060098AC, // Standing, looking left and right - 0x060098AC, - 0x060011F4, // Falling to ground - 0x060098AC, - 0x06008D60, // Runnng, spear in attack position - 0x060098AC, 0x060098AC, 0x060098AC, + &gGerudoPurpleWalkingAnim, &gGerudoPurpleLookingAboutAnim, &gGerudoPurpleLookingAboutAnim, + &gGerudoPurpleFallingToGroundAnim, &gGerudoPurpleLookingAboutAnim, &gGerudoPurpleChargingAnim, + &gGerudoPurpleLookingAboutAnim, &gGerudoPurpleLookingAboutAnim, &gGerudoPurpleLookingAboutAnim, }; static u8 sAnimModes[] = { @@ -104,9 +106,6 @@ static u8 sAnimModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, }; -extern FlexSkeletonHeader D_06008968; -extern AnimationHeader D_06009ED4; - void EnGe2_ChangeAction(EnGe2* this, s32 i) { this->actionFunc = sActionFuncs[i]; Animation_Change(&this->skelAnime, sAnimations[i], 1.0f, 0.0f, Animation_GetLastFrame(sAnimations[i]), @@ -119,8 +118,8 @@ void EnGe2_Init(Actor* thisx, GlobalContext* globalCtx) { EnGe2* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06008968, NULL, this->jointTable, this->morphTable, 22); - Animation_PlayLoop(&this->skelAnime, &D_06009ED4); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGerudoPurpleSkel, NULL, this->jointTable, this->morphTable, 22); + Animation_PlayLoop(&this->skelAnime, &gGerudoPurpleWalkingAnim); Collider_InitCylinder(globalCtx, &this->collider); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -644,9 +643,9 @@ void EnGe2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } static u64* sEyeTextures[] = { - 0x06004F78, // Half-open - 0x06005578, // Quarter-open - 0x06005BF8, // Closed + gGerudoPurpleEyeOpenTex, + gGerudoPurpleEyeHalfTex, + gGerudoPurpleEyeClosedTex, }; void EnGe2_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h index e5fc25d8e8..7bfd968a13 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h @@ -7,31 +7,31 @@ struct EnGeldB; typedef enum { - /* 00 */ GELDB_LIMB_NONE, - /* 01 */ GELDB_LIMB_ROOT, - /* 02 */ GELDB_LIMB_TORSO, - /* 03 */ GELDB_LIMB_NECK, - /* 04 */ GELDB_LIMB_PONYTAIL, - /* 05 */ GELDB_LIMB_VEIL, - /* 06 */ GELDB_LIMB_HEAD, - /* 07 */ GELDB_LIMB_R_UPPER_ARM, - /* 08 */ GELDB_LIMB_R_FOREARM, - /* 09 */ GELDB_LIMB_R_WRIST, - /* 10 */ GELDB_LIMB_R_HAND, - /* 11 */ GELDB_LIMB_R_SWORD, - /* 12 */ GELDB_LIMB_L_UPPER_ARM, - /* 13 */ GELDB_LIMB_L_FOREARM, - /* 14 */ GELDB_LIMB_L_WRIST, - /* 15 */ GELDB_LIMB_L_HAND, - /* 16 */ GELDB_LIMB_L_SWORD, - /* 17 */ GELDB_LIMB_L_THIGH, - /* 18 */ GELDB_LIMB_L_SHIN, - /* 19 */ GELDB_LIMB_L_FOOT, - /* 20 */ GELDB_LIMB_R_THIGH, - /* 21 */ GELDB_LIMB_R_SHIN, - /* 22 */ GELDB_LIMB_R_FOOT, - /* 23 */ GELDB_LIMB_WAIST, - /* 24 */ GELDB_LIMB_MAX + /* 0x00 */ GELDB_LIMB_NONE, + /* 0x01 */ GELDB_LIMB_ROOT, + /* 0x02 */ GELDB_LIMB_TORSO, + /* 0x03 */ GELDB_LIMB_NECK, + /* 0x04 */ GELDB_LIMB_PONYTAIL, + /* 0x05 */ GELDB_LIMB_VEIL, + /* 0x06 */ GELDB_LIMB_HEAD, + /* 0x07 */ GELDB_LIMB_R_UPPER_ARM, + /* 0x08 */ GELDB_LIMB_R_FOREARM, + /* 0x09 */ GELDB_LIMB_R_WRIST, + /* 0x0A */ GELDB_LIMB_R_HAND, + /* 0x0B */ GELDB_LIMB_R_SWORD, + /* 0x0C */ GELDB_LIMB_L_UPPER_ARM, + /* 0x0D */ GELDB_LIMB_L_FOREARM, + /* 0x0E */ GELDB_LIMB_L_WRIST, + /* 0x0F */ GELDB_LIMB_L_HAND, + /* 0x10 */ GELDB_LIMB_L_SWORD, + /* 0x11 */ GELDB_LIMB_L_THIGH, + /* 0x12 */ GELDB_LIMB_L_SHIN, + /* 0x13 */ GELDB_LIMB_L_FOOT, + /* 0x14 */ GELDB_LIMB_R_THIGH, + /* 0x15 */ GELDB_LIMB_R_SHIN, + /* 0x16 */ GELDB_LIMB_R_FOOT, + /* 0x17 */ GELDB_LIMB_WAIST, + /* 0x18 */ GELDB_LIMB_MAX } EnGeldBLimb; typedef void (*EnGeldBActionFunc)(struct EnGeldB*, GlobalContext*); diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index 430007e15d..be6a79c343 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -1,5 +1,12 @@ +/* + * File: z_en_nb.c + * Overlay: ovl_En_Nb + * Description: Nabooru + */ + #include "z_en_nb.h" #include "vt.h" +#include "objects/object_nb/object_nb.h" #define FLAGS 0x00000010 @@ -52,32 +59,6 @@ void EnNb_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnNb_Update(Actor* thisx, GlobalContext* globalCtx); void EnNb_Draw(Actor* thisx, GlobalContext* globalCtx); -extern FlexSkeletonHeader D_060181C8; -extern AnimationHeader D_06004BB4; // standing up hands on hips -extern AnimationHeader D_06006E78; -extern AnimationHeader D_06004E60; // getting up from crawlspace -extern AnimationHeader D_06004BB4; -extern AnimationHeader D_06009238; -extern AnimationHeader D_06009694; // hands on hips standing -extern AnimationHeader D_0600274C; // raising both arms up transition (giving medallion to link ?) -extern AnimationHeader D_06002B4C; // raising both arms up stable (giving medallion to link ?) -extern AnimationHeader D_06000410; // clasping hands together -extern AnimationHeader D_06001E7C; // looking around ? -extern AnimationHeader D_06001350; // i think this is the animation where she is in the purple thing -extern AnimationHeader D_06001104; // transition to raising arm up in purple portal -extern AnimationHeader D_06008BD0; // falls to the ground -extern AnimationHeader D_060046A8; // looking in crawlspace ? -extern AnimationHeader D_06003954; // on ground getting up ?? -extern AnimationHeader D_06004030; // looking behind her to the right -extern AnimationHeader D_06002DBC; // freaking out -extern AnimationHeader D_060035A8; // looking behind her -extern AnimationHeader D_06006320; // sees unk from behind, turns and runs -extern AnimationHeader D_06000BC0; // crossed legs -extern AnimationHeader D_06005CA4; // crossed legs, turns head and looks behind to the right -extern AnimationHeader D_06005614; // crossed legs, looking behind to the right -extern Gfx D_06013158[]; -extern UNK_TYPE D_0600D8E8; - static ColliderCylinderInitType1 sCylinderInit = { { COLTYPE_HIT0, @@ -97,10 +78,10 @@ static ColliderCylinderInitType1 sCylinderInit = { { 25, 80, 0, { 0, 0, 0 } }, }; -static UNK_PTR sEyeTextures[] = { - 0x0600B428, - 0x0600D0E8, - 0x0600D4E8, +static u64* sEyeTextures[] = { + gNabooruEyeOpenTex, + gNabooruEyeHalfTex, + gNabooruEyeClosedTex, }; static s32 D_80AB4318 = 0; @@ -322,7 +303,7 @@ void EnNb_SetCurrentAnim(EnNb* this, AnimationHeader* animation, u8 mode, f32 tr } void EnNb_SetChamberAnim(EnNb* this, GlobalContext* globalCtx) { - EnNb_SetCurrentAnim(this, &D_06009694, 0, 0, 0); + EnNb_SetCurrentAnim(this, &gNabooruStandingHandsOnHipsChamberOfSagesAnim, 0, 0, 0); this->actor.shape.yOffset = -10000.0f; } @@ -385,7 +366,7 @@ void EnNb_SetupDefaultChamberIdle(EnNb* this) { } void EnNb_SetupArmRaise(EnNb* this, GlobalContext* globalCtx) { - AnimationHeader* animation = &D_0600274C; + AnimationHeader* animation = &gNabooruRaisingArmsGivingMedallionAnim; CsCmdActorAction* csCmdNPCAction; if (globalCtx->csCtx.state != CS_STATE_IDLE) { @@ -399,7 +380,7 @@ void EnNb_SetupArmRaise(EnNb* this, GlobalContext* globalCtx) { } void EnNb_SetupRaisedArmTransition(EnNb* this, s32 animFinished) { - AnimationHeader* animation = &D_06002B4C; + AnimationHeader* animation = &gNabooruArmsRaisedGivingMedallionAnim; if (animFinished) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, @@ -466,7 +447,7 @@ void func_80AB19FC(EnNb* this, GlobalContext* globalCtx) { } void EnNb_SetupLightArrowOrSealingCs(EnNb* this, GlobalContext* globalCtx) { - EnNb_SetCurrentAnim(this, &D_06000410, 2, 0.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruPuttingHandsTogetherCastingMagicAnim, 2, 0.0f, 0); this->action = NB_ACTION_7; this->actor.shape.shadowAlpha = 0; } @@ -579,7 +560,7 @@ void EnNb_DrawTransparency(EnNb* this, GlobalContext* globalCtx) { } void EnNb_InitKidnap(EnNb* this, GlobalContext* globalCtx) { - EnNb_SetCurrentAnim(this, &D_06001E7C, 0, 0.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruTrappedInVortexPushingGroundAnim, 0, 0.0f, 0); this->action = NB_KIDNAPPED; this->actor.shape.shadowAlpha = 0; gSaveContext.eventChkInf[9] |= 0x20; @@ -627,7 +608,7 @@ void EnNb_SetupCaptureCutsceneState(EnNb* this, GlobalContext* globalCtx) { } void EnNb_SetRaisedArmCaptureAnim(EnNb* this, s32 animFinished) { - AnimationHeader* animation = &D_06001350; + AnimationHeader* animation = &gNabooruSuckedByVortexAnim; if (animFinished) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, @@ -636,7 +617,7 @@ void EnNb_SetRaisedArmCaptureAnim(EnNb* this, s32 animFinished) { } void EnNb_SetupLookAroundInKidnap(EnNb* this) { - AnimationHeader* animation = &D_06001E7C; + AnimationHeader* animation = &gNabooruTrappedInVortexPushingGroundAnim; Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, -8.0f); this->action = NB_KIDNAPPED_LOOK_AROUND; @@ -644,7 +625,7 @@ void EnNb_SetupLookAroundInKidnap(EnNb* this) { } void EnNb_SetupKidnap(EnNb* this) { - AnimationHeader* animation = &D_06001104; + AnimationHeader* animation = &gNabooruTrappedInVortexRaisingArmAnim; Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, -8.0f); this->action = NB_PORTAL_FALLTHROUGH; @@ -707,7 +688,7 @@ void EnNb_SuckedInByPortal(EnNb* this, GlobalContext* globalCtx) { } void EnNb_SetupConfrontation(EnNb* this, GlobalContext* globalCtx) { - AnimationHeader* animation = &D_06008BD0; + AnimationHeader* animation = &gNabooruCollapseFromStandingToKneelingTransitionAnim; EnNb_SetCurrentAnim(this, animation, 0, 0.0f, 0); this->action = NB_IN_CONFRONTATION; @@ -766,28 +747,28 @@ void func_80AB26C8(EnNb* this) { void func_80AB26DC(EnNb* this, GlobalContext* globalCtx) { s32 pad; - AnimationHeader* animation = &D_06008BD0; - f32 frames = Animation_GetLastFrame(animation); + AnimationHeader* animation = &gNabooruCollapseFromStandingToKneelingTransitionAnim; + f32 lastFrame = Animation_GetLastFrame(animation); EnNb_SetupCsPosRot(this, globalCtx, 1); - Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, frames, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, 0.0f); this->action = NB_ACTION_14; this->drawMode = NB_DRAW_KNEEL; this->actor.shape.shadowAlpha = 0xFF; } void EnNb_SetupKneel(EnNb* this) { - AnimationHeader* animation = &D_06008BD0; - f32 frames = Animation_GetLastFrame(animation); + AnimationHeader* animation = &gNabooruCollapseFromStandingToKneelingTransitionAnim; + f32 lastFrame = Animation_GetLastFrame(animation); - Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, frames, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, 0.0f); this->action = NB_KNEEL; this->drawMode = NB_DRAW_KNEEL; this->actor.shape.shadowAlpha = 0xFF; } void EnNb_CheckIfKneeling(EnNb* this, s32 animFinished) { - AnimationHeader* animation = &D_060046A8; + AnimationHeader* animation = &gNabooruOnAllFoursAnim; if (animFinished) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, @@ -797,17 +778,17 @@ void EnNb_CheckIfKneeling(EnNb* this, s32 animFinished) { } void EnNb_SetupLookRight(EnNb* this) { - AnimationHeader* animation = &D_06003954; - f32 frames = Animation_GetLastFrame(animation); + AnimationHeader* animation = &gNabooruOnAllFoursToOnOneKneeLookingRightTransitionAnim; + f32 lastFrame = Animation_GetLastFrame(animation); - Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, frames, ANIMMODE_ONCE, -8.0f); + Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, -8.0f); this->action = NB_LOOK_RIGHT; this->drawMode = NB_DRAW_DEFAULT; this->actor.shape.shadowAlpha = 0xFF; } void EnNb_CheckIfLookingRight(EnNb* this, s32 animFinished) { - AnimationHeader* animation = &D_06004030; + AnimationHeader* animation = &gNabooruOnOneKneeLookingRightAnim; if (animFinished) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, @@ -817,17 +798,17 @@ void EnNb_CheckIfLookingRight(EnNb* this, s32 animFinished) { } void EnNb_SetupLookLeft(EnNb* this) { - AnimationHeader* animation = &D_06002DBC; - f32 frames = Animation_GetLastFrame(animation); + AnimationHeader* animation = &gNabooruOnOneKneeTurningHeadRightToLeftTransitionAnim; + f32 lastFrame = Animation_GetLastFrame(animation); - Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, frames, ANIMMODE_ONCE, -8.0f); + Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, -8.0f); this->action = NB_LOOK_LEFT; this->drawMode = NB_DRAW_LOOK_DIRECTION; this->actor.shape.shadowAlpha = 0xFF; } void EnNb_CheckIfLookLeft(EnNb* this, s32 animFinished) { - AnimationHeader* animation = &D_060035A8; + AnimationHeader* animation = &gNabooruOnOneKneeLookingLeftAnim; if (animFinished) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, @@ -843,10 +824,10 @@ void EnNb_SetupDemo6KInConfrontation(EnNb* this, GlobalContext* globalCtx, s32 a } void EnNb_SetupRun(EnNb* this) { - AnimationHeader* animation = &D_06006320; - f32 frames = Animation_GetLastFrame(animation); + AnimationHeader* animation = &gNabooruKneeingToRunningToHitAnim; + f32 lastFrame = Animation_GetLastFrame(animation); - Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, frames, ANIMMODE_ONCE, -8.0f); + Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, -8.0f); this->action = NB_RUN; this->drawMode = NB_DRAW_LOOK_DIRECTION; this->actor.shape.shadowAlpha = 0xFF; @@ -975,8 +956,8 @@ void func_80AB2E70(EnNb* this, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_nb_inConfrontion.c", 572); func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(&D_0600D8E8)); - gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(&D_0600D8E8)); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(&gNabooruEyeWideTex)); + gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(&gNabooruEyeWideTex)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); SkelAnime_DrawFlexOpa(globalCtx, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, @@ -988,8 +969,8 @@ void func_80AB2E70(EnNb* this, GlobalContext* globalCtx) { s32 func_80AB2FC0(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnNb* this = THIS; - if (limbIndex == 15) { - *dList = D_06013158; + if (limbIndex == NB_LIMB_HEAD) { + *dList = gNabooruHeadMouthOpenDL; } return 0; @@ -1016,7 +997,7 @@ void func_80AB2FE4(EnNb* this, GlobalContext* globalCtx) { } void EnNb_SetupCreditsSpawn(EnNb* this, GlobalContext* globalCtx) { - EnNb_SetCurrentAnim(this, &D_06000BC0, 0, 0.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruSittingCrossLeggedAnim, 0, 0.0f, 0); this->action = NB_CREDITS_INIT; this->drawMode = NB_DRAW_NOTHING; this->actor.shape.shadowAlpha = 0; @@ -1030,7 +1011,7 @@ void EnNb_SetAlphaInCredits(EnNb* this) { if ((kREG(17) + 10.0f) <= this->alphaTimer) { this->alpha = 255; - this->actor.shape.shadowAlpha = 0xFF; + this->actor.shape.shadowAlpha = 255; } else { alpha = (*alphaTimer / (kREG(17) + 10.0f)) * 255.0f; this->alpha = alpha; @@ -1052,13 +1033,13 @@ void EnNb_SetupCreditsSit(EnNb* this) { } void EnNb_SetupCreditsHeadTurn(EnNb* this) { - EnNb_SetCurrentAnim(this, &D_06005CA4, 2, -8.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruSittingCrossLeggedTurningToLookUpRightTransitionAnim, 2, -8.0f, 0); this->action = NB_CREDITS_HEAD_TURN; } void EnNb_CheckIfLookingUp(EnNb* this, s32 animFinished) { if (animFinished) { - EnNb_SetCurrentAnim(this, &D_06005614, 0, 0.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruSittingCrossLeggedLookingUpRightAnim, 0, 0.0f, 0); } } @@ -1122,11 +1103,11 @@ void EnNb_CrawlspaceSpawnCheck(EnNb* this, GlobalContext* globalCtx) { // looking into crawlspace if (!(gSaveContext.eventChkInf[9] & 0x10)) { - EnNb_SetCurrentAnim(this, &D_06006E78, 0, 0.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruKneeingAtCrawlspaceAnim, 0, 0.0f, 0); this->action = NB_CROUCH_CRAWLSPACE; this->drawMode = NB_DRAW_DEFAULT; } else { - EnNb_SetCurrentAnim(this, &D_06004BB4, 0, 0.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruStandingHandsOnHipsAnim, 0, 0.0f, 0); this->headTurnFlag = 1; this->actor.flags |= 9; this->actor.world.pos = this->finalPos; @@ -1195,7 +1176,7 @@ void func_80AB36DC(EnNb* this, GlobalContext* globalCtx) { void EnNb_CheckNoticed(EnNb* this, GlobalContext* globalCtx) { if (EnNb_GetNoticedStatus(this, globalCtx)) { - EnNb_SetCurrentAnim(this, &D_06004E60, 2, -8.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruStandingToWalkingTransitionAnim, 2, -8.0f, 0); this->action = NB_NOTICE_PLAYER; EnNb_SetNoticeSFX(this); } @@ -1203,7 +1184,7 @@ void EnNb_CheckNoticed(EnNb* this, GlobalContext* globalCtx) { void EnNb_SetupIdleCrawlspace(EnNb* this, s32 animFinished) { if (animFinished) { - EnNb_SetCurrentAnim(this, &D_06004BB4, 0, -8.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruStandingHandsOnHipsAnim, 0, -8.0f, 0); this->headTurnFlag = 1; this->actor.flags |= 9; this->action = NB_IDLE_CRAWLSPACE; @@ -1227,7 +1208,7 @@ void func_80AB3838(EnNb* this, GlobalContext* globalCtx) { } void EnNb_SetupPathMovement(EnNb* this, GlobalContext* globalCtx) { - EnNb_SetCurrentAnim(this, &D_06004E60, 2, -8.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruStandingToWalkingTransitionAnim, 2, -8.0f, 0); gSaveContext.eventChkInf[9] |= 0x10; this->action = NB_IN_PATH; this->actor.flags &= ~9; @@ -1292,12 +1273,12 @@ void EnNb_SetTextIdAsChild(EnNb* this, GlobalContext* globalCtx) { void func_80AB3A7C(EnNb* this, GlobalContext* globalCtx, s32 animFinished) { u16 movementTimer = this->movementTimer; - if ((u16)(kREG(17) + 0x19) > movementTimer) { + if ((u16)(kREG(17) + 25) > movementTimer) { if (animFinished) { - EnNb_SetCurrentAnim(this, &D_06009238, 0, 0.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruWalkingAnim, 0, 0.0f, 0); } } else { - EnNb_SetCurrentAnim(this, &D_06004BB4, 0, -8.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruStandingHandsOnHipsAnim, 0, -8.0f, 0); this->action = NB_IDLE_AFTER_TALK; } } @@ -1443,7 +1424,7 @@ void EnNb_Init(Actor* thisx, GlobalContext* globalCtx) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); EnNb_SetupCollider(thisx, globalCtx); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_060181C8, NULL, this->jointTable, this->morphTable, 19); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gNabooruSkel, NULL, this->jointTable, this->morphTable, NB_LIMB_MAX); switch (EnNb_GetType(this)) { case NB_TYPE_DEMO02: @@ -1473,11 +1454,11 @@ s32 EnNb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, s32 ret = false; if (this->headTurnFlag != 0) { - if (limbIndex == 8) { + if (limbIndex == NB_LIMB_TORSO) { rot->x += unk_300->unk_0E.y; rot->y -= unk_300->unk_0E.x; ret = false; - } else if (limbIndex == 15) { + } else if (limbIndex == NB_LIMB_HEAD) { rot->x += unk_300->unk_08.y; rot->z += unk_300->unk_08.x; ret = false; @@ -1490,7 +1471,7 @@ s32 EnNb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, void EnNb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnNb* this = THIS; - if (limbIndex == 15) { + if (limbIndex == NB_LIMB_HEAD) { Vec3f vec1 = { 0.0f, 10.0f, 0.0f }; Vec3f vec2; diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.h b/src/overlays/actors/ovl_En_Nb/z_en_nb.h index f5e212b858..a5b35226c5 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.h +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.h @@ -6,14 +6,37 @@ struct EnNb; +typedef enum { + /* 0x00 */ NB_LIMB_NONE, + /* 0x01 */ NB_LIMB_ROOT, + /* 0x02 */ NB_LIMB_L_THIGH, + /* 0x03 */ NB_LIMB_L_SHIN, + /* 0x04 */ NB_LIMB_L_FOOT, + /* 0x05 */ NB_LIMB_R_THIGH, + /* 0x06 */ NB_LIMB_R_SHIN, + /* 0x07 */ NB_LIMB_R_FOOT, + /* 0x08 */ NB_LIMB_TORSO, + /* 0x09 */ NB_LIMB_L_UPPER_ARM, + /* 0x0A */ NB_LIMB_L_FOREARM, + /* 0x0B */ NB_LIMB_L_HAND, + /* 0x0C */ NB_LIMB_R_UPPER_ARM, + /* 0x0D */ NB_LIMB_R_FOREARM, + /* 0x0E */ NB_LIMB_R_HAND, + /* 0x0F */ NB_LIMB_HEAD, + /* 0x10 */ NB_LIMB_BLANK, + /* 0x11 */ NB_LIMB_PONYTAIL, + /* 0x12 */ NB_LIMB_WAIST, + /* 0x13 */ NB_LIMB_MAX +} EnNbLimb; + typedef void (*EnNbActionFunc)(struct EnNb*, GlobalContext*); typedef void (*EnNbDrawFunc)(struct EnNb*, GlobalContext*); typedef struct EnNb { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; - /* 0x0190 */ Vec3s jointTable[19]; - /* 0x0202 */ Vec3s morphTable[19]; + /* 0x0190 */ Vec3s jointTable[NB_LIMB_MAX]; + /* 0x0202 */ Vec3s morphTable[NB_LIMB_MAX]; /* 0x0274 */ s16 eyeIdx; /* 0x0276 */ s16 blinkTimer; /* 0x0278 */ s32 action;