summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTheo <65437533+notyourav@users.noreply.github.com>2023-12-28 17:56:30 -0800
committerGitHub <noreply@github.com>2023-12-28 17:56:30 -0800
commitd6b425f340a93d3a7b6b278a3fbc182552f32eba (patch)
tree80c3483afb7c3b6795a1320e5afe0570b26c4889 /src
parentb32553e4902f91481ec9336a238d26bd355c7d2f (diff)
parent7c1c612c9ba95b47f33cfd217ab99c4c9102531e (diff)
Merge pull request #674 from notyourav/b
fix fakematch in LinkHoldingItem_Action3
Diffstat (limited to 'src')
-rw-r--r--src/beanstalkSubtask.c6
-rw-r--r--src/code_0805EC04.c26
-rw-r--r--src/enemy/likeLike.c8
-rw-r--r--src/item/itemPegasusBoots.c6
-rw-r--r--src/item/itemTryPickupObject.c4
-rw-r--r--src/itemUtils.c20
-rw-r--r--src/manager/miscManager.c2
-rw-r--r--src/menu/pauseMenu.c4
-rw-r--r--src/npc/bigGoron.c2
-rw-r--r--src/npc/bladeBrothers.c4
-rw-r--r--src/npc/npc4E.c4
-rw-r--r--src/object/crenelBeanSprout.c2
-rw-r--r--src/object/houseDoorExterior.c2
-rw-r--r--src/object/itemForSale.c4
-rw-r--r--src/object/linkHoldingItem.c10
-rw-r--r--src/player.c15
-rw-r--r--src/playerItem/playerItemBomb.c4
-rw-r--r--src/playerUtils.c46
-rw-r--r--src/title.c2
-rw-r--r--src/ui.c2
20 files changed, 86 insertions, 87 deletions
diff --git a/src/beanstalkSubtask.c b/src/beanstalkSubtask.c
index 3d425817..a115acc1 100644
--- a/src/beanstalkSubtask.c
+++ b/src/beanstalkSubtask.c
@@ -313,7 +313,7 @@ u32 UpdatePlayerCollision(void) {
return 0;
}
gUnk_0200AF00.rActionInteractTile = R_ACTION_READ;
- if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_40)) == 0) {
+ if ((gPlayerState.playerInput.newInput & (INPUT_ACTION | INPUT_40)) == 0) {
return 0;
}
gPlayerState.mobility = 1;
@@ -327,7 +327,7 @@ u32 UpdatePlayerCollision(void) {
return 0;
}
gUnk_0200AF00.rActionInteractTile = R_ACTION_OPEN;
- if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0) {
+ if ((gPlayerState.playerInput.newInput & (INPUT_ACTION | INPUT_INTERACT)) == 0) {
return 0;
}
gPlayerState.mobility = 1;
@@ -338,7 +338,7 @@ u32 UpdatePlayerCollision(void) {
return 0;
}
gUnk_0200AF00.rActionInteractTile = R_ACTION_OPEN;
- if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0) {
+ if ((gPlayerState.playerInput.newInput & (INPUT_ACTION | INPUT_INTERACT)) == 0) {
return 0;
}
gPlayerState.mobility = 1;
diff --git a/src/code_0805EC04.c b/src/code_0805EC04.c
index 1a040933..4d584da9 100644
--- a/src/code_0805EC04.c
+++ b/src/code_0805EC04.c
@@ -138,40 +138,40 @@ void UpdatePlayerInput(void) {
gPlayerState.playerInput.heldInput = state;
gPlayerState.playerInput.newInput = state & prevState;
// Calculate the direction from the currently held input.
- gPlayerState.direction = gUnk_08109202[(state & PLAYER_INPUT_ANY_DIRECTION) >> 8];
+ gPlayerState.direction = gUnk_08109202[(state & INPUT_ANY_DIRECTION) >> 8];
}
u32 ConvInputToState(u32 keys) {
u32 result;
if (keys & L_BUTTON) {
- result = 0x1000;
+ result = INPUT_FUSE;
} else {
result = 0;
}
if (keys & R_BUTTON) {
- result |= PLAYER_INPUT_20;
- result |= PLAYER_INPUT_8000;
- result |= PLAYER_INPUT_80;
+ result |= INPUT_CONTEXT;
+ result |= INPUT_LIFT_THROW;
+ result |= INPUT_ACTION;
}
if (keys & A_BUTTON) {
- result |= PLAYER_INPUT_8;
- result |= PLAYER_INPUT_40 | PLAYER_INPUT_1;
+ result |= INPUT_INTERACT;
+ result |= INPUT_40 | INPUT_USE_ITEM1;
}
if (keys & B_BUTTON) {
- result |= PLAYER_INPUT_10;
- result |= PLAYER_INPUT_2;
+ result |= INPUT_CANCEL;
+ result |= INPUT_USE_ITEM2;
}
if (keys & DPAD_RIGHT) {
- result |= PLAYER_INPUT_RIGHT;
+ result |= INPUT_RIGHT;
}
if (keys & DPAD_LEFT) {
- result |= PLAYER_INPUT_LEFT;
+ result |= INPUT_LEFT;
}
if (keys & DPAD_UP) {
- result |= PLAYER_INPUT_UP;
+ result |= INPUT_UP;
}
if (keys & DPAD_DOWN) {
- result |= PLAYER_INPUT_DOWN;
+ result |= INPUT_DOWN;
}
return result;
}
diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c
index 886aa8b7..782a51b2 100644
--- a/src/enemy/likeLike.c
+++ b/src/enemy/likeLike.c
@@ -260,12 +260,12 @@ void sub_080281A0(LikeLikeEntity* this) {
bool32 LikeLike_StealItem(u32 item) {
bool32 ret = FALSE;
if (GetInventoryValue(item) == 1) {
- if (ItemIsShield(gSave.stats.itemButtons[SLOT_A])) {
- gSave.stats.itemButtons[SLOT_A] = ITEM_NONE;
+ if (ItemIsShield(gSave.stats.equipped[SLOT_A])) {
+ gSave.stats.equipped[SLOT_A] = ITEM_NONE;
}
- if (ItemIsShield(gSave.stats.itemButtons[SLOT_B])) {
- gSave.stats.itemButtons[SLOT_B] = ITEM_NONE;
+ if (ItemIsShield(gSave.stats.equipped[SLOT_B])) {
+ gSave.stats.equipped[SLOT_B] = ITEM_NONE;
}
SetInventoryValue(item, 0);
diff --git a/src/item/itemPegasusBoots.c b/src/item/itemPegasusBoots.c
index 1f4aa52a..55088984 100644
--- a/src/item/itemPegasusBoots.c
+++ b/src/item/itemPegasusBoots.c
@@ -107,10 +107,10 @@ void sub_08076964(ItemBehavior* this, u32 index) {
SetItemAnim(this, ANIM_DASH);
entity = CreatePlayerItemWithParent(this, PLAYER_ITEM_DASH_SWORD);
if (entity != NULL) {
- if (ItemIsSword(gSave.stats.itemButtons[SLOT_A]) != 0) {
- uVar3 = gSave.stats.itemButtons[SLOT_A];
+ if (ItemIsSword(gSave.stats.equipped[SLOT_A]) != 0) {
+ uVar3 = gSave.stats.equipped[SLOT_A];
} else {
- uVar3 = gSave.stats.itemButtons[SLOT_B];
+ uVar3 = gSave.stats.equipped[SLOT_B];
}
entity->field_0x68.HALF.LO = uVar3;
return;
diff --git a/src/item/itemTryPickupObject.c b/src/item/itemTryPickupObject.c
index c1fc697e..1eb76da5 100644
--- a/src/item/itemTryPickupObject.c
+++ b/src/item/itemTryPickupObject.c
@@ -145,7 +145,7 @@ void sub_080762D8(ItemBehavior* this, u32 index) {
if (gPlayerEntity.iframes < 9 && gPlayerEntity.knockbackDuration == 0) {
if (this->field_0x18 != NULL) {
if (this->field_0x18->action == 2 && this->field_0x18->subAction == 5) {
- if (!(gPlayerState.playerInput.heldInput & PLAYER_INPUT_80)) { // Pressing R
+ if (!(gPlayerState.playerInput.heldInput & INPUT_ACTION)) { // Pressing R
this->field_0x18->subAction = 6;
PlayerCancelHoldItem(this, index);
return;
@@ -263,7 +263,7 @@ void sub_08076518(ItemBehavior* this, u32 index) {
if (gPlayerEntity.knockbackDuration != 0) {
PlayerCancelHoldItem(this, index);
} else {
- if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_8000 | PLAYER_INPUT_10 | PLAYER_INPUT_8)) != 0) {
+ if ((gPlayerState.playerInput.newInput & (INPUT_LIFT_THROW | INPUT_CANCEL | INPUT_INTERACT)) != 0) {
sub_0806F948(&gPlayerEntity);
gPlayerState.heldObject = 5;
this->field_0x18->subAction = 2;
diff --git a/src/itemUtils.c b/src/itemUtils.c
index 1b3cf948..c78c0da3 100644
--- a/src/itemUtils.c
+++ b/src/itemUtils.c
@@ -255,9 +255,9 @@ void ModArrows(s32 arrows) {
EquipSlot IsItemEquipped(u32 itemId) {
EquipSlot equipSlot;
- if (itemId == gSave.stats.itemButtons[SLOT_A]) {
+ if (itemId == gSave.stats.equipped[SLOT_A]) {
equipSlot = EQUIP_SLOT_A;
- } else if (itemId == gSave.stats.itemButtons[SLOT_B]) {
+ } else if (itemId == gSave.stats.equipped[SLOT_B]) {
equipSlot = EQUIP_SLOT_B;
} else {
equipSlot = EQUIP_SLOT_NONE;
@@ -273,17 +273,17 @@ void PutItemOnSlot(u32 itemId) {
}
if (itemId2 - 1 < 0x1f) {
equipSlot = EQUIP_SLOT_NONE;
- if (gSave.stats.itemButtons[SLOT_A] == ITEM_NONE) {
+ if (gSave.stats.equipped[SLOT_A] == ITEM_NONE) {
equipSlot = EQUIP_SLOT_A;
- } else if (gSave.stats.itemButtons[SLOT_B] == ITEM_NONE) {
+ } else if (gSave.stats.equipped[SLOT_B] == ITEM_NONE) {
equipSlot = EQUIP_SLOT_B;
}
if (equipSlot == EQUIP_SLOT_NONE) {
u32 temp = gItemMetaData[itemId2].menuSlot;
- if (temp == gItemMetaData[gSave.stats.itemButtons[SLOT_A]].menuSlot) {
+ if (temp == gItemMetaData[gSave.stats.equipped[SLOT_A]].menuSlot) {
equipSlot = EQUIP_SLOT_A;
} else {
- if (temp == gItemMetaData[gSave.stats.itemButtons[SLOT_B]].menuSlot) {
+ if (temp == gItemMetaData[gSave.stats.equipped[SLOT_B]].menuSlot) {
equipSlot = EQUIP_SLOT_B;
}
}
@@ -302,13 +302,13 @@ void ForceEquipItem(u32 itemId, u32 equipSlot) {
if ((itemId - 1 < 0x1f) && (equipSlot < EQUIP_SLOT_NONE)) {
otherItemSlot = equipSlot == EQUIP_SLOT_A;
- replacedItem = gSave.stats.itemButtons[equipSlot];
- otherItem = gSave.stats.itemButtons[otherItemSlot];
+ replacedItem = gSave.stats.equipped[equipSlot];
+ otherItem = gSave.stats.equipped[otherItemSlot];
if (gItemMetaData[otherItem].menuSlot == gItemMetaData[itemId].menuSlot) {
otherItem = replacedItem;
}
- gSave.stats.itemButtons[equipSlot] = itemId;
- gSave.stats.itemButtons[otherItemSlot] = otherItem;
+ gSave.stats.equipped[equipSlot] = itemId;
+ gSave.stats.equipped[otherItemSlot] = otherItem;
gUnk_0200AF00.unk_13 = 0x7f;
gUnk_0200AF00.unk_14 = 0x7f;
}
diff --git a/src/manager/miscManager.c b/src/manager/miscManager.c
index 5ae26ace..80d4cffc 100644
--- a/src/manager/miscManager.c
+++ b/src/manager/miscManager.c
@@ -364,7 +364,7 @@ void MiscManager_TypeB(MiscManager* this) {
bool32 sub_080593CC(MiscManager* this) {
if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.swim_state != 0 && gPlayerEntity.animationState == 0 &&
- (gPlayerState.playerInput.heldInput & PLAYER_INPUT_ANY_DIRECTION) == PLAYER_INPUT_UP) {
+ (gPlayerState.playerInput.heldInput & INPUT_ANY_DIRECTION) == INPUT_UP) {
return EntityWithinDistance(&gPlayerEntity, this->unk_38, this->unk_3a + 0xC, 6);
}
return FALSE;
diff --git a/src/menu/pauseMenu.c b/src/menu/pauseMenu.c
index 2ea79113..6b1d0cef 100644
--- a/src/menu/pauseMenu.c
+++ b/src/menu/pauseMenu.c
@@ -529,14 +529,14 @@ void PauseMenu_ItemMenu_Draw(void) {
gOamCmd._8 = 0x800;
DrawDirect(sub_080A5384_draw_constant0, 0x22);
}
- i = GetMenuSlotForItem(gSave.stats.itemButtons[SLOT_A]);
+ i = GetMenuSlotForItem(gSave.stats.equipped[SLOT_A]);
if (i < MENU_SLOT_COUNT) {
entry = &gItemMenuTable[i];
gOamCmd.x = entry->x;
gOamCmd.y = entry->y;
DrawDirect(sub_080A5384_draw_constant0, 3);
}
- i = GetMenuSlotForItem(gSave.stats.itemButtons[SLOT_B]);
+ i = GetMenuSlotForItem(gSave.stats.equipped[SLOT_B]);
if (i < MENU_SLOT_COUNT) {
entry = &gItemMenuTable[i];
gOamCmd.x = entry->x;
diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c
index 83205c44..059f6163 100644
--- a/src/npc/bigGoron.c
+++ b/src/npc/bigGoron.c
@@ -434,7 +434,7 @@ void sub_0806D5D4(void) {
InitBiggoronTimer();
equipSlot = IsItemEquipped(ITEM_SHIELD);
if (equipSlot != EQUIP_SLOT_NONE) {
- gSave.stats.itemButtons[equipSlot] = ITEM_NONE;
+ gSave.stats.equipped[equipSlot] = ITEM_NONE;
}
SetInventoryValue(ITEM_SHIELD, 0);
}
diff --git a/src/npc/bladeBrothers.c b/src/npc/bladeBrothers.c
index ecb97fe2..598b0523 100644
--- a/src/npc/bladeBrothers.c
+++ b/src/npc/bladeBrothers.c
@@ -339,10 +339,10 @@ void BladeBrothers_StartPlayerDemonstration(Entity* this, ScriptExecutionContext
}
void sub_08068BB4(BladeBrothersEntity* this) {
- u32 item = gSave.stats.itemButtons[SLOT_A];
+ u32 item = gSave.stats.equipped[SLOT_A];
this->itemSlotA = item;
- item = gSave.stats.itemButtons[SLOT_B];
+ item = gSave.stats.equipped[SLOT_B];
this->itemSlotB = item;
}
diff --git a/src/npc/npc4E.c b/src/npc/npc4E.c
index 910fb485..e60812b2 100644
--- a/src/npc/npc4E.c
+++ b/src/npc/npc4E.c
@@ -186,8 +186,8 @@ Item NPC4E_GetItemWithSwordUpgraded(Item itemId) {
}
void NPC4E_SaveEquippedItems(NPC4EEntity* this) {
- this->unk_68 = gSave.stats.itemButtons[SLOT_A];
- this->unk_69 = gSave.stats.itemButtons[SLOT_B];
+ this->unk_68 = gSave.stats.equipped[SLOT_A];
+ this->unk_69 = gSave.stats.equipped[SLOT_B];
}
void NPC4E_RestoreEquippedItems(NPC4EEntity* this) {
diff --git a/src/object/crenelBeanSprout.c b/src/object/crenelBeanSprout.c
index a9d500cd..1e28d988 100644
--- a/src/object/crenelBeanSprout.c
+++ b/src/object/crenelBeanSprout.c
@@ -179,7 +179,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) {
RestorePrevTileEntity(0xdc, super->collisionLayer);
sub_08096A78(this);
}
- if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_40)) == 0) {
+ if ((gPlayerState.playerInput.newInput & (INPUT_ACTION | INPUT_40)) == 0) {
return;
}
if (gUnk_0200AF00.rActionPlayerState != R_ACTION_THROW) {
diff --git a/src/object/houseDoorExterior.c b/src/object/houseDoorExterior.c
index 5b0a94f6..a921f8ba 100644
--- a/src/object/houseDoorExterior.c
+++ b/src/object/houseDoorExterior.c
@@ -184,7 +184,7 @@ void sub_0808692C(HouseDoorExteriorEntity* this) {
static u8 sub_08086954(HouseDoorExteriorEntity* this) {
if (sub_0800445C(super)) {
if (GetAnimationStateInRectRadius(super, 6, 20) >= 0 && gPlayerEntity.animationState == 0 &&
- (u16)gPlayerState.playerInput.heldInput == PLAYER_INPUT_UP && gPlayerState.jump_status == 0) {
+ (u16)gPlayerState.playerInput.heldInput == INPUT_UP && gPlayerState.jump_status == 0) {
super->timer--;
}
} else {
diff --git a/src/object/itemForSale.c b/src/object/itemForSale.c
index 7dcef6c5..aca8b2fd 100644
--- a/src/object/itemForSale.c
+++ b/src/object/itemForSale.c
@@ -118,8 +118,8 @@ void ItemForSale_Action2(ItemForSaleEntity* this) {
ptr = sub_080784E4();
if (((*(int*)(ptr + 8) == 0) || ((*(u8*)(ptr + 1) != 1 || (gUnk_0200AF00.rActionPlayerState = R_ACTION_SPEAK,
(gPlayerState.playerInput.newInput &
- (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0)))) &&
- ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_10 | PLAYER_INPUT_8)) != 0)) {
+ (INPUT_ACTION | INPUT_INTERACT)) == 0)))) &&
+ ((gPlayerState.playerInput.newInput & (INPUT_ACTION | INPUT_CANCEL | INPUT_INTERACT)) != 0)) {
sub_080819B4(this);
}
}
diff --git a/src/object/linkHoldingItem.c b/src/object/linkHoldingItem.c
index ae982637..cf14269a 100644
--- a/src/object/linkHoldingItem.c
+++ b/src/object/linkHoldingItem.c
@@ -123,8 +123,8 @@ void LinkHoldingItem_Action2(LinkHoldingItemEntity* this) {
}
void LinkHoldingItem_Action3(LinkHoldingItemEntity* this) {
- u32 tmp;
- if ((super->parent)->action == 8) {
+ u32 bottle_no;
+ if (super->parent->action == PLAYER_ITEMGET) {
return;
}
switch (super->timer) {
@@ -149,9 +149,9 @@ void LinkHoldingItem_Action3(LinkHoldingItemEntity* this) {
ModHealth(160);
break;
case 3:
- tmp = GetBottleContaining(super->type);
- if (tmp != 0) {
- gSave.stats.itemButtons[tmp + 1] = ITEM_BOTTLE_EMPTY;
+ bottle_no = GetBottleContaining(super->type);
+ if (bottle_no != 0) {
+ gSave.stats.bottles[bottle_no - 1] = ITEM_BOTTLE_EMPTY;
} else {
SetInventoryValue(super->type, ITEM_GREEN_SWORD);
}
diff --git a/src/player.c b/src/player.c
index 12b1ff45..cc028dba 100644
--- a/src/player.c
+++ b/src/player.c
@@ -2750,7 +2750,7 @@ static void sub_08073504(Entity* this) {
static void sub_08073584(Entity* this) {
u32 state, dir, idx;
- if ((gPlayerState.playerInput.newInput & PLAYER_INPUT_80) || this->iframes > 0 || gPlayerState.field_0x3c ||
+ if ((gPlayerState.playerInput.newInput & INPUT_ACTION) || this->iframes > 0 || gPlayerState.field_0x3c ||
(gPlayerState.flags & PL_PARACHUTE) == 0) {
gPlayerState.jump_status |= 0x40;
PlayerSetNormalAndCollide();
@@ -3447,10 +3447,10 @@ void SurfaceAction_14(Entity* this) {
void SurfaceAction_CloneTile(Entity* this) {
if (gPlayerState.chargeState.action == 4) {
u32 item, n, i;
- if (ItemIsSword(gSave.stats.itemButtons[SLOT_A])) {
- item = gSave.stats.itemButtons[SLOT_A];
+ if (ItemIsSword(gSave.stats.equipped[SLOT_A])) {
+ item = gSave.stats.equipped[SLOT_A];
} else {
- item = gSave.stats.itemButtons[SLOT_B];
+ item = gSave.stats.equipped[SLOT_B];
}
switch (item) {
case 1:
@@ -3523,8 +3523,7 @@ void SurfaceAction_ShallowWater(Entity* this) {
this->spritePriority.b0 = 4;
gPlayerState.swim_state = 0;
}
- if ((gPlayerState.playerInput.newInput & PLAYER_INPUT_ANY_DIRECTION) ||
- gPlayerState.surfacePositionSameTimer == 1)
+ if ((gPlayerState.playerInput.newInput & INPUT_ANY_DIRECTION) || gPlayerState.surfacePositionSameTimer == 1)
SoundReq(SFX_WATER_WALK);
}
}
@@ -3567,7 +3566,7 @@ void SurfaceAction_Swamp(Entity* this) {
CreateObjectWithParent(this, OBJECT_70, 0, 0);
CreateFx(this, FX_GREEN_SPLASH, 0);
SoundReq(SFX_161);
- } else if ((gPlayerState.playerInput.newInput & PLAYER_INPUT_ANY_DIRECTION) != 0) {
+ } else if ((gPlayerState.playerInput.newInput & INPUT_ANY_DIRECTION) != 0) {
SoundReq(SFX_161);
} else if ((gRoomTransition.frameCount & 0xf) == 0) {
SoundReq(SFX_161);
@@ -3723,7 +3722,7 @@ void SurfaceAction_Dust(Entity* this) {
if (!sub_080741C4()) {
gPlayerState.speed_modifier -= 128;
if (gPlayerState.surfacePositionSameTimer == 1 ||
- (gPlayerState.playerInput.newInput & PLAYER_INPUT_ANY_DIRECTION) != 0) {
+ (gPlayerState.playerInput.newInput & INPUT_ANY_DIRECTION) != 0) {
if (gPlayerState.floor_type == SURFACE_DUST)
CreateObjectWithParent(this, DIRT_PARTICLE, 1, 0);
else
diff --git a/src/playerItem/playerItemBomb.c b/src/playerItem/playerItemBomb.c
index 63647459..af443266 100644
--- a/src/playerItem/playerItemBomb.c
+++ b/src/playerItem/playerItemBomb.c
@@ -113,10 +113,10 @@ void PlayerItemBomb_Action1(PlayerItemBombEntity* this) {
}
switch (IsItemEquipped(ITEM_REMOTE_BOMBS)) {
case EQUIP_SLOT_A:
- input = PLAYER_INPUT_1;
+ input = INPUT_USE_ITEM1;
break;
case EQUIP_SLOT_B:
- input = PLAYER_INPUT_2;
+ input = INPUT_USE_ITEM2;
break;
case EQUIP_SLOT_NONE:
input = 0;
diff --git a/src/playerUtils.c b/src/playerUtils.c
index cddb108a..cff07abb 100644
--- a/src/playerUtils.c
+++ b/src/playerUtils.c
@@ -175,8 +175,8 @@ void UpdateActiveItems(PlayerEntity* this) {
gPlayerState.attack_status &= 0xf;
if (((gPlayerState.field_0x7 | gPlayerState.jump_status) & 0x80) == 0 && (gPlayerState.jump_status & 0x40) == 0 &&
gPlayerState.swim_state == 0 && IsAbleToUseItem(this) && !IsPreventedFromUsingItem()) {
- CreateItemIfInputMatches(gSave.stats.itemButtons[SLOT_A], PLAYER_INPUT_1, FALSE);
- CreateItemIfInputMatches(gSave.stats.itemButtons[SLOT_B], PLAYER_INPUT_2, FALSE);
+ CreateItemIfInputMatches(gSave.stats.equipped[SLOT_A], INPUT_USE_ITEM1, FALSE);
+ CreateItemIfInputMatches(gSave.stats.equipped[SLOT_B], INPUT_USE_ITEM2, FALSE);
IsTryingToPickupObject();
}
@@ -189,9 +189,9 @@ void UpdateActiveItems(PlayerEntity* this) {
void CreateItemEquippedAtSlot(EquipSlot equipSlot) {
if (equipSlot == EQUIP_SLOT_A) {
- CreateItemIfInputMatches(gSave.stats.itemButtons[SLOT_A], PLAYER_INPUT_1, TRUE);
+ CreateItemIfInputMatches(gSave.stats.equipped[SLOT_A], INPUT_USE_ITEM1, TRUE);
} else {
- CreateItemIfInputMatches(gSave.stats.itemButtons[SLOT_B], PLAYER_INPUT_2, TRUE);
+ CreateItemIfInputMatches(gSave.stats.equipped[SLOT_B], INPUT_USE_ITEM2, TRUE);
}
}
@@ -210,7 +210,7 @@ bool32 IsAbleToUseItem(PlayerEntity* this) {
}
bool32 IsPreventedFromUsingItem(void) {
- if ((gPlayerState.playerInput.newInput & PLAYER_INPUT_80) != 0) {
+ if ((gPlayerState.playerInput.newInput & INPUT_ACTION) != 0) {
if ((gPlayerState.flags & PL_CLONING) != 0) {
gPlayerState.chargeState.action = 1;
DeleteClones();
@@ -233,7 +233,7 @@ bool32 IsPreventedFromUsingItem(void) {
default:
if ((((gUnk_0200AF00.rActionInteractObject == R_ACTION_ROLL) && (gPlayerState.field_0x1c == 0)) &&
(gPlayerState.floor_type != SURFACE_SWAMP)) &&
- ((((gPlayerState.playerInput.heldInput & PLAYER_INPUT_ANY_DIRECTION) != 0 &&
+ ((((gPlayerState.playerInput.heldInput & INPUT_ANY_DIRECTION) != 0 &&
((gPlayerState.flags & (PL_BURNING | PL_ROLLING)) == 0)) &&
((gPlayerState.jump_status == 0 && (gPlayerState.attack_status == 0)))))) {
gPlayerState.queued_action = PLAYER_ROLL;
@@ -274,9 +274,9 @@ bool32 IsTryingToPickupObject(void) {
if (!((((gPlayerState.flags & (PL_USE_PORTAL | PL_MINISH | PL_ROLLING)) == 0) &&
(((gNewPlayerEntity.unk_79 != 0 || (gPlayerState.heldObject != 0)) ||
- ((gPlayerState.playerInput.newInput & PLAYER_INPUT_8000) != 0)))) &&
+ ((gPlayerState.playerInput.newInput & INPUT_LIFT_THROW) != 0)))) &&
(((sub_080789A8() != 0 || ((gPlayerState.playerInput.heldInput &
- (PLAYER_INPUT_ANY_DIRECTION | PLAYER_INPUT_1 | PLAYER_INPUT_2)) == 0)))))) {
+ (INPUT_ANY_DIRECTION | INPUT_USE_ITEM1 | INPUT_USE_ITEM2)) == 0)))))) {
return FALSE;
}
item = CreateItem(ITEM_TRY_PICKUP_OBJECT);
@@ -631,10 +631,10 @@ bool32 IsItemActiveByInput(ItemBehavior* this, PlayerInputState input) {
u32 val;
Stats* stats = &gSave.stats;
u32 id = this->behaviorId;
- if (stats->itemButtons[SLOT_A] == id) {
- val = PLAYER_INPUT_1;
- } else if (stats->itemButtons[SLOT_B] == id) {
- val = PLAYER_INPUT_2;
+ if (stats->equipped[SLOT_A] == id) {
+ val = INPUT_USE_ITEM1;
+ } else if (stats->equipped[SLOT_B] == id) {
+ val = INPUT_USE_ITEM2;
} else {
val = 0;
}
@@ -901,10 +901,10 @@ bool32 sub_08077FEC(u32 action) {
bool32 sub_08078008(ChargeState* state) {
Item swordType;
- if (ItemIsSword(gSave.stats.itemButtons[SLOT_A]) != ITEM_NONE) {
- swordType = gSave.stats.itemButtons[SLOT_A];
- } else if (ItemIsSword(gSave.stats.itemButtons[SLOT_B]) != ITEM_NONE) {
- swordType = gSave.stats.itemButtons[SLOT_B];
+ if (ItemIsSword(gSave.stats.equipped[SLOT_A]) != ITEM_NONE) {
+ swordType = gSave.stats.equipped[SLOT_A];
+ } else if (ItemIsSword(gSave.stats.equipped[SLOT_B]) != ITEM_NONE) {
+ swordType = gSave.stats.equipped[SLOT_B];
} else {
swordType = ITEM_NONE;
}
@@ -1110,7 +1110,7 @@ bool32 sub_080782C0(void) {
return FALSE;
}
}
- if (((gPlayerState.playerInput.newInput & PLAYER_INPUT_1000) != 0) &&
+ if (((gPlayerState.playerInput.newInput & INPUT_FUSE) != 0) &&
((u8)(gPossibleInteraction.currentObject->kinstoneId - 1) < 100)) {
AddKinstoneToBag(KINSTONE_NONE);
if (gSave.kinstones.amounts[0] != 0) {
@@ -1123,7 +1123,7 @@ bool32 sub_080782C0(void) {
ForceSetPlayerState(PL_STATE_TALKEZLO);
return TRUE;
}
- if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0) {
+ if ((gPlayerState.playerInput.newInput & (INPUT_ACTION | INPUT_INTERACT)) == 0) {
return FALSE;
}
switch (gPossibleInteraction.currentObject->type) {
@@ -1973,7 +1973,7 @@ void sub_08079520(Entity* this) {
}
u32 sub_0807953C(void) {
- u32 tmp = PLAYER_INPUT_ANY_DIRECTION | PLAYER_INPUT_20 | PLAYER_INPUT_10 | PLAYER_INPUT_8;
+ u32 tmp = INPUT_ANY_DIRECTION | INPUT_CONTEXT | INPUT_CANCEL | INPUT_INTERACT;
return gPlayerState.playerInput.newInput & tmp;
}
@@ -2549,10 +2549,10 @@ void DeleteClones(void) {
}
bool32 HasSwordEquipped(void) {
- if (ItemIsSword((u32)gSave.stats.itemButtons[SLOT_A]) != 0) {
+ if (ItemIsSword((u32)gSave.stats.equipped[SLOT_A]) != 0) {
return TRUE;
} else {
- return ItemIsSword((u32)gSave.stats.itemButtons[SLOT_B]);
+ return ItemIsSword((u32)gSave.stats.equipped[SLOT_B]);
}
}
@@ -3009,7 +3009,7 @@ void PlayerSwimming(Entity* this) {
}
bool32 ToggleDiving(Entity* this) {
- if (gPlayerState.playerInput.newInput & PLAYER_INPUT_10) {
+ if (gPlayerState.playerInput.newInput & INPUT_CANCEL) {
gPlayerState.swim_state ^= 0x80;
if (gPlayerState.swim_state & 0x80) {
gPlayerState.remainingDiveTime = 0x78;
@@ -3026,7 +3026,7 @@ bool32 ToggleDiving(Entity* this) {
void PlayerUpdateSwimming(Entity* this) {
if ((((this->action != 0x17) || (gPlayerState.field_0xa == 0)) && (gRoomControls.reload_flags == 0)) &&
- ((gPlayerState.playerInput.newInput & PLAYER_INPUT_8) != 0)) {
+ ((gPlayerState.playerInput.newInput & INPUT_INTERACT) != 0)) {
if (GetInventoryValue(ITEM_SWIM_BUTTERFLY) == 1) {
this->speed = 0x1c0;
} else {
diff --git a/src/title.c b/src/title.c
index 353604e3..238e11d1 100644
--- a/src/title.c
+++ b/src/title.c
@@ -89,7 +89,7 @@ static const SaveFile gDemoSave = {
.stats = {
.health = 40,
.maxHealth = 40,
- .itemButtons = { ITEM_SHIELD, ITEM_SMITH_SWORD },
+ .equipped = { ITEM_SHIELD, ITEM_SMITH_SWORD },
.rupees = 5,
},
.inventory = {
diff --git a/src/ui.c b/src/ui.c
index dcc5b573..1bff0dae 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -663,7 +663,7 @@ void ButtonUIElement_Action1(UIElement* element) {
u32 sub_0801CC80(UIElement* element) {
u8 type = element->type;
u32 buttonId = (type ^ 3) != 0;
- u32 itemId = gSave.stats.itemButtons[buttonId];
+ u32 itemId = gSave.stats.equipped[buttonId];
if (ItemIsBottle(itemId)) {
itemId = gSave.stats.bottles[itemId - ITEM_BOTTLE1];
}