mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-07 06:40:15 +00:00
mori_bigst (#392)
* Darkmeiro decompilation Bg_Gnd_Darkmeiro decompiled, matched, and documented. * give this a shot * fix conflict * one more try * mori_bigst matched and documented * forgot the .s files again * Update src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> * one .s got away * more cleanup * one more thing * wait for mori tex * cleanup * Update z_bg_mori_bigst.c Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
parent
b48fa7ff4a
commit
201584a707
25 changed files with 235 additions and 781 deletions
|
@ -1,3 +1,9 @@
|
|||
/*
|
||||
* File: z_bg_mori_bigst.c
|
||||
* Overlay: ovl_Bg_Mori_Bigst
|
||||
* Description: Forest Temple falling platform and Stalfos fight
|
||||
*/
|
||||
|
||||
#include "z_bg_mori_bigst.h"
|
||||
|
||||
#define FLAGS 0x00000010
|
||||
|
@ -7,8 +13,24 @@
|
|||
void BgMoriBigst_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgMoriBigst_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgMoriBigst_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgMoriBigst_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
void BgMoriBigst_SetupWaitForMoriTex(BgMoriBigst* this, GlobalContext* globalCtx);
|
||||
void BgMoriBigst_WaitForMoriTex(BgMoriBigst* this, GlobalContext* globalCtx);
|
||||
void BgMoriBigst_SetupNoop(BgMoriBigst* this, GlobalContext* globalCtx);
|
||||
void BgMoriBigst_SetupStalfosFight(BgMoriBigst* this, GlobalContext* globalCtx);
|
||||
void BgMoriBigst_StalfosFight(BgMoriBigst* this, GlobalContext* globalCtx);
|
||||
void BgMoriBigst_SetupFall(BgMoriBigst* this, GlobalContext* globalCtx);
|
||||
void BgMoriBigst_Fall(BgMoriBigst* this, GlobalContext* globalCtx);
|
||||
void BgMoriBigst_SetupLanding(BgMoriBigst* this, GlobalContext* globalCtx);
|
||||
void BgMoriBigst_Landing(BgMoriBigst* this, GlobalContext* globalCtx);
|
||||
void BgMoriBigst_SetupStalfosPairFight(BgMoriBigst* this, GlobalContext* globalCtx);
|
||||
void BgMoriBigst_StalfosPairFight(BgMoriBigst* this, GlobalContext* globalCtx);
|
||||
void BgMoriBigst_SetupDone(BgMoriBigst* this, GlobalContext* globalCtx);
|
||||
|
||||
extern ColHeader D_0600221C;
|
||||
extern Gfx D_06001E50[];
|
||||
|
||||
/*
|
||||
const ActorInit Bg_Mori_Bigst_InitVars = {
|
||||
ACTOR_BG_MORI_BIGST,
|
||||
ACTORTYPE_BG,
|
||||
|
@ -20,39 +42,220 @@ const ActorInit Bg_Mori_Bigst_InitVars = {
|
|||
(ActorFunc)BgMoriBigst_Update,
|
||||
NULL,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Bigst/func_808A0BC0.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Bigst/func_808A0BC8.s")
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_F32(uncullZoneForward, 3000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 3000, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneDownward, 3000, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -500, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32_DIV1000(minVelocityY, -12000, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Bigst/BgMoriBigst_Init.s")
|
||||
void BgMoriBigst_SetupAction(BgMoriBigst* this, BgMoriBigstActionFunc actionFunc) {
|
||||
this->actionFunc = actionFunc;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Bigst/BgMoriBigst_Destroy.s")
|
||||
void BgMoriBigst_InitDynapoly(BgMoriBigst* this, GlobalContext* globalCtx, ColHeader* collision, s32 moveFlag) {
|
||||
s32 pad;
|
||||
ColHeader* colHeader = NULL;
|
||||
s32 pad2;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Bigst/func_808A0DDC.s")
|
||||
DynaPolyInfo_SetActorMove(&this->dyna, moveFlag);
|
||||
DynaPolyInfo_Alloc(collision, &colHeader);
|
||||
this->dyna.dynaPolyId =
|
||||
DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Bigst/func_808A0E04.s")
|
||||
if (this->dyna.dynaPolyId == 0x32) {
|
||||
// Warning : move BG login failed
|
||||
osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_mori_bigst.c", 190,
|
||||
this->dyna.actor.id, this->dyna.actor.params);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Bigst/func_808A0ED0.s")
|
||||
void BgMoriBigst_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
BgMoriBigst* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Bigst/func_808A0EF4.s")
|
||||
// mori (bigST.keyceiling)
|
||||
osSyncPrintf("mori (bigST.鍵型天井)(arg : %04x)(sw %d)(noE %d)(roomC %d)(playerPosY %f)\n", this->dyna.actor.params,
|
||||
Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F),
|
||||
Flags_GetTempClear(globalCtx, this->dyna.actor.room), Flags_GetClear(globalCtx, this->dyna.actor.room),
|
||||
PLAYER->actor.posRot.pos.y);
|
||||
BgMoriBigst_InitDynapoly(this, globalCtx, &D_0600221C, DPM_UNK);
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
this->moriTexObjIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX);
|
||||
if (this->moriTexObjIndex < 0) {
|
||||
// 【Big Stalfos key ceiling】 bank danger!
|
||||
osSyncPrintf("【ビッグスタルフォス鍵型天井】 バンク危険!\n");
|
||||
osSyncPrintf("%s %d\n", "../z_bg_mori_bigst.c", 234);
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
return;
|
||||
}
|
||||
if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) {
|
||||
this->dyna.actor.posRot.pos.y = this->dyna.actor.initPosRot.pos.y;
|
||||
} else {
|
||||
this->dyna.actor.posRot.pos.y = this->dyna.actor.initPosRot.pos.y + 270.0f;
|
||||
}
|
||||
Actor_SetHeight(&this->dyna.actor, 50.0f);
|
||||
BgMoriBigst_SetupWaitForMoriTex(this, globalCtx);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Bigst/func_808A0FB0.s")
|
||||
void BgMoriBigst_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
BgMoriBigst* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Bigst/func_808A1024.s")
|
||||
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Bigst/func_808A104C.s")
|
||||
void BgMoriBigst_SetupWaitForMoriTex(BgMoriBigst* this, GlobalContext* globalCtx) {
|
||||
BgMoriBigst_SetupAction(this, BgMoriBigst_WaitForMoriTex);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Bigst/func_808A10D4.s")
|
||||
void BgMoriBigst_WaitForMoriTex(BgMoriBigst* this, GlobalContext* globalCtx) {
|
||||
Actor* thisx = &this->dyna.actor;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Bigst/func_808A1164.s")
|
||||
if (Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIndex)) {
|
||||
thisx->draw = BgMoriBigst_Draw;
|
||||
if (Flags_GetClear(globalCtx, thisx->room) && (PLAYER->actor.posRot.pos.y > 700.0f)) {
|
||||
if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0x3F)) {
|
||||
BgMoriBigst_SetupDone(this, globalCtx);
|
||||
} else {
|
||||
BgMoriBigst_SetupStalfosFight(this, globalCtx);
|
||||
}
|
||||
} else {
|
||||
BgMoriBigst_SetupNoop(this, globalCtx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Bigst/func_808A1190.s")
|
||||
void BgMoriBigst_SetupNoop(BgMoriBigst* this, GlobalContext* globalCtx) {
|
||||
BgMoriBigst_SetupAction(this, NULL);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Bigst/func_808A12C4.s")
|
||||
void BgMoriBigst_SetupStalfosFight(BgMoriBigst* this, GlobalContext* globalCtx) {
|
||||
Actor* stalfos;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Bigst/func_808A1320.s")
|
||||
BgMoriBigst_SetupAction(this, BgMoriBigst_StalfosFight);
|
||||
Flags_UnsetClear(globalCtx, this->dyna.actor.room);
|
||||
stalfos = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_TEST, 209.0f, 827.0f,
|
||||
-3320.0f, 0, 0, 0, 1);
|
||||
if (stalfos != NULL) {
|
||||
this->dyna.actor.child = NULL;
|
||||
this->dyna.actor.initPosRot.rot.z++;
|
||||
} else {
|
||||
// Second Stalfos failure
|
||||
osSyncPrintf("Warning : 第2スタルフォス発生失敗\n");
|
||||
}
|
||||
Flags_SetClear(globalCtx, this->dyna.actor.room);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Bigst/BgMoriBigst_Update.s")
|
||||
void BgMoriBigst_StalfosFight(BgMoriBigst* this, GlobalContext* globalCtx) {
|
||||
Player* player = PLAYER;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Bigst/func_808A13B4.s")
|
||||
if ((this->dyna.actor.initPosRot.rot.z == 0) &&
|
||||
((this->dyna.actor.initPosRot.pos.y - 5.0f) <= PLAYER->actor.posRot.pos.y)) {
|
||||
BgMoriBigst_SetupFall(this, globalCtx);
|
||||
func_800800F8(globalCtx, 0xC94, 0x48, &this->dyna.actor, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void BgMoriBigst_SetupFall(BgMoriBigst* this, GlobalContext* globalCtx) {
|
||||
BgMoriBigst_SetupAction(this, BgMoriBigst_Fall);
|
||||
}
|
||||
|
||||
void BgMoriBigst_Fall(BgMoriBigst* this, GlobalContext* globalCtx) {
|
||||
Actor_MoveForward(&this->dyna.actor);
|
||||
if (this->dyna.actor.posRot.pos.y <= this->dyna.actor.initPosRot.pos.y) {
|
||||
this->dyna.actor.posRot.pos.y = this->dyna.actor.initPosRot.pos.y;
|
||||
BgMoriBigst_SetupLanding(this, globalCtx);
|
||||
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND);
|
||||
func_800800F8(globalCtx, 0x3FC, 8, &this->dyna.actor, 0);
|
||||
func_8002DF38(globalCtx, NULL, 0x3C);
|
||||
}
|
||||
}
|
||||
|
||||
void BgMoriBigst_SetupLanding(BgMoriBigst* this, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
s32 quake;
|
||||
|
||||
BgMoriBigst_SetupAction(this, BgMoriBigst_Landing);
|
||||
this->waitTimer = 18;
|
||||
quake = Quake_Add(ACTIVE_CAM, 3);
|
||||
Quake_SetSpeed(quake, 25000);
|
||||
Quake_SetQuakeValues(quake, 5, 0, 0, 0);
|
||||
Quake_SetCountdown(quake, 16);
|
||||
}
|
||||
|
||||
void BgMoriBigst_Landing(BgMoriBigst* this, GlobalContext* globalCtx) {
|
||||
if (this->waitTimer <= 0) {
|
||||
BgMoriBigst_SetupStalfosPairFight(this, globalCtx);
|
||||
}
|
||||
}
|
||||
|
||||
void BgMoriBigst_SetupStalfosPairFight(BgMoriBigst* this, GlobalContext* globalCtx) {
|
||||
Actor* stalfos1;
|
||||
Actor* stalfos2;
|
||||
|
||||
BgMoriBigst_SetupAction(this, BgMoriBigst_StalfosPairFight);
|
||||
Flags_UnsetClear(globalCtx, this->dyna.actor.room);
|
||||
stalfos1 =
|
||||
Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_TEST, 70.0f, 827.0f, -3383.0f, 0, 0, 0, 5);
|
||||
if (stalfos1 != NULL) {
|
||||
this->dyna.actor.child = NULL;
|
||||
this->dyna.actor.initPosRot.rot.z++;
|
||||
} else {
|
||||
// Warning: 3-1 Stalfos failure
|
||||
osSyncPrintf("Warning : 第3-1スタルフォス発生失敗\n");
|
||||
}
|
||||
stalfos2 =
|
||||
Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_TEST, 170.0f, 827.0f, -3260.0f, 0, 0, 0, 5);
|
||||
if (stalfos2 != NULL) {
|
||||
this->dyna.actor.child = NULL;
|
||||
this->dyna.actor.initPosRot.rot.z++;
|
||||
} else {
|
||||
// Warning: 3-2 Stalfos failure
|
||||
osSyncPrintf("Warning : 第3-2スタルフォス発生失敗\n");
|
||||
}
|
||||
Flags_SetClear(globalCtx, this->dyna.actor.room);
|
||||
}
|
||||
|
||||
void BgMoriBigst_StalfosPairFight(BgMoriBigst* this, GlobalContext* globalCtx) {
|
||||
if ((this->dyna.actor.initPosRot.rot.z == 0) && !Player_InCsMode(globalCtx)) {
|
||||
Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F);
|
||||
BgMoriBigst_SetupDone(this, globalCtx);
|
||||
}
|
||||
}
|
||||
|
||||
void BgMoriBigst_SetupDone(BgMoriBigst* this, GlobalContext* globalCtx) {
|
||||
BgMoriBigst_SetupAction(this, NULL);
|
||||
}
|
||||
|
||||
void BgMoriBigst_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
BgMoriBigst* this = THIS;
|
||||
|
||||
Actor_SetHeight(&this->dyna.actor, 50.0f);
|
||||
if (this->waitTimer > 0) {
|
||||
this->waitTimer--;
|
||||
}
|
||||
if (func_80043590(&this->dyna)) {
|
||||
func_80074CE8(globalCtx, 6);
|
||||
}
|
||||
if (this->actionFunc != NULL) {
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
}
|
||||
|
||||
void BgMoriBigst_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
BgMoriBigst* this = THIS;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_bigst.c", 541);
|
||||
func_80093D18(globalCtx->state.gfxCtx);
|
||||
|
||||
gSPSegment(oGfxCtx->polyOpa.p++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIndex].segment);
|
||||
|
||||
gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_bigst.c", 548),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
gSPDisplayList(oGfxCtx->polyOpa.p++, D_06001E50);
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_bigst.c", 553);
|
||||
}
|
||||
|
|
|
@ -6,9 +6,13 @@
|
|||
|
||||
struct BgMoriBigst;
|
||||
|
||||
typedef void (*BgMoriBigstActionFunc)(struct BgMoriBigst*, GlobalContext*);
|
||||
|
||||
typedef struct BgMoriBigst {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x20];
|
||||
/* 0x0000 */ DynaPolyActor dyna;
|
||||
/* 0x0164 */ BgMoriBigstActionFunc actionFunc;
|
||||
/* 0x0168 */ s16 waitTimer;
|
||||
/* 0x016A */ s8 moriTexObjIndex;
|
||||
} BgMoriBigst; // size = 0x016C
|
||||
|
||||
extern const ActorInit Bg_Mori_Bigst_InitVars;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue