Obj_Hunsui (#626)

* Obj_Hunsui

* PR

* Merge

* Merge
This commit is contained in:
Maide 2022-02-28 02:38:36 +00:00 committed by GitHub
parent 84e13ff2a0
commit c9f64d3344
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 676 additions and 36 deletions

4
spec
View File

@ -4436,9 +4436,7 @@ beginseg
name "ovl_Obj_Hunsui"
compress
include "build/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.o"
include "build/data/ovl_Obj_Hunsui/ovl_Obj_Hunsui.data.o"
include "build/data/ovl_Obj_Hunsui/ovl_Obj_Hunsui.bss.o"
include "build/data/ovl_Obj_Hunsui/ovl_Obj_Hunsui.reloc.o"
include "build/src/overlays/actors/ovl_Obj_Hunsui/ovl_Obj_Hunsui_reloc.o"
endseg
beginseg

View File

@ -11,6 +11,8 @@ typedef void (*BgDblueMovebgActionFunc)(struct BgDblueMovebg*, GlobalContext*);
#define BGDBLUEMOVEBG_GET_FF0(thisx) (((thisx)->params >> 4) & 0xFF)
#define BGDBLUEMOVEBG_GET_F000(thisx) (((thisx)->params >> 0xC) & 0xF)
#define BGDBLUEMOVEBG_F_8 8
typedef struct BgDblueMovebg {
/* 0x000 */ DynaPolyActor dyna;
/* 0x15C */ BgDblueMovebgActionFunc actionFunc;

View File

@ -5,6 +5,7 @@
*/
#include "z_obj_hunsui.h"
#include "objects/object_hunsui/object_hunsui.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)
@ -15,7 +16,36 @@ void ObjHunsui_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ObjHunsui_Update(Actor* thisx, GlobalContext* globalCtx);
void ObjHunsui_Draw(Actor* thisx, GlobalContext* globalCtx);
#if 0
void func_80B9CE64(ObjHunsui* this, GlobalContext* globalCtx);
void func_80B9D0FC(ObjHunsui* this, GlobalContext* globalCtx);
void func_80B9D120(ObjHunsui* this, GlobalContext* globalCtx);
void func_80B9D2BC(ObjHunsui* this, GlobalContext* globalCtx);
void func_80B9D4D0(ObjHunsui* this, GlobalContext* globalCtx);
void func_80B9D508(ObjHunsui* this, GlobalContext* globalCtx);
void func_80B9D714(ObjHunsui* this, GlobalContext* globalCtx);
void func_80B9DA60(Actor* thisx, GlobalContext* globalCtx);
AnimatedMaterial* D_80B9DED0;
AnimatedMaterial* D_80B9DED4;
typedef struct {
/* 0x00 */ u8 unk_00;
/* 0x01 */ u8 unk_01;
/* 0x02 */ u8 unk_02;
} ObjHansuiBssStruct; // size = 0x3
ObjHansuiBssStruct D_80B9DED8;
typedef struct {
/* 0x00 */ u8 unk_00;
/* 0x01 */ u8 unk_01;
} ObjHansuiStruct; // size = 0x2
ObjHansuiStruct D_80B9DC70[] = {
{ 1, 1 }, { 1, 0 }, { 2, 3 }, { 2, 1 }, { 2, 2 }, { 2, 0 }, { 3, 7 },
{ 3, 3 }, { 3, 5 }, { 3, 1 }, { 3, 6 }, { 3, 2 }, { 3, 4 }, { 3, 0 },
};
const ActorInit Obj_Hunsui_InitVars = {
ACTOR_OBJ_HUNSUI,
ACTORCAT_BG,
@ -28,42 +58,622 @@ const ActorInit Obj_Hunsui_InitVars = {
(ActorFunc)ObjHunsui_Draw,
};
#endif
static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneScale, 400, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 400, ICHAIN_STOP),
};
extern UNK_TYPE D_06000220;
extern UNK_TYPE D_06000C74;
extern UNK_TYPE D_06000EC0;
s32 func_80B9C450(GlobalContext* globalCtx, s32 arg1, s32 arg2) {
s32 sp2C = 1;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hunsui/func_80B9C450.s")
if (arg2 < ARRAY_COUNT(D_80B9DC70)) {
s32 val = D_80B9DC70[arg2].unk_00;
s32 val3 = D_80B9DC70[arg2].unk_01;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hunsui/func_80B9C5E8.s")
while (val--) {
if ((1 << val) & val3) {
if (!Flags_GetSwitch(globalCtx, arg1 + val)) {
sp2C = 0;
break;
}
} else if (Flags_GetSwitch(globalCtx, arg1 + val)) {
sp2C = 0;
break;
}
}
} else {
sp2C = 0;
switch (arg2) {
case 14:
if (!Flags_GetSwitch(globalCtx, arg1)) {
sp2C = 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hunsui/ObjHunsui_Init.s")
if (Flags_GetSwitch(globalCtx, arg1 + 1) && Flags_GetSwitch(globalCtx, arg1 + 2) &&
Flags_GetSwitch(globalCtx, arg1 + 3)) {
sp2C += 2;
}
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hunsui/ObjHunsui_Destroy.s")
case 15:
if (!Flags_GetSwitch(globalCtx, arg1) ||
(Flags_GetSwitch(globalCtx, arg1 + 1) && Flags_GetSwitch(globalCtx, arg1 + 2) &&
Flags_GetSwitch(globalCtx, arg1 + 3))) {
sp2C = 1;
}
break;
}
}
return sp2C;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hunsui/ObjHunsui_Update.s")
void func_80B9C5E8(ObjHunsui* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
f32 temp_f10;
f32 temp_f16;
Vec3f sp40;
s16 sp3E;
f32 sp38;
f32 sp34;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hunsui/func_80B9CE64.s")
if ((this->dyna.actor.xzDistToPlayer < (45.0f * this->dyna.actor.scale.x * 10.0f)) &&
(this->dyna.actor.playerHeightRel < -21.0f)) {
if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) {
this->unk_172 &= ~8;
this->unk_19C = 0.0f;
this->unk_1A0 = 0.0f;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hunsui/func_80B9D094.s")
this->unk_18C++;
if (this->unk_18C >= 3) {
this->unk_18C = 0;
Math_Vec3f_Copy(&sp40, &player->actor.world.pos);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hunsui/func_80B9D0FC.s")
sp40.x += randPlusMinusPoint5Scaled(10.0f);
sp40.z += randPlusMinusPoint5Scaled(10.0f);
sp40.y += Rand_ZeroFloat(2.0f);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hunsui/func_80B9D120.s")
EffectSsGSplash_Spawn(globalCtx, &sp40, NULL, NULL, 2.0f * Rand_ZeroOne(), 1);
}
} else {
this->unk_172 |= 8;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hunsui/func_80B9D288.s")
this->unk_18C++;
if (this->unk_18C >= 3) {
Math_Vec3f_Copy(&sp40, &player->actor.world.pos);
this->unk_18C = 0;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hunsui/func_80B9D2BC.s")
sp40.x += randPlusMinusPoint5Scaled(10.0f);
sp40.z += randPlusMinusPoint5Scaled(10.0f);
sp40.y += Rand_ZeroFloat(45.0f);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hunsui/func_80B9D334.s")
EffectSsGSplash_Spawn(globalCtx, &sp40, NULL, NULL, 1, 1);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hunsui/func_80B9D4D0.s")
sp3E = BINANG_ROT180(player->actor.world.rot.y - this->dyna.actor.yawTowardsPlayer);
player->actor.gravity = 0.0f;
player->actor.velocity.y = 0.0f;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hunsui/func_80B9D508.s")
if ((this->unk_160 != OBJHUNSUI_F000_5) && (this->unk_160 != OBJHUNSUI_F000_6)) {
Math_SmoothStepToF(&player->actor.world.pos.y, this->dyna.actor.world.pos.y, 0.5f, 4.0f, 1.0f);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hunsui/func_80B9D714.s")
if ((sp3E < 0x4000) && (sp3E > -0x4000)) {
this->unk_1A4 = BINANG_ROT180(player->actor.world.rot.y);
sp34 = this->dyna.actor.xzDistToPlayer / (45.0f * this->dyna.actor.scale.x * 10.0f);
if (1) {}
sp38 = this->dyna.actor.xzDistToPlayer / (45.0f * this->dyna.actor.scale.x * 10.0f);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hunsui/ObjHunsui_Draw.s")
if (sp38 > 1.0f) {
sp38 = sp34;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hunsui/func_80B9DA60.s")
player->linearVelocity *= sp38;
if ((this->unk_160 == OBJHUNSUI_F000_5) || (this->unk_160 == OBJHUNSUI_F000_6)) {
Math_ApproachF(&this->unk_1A0, 4.5f, 2.0f, 1.0f);
Math_ApproachF(&this->unk_19C, this->unk_1A0, 2.0f, 0.3f * sp38);
} else {
Math_ApproachF(&this->unk_1A0, 3.0f, 1.0f, 1.0f);
Math_ApproachF(&this->unk_19C, this->unk_1A0, 1.0f, 0.3f * sp38);
}
} else {
this->unk_1A4 = player->actor.world.rot.y;
player->linearVelocity *= 0.5f;
Math_ApproachF(&this->unk_1A0, 3.0f, 1.0f, 1.0f);
Math_ApproachF(&this->unk_19C, this->unk_1A0, 1.0f, 0.1f);
}
player->unk_B84 = this->unk_1A4;
player->unk_B80 = this->unk_19C;
}
} else {
if (this->unk_172 & 8) {
player->linearVelocity = this->unk_19C + player->linearVelocity;
player->currentYaw = this->unk_1A4;
}
this->unk_1A0 = 0.0f;
this->unk_19C = 0.0f;
this->unk_172 &= ~8;
}
}
void ObjHunsui_Init(Actor* thisx, GlobalContext* globalCtx) {
ObjHunsui* this = THIS;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
this->unk_160 = OBJHUNSUI_GET_F000(thisx);
this->unk_164 = OBJHUNSUI_GET_F80(thisx);
this->unk_168 = OBJHUNSUI_GET_7F(thisx);
DynaPolyActor_Init(&this->dyna, 1);
if ((this->unk_160 != OBJHUNSUI_F000_5) && (this->unk_160 != OBJHUNSUI_F000_6)) {
DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_hunsui_Colheader_000C74);
}
D_80B9DED0 = Lib_SegmentedToVirtual(object_hunsui_Matanimheader_000BF0);
D_80B9DED4 = Lib_SegmentedToVirtual(object_hunsui_Matanimheader_001888);
SubS_FillCutscenesList(&this->dyna.actor, &this->unk_170, 1);
this->unk_18C = 0;
switch (this->unk_160) {
case OBJHUNSUI_F000_1:
case OBJHUNSUI_F000_2:
case OBJHUNSUI_F000_3:
case OBJHUNSUI_F000_4:
case OBJHUNSUI_F000_5:
case OBJHUNSUI_F000_6:
this->dyna.actor.uncullZoneScale = 900.0f;
this->dyna.actor.uncullZoneDownward = 90.0f;
this->dyna.actor.uncullZoneForward = 4000.0f;
break;
}
switch (this->unk_160) {
case OBJHUNSUI_F000_5:
if (D_80B9DED8.unk_01 == 0) {
D_80B9DED8.unk_01 = 1;
this->unk_16C = this->dyna.actor.room;
this->unk_16D = this->dyna.actor.world.rot.z;
this->dyna.actor.world.rot.z = 0;
this->dyna.actor.shape.rot.z = 0;
this->dyna.actor.room = -1;
} else {
Actor_MarkForDeath(&this->dyna.actor);
return;
}
break;
case OBJHUNSUI_F000_6:
if (D_80B9DED8.unk_02 == 0) {
D_80B9DED8.unk_02 = 1;
this->unk_16C = this->dyna.actor.room;
this->unk_16D = this->dyna.actor.world.rot.z;
this->dyna.actor.world.rot.z = 0;
this->dyna.actor.shape.rot.z = 0;
this->dyna.actor.room = -1;
} else {
Actor_MarkForDeath(&this->dyna.actor);
return;
}
break;
}
switch (this->unk_160) {
case OBJHUNSUI_F000_0:
if (D_80B9DED8.unk_00 == 0) {
D_80B9DED8.unk_00 = 1;
this->unk_16C = this->dyna.actor.room;
this->unk_16D = this->unk_164;
// clang-format off
this->dyna.actor.room = -1; this->actionFunc = func_80B9D714;
// clang-format on
} else {
Actor_MarkForDeath(&this->dyna.actor);
return;
}
break;
case OBJHUNSUI_F000_2:
this->unk_172 |= 1;
case OBJHUNSUI_F000_1:
this->dyna.actor.draw = func_80B9DA60;
if ((this->unk_172 & 1) && func_80B9C450(globalCtx, this->unk_168, this->unk_164)) {
this->unk_174 = 240.0f;
this->unk_172 |= 4;
this->unk_184 = 0xFF0;
} else {
this->unk_174 = -30.0f;
this->unk_172 |= 2;
this->unk_184 = 0;
}
this->unk_178 = this->unk_174;
this->unk_180 = func_80B9C450(globalCtx, this->unk_168, this->unk_164);
this->actionFunc = func_80B9CE64;
break;
case OBJHUNSUI_F000_4:
this->unk_172 |= 1;
case OBJHUNSUI_F000_3:
case OBJHUNSUI_F000_5:
case OBJHUNSUI_F000_6:
this->dyna.actor.draw = func_80B9DA60;
if ((this->unk_160 == OBJHUNSUI_F000_5) || (this->unk_160 == OBJHUNSUI_F000_6)) {
func_80B9D2BC(this, globalCtx);
this->unk_178 = this->unk_174;
} else {
if ((this->unk_172 & 1) || func_80B9C450(globalCtx, this->unk_168, this->unk_164)) {
func_80B9D4D0(this, globalCtx);
} else {
func_80B9D0FC(this, globalCtx);
}
this->unk_178 = this->unk_174;
}
break;
}
}
void ObjHunsui_Destroy(Actor* thisx, GlobalContext* globalCtx) {
ObjHunsui* this = THIS;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
}
void ObjHunsui_Update(Actor* thisx, GlobalContext* globalCtx) {
ObjHunsui* this = THIS;
this->actionFunc(this, globalCtx);
if ((this->unk_172 & 0x40) && SubS_StartActorCutscene(&this->dyna.actor, this->unk_17C, -1, 0)) {
this->unk_172 &= ~0x40;
}
if (this->unk_1AC > 1024.0f) {
this->unk_1AC -= 1024.0f;
}
if (this->unk_1AC <= 0.0f) {
this->unk_1AC += 1024.0f;
}
}
void func_80B9CE64(ObjHunsui* this, GlobalContext* globalCtx) {
s32 sp2C;
f32 sins;
if (!(this->unk_172 & 2)) {
func_80B9C5E8(this, globalCtx);
}
this->unk_18A += 0x71C;
Math_SmoothStepToF(&this->unk_190, this->unk_194, 1.0f, 0.2f, 0.01f);
sp2C = func_80B9C450(globalCtx, this->unk_168, this->unk_164);
if (!(this->unk_172 & 1)) {
if (sp2C != this->unk_180) {
this->unk_17C = this->unk_170;
this->unk_172 |= 0x40;
}
}
if ((this->unk_172 & 1) || (sp2C != 0)) {
this->unk_172 &= ~2;
if (this->unk_186 == 0) {
this->unk_172 |= 0x10;
this->unk_174 = 240.0f;
if (this->unk_178 == 240.0f) {
if (this->unk_188++ > 40) {
this->unk_188 = 0;
this->unk_186 = 1;
this->unk_194 = 0.0f;
} else {
this->unk_194 = 8.0f;
}
}
} else {
this->unk_174 = 30.0f;
if (this->unk_178 == 30.0f) {
if (this->unk_188++ > 40) {
this->unk_188 = 0;
this->unk_186 = 0;
this->unk_194 = 0.0f;
} else {
this->unk_194 = 8.0f;
}
}
}
} else {
this->unk_174 = -30.0f;
if (this->unk_178 == -30.0f) {
this->unk_172 &= ~0x10;
this->unk_172 |= 2;
}
}
sins = Math_SinS(this->unk_18A);
this->unk_198 = sins * this->unk_190;
if (!(this->unk_172 & 0x40)) {
Math_SmoothStepToF(&this->unk_178, this->unk_174, 0.6f, 10.5f, 0.05f);
}
this->dyna.actor.world.pos.y = this->unk_198 + (this->dyna.actor.home.pos.y + this->unk_178);
this->unk_180 = sp2C;
}
void func_80B9D094(ObjHunsui* this, GlobalContext* globalCtx) {
f32 sins;
this->unk_18A += 0x71C;
Math_SmoothStepToF(&this->unk_190, this->unk_194, 1.0f, 0.2f, 0.01f);
sins = Math_SinS(this->unk_18A);
this->unk_198 = sins * this->unk_190;
}
void func_80B9D0FC(ObjHunsui* this, GlobalContext* globalCtx) {
this->unk_174 = -30.0f;
this->actionFunc = func_80B9D120;
}
void func_80B9D120(ObjHunsui* this, GlobalContext* globalCtx) {
if (((this->unk_160 == OBJHUNSUI_F000_5) || (this->unk_160 == OBJHUNSUI_F000_6)) &&
(this->unk_16C != globalCtx->roomCtx.currRoom.num) && (this->unk_16C != globalCtx->roomCtx.prevRoom.num) &&
((this->unk_16D != globalCtx->roomCtx.currRoom.num) && (this->unk_16D != globalCtx->roomCtx.prevRoom.num))) {
switch (this->unk_160) {
case OBJHUNSUI_F000_5:
D_80B9DED8.unk_01 = 0;
break;
case OBJHUNSUI_F000_6:
D_80B9DED8.unk_02 = 0;
break;
}
Actor_MarkForDeath(&this->dyna.actor);
return;
}
func_80B9D094(this, globalCtx);
if (!(this->unk_172 & 0x40)) {
Math_SmoothStepToF(&this->unk_178, this->unk_174, 0.6f, 10.5f, 0.05f);
}
this->dyna.actor.world.pos.y = this->unk_198 + (this->dyna.actor.home.pos.y + this->unk_178);
if (this->unk_178 == this->unk_174) {
this->unk_172 &= ~0x10;
this->unk_172 |= 2;
}
if (func_80B9C450(globalCtx, this->unk_168, this->unk_164)) {
this->unk_17C = this->unk_170;
this->unk_172 |= 0x40;
func_80B9D4D0(this, globalCtx);
}
}
s32 func_80B9D288(GlobalContext* globalCtx, Actor* thisx, Actor* iter, void* verifyData) {
s32 ret = false;
if (BGDBLUEMOVEBG_GET_F(iter) == BGDBLUEMOVEBG_F_8) {
ret = true;
}
return ret;
}
void func_80B9D2BC(ObjHunsui* this, GlobalContext* globalCtx) {
if ((this->unk_172 & 1) || func_80B9C450(globalCtx, this->unk_168, this->unk_164)) {
func_80B9D4D0(this, globalCtx);
} else {
this->unk_172 |= 2;
func_80B9D0FC(this, globalCtx);
}
}
void func_80B9D334(ObjHunsui* this, GlobalContext* globalCtx) {
Vec3f sp74;
s32 i;
s32 phi_s2 = 0;
s32 phi_s3;
switch (this->unk_160) {
case OBJHUNSUI_F000_5:
phi_s2 = 1;
break;
case OBJHUNSUI_F000_6:
break;
}
if (this->unk_1B4 != NULL) {
phi_s3 = false;
for (i = 0; i < 8; i++) {
if (this->unk_1B4->unk_300[phi_s2][i] == (phi_s2 + 1)) {
phi_s3 = true;
Math_Vec3f_Copy(&sp74, &this->unk_1B4->unk_238[phi_s2][i]);
this->unk_174 = sp74.y - this->dyna.actor.home.pos.y;
if (this->unk_174 > 240.0f) {
this->unk_174 = 240.0f;
}
this->unk_190 = 0.0f;
this->unk_198 = 0.0f;
this->unk_18A = 0;
}
}
if (!phi_s3) {
this->unk_174 = 240;
}
} else {
Actor* dblueMovebg = SubS_FindActorCustom(globalCtx, &this->dyna.actor, NULL, ACTORCAT_BG,
ACTOR_BG_DBLUE_MOVEBG, NULL, func_80B9D288);
if (dblueMovebg != NULL) {
this->unk_1B4 = (BgDblueMovebg*)dblueMovebg;
func_80B9D2BC(this, globalCtx);
}
}
}
void func_80B9D4D0(ObjHunsui* this, GlobalContext* globalCtx) {
this->unk_172 &= ~2;
this->unk_172 |= 0x10;
this->unk_174 = 240.0f;
this->actionFunc = func_80B9D508;
}
void func_80B9D508(ObjHunsui* this, GlobalContext* globalCtx) {
if (((this->unk_160 == OBJHUNSUI_F000_5) || (this->unk_160 == OBJHUNSUI_F000_6)) &&
(this->unk_16C != globalCtx->roomCtx.currRoom.num) && (this->unk_16C != globalCtx->roomCtx.prevRoom.num) &&
(this->unk_16D != globalCtx->roomCtx.currRoom.num) && (this->unk_16D != globalCtx->roomCtx.prevRoom.num)) {
switch (this->unk_160) {
case OBJHUNSUI_F000_5:
D_80B9DED8.unk_01 = 0;
break;
case OBJHUNSUI_F000_6:
D_80B9DED8.unk_02 = 0;
break;
}
Actor_MarkForDeath(&this->dyna.actor);
return;
}
func_80B9C5E8(this, globalCtx);
func_80B9D094(this, globalCtx);
if (((this->unk_160 == OBJHUNSUI_F000_5) || (this->unk_160 == OBJHUNSUI_F000_6)) &&
(globalCtx->roomCtx.currRoom.num == 8)) {
func_80B9D334(this, globalCtx);
}
if (!(this->unk_172 & 0x40)) {
Math_SmoothStepToF(&this->unk_178, this->unk_174, 0.6f, 10.5f, 0.05f);
}
this->dyna.actor.world.pos.y = this->unk_198 + (this->dyna.actor.home.pos.y + this->unk_178);
if ((this->unk_160 == OBJHUNSUI_F000_6) || (this->unk_160 == OBJHUNSUI_F000_5)) {
this->unk_1AC += -10.0f + (1.8f * (this->dyna.actor.world.pos.y - this->dyna.actor.prevPos.y));
this->unk_1B0 += -8.0f + (0.9f * (this->dyna.actor.world.pos.y - this->dyna.actor.prevPos.y));
}
if (!(this->unk_172 & 1) && !func_80B9C450(globalCtx, this->unk_168, this->unk_164)) {
this->unk_17C = this->unk_170;
this->unk_172 |= 0x40;
func_80B9D0FC(this, globalCtx);
}
}
void func_80B9D714(ObjHunsui* this, GlobalContext* globalCtx) {
s32 pad;
Player* player = GET_PLAYER(globalCtx);
s16 cs;
f32 sp28;
if ((this->unk_16C != globalCtx->roomCtx.currRoom.num) && (this->unk_16C != globalCtx->roomCtx.prevRoom.num) &&
(this->unk_16D != globalCtx->roomCtx.currRoom.num) && (this->unk_16D != globalCtx->roomCtx.prevRoom.num)) {
Actor_MarkForDeath(&this->dyna.actor);
} else {
if (Flags_GetSwitch(globalCtx, this->unk_168)) {
this->unk_172 &= ~2;
this->unk_172 |= 0x10;
cs = this->dyna.actor.cutscene;
if (this->unk_16E == 0) {
if ((cs >= 0) && !ActorCutscene_GetCanPlayNext(cs)) {
ActorCutscene_SetIntentToPlay(cs);
} else if (cs >= 0) {
ActorCutscene_StartAndSetUnkLinkFields(cs, &this->dyna.actor);
this->unk_16E = -1;
} else {
this->unk_16E = 40;
}
} else if (this->unk_16E < 0) {
if (func_800F22C4(cs, &this->dyna.actor)) {
this->unk_16E = 40;
}
} else {
s32 pad;
if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 800.0f, 0.1f, 8.0f,
1.0f) < 0.5f) {
if (DECR(this->unk_16E) == 0) {
Flags_UnsetSwitch(globalCtx, this->unk_168);
}
}
this->dyna.actor.velocity.y = this->dyna.actor.world.pos.y - this->dyna.actor.prevPos.y;
}
} else {
Math_StepToF(&this->dyna.actor.velocity.y, -10.0f, 4.0f);
this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y;
if (this->dyna.actor.world.pos.y < this->dyna.actor.home.pos.y) {
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y;
this->unk_172 &= ~0x10;
this->unk_172 |= 2;
}
}
}
if (!DynaPolyActor_IsInRidingMovingState(&this->dyna)) {
if (this->dyna.actor.xzDistToPlayer < 45.0f) {
if ((this->dyna.actor.playerHeightRel < -this->dyna.actor.velocity.y) &&
(this->dyna.actor.playerHeightRel >= -800.0f)) {
sp28 = (45.0f - this->dyna.actor.xzDistToPlayer) * 0.5f;
player->actor.world.pos.x += sp28 * Math_SinS(this->dyna.actor.yawTowardsPlayer);
player->actor.world.pos.z += sp28 * Math_CosS(this->dyna.actor.yawTowardsPlayer);
}
}
}
}
void ObjHunsui_Draw(Actor* thisx, GlobalContext* globalCtx) {
ObjHunsui* this = THIS;
if (this->unk_172 & 0x10) {
f32 temp_f8 = (this->dyna.actor.world.pos.y - this->dyna.actor.home.pos.y) / 800.0f;
func_8019FAD8(&this->dyna.actor.projectedPos, NA_SE_EV_WATER_PILLAR - SFX_FLAG, 1.0f + temp_f8);
}
if (!(this->unk_172 & 2)) {
AnimatedMat_Draw(globalCtx, D_80B9DED0);
Gfx_DrawDListXlu(globalCtx, object_hunsui_DL_000220);
}
}
void func_80B9DA60(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
ObjHunsui* this = THIS;
f32 temp;
if (this->unk_172 & 0x10) {
temp = 1.0f + ((this->unk_178 - 240.0f) / 270.0f);
func_8019FAD8(&this->dyna.actor.projectedPos, NA_SE_EV_WATER_PILLAR - SFX_FLAG, 1.0f + temp);
}
if ((this->dyna.actor.flags & ACTOR_FLAG_40) && !(this->unk_172 & 2)) {
if ((this->unk_160 == OBJHUNSUI_F000_6) || (this->unk_160 == OBJHUNSUI_F000_5)) {
OPEN_DISPS(globalCtx->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (globalCtx->gameplayFrames % 128) * -9, 0x20,
0x20, 1, 0, (globalCtx->gameplayFrames % 128) * -8, 0x20, 0x20));
gSPSegment(POLY_XLU_DISP++, 0x09,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (s32)this->unk_1AC, 0x20, 0x20, 1, 0,
(s32)this->unk_1B0, 0x20, 0x20));
CLOSE_DISPS(globalCtx->state.gfxCtx);
} else {
AnimatedMat_DrawXlu(globalCtx, D_80B9DED4);
}
OPEN_DISPS(globalCtx->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x7F, 255, 255, 255, 127);
Gfx_DrawDListXlu(globalCtx, object_hunsui_DL_000EC0);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
}

View File

@ -2,18 +2,56 @@
#define Z_OBJ_HUNSUI_H
#include "global.h"
#include "overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.h"
struct ObjHunsui;
typedef void (*ObjHunsuiActionFunc)(struct ObjHunsui*, GlobalContext*);
#define OBJHUNSUI_GET_7F(thisx) ((thisx)->params & 0x7F)
#define OBJHUNSUI_GET_F80(thisx) (((thisx)->params >> 7) & 0x1F)
#define OBJHUNSUI_GET_F000(thisx) (((thisx)->params >> 0xC) & 0xF)
enum {
/* 0 */ OBJHUNSUI_F000_0,
/* 1 */ OBJHUNSUI_F000_1,
/* 2 */ OBJHUNSUI_F000_2,
/* 3 */ OBJHUNSUI_F000_3,
/* 4 */ OBJHUNSUI_F000_4,
/* 5 */ OBJHUNSUI_F000_5,
/* 6 */ OBJHUNSUI_F000_6,
};
typedef struct ObjHunsui {
/* 0x0000 */ Actor actor;
/* 0x0144 */ char unk_144[0x18];
/* 0x0000 */ DynaPolyActor dyna;
/* 0x015C */ ObjHunsuiActionFunc actionFunc;
/* 0x0160 */ char unk_160[0x58];
/* 0x0160 */ s16 unk_160;
/* 0x0164 */ s32 unk_164;
/* 0x0168 */ s32 unk_168;
/* 0x016C */ s8 unk_16C;
/* 0x016D */ s8 unk_16D;
/* 0x016E */ s8 unk_16E;
/* 0x0170 */ s16 unk_170;
/* 0x0172 */ u16 unk_172;
/* 0x0174 */ f32 unk_174;
/* 0x0178 */ f32 unk_178;
/* 0x017C */ s16 unk_17C;
/* 0x0180 */ s32 unk_180;
/* 0x0184 */ s16 unk_184;
/* 0x0186 */ s16 unk_186;
/* 0x0188 */ s16 unk_188;
/* 0x018A */ s16 unk_18A;
/* 0x018C */ s16 unk_18C;
/* 0x0190 */ f32 unk_190;
/* 0x0194 */ f32 unk_194;
/* 0x0198 */ f32 unk_198;
/* 0x019C */ f32 unk_19C;
/* 0x01A0 */ f32 unk_1A0;
/* 0x01A4 */ s16 unk_1A4;
/* 0x0196 */ UNK_TYPE1 unk1A6[0x6];
/* 0x01AC */ f32 unk_1AC;
/* 0x01B0 */ f32 unk_1B0;
/* 0x01B4 */ BgDblueMovebg* unk_1B4;
} ObjHunsui; // size = 0x1B8
extern const ActorInit Obj_Hunsui_InitVars;

View File

@ -2043,14 +2043,6 @@ D_06002FC4 = 0x06002FC4;
D_06000080 = 0x06000080;
D_06000110 = 0x06000110;
// ovl_Obj_Hunsui
D_06000220 = 0x06000220;
D_06000BF0 = 0x06000BF0;
D_06000C74 = 0x06000C74;
D_06000EC0 = 0x06000EC0;
D_06001888 = 0x06001888;
// ovl_Obj_Jgame_Light
D_060003A0 = 0x060003A0;