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

View File

@ -8,7 +8,7 @@ SCRIPT_START script_Npc4EFirstCloud
Call NPC4E_IsKinstoneFused
JumpIf script_0800D6AE
Call NPC4E_MakeFuserInteractable
CallWithArg sub_0806DA04, 0x00000002
CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000002
EndBlock
script_0800D636:
_0807EA4C

View File

@ -19,7 +19,7 @@ script_08010502:
MessageNoOverlap TEXT_PICOLYTE, 0x10
WaitUntilTextboxCloses
script_0801052E:
Call sub_080634E4
Call Beedle_GetObjectType
JumpTable script_08010544, script_08010558, script_08010570, script_08010570, script_0801054C, script_08010564, script_08010570
script_08010544:
MessageNoOverlap TEXT_PICOLYTE, 0x0d
@ -37,7 +37,7 @@ script_08010564:
JumpIfNot script_080105DC
Jump script_08010570
script_08010570:
Call sub_080634EC
Call Beedle_ConfirmBuyItem
CallWithArg ScriptCommand_SaleItemConfirmMessage, 0x00000000
WaitUntilTextboxCloses
CheckTextboxResult
@ -46,7 +46,7 @@ script_08010570:
JumpIfNot script_080105C4
CheckBottleContaining ITEM_BOTTLE_EMPTY
JumpIfNot script_080105CC
Call sub_08063504
Call Beedle_IsBottleInInventory
JumpIf script_080105D4
MessageNoOverlap TEXT_PICOLYTE, 0x07
WaitUntilTextboxCloses

View File

@ -6,7 +6,7 @@ SCRIPT_START script_MysteriousWall
Call NPC4E_IsKinstoneFused
JumpIf script_0800B9AC
Call NPC4E_MakeFuserInteractable
CallWithArg sub_0806DA04, 0x00000005
CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000005
EndBlock
script_0800B98A:
_0807EA4C

View File

@ -8,7 +8,7 @@ script_0801427C:
JumpIfNot script_0801427C
BeginBlock
Call MakeCheckableObjectInteractable
CallWithArg sub_0806DA04, 0x00000008
CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000008
EndBlock
script_08014298:
CheckEntityInteractType

View File

@ -5,7 +5,7 @@ SCRIPT_START script_Npc4EPedestal
EndBlock
BeginBlock
Call MakePedestalInteractable
CallWithArg sub_0806DA04, 0x00000003
CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000003
EndBlock
script_080134F8:
CheckEntityInteractType

View File

@ -5,7 +5,7 @@ SCRIPT_START script_Npc4ESecondSanctuary
EndBlock
BeginBlock
Call MakePedestalInteractable
CallWithArg sub_0806DA04, 0x00000003
CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000003
EndBlock
script_0801373C:
CheckEntityInteractType

View File

@ -5,7 +5,7 @@ SCRIPT_START script_Npc4EThirdSanctuary
EndBlock
BeginBlock
Call MakePedestalInteractable
CallWithArg sub_0806DA04, 0x00000003
CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000003
EndBlock
script_080138D0:
CheckEntityInteractType

View File

@ -4,7 +4,7 @@ SCRIPT_START script_08012C68
_0807E9D4
DoPostScriptAction 0x0008
SetIntVariable 0x00000000
Call sub_0806DA04
Call NPC4E_ChangeInteractableHitbox
EndBlock
script_08012C7E:
CheckEntityInteractType

View File

@ -3,7 +3,7 @@ SCRIPT_START script_08013D04
BeginBlock
Call MakePedestalInteractable
DoPostScriptAction 0x0008
CallWithArg sub_0806DA04, 0x00000004
CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000004
EndBlock
script_08013D1C:
CheckEntityInteractType

View File

@ -3,7 +3,7 @@ SCRIPT_START script_08013D44
BeginBlock
Call MakePedestalInteractable
DoPostScriptAction 0x0008
CallWithArg sub_0806DA04, 0x00000004
CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000004
EndBlock
script_08013D5C:
CheckEntityInteractType

View File

@ -3,7 +3,7 @@ SCRIPT_START script_08013D84
BeginBlock
Call MakePedestalInteractable
DoPostScriptAction 0x0008
CallWithArg sub_0806DA04, 0x00000004
CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000004
EndBlock
script_08013D9C:
CheckEntityInteractType

View File

@ -3,7 +3,7 @@ SCRIPT_START script_08013DC4
BeginBlock
Call MakePedestalInteractable
DoPostScriptAction 0x0008
CallWithArg sub_0806DA04, 0x00000004
CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000004
EndBlock
script_08013DDC:
CheckEntityInteractType

View File

@ -5,7 +5,7 @@ SCRIPT_START script_NPC4ESourceOfTheFlow
CheckKinstoneFused KINSTONE_SOURCE_FLOW
JumpIf script_08016028
_0807EA88 KINSTONE_SOURCE_FLOW
CallWithArg sub_0806DA04, 0x00000007
CallWithArg NPC4E_ChangeInteractableHitbox, 0x00000007
DoPostScriptAction 0x000a
EndBlock
script_08015FE4:

View File

@ -4,7 +4,7 @@ SCRIPT_START script_Npc4EWindRuinsTextBoard
Call MakeCheckableObjectInteractable
DoPostScriptAction 0x0008
SetIntVariable 0x00000001
Call sub_0806DA04
Call NPC4E_ChangeInteractableHitbox
EndBlock
script_0800D88E:
CheckEntityInteractType

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]);
}

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
};