1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-07 14:50:15 +00:00

Decomp BgJyaLift (#216)

* Re upload

* Decomp BgJyaLift

* Fixed issues

Fixed issues from review

* Edits after review

* Review Fixes

Made some fixes and also changed an unknown variable name

* Fixes to file

Fixed some styling things and renamed the last function

* Added fixes

Added roman's fixes

* Delete filemap.pyc

* Fixes

Removed ctx.c and replaced tabs with spaces spec.
This commit is contained in:
louist103 2020-06-24 18:34:31 -04:00 committed by GitHub
parent 054f6dc04d
commit 7946d6698c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 132 additions and 411 deletions

View file

@ -15,7 +15,15 @@ void BgJyaLift_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgJyaLift_Update(Actor* thisx, GlobalContext* globalCtx);
void BgJyaLift_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
void BgJyaLift_InitDynapoly(BgJyaLift* this, GlobalContext* globalCtx, u32 arg2, DynaPolyMoveFlag moveFlag);
void BgJyaLift_SetFinalPosY(BgJyaLift* this);
void BgJyaLift_SetInitPosY(BgJyaLift* this);
void BgJyaLift_DelayMove(BgJyaLift* this, GlobalContext* globalCtx);
void BgJyaLift_SetupMove(BgJyaLift* this);
void BgJyaLift_Move(BgJyaLift* this, GlobalContext* globalCtx);
s16 D_8089A020 = 0;
const ActorInit Bg_Jya_Lift_InitVars = {
ACTOR_BG_JYA_LIFT,
ACTORTYPE_BG,
@ -27,23 +35,124 @@ const ActorInit Bg_Jya_Lift_InitVars = {
(ActorFunc)BgJyaLift_Update,
(ActorFunc)BgJyaLift_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Lift/func_80899BA0.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Lift/BgJyaLift_Init.s")
static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE),
ICHAIN_F32(unk_F4, 1400, ICHAIN_CONTINUE),
ICHAIN_F32(unk_F8, 1800, ICHAIN_CONTINUE),
ICHAIN_F32(unk_FC, 2500, ICHAIN_STOP),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Lift/BgJyaLift_Destroy.s")
extern UNK_TYPE D_0600D7E8;
extern Gfx D_0600CCE0[];
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Lift/func_80899D18.s")
void BgJyaLift_InitDynapoly(BgJyaLift* this, GlobalContext* globalCtx, u32 arg2, DynaPolyMoveFlag moveFlag) {
s32 pad1;
s32 localConst = 0;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Lift/func_80899D38.s")
DynaPolyInfo_SetActorMove(&this->dyna, moveFlag);
DynaPolyInfo_Alloc(arg2, &localConst);
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna, localConst);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Lift/func_80899DBC.s")
void BgJyaLift_Init(Actor* thisx, GlobalContext* globalCtx) {
BgJyaLift* this = THIS;
this->unk_16A = 0;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Lift/func_80899DCC.s")
if (D_8089A020) {
Actor_Kill(thisx);
return;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Lift/func_80899EF0.s")
// Goddess lift CT
osSyncPrintf("女神リフト CT\n");
BgJyaLift_InitDynapoly(this, globalCtx, &D_0600D7E8, 0);
Actor_ProcessInitChain(thisx, sInitChain);
if (Flags_GetSwitch(globalCtx, (thisx->params & 0x3F))) {
BgJyaLift_SetFinalPosY(thisx);
} else {
BgJyaLift_SetInitPosY(thisx);
}
thisx->room = -1;
D_8089A020 = 1;
this->unk_16A = 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Lift/BgJyaLift_Update.s")
void BgJyaLift_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgJyaLift* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Lift/BgJyaLift_Draw.s")
if (this->unk_16A != 0) {
// Goddess Lift DT
osSyncPrintf("女神リフト DT\n");
D_8089A020 = 0;
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
}
}
void BgJyaLift_SetInitPosY(BgJyaLift* this) {
this->actionFunc = BgJyaLift_DelayMove;
this->dyna.actor.posRot.pos.y = 1613.0f;
this->moveDelay = 0;
}
void BgJyaLift_DelayMove(BgJyaLift* this, GlobalContext* globalCtx) {
if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F) || (this->moveDelay > 0)) {
this->moveDelay++;
if (this->moveDelay >= 20) {
func_800800F8(globalCtx, 0xD66, -0x63, &this->dyna.actor, 0);
BgJyaLift_SetupMove(this);
}
}
}
void BgJyaLift_SetupMove(BgJyaLift* this) {
this->actionFunc = BgJyaLift_Move;
}
void BgJyaLift_Move(BgJyaLift* this, GlobalContext* globalCtx) {
f32 distFromBottom;
f32 tempVelocity;
Math_SmoothScaleMaxMinF(&this->dyna.actor.velocity.y, 4.0f, 0.1f, 1.0f, 0.0f);
tempVelocity = (this->dyna.actor.velocity.y < 0.2f) ? 0.2f : this->dyna.actor.velocity.y;
distFromBottom = Math_SmoothScaleMaxMinF(&this->dyna.actor.posRot.pos.y, 973.0f, 0.1f, tempVelocity, 0.2f);
if ((this->dyna.actor.posRot.pos.y < 1440.0f) && (1440.0f <= this->dyna.actor.pos4.y)) {
func_8005B1A4(ACTIVE_CAM);
}
if (fabsf(distFromBottom) < 0.001f) {
BgJyaLift_SetFinalPosY(this);
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_ELEVATOR_STOP);
} else {
func_8002F974(&this->dyna.actor, 0x200C);
}
}
void BgJyaLift_SetFinalPosY(BgJyaLift* this) {
this->actionFunc = NULL;
this->dyna.actor.posRot.pos.y = 973.0f;
}
void BgJyaLift_Update(Actor* thisx, GlobalContext* globalCtx) {
BgJyaLift* this = THIS;
GlobalContext* globalCtx2 = globalCtx;
if (this->actionFunc != NULL) {
this->actionFunc(this);
}
if ((this->dyna.unk_160 & 4) && ((this->unk_16B & 4) == 0)) {
func_8005A77C(globalCtx2->cameraPtrs[0], 0x3F);
} else if (((this->dyna.unk_160) & 4) == 0 && ((this->unk_16B & 4)) && (globalCtx2->cameraPtrs[0]->setting == 0x3F)) {
func_8005A77C(globalCtx2->cameraPtrs[0], 3);
}
this->unk_16B = this->dyna.unk_160;
// Spirit Temple room 5 is the main room with the statue room 25 is directly above room 5
if ((globalCtx2->roomCtx.curRoom.num != 5) && (globalCtx2->roomCtx.curRoom.num != 25)) {
Actor_Kill(thisx);
}
}
void BgJyaLift_Draw(Actor* thisx, GlobalContext* globalCtx) {
Gfx_DrawDListOpa(globalCtx, D_0600CCE0);
}

View file

@ -5,10 +5,14 @@
#include <global.h>
struct BgJyaLift;
typedef void (*BgJyaLiftActionFunc)(struct BgJyaLift*);
typedef struct BgJyaLift {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x20];
/* 0x000 */ DynaPolyActor dyna;
/* 0x164 */ BgJyaLiftActionFunc actionFunc;
/* 0x168 */ s16 moveDelay;
/* 0x16A */ u8 unk_16A;
/* 0x16B */ u8 unk_16B;
} BgJyaLift; // size = 0x016C
extern const ActorInit Bg_Jya_Lift_InitVars;