diff --git a/assets/xml/objects/object_d_lift.xml b/assets/xml/objects/object_d_lift.xml
index bcd707d686..475f7fd3e6 100644
--- a/assets/xml/objects/object_d_lift.xml
+++ b/assets/xml/objects/object_d_lift.xml
@@ -3,9 +3,9 @@
-
-
-
-
+
+
+
+
diff --git a/spec b/spec
index 56e5b4b95a..4d1f0f7d80 100644
--- a/spec
+++ b/spec
@@ -1455,8 +1455,7 @@ beginseg
name "ovl_Obj_Lift"
compress
include "build/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.o"
- include "build/data/ovl_Obj_Lift/ovl_Obj_Lift.data.o"
- include "build/data/ovl_Obj_Lift/ovl_Obj_Lift.reloc.o"
+ include "build/src/overlays/actors/ovl_Obj_Lift/ovl_Obj_Lift_reloc.o"
endseg
beginseg
diff --git a/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c b/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c
index 2f82ac9035..769266e973 100644
--- a/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c
+++ b/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c
@@ -65,7 +65,7 @@ void ObjChikuwa_Init(Actor* thisx, PlayState* play) {
this->dyna.actor.scale.z = 0.05f;
DynaPolyActor_Init(&this->dyna, 0);
- DynaPolyActor_LoadMesh(play, &this->dyna, &object_d_lift_Colheader_000F00);
+ DynaPolyActor_LoadMesh(play, &this->dyna, &gDampeGraveBrownElevatorCol);
this->dyna.actor.home.rot.y += 0x2000;
this->dyna.actor.home.rot.y &= 0xC000;
@@ -210,7 +210,7 @@ void ObjChikuwa_Draw(Actor* thisx, PlayState* play) {
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_OPA_DISP++, object_d_lift_DL_000D10);
+ gSPDisplayList(POLY_OPA_DISP++, gDampeGraveBrownElevatorDL);
}
}
}
@@ -224,7 +224,7 @@ void ObjChikuwa_Draw(Actor* thisx, PlayState* play) {
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_OPA_DISP++, object_d_lift_DL_000D10);
+ gSPDisplayList(POLY_OPA_DISP++, gDampeGraveBrownElevatorDL);
}
}
}
diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c
index 28a45984ed..f7056b147b 100644
--- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c
+++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c
@@ -5,6 +5,7 @@
*/
#include "z_obj_lift.h"
+#include "objects/object_d_lift/object_d_lift.h"
#define FLAGS (ACTOR_FLAG_10)
@@ -15,7 +16,16 @@ void ObjLift_Destroy(Actor* thisx, PlayState* play);
void ObjLift_Update(Actor* thisx, PlayState* play);
void ObjLift_Draw(Actor* thisx, PlayState* play);
-#if 0
+void func_8093D760(ObjLift* this);
+void func_8093D7A0(ObjLift* this, PlayState* play);
+void func_8093D9C0(ObjLift* this);
+void func_8093D8B4(ObjLift* this, PlayState* play);
+void func_8093D88C(ObjLift* this);
+void func_8093DA48(ObjLift* this, PlayState* play);
+void func_8093DB70(ObjLift* this);
+void func_8093DB90(ObjLift* this, PlayState* play);
+void func_8093DC90(Actor* thisx, PlayState* play);
+
const ActorInit Obj_Lift_InitVars = {
ACTOR_OBJ_LIFT,
ACTORCAT_BG,
@@ -28,46 +38,207 @@ const ActorInit Obj_Lift_InitVars = {
(ActorFunc)ObjLift_Draw,
};
-// static InitChainEntry sInitChain[] = {
-static InitChainEntry D_8093DD84[] = {
- ICHAIN_F32_DIV1000(gravity, -600, ICHAIN_CONTINUE),
- ICHAIN_F32_DIV1000(terminalVelocity, -15000, ICHAIN_CONTINUE),
- ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE),
- ICHAIN_F32(uncullZoneScale, 350, ICHAIN_CONTINUE),
+static s16 D_8093DD50[] = { 0, 10, 20, 30, 40, 50, 60 };
+
+Vec2s D_8093DD60[] = {
+ { 120, -120 }, { 120, 0 }, { 120, 120 }, { 0, -120 }, { 0, 0 },
+ { 0, 120 }, { -120, -120 }, { -120, 0 }, { -120, 120 },
+};
+
+static InitChainEntry sInitChain[] = {
+ ICHAIN_F32_DIV1000(gravity, -600, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(terminalVelocity, -15000, ICHAIN_CONTINUE),
+ ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 350, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 350, ICHAIN_STOP),
};
-#endif
+static f32 D_8093DD98[] = { 0.1f, 0.05f };
-extern InitChainEntry D_8093DD84[];
+static f32 yOffsets[] = { -18.0f, -9.0f };
-extern UNK_TYPE D_06000D10;
-extern UNK_TYPE D_06000F00;
+void func_8093D3C0(ObjLift* this, PlayState* play) {
+ Vec3f pos;
+ Vec3f vel;
+ Vec3f* actorPos = &this->dyna.actor.world.pos;
+ s32 i;
+ s32 rand;
+ s32 pad;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093D3C0.s")
+ for (i = 0; i < ARRAY_COUNT(D_8093DD60); i++) {
+ pos.x = (D_8093DD60[i].x * this->dyna.actor.scale.x) + actorPos->x;
+ pos.y = actorPos->y;
+ pos.z = (D_8093DD60[i].z * this->dyna.actor.scale.z) + actorPos->z;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/ObjLift_Init.s")
+ vel.x = D_8093DD60[i].x * this->dyna.actor.scale.x * 0.8f;
+ vel.y = (Rand_ZeroOne() * 10.0f) + 6.0f;
+ vel.z = D_8093DD60[i].z * this->dyna.actor.scale.z * 0.8f;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/ObjLift_Destroy.s")
+ if ((s32)Rand_Next() > 0) {
+ rand = 0x40;
+ } else {
+ rand = 0x20;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093D760.s")
+ EffectSsKakera_Spawn(play, &pos, &vel, actorPos, -0x100, rand, 15, 15, 0,
+ ((Rand_ZeroOne() * 50.0f) + 50.0f) * this->dyna.actor.scale.x, 0, 32, 50, -1,
+ OBJECT_D_LIFT, gDampeGraveBrownElevatorDL);
+ }
+ if (OBJLIFT_GET_1(&this->dyna.actor) == 0) {
+ func_800BBFB0(play, &this->dyna.actor.world.pos, 120.0f, 12, 120, 100, 1);
+ } else if (OBJLIFT_GET_1(&this->dyna.actor) == 1) {
+ func_800BBFB0(play, &this->dyna.actor.world.pos, 60.0f, 8, 60, 100, 1);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093D7A0.s")
+void ObjLift_Init(Actor* thisx, PlayState* play) {
+ f32 temp_fv0;
+ ObjLift* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093D88C.s")
+ Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
+ this->dyna.actor.scale.x = this->dyna.actor.scale.z = D_8093DD98[OBJLIFT_GET_1(&this->dyna.actor)];
+ this->dyna.actor.scale.y = 5.0f / 90.0f;
+ this->dyna.actor.shape.rot.z = 0;
+ this->unk_178 = this->dyna.actor.home.rot.z;
+ this->dyna.actor.home.rot.z = this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z;
+ DynaPolyActor_Init(&this->dyna, 1);
+ if ((this->unk_178 <= 0) && (Flags_GetSwitch(play, OBJLIFT_GET_7F(&this->dyna.actor)))) {
+ Actor_MarkForDeath(&this->dyna.actor);
+ } else {
+ DynaPolyActor_LoadMesh(play, &this->dyna, &gDampeGraveBrownElevatorCol);
+ this->unk_160 = Rand_Next() >> 0x10;
+ this->unk_162 = Rand_Next() >> 0x10;
+ this->unk_164 = Rand_Next() >> 0x10;
+ func_8093D760(this);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093D8B4.s")
+void ObjLift_Destroy(Actor* thisx, PlayState* play) {
+ ObjLift* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093D9C0.s")
+ DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093DA48.s")
+void func_8093D760(ObjLift* this) {
+ this->timer = D_8093DD50[OBJLIFT_GET_7(&this->dyna.actor)];
+ this->actionFunc = func_8093D7A0;
+ this->dyna.actor.draw = ObjLift_Draw;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093DB70.s")
+void func_8093D7A0(ObjLift* this, PlayState* play) {
+ s32 pad;
+ s16 quake;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093DB90.s")
+ if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) {
+ if (this->timer <= 0) {
+ if (OBJLIFT_GET_7(&this->dyna.actor) == 7) {
+ func_8093D9C0(this);
+ } else {
+ quake = Quake_Add(GET_ACTIVE_CAM(play), 1);
+ Quake_SetSpeed(quake, 10000);
+ Quake_SetQuakeValues(quake, 2, 0, 0, 0);
+ Quake_SetCountdown(quake, 20);
+ func_8093D88C(this);
+ }
+ }
+ } else {
+ this->timer = D_8093DD50[OBJLIFT_GET_7(&this->dyna.actor)];
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/ObjLift_Update.s")
+void func_8093D88C(ObjLift* this) {
+ this->timer = 20;
+ this->actionFunc = func_8093D8B4;
+ this->dyna.actor.draw = func_8093DC90;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/ObjLift_Draw.s")
+void func_8093D8B4(ObjLift* this, PlayState* play) {
+ if (this->timer <= 0) {
+ func_8093D9C0(this);
+ } else {
+ this->unk_160 += 0x2710;
+ this->unk_174 = Math_SinS(this->unk_160) * 300.0f;
+ this->unk_176 = Math_CosS(this->unk_160) * 300.0f;
+ this->unk_162 += 0x4650;
+ this->unk_168.y = Math_SinS(this->unk_162);
+ this->unk_164 += 0x4650;
+ this->unk_168.x = Math_SinS(this->unk_164) * 3.0f;
+ this->unk_168.z = Math_CosS(this->unk_164) * 3.0f;
+ }
+ if ((this->timer & 3) == 3) {
+ SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 16, NA_SE_EV_BLOCK_SHAKE);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Lift/func_8093DC90.s")
+void func_8093D9C0(ObjLift* this) {
+ this->actionFunc = func_8093DA48;
+ Math_Vec3f_Copy(&this->dyna.actor.world.pos, &this->dyna.actor.home.pos);
+ this->dyna.actor.shape.rot = this->dyna.actor.world.rot = this->dyna.actor.home.rot;
+ this->dyna.actor.draw = ObjLift_Draw;
+}
+
+void func_8093DA48(ObjLift* this, PlayState* play) {
+ s32 pad;
+ s32 sp38;
+ Vec3f pos;
+
+ Actor_MoveWithGravity(&this->dyna.actor);
+ Math_Vec3f_Copy(&pos, &this->dyna.actor.prevPos);
+ pos.y += yOffsets[OBJLIFT_GET_1(&this->dyna.actor)];
+ this->dyna.actor.floorHeight =
+ BgCheck_EntityRaycastFloor5(&play->colCtx, &this->dyna.actor.floorPoly, &sp38, &this->dyna.actor, &pos);
+ if ((yOffsets[OBJLIFT_GET_1(&this->dyna.actor)] - 0.001f) <=
+ (this->dyna.actor.floorHeight - this->dyna.actor.world.pos.y)) {
+ func_8093D3C0(this, play);
+ SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 20, NA_SE_EV_BOX_BREAK);
+ if (this->unk_178 > 0) {
+ func_8093DB70(this);
+ func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId);
+ } else {
+ Flags_SetSwitch(play, OBJLIFT_GET_7F(&this->dyna.actor));
+ Actor_MarkForDeath(&this->dyna.actor);
+ }
+ }
+}
+
+void func_8093DB70(ObjLift* this) {
+ this->timer = this->unk_178;
+ this->actionFunc = func_8093DB90;
+ this->dyna.actor.draw = NULL;
+}
+
+void func_8093DB90(ObjLift* this, PlayState* play) {
+ if (this->timer <= 0) {
+ Math_Vec3f_Copy(&this->dyna.actor.world.pos, &this->dyna.actor.home.pos);
+ this->dyna.actor.world.rot = this->dyna.actor.shape.rot = this->dyna.actor.home.rot;
+ func_800C6314(play, &play->colCtx.dyna, this->dyna.bgId);
+ func_8093D760(this);
+ }
+}
+
+void ObjLift_Update(Actor* thisx, PlayState* play) {
+ ObjLift* this = THIS;
+
+ if (this->timer > 0) {
+ this->timer--;
+ }
+ this->actionFunc(this, play);
+}
+
+void ObjLift_Draw(Actor* thisx, PlayState* play) {
+ ObjLift* this = THIS;
+
+ Gfx_DrawDListOpa(play, gDampeGraveBrownElevatorDL);
+}
+
+void func_8093DC90(Actor* thisx, PlayState* play) {
+ ObjLift* this = THIS;
+ Vec3f pos;
+ Vec3s rot;
+
+ Math_Vec3f_Sum(&this->dyna.actor.world.pos, &this->unk_168, &pos);
+ rot.x = this->unk_174 + this->dyna.actor.home.rot.x;
+ rot.y = this->dyna.actor.home.rot.y;
+ rot.z = this->unk_176 + this->dyna.actor.home.rot.z;
+ Matrix_SetTranslateRotateYXZ(pos.x, pos.y, pos.z, &rot);
+ Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z, MTXMODE_APPLY);
+ Gfx_DrawDListOpa(play, gDampeGraveBrownElevatorDL);
+}
diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h
index 291ad33554..ea29a9cb9b 100644
--- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h
+++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h
@@ -3,15 +3,25 @@
#include "global.h"
+#define OBJLIFT_GET_1(thisx) ((thisx)->params & 1)
+#define OBJLIFT_GET_7(thisx) (((thisx)->params >> 8) & 7)
+#define OBJLIFT_GET_7F(thisx) (((thisx)->params >> 1) & 0x7F)
+
struct ObjLift;
typedef void (*ObjLiftActionFunc)(struct ObjLift*, PlayState*);
typedef struct ObjLift {
- /* 0x000 */ Actor actor;
- /* 0x144 */ char unk_144[0x18];
+ /* 0x000 */ DynaPolyActor dyna;
/* 0x15C */ ObjLiftActionFunc actionFunc;
- /* 0x160 */ char unk_160[0x1C];
+ /* 0x160 */ s16 unk_160;
+ /* 0x162 */ s16 unk_162;
+ /* 0x164 */ s16 unk_164;
+ /* 0x166 */ s16 timer;
+ /* 0x168 */ Vec3f unk_168;
+ /* 0x174 */ s16 unk_174;
+ /* 0x176 */ s16 unk_176;
+ /* 0x178 */ s16 unk_178;
} ObjLift; // size = 0x17C
extern const ActorInit Obj_Lift_InitVars;