ovl_Bg_Haka_Bombwall partially decompiled (1 NON_MATCHING) (#947)

* progress

* 1 non matching + reloc issues?

* final details

* format

* final details

* reverting changes to ovl_Bg_Kin2_Bombwall

* undefined_syms

* undef

* warnings

* pr review
This commit is contained in:
Alejandro Asenjo 2022-07-22 02:15:20 -03:00 committed by GitHub
parent 6dd31c00e5
commit fed7cec4ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 188 additions and 36 deletions

7
spec
View File

@ -4557,8 +4557,11 @@ beginseg
name "ovl_Bg_Haka_Bombwall"
compress
include "build/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.o"
include "build/data/ovl_Bg_Haka_Bombwall/ovl_Bg_Haka_Bombwall.data.o"
include "build/data/ovl_Bg_Haka_Bombwall/ovl_Bg_Haka_Bombwall.reloc.o"
#ifdef NON_MATCHING
include "build/src/overlays/actors/ovl_Bg_Haka_Bombwall/ovl_Bg_Haka_Bombwall_reloc.o"
#else
include "build/data/ovl_Bg_Haka_Bombwall/ovl_Bg_Haka_Bombwall.reloc.o"
#endif
endseg
beginseg

View File

@ -5,6 +5,7 @@
*/
#include "z_bg_haka_bombwall.h"
#include "objects/object_haka_obj/object_haka_obj.h"
#define FLAGS 0x00000000
@ -15,7 +16,14 @@ void BgHakaBombwall_Destroy(Actor* thisx, PlayState* play);
void BgHakaBombwall_Update(Actor* thisx, PlayState* play);
void BgHakaBombwall_Draw(Actor* thisx, PlayState* play);
#if 0
void func_80BD5E6C(BgHakaBombwall* this, PlayState* play);
void func_80BD6260(BgHakaBombwall* this);
void func_80BD6274(BgHakaBombwall* this, PlayState* play);
void BgHakaBombwall_SetupPlayCutscene(BgHakaBombwall* this);
void BgHakaBombwall_PlayCutscene(BgHakaBombwall* this, PlayState* play);
void BgHakaBombwall_SetupEndCutscene(BgHakaBombwall* this);
void BgHakaBombwall_EndCutscene(BgHakaBombwall* this, PlayState* play);
const ActorInit Bg_Haka_Bombwall_InitVars = {
ACTOR_BG_HAKA_BOMBWALL,
ACTORCAT_BG,
@ -28,50 +36,191 @@ const ActorInit Bg_Haka_Bombwall_InitVars = {
(ActorFunc)BgHakaBombwall_Draw,
};
// static ColliderCylinderInit sCylinderInit = {
static ColliderCylinderInit D_80BD64A0 = {
{ COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_NONE, OC2_NONE, COLSHAPE_CYLINDER, },
{ ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, },
static ColliderCylinderInit sCylinderInit = {
{
COLTYPE_NONE,
AT_NONE,
AC_ON | AC_TYPE_PLAYER,
OC1_NONE,
OC2_NONE,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK0,
{ 0x00000000, 0x00, 0x00 },
{ 0x00000008, 0x00, 0x00 },
TOUCH_NONE | TOUCH_SFX_NORMAL,
BUMP_ON,
OCELEM_NONE,
},
{ 80, 80, 0, { 0, 0, 0 } },
};
// static InitChainEntry sInitChain[] = {
static InitChainEntry D_80BD64D4[] = {
static s16 D_80BD64CC[4] = { 24, 15, 10, 5 };
static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneScale, 500, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 500, ICHAIN_CONTINUE),
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
};
s32 func_80BD5E00(BgHakaBombwall* this) {
if (this->collider.base.acFlags & AC_HIT) {
if ((this->collider.base.ac != NULL) &&
(Math3D_Vec3fDistSq(&this->dyna.actor.world.pos, &this->collider.base.ac->world.pos) < SQ(80.0f))) {
return true;
}
}
return false;
}
#ifdef NON_MATCHING
void func_80BD5E6C(BgHakaBombwall* this, PlayState* play) {
s32 i;
Vec3f spE0;
Vec3f spD4;
Vec3f spC8;
Vec3f spBC;
f32 temp_fs0;
f32 phi_fs1;
s16 phi_s0;
s16 gravity;
s16 phi_t0;
Matrix_Push();
Matrix_RotateYS(this->dyna.actor.shape.rot.y, MTXMODE_NEW);
temp_fs0 = 0.0f;
phi_fs1 = 0.0f;
for (i = 0; i < 30; i++) {
temp_fs0 += 60.0f + (Rand_ZeroOne() * 20.0f);
if (temp_fs0 > 75.0f) {
temp_fs0 -= 150.0f;
}
spC8.x = temp_fs0;
phi_fs1 += 5;
spC8.y = phi_fs1;
spC8.z = (Rand_ZeroOne() * 20.0f) - 10.0f;
spBC.x = ((Rand_ZeroOne() - 0.5f) * 5.0f) + (temp_fs0 * (4.0f / 75.0f));
spBC.y = (Rand_ZeroOne() * 7.0f) - 2.0f;
spBC.z = (Rand_ZeroOne() * 4.0f) - 2.0f;
Matrix_MultVec3f(&spC8, &spE0);
Matrix_MultVec3f(&spBC, &spD4);
spE0.x += this->dyna.actor.world.pos.x;
spE0.y += this->dyna.actor.world.pos.y;
spE0.z += this->dyna.actor.world.pos.z;
if ((i & 3) == 0) {
phi_s0 = 32;
func_800BBFB0(play, &spE0, 60.0f, 2, 100, 120, 1);
} else {
phi_s0 = 64;
}
if (i % 2 != 0) {
phi_s0 |= 1;
phi_t0 = 1;
} else {
phi_t0 = 0;
}
if (D_80BD64CC[i & 3] >= 16) {
gravity = -550;
} else {
gravity = -450;
}
EffectSsKakera_Spawn(play, &spE0, &spD4, &spE0, gravity, phi_s0, 30, 0, 0, D_80BD64CC[i & 3], phi_t0, 0, 50, -1,
OBJECT_IKANA_OBJ, object_haka_obj_DL_001680);
}
Matrix_Pop();
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/func_80BD5E6C.s")
#endif
extern ColliderCylinderInit D_80BD64A0;
extern InitChainEntry D_80BD64D4[];
void BgHakaBombwall_Init(Actor* thisx, PlayState* play) {
s32 pad;
BgHakaBombwall* this = THIS;
extern UNK_TYPE D_06000040;
extern UNK_TYPE D_06000148;
extern UNK_TYPE D_06001680;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, 0);
Collider_InitCylinder(play, &this->collider);
if (Flags_GetSwitch(play, BGHAKABOMBWALL_GET_7F(thisx))) {
Actor_MarkForDeath(&this->dyna.actor);
} else {
DynaPolyActor_LoadMesh(play, &this->dyna, &object_haka_obj_Colheader_000148);
Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit);
Collider_UpdateCylinder(&this->dyna.actor, &this->collider);
func_80BD6260(this);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/func_80BD5E00.s")
void BgHakaBombwall_Destroy(Actor* thisx, PlayState* play) {
BgHakaBombwall* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/func_80BD5E6C.s")
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
Collider_DestroyCylinder(play, &this->collider);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/BgHakaBombwall_Init.s")
void func_80BD6260(BgHakaBombwall* this) {
this->actionFunc = func_80BD6274;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/BgHakaBombwall_Destroy.s")
void func_80BD6274(BgHakaBombwall* this, PlayState* play) {
if (func_80BD5E00(this)) {
BgHakaBombwall_SetupPlayCutscene(this);
} else {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/func_80BD6260.s")
void BgHakaBombwall_SetupPlayCutscene(BgHakaBombwall* this) {
this->dyna.actor.flags |= ACTOR_FLAG_10;
ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene);
this->actionFunc = BgHakaBombwall_PlayCutscene;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/func_80BD6274.s")
void BgHakaBombwall_PlayCutscene(BgHakaBombwall* this, PlayState* play) {
if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) {
ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor);
func_80BD5E6C(this, play);
this->dyna.actor.draw = NULL;
Flags_SetSwitch(play, BGHAKABOMBWALL_GET_7F(&this->dyna.actor));
SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 0x3C, NA_SE_EV_WALL_BROKEN);
func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId);
BgHakaBombwall_SetupEndCutscene(this);
} else {
ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/func_80BD62D0.s")
void BgHakaBombwall_SetupEndCutscene(BgHakaBombwall* this) {
this->csTimer = 30;
this->actionFunc = BgHakaBombwall_EndCutscene;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/func_80BD6314.s")
void BgHakaBombwall_EndCutscene(BgHakaBombwall* this, PlayState* play) {
this->csTimer--;
if (this->csTimer <= 0) {
ActorCutscene_Stop(this->dyna.actor.cutscene);
Actor_MarkForDeath(&this->dyna.actor);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/func_80BD63B4.s")
void BgHakaBombwall_Update(Actor* thisx, PlayState* play) {
BgHakaBombwall* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/func_80BD63D0.s")
this->actionFunc(this, play);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/BgHakaBombwall_Update.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Haka_Bombwall/BgHakaBombwall_Draw.s")
void BgHakaBombwall_Draw(Actor* thisx, PlayState* play) {
Gfx_DrawDListOpa(play, object_haka_obj_DL_000040);
}

View File

@ -3,15 +3,17 @@
#include "global.h"
#define BGHAKABOMBWALL_GET_7F(thisx) ((thisx)->params & 0x7F)
struct BgHakaBombwall;
typedef void (*BgHakaBombwallActionFunc)(struct BgHakaBombwall*, PlayState*);
typedef struct BgHakaBombwall {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x64];
/* 0x000 */ DynaPolyActor dyna;
/* 0x15C */ ColliderCylinder collider;
/* 0x1A8 */ BgHakaBombwallActionFunc actionFunc;
/* 0x1AC */ char unk_1AC[0x4];
/* 0x1AC */ s8 csTimer;
} BgHakaBombwall; // size = 0x1B0
extern const ActorInit Bg_Haka_Bombwall_InitVars;

View File

@ -15830,10 +15830,10 @@
0x80BD6218:("BgHakaBombwall_Destroy",),
0x80BD6260:("func_80BD6260",),
0x80BD6274:("func_80BD6274",),
0x80BD62D0:("func_80BD62D0",),
0x80BD6314:("func_80BD6314",),
0x80BD63B4:("func_80BD63B4",),
0x80BD63D0:("func_80BD63D0",),
0x80BD62D0:("BgHakaBombwall_SetupPlayCutscene",),
0x80BD6314:("BgHakaBombwall_PlayCutscene",),
0x80BD63B4:("BgHakaBombwall_SetupEndCutscene",),
0x80BD63D0:("BgHakaBombwall_EndCutscene",),
0x80BD6420:("BgHakaBombwall_Update",),
0x80BD6444:("BgHakaBombwall_Draw",),
0x80BD6580:("BgHakaTomb_Init",),

View File

@ -582,8 +582,6 @@ D_060037F8 = 0x060037F8;
// ovl_Bg_Haka_Bombwall
D_06000040 = 0x06000040;
D_06000148 = 0x06000148;
D_06001680 = 0x06001680;
// ovl_Bg_Hakugin_Bombwall