diff --git a/assets/xml/objects/object_fwall.xml b/assets/xml/objects/object_fwall.xml index 1f7fb575bb..1bbb5d572b 100644 --- a/assets/xml/objects/object_fwall.xml +++ b/assets/xml/objects/object_fwall.xml @@ -1,6 +1,24 @@  - + + + + + + + + + + + + + + + + + + + diff --git a/spec b/spec index eda0cfe476..9bf8943cc9 100644 --- a/spec +++ b/spec @@ -2931,8 +2931,7 @@ beginseg name "ovl_Bg_Spout_Fire" compress include "build/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.o" - include "build/data/ovl_Bg_Spout_Fire/ovl_Bg_Spout_Fire.data.o" - include "build/data/ovl_Bg_Spout_Fire/ovl_Bg_Spout_Fire.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Spout_Fire/ovl_Bg_Spout_Fire_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.c b/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.c index c43a13a25d..055598c002 100644 --- a/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.c +++ b/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.c @@ -5,6 +5,7 @@ */ #include "z_bg_spout_fire.h" +#include "objects/object_fwall/object_fwall.h" #define FLAGS 0x00000000 @@ -13,12 +14,14 @@ void BgSpoutFire_Init(Actor* thisx, PlayState* play); void BgSpoutFire_Destroy(Actor* thisx, PlayState* play); void BgSpoutFire_Update(Actor* thisx, PlayState* play); +void BgSpoutFire_Draw(Actor* thisx, PlayState* play); +s32 func_80A60C24(BgSpoutFire* this, PlayState* play); void func_80A60C94(BgSpoutFire* this, PlayState* play); void func_80A60CDC(BgSpoutFire* this, PlayState* play); void func_80A60D10(BgSpoutFire* this, PlayState* play); +void func_80A60E08(BgSpoutFire* this, PlayState* play); -#if 0 const ActorInit Bg_Spout_Fire_InitVars = { ACTOR_BG_SPOUT_FIRE, ACTORCAT_BG, @@ -31,39 +34,170 @@ const ActorInit Bg_Spout_Fire_InitVars = { (ActorFunc)NULL, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80A61160 = { - { COLTYPE_NONE, AT_ON | AT_TYPE_ENEMY, AC_NONE, OC1_ON | OC1_TYPE_PLAYER, OC2_TYPE_2, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NONE, BUMP_NONE, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_ON | AT_TYPE_ENEMY, + AC_NONE, + OC1_ON | OC1_TYPE_PLAYER, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x20000000, 0x01, 0x04 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NONE, + BUMP_NONE, + OCELEM_ON, + }, { 30, 83, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit D_80A6118C = { 1, 80, 100, MASS_IMMOVABLE }; +static CollisionCheckInfoInit sColChkInfoInit = { 1, 80, 100, MASS_IMMOVABLE }; -#endif +static TexturePtr sFlameTextures[] = { + gFwallFireball0Tex, gFwallFireball1Tex, gFwallFireball2Tex, gFwallFireball3Tex, + gFwallFireball4Tex, gFwallFireball5Tex, gFwallFireball6Tex, gFwallFireball7Tex, +}; -extern ColliderCylinderInit D_80A61160; -extern CollisionCheckInfoInit D_80A6118C; +static s32 sTexturesDesegmented = false; -extern UNK_TYPE D_06000040; +void BgSpoutFire_Init(Actor* thisx, PlayState* play) { + s32 i; + BgSpoutFire* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Spout_Fire/BgSpoutFire_Init.s") + this->actor.scale.z = 1350.0f * 0.0001f; + this->actor.scale.x = 1350.0f * 0.0001f; + this->actor.scale.y = 0.01f; + this->flameTexIndex = 0; + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + this->collider.dim.pos.y = this->actor.world.pos.y; + CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); + if (!sTexturesDesegmented) { + for (i = 0; i < ARRAY_COUNT(sFlameTextures); i++) { + sFlameTextures[i] = Lib_SegmentedToVirtual(sFlameTextures[i]); + } + sTexturesDesegmented = true; + } + this->actionFunc = func_80A60C94; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Spout_Fire/BgSpoutFire_Destroy.s") +void BgSpoutFire_Destroy(Actor* thisx, PlayState* play) { + BgSpoutFire* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Spout_Fire/func_80A60C24.s") + Collider_DestroyCylinder(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Spout_Fire/func_80A60C94.s") +s32 func_80A60C24(BgSpoutFire* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Vec3f sp18; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Spout_Fire/func_80A60CDC.s") + Actor_OffsetOfPointInActorCoords(&this->actor, &sp18, &player->actor.world.pos); + if ((fabsf(sp18.x) < 100.0f) && (fabsf(sp18.z) < 120.0f)) { + return true; + } else { + return false; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Spout_Fire/func_80A60D10.s") +void func_80A60C94(BgSpoutFire* this, PlayState* play) { + if (func_80A60C24(this, play)) { + this->actor.draw = BgSpoutFire_Draw; + this->timer = 5; + this->actionFunc = func_80A60CDC; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Spout_Fire/func_80A60DA0.s") +void func_80A60CDC(BgSpoutFire* this, PlayState* play) { + if (this->timer != 0) { + this->timer--; + } + if (this->timer == 0) { + this->actionFunc = func_80A60D10; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Spout_Fire/func_80A60E08.s") +void func_80A60D10(BgSpoutFire* this, PlayState* play) { + if (func_80A60C24(this, play)) { + Math_StepToF(&this->actor.scale.y, 0.1f, 2.5f * 0.01f); + } else if (Math_StepToF(&this->actor.scale.y, 0.01f, 0.01f)) { + this->actor.draw = NULL; + this->actionFunc = func_80A60C94; + } else { + this->timer = 0; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Spout_Fire/BgSpoutFire_Update.s") +void func_80A60DA0(BgSpoutFire* this, PlayState* play) { + s16 phi_a3; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Spout_Fire/func_80A61040.s") + if (Actor_IsFacingPlayer(&this->actor, 0x4000)) { + phi_a3 = this->actor.shape.rot.y; + } else { + phi_a3 = (this->actor.shape.rot.y + 0x8000); + } + func_800B8D98(play, &this->actor, 5.0f, phi_a3, 1.0f); +} + +void func_80A60E08(BgSpoutFire* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Vec3f sp30; + f32 cos; + f32 sin; + + Actor_OffsetOfPointInActorCoords(&this->actor, &sp30, &player->actor.world.pos); + sp30.x = CLAMP(sp30.x, -74.25f, 74.25f); + if (this->timer == 0) { + if (sp30.z > 0.0f) { + sp30.z = -25.0f; + this->timer = -1; + } else { + sp30.z = 25.0f; + this->timer = 1; + } + } else { + sp30.z = this->timer * 25.0f; + } + sin = Math_SinS(this->actor.shape.rot.y); + cos = Math_CosS(this->actor.shape.rot.y); + this->collider.dim.pos.x = this->actor.world.pos.x + (sp30.x * cos) + (sp30.z * sin); + this->collider.dim.pos.z = this->actor.world.pos.z - (sp30.x * sin) + (sp30.z * cos); +} + +void BgSpoutFire_Update(Actor* thisx, PlayState* play) { + s32 pad; + BgSpoutFire* this = THIS; + + this->flameTexIndex = (this->flameTexIndex + 1) % 8; + if ((this->collider.base.atFlags & AT_HIT)) { + this->collider.base.atFlags &= ~AT_HIT; + func_80A60DA0(this, play); + } + this->actionFunc(this, play); + if (this->actionFunc == func_80A60D10) { + func_80A60E08(this, play); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + func_800B9010(&this->actor, NA_SE_EV_FIRE_PLATE - SFX_FLAG); + } +} + +void BgSpoutFire_Draw(Actor* thisx, PlayState* play) { + BgSpoutFire* this = THIS; + Gfx* gfx; + + OPEN_DISPS(play->state.gfxCtx); + + gfx = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); + POLY_XLU_DISP = gfx; + gSPSegment(&gfx[0], 0x08, sFlameTextures[this->flameTexIndex]); + gDPSetPrimColor(&gfx[1], 0, 1, 255, 255, 0, 150); + gDPSetEnvColor(&gfx[2], 255, 0, 0, 255); + Matrix_Translate(-55.0f, 0.0f, 0.0f, MTXMODE_APPLY); + gSPMatrix(&gfx[3], Matrix_NewMtx(play->state.gfxCtx), (G_MTX_NOPUSH | G_MTX_LOAD) | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[4], object_fwall_DL_000040); + POLY_XLU_DISP = &gfx[5]; + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.h b/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.h index 54260cf71f..808b720617 100644 --- a/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.h +++ b/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.h @@ -8,9 +8,11 @@ struct BgSpoutFire; typedef void (*BgSpoutFireActionFunc)(struct BgSpoutFire*, PlayState*); typedef struct BgSpoutFire { - /* 0x0000 */ Actor actor; - /* 0x0144 */ BgSpoutFireActionFunc actionFunc; - /* 0x0148 */ char unk_148[0x50]; + /* 0x000 */ Actor actor; + /* 0x144 */ BgSpoutFireActionFunc actionFunc; + /* 0x148 */ s16 timer; + /* 0x14A */ s16 flameTexIndex; + /* 0x14C */ ColliderCylinder collider; } BgSpoutFire; // size = 0x198 extern const ActorInit Bg_Spout_Fire_InitVars; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 2ad13737b6..ee4bd732fc 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -10749,7 +10749,7 @@ 0x80A60DA0:("func_80A60DA0",), 0x80A60E08:("func_80A60E08",), 0x80A60F68:("BgSpoutFire_Update",), - 0x80A61040:("func_80A61040",), + 0x80A61040:("BgSpoutFire_Draw",), 0x80A612B0:("EnDyExtra_Destroy",), 0x80A612C0:("EnDyExtra_Init",), 0x80A61334:("func_80A61334",), diff --git a/undefined_syms.txt b/undefined_syms.txt index ebbdb298d6..5959dc57da 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -660,10 +660,6 @@ D_06001640 = 0x06001640; D_06000048 = 0x06000048; -// ovl_Bg_Spout_Fire - -D_06000040 = 0x06000040; - // ovl_Bg_Umajump D_06001220 = 0x06001220;