EnInvisibleRuppe OK (#508)

* EnInvisibleRuppe OK

* Style changes as per review

* Update reloc

* Apply feedback
This commit is contained in:
Electrk
2021-12-19 18:47:08 +00:00
committed by GitHub
parent 8662b35a69
commit 89829b9905
3 changed files with 90 additions and 16 deletions
+1 -2
View File
@@ -5504,8 +5504,7 @@ beginseg
name "ovl_En_Invisible_Ruppe"
compress
include "build/src/overlays/actors/ovl_En_Invisible_Ruppe/z_en_invisible_ruppe.o"
include "build/data/ovl_En_Invisible_Ruppe/ovl_En_Invisible_Ruppe.data.o"
include "build/data/ovl_En_Invisible_Ruppe/ovl_En_Invisible_Ruppe.reloc.o"
include "build/src/overlays/actors/ovl_En_Invisible_Ruppe/ovl_En_Invisible_Ruppe_reloc.o"
endseg
beginseg
@@ -14,10 +14,10 @@ void EnInvisibleRuppe_Init(Actor* thisx, GlobalContext* globalCtx);
void EnInvisibleRuppe_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnInvisibleRuppe_Update(Actor* thisx, GlobalContext* globalCtx);
void func_80C258A0(EnInvisibleRuppe* this, GlobalContext* globalCtx);
void func_80C2590C(EnInvisibleRuppe* this, GlobalContext* globalCtx);
void func_80C259E8(EnInvisibleRuppe* this, GlobalContext* globalCtx);
#if 0
const ActorInit En_Invisible_Ruppe_InitVars = {
ACTOR_EN_INVISIBLE_RUPPE,
ACTORCAT_NPC,
@@ -30,25 +30,95 @@ const ActorInit En_Invisible_Ruppe_InitVars = {
(ActorFunc)NULL,
};
// static ColliderCylinderInit sCylinderInit = {
static ColliderCylinderInit D_80C25B50 = {
{ 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
void func_80C258A0(EnInvisibleRuppe* this, GlobalContext* globalCtx) {
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 32.0f, 30.0f, 0.0f, 4);
}
extern ColliderCylinderInit D_80C25B50;
void func_80C2590C(EnInvisibleRuppe* this, GlobalContext* globalCtx) {
if (this->collider.base.ocFlags1 & OC1_HIT) {
switch (INVISIBLERUPPE_GET_3(this)) {
case 0:
play_sound(NA_SE_SY_GET_RUPY);
Item_DropCollectible(globalCtx, &this->actor.world.pos, 0x8000 | ITEM00_RUPEE_GREEN);
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invisible_Ruppe/func_80C258A0.s")
case 1:
play_sound(NA_SE_SY_GET_RUPY);
Item_DropCollectible(globalCtx, &this->actor.world.pos, 0x8000 | ITEM00_RUPEE_BLUE);
break;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invisible_Ruppe/func_80C2590C.s")
case 2:
play_sound(NA_SE_SY_GET_RUPY);
Item_DropCollectible(globalCtx, &this->actor.world.pos, 0x8000 | ITEM00_RUPEE_RED);
break;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invisible_Ruppe/func_80C259E8.s")
if (this->unk_190 >= 0) {
Actor_SetSwitchFlag(globalCtx, this->unk_190);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invisible_Ruppe/EnInvisibleRuppe_Init.s")
this->actionFunc = func_80C259E8;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invisible_Ruppe/EnInvisibleRuppe_Destroy.s")
void func_80C259E8(EnInvisibleRuppe* this, GlobalContext* globalCtx) {
Actor_MarkForDeath(&this->actor);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Invisible_Ruppe/EnInvisibleRuppe_Update.s")
void EnInvisibleRuppe_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnInvisibleRuppe* this = THIS;
this->unk_190 = INVISIBLERUPPE_GET_1FC(this);
if (this->unk_190 == 0x7F) {
this->unk_190 = -1;
}
if ((this->unk_190 >= 0) && Flags_GetSwitch(globalCtx, this->unk_190)) {
Actor_MarkForDeath(&this->actor);
return;
}
Collider_InitCylinder(globalCtx, &this->collider);
Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
this->actionFunc = func_80C2590C;
}
void EnInvisibleRuppe_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnInvisibleRuppe* this = THIS;
Collider_DestroyCylinder(globalCtx, &this->collider);
}
void EnInvisibleRuppe_Update(Actor* thisx, GlobalContext* globalCtx) {
EnInvisibleRuppe* this = THIS;
this->actionFunc(this, globalCtx);
func_80C258A0(this, globalCtx);
}
@@ -7,9 +7,14 @@ struct EnInvisibleRuppe;
typedef void (*EnInvisibleRuppeActionFunc)(struct EnInvisibleRuppe*, GlobalContext*);
#define INVISIBLERUPPE_GET_3(thisx) ((thisx)->actor.params & 3)
#define INVISIBLERUPPE_GET_1FC(thisx) (((thisx)->actor.params & 0x1FC) >> 2)
typedef struct EnInvisibleRuppe {
/* 0x0000 */ Actor actor;
/* 0x0144 */ char unk_144[0x50];
/* 0x0144 */ ColliderCylinder collider;
/* 0x0190 */ s16 unk_190;
/* 0x0192 */ s16 unk_192;
/* 0x0194 */ EnInvisibleRuppeActionFunc actionFunc;
} EnInvisibleRuppe; // size = 0x198