ovl_Obj_Y2lift decompiled (#856)

* ovl_Obj_Y2lift decompiled

* format

* pr review fixes

* clean up

Co-authored-by: SonicDcer <noreply@github.com>
This commit is contained in:
Alejandro Asenjo 2022-06-20 17:35:37 -03:00 committed by GitHub
parent 53fc438d81
commit f77c4770f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 62 additions and 22 deletions

View File

@ -2,8 +2,8 @@
<File Name="object_kaizoku_obj" Segment="6">
<DList Name="object_kaizoku_obj_DL_0001A0" Offset="0x1A0" />
<Texture Name="object_kaizoku_obj_Tex_000300" OutName="tex_000300" Format="rgba16" Width="32" Height="64" Offset="0x300" />
<DList Name="object_kaizoku_obj_DL_001680" Offset="0x1680" />
<Collision Name="object_kaizoku_obj_Colheader_0019B0" Offset="0x19B0" />
<DList Name="gPirateLiftPlatformDL" Offset="0x1680" />
<Collision Name="gPirateLiftPlatformCol" Offset="0x19B0" />
<Texture Name="object_kaizoku_obj_Tex_0019E0" OutName="tex_0019E0" Format="rgba16" Width="64" Height="32" Offset="0x19E0" />
<Texture Name="object_kaizoku_obj_Tex_0029E0" OutName="tex_0029E0" Format="rgba16" Width="16" Height="32" Offset="0x29E0" />
<Texture Name="object_kaizoku_obj_Tex_002DE0" OutName="tex_002DE0" Format="rgba16" Width="16" Height="16" Offset="0x2DE0" />

3
spec
View File

@ -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

View File

@ -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);
}

View File

@ -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;

View File

@ -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;