diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c | 128 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h | 5 |
2 files changed, 114 insertions, 19 deletions
diff --git a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c index 4ce75c6d2..7df87077d 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c +++ b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c @@ -1,14 +1,26 @@ +/* + * File: z_bg_spot12_saku.c + * Overlay: Bg_Spot12_Saku + * Description: + */ + #include "z_bg_spot12_saku.h" #define ROOM 0x00 #define FLAGS 0x00000000 -void BgSpot12Saku_Init(BgSpot12Saku* this, GlobalContext* globalCtx); -void BgSpot12Saku_Destroy(BgSpot12Saku* this, GlobalContext* globalCtx); -void BgSpot12Saku_Update(BgSpot12Saku* this, GlobalContext* globalCtx); -void BgSpot12Saku_Draw(BgSpot12Saku* this, GlobalContext* globalCtx); +static void BgSpot12Saku_Init(BgSpot12Saku* this, GlobalContext* globalCtx); +static void BgSpot12Saku_Destroy(BgSpot12Saku* this, GlobalContext* globalCtx); +static void BgSpot12Saku_Update(BgSpot12Saku* this, GlobalContext* globalCtx); +static void BgSpot12Saku_Draw(BgSpot12Saku* this, GlobalContext* globalCtx); + +static void func_808B3550(BgSpot12Saku* this); +static void func_808B357C(BgSpot12Saku* this, GlobalContext* globalCtx); +static void func_808B35E4(BgSpot12Saku* this); +static void func_808B3604(BgSpot12Saku* this, GlobalContext* globalCtx); +static void func_808B3714(BgSpot12Saku* this); +static void func_808B37AC(BgSpot12Saku* this, GlobalContext* globalCtx); -/* const ActorInit Bg_Spot12_Saku_InitVars = { ACTOR_BG_SPOT12_SAKU, ACTORTYPE_BG, @@ -21,25 +33,107 @@ const ActorInit Bg_Spot12_Saku_InitVars = { (ActorFunc)BgSpot12Saku_Update, (ActorFunc)BgSpot12Saku_Draw, }; -*/ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Saku/func_808B3420.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Saku/BgSpot12Saku_Init.s") +static InitChainEntry D_808B3840[] = { + ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), + ICHAIN_F32(unk_F4, 1200, ICHAIN_CONTINUE), + ICHAIN_F32(unk_F8, 500, ICHAIN_CONTINUE), + ICHAIN_F32(unk_FC, 1000, ICHAIN_STOP), +}; + +extern UNK_PTR D_06002260; +extern UNK_PTR D_0600238C; + +static void func_808B3420(BgSpot12Saku* this, GlobalContext* globalCtx, UNK_TYPE collision, DynaPolyMoveFlag flags) { + Actor* thisx = &this->dyna.actor; + s32 localC = 0; + s32 pad[2]; + + DynaPolyInfo_SetActorMove(thisx, flags); + DynaPolyInfo_Alloc(collision, &localC); + this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, localC); + if (this->dyna.dynaPolyId == 0x32) { + osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_saku.c", 140, + thisx->id, thisx->params); + } +} + +static void BgSpot12Saku_Init(BgSpot12Saku* this, GlobalContext* globalCtx) { + Actor* thisx = &this->dyna.actor; + + func_808B3420(this, globalCtx, &D_0600238C, 0); + Actor_ProcessInitChain(thisx, D_808B3840); + if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + func_808B3714(this); + } else { + func_808B3550(this); + } +} + +static void BgSpot12Saku_Destroy(BgSpot12Saku* this, GlobalContext* globalCtx) { + DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); +} + +static void func_808B3550(BgSpot12Saku* this) { + Actor* thisx = &this->dyna.actor; + + this->actionFunc = func_808B357C; + thisx->scale.x = 0.1f; + thisx->posRot.pos.x = thisx->initPosRot.pos.x; + thisx->posRot.pos.z = thisx->initPosRot.pos.z; +} + +static void func_808B357C(BgSpot12Saku* this, GlobalContext* globalCtx) { + Actor* thisx = &this->dyna.actor; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Saku/BgSpot12Saku_Destroy.s") + if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + func_808B35E4(this); + this->unk_168 = 0x14; + func_800800F8(globalCtx, 0x104A, -0x63, thisx, 0); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Saku/func_808B3550.s") +static void func_808B35E4(BgSpot12Saku* this) { + if (this->unk_168 == 0) { + this->actionFunc = func_808B3604; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Saku/func_808B357C.s") +static void func_808B3604(BgSpot12Saku* this, GlobalContext* globalCtx) { + f32 temp_ret = Math_SmoothScaleMaxMinF(&this->dyna.actor.scale.x, 0.001f / 0.14f, 0.16f, 0.0022f, 0.001f); + f32 temp_f18 = ((0.1f - this->dyna.actor.scale.x) * 840.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Saku/func_808B35E4.s") + this->dyna.actor.posRot.pos.x = + this->dyna.actor.initPosRot.pos.x - (Math_Sins(this->dyna.actor.shape.rot.y + 0x4000) * temp_f18); + this->dyna.actor.posRot.pos.z = + this->dyna.actor.initPosRot.pos.z - (Math_Coss(this->dyna.actor.shape.rot.y + 0x4000) * temp_f18); + if (fabsf(temp_ret) < 0.0001f) { + func_808B3714(this); + Audio_PlayActorSound2(&this->dyna.actor, 0x280E); + } else { + func_8002F974(&this->dyna.actor, 0x2067); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Saku/func_808B3604.s") +static void func_808B3714(BgSpot12Saku* this) { + Actor* thisx = &this->dyna.actor; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Saku/func_808B3714.s") + this->actionFunc = func_808B37AC; + thisx->scale.x = 0.00714285764843f; + thisx->posRot.pos.x = thisx->initPosRot.pos.x - (Math_Sins(thisx->shape.rot.y + 0x4000) * 78.0f); + thisx->posRot.pos.z = thisx->initPosRot.pos.z - (Math_Coss(thisx->shape.rot.y + 0x4000) * 78.0f); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Saku/func_808B37AC.s") +static void func_808B37AC(BgSpot12Saku* this, GlobalContext* globalCtx) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Saku/BgSpot12Saku_Update.s") +static void BgSpot12Saku_Update(BgSpot12Saku* this, GlobalContext* globalCtx) { + if (this->unk_168 > 0) { + this->unk_168 -= 1; + } + this->actionFunc(this, globalCtx); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Saku/BgSpot12Saku_Draw.s") +static void BgSpot12Saku_Draw(BgSpot12Saku* this, GlobalContext* globalCtx) { + Gfx_DrawDListOpa(globalCtx, &D_06002260); +} diff --git a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h index 8b748fa09..f6d018d88 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h +++ b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h @@ -5,8 +5,9 @@ #include <global.h> typedef struct { - /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0x20]; + /* 0x0000 */ DynaPolyActor dyna; + /* 0x0164 */ ActorFunc actionFunc; + /* 0x0168 */ s16 unk_168; } BgSpot12Saku; // size = 0x016C extern const ActorInit Bg_Spot12_Saku_InitVars; |
