From 204790ea8b7a701631a0e83a1ddfba5100148329 Mon Sep 17 00:00:00 2001 From: Isghj <42048411+isghj5@users.noreply.github.com> Date: Sat, 27 Mar 2021 11:23:35 -0700 Subject: [PATCH] En_Tubo_Trap (Flying Pot Enemy) (#62) * EnTuboTrap: All but one, non-matching: minor regalloc * EnTuboTrap: updates to zel's actor struct changes and cleaning * EnTuboTrap: fullgrowngaming's requested changes * EnTuboTrap: changed non-matching asm to new location * Update src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c Co-authored-by: Rozelette * Update src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c Co-authored-by: Rozelette * EnTuboTrap: moved dlist externs to segment, and objects up to top of object_script.txt * EnTuboTrap: requested changes * EnTuboTrap: Fix GLOBAL_ASM, updated to Tharo's collision * EnTuboTrap: collision enum was added * EnTuboTrap: Update sfx function name Co-authored-by: isghj8 Co-authored-by: Rozelette --- include/functions.h | 14 +- include/segment.h | 9 +- linker_scripts/code_script.txt | 2 +- linker_scripts/object_script.txt | 4 + .../actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c | 321 +++++++++++++++++- .../actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h | 11 +- 6 files changed, 337 insertions(+), 24 deletions(-) diff --git a/include/functions.h b/include/functions.h index 74ce52bb91..03213eb1d9 100644 --- a/include/functions.h +++ b/include/functions.h @@ -524,10 +524,10 @@ void EnItem00_DrawSprite(ActorEnItem00* actor, GlobalContext* ctxt); void EnItem00_DrawHeartContainer(ActorEnItem00* actor, GlobalContext* ctxt); // void EnItem00_DrawHeartPiece(void); // void func_800A7650(void); -// void func_800A7730(void); +void func_800A7730(GlobalContext* globalCtx, Vec3f* spawnPos, u32 params); // void func_800A7AD4(void); // void func_800A7D28(void); -// void func_800A8150(void); +s32 func_800A8150(s32 params); // void func_800A817C(void); // void func_800A81A4(void); // void func_800A81F0(void); @@ -633,7 +633,7 @@ void EffectSS_SpawnDust(GlobalContext* ctxt, u16 flags, Vec3f* position, Vec3f* // void EffectSS_SpawnDodongoFire(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE4 param_10); // void EffectSS_SpawnBubble(UNK_TYPE4 uParm1, Vec3f* pzParm2, UNK_TYPE4 uParm3, UNK_TYPE4 uParm4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // void EffectSS_SpawnGRipple(UNK_TYPE4 uParm1, Vec3f* pzParm2, UNK_TYPE2 uParm3, UNK_TYPE2 uParm4, UNK_TYPE2 param_5); -// void EffectSS_SpawnGSplash(UNK_TYPE4 uParm1, Vec3f* pzParm2, UNK_TYPE4* puParm3, UNK_TYPE4* puParm4, UNK_TYPE1 uParm5, UNK_TYPE2 param_6); +void EffectSS_SpawnGSplash(GlobalContext *globalCtx, Vec3f* pzParm2, ColorRGBA8* primaryCol, ColorRGBA8* envCol, s16 type, s16 scale); // void EffectSS_SpawnGFire(UNK_TYPE4 uParm1, Vec3f* pzParm2); // void EffectSS_SpawnLightning(UNK_TYPE4 uParm1, Vec3f* pzParm2, ColorRGBA8* pzParm3, ColorRGBA8* pzParm4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8); // void func_800B2090(UNK_TYPE4 param_1, Vec3f* param_2, Vec3f* param_3, Vec3f* param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8); @@ -651,7 +651,7 @@ void EffectSS_SpawnDust(GlobalContext* ctxt, u16 flags, Vec3f* position, Vec3f* // void EffectSS_SpawnPhantomGanonFlash(UNK_TYPE4 uParm1, UNK_TYPE4 uParm2, Vec3f* pzParm3, UNK_TYPE2 uParm4, UNK_TYPE1 param_5); // void EffectSS_SpawnKakarikoFire(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4, UNK_TYPE2 param_5, UNK_TYPE1 param_6); // void EffectSS_SpawnSoldierSearchBall(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4, UNK_TYPE2 param_5, UNK_TYPE4 param_6, UNK_TYPE2 param_7); -// void EffectSS_SpawnShard(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE2 param_11, UNK_TYPE2 param_12, UNK_TYPE4 param_13, UNK_TYPE2 param_14, UNK_TYPE2 param_15, UNK_TYPE4 param_16); +void EffectSS_SpawnShard(GlobalContext *globalCtx, Vec3f *pos, Vec3f *vel, Vec3f *param_4, s16 gravity, s16 param_6, s16 param_7, s16 param_8, s16 param_9, s16 param_10, s16 param_11,s16 param_12, s32 param_13, s16 param_14, s16 param_15, Gfx* dList); // void EffectSS_SpawnIcePiece(UNK_TYPE4 uParm1, Vec3f* pzParm2, UNK_TYPE4 uParm3, Vec3f* pzParm4, Vec3f* param_5, UNK_TYPE4 param_6); // void func_800B2930(void); // void EffectSS_SpawnEnemyIce(UNK_TYPE4 uParm1, Actor* pzParm2, Vec3f* pzParm3, ColorRGBA8* pzParm4, ColorRGBA8* param_5, UNK_TYPE4 param_6); @@ -869,8 +869,8 @@ void func_800BBA88(GlobalContext* ctxt, Actor* iParm2); // void func_800BBC20(void); // void func_800BBCEC(void); // void func_800BBDAC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE1 param_9); -// void func_800BBFB0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE1 param_7); -// void func_800BC154(void); +void func_800BBFB0(GlobalContext* gCtx, Vec3f* position, f32 param3, s32 param_4, s16 param_5, s16 param_6, u8 param_7); +void func_800BC154(GlobalContext* gCtx, ActorContext* actorCtx, Actor* actor, u8 actorCategory); // void func_800BC188(void); // void func_800BC1B4(void); // void func_800BC270(void); @@ -1632,7 +1632,7 @@ void EffFootmark_Draw(GlobalContext* ctxt); void func_800F0390(GlobalContext* ctxt); void func_800F03C0(GlobalContext* ctxt); void func_800F048C(GlobalContext* ctxt, Vec3f* param_2, u8 param_3, u16 param_4, u8 param_5); -// void func_800F0568(void); +void func_800F0568(GlobalContext* ctxt, Vec3f* position, s32 param_3, s16 sfxId); // void func_800F0590(void); // void func_800F05C0(void); // void func_800F07C0(void); diff --git a/include/segment.h b/include/segment.h index b8b987f4a3..39e19a6e70 100644 --- a/include/segment.h +++ b/include/segment.h @@ -3,8 +3,13 @@ #include -extern UNK_TYPE D_04029CB0; // D_04029CB0 -extern UNK_TYPE D_04029CF0; // D_04029CF0 +extern Gfx D_04029CB0[]; // D_04029CB0 +extern Gfx D_04029CF0[]; // D_04029CF0 + +//extern Gfx[] D_05018090; // pot break shard displaylist +//extern Gfx[] D_05017EA0; // pot displaylist +extern UNK_TYPE D_05018090; // pot break shard displaylist +extern UNK_TYPE D_05017EA0; // pot displaylist extern UNK_TYPE D_0E000048; extern UNK_TYPE D_0E000088; diff --git a/linker_scripts/code_script.txt b/linker_scripts/code_script.txt index 190bd61c49..7ce9752788 100644 --- a/linker_scripts/code_script.txt +++ b/linker_scripts/code_script.txt @@ -2079,7 +2079,7 @@ SECTIONS ovl_En_Tubo_Trap : AT(RomLocation) { build/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.o(.text) - build/asm/overlays/ovl_En_Tubo_Trap_data.o(.data) + build/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.o(.data) build/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.o(.rodata) build/asm/overlays/ovl_En_Tubo_Trap_rodata.o(.rodata) } diff --git a/linker_scripts/object_script.txt b/linker_scripts/object_script.txt index 4f5da03e33..aaca64d157 100644 --- a/linker_scripts/object_script.txt +++ b/linker_scripts/object_script.txt @@ -11,6 +11,9 @@ D_04062060 = 0x04062060; D_04062000 = 0x04062000; D_040622C0 = 0x040622C0; +/* gameplay_dangeon_keep */ +D_05018090 = 0x05018090; +D_05017EA0 = 0x05017EA0; D_0501D980 = 0x0501D980; D_050219E0 = 0x050219E0; @@ -66,6 +69,7 @@ D_06009120 = 0x06009120; D_06005458 = 0x06005458; D_0600788C = 0x0600788C; + /* en_ending_hero4 */ D_0600D640 = 0x0600D640; D_06002A84 = 0x06002A84; diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c index f65d638bb0..14c3377ce8 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c @@ -8,8 +8,16 @@ void EnTuboTrap_Init(Actor* thisx, GlobalContext* globalCtx); void EnTuboTrap_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnTuboTrap_Update(Actor* thisx, GlobalContext* globalCtx); void EnTuboTrap_Draw(Actor* thisx, GlobalContext* globalCtx); +void func_80931004(EnTuboTrap *this, GlobalContext *globalCtx); +void func_80931138(EnTuboTrap* this, GlobalContext* globalCtx); +void func_809311C4(EnTuboTrap* this, GlobalContext* globalCtx); + +static ColliderCylinderInit sCylinderInit = { + { COLTYPE_NONE, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_NONE, OC2_TYPE_2, COLSHAPE_CYLINDER, }, + { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, + { 11, 28, 0, { 0, 0, 0 } }, +}; -/* const ActorInit En_Tubo_Trap_InitVars = { ACTOR_EN_TUBO_TRAP, ACTORCAT_PROP, @@ -21,26 +29,315 @@ const ActorInit En_Tubo_Trap_InitVars = { (ActorFunc)EnTuboTrap_Update, (ActorFunc)EnTuboTrap_Draw }; -*/ -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Tubo_Trap_0x809307E0/EnTuboTrap_Init.asm") +static InitChainEntry sInitChain[] = { + ICHAIN_VEC3F_DIV1000(scale, 197, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneScale, 100, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_STOP), +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Tubo_Trap_0x809307E0/EnTuboTrap_Destroy.asm") +//used in WaitForProximity +s8 D_8093146C[] = { + 0x28, 0x28, 0x28, 0x19, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Tubo_Trap_0x809307E0/func_8093089C.asm") +void EnTuboTrap_Init(Actor *thisx, GlobalContext *globalCtx) { + EnTuboTrap* this = THIS; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Tubo_Trap_0x809307E0/func_809308F4.asm") + Actor_ProcessInitChain(&this->actor, sInitChain); + this->actor.shape.rot.z = 0; + this->actor.world.rot.z = 0; + Actor_SetDrawParams(&this->actor.shape, 0.0f, func_800B3FC0, 1.8f); + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + this->actionFunc = func_80931004; // idle +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Tubo_Trap_0x809307E0/func_80930B60.asm") +void EnTuboTrap_Destroy(Actor* thisx, GlobalContext *globalCtx) { + EnTuboTrap* this = THIS; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Tubo_Trap_0x809307E0/func_80930DDC.asm") + Collider_DestroyCylinder(globalCtx, &this->collider); +} +// drop collectable +void func_8093089C(EnTuboTrap *this, GlobalContext *globalCtx) { + s32 itemParam = ((this->actor.params >> 8) & 0x3F); + s32 dropCount = func_800A8150(itemParam); + + if (dropCount >= 0) { + // in OOT this is Item_DropCollectible + func_800A7730(globalCtx, + &this->actor.world, + ((this->actor.params & 0x7F) << 8) | dropCount); + } +} + +// EnTuboTrap_SpawnEffectsOnLand +void func_809308F4(EnTuboTrap *this, GlobalContext *globalCtx) { + f32 rand; + f32 sin; + f32 cos; + + Vec3f pos; + Vec3f vel; + s32 arg5; + + s16 var; + s32 i; + + Vec3f *actorPos = &this->actor.world.pos; + + for (i = 0, var = 0; i < 15; i++, var += 20000){ + sin = Math_Sins(var); + cos = Math_Coss(var); + pos.x = sin * 8.0f; + pos.y = (randZeroOne() * 5.0f) + 2.0f; + pos.z = cos * 8.0f; + + vel.x = pos.x * 0.23f; + vel.y = (randZeroOne() * 5.0f) + 2.0f; + vel.z = pos.z * 0.23f; + + pos.x += actorPos->x; + pos.y += actorPos->y; + pos.z += actorPos->z; + + rand = randZeroOne(); + if (rand < 0.2f) { + arg5 = 0x60; + }else if (rand < 0.6f){ + arg5 = 0x40; + }else { + arg5 = 0x20; + } + EffectSS_SpawnShard(globalCtx, + &pos, + &vel, + actorPos, + -0xF0, + arg5, + 0x14, + 0, + 0, + ((randZeroOne() * 85.0f) + 15.0f), + 0, + 0, + 0x3C, + -1, + GAMEPLAY_DANGEON_KEEP, + &D_05018090); + } + + func_800BBFB0(globalCtx, actorPos, 30.0f, 4, 0x14, 0x32, 0); +} + +// EnTuboTrap_SpawnEffectsInWater +void func_80930B60(EnTuboTrap *this, GlobalContext *globalCtx) { + f32 rand; + f32 sin; + f32 cos; + + Vec3f pos; + Vec3f vel; + + s16 var; + s32 arg5; + s32 i; + Vec3f *actorPos = &this->actor.world.pos; + + + pos = *actorPos; + pos.y += this->actor.yDistToWater; + + EffectSS_SpawnGSplash(globalCtx, &pos, NULL, NULL, 0, 0x190); + + for (i = 0, var = 0; i < 15; i++, var += 20000) { + sin = Math_Sins(var); + cos = Math_Coss(var); + pos.x = sin * 8.0f; + pos.y = (randZeroOne() * 5.0f) + 2.0f; + pos.z = cos * 8.0f; + + vel.x = pos.x * 0.20f; + vel.y = (randZeroOne() * 4.0f) + 2.0f; + vel.z = pos.z * 0.20f; + + pos.x += actorPos->x; + pos.y += actorPos->y; + pos.z += actorPos->z; + + rand = randZeroOne(); + if (rand < 0.2f) { + arg5 = 64; + } else { + arg5 = 32; + } + + EffectSS_SpawnShard(globalCtx, + &pos, + &vel, + actorPos, + -0xAA, + arg5, + 0x32, 5, 0, + ((randZeroOne() * 85.0f) + 15.0f), + 0, 0, 0x46, + -1, + GAMEPLAY_DANGEON_KEEP, + &D_05018090); + + } +} + +// EnTuboTrap_HandleImpact +void func_80930DDC(EnTuboTrap *this, GlobalContext *globalCtx) { + Actor *player = PLAYER; + Actor *player2 = PLAYER; + + // in oot func_800F0568 is Audio_PlaySoundAtPosition + + if (((this->actor.bgCheckFlags & 0x20) != 0) && (this->actor.yDistToWater > 15.0f)) { + func_80930B60(this, globalCtx); + func_800F0568(globalCtx, &this->actor.world, 0x28, 0x2817); + func_8093089C(this, globalCtx); + Actor_MarkForDeath(&this->actor); + return; + } + if ((this->collider.base.atFlags & AT_BOUNCED) != 0) { + this->collider.base.atFlags &= ~AT_BOUNCED; + func_809308F4(this, globalCtx); + func_800F0568(globalCtx, &this->actor.world, 0x28, 0x1808); + func_800F0568(globalCtx, &this->actor.world, 0x28, 0x2887); + func_8093089C(this, globalCtx); + Actor_MarkForDeath(&this->actor); + return; + } + if ((this->collider.base.acFlags & AC_HIT) != 0) { + this->collider.base.acFlags &= ~AC_HIT; + func_809308F4(this, globalCtx); + func_800F0568(globalCtx, &this->actor.world, 0x28, 0x2802); + func_800F0568(globalCtx, &this->actor.world, 0x28, 0x2887); + func_8093089C(this, globalCtx); + Actor_MarkForDeath(&this->actor); + return; + } + if ((this->collider.base.atFlags & AT_HIT) != 0) { + this->collider.base.atFlags &= ~AT_HIT; + if (player == this->collider.base.at) { + func_809308F4(this, globalCtx); + func_800F0568(globalCtx, &this->actor.world, 0x28, 0x2887); + func_800F0568(globalCtx, &player2->world, 0x28, 0x83E); + func_8093089C(this, globalCtx); + Actor_MarkForDeath(&this->actor); + return; + } + } + if (((this->actor.bgCheckFlags & 8) != 0) || ((this->actor.bgCheckFlags & 1) != 0)) { + func_809308F4(this, globalCtx); + func_800F0568(globalCtx, &this->actor.world, 0x28, 0x2887); + func_8093089C(this, globalCtx); + Actor_MarkForDeath(&this->actor); + } +} + +#if NON-MATCHING +// Wait For Proximity (idle) + // NON-MATCHING: wrong register used, v instead of t for the weirdValues[] pointer +void func_80931004(EnTuboTrap *this, GlobalContext *globalCtx) { + Actor *player = PLAYER; + f32 currentHeight; + s8 weirdvalue; + s16 startingRotation; + static s8 D_8093146C[] = { + 0x28, 0x28, 0x28, 0x19, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + }; + + if ((this->actor.xzDistToPlayer < 200.0f) && (this->actor.world.pos.y <= player->world.pos.y)) { + startingRotation = this->actor.home.rot.z; + if ((startingRotation == 0) || (this->actor.yDistToPlayer <= ((f32) startingRotation * 10.0f))) { + func_800BC154(globalCtx, &globalCtx->actorCtx, this, ACTORCAT_ENEMY); + currentHeight = this->actor.world.pos.y; + this->actor.flags |= 0x11; // always update and can target + + // hard to know what this value is even used for without knowing what ActorPlayer::unk14B is + // wild guess: this is player animation state, height is modified to always point at center of link model + weirdvalue = D_8093146C[ ((ActorPlayer*) player)->unk14B & 0xFF]; + + this->targetHeight = player->world.pos.y + (f32) weirdvalue; + if (this->targetHeight < currentHeight) { + this->targetHeight = currentHeight; + this->targetHeight += weirdvalue; + } + this->originPos = this->actor.world.pos; + Audio_PlayActorSound2(&this->actor, 0x28C4); + this->actionFunc = func_80931138; + } + } +} +#else #pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Tubo_Trap_0x809307E0/func_80931004.asm") +#endif -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Tubo_Trap_0x809307E0/func_80931138.asm") +// levitate +void func_80931138(EnTuboTrap *this, GlobalContext *globalCtx) { + this->actor.shape.rot.y += 5000; + Math_SmoothScaleMaxF(&this->actor.world.pos.y, this->targetHeight, 0.8f, 3.0f); -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Tubo_Trap_0x809307E0/func_809311C4.asm") + if (fabsf(this->actor.world.pos.y - this->targetHeight) < 10.0f) { + this->actor.speedXZ = 10.0f; + this->actor.world.rot.y = this->actor.yawTowardsPlayer; + this->actionFunc = func_809311C4; // flying at link + } +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Tubo_Trap_0x809307E0/EnTuboTrap_Update.asm") +// flying at link +void func_809311C4(EnTuboTrap *this, GlobalContext *globalCtx) { + f32 dX = this->originPos.x - this->actor.world.pos.x; + f32 dY = this->originPos.y - this->actor.world.pos.y; + f32 dZ = this->originPos.z - this->actor.world.pos.z; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Tubo_Trap_0x809307E0/EnTuboTrap_Draw.asm") + Audio_PlayActorSound2(&this->actor, 0x3037); + + if ((SQ(dX) + SQ(dY) + SQ(dZ) > 57600.0f)) { //240.0f ^ 2 + Math_SmoothScaleMaxF(&this->actor.gravity, -3.0f, 0.2f, 0.5f); + } + + this->actor.shape.rot.y += 5000; + func_80930DDC(this, globalCtx); // "handle impact" +} + +void EnTuboTrap_Update(Actor *thisx, GlobalContext *globalCtx) { + EnTuboTrap* this = THIS; + s32 padding; + + this->actionFunc(this, globalCtx); + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + func_800B78B8(globalCtx, &this->actor, 12.0f, 10.0f, 20.0f, 0x1F); + Actor_SetHeight(&this->actor, 0.0f); + + if (this->actor.projectedPos.z < 811.0f) { + if (this->actor.projectedPos.z > 300.0f) { + this->actor.shape.shadowAlpha = (u8) ( (0x32B - (s32) this->actor.projectedPos.z) >> 1); + this->actor.shape.shadowDraw = func_800B3FC0; + } else if (this->actor.projectedPos.z > -10.0f) { + this->actor.shape.shadowAlpha = 0xFF; + this->actor.shape.shadowDraw = func_800B3FC0; + } else{ + this->actor.shape.shadowDraw = NULL; + } + } else { + this->actor.shape.shadowDraw = NULL; + } + + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAT(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); +} + +void EnTuboTrap_Draw(Actor *thisx, GlobalContext *globalCtx) { + // Gfx_DrawDListOpa with a display list + func_800BDFC0(globalCtx, &D_05017EA0); +} diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h index 1579cbd425..34956405b3 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h @@ -5,11 +5,18 @@ struct EnTuboTrap; +typedef void (*EnTuboTrapActionFunc)(struct EnTuboTrap*, GlobalContext*); + typedef struct EnTuboTrap { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x60]; + /* 0x0000 */ Actor actor; + /* 0x0144 */ EnTuboTrapActionFunc actionFunc; + /* 0x0148 */ f32 targetHeight; + /* 0x014C */ Vec3f originPos; + /* 0x0158 */ ColliderCylinder collider; } EnTuboTrap; // size = 0x1A4 extern const ActorInit En_Tubo_Trap_InitVars; + + #endif // Z_EN_TUBO_TRAP_H