mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-28 15:56:51 +00:00
commit
0a25ab74c4
4 changed files with 205 additions and 19 deletions
4
spec
4
spec
|
@ -930,9 +930,7 @@ endseg
|
||||||
beginseg
|
beginseg
|
||||||
name "ovl_Bg_Hidan_Firewall"
|
name "ovl_Bg_Hidan_Firewall"
|
||||||
include "build/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.o"
|
include "build/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.o"
|
||||||
include "build/data/overlays/actors/z_bg_hidan_firewall.data.o"
|
include "build/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall_reloc.o"
|
||||||
include "build/data/overlays/actors/z_bg_hidan_firewall.rodata.o"
|
|
||||||
include "build/data/overlays/actors/z_bg_hidan_firewall.reloc.o"
|
|
||||||
endseg
|
endseg
|
||||||
|
|
||||||
beginseg
|
beginseg
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
/*
|
||||||
|
* File: z_bg_hidan_firewall.c
|
||||||
|
* Overlay: ovl_Bg_Hidan_Firewall
|
||||||
|
* Description: Proximity Flame Wall
|
||||||
|
*/
|
||||||
|
|
||||||
#include "z_bg_hidan_firewall.h"
|
#include "z_bg_hidan_firewall.h"
|
||||||
|
|
||||||
#define ROOM 0x00
|
#define ROOM 0x00
|
||||||
|
@ -5,9 +11,17 @@
|
||||||
|
|
||||||
void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx);
|
void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx);
|
||||||
void BgHidanFirewall_Destroy(BgHidanFirewall* this, GlobalContext* globalCtx);
|
void BgHidanFirewall_Destroy(BgHidanFirewall* this, GlobalContext* globalCtx);
|
||||||
|
s32 BgHidanFirewall_CheckProximity(BgHidanFirewall* this, GlobalContext* globalCtx);
|
||||||
|
void BgHidanFirewall_Wait(BgHidanFirewall* this, GlobalContext* globalCtx);
|
||||||
|
void BgHidanFirewall_Countdown(BgHidanFirewall* this, GlobalContext* globalCtx);
|
||||||
|
void BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx);
|
||||||
|
void BgHidanFirewall_Collide(BgHidanFirewall* this, GlobalContext* globalCtx);
|
||||||
|
void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext* globalCtx);
|
||||||
void BgHidanFirewall_Update(BgHidanFirewall* this, GlobalContext* globalCtx);
|
void BgHidanFirewall_Update(BgHidanFirewall* this, GlobalContext* globalCtx);
|
||||||
|
void BgHidanFirewall_Draw(BgHidanFirewall* this, GlobalContext* globalCtx);
|
||||||
|
|
||||||
|
extern Gfx D_0600DA80[];
|
||||||
|
|
||||||
/*
|
|
||||||
const ActorInit Bg_Hidan_Firewall_InitVars = {
|
const ActorInit Bg_Hidan_Firewall_InitVars = {
|
||||||
ACTOR_BG_HIDAN_FIREWALL,
|
ACTOR_BG_HIDAN_FIREWALL,
|
||||||
ACTORTYPE_BG,
|
ACTORTYPE_BG,
|
||||||
|
@ -20,23 +34,194 @@ const ActorInit Bg_Hidan_Firewall_InitVars = {
|
||||||
(ActorFunc)BgHidanFirewall_Update,
|
(ActorFunc)BgHidanFirewall_Update,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
*/
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/BgHidanFirewall_Init.s")
|
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/BgHidanFirewall_Destroy.s")
|
static ColliderCylinderInit cylinderInitData = {
|
||||||
|
0x0A, 0x11, 0x00, 0x09,
|
||||||
|
0x20, 0x01, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x20000000,
|
||||||
|
0x01, 0x04, 0x00, 0x00,
|
||||||
|
0xFFCFFFFF,
|
||||||
|
0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x19, 0x00, 0x01, 0x00,
|
||||||
|
0x001E, 0x0053,
|
||||||
|
0x0000,
|
||||||
|
};
|
||||||
|
|
||||||
|
static Sub98Init4 actor98InitData = {
|
||||||
|
0x01, 0x0050, 0x0064, 0xFF,
|
||||||
|
};
|
||||||
|
|
||||||
|
UNK_PTR D_80886D04[] = {
|
||||||
|
0x06015D20,
|
||||||
|
0x06016120,
|
||||||
|
0x06016520,
|
||||||
|
0x06016920,
|
||||||
|
0x06016D20,
|
||||||
|
0x06017120,
|
||||||
|
0x06017520,
|
||||||
|
0x06017920,
|
||||||
|
};
|
||||||
|
|
||||||
|
void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx) {
|
||||||
|
|
||||||
|
f32 scale;
|
||||||
|
|
||||||
|
scale = 0.12f;
|
||||||
|
this->actor.scale.x = scale;
|
||||||
|
this->actor.scale.z = scale;
|
||||||
|
|
||||||
|
scale = 0.01f;
|
||||||
|
this->actor.scale.y = 0.01f;
|
||||||
|
|
||||||
|
this->unk_150 = 0;
|
||||||
|
|
||||||
|
ActorCollider_AllocCylinder(globalCtx, &this->collider);
|
||||||
|
ActorCollider_InitCylinder(globalCtx, &this->collider, &this->actor, &cylinderInitData);
|
||||||
|
|
||||||
|
this->collider.dim.position.y = this->actor.posRot.pos.y;
|
||||||
|
|
||||||
|
func_80061ED4(&this->actor.sub_98, NULL, &actor98InitData);
|
||||||
|
|
||||||
|
this->actionFunc = (ActorFunc)BgHidanFirewall_Wait;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BgHidanFirewall_Destroy(BgHidanFirewall* this, GlobalContext* globalCtx) {
|
||||||
|
BgHidanFirewall* thing = this;
|
||||||
|
ActorCollider_FreeCylinder(globalCtx, &this->collider);
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 BgHidanFirewall_CheckProximity(BgHidanFirewall* this, GlobalContext* globalCtx) {
|
||||||
|
Player* player;
|
||||||
|
Vec3f distance;
|
||||||
|
|
||||||
|
player = PLAYER;
|
||||||
|
func_8002DBD0(&this->actor, &distance, &player->actor.posRot.pos);
|
||||||
|
|
||||||
|
if (fabsf(distance.x) < 100.0f && fabsf(distance.z) < 120.0f) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BgHidanFirewall_Wait(BgHidanFirewall* this, GlobalContext* globalCtx) {
|
||||||
|
if (BgHidanFirewall_CheckProximity(this, globalCtx) != 0) {
|
||||||
|
this->actor.draw = BgHidanFirewall_Draw;
|
||||||
|
this->actor.params = 5;
|
||||||
|
this->actionFunc = (ActorFunc)BgHidanFirewall_Countdown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BgHidanFirewall_Countdown(BgHidanFirewall* this, GlobalContext* globalCtx) {
|
||||||
|
|
||||||
|
if (this->actor.params != 0) {
|
||||||
|
this->actor.params--;
|
||||||
|
}
|
||||||
|
if (this->actor.params == 0) {
|
||||||
|
this->actionFunc = (ActorFunc)BgHidanFirewall_Erupt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BgHidanFirewall_Erupt(BgHidanFirewall* this, GlobalContext* globalCtx) {
|
||||||
|
if (BgHidanFirewall_CheckProximity(this, globalCtx) != 0) {
|
||||||
|
Math_ApproxF(&this->actor.scale.y, 0.1f, 0.01f/0.4f);
|
||||||
|
} else {
|
||||||
|
if (Math_ApproxF(&this->actor.scale.y, 0.01f, 0.01f) != 0) {
|
||||||
|
this->actor.draw = NULL;
|
||||||
|
this->actionFunc = (ActorFunc)BgHidanFirewall_Wait;
|
||||||
|
} else {
|
||||||
|
this->actor.params = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BgHidanFirewall_Collide(BgHidanFirewall* this, GlobalContext* globalCtx) {
|
||||||
|
s16 phi_a3;
|
||||||
|
|
||||||
|
if (func_8002E084(&this->actor, 0x4000) != 0) {
|
||||||
|
phi_a3 = this->actor.shape.rot.y;
|
||||||
|
} else {
|
||||||
|
phi_a3 = this->actor.shape.rot.y + 0x8000;
|
||||||
|
}
|
||||||
|
func_8002F71C(globalCtx, &this->actor, 5.0f, phi_a3, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext* globalCtx) {
|
||||||
|
Player* player;
|
||||||
|
Vec3f sp30;
|
||||||
|
f32 temp_ret;
|
||||||
|
f32 sp28;
|
||||||
|
f32 phi_f0;
|
||||||
|
|
||||||
|
player = PLAYER;
|
||||||
|
|
||||||
|
func_8002DBD0(&this->actor, &sp30, &player->actor.posRot.pos);
|
||||||
|
if (sp30.x < -70.0f) {
|
||||||
|
sp30.x = -70.0f;
|
||||||
|
} else {
|
||||||
|
if (70.0f < sp30.x) {
|
||||||
|
phi_f0 = 70.0f;
|
||||||
|
} else {
|
||||||
|
phi_f0 = sp30.x;
|
||||||
|
}
|
||||||
|
sp30.x = phi_f0;
|
||||||
|
}
|
||||||
|
if (this->actor.params == 0) {
|
||||||
|
if (0.0f < sp30.z) {
|
||||||
|
sp30.z = -25.0f;
|
||||||
|
this->actor.params = -1;
|
||||||
|
} else {
|
||||||
|
sp30.z = 25.0f;
|
||||||
|
this->actor.params = 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sp30.z = this->actor.params * 25.0f;
|
||||||
|
}
|
||||||
|
sp28 = Math_Sins(this->actor.shape.rot.y);
|
||||||
|
temp_ret = Math_Coss(this->actor.shape.rot.y);
|
||||||
|
this->collider.dim.position.x = this->actor.posRot.pos.x + sp30.x * temp_ret + sp30.z * sp28;
|
||||||
|
this->collider.dim.position.z = this->actor.posRot.pos.z - sp30.x * sp28 + sp30.z * temp_ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BgHidanFirewall_Update(BgHidanFirewall* this, GlobalContext* globalCtx) {
|
||||||
|
s32 pad1;
|
||||||
|
s32 pad2;
|
||||||
|
|
||||||
|
this->unk_150 = (this->unk_150 + 1) % 8;
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/func_80886728.s")
|
if (this->collider.base.colliderFlags & 2) {
|
||||||
|
this->collider.base.colliderFlags &= ~2;
|
||||||
|
BgHidanFirewall_Collide(this, globalCtx);
|
||||||
|
}
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/func_80886794.s")
|
this->actionFunc(this, globalCtx);
|
||||||
|
if (this->actionFunc == (ActorFunc)BgHidanFirewall_Erupt) {
|
||||||
|
BgHidanFirewall_ColliderFollowPlayer(this, globalCtx);
|
||||||
|
Actor_CollisionCheck_SetAT(globalCtx, &globalCtx->sub_11E60, &this->collider);
|
||||||
|
Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider);
|
||||||
|
func_8002F974(&this->actor, 0x2034);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/func_808867DC.s")
|
void BgHidanFirewall_Draw(BgHidanFirewall* this, GlobalContext* globalCtx) {
|
||||||
|
UNK_PTR* temp;
|
||||||
|
u32 pad;
|
||||||
|
GraphicsContext* gfxCtx;
|
||||||
|
Gfx* dispRefs[3];
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/func_80886810.s")
|
gfxCtx = globalCtx->state.gfxCtx;
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/func_80886898.s")
|
Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 448);
|
||||||
|
gfxCtx->polyXlu.p = Gfx_CallSetupDL(gfxCtx->polyXlu.p, 0x14);
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/func_808868FC.s")
|
temp = D_80886D04;
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/BgHidanFirewall_Update.s")
|
gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(temp[this->unk_150]));
|
||||||
|
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0x01, 0xFF, 0xFF, 0x00, 0x96);
|
||||||
|
gDPSetEnvColor(gfxCtx->polyXlu.p++, 0xFF, 0x00, 0x00, 0xFF);
|
||||||
|
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 458),
|
||||||
|
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||||
|
gSPDisplayList(gfxCtx->polyXlu.p++, D_0600DA80);
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Firewall/func_80886B34.s")
|
Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 463);
|
||||||
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x0000 */ Actor actor;
|
/* 0x0000 */ Actor actor;
|
||||||
/* 0x014C */ char unk_14C[0x54];
|
/* 0x014C */ ActorFunc actionFunc;
|
||||||
|
/* 0x0150 */ s16 unk_150;
|
||||||
|
/* 0x0154 */ ColliderCylinderMain collider;
|
||||||
} BgHidanFirewall; // size = 0x01A0
|
} BgHidanFirewall; // size = 0x01A0
|
||||||
|
|
||||||
extern const ActorInit Bg_Hidan_Firewall_InitVars;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -480,3 +480,6 @@ D_060012C0 = 0x060012C0;
|
||||||
// z_obj_comb
|
// z_obj_comb
|
||||||
D_050095B0 = 0x050095B0;
|
D_050095B0 = 0x050095B0;
|
||||||
D_05009940 = 0x05009940;
|
D_05009940 = 0x05009940;
|
||||||
|
|
||||||
|
// z_bg_hidan_firewall
|
||||||
|
D_0600DA80 = 0x0600DA80;
|
||||||
|
|
Loading…
Reference in a new issue