diff --git a/spec b/spec index ae715c32d4..15519ef17d 100644 --- a/spec +++ b/spec @@ -3617,8 +3617,7 @@ beginseg name "ovl_En_Gamelupy" compress include "build/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.o" - include "build/data/ovl_En_Gamelupy/ovl_En_Gamelupy.data.o" - include "build/data/ovl_En_Gamelupy/ovl_En_Gamelupy.reloc.o" + include "build/src/overlays/actors/ovl_En_Gamelupy/ovl_En_Gamelupy_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c b/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c index c559e7183e..81f3be6d0e 100644 --- a/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c +++ b/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c @@ -5,6 +5,7 @@ */ #include "z_en_gamelupy.h" +#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_10) @@ -18,8 +19,10 @@ void EnGamelupy_Draw(Actor* thisx, PlayState* play); void func_80AF6958(EnGamelupy* this, PlayState* play); void func_80AF69A8(EnGamelupy* this, PlayState* play); void func_80AF6A78(EnGamelupy* this, PlayState* play); +void func_80AF6944(EnGamelupy* this); +void func_80AF6994(EnGamelupy* this); +void func_80AF6A38(EnGamelupy* this); -#if 0 const ActorInit En_Gamelupy_InitVars = { ACTOR_EN_GAMELUPY, ACTORCAT_PROP, @@ -32,37 +35,158 @@ const ActorInit En_Gamelupy_InitVars = { (ActorFunc)EnGamelupy_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80AF6CF0 = { - { COLTYPE_NONE, AT_NONE, AC_NONE, OC1_ON | OC1_NO_PUSH | OC1_TYPE_PLAYER, OC2_TYPE_2, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK4, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_NONE, + OC1_ON | OC1_NO_PUSH | OC1_TYPE_PLAYER, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK4, + { 0x00000000, 0x00, 0x00 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_ON, + }, { 10, 30, 0, { 0, 0, 0 } }, }; -#endif +static TexturePtr sRupeeTex[] = { + gameplay_keep_Tex_061FC0, gameplay_keep_Tex_061FE0, gameplay_keep_Tex_062000, + gameplay_keep_Tex_062040, gameplay_keep_Tex_062020, +}; -extern ColliderCylinderInit D_80AF6CF0; +static Color_RGBA8 sPrimColor = { 255, 255, 255, 255 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gamelupy/EnGamelupy_Init.s") +static Color_RGBA8 sEnvColor = { 100, 200, 0, 255 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gamelupy/EnGamelupy_Destroy.s") +void EnGamelupy_Init(Actor* thisx, PlayState* play) { + s32 pad; + EnGamelupy* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gamelupy/func_80AF6854.s") + Actor_SetScale(&this->actor, 0.03f); + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 10.0f); + this->actor.shape.yOffset = 700.0f; + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + this->actor.gravity = -0.5f; + this->actor.shape.rot.y = Rand_Next(); + this->unk_19C = 0; + this->unk_19E = 0; + this->unk_1A0 = 0x7D0; + if (this->actor.params == 1) { + this->rupeeIndex = 1; + } else { + this->rupeeIndex = 0; + } + func_80AF6944(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gamelupy/func_80AF6944.s") +void EnGamelupy_Destroy(Actor* thisx, PlayState* play) { + EnGamelupy* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gamelupy/func_80AF6958.s") + Collider_DestroyCylinder(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gamelupy/func_80AF6994.s") +void func_80AF6854(EnGamelupy* this, PlayState* play) { + Vec3f sp4C; + Vec3f sp40; + Vec3f sp30; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gamelupy/func_80AF69A8.s") + sp4C = this->actor.world.pos; + sp30.x = Math_SinS(this->unk_19E) * 3.0f; + sp30.y = 5.5f; + sp30.z = Math_CosS(this->unk_19E) * 3.0f; + sp40.x = -0.05f * sp30.x; + sp40.y = -0.4f; + sp40.z = -0.05f * sp30.z; + EffectSsKirakira_SpawnDispersed(play, &sp4C, &sp30, &sp40, &sPrimColor, &sEnvColor, 3000, 40); + this->unk_19E += this->unk_1A0; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gamelupy/func_80AF6A38.s") +void func_80AF6944(EnGamelupy* this) { + this->actionFunc = func_80AF6958; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gamelupy/func_80AF6A78.s") +void func_80AF6958(EnGamelupy* this, PlayState* play) { + s16* unk_198 = func_800B6680(play, ACTOR_EN_GAMELUPY); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gamelupy/func_80AF6B40.s") + if (unk_198 != NULL) { + this->unk_198 = unk_198; + func_80AF6994(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gamelupy/EnGamelupy_Update.s") +void func_80AF6994(EnGamelupy* this) { + this->actionFunc = func_80AF69A8; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Gamelupy/EnGamelupy_Draw.s") +void func_80AF69A8(EnGamelupy* this, PlayState* play) { + if (this->collider.base.ocFlags1 & OC1_HIT) { + *this->unk_198 += 0x32; + if (this->rupeeIndex == 1) { + func_801159EC(5); + } else { + func_801159EC(1); + } + func_80AF6A38(this); + } + this->actor.shape.rot.y += 0x1F4; +} + +void func_80AF6A38(EnGamelupy* this) { + this->unk_19C = 0; + this->actor.gravity = 0.0f; + Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_GET_RUPY); + this->actionFunc = func_80AF6A78; +} + +void func_80AF6A78(EnGamelupy* this, PlayState* play) { + f32 scale; + Player* player = GET_PLAYER(play); + + if (this->unk_19C > 30) { + Actor_MarkForDeath(&this->actor); + } else { + this->unk_19C++; + this->actor.world.pos = player->actor.world.pos; + this->actor.world.pos.y += 40.0f; + scale = (30.0f - this->unk_19C) * 0.001f; + Actor_SetScale(&this->actor, scale); + func_80AF6854(this, play); + } + this->actor.shape.rot.y += 0x3E8; +} + +void func_80AF6B40(EnGamelupy* this, PlayState* play) { + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); +} + +void EnGamelupy_Update(Actor* thisx, PlayState* play) { + EnGamelupy* this = THIS; + + this->actionFunc(this, play); + Actor_MoveWithGravity(&this->actor); + Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 0.0f, 0xC); + func_80AF6B40(this, play); +} + +void EnGamelupy_Draw(Actor* thisx, PlayState* play) { + s32 pad; + EnGamelupy* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + func_800B8050(&this->actor, play, 0); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sRupeeTex[this->rupeeIndex])); + gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_0622C0); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.h b/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.h index b3737d7064..4ee6a5b117 100644 --- a/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.h +++ b/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.h @@ -8,10 +8,14 @@ struct EnGamelupy; typedef void (*EnGamelupyActionFunc)(struct EnGamelupy*, PlayState*); typedef struct EnGamelupy { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x4C]; - /* 0x0190 */ EnGamelupyActionFunc actionFunc; - /* 0x0194 */ char unk_194[0x10]; + /* 0x000 */ Actor actor; + /* 0x144 */ ColliderCylinder collider; + /* 0x190 */ EnGamelupyActionFunc actionFunc; + /* 0x194 */ s32 rupeeIndex; + /* 0x198 */ s16* unk_198; + /* 0x19C */ s16 unk_19C; + /* 0x19E */ s16 unk_19E; + /* 0x1A0 */ s16 unk_1A0; } EnGamelupy; // size = 0x1A4 extern const ActorInit En_Gamelupy_InitVars;