mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-07 06:40:15 +00:00
Decompiles z_bg_spot11_bakudankabe.c (#355)
* Starts z_bg_spot11_bakudankabe * BgSpot11Bakudankabe_Init * BgSpot11Bakudankabe_Destroy * BgSpot11Bakudankabe_Update * BgSpot11Bakudankabe_Draw * func_808B2180 * func_808B2218 WIP * Finishes z_bg_spot11_bakudankabe.c * Removes forward declared function * Addresses PR comments Co-authored-by: i82orbom <i82orbom i82orbom@github>
This commit is contained in:
parent
98ca965541
commit
468c592792
12 changed files with 117 additions and 445 deletions
|
@ -15,7 +15,6 @@ void BgSpot11Bakudankabe_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
|||
void BgSpot11Bakudankabe_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgSpot11Bakudankabe_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
const ActorInit Bg_Spot11_Bakudankabe_InitVars = {
|
||||
ACTOR_BG_SPOT11_BAKUDANKABE,
|
||||
ACTORTYPE_BG,
|
||||
|
@ -27,15 +26,117 @@ const ActorInit Bg_Spot11_Bakudankabe_InitVars = {
|
|||
(ActorFunc)BgSpot11Bakudankabe_Update,
|
||||
(ActorFunc)BgSpot11Bakudankabe_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot11_Bakudankabe/func_808B2180.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot11_Bakudankabe/func_808B2218.s")
|
||||
static ColliderCylinderInit sCylinderInit = {
|
||||
{ COLTYPE_UNK10, 0x00, 0x09, 0x00, 0x20, COLSHAPE_CYLINDER },
|
||||
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, 0x00, 0x01, 0x00 },
|
||||
{ 40, 80, 0, { 2259, 108, -1580 } },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot11_Bakudankabe/BgSpot11Bakudankabe_Init.s")
|
||||
Vec3f D_808B272C = { 2259.0f, 108.0f, -1550.0f };
|
||||
Vec3f D_808B2738 = { 2259.0f, 108.0f, -1550.0f };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot11_Bakudankabe/BgSpot11Bakudankabe_Destroy.s")
|
||||
extern UNK_TYPE D_06001A58;
|
||||
extern Gfx D_06001980[];
|
||||
extern Gfx D_0500A880[];
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot11_Bakudankabe/BgSpot11Bakudankabe_Update.s")
|
||||
void func_808B2180(BgSpot11Bakudankabe* this, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot11_Bakudankabe/BgSpot11Bakudankabe_Draw.s")
|
||||
Collider_InitCylinder(globalCtx, &this->collider);
|
||||
Collider_SetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit);
|
||||
this->collider.dim.pos.x += (s16)this->dyna.actor.posRot.pos.x;
|
||||
this->collider.dim.pos.y += (s16)this->dyna.actor.posRot.pos.y;
|
||||
this->collider.dim.pos.z += (s16)this->dyna.actor.posRot.pos.z;
|
||||
}
|
||||
|
||||
void func_808B2218(BgSpot11Bakudankabe* this, GlobalContext* globalCtx) {
|
||||
Actor* thisx = &this->dyna.actor;
|
||||
Vec3f burstDepthY;
|
||||
Vec3f burstDepthX;
|
||||
s32 i;
|
||||
|
||||
burstDepthX.z = 0;
|
||||
burstDepthX.x = 0;
|
||||
|
||||
for (i = 0; i < 20; i++) {
|
||||
s16 scale;
|
||||
s32 gravityInfluence;
|
||||
s32 rotationSpeed;
|
||||
|
||||
Math_Vec3f_Sum(&thisx->posRot.pos, &D_808B272C, &burstDepthY);
|
||||
|
||||
burstDepthY.x += (Math_Rand_ZeroOne() - 0.5f) * 120.0f;
|
||||
burstDepthY.y += (30.0f + (i * 6.5f));
|
||||
burstDepthY.z += (Math_Rand_ZeroOne() - 0.5f) * 20.0f;
|
||||
|
||||
burstDepthX.y = (Math_Rand_ZeroOne() - 0.2f) * 12.0f;
|
||||
scale = (Math_Rand_ZeroOne() * 55.0f) + 8.0f;
|
||||
|
||||
if (scale < 20) {
|
||||
gravityInfluence = -300;
|
||||
} else if (scale < 35) {
|
||||
gravityInfluence = -360;
|
||||
} else {
|
||||
gravityInfluence = -420;
|
||||
}
|
||||
if (Math_Rand_ZeroOne() < 0.4f) {
|
||||
rotationSpeed = 65;
|
||||
} else {
|
||||
rotationSpeed = 33;
|
||||
}
|
||||
func_80029E8C(globalCtx, &burstDepthY, &burstDepthX, &burstDepthY, gravityInfluence, rotationSpeed, 0x1E, 4, 0,
|
||||
scale, 1, 3, 80, -1, OBJECT_GAMEPLAY_FIELD_KEEP, D_0500A880);
|
||||
}
|
||||
Math_Vec3f_Sum(&thisx->posRot.pos, &D_808B272C, &burstDepthY);
|
||||
func_80033480(globalCtx, &burstDepthY, 70, 4, 110, 160, 1);
|
||||
burstDepthY.y += 40;
|
||||
func_80033480(globalCtx, &burstDepthY, 70, 5, 110, 160, 1);
|
||||
burstDepthY.y += 40;
|
||||
func_80033480(globalCtx, &burstDepthY, 70, 4, 110, 160, 1);
|
||||
}
|
||||
|
||||
void BgSpot11Bakudankabe_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgSpot11Bakudankabe* this = THIS;
|
||||
s32 pad;
|
||||
s32 sp24;
|
||||
|
||||
sp24 = 0;
|
||||
DynaPolyInfo_SetActorMove(&this->dyna, 0);
|
||||
if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params & 0x3F))) {
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
return;
|
||||
}
|
||||
func_808B2180(this, globalCtx);
|
||||
DynaPolyInfo_Alloc(&D_06001A58, &sp24);
|
||||
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp24);
|
||||
Actor_SetScale(&this->dyna.actor, 1.0f);
|
||||
osSyncPrintf("(spot11 爆弾壁)(arg_data 0x%04x)\n", this->dyna.actor.params);
|
||||
}
|
||||
|
||||
void BgSpot11Bakudankabe_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgSpot11Bakudankabe* this = THIS;
|
||||
|
||||
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
|
||||
Collider_DestroyCylinder(globalCtx, &this->collider);
|
||||
}
|
||||
|
||||
void BgSpot11Bakudankabe_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgSpot11Bakudankabe* this = THIS;
|
||||
|
||||
if (this->collider.base.acFlags & 2) {
|
||||
func_808B2218(this, globalCtx);
|
||||
Flags_SetSwitch(globalCtx, (this->dyna.actor.params & 0x3F));
|
||||
Audio_PlaySoundAtPosition(globalCtx, &D_808B2738, 40, NA_SE_EV_WALL_BROKEN);
|
||||
func_80078884(NA_SE_SY_CORRECT_CHIME);
|
||||
Actor_Kill(&this->dyna.actor);
|
||||
return;
|
||||
}
|
||||
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
}
|
||||
|
||||
void BgSpot11Bakudankabe_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgSpot11Bakudankabe* this = THIS;
|
||||
|
||||
Gfx_DrawDListOpa(globalCtx, D_06001980);
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
struct BgSpot11Bakudankabe;
|
||||
|
||||
typedef struct BgSpot11Bakudankabe {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x64];
|
||||
/* 0x0000 */ DynaPolyActor dyna;
|
||||
/* 0x0164 */ ColliderCylinder collider;
|
||||
} BgSpot11Bakudankabe; // size = 0x01B0
|
||||
|
||||
extern const ActorInit Bg_Spot11_Bakudankabe_InitVars;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue