diff --git a/include/structures.h b/include/structures.h index acebef3e..9c8864db 100644 --- a/include/structures.h +++ b/include/structures.h @@ -258,12 +258,19 @@ typedef struct { union SplitWord _4; } struct_020227E8; +typedef struct { + s8 x; + s8 y; + s8 width; + s8 height; +} Rect; + typedef struct { /*0x00*/ u8 ignoreLayer; /* if bit 0 set, skip layer check for collision */ /*0x01*/ u8 type; /*0x02*/ u8 interactDirections; /* lower 4 bits determine Link's allowed facing directions to interact, 0 to allow (0000WSEN) */ /*0x03*/ u8 kinstoneId; - /*0x04*/ const s8* customHitbox; /* if set, array contains x, y, width and height */ + /*0x04*/ const Rect* customHitbox; /* optional custom rectangle */ /*0x08*/ Entity* entity; } InteractableObject; @@ -351,11 +358,4 @@ typedef struct { u8 frame; u8 frameIndex; } PACKED FrameStruct; - -typedef struct { - s8 x; - s8 y; - s8 width; - s8 height; -} Rect; #endif // STRUCTURES_H diff --git a/src/npc/beedle.c b/src/npc/beedle.c index 0b2c030a..16ed2ec2 100644 --- a/src/npc/beedle.c +++ b/src/npc/beedle.c @@ -9,7 +9,7 @@ #include "item.h" typedef struct { - s8 customHitbox[4]; + Rect customHitbox; s8 interactDirections; u8 unused[3]; } InteractCollisionData; diff --git a/src/npc/drLeft.c b/src/npc/drLeft.c index 37f1b0e0..aef5ecc4 100644 --- a/src/npc/drLeft.c +++ b/src/npc/drLeft.c @@ -77,11 +77,6 @@ void sub_0806C038(Entity* this) { } void sub_0806C09C(Entity* this) { - static const s8 gUnk_081133B4[] = { - 0, - 6, - 8, - 12, - }; + static const Rect gUnk_081133B4 = { 0, 6, 8, 12 }; SetInteractableObjectCollision(this, 1, 0, &gUnk_081133B4); } diff --git a/src/npc/mayorHagen.c b/src/npc/mayorHagen.c index 01156ff0..e5e5cad3 100644 --- a/src/npc/mayorHagen.c +++ b/src/npc/mayorHagen.c @@ -38,14 +38,9 @@ void MayorHagen(Entity* this) { } void MayorHagen_MakeInteractable(Entity* this) { - static const s8 gUnk_08113F44[] = { - 0, - 8, - 8, - 16, - }; + static const Rect gUnk_08113F44 = { 0, 8, 8, 16 }; AddInteractableWhenBigFuser(this, GetFusionToOffer(this)); - SetInteractableObjectCollision(this, 1, 0, gUnk_08113F44); + SetInteractableObjectCollision(this, 1, 0, &gUnk_08113F44); } void sub_0806CE80(Entity* this) { diff --git a/src/npc/npc4E.c b/src/npc/npc4E.c index 3cc60593..1ec89710 100644 --- a/src/npc/npc4E.c +++ b/src/npc/npc4E.c @@ -12,7 +12,7 @@ #include "sound.h" typedef struct { - s8 customHitbox[4]; + Rect customHitbox; u8 interactDirections; u8 unused[3]; } InteractCollisionData; diff --git a/src/npc/rem.c b/src/npc/rem.c index 6ea7e751..01db2ab1 100644 --- a/src/npc/rem.c +++ b/src/npc/rem.c @@ -329,7 +329,7 @@ void sub_0806A914(Entity* this) { } void Rem_MakeInteractable(Entity* this) { - static const s8 gUnk_0811229C[] = { 0, 6, 10, 16 }; + static const Rect gUnk_0811229C = { 0, 6, 10, 16 }; AddInteractableWhenBigObject(this); SetInteractableObjectCollision(this, 0, 0, &gUnk_0811229C); } diff --git a/src/npc/smallTownMinish.c b/src/npc/smallTownMinish.c index 8b69b4ff..5bbe8040 100644 --- a/src/npc/smallTownMinish.c +++ b/src/npc/smallTownMinish.c @@ -9,12 +9,12 @@ void SmallTownMinish(Entity* this) { static const Hitbox gUnk_081142FC = { -2, 1, { 0, 0, 0, 0 }, 6, 6 }; - static const s8 gUnk_08114304[] = { -2, 1, 6, 6 }; + static const Rect gUnk_08114304 = { -2, 1, 6, 6 }; if (this->action == 0) { this->action++; this->hitbox = (Hitbox*)&gUnk_081142FC; sub_0807DD50(this); - SetInteractableObjectCollision(this, 1, 0, gUnk_08114304); + SetInteractableObjectCollision(this, 1, 0, &gUnk_08114304); } else { sub_0807DD94(this, NULL); } diff --git a/src/npc/smith.c b/src/npc/smith.c index 745acc7e..bc5df016 100644 --- a/src/npc/smith.c +++ b/src/npc/smith.c @@ -206,12 +206,7 @@ void sub_08066258(void) { } void Smith_ChangeInteractableHitbox(Entity* this) { - static const s8 gUnk_081103E0[] = { - 0, - 6, - 8, - 12, - }; + static const Rect gUnk_081103E0 = { 0, 6, 8, 12 }; SetInteractableObjectCollision(this, 1, 0, &gUnk_081103E0); } diff --git a/src/npc/stockwell.c b/src/npc/stockwell.c index cef0a8a1..7230bd7a 100644 --- a/src/npc/stockwell.c +++ b/src/npc/stockwell.c @@ -9,7 +9,7 @@ #include "game.h" #ifndef EU -static const s8 gUnk_0810FDA0[] = { 0, 8, 10, 16 }; +static const Rect gUnk_0810FDA0 = { 0, 8, 10, 16 }; #endif extern u16 script_StockwellBuy[]; diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c index 3dc58b06..a8cb574b 100644 --- a/src/npc/townMinish.c +++ b/src/npc/townMinish.c @@ -129,13 +129,13 @@ static const SpriteLoadData gUnk_08112674[][4] = { { 0x0, 0x0, 0x0 }, }, }; -static const s8 gUnk_081126D4[][4] = { +static const Rect gUnk_081126D4[4] = { { 0, 8, 8, 16 }, { -8, -2, 16, 8 }, { 0, 8, 8, 16 }, { 8, -2, 16, 8 }, }; -static const u8 gUnk_081126E4[4] = { 14, 13, 11, 7 }; +static const u8 gUnk_081126E4[4] = { 0x0e, 0x0d, 0x0b, 0x07 }; void TownMinish(Entity* this) { static void (*const scriptedActionFuncs[])(Entity*) = { @@ -228,7 +228,7 @@ void sub_0806ACC4(Entity* this) { } if (this->type == 1) { u8 idx = gPlayerEntity.animationState >> 1; - SetInteractableObjectCollision(this, 1, gUnk_081126E4[idx], gUnk_081126D4[idx]); + SetInteractableObjectCollision(this, 1, gUnk_081126E4[idx], &gUnk_081126D4[idx]); } } break; diff --git a/src/object/windcrest.c b/src/object/windcrest.c index 07802edb..815a0f4a 100644 --- a/src/object/windcrest.c +++ b/src/object/windcrest.c @@ -23,8 +23,8 @@ void Windcrest(Entity* this) { } void Windcrest_ChangeInteractableHitbox(Entity* this) { - static const s8 gUnk_08125010[] = { 0, 0, 12, 12 }; - SetInteractableObjectCollision(this, 1, 0xe, gUnk_08125010); + static const Rect gUnk_08125010 = { 0, 0, 12, 12 }; + SetInteractableObjectCollision(this, 1, 0xe, &gUnk_08125010); } void Windcrest_Unlock(Entity* this) {