Name and clean up some functions and structs

This commit is contained in:
Catobat
2023-04-30 21:43:22 +02:00
parent 4fd83717cd
commit 5145a6909e
16 changed files with 47 additions and 51 deletions
+17 -20
View File
@@ -9,22 +9,17 @@
#include "item.h"
typedef struct {
s8 unk_00;
u8 unk_01;
u8 unk_02;
u8 unk_03;
s8 unk_04;
s8 unk_05;
s8 unk_06;
s8 unk_07;
} gUnk_0810C89C_struct;
s8 customHitbox[4];
s8 interactDirections;
u8 unused[3];
} InteractCollisionData;
void sub_080632E0(Entity* this);
void sub_08063314(Entity* this);
void sub_0806336C(Entity* this);
void sub_08063390(Entity* this);
static const u8 gUnk_0810C88C[] = {
static const u8 gBeedleItems[] = {
ITEM_NONE,
ITEM_BOTTLE_PICOLYTE_BLUE,
ITEM_BOTTLE_PICOLYTE_GREEN,
@@ -32,10 +27,10 @@ static const u8 gUnk_0810C88C[] = {
ITEM_BOTTLE_PICOLYTE_ORANGE,
ITEM_BOTTLE_PICOLYTE_YELLOW,
ITEM_BOTTLE_PICOLYTE_WHITE,
ITEM_NONE,
0,
};
static const Hitbox gUnk_0810C894 = { 0, 0, { 0, 0, 0, 0 }, 16, 6 };
static const gUnk_0810C89C_struct gUnk_0810C89C[] = {
static const InteractCollisionData gBeedleCollisionData[] = {
{ 0, 0, 6, 6, 0, 0, 0, 0 }, { -24, 0, 6, 6, 0, 0, 0, 0 }, { -24, 16, 6, 6, 0, 0, 0, 0 },
{ -24, 32, 6, 6, 0, 0, 0, 0 }, { 24, 0, 6, 6, 0, 0, 0, 0 }, { 24, 16, 6, 6, 0, 0, 0, 0 },
{ 24, 32, 6, 6, 0, 0, 0, 0 },
@@ -146,8 +141,10 @@ void sub_08063410(Entity* this) {
GetNextFrame(this);
}
// figures out with which of the 7 objects the player interacts with
// based on the player's position and facing direction
void sub_0806346C(Entity* this) {
static const u8 gUnk_0810C8F0[][6][4] = {
static const u8 gUnk_0810C8F0[5][6][4] = {
{
{ 1, 1, 1, 1 },
{ 1, 1, 1, 1 },
@@ -216,20 +213,20 @@ void sub_0806346C(Entity* this) {
bVar1 = gUnk_0810C8F0[iVar2][iVar3][gPlayerEntity.animationState >> 1];
if (bVar1 != this->type2) {
const gUnk_0810C89C_struct* temp = &gUnk_0810C89C[bVar1];
SetInteractableObjectCollision(this, 1, temp->unk_04, temp);
const InteractCollisionData* data = &gBeedleCollisionData[bVar1];
SetInteractableObjectCollision(this, 1, data->interactDirections, data);
this->type2 = bVar1;
}
}
void sub_080634E4(Entity* this, ScriptExecutionContext* context) {
void Beedle_GetObjectType(Entity* this, ScriptExecutionContext* context) {
context->intVariable = this->type2;
}
void sub_080634EC(Entity* this) {
gRoomVars.shopItemType = gUnk_0810C88C[this->type2];
void Beedle_ConfirmBuyItem(Entity* this) {
gRoomVars.shopItemType = gBeedleItems[this->type2];
}
void sub_08063504(Entity* this, ScriptExecutionContext* context) {
context->condition = !!GetBottleContaining(gUnk_0810C88C[this->type2]);
void Beedle_IsBottleInInventory(Entity* this, ScriptExecutionContext* context) {
context->condition = !!GetBottleContaining(gBeedleItems[this->type2]);
}
+14 -15
View File
@@ -12,15 +12,16 @@
#include "sound.h"
typedef struct {
u32 unk_00;
s8 unk_04;
} gUnk_0810C89C_struct;
s8 customHitbox[4];
u8 interactDirections;
u8 unused[3];
} InteractCollisionData;
extern void script_MinishVillageObjectLeftStoneOpening; // Cutscene data type?
extern void script_MinishVillageObjectRightStoneOpening; // Cutscene data type?
const Hitbox gUnk_08114154;
const u8 gUnk_0811415C[];
const InteractCollisionData gNpc4ECollisionData[];
const ScreenTransitionData* const gNpc4ETransitions[];
const u8 gNpc4ETransitionTypes[];
const u16 gUnk_081141F4[];
@@ -42,11 +43,9 @@ void NPC4E(Entity* this) {
}
}
void sub_0806DA04(Entity* this, ScriptExecutionContext* context) {
// TODO gUnk_0811415C should be a gUnk_0810C89C_struct[], but then a lot of bytes everywhere are wrong?
gUnk_0810C89C_struct* a = (gUnk_0810C89C_struct*)&(
(gUnk_0810C89C_struct*)gUnk_0811415C)[context->intVariable]; // cast necessary to no longer make it a const* ?
SetInteractableObjectCollision(this, 1, (u8)a->unk_04, a);
void NPC4E_ChangeInteractableHitbox(Entity* this, ScriptExecutionContext* context) {
const InteractCollisionData* data = &gNpc4ECollisionData[context->intVariable];
SetInteractableObjectCollision(this, 1, data->interactDirections, data);
}
void NPC4E_DoScreenTransition(Entity* this, ScriptExecutionContext* context) {
@@ -232,13 +231,13 @@ void NPC4E_Fusion(Entity* this) {
const Hitbox gUnk_08114154 = { 0, -8, 0, 0, 0, 0, 24, 8 };
const u8 gUnk_0811415C[] = { //
0x00, 0x00, 0x08, 0x08, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x0e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x04, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x04, 0x0e, 0x00, 0x00, 0x00,
0x00, 0x08, 0x10, 0x04, 0x0e, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x08, 0x0e, 0x00, 0x00, 0x00,
const InteractCollisionData gNpc4ECollisionData[] = { //
{ 0, 0, 8, 8, 0x0E, 0, 0, 0 }, { 0, 0, 26, 8, 0x0E, 0, 0, 0 },
{ 0, 0, 16, 4, 0x0E, 0, 0, 0 }, { 0, 0, 10, 10, 0x00, 0, 0, 0 },
{ 0, 0, 10, 10, 0x00, 0, 0, 0 }, { 0, 0, 6, 4, 0x0E, 0, 0, 0 },
{ 0, 8, 16, 4, 0x0E, 0, 0, 0 }, { 0, -8, 24, 8, 0x0E, 0, 0, 0 },
#ifndef EU
0x00, 0x00, 0x58, 0x08, 0x0e, 0x00, 0x00, 0x00
{ 0, 0, 88, 8, 0x0E, 0, 0, 0 }
#endif
};