mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
Elevator functions
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "z_bg_dblue_elevator.h"
|
||||
#include "objects/object_dblue_object/object_dblue_object.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10)
|
||||
|
||||
@@ -15,6 +16,17 @@ void BgDblueElevator_Destroy(Actor* thisx, PlayState* play);
|
||||
void BgDblueElevator_Update(Actor* thisx, PlayState* play);
|
||||
void BgDblueElevator_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
void func_80B91F20(BgDblueElevator* this, PlayState* play);
|
||||
void func_80B91F74(BgDblueElevator* this, PlayState* play);
|
||||
void func_80B924DC(BgDblueElevator* this);
|
||||
void func_80B924F8(BgDblueElevator* this, PlayState* play);
|
||||
void func_80B9257C(BgDblueElevator* this);
|
||||
void func_80B925B8(BgDblueElevator* this);
|
||||
void func_80B92644(BgDblueElevator* this);
|
||||
void func_80B92660(BgDblueElevator* this, PlayState* play);
|
||||
|
||||
extern Elevator D_80B92960[];
|
||||
|
||||
#if 0
|
||||
ActorInit Bg_Dblue_Elevator_InitVars = {
|
||||
/**/ ACTOR_BG_DBLUE_ELEVATOR,
|
||||
@@ -43,7 +55,14 @@ extern InitChainEntry D_80B929EC[];
|
||||
extern UNK_TYPE D_060002C8;
|
||||
extern UNK_TYPE D_060005C4;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Dblue_Elevator/func_80B91F20.s")
|
||||
void func_80B91F20(BgDblueElevator* this, PlayState* play) {
|
||||
s32 pad;
|
||||
WaterBox* waterBox;
|
||||
s32 bgId;
|
||||
|
||||
this->unk_16B = WaterBox_GetSurfaceImpl(play, &play->colCtx, this->dyna.actor.world.pos.x,
|
||||
this->dyna.actor.world.pos.z, &this->unk_16C, &waterBox, &bgId);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Dblue_Elevator/func_80B91F74.s")
|
||||
|
||||
@@ -51,21 +70,146 @@ extern UNK_TYPE D_060005C4;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Dblue_Elevator/func_80B922FC.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Dblue_Elevator/BgDblueElevator_Init.s")
|
||||
void BgDblueElevator_Init(Actor* thisx, PlayState* play) {
|
||||
BgDblueElevator* this = THIS;
|
||||
s32 pad;
|
||||
s32 params = (this->dyna.actor.params >> 8) & 3;
|
||||
Elevator* elevator = &D_80B92960[params];
|
||||
s32 temp_v0;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Dblue_Elevator/BgDblueElevator_Destroy.s")
|
||||
Actor_ProcessInitChain(&this->dyna.actor, D_80B929EC);
|
||||
DynaPolyActor_Init(&this->dyna, 1);
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, &gGreatBayTempleObjectElevatorCol);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Dblue_Elevator/func_80B924DC.s")
|
||||
temp_v0 = elevator->actionFunc(this, play);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Dblue_Elevator/func_80B924F8.s")
|
||||
if (temp_v0 == 2) {
|
||||
this->unk_168 = -elevator->unk_0D;
|
||||
} else {
|
||||
this->unk_168 = elevator->unk_0D;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Dblue_Elevator/func_80B9257C.s")
|
||||
func_80B91F20(this, play);
|
||||
|
||||
if ((temp_v0 == 0) || (temp_v0 == 3)) {
|
||||
func_80B924DC(this);
|
||||
} else {
|
||||
func_80B92644(this);
|
||||
}
|
||||
}
|
||||
|
||||
void BgDblueElevator_Destroy(Actor* thisx, PlayState* play) {
|
||||
BgDblueElevator* this = THIS;
|
||||
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
|
||||
void func_80B924DC(BgDblueElevator* this) {
|
||||
this->unk_169 = 60;
|
||||
this->actionFunc = func_80B924F8;
|
||||
}
|
||||
|
||||
void func_80B924F8(BgDblueElevator* this, PlayState* play) {
|
||||
s32 params = (this->dyna.actor.params >> 8) & 3;
|
||||
Elevator* elevator = &D_80B92960[params];
|
||||
s32 temp_v0 = elevator->actionFunc(this, play);
|
||||
|
||||
if ((temp_v0 == 0) || (temp_v0 == 3)) {
|
||||
this->unk_169 = 60;
|
||||
return;
|
||||
}
|
||||
|
||||
this->unk_169--;
|
||||
if (this->unk_169 <= 0) {
|
||||
func_80B92644(this);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80B9257C(BgDblueElevator* this) {
|
||||
s32 params = (this->dyna.actor.params >> 8) & 3;
|
||||
Elevator* elevator = &D_80B92960[params];
|
||||
|
||||
this->unk_16A = elevator->unk_0C;
|
||||
this->actionFunc = func_80B925B8;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Dblue_Elevator/func_80B925B8.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Dblue_Elevator/func_80B92644.s")
|
||||
void func_80B92644(BgDblueElevator* this) {
|
||||
this->unk_160 = 0.0f;
|
||||
this->actionFunc = func_80B92660;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Dblue_Elevator/func_80B92660.s")
|
||||
void func_80B92660(BgDblueElevator* this, PlayState* play) {
|
||||
s32 params = (this->dyna.actor.params >> 8) & 3;
|
||||
Elevator* elevator = &D_80B92960[params];
|
||||
s32 temp_v0 = elevator->actionFunc(this, play);
|
||||
|
||||
s32 pad;
|
||||
s32 sp5C;
|
||||
s32 sp58;
|
||||
f32 var_fa0;
|
||||
Vec3f sp48;
|
||||
Vec3f sp3C;
|
||||
f32 var_fv1;
|
||||
s32 pad2;
|
||||
|
||||
if ((temp_v0 == 0) || (temp_v0 == 3)) {
|
||||
sp58 = Math_StepToF(&this->unk_160, 0.0f, elevator->unk_14);
|
||||
} else {
|
||||
sp58 = 0;
|
||||
Math_StepToF(&this->unk_160, elevator->unk_18, elevator->unk_10);
|
||||
}
|
||||
|
||||
if (this->unk_168 > 0) {
|
||||
var_fa0 = elevator->unk_8;
|
||||
} else {
|
||||
var_fa0 = -elevator->unk_8;
|
||||
}
|
||||
|
||||
if (this->unk_160 <= 1.1f) {
|
||||
var_fv1 = 1.1f;
|
||||
} else {
|
||||
var_fv1 = this->unk_160;
|
||||
}
|
||||
|
||||
if (Math_SmoothStepToF(&this->unk_164, var_fa0, 0.4f, var_fv1, 1.0f) < 0.001f) {
|
||||
sp5C = 1;
|
||||
} else {
|
||||
sp5C = 0;
|
||||
}
|
||||
|
||||
if (elevator->unk_00 == 0) {
|
||||
this->dyna.actor.world.pos.y = this->unk_164 + this->dyna.actor.home.pos.y;
|
||||
if (((this->dyna.actor.flags & 0x40) == 0x40) && (this->unk_16B != 0)) {
|
||||
if (this->unk_168 > 0) {
|
||||
var_fv1 = ((this->dyna.actor.world.pos.y + -10.0f) - this->unk_16C) *
|
||||
(((&this->dyna.actor.prevPos)->y + -10.0f) - this->unk_16C);
|
||||
} else {
|
||||
var_fv1 = ((this->dyna.actor.world.pos.y + -30.0f) - this->unk_16C) *
|
||||
((this->dyna.actor.prevPos.y + -30.0f) - this->unk_16C);
|
||||
}
|
||||
if (var_fv1 <= 0.0f) {
|
||||
func_80B91F74(this, play);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Matrix_RotateYS(this->dyna.actor.shape.rot.y, MTXMODE_NEW);
|
||||
sp48.x = this->unk_164;
|
||||
sp48.z = sp48.y = 0.0f;
|
||||
Matrix_MultVec3f(&sp48, &sp3C);
|
||||
Math_Vec3f_Sum(&this->dyna.actor.home.pos, &sp3C, &this->dyna.actor.world.pos);
|
||||
}
|
||||
|
||||
if (sp58 != 0) {
|
||||
func_80B924DC(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sp5C != 0) {
|
||||
this->unk_168 = -this->unk_168;
|
||||
func_80B9257C(this);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Dblue_Elevator/BgDblueElevator_Update.s")
|
||||
|
||||
|
||||
@@ -5,13 +5,29 @@
|
||||
|
||||
struct BgDblueElevator;
|
||||
|
||||
typedef void (*BgDblueElevatorActionFunc)(struct BgDblueElevator*, PlayState*);
|
||||
typedef s32 (*BgDblueElevatorActionFunc)(struct BgDblueElevator*, PlayState*);
|
||||
|
||||
typedef struct BgDblueElevator {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ char unk_144[0x18];
|
||||
/* 0x000 */ DynaPolyActor dyna;
|
||||
/* 0x15C */ BgDblueElevatorActionFunc actionFunc;
|
||||
/* 0x160 */ char unk_160[0x10];
|
||||
/* 0x160 */ f32 unk_160;
|
||||
/* 0x164 */ f32 unk_164;
|
||||
/* 0x168 */ s8 unk_168;
|
||||
/* 0x169 */ s8 unk_169;
|
||||
/* 0x16A */ s8 unk_16A;
|
||||
/* 0x16B */ s8 unk_16B;
|
||||
/* 0x16C */ f32 unk_16C;
|
||||
} BgDblueElevator; // size = 0x170
|
||||
|
||||
typedef struct Elevator {
|
||||
/* 0x0 */ s32 unk_00;
|
||||
/* 0x4 */ BgDblueElevatorActionFunc actionFunc;
|
||||
/* 0x8 */ f32 unk_8;
|
||||
/* 0xC */ s8 unk_0C;
|
||||
/* 0xD */ s8 unk_0D;
|
||||
/* 0x10 */ f32 unk_10;
|
||||
/* 0x14 */ f32 unk_14;
|
||||
/* 0x18 */ f32 unk_18;
|
||||
} Elevator; // size = 0x1C
|
||||
|
||||
#endif // Z_BG_DBLUE_ELEVATOR_H
|
||||
|
||||
Reference in New Issue
Block a user