diff --git a/assets/xml/objects/object_kaizoku_obj.xml b/assets/xml/objects/object_kaizoku_obj.xml index 8dd96770a0..6a7457e1c9 100644 --- a/assets/xml/objects/object_kaizoku_obj.xml +++ b/assets/xml/objects/object_kaizoku_obj.xml @@ -2,8 +2,8 @@ - - + + diff --git a/spec b/spec index 102e2f9239..fb2204cc17 100644 --- a/spec +++ b/spec @@ -4261,8 +4261,7 @@ beginseg name "ovl_Obj_Y2lift" compress include "build/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.o" - include "build/data/ovl_Obj_Y2lift/ovl_Obj_Y2lift.data.o" - include "build/data/ovl_Obj_Y2lift/ovl_Obj_Y2lift.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Y2lift/ovl_Obj_Y2lift_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.c b/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.c index 7e9f6cb29d..14bad806cb 100644 --- a/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.c +++ b/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.c @@ -5,6 +5,7 @@ */ #include "z_obj_y2lift.h" +#include "objects/object_kaizoku_obj/object_kaizoku_obj.h" #define FLAGS (ACTOR_FLAG_10) @@ -15,7 +16,6 @@ void ObjY2lift_Destroy(Actor* thisx, GlobalContext* globalCtx); void ObjY2lift_Update(Actor* thisx, GlobalContext* globalCtx); void ObjY2lift_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 const ActorInit Obj_Y2lift_InitVars = { ACTOR_OBJ_Y2LIFT, ACTORCAT_BG, @@ -28,25 +28,68 @@ const ActorInit Obj_Y2lift_InitVars = { (ActorFunc)ObjY2lift_Draw, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80B9A940[] = { +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 800, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP), }; -#endif +void ObjY2lift_Init(Actor* thisx, GlobalContext* globalCtx) { + ObjY2lift* this = THIS; -extern InitChainEntry D_80B9A940[]; + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + DynaPolyActor_Init(&this->dyna, 1); + DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &gPirateLiftPlatformCol); +} -extern UNK_TYPE D_06001680; -extern UNK_TYPE D_060019B0; +void ObjY2lift_Destroy(Actor* thisx, GlobalContext* globalCtx) { + ObjY2lift* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Y2lift/ObjY2lift_Init.s") + DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Y2lift/ObjY2lift_Destroy.s") +void ObjY2lift_Update(Actor* thisx, GlobalContext* globalCtx) { + ObjY2lift* this = THIS; + f32 temp_fv0 = this->dyna.actor.world.pos.y; + f32 targetVelocityY = 0.0f; + s32 temp_v0 = DynaPolyActor_IsInRidingMovingState(&this->dyna); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Y2lift/ObjY2lift_Update.s") + if (temp_v0 || DynaPolyActor_IsInRidingFallingState(&this->dyna)) { + if (!this->unk15D) { + this->unk15D = true; + this->unk15F = 12; + } else if (this->unk15F == 0 && temp_v0) { + this->unk15C = 16; + } + } else { + this->unk15D = false; + } + if (DECR(this->unk15C) != 0) { + temp_fv0 = this->dyna.actor.home.pos.y + 180.0f; + targetVelocityY = 2.0f; + } else if (!temp_v0 && this->dyna.actor.velocity.y <= 0.0f) { + temp_fv0 = this->dyna.actor.home.pos.y; + targetVelocityY = -2.0f; + } + Math_StepToF(&this->dyna.actor.velocity.y, targetVelocityY, 0.1f); + this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y; + if (((this->dyna.actor.world.pos.y - temp_fv0) * targetVelocityY) >= 0.0f) { + this->dyna.actor.world.pos.y = temp_fv0; + this->dyna.actor.velocity.y = 0.0f; + if (!this->unk15E) { + this->unk15E = true; + this->unk15F = 12; + } + } else { + this->unk15E = false; + func_800B9010(&this->dyna.actor, NA_SE_EV_PLATE_LIFT_LEVEL - SFX_FLAG); + } + if (DECR(this->unk15F) != 0) { + this->dyna.actor.shape.yOffset = (2.0f * (this->unk15F & 1)) * this->unk15F; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Y2lift/ObjY2lift_Draw.s") +void ObjY2lift_Draw(Actor* thisx, GlobalContext* globalCtx) { + Gfx_DrawDListOpa(globalCtx, gPirateLiftPlatformDL); +} diff --git a/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.h b/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.h index 27bd6d9680..a26d305ae6 100644 --- a/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.h +++ b/src/overlays/actors/ovl_Obj_Y2lift/z_obj_y2lift.h @@ -6,8 +6,11 @@ struct ObjY2lift; typedef struct ObjY2lift { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x1C]; + /* 0x000 */ DynaPolyActor dyna; + /* 0x15C */ u8 unk15C; + /* 0x15D */ u8 unk15D; + /* 0x15E */ u8 unk15E; + /* 0x15F */ u8 unk15F; } ObjY2lift; // size = 0x160 extern const ActorInit Obj_Y2lift_InitVars; diff --git a/undefined_syms.txt b/undefined_syms.txt index f2f9c6af12..ebbdb298d6 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -1591,11 +1591,6 @@ D_06000098 = 0x06000098; D_06000838 = 0x06000838; D_060022AC = 0x060022AC; -// ovl_Obj_Y2lift - -D_06001680 = 0x06001680; -D_060019B0 = 0x060019B0; - // ovl_player_actor D_06008860 = 0x06008860;