diff options
| author | Derek Hensley <hensley.derek58@gmail.com> | 2022-02-19 15:27:15 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-19 23:27:15 +0000 |
| commit | f67ecbc3c222197cfdd9e63e8cc78506db06f0d4 (patch) | |
| tree | d6dc13a42c672c12bee98a1ecc7b97e814c9becf /src | |
| parent | b9496691319640dfa8071a128263d26e9e8bce80 (diff) | |
EnBba01 Ok and Documented (#667)
* Decomp Bba_01
* Doc bba01
* Document object_bba
* Remove new line
* Cleanup/rename EnHy to help differentiate it from overlays
* Adjust xml comment
* PR suggestions
* English is hard
* English is hard 2
* Add note about invalid textIds
* typo
* Fix merge
* Remove 0 defines
Diffstat (limited to 'src')
| -rw-r--r-- | src/code/z_en_hy_code.c (renamed from src/code/z_en_hy.c) | 4 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Baba/z_en_baba.c | 16 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c | 349 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h | 10 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c | 80 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h | 2 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Zo/z_en_zo.c | 66 |
7 files changed, 372 insertions, 155 deletions
diff --git a/src/code/z_en_hy.c b/src/code/z_en_hy_code.c index b99b77dae..7b17f78f2 100644 --- a/src/code/z_en_hy.c +++ b/src/code/z_en_hy_code.c @@ -3,7 +3,7 @@ * Description: Unused System for NPCs (includes animation, door interaction, blinking, pathing, and collider helpers) */ -#include "z_en_hy.h" +#include "z_en_hy_code.h" #include "overlays/actors/ovl_En_Door/z_en_door.h" #include "objects/object_aob/object_aob.h" #include "objects/object_bba/object_bba.h" @@ -18,7 +18,7 @@ static AnimationInfoS sAnimations[] = { { &object_boj_Anim_001908, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_boj_Anim_001908, 1.0f, 0, -1, ANIMMODE_LOOP, -8 }, { &object_boj_Anim_0008C0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &object_bba_Anim_005DC4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gBbaIdleHoldingBagAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_bji_Anim_000FDC, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &object_bji_Anim_000AB0, 1.0f, 0, -1, ANIMMODE_LOOP, -8 }, { &object_bji_Anim_00066C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, diff --git a/src/overlays/actors/ovl_En_Baba/z_en_baba.c b/src/overlays/actors/ovl_En_Baba/z_en_baba.c index 96864a395..149bd29ae 100644 --- a/src/overlays/actors/ovl_En_Baba/z_en_baba.c +++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.c @@ -42,12 +42,12 @@ const ActorInit En_Baba_InitVars = { }; static AnimationInfo sAnimations[] = { - { &object_bba_Anim_005DC4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &object_bba_Anim_006550, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &object_bba_Anim_006B10, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &object_bba_Anim_005154, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, - { &object_bba_Anim_0058B8, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &object_bba_Anim_004910, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, + { &gBbaIdleHoldingBagAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, + { &gBbaIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, + { &gBbaWalkingHoldingBagAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, + { &gBbaKnockedOverAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, + { &gBbaLyingDownAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, + { &gBbaWalkingAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, }; static ColliderCylinderInit sCylinderInit = { @@ -429,7 +429,7 @@ void func_80BA93AC(EnBaba* this, GlobalContext* globalCtx) { } void func_80BA9480(EnBaba* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_bba_Skel_005EF0, &object_bba_Anim_006B10, this->jointTable, + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBbaSkel, &gBbaWalkingHoldingBagAnim, this->jointTable, this->morphTable, 0x12); this->actor.draw = EnBaba_Draw; @@ -741,7 +741,7 @@ void EnBaba_Draw(Actor* thisx, GlobalContext* globalCtx) { func_8012C5B0(globalCtx->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(&object_bba_Tex_0092A0)); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gBbaEyeTex)); SkelAnime_DrawTransformFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnBaba_OverrideLimbDraw, EnBaba_PostLimbDraw, diff --git a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c index 963290504..5df543b06 100644 --- a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c +++ b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c @@ -2,9 +2,18 @@ * File: z_en_bba_01.c * Overlay: ovl_En_Bba_01 * Description: Unused Bomb Shop Lady NPC + * + * Note: This actor was probably written with OOT's object_bba's skeleton in mind, and so this actor is very bugged. + * + * The main offender is that gBbaSkel has 18 limbs, while the system used (EnHy) expects 16 (see @bug in FinishInit + * below). + * + * The draw functions also use different limbs than expected, which results in, for example, EnBba01's right arm and bag + * following the player instead of her head and torso. */ #include "z_en_bba_01.h" +#include "objects/object_bba/object_bba.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) @@ -15,12 +24,10 @@ void EnBba01_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnBba01_Update(Actor* thisx, GlobalContext* globalCtx); void EnBba01_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_809CC2F0(EnBba01* this, GlobalContext* globalCtx); -void func_809CC370(EnBba01* this, GlobalContext* globalCtx); -void func_809CC3A8(EnBba01* this, GlobalContext* globalCtx); -void func_809CC3CC(EnBba01* this, GlobalContext* globalCtx); +void EnBba01_Walk(EnHy* this, GlobalContext* globalCtx); +void EnBba01_FaceFoward(EnHy* this, GlobalContext* globalCtx); +void EnBba01_Talk(EnHy* this, GlobalContext* globalCtx); -#if 0 const ActorInit En_Bba_01_InitVars = { ACTOR_EN_BBA_01, ACTORCAT_NPC, @@ -33,84 +40,296 @@ const ActorInit En_Bba_01_InitVars = { (ActorFunc)EnBba01_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_809CCC80 = { - { COLTYPE_HIT0, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_HIT0, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK1, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 18, 64, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_809CCCAC = { 0, 0, 0, 0, MASS_IMMOVABLE }; - -// static DamageTable sDamageTable = { -static DamageTable D_809CCCB8 = { - /* Deku Nut */ DMG_ENTRY(0, 0x0), - /* Deku Stick */ DMG_ENTRY(0, 0x0), - /* Horse trample */ DMG_ENTRY(0, 0x0), - /* Explosives */ DMG_ENTRY(0, 0x0), - /* Zora boomerang */ DMG_ENTRY(0, 0x0), - /* Normal arrow */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0), - /* Hookshot */ DMG_ENTRY(0, 0x0), - /* Goron punch */ DMG_ENTRY(0, 0x0), - /* Sword */ DMG_ENTRY(0, 0x0), - /* Goron pound */ DMG_ENTRY(0, 0x0), - /* Fire arrow */ DMG_ENTRY(0, 0x0), - /* Ice arrow */ DMG_ENTRY(0, 0x0), - /* Light arrow */ DMG_ENTRY(0, 0x0), - /* Goron spikes */ DMG_ENTRY(0, 0x0), - /* Deku spin */ DMG_ENTRY(0, 0x0), - /* Deku bubble */ DMG_ENTRY(0, 0x0), - /* Deku launch */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x0), - /* Zora barrier */ DMG_ENTRY(0, 0x0), - /* Normal shield */ DMG_ENTRY(0, 0x0), - /* Light ray */ DMG_ENTRY(0, 0x0), - /* Thrown object */ DMG_ENTRY(0, 0x0), - /* Zora punch */ DMG_ENTRY(0, 0x0), - /* Spin attack */ DMG_ENTRY(0, 0x0), - /* Sword beam */ DMG_ENTRY(0, 0x0), - /* Normal Roll */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0), - /* Powder Keg */ DMG_ENTRY(0, 0x0), +static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; + +static DamageTable sDamageTable = { + /* Deku Nut */ DMG_ENTRY(0, 0), + /* Deku Stick */ DMG_ENTRY(0, 0), + /* Horse trample */ DMG_ENTRY(0, 0), + /* Explosives */ DMG_ENTRY(0, 0), + /* Zora boomerang */ DMG_ENTRY(0, 0), + /* Normal arrow */ DMG_ENTRY(0, 0), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0), + /* Hookshot */ DMG_ENTRY(0, 0), + /* Goron punch */ DMG_ENTRY(0, 0), + /* Sword */ DMG_ENTRY(0, 0), + /* Goron pound */ DMG_ENTRY(0, 0), + /* Fire arrow */ DMG_ENTRY(0, 0), + /* Ice arrow */ DMG_ENTRY(0, 0), + /* Light arrow */ DMG_ENTRY(0, 0), + /* Goron spikes */ DMG_ENTRY(0, 0), + /* Deku spin */ DMG_ENTRY(0, 0), + /* Deku bubble */ DMG_ENTRY(0, 0), + /* Deku launch */ DMG_ENTRY(0, 0), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0), + /* Zora barrier */ DMG_ENTRY(0, 0), + /* Normal shield */ DMG_ENTRY(0, 0), + /* Light ray */ DMG_ENTRY(0, 0), + /* Thrown object */ DMG_ENTRY(0, 0), + /* Zora punch */ DMG_ENTRY(0, 0), + /* Spin attack */ DMG_ENTRY(0, 0), + /* Sword beam */ DMG_ENTRY(0, 0), + /* Normal Roll */ DMG_ENTRY(0, 0), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0), + /* Unblockable */ DMG_ENTRY(0, 0), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0), + /* Powder Keg */ DMG_ENTRY(0, 0), }; -#endif +u16 D_809CCCD8[] = { 4000, 4, 1, 3, 6000, 4, 1, 6, 4000, 4, 1, 3, 6000, 4, 1, 6 }; + +void EnBba01_UpdateModel(EnBba01* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + Vec3f focus; + + EnHy_UpdateSkelAnime(&this->enHy, globalCtx); + if (func_8013D5E8(this->enHy.actor.shape.rot.y, 0x36B0, this->enHy.actor.yawTowardsPlayer)) { + focus.x = player->actor.world.pos.x; + focus.y = player->bodyPartsPos[7].y + 3.0f; + focus.z = player->actor.world.pos.z; + func_8013D2E0(&focus, &this->enHy.actor.focus.pos, &this->enHy.actor.shape.rot, &this->enHy.focusTarget, + &this->enHy.headRot, &this->enHy.torsoRot, D_809CCCD8); + } else { + Math_SmoothStepToS(&this->enHy.focusTarget.x, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->enHy.focusTarget.y, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->enHy.headRot.x, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->enHy.headRot.y, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->enHy.torsoRot.x, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->enHy.torsoRot.y, 0, 4, 0x3E8, 1); + } + SubS_FillLimbRotTables(globalCtx, this->enHy.limbRotTableY, this->enHy.limbRotTableZ, + ARRAY_COUNT(this->enHy.limbRotTableY)); + EnHy_UpdateCollider(&this->enHy, globalCtx); +} + +s32 EnBba01_TestIsTalking(EnBba01* this, GlobalContext* globalCtx) { + s32 isTalking = false; + + if (Actor_ProcessTalkRequest(&this->enHy.actor, &globalCtx->state)) { + isTalking = true; + this->enHy.textId = 0x10B9; // Invalid textId, produces empty textbox + this->enHy.tmpFocusTarget = this->enHy.focusTarget; + this->enHy.tmpHeadRot = this->enHy.headRot; + this->enHy.tmpTorsoRot = this->enHy.torsoRot; + this->enHy.tmpActionFunc = this->enHy.actionFunc; + this->enHy.actionFunc = EnBba01_Talk; + } + return isTalking; +} + +s32 func_809CC270(EnBba01* this, GlobalContext* globalCtx) { + s16 x; + s16 y; + + Actor_GetScreenPos(globalCtx, &this->enHy.actor, &x, &y); + //! @bug: Both x and y conditionals are always true, || should be an && + if (!this->enHy.waitingOnInit && ((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT))) { + func_800B85E0(&this->enHy.actor, globalCtx, 30.0f, EXCH_ITEM_2E); + } + return true; +} + +void EnBba01_FinishInit(EnHy* this, GlobalContext* globalCtx) { + //! @bug: gBbaSkel does not match EnHy's skeleton assumptions. + //! Since gBbaSkel has more limbs than expected, joint and morph tables will overflow + if (EnHy_Init(this, globalCtx, &gBbaSkel, ENHY_ANIMATION_BBA_6)) { + this->actor.flags |= ACTOR_FLAG_1; + this->actor.draw = EnBba01_Draw; + this->waitingOnInit = false; + if (ENBBA01_GET_PATH(&this->actor) == ENBBA01_NO_PATH) { + this->actionFunc = EnBba01_FaceFoward; + } else { + this->actionFunc = EnBba01_Walk; + } + } +} + +void EnBba01_Walk(EnHy* this, GlobalContext* globalCtx) { + if (EnHy_MoveForwards(this, 1.0f)) { + this->curPoint = 0; + } +} + +void EnBba01_FaceFoward(EnHy* this, GlobalContext* globalCtx) { + this->actor.shape.rot = this->actor.world.rot; +} + +void EnBba01_Talk(EnHy* this, GlobalContext* globalCtx) { + s16 yaw; + u8 talkState; + + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xFA0, 1); + talkState = Message_GetState(&globalCtx->msgCtx); + this->inMsgState3 = (talkState == 3) ? true : false; + + switch (talkState) { + case 0: + yaw = ABS_ALT(this->actor.shape.rot.y - this->actor.yawTowardsPlayer); + if (yaw < 0x64) { + func_801518B0(globalCtx, this->textId, NULL); + } + break; + case 2: + this->actor.textId = 0; + this->focusTarget = this->tmpFocusTarget; + this->headRot = this->tmpHeadRot; + this->torsoRot = this->tmpTorsoRot; + this->actor.shape.rot.y = this->actor.world.rot.y; + this->actionFunc = this->tmpActionFunc; + this->tmpActionFunc = NULL; + break; + } +} + +void EnBba01_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnBba01* this = THIS; + + this->enHy.animObjIndex = func_8013D924(OBJECT_BBA, globalCtx); + this->enHy.headObjIndex = func_8013D924(OBJECT_BBA, globalCtx); + this->enHy.skelUpperObjIndex = func_8013D924(OBJECT_BBA, globalCtx); + this->enHy.skelLowerObjIndex = func_8013D924(OBJECT_BBA, globalCtx); + + if ((this->enHy.animObjIndex < 0) || (this->enHy.headObjIndex < 0) || (this->enHy.skelUpperObjIndex < 0) || + (this->enHy.skelLowerObjIndex < 0)) { + Actor_MarkForDeath(&this->enHy.actor); + } + this->enHy.actor.draw = NULL; + Collider_InitCylinder(globalCtx, &this->enHy.collider); + Collider_SetCylinder(globalCtx, &this->enHy.collider, &this->enHy.actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->enHy.actor.colChkInfo, &sDamageTable, &sColChkInfoInit); + this->enHy.actor.flags &= ~ACTOR_FLAG_1; + this->enHy.path = func_8013D648(globalCtx, ENBBA01_GET_PATH(&this->enHy.actor), ENBBA01_NO_PATH); + this->enHy.waitingOnInit = true; + Actor_SetScale(&this->enHy.actor, 0.01f); + this->enHy.actionFunc = EnBba01_FinishInit; +} + +void EnBba01_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnBba01* this = THIS; + + Collider_DestroyCylinder(globalCtx, &this->enHy.collider); +} + +void EnBba01_Update(Actor* thisx, GlobalContext* globalCtx) { + EnBba01* this = THIS; + + EnBba01_TestIsTalking(this, globalCtx); + this->enHy.actionFunc(&this->enHy, globalCtx); + Actor_UpdateBgCheckInfo(globalCtx, &this->enHy.actor, 0.0f, 0.0f, 0.0f, 4); + EnBba01_UpdateModel(this, globalCtx); + func_809CC270(this, globalCtx); +} -extern ColliderCylinderInit D_809CCC80; -extern CollisionCheckInfoInit2 D_809CCCAC; -extern DamageTable D_809CCCB8; +s32 EnBba01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { + EnBba01* this = THIS; + s8 bodyPart; + Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; -extern UNK_TYPE D_06005EF0; + bodyPart = gEnHyBodyParts[limbIndex]; + if (bodyPart >= 0) { + Matrix_MultiplyVector3fByState(&zeroVec, &this->enHy.bodyPartsPos[bodyPart]); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bba_01/func_809CC060.s") + if (limbIndex == BBA_LIMB_RIGHT_LOWER_ARM_ROOT) { + OPEN_DISPS(globalCtx->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->enHy.headObjIndex].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->enHy.headObjIndex].segment); + gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->enHy.skelLowerObjIndex].segment); + CLOSE_DISPS(globalCtx->state.gfxCtx); + } + if (limbIndex == BBA_LIMB_RIGHT_LOWER_ARM_ROOT) { + Matrix_InsertTranslation(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); + Matrix_InsertXRotation_s(this->enHy.headRot.y, MTXMODE_APPLY); + Matrix_InsertZRotation_s(-this->enHy.headRot.x, MTXMODE_APPLY); + Matrix_InsertTranslation(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bba_01/func_809CC1D4.s") + if (limbIndex == BBA_LIMB_BAG) { + Matrix_InsertXRotation_s(-this->enHy.torsoRot.y, MTXMODE_APPLY); + Matrix_InsertZRotation_s(-this->enHy.torsoRot.x, MTXMODE_APPLY); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bba_01/func_809CC270.s") + if ((limbIndex == BBA_LIMB_RIGHT_LOWER_ARM_ROOT) && this->enHy.inMsgState3 && + ((globalCtx->state.frames % 2) == 0)) { + Matrix_InsertTranslation(40.0f, 0.0f, 0.0f, MTXMODE_APPLY); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bba_01/func_809CC2F0.s") + if ((limbIndex == BBA_LIMB_BAG) || (limbIndex == BBA_LIMB_TORSO) || (limbIndex == BBA_LIMB_LEFT_FOREARM)) { + rot->y += (s16)(Math_SinS(this->enHy.limbRotTableY[limbIndex]) * 200.0f); + rot->z += (s16)(Math_CosS(this->enHy.limbRotTableZ[limbIndex]) * 200.0f); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bba_01/func_809CC370.s") + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bba_01/func_809CC3A8.s") +void EnBba01_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnBba01* this = THIS; + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bba_01/func_809CC3CC.s") + if (limbIndex == BBA_LIMB_HEAD) { + OPEN_DISPS(globalCtx->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->enHy.skelUpperObjIndex].segment); + gSegments[0x06] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->enHy.skelUpperObjIndex].segment); + CLOSE_DISPS(globalCtx->state.gfxCtx); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bba_01/EnBba01_Init.s") + if (limbIndex == BBA_LIMB_RIGHT_LOWER_ARM_ROOT) { + Matrix_MultiplyVector3fByState(&zeroVec, &this->enHy.actor.focus.pos); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bba_01/EnBba01_Destroy.s") +void EnBba01_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bba_01/EnBba01_Update.s") +void EnBba01_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnBba01* this = THIS; + s32 i; + u8* shadowTex = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(u8[64][64])); + u8* shadowTexIter; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bba_01/func_809CC6F0.s") + OPEN_DISPS(globalCtx->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bba_01/func_809CC984.s") + func_8012C28C(globalCtx->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(globalCtx->state.gfxCtx, 255, 255, 255, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(globalCtx->state.gfxCtx, 55, 55, 255, 0)); + gDPPipeSync(POLY_OPA_DISP++); + SkelAnime_DrawTransformFlexOpa(globalCtx, this->enHy.skelAnime.skeleton, this->enHy.skelAnime.jointTable, + this->enHy.skelAnime.dListCount, EnBba01_OverrideLimbDraw, EnBba01_PostLimbDraw, + EnBba01_TransformLimbDraw, &this->enHy.actor); + Matrix_InsertXRotation_s(0, MTXMODE_NEW); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bba_01/func_809CCA5C.s") + for (i = 0, shadowTexIter = shadowTex; i < (s32)sizeof(u8[64][64]); i++) { + *shadowTexIter++ = 0; + } + for (i = 0; i < 5; i++) { + func_8013CD64(this->enHy.bodyPartsPos, &this->enHy.actor.world.pos, shadowTex, i / 5.0f, + ARRAY_COUNT(this->enHy.bodyPartsPos), gEnHyShadowSize, gEnHyBodyPartsIndex); + } + func_8013CF04(&this->enHy.actor, &globalCtx->state.gfxCtx, shadowTex); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bba_01/EnBba01_Draw.s") + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h index 20416b4f9..b670dea01 100644 --- a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h +++ b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.h @@ -1,16 +1,18 @@ #ifndef Z_EN_BBA_01_H #define Z_EN_BBA_01_H -#include "global.h" +#include "z_en_hy_code.h" struct EnBba01; typedef void (*EnBba01ActionFunc)(struct EnBba01*, GlobalContext*); +#define ENBBA01_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9) +#define ENBBA01_NO_PATH 0x3F + typedef struct EnBba01 { - /* 0x0000 */ Actor actor; - /* 0x0144 */ EnBba01ActionFunc actionFunc; - /* 0x0148 */ char unk_148[0x4D4]; + /* 0x000 */ EnHy enHy; + /* 0x3EC */ UNK_TYPE1 unk_3EC[0x230]; } EnBba01; // size = 0x61C extern const ActorInit En_Bba_01_InitVars; diff --git a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c index 77cb0cca8..9e4ae1159 100644 --- a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c +++ b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c @@ -7,7 +7,7 @@ #include "z_en_cne_01.h" #include "objects/object_cne/object_cne.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_8 | ACTOR_FLAG_1) +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) #define THIS ((EnCne01*)thisx) @@ -20,8 +20,6 @@ void EnCne01_Walk(EnHy* this, GlobalContext* globalCtx); void EnCne01_FaceForward(EnHy* this, GlobalContext* globalCtx); void EnCne01_Talk(EnHy* this, GlobalContext* globalCtx); -typedef enum { CNE01_DMG_EFF_NONE } EnCne01DamageEffect; - const ActorInit En_Cne_01_InitVars = { ACTOR_EN_CNE_01, ACTORCAT_NPC, @@ -57,41 +55,41 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; static DamageTable sDamageTable = { - /* Deku Nut */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Deku Stick */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Horse trample */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Explosives */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Zora boomerang */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Normal arrow */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Hookshot */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Goron punch */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Sword */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Goron pound */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Fire arrow */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Ice arrow */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Light arrow */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Goron spikes */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Deku spin */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Deku bubble */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Deku launch */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* UNK_DMG_0x12 */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Zora barrier */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Normal shield */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Light ray */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Thrown object */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Zora punch */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Spin attack */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Sword beam */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Normal Roll */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Unblockable */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), - /* Powder Keg */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE), + /* Deku Nut */ DMG_ENTRY(0, 0), + /* Deku Stick */ DMG_ENTRY(0, 0), + /* Horse trample */ DMG_ENTRY(0, 0), + /* Explosives */ DMG_ENTRY(0, 0), + /* Zora boomerang */ DMG_ENTRY(0, 0), + /* Normal arrow */ DMG_ENTRY(0, 0), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0), + /* Hookshot */ DMG_ENTRY(0, 0), + /* Goron punch */ DMG_ENTRY(0, 0), + /* Sword */ DMG_ENTRY(0, 0), + /* Goron pound */ DMG_ENTRY(0, 0), + /* Fire arrow */ DMG_ENTRY(0, 0), + /* Ice arrow */ DMG_ENTRY(0, 0), + /* Light arrow */ DMG_ENTRY(0, 0), + /* Goron spikes */ DMG_ENTRY(0, 0), + /* Deku spin */ DMG_ENTRY(0, 0), + /* Deku bubble */ DMG_ENTRY(0, 0), + /* Deku launch */ DMG_ENTRY(0, 0), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0), + /* Zora barrier */ DMG_ENTRY(0, 0), + /* Normal shield */ DMG_ENTRY(0, 0), + /* Light ray */ DMG_ENTRY(0, 0), + /* Thrown object */ DMG_ENTRY(0, 0), + /* Zora punch */ DMG_ENTRY(0, 0), + /* Spin attack */ DMG_ENTRY(0, 0), + /* Sword beam */ DMG_ENTRY(0, 0), + /* Normal Roll */ DMG_ENTRY(0, 0), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0), + /* Unblockable */ DMG_ENTRY(0, 0), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0), + /* Powder Keg */ DMG_ENTRY(0, 0), }; -static u16 D_809CBF58[] = { 4000, 4, 1, 3, 6000, 4, 1, 6, 4000, 4, 1, 3, 6000, 4, 1, 6 }; +u16 D_809CBF58[] = { 4000, 4, 1, 3, 6000, 4, 1, 6, 4000, 4, 1, 3, 6000, 4, 1, 6 }; void EnCne01_UpdateModel(EnCne01* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); @@ -122,7 +120,7 @@ s32 EnCne01_TestIsTalking(EnCne01* this, GlobalContext* globalCtx) { if (Actor_ProcessTalkRequest(&this->enHy.actor, &globalCtx->state)) { isTalking = true; - this->enHy.textId = 0x10B9; + this->enHy.textId = 0x10B9; // Invalid textId, produces empty textbox this->enHy.tmpFocusTarget = this->enHy.focusTarget; this->enHy.tmpHeadRot = this->enHy.headRot; this->enHy.tmpTorsoRot = this->enHy.torsoRot; @@ -169,13 +167,13 @@ void EnCne01_FaceForward(EnHy* this, GlobalContext* globalCtx) { void EnCne01_Talk(EnHy* this, GlobalContext* globalCtx) { s16 yaw; - u8 talkstate; + u8 talkState; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xFA0, 1); - talkstate = Message_GetState(&globalCtx->msgCtx); - this->inMsgState3 = (talkstate == 3) ? true : false; + talkState = Message_GetState(&globalCtx->msgCtx); + this->inMsgState3 = (talkState == 3) ? true : false; - switch (talkstate) { + switch (talkState) { case 0: yaw = ABS_ALT(this->actor.shape.rot.y - this->actor.yawTowardsPlayer); if (yaw < 0x64) { diff --git a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h index 98e7021cf..840d1cf60 100644 --- a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h +++ b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.h @@ -1,7 +1,7 @@ #ifndef Z_EN_CNE_01_H #define Z_EN_CNE_01_H -#include "z_en_hy.h" +#include "z_en_hy_code.h" struct EnCne01; diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index 65696bb00..34bff63c2 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -20,8 +20,6 @@ void EnZo_FollowPath(EnZo* this, GlobalContext* globalCtx); void EnZo_TreadWater(EnZo* this, GlobalContext* globalCtx); void EnZo_DoNothing(EnZo* this, GlobalContext* globalCtx); -typedef enum { ZO_DMG_EFF_NONE } EnZoDamageEffect; - const ActorInit En_Zo_InitVars = { ACTOR_EN_ZO, ACTORCAT_NPC, @@ -57,38 +55,38 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; static DamageTable sDamageTable = { - /* Deku Nut */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Deku Stick */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Horse trample */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Explosives */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Zora boomerang */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Normal arrow */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Hookshot */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Goron punch */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Sword */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Goron pound */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Fire arrow */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Ice arrow */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Light arrow */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Goron spikes */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Deku spin */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Deku bubble */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Deku launch */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* UNK_DMG_0x12 */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Zora barrier */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Normal shield */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Light ray */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Thrown object */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Zora punch */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Spin attack */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Sword beam */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Normal Roll */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Unblockable */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), - /* Powder Keg */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Deku Nut */ DMG_ENTRY(0, 0), + /* Deku Stick */ DMG_ENTRY(0, 0), + /* Horse trample */ DMG_ENTRY(0, 0), + /* Explosives */ DMG_ENTRY(0, 0), + /* Zora boomerang */ DMG_ENTRY(0, 0), + /* Normal arrow */ DMG_ENTRY(0, 0), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0), + /* Hookshot */ DMG_ENTRY(0, 0), + /* Goron punch */ DMG_ENTRY(0, 0), + /* Sword */ DMG_ENTRY(0, 0), + /* Goron pound */ DMG_ENTRY(0, 0), + /* Fire arrow */ DMG_ENTRY(0, 0), + /* Ice arrow */ DMG_ENTRY(0, 0), + /* Light arrow */ DMG_ENTRY(0, 0), + /* Goron spikes */ DMG_ENTRY(0, 0), + /* Deku spin */ DMG_ENTRY(0, 0), + /* Deku bubble */ DMG_ENTRY(0, 0), + /* Deku launch */ DMG_ENTRY(0, 0), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0), + /* Zora barrier */ DMG_ENTRY(0, 0), + /* Normal shield */ DMG_ENTRY(0, 0), + /* Light ray */ DMG_ENTRY(0, 0), + /* Thrown object */ DMG_ENTRY(0, 0), + /* Zora punch */ DMG_ENTRY(0, 0), + /* Spin attack */ DMG_ENTRY(0, 0), + /* Sword beam */ DMG_ENTRY(0, 0), + /* Normal Roll */ DMG_ENTRY(0, 0), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0), + /* Unblockable */ DMG_ENTRY(0, 0), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0), + /* Powder Keg */ DMG_ENTRY(0, 0), }; static AnimationInfoS sAnimations[] = { |
