ovl_Obj_Shutter decompiled (#864)

* ovl_Obj_Shutter decompiled

* pr review

* format

* Empty-Commit

* rename
This commit is contained in:
Alejandro Asenjo 2022-07-11 22:23:12 -03:00 committed by GitHub
parent ffb90132c6
commit c35d699d8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 64 additions and 16 deletions

View File

@ -4,7 +4,7 @@
<DList Name="object_f53_obj_DL_000148" Offset="0x148" />
<DList Name="object_f53_obj_DL_000158" Offset="0x158" />
<Texture Name="object_f53_obj_Tex_000168" OutName="tex_000168" Format="rgba16" Width="32" Height="64" Offset="0x168" />
<DList Name="object_f53_obj_DL_0011E0" Offset="0x11E0" />
<DList Name="gBankShutterDL" Offset="0x11E0" />
<Texture Name="object_f53_obj_Tex_001278" OutName="tex_001278" Format="rgba16" Width="32" Height="32" Offset="0x1278" />
<!-- <Blob Name="object_f53_obj_Blob_001A78" Size="0x78" Offset="0x1A78" /> -->
<DList Name="object_f53_obj_DL_001AF0" Offset="0x1AF0" />

3
spec
View File

@ -2691,8 +2691,7 @@ beginseg
name "ovl_Obj_Shutter"
compress
include "build/src/overlays/actors/ovl_Obj_Shutter/z_obj_shutter.o"
include "build/data/ovl_Obj_Shutter/ovl_Obj_Shutter.data.o"
include "build/data/ovl_Obj_Shutter/ovl_Obj_Shutter.reloc.o"
include "build/src/overlays/actors/ovl_Obj_Shutter/ovl_Obj_Shutter_reloc.o"
endseg
beginseg

View File

@ -5,6 +5,7 @@
*/
#include "z_obj_shutter.h"
#include "objects/object_f53_obj/object_f53_obj.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)
@ -12,10 +13,9 @@
void ObjShutter_Init(Actor* thisx, PlayState* play);
void ObjShutter_Destroy(Actor* thisx, PlayState* play);
void ObjShutter_Update(Actor* thisx, PlayState* play);
void ObjShutter_Update(Actor* thisx, PlayState* play2);
void ObjShutter_Draw(Actor* thisx, PlayState* play);
#if 0
const ActorInit Obj_Shutter_InitVars = {
ACTOR_OBJ_SHUTTER,
ACTORCAT_PROP,
@ -28,14 +28,66 @@ const ActorInit Obj_Shutter_InitVars = {
(ActorFunc)ObjShutter_Draw,
};
#endif
void ObjShutter_Init(Actor* thisx, PlayState* play) {
}
extern UNK_TYPE D_060011E0;
void ObjShutter_Destroy(Actor* thisx, PlayState* play) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Shutter/ObjShutter_Init.s")
static u8 sScheduleScript[] = {
/* 0x0 */ SCHEDULE_CMD_CHECK_TIME_RANGE_S(10, 0, 20, 0, 0x9 - 0x6),
/* 0x6 */ SCHEDULE_CMD_RET_VAL_L(2),
/* 0x9 */ SCHEDULE_CMD_RET_VAL_L(1),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Shutter/ObjShutter_Destroy.s")
void ObjShutter_Update(Actor* thisx, PlayState* play2) {
ObjShutter* this = THIS;
PlayState* play = play2;
ScheduleResult schedule;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Shutter/ObjShutter_Update.s")
Schedule_RunScript(play, sScheduleScript, &schedule);
if (schedule.result == 1) {
if (this->scheduleResult != schedule.result) {
this->actor.velocity.y = 0.0f;
}
if ((this->verticalOffset >= 80.0f) || (this->scheduleResult == 0)) {
this->actor.velocity.y = 0.0f;
this->verticalOffset = 80.0f;
} else {
this->verticalOffset += 10.0f;
}
} else {
if (this->scheduleResult != schedule.result) {
this->actor.velocity.y = 0.0f;
}
if (this->verticalOffset != 0.0f) {
this->actor.velocity.y -= 3.0f;
this->verticalOffset += this->actor.velocity.y;
if (this->verticalOffset <= 0.0f) {
this->actor.velocity.y = fabsf(this->actor.velocity.y) * 0.8f;
if ((s32)this->actor.velocity.y == 0) {
this->actor.velocity.y = 0.0f;
this->verticalOffset = 0.0f;
}
}
}
}
this->scheduleResult = schedule.result;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Shutter/ObjShutter_Draw.s")
void ObjShutter_Draw(Actor* thisx, PlayState* play) {
ObjShutter* this = THIS;
Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y + this->verticalOffset, this->actor.world.pos.z,
MTXMODE_NEW);
Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY);
Matrix_RotateYS(this->actor.world.rot.y, MTXMODE_APPLY);
OPEN_DISPS(play->state.gfxCtx);
func_8012C28C(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gBankShutterDL);
CLOSE_DISPS(play->state.gfxCtx);
}

View File

@ -7,7 +7,8 @@ struct ObjShutter;
typedef struct ObjShutter {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x8];
/* 0x144 */ u8 scheduleResult;
/* 0x148 */ f32 verticalOffset;
} ObjShutter; // size = 0x14C
extern const ActorInit Obj_Shutter_InitVars;

View File

@ -1541,10 +1541,6 @@ D_06001DB0 = 0x06001DB0;
D_06001E40 = 0x06001E40;
D_060048D0 = 0x060048D0;
// ovl_Obj_Shutter
D_060011E0 = 0x060011E0;
// ovl_Obj_Takaraya_Wall
D_06000B70 = 0x06000B70;