bg_iknin_susceil OK (#186)

* 6 functions left

* All but one function matched

* all functions decomped

* Formatted files

* Added switch flag define

* Made all suggested changes
This commit is contained in:
kyleburnette 2021-06-15 15:43:01 -07:00 committed by GitHub
parent 80752e1107
commit ad3f2b525e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 237 additions and 29 deletions

View File

@ -262,7 +262,9 @@ typedef struct {
/* 0xB08 */ f32 unkB08;
/* 0xB0C */ UNK_TYPE1 padB0C[0x1C];
/* 0xB28 */ s16 unkB28;
/* 0xB2A */ UNK_TYPE1 padB2A[0x56];
/* 0xB2A */ UNK_TYPE1 padB2A[0x1E];
/* 0xB48 */ f32 unkB48;
/* 0xB4C */ UNK_TYPE1 padB4C[0x34];
/* 0xB80 */ f32 unk_B80;
/* 0xB84 */ s16 unk_B84;
/* 0xB86 */ char unk_B86[0x16];

View File

@ -8928,9 +8928,9 @@ SECTIONS
ovl_Bg_Iknin_Susceil : AT(RomLocation)
{
build/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.o(.text)
build/asm/overlays/ovl_Bg_Iknin_Susceil_data.o(.data)
build/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.o(.data)
build/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.o(.rodata)
build/asm/overlays/ovl_Bg_Iknin_Susceil_rodata.o(.rodata)
build/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil_overlay.o(.ovl)
}
SegmentEnd = .;
SegmentSize = SegmentEnd - SegmentStart;

View File

@ -243,6 +243,11 @@ D_06003478 = 0x06003478;
D_06000040 = 0x06000040;
D_060024F0 = 0x060024F0;
/* z_bg_iknin_susceil */
D_0600CBAC = 0x0600CBAC;
D_0600C670 = 0x0600C670;
D_0600C308 = 0x0600C308;
/* z_bg_keikoku_spr */
D_06000100 = 0x06000100;
D_060001F8 = 0x060001F8;

View File

@ -9,7 +9,21 @@ void BgIkninSusceil_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgIkninSusceil_Update(Actor* thisx, GlobalContext* globalCtx);
void BgIkninSusceil_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
void func_80C0AB44(BgIkninSusceil* this, GlobalContext* globalCtx);
void func_80C0AB88(BgIkninSusceil* this);
void func_80C0ABA8(BgIkninSusceil* this, GlobalContext* globalCtx);
void func_80C0AC74(BgIkninSusceil* this);
void func_80C0AC90(BgIkninSusceil* this, GlobalContext* globalCtx);
void func_80C0ACD4(BgIkninSusceil* this);
void func_80C0ACE8(BgIkninSusceil* this, GlobalContext* globalCtx);
void func_80C0AD44(BgIkninSusceil* this);
void func_80C0AD64(BgIkninSusceil* this, GlobalContext* globalCtx);
void func_80C0AE5C(BgIkninSusceil* this, GlobalContext* globalCtx);
extern CollisionHeader D_0600CBAC;
extern AnimatedMaterial D_0600C670;
extern Gfx D_0600C308[];
const ActorInit Bg_Iknin_Susceil_InitVars = {
ACTOR_BG_IKNIN_SUSCEIL,
ACTORCAT_BG,
@ -21,46 +35,224 @@ const ActorInit Bg_Iknin_Susceil_InitVars = {
(ActorFunc)BgIkninSusceil_Update,
(ActorFunc)BgIkninSusceil_Draw,
};
*/
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/func_80C0A740.asm")
s32 unused = 0;
f32 D_80C0B0E4 = 960.0f;
Vec2f D_80C0B0E8 = { -320.0f, 0.0f };
s8 D_80C0B0F0[] = { 0x00, 0x00, 0x07, 0x0A, 0x0A, 0x0B, 0x0B, 0x00 };
s8 D_80C0B0F8[] = { 0x01, 0x02, 0x00, 0x01, 0x02, 0x01, 0x02, 0x00 };
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/func_80C0A804.asm")
static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
};
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/func_80C0A838.asm")
s32 func_80C0A740(BgIkninSusceil* this, GlobalContext* globalCtx) {
s32 pad2[2];
Vec3f offset;
ActorPlayer* player = PLAYER;
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/func_80C0A86C.asm")
Actor_CalcOffsetOrientedToDrawRotation(&this->dyna.actor, &offset, &player->base.world.pos);
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/func_80C0A95C.asm")
return (D_80C0B0E8.x < offset.z) && (offset.z < D_80C0B0E8.y) && (offset.x > -240.0f) && (offset.x < D_80C0B0E4);
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/BgIkninSusceil_Init.asm")
void func_80C0A804(BgIkninSusceil* this, GlobalContext* globalCtx) {
func_800C6314(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/BgIkninSusceil_Destroy.asm")
void func_80C0A838(BgIkninSusceil* this, GlobalContext* globalCtx) {
func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/func_80C0AB14.asm")
void func_80C0A86C(BgIkninSusceil* this, GlobalContext* globalCtx, s16 y, s16 countdown, s32 arg4) {
s32 pad;
s16 quake = Quake_Add(ACTIVE_CAM, 3);
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/func_80C0AB44.asm")
Quake_SetSpeed(quake, 0x7B30);
Quake_SetQuakeValues(quake, y, 0, 0, 0);
Quake_SetCountdown(quake, countdown);
if (arg4 == 1) {
func_8013ECE0(10000.0f, 255, 20, 150);
} else if (arg4 == 2) {
func_8013ECE0(10000.0f, 180, 20, 100);
} else if (arg4 == 3) {
func_8013ECE0(10000.0f, 120, 20, 10);
}
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/func_80C0AB88.asm")
s32 func_80C0A95C(BgIkninSusceil* this, GlobalContext* globalCtx) {
s32 phi_t0 = true;
s32 i;
f32 new_var;
ActorPlayer* player = PLAYER;
Vec3f offset;
f32 temp1, temp2, temp3, temp4;
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/func_80C0ABA8.asm")
Actor_CalcOffsetOrientedToDrawRotation(&this->dyna.actor, &offset, &player->base.world.pos);
for (i = 0; i < 7; i++) {
temp3 = (D_80C0B0F0[i] * 80.0f) + 0.5f;
temp4 = (D_80C0B0F0[i] * 80.0f) + 79.5f;
if (1) {}
new_var = D_80C0B0F8[i] * -80.0f; // temp seems to actually be needed for matching
temp1 = new_var - 79.5f;
temp2 = new_var - 0.5f;
if ((temp1 < offset.z) && (offset.z < temp2) && (temp3 < offset.x) && (offset.x < temp4)) {
phi_t0 = false;
break;
}
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/func_80C0AC74.asm")
return phi_t0;
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/func_80C0AC90.asm")
void BgIkninSusceil_Init(Actor* thisx, GlobalContext* globalCtx) {
BgIkninSusceil* this = THIS;
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/func_80C0ACD4.asm")
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
BcCheck3_BgActorInit(&this->dyna, 1);
BgCheck3_LoadMesh(globalCtx, &this->dyna, &D_0600CBAC);
this->animatedTexture = Lib_SegmentedToVirtual(&D_0600C670);
func_80C0AC74(this);
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/func_80C0ACE8.asm")
void BgIkninSusceil_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgIkninSusceil* this = THIS;
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/func_80C0AD44.asm")
BgCheck_RemoveActorMesh(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/func_80C0AD64.asm")
void func_80C0AB14(BgIkninSusceil* this) {
this->timer = 110;
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 365.0f;
this->actionFunc = func_80C0AB44;
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/func_80C0AE3C.asm")
void func_80C0AB44(BgIkninSusceil* this, GlobalContext* globalCtx) {
if (this->timer > 0) {
this->timer -= 1;
return;
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/func_80C0AE5C.asm")
if (func_80C0A740(this, globalCtx)) {
func_80C0AB88(this);
}
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/BgIkninSusceil_Update.asm")
void func_80C0AB88(BgIkninSusceil* this) {
this->actionFunc = func_80C0ABA8;
this->dyna.actor.velocity.y = -10.0f;
}
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Bg_Iknin_Susceil_0x80C0A740/BgIkninSusceil_Draw.asm")
void func_80C0ABA8(BgIkninSusceil* this, GlobalContext* globalCtx) {
this->dyna.actor.velocity.y += -0.7f;
this->dyna.actor.velocity.y *= 0.93f;
this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y;
if (this->dyna.actor.world.pos.y <= this->dyna.actor.home.pos.y) {
func_80C0A86C(this, globalCtx, 4, 14, 1);
Actor_UnsetSwitchFlag(globalCtx, GET_SUSCEIL_SWITCHFLAG(this));
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BIGWALL_BOUND);
func_80C0AC74(this);
} else {
func_800B9010(&this->dyna.actor, NA_SE_EV_ICE_PILLAR_FALL - SFX_FLAG);
}
}
void func_80C0AC74(BgIkninSusceil* this) {
this->actionFunc = func_80C0AC90;
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y;
}
void func_80C0AC90(BgIkninSusceil* this, GlobalContext* globalCtx) {
if (Flags_GetSwitch(globalCtx, GET_SUSCEIL_SWITCHFLAG(this))) {
func_80C0ACD4(this);
}
}
void func_80C0ACD4(BgIkninSusceil* this) {
this->actionFunc = func_80C0ACE8;
}
void func_80C0ACE8(BgIkninSusceil* this, GlobalContext* globalCtx) {
if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) {
ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor);
func_80C0AD44(this);
} else {
ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene);
}
}
void func_80C0AD44(BgIkninSusceil* this) {
this->actionFunc = func_80C0AD64;
this->dyna.actor.velocity.y = 5.0f;
}
void func_80C0AD64(BgIkninSusceil* this, GlobalContext* globalCtx) {
this->dyna.actor.velocity.y += 0.46f;
this->dyna.actor.velocity.y *= 0.98f;
if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 365.0f, 0.5f,
this->dyna.actor.velocity.y, 1.0f) < 0.1f) {
func_80C0A86C(this, globalCtx, 1, 0xE, 3);
ActorCutscene_Stop(this->dyna.actor.cutscene);
func_80C0AB14(this);
} else {
func_800B9010(&this->dyna.actor, NA_SE_EV_ICE_PILLAR_RISING - SFX_FLAG);
}
}
void func_80C0AE3C(BgIkninSusceil* this) {
this->actionFunc = func_80C0AE5C;
this->dyna.actor.velocity.y = 30.0f;
}
void func_80C0AE5C(BgIkninSusceil* this, GlobalContext* globalCtx) {
this->dyna.actor.velocity.y += -0.1f;
this->dyna.actor.velocity.y *= 0.95f;
this->dyna.actor.velocity.y = CLAMP_MIN(this->dyna.actor.velocity.y, 1.0f);
this->dyna.actor.world.pos.y = this->dyna.actor.world.pos.y + this->dyna.actor.velocity.y;
if ((this->dyna.actor.home.pos.y + 365.0f) < this->dyna.actor.world.pos.y) {
func_80C0A86C(this, globalCtx, 3, 14, 2);
func_80C0AB14(this);
}
}
void BgIkninSusceil_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
BgIkninSusceil* this = THIS;
ActorPlayer* player = PLAYER;
if ((this->unk168 == 0) && (this->unk166 > 0) && ((player->unkA74 & 0x100) != 0) && (player->unkB48 > 1000.0f)) {
this->unk168 = 2;
if ((func_80C0A95C(this, globalCtx) != 0) && (this->actionFunc != func_80C0AE5C)) {
func_800B8E58(player, 0x83E);
func_80C0AE3C(this);
}
}
if (this->unk168 > 0) {
this->unk168--;
}
this->actionFunc(this, globalCtx);
if ((this->dyna.actor.home.pos.y + 70.0f) < this->dyna.actor.world.pos.y) {
this->unk166 = 0;
} else if ((player->unkA74 & 0x100) != 0) {
this->unk166 = 3;
} else {
if (this->unk166 > 0) {
this->unk166--;
}
}
if (this->unk166 > 0) {
func_80C0A838(this, globalCtx);
} else {
func_80C0A804(this, globalCtx);
}
}
void BgIkninSusceil_Draw(Actor* thisx, GlobalContext* globalCtx) {
BgIkninSusceil* this = THIS;
AnimatedMat_Draw(globalCtx, this->animatedTexture);
func_800BDFC0(globalCtx, D_0600C308);
}

View File

@ -3,11 +3,20 @@
#include <global.h>
#define GET_SUSCEIL_SWITCHFLAG(this) (((this)->dyna.actor.params) & 0x7F)
struct BgIkninSusceil;
typedef void (*BgIkninSusceilActionFunc)(struct BgIkninSusceil*, GlobalContext*);
typedef struct BgIkninSusceil {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x28];
/* 0x000 */ DynaPolyActor dyna;
/* 0x15C */ AnimatedMaterial* animatedTexture;
/* 0x160 */ BgIkninSusceilActionFunc actionFunc;
/* 0x164 */ s16 timer;
/* 0x166 */ s16 unk166;
/* 0x168 */ s16 unk168;
/* 0x16A */ UNK_TYPE2 unk16A;
} BgIkninSusceil; // size = 0x16C
extern const ActorInit Bg_Iknin_Susceil_InitVars;

View File

@ -28,7 +28,7 @@ def get_c_file(directory):
def find_build_command_line(c_file):
rel_c_file = os.path.relpath(c_file, root_dir)
make_cmd = ["make", "rom_uncompressed.z64", "--always-make", "--dry-run", "--debug=j", "PERMUTER=1"]
make_cmd = ["make", "mm.us.rev1.rom_uncompressed.z64", "--always-make", "--dry-run", "--debug=j", "PERMUTER=1"]
debug_output = (
subprocess.check_output(make_cmd, cwd=root_dir).decode("utf-8").split("\n")
)