summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDragorn421 <Dragorn421@users.noreply.github.com>2026-02-20 09:23:49 +0100
committerGitHub <noreply@github.com>2026-02-20 09:23:49 +0100
commit7e445cde73641c184a0b9f8dcf309d5d5eba65b8 (patch)
tree06bb3b8042d6a9ac4b20c3972ae3b78fc6f3d21b
parent42242bdf882f238f6264882ee43bfb7f8b9076dd (diff)
EnBox params macros (#2696)
-rw-r--r--src/overlays/actors/ovl_En_Box/z_en_box.c22
-rw-r--r--src/overlays/actors/ovl_En_Box/z_en_box.h6
2 files changed, 17 insertions, 11 deletions
diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c
index c3e37e868..adb65c23c 100644
--- a/src/overlays/actors/ovl_En_Box/z_en_box.c
+++ b/src/overlays/actors/ovl_En_Box/z_en_box.c
@@ -129,7 +129,7 @@ void EnBox_Init(Actor* thisx, PlayState* play2) {
DynaPoly_DisableCeilingCollision(play, &play->colCtx.dyna, this->dyna.bgId);
this->movementFlags = 0;
- this->type = PARAMS_GET_U(thisx->params, 12, 4);
+ this->type = ENBOX_GET_TYPE(thisx);
this->iceSmokeTimer = 0;
this->unk_1FB = ENBOX_STATE_0;
this->dyna.actor.gravity = -5.5f;
@@ -138,7 +138,7 @@ void EnBox_Init(Actor* thisx, PlayState* play2) {
if (play) {} // helps the compiler store play2 into s1
- if (Flags_GetTreasure(play, PARAMS_GET_U(this->dyna.actor.params, 0, 5))) {
+ if (Flags_GetTreasure(play, ENBOX_GET_TREASURE_FLAG(&this->dyna.actor))) {
this->alpha = 255;
this->iceSmokeTimer = 100;
EnBox_SetupAction(this, EnBox_Open);
@@ -285,7 +285,7 @@ void EnBox_Fall(EnBox* this, PlayState* play) {
}
void EnBox_FallOnSwitchFlag(EnBox* this, PlayState* play) {
- s32 treasureFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 5);
+ s32 treasureFlag = ENBOX_GET_TREASURE_FLAG(&this->dyna.actor);
if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) {
Actor_SetClosestSecretDistance(&this->dyna.actor, play);
@@ -304,7 +304,7 @@ void EnBox_FallOnSwitchFlag(EnBox* this, PlayState* play) {
// used for types 9, 10
void func_809C9700(EnBox* this, PlayState* play) {
- s32 treasureFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 5);
+ s32 treasureFlag = ENBOX_GET_TREASURE_FLAG(&this->dyna.actor);
Player* player = GET_PLAYER(play);
if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) {
@@ -341,7 +341,7 @@ void func_809C9700(EnBox* this, PlayState* play) {
}
void EnBox_AppearOnSwitchFlag(EnBox* this, PlayState* play) {
- s32 treasureFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 5);
+ s32 treasureFlag = ENBOX_GET_TREASURE_FLAG(&this->dyna.actor);
if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) {
Actor_SetClosestSecretDistance(&this->dyna.actor, play);
@@ -355,7 +355,7 @@ void EnBox_AppearOnSwitchFlag(EnBox* this, PlayState* play) {
}
void EnBox_AppearOnRoomClear(EnBox* this, PlayState* play) {
- s32 treasureFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 5);
+ s32 treasureFlag = ENBOX_GET_TREASURE_FLAG(&this->dyna.actor);
if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) {
Actor_SetClosestSecretDistance(&this->dyna.actor, play);
@@ -437,16 +437,16 @@ void EnBox_WaitOpen(EnBox* this, PlayState* play) {
Audio_PlayFanfare(NA_BGM_OPEN_TRE_BOX | 0x900);
}
}
- PRINTF("Actor_Environment_Tbox_On() %d\n", PARAMS_GET_U(this->dyna.actor.params, 0, 5));
- Flags_SetTreasure(play, PARAMS_GET_U(this->dyna.actor.params, 0, 5));
+ PRINTF("Actor_Environment_Tbox_On() %d\n", ENBOX_GET_TREASURE_FLAG(&this->dyna.actor));
+ Flags_SetTreasure(play, ENBOX_GET_TREASURE_FLAG(&this->dyna.actor));
} else {
player = GET_PLAYER(play);
Actor_WorldToActorCoords(&this->dyna.actor, &sp4C, &player->actor.world.pos);
if (sp4C.z > -50.0f && sp4C.z < 0.0f && fabsf(sp4C.y) < 10.0f && fabsf(sp4C.x) < 20.0f &&
Player_IsFacingActor(&this->dyna.actor, 0x3000, play)) {
- Actor_OfferGetItemNearby(&this->dyna.actor, play, -PARAMS_GET_U(this->dyna.actor.params, 5, 7));
+ Actor_OfferGetItemNearby(&this->dyna.actor, play, -ENBOX_GET_GET_ITEM_ID(&this->dyna.actor));
}
- if (Flags_GetTreasure(play, PARAMS_GET_U(this->dyna.actor.params, 0, 5))) {
+ if (Flags_GetTreasure(play, ENBOX_GET_TREASURE_FLAG(&this->dyna.actor))) {
EnBox_SetupAction(this, EnBox_Open);
}
}
@@ -556,7 +556,7 @@ void EnBox_Update(Actor* thisx, PlayState* play) {
Actor_SetFocus(&this->dyna.actor, 40.0f);
}
- if (PARAMS_GET_U(this->dyna.actor.params, 5, 7) == GI_ICE_TRAP && this->actionFunc == EnBox_Open &&
+ if (ENBOX_GET_GET_ITEM_ID(&this->dyna.actor) == GI_ICE_TRAP && this->actionFunc == EnBox_Open &&
this->skelanime.curFrame > 45 && this->iceSmokeTimer < 100) {
EnBox_SpawnIceSmoke(this, play);
}
diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.h b/src/overlays/actors/ovl_En_Box/z_en_box.h
index 7bea0c478..3b8f167eb 100644
--- a/src/overlays/actors/ovl_En_Box/z_en_box.h
+++ b/src/overlays/actors/ovl_En_Box/z_en_box.h
@@ -7,6 +7,12 @@
#define ENBOX_TREASURE_FLAG_UNK_MIN 20
#define ENBOX_TREASURE_FLAG_UNK_MAX 32
+#define ENBOX_GET_TYPE(thisx) PARAMS_GET_U((thisx)->params, 12, 4)
+#define ENBOX_GET_GET_ITEM_ID(thisx) PARAMS_GET_U((thisx)->params, 5, 7)
+#define ENBOX_GET_TREASURE_FLAG(thisx) PARAMS_GET_U((thisx)->params, 0, 5)
+
+#define ENBOX_PARAMS(type, getItemId, treasureFlag) (((type) << 12) | ((getItemId) << 5) | (treasureFlag))
+
struct EnBox;
typedef void (*EnBoxActionFunc)(struct EnBox*, struct PlayState*);