identify all player items

This commit is contained in:
theo3
2022-03-28 15:08:37 -07:00
parent 270476488f
commit 7c16e8d50a
46 changed files with 531 additions and 515 deletions
+9 -13
View File
@@ -9,15 +9,15 @@ extern void (*const gUnk_0811BD98[])(ItemBehavior*, u32);
extern s8 gUnk_0811BDAC[];
void ItemBomb(ItemBehavior* this, u32 arg1) {
gUnk_0811BD98[this->stateID](this, arg1);
void ItemBomb(ItemBehavior* this, u32 idx) {
gUnk_0811BD98[this->stateID](this, idx);
}
void sub_08075FF8(ItemBehavior* this, u32 arg1) {
void sub_08075FF8(ItemBehavior* this, u32 idx) {
Entity* entity;
u32 maxBombs;
u32 bombCount;
s8* tmp;
s8* pos;
s32 x;
s32 y;
@@ -25,24 +25,20 @@ void sub_08075FF8(ItemBehavior* this, u32 arg1) {
bombCount = 0;
for (entity = FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_BOMB, 2); entity != NULL;
entity = FindNextDuplicateID(entity, 2)) {
bombCount += 1;
bombCount++;
}
maxBombs = this->behaviorID == 7 ? 3 : 1;
if (maxBombs > bombCount) {
entity = CreatePlayerItemWithParent(this, 2);
if (entity != NULL) {
tmp = &gUnk_0811BDAC[gPlayerEntity.animationState & 6];
// TODO fix array access
x = tmp[0] << 0x10;
y = tmp[1] << 0x10;
PositionRelative(&gPlayerEntity, entity, x, y);
pos = &gUnk_0811BDAC[gPlayerEntity.animationState & 6];
PositionRelative(&gPlayerEntity, entity, Q_16_16(pos[0]), Q_16_16(pos[1]));
ModBombs(-1);
SoundReq(SFX_104);
SoundReq(SFX_PLACE_OBJ);
}
}
}
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
}
// TODO arg1 type not yet known, called by ItemPickupCheck and sub_080762D8
ASM_FUNC("asm/non_matching/itemBomb/sub_08076088.inc", void sub_08076088(ItemBehavior* this, void* arg1))
+7 -7
View File
@@ -3,23 +3,23 @@
extern void (*const gUnk_0811BD78[])(ItemBehavior*, u32);
void ItemBoomerang(ItemBehavior* this, u32 arg1) {
gUnk_0811BD78[this->stateID](this, arg1);
void ItemBoomerang(ItemBehavior* this, u32 idx) {
gUnk_0811BD78[this->stateID](this, idx);
}
void sub_08075D2C(ItemBehavior* this, u32 arg1) {
void sub_08075D2C(ItemBehavior* this, u32 idx) {
if (((gPlayerState.field_0x3[1] & 8) == 0) && (sub_08077C94(this, this->behaviorID) == NULL)) {
this->field_0x5[4] |= 0xf;
sub_0806F948(&gPlayerEntity);
sub_08077C0C(this, 0xb);
sub_08077D38(this, arg1);
sub_08077D38(this, idx);
gPlayerState.field_0x3[1] |= 8;
} else {
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
}
}
void sub_08075D88(ItemBehavior* this, u32 arg1) {
void sub_08075D88(ItemBehavior* this, u32 idx) {
if ((gPlayerState.field_0x3[1] & 0x80) == 0) {
if (((this->behaviorID == 0xc) && ((gPlayerState.field_0xa & 0x80) != 0)) && ((this->field_0x5[9] & 2) != 0)) {
ResetPlayerVelocity();
@@ -30,5 +30,5 @@ void sub_08075D88(ItemBehavior* this, u32 arg1) {
return;
}
}
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
}
+15 -15
View File
@@ -4,23 +4,23 @@
extern void (*const gUnk_0811BD80[])(ItemBehavior*, u32);
void ItemBow(ItemBehavior* this, u32 arg1) {
gUnk_0811BD80[this->stateID](this, arg1);
void ItemBow(ItemBehavior* this, u32 idx) {
gUnk_0811BD80[this->stateID](this, idx);
}
void sub_08075DF4(ItemBehavior* this, u32 arg1) {
void sub_08075DF4(ItemBehavior* this, u32 idx) {
if ((gPlayerState.field_0x3[1] & 8) == 0) {
this->field_0x5[4] |= 0x80;
sub_0806F948(&gPlayerEntity);
sub_08077BB8(this);
sub_08077D38(this, arg1);
sub_08077D38(this, idx);
gPlayerState.field_0x1f[2] = 1;
} else {
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
}
}
void sub_08075E40(ItemBehavior* this, u32 arg1) {
void sub_08075E40(ItemBehavior* this, u32 idx) {
u8 bVar1;
if (gPlayerState.field_0x1f[2] != 0) {
@@ -32,17 +32,17 @@ void sub_08075E40(ItemBehavior* this, u32 arg1) {
this->field_0x5[4] &= 0x7f;
if (gSave.stats.arrowCount != 0) {
this->field_0xf = bVar1;
gPlayerState.field_0xa &= ~(8 >> arg1);
gPlayerState.field_0xa &= ~(8 >> idx);
}
}
return;
}
}
gPlayerState.field_0x1f[2] = 0;
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
}
void sub_08075EC0(ItemBehavior* this, u32 arg1) {
void sub_08075EC0(ItemBehavior* this, u32 idx) {
u8 arrowCount;
s32 iVar2;
@@ -51,10 +51,10 @@ void sub_08075EC0(ItemBehavior* this, u32 arg1) {
if (iVar2 != 0 && arrowCount != 0) {
if (((gPlayerState.field_0x3[1] & 0x80) != 0) || (gPlayerState.field_0x1f[2] == 0)) {
gPlayerState.field_0x1f[2] = 0;
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
}
} else {
gPlayerState.field_0xa = (8 >> arg1) | gPlayerState.field_0xa;
gPlayerState.field_0xa = (8 >> idx) | gPlayerState.field_0xa;
sub_08077DF4(this, 0x27c);
this->field_0xf = 0xf;
this->field_0x5[4] |= 0xf;
@@ -62,7 +62,7 @@ void sub_08075EC0(ItemBehavior* this, u32 arg1) {
}
}
void sub_08075F38(ItemBehavior* this, u32 arg1) {
void sub_08075F38(ItemBehavior* this, u32 idx) {
if (((gPlayerState.field_0x3[1] & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) {
UpdateItemAnim(this);
if ((this->field_0x5[9] & 1) != 0) {
@@ -70,11 +70,11 @@ void sub_08075F38(ItemBehavior* this, u32 arg1) {
}
} else {
gPlayerState.field_0x1f[2] = 0;
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
}
}
void sub_08075F84(ItemBehavior* this, u32 arg1) {
void sub_08075F84(ItemBehavior* this, u32 idx) {
if (((gPlayerState.field_0x3[1] & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) {
if (GetInventoryValue(ITEM_ARROW_BUTTERFLY) == 1) {
sub_08077E3C(this, 5);
@@ -86,5 +86,5 @@ void sub_08075F84(ItemBehavior* this, u32 arg1) {
}
}
gPlayerState.field_0x1f[2] = 0;
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
}
+2 -2
View File
@@ -3,7 +3,7 @@
extern Entity* sub_08077BD4(ItemBehavior*);
extern void DeletePlayerItem(ItemBehavior*, u32);
void ItemDebug(ItemBehavior* beh, u32 arg1) {
void ItemDebug(ItemBehavior* beh, u32 idx) {
sub_08077BD4(beh);
DeletePlayerItem(beh, arg1);
DeletePlayerItem(beh, idx);
}
+14 -14
View File
@@ -5,15 +5,15 @@
void (*const ItemGustJar_StateFunctions[])(ItemBehavior* beh, u32);
void ItemGustJar(ItemBehavior* this, u32 arg1) {
void ItemGustJar(ItemBehavior* this, u32 idx) {
gPlayerState.framestate = PL_STATE_GUSTJAR;
ItemGustJar_StateFunctions[this->stateID](this, arg1);
ItemGustJar_StateFunctions[this->stateID](this, idx);
}
void sub_08076DF4(ItemBehavior* this, u32 arg1) {
void sub_08076DF4(ItemBehavior* this, u32 idx) {
if (sub_0807A894(&gPlayerEntity) != 0x29 && gPlayerState.floor_type != SURFACE_DOOR &&
gPlayerState.floor_type != SURFACE_DOOR_13 && gPlayerState.jump_status == 0) {
sub_08077D38(this, arg1);
sub_08077D38(this, idx);
this->field_0x5[2] = 0;
this->field_0x5[5] = gPlayerEntity.animationState;
this->field_0x5[4] |= 0x80;
@@ -23,20 +23,20 @@ void sub_08076DF4(ItemBehavior* this, u32 arg1) {
gPlayerState.field_0x1c = 1;
sub_08077BB8(this);
} else {
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
}
}
void sub_08076E60(ItemBehavior* this, u32 arg1) {
void sub_08076E60(ItemBehavior* this, u32 idx) {
Entity* playerItem;
if ((gPlayerState.field_0x1c & 0xf) == 0) {
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
}
if ((this->field_0x5[9] & 0x80) != 0) {
this->stateID = 2;
sub_08077DF4(this, 0x504);
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> arg1);
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> idx);
playerItem = CreatePlayerItem(0x10, 0, 0, 0);
if (playerItem != NULL) {
playerItem->parent = &gPlayerEntity;
@@ -46,9 +46,9 @@ void sub_08076E60(ItemBehavior* this, u32 arg1) {
}
}
void sub_08076EC8(ItemBehavior* this, u32 arg1) {
void sub_08076EC8(ItemBehavior* this, u32 idx) {
if ((gPlayerState.field_0x1c & 0xf) == 0) {
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
return;
}
@@ -81,10 +81,10 @@ void sub_08076EC8(ItemBehavior* this, u32 arg1) {
}
this->stateID++;
gPlayerState.field_0xa |= 8 >> arg1;
gPlayerState.field_0xa |= 8 >> idx;
}
void sub_08076F64(ItemBehavior* this, u32 arg1) {
void sub_08076F64(ItemBehavior* this, u32 idx) {
Entity* item;
Entity* player;
switch (gPlayerState.field_0x1c & 0xf) {
@@ -97,7 +97,7 @@ void sub_08076F64(ItemBehavior* this, u32 arg1) {
player = &gPlayerEntity;
*(u32*)&player->field_0x74 = 0;
gPlayerState.field_0x1c = 1;
gPlayerState.field_0xa &= ~(8 >> arg1);
gPlayerState.field_0xa &= ~(8 >> idx);
this->stateID = 2;
sub_08077DF4(this, 0x504);
item = CreatePlayerItem(0x10, 0, 0, 0);
@@ -169,7 +169,7 @@ void sub_08076F64(ItemBehavior* this, u32 arg1) {
case0:
gPlayerState.field_0x1c = 0;
gPlayerEntity.field_0x70.WORD = 0;
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
break;
}
}
+9 -9
View File
@@ -6,13 +6,13 @@ extern void (*const gUnk_0811BE28[])(ItemBehavior*, u32);
extern u8 gUnk_02002AC8[];
void ItemJarEmpty(ItemBehavior* this, u32 arg1) {
gUnk_0811BE28[this->stateID](this, arg1);
void ItemJarEmpty(ItemBehavior* this, u32 idx) {
gUnk_0811BE28[this->stateID](this, idx);
}
void sub_08077534(ItemBehavior* this, u32 arg1) {
void sub_08077534(ItemBehavior* this, u32 idx) {
u32 tmp;
sub_08077D38(this, arg1);
sub_08077D38(this, idx);
sub_0806F948(&gPlayerEntity);
sub_08077BB8(this);
this->field_0x5[4] |= 0xf;
@@ -49,7 +49,7 @@ void sub_08077534(ItemBehavior* this, u32 arg1) {
gPlayerEntity.flags &= ~ENT_COLLIDE;
}
void sub_08077618(ItemBehavior* this, u32 arg1) {
void sub_08077618(ItemBehavior* this, u32 idx) {
if ((this->field_0x5[9] & 0x80) != 0) {
sub_08077DF4(this, 0x618);
this->stateID += 1;
@@ -58,18 +58,18 @@ void sub_08077618(ItemBehavior* this, u32 arg1) {
}
}
void sub_08077640(ItemBehavior* this, u32 arg1) {
void sub_08077640(ItemBehavior* this, u32 idx) {
UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) {
gPlayerEntity.flags |= ENT_COLLIDE;
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
}
}
void sub_0807766C(ItemBehavior* this, u32 arg1) {
void sub_0807766C(ItemBehavior* this, u32 idx) {
UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) {
gPlayerEntity.flags |= ENT_COLLIDE;
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
}
}
+13 -13
View File
@@ -13,11 +13,11 @@ extern bool32 sub_08077F10(ItemBehavior*);
extern void sub_0807AB44(Entity*, s32, s32);
void ItemLantern(ItemBehavior* this, u32 arg1) {
gUnk_0811BD68[this->stateID](this, arg1);
void ItemLantern(ItemBehavior* this, u32 idx) {
gUnk_0811BD68[this->stateID](this, idx);
}
void sub_08075A0C(ItemBehavior* this, u32 arg1) {
void sub_08075A0C(ItemBehavior* this, u32 idx) {
Entity* object;
u32 itemSlot;
s8* tmp;
@@ -27,10 +27,10 @@ void sub_08075A0C(ItemBehavior* this, u32 arg1) {
ForceEquipItem(ITEM_LANTERN_OFF, itemSlot);
gPlayerState.flags &= ~PL_USE_LANTERN;
ForceEquipItem(ITEM_LANTERN_OFF, itemSlot);
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
} else {
this->field_0x5[4] |= 0x80;
sub_08077D38(this, arg1);
sub_08077D38(this, idx);
sub_08077BD4(this);
sub_0806F948(&gPlayerEntity);
this->behaviorID = 0x10;
@@ -45,7 +45,7 @@ void sub_08075A0C(ItemBehavior* this, u32 arg1) {
}
}
void sub_08075ADC(ItemBehavior* this, u32 arg1) {
void sub_08075ADC(ItemBehavior* this, u32 idx) {
u32 bVar1;
if (
@@ -57,7 +57,7 @@ void sub_08075ADC(ItemBehavior* this, u32 arg1) {
this->field_0xf = 0;
this->stateID += 1;
gPlayerState.flags |= PL_USE_LANTERN;
bVar1 = 8 >> arg1;
bVar1 = 8 >> idx;
gPlayerState.field_0x3[1] = gPlayerState.field_0x3[1] & ~((bVar1 << 4) | bVar1);
bVar1 = ~bVar1;
gPlayerState.field_0xa = bVar1 & gPlayerState.field_0xa;
@@ -68,7 +68,7 @@ void sub_08075ADC(ItemBehavior* this, u32 arg1) {
}
}
void sub_08075B54(ItemBehavior* this, u32 arg1) {
void sub_08075B54(ItemBehavior* this, u32 idx) {
u32 bVar1;
u32 itemSlot;
Entity* object;
@@ -79,7 +79,7 @@ void sub_08075B54(ItemBehavior* this, u32 arg1) {
if (!(((sub_08077F10(this) == 0) && (itemSlot < 2)) || (gPlayerState.jump_status != 0))) {
ForceEquipItem(ITEM_LANTERN_OFF, itemSlot);
gPlayerState.flags &= ~PL_USE_LANTERN;
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
SoundReq(SFX_ITEM_LANTERN_OFF);
} else {
if (((gPlayerState.queued_action != PLAYER_ROLL) && (gPlayerEntity.frameIndex < 0x37)) &&
@@ -99,7 +99,7 @@ void sub_08075B54(ItemBehavior* this, u32 arg1) {
object->y.HALF.HI = tmp[1] + object->y.HALF.HI;
}
sub_08077DF4(this, 0x60c);
bVar1 = (8 >> (arg1));
bVar1 = (8 >> (idx));
gPlayerState.field_0xa |= bVar1;
gPlayerState.keepFacing |= bVar1;
}
@@ -108,7 +108,7 @@ void sub_08075B54(ItemBehavior* this, u32 arg1) {
}
}
void sub_08075C9C(ItemBehavior* this, u32 arg1) {
void sub_08075C9C(ItemBehavior* this, u32 idx) {
s8* tmp;
UpdateItemAnim(this);
@@ -119,8 +119,8 @@ void sub_08075C9C(ItemBehavior* this, u32 arg1) {
if ((this->field_0x5[9] & 0x80) != 0) {
this->field_0xf = 0;
this->stateID -= 1;
gPlayerState.field_0xa = (~(8 >> arg1)) & gPlayerState.field_0xa;
gPlayerState.keepFacing = (~(8 >> arg1)) & gPlayerState.keepFacing;
gPlayerState.field_0xa = (~(8 >> idx)) & gPlayerState.field_0xa;
gPlayerState.keepFacing = (~(8 >> idx)) & gPlayerState.keepFacing;
} else {
gPlayerEntity.field_0x7a.HWORD += 1;
}
+11 -11
View File
@@ -18,15 +18,15 @@ extern bool32 sub_0807B5B0(Entity*);
extern const s16 gUnk_0811BE16[];
void ItemMoleMitts(ItemBehavior* this, u32 arg1) {
gUnk_0811BE04[this->stateID](this, arg1);
void ItemMoleMitts(ItemBehavior* this, u32 idx) {
gUnk_0811BE04[this->stateID](this, idx);
}
void sub_08077130(ItemBehavior* this, u32 arg1) {
void sub_08077130(ItemBehavior* this, u32 idx) {
s32 iVar1;
if (gPlayerState.jump_status == 0) {
sub_08077D38(this, arg1);
sub_08077D38(this, idx);
gPlayerState.field_0x3c[1] = 1;
this->field_0x5[4] |= 0x80;
iVar1 = sub_080774A0();
@@ -47,17 +47,17 @@ void sub_08077130(ItemBehavior* this, u32 arg1) {
this->stateID = 1;
}
} else {
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
gPlayerState.field_0x3c[1] = 0;
}
}
void sub_080771C8(ItemBehavior* this, u32 arg1) {
void sub_080771C8(ItemBehavior* this, u32 idx) {
Entity* object;
UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) {
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
gPlayerState.field_0x3c[1] = 0;
} else {
if (((this->field_0x5[9] & 0x20) != 0) && (this->field_0x5[3] == 0xff)) {
@@ -89,7 +89,7 @@ void sub_080771C8(ItemBehavior* this, u32 arg1) {
}
}
void sub_080772A8(ItemBehavior* this, u32 param_2) {
void sub_080772A8(ItemBehavior* this, u32 idx) {
Entity* effect;
if (((this->field_0x5[9] & 8) != 0) && sub_08077F10(this)) {
@@ -119,7 +119,7 @@ void sub_080772A8(ItemBehavior* this, u32 param_2) {
return;
}
}
DeletePlayerItem(this, param_2);
DeletePlayerItem(this, idx);
gPlayerState.field_0x3c[1] = 0;
} else {
if ((this->field_0x5[9] & 0x60) != 0) {
@@ -148,7 +148,7 @@ void sub_080772A8(ItemBehavior* this, u32 param_2) {
}
}
void sub_08077448(ItemBehavior* this, u32 arg1) {
void sub_08077448(ItemBehavior* this, u32 idx) {
gPlayerEntity.direction = gPlayerEntity.animationState << 2 ^ 0x10;
gPlayerEntity.speed = 0x100;
if (((this->field_0x5[9] & 1) != 0) && (this->field_0x5[0] != 0)) {
@@ -157,7 +157,7 @@ void sub_08077448(ItemBehavior* this, u32 arg1) {
UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) {
gPlayerState.field_0x3c[1] = 0;
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
}
}
+9 -9
View File
@@ -8,14 +8,14 @@ extern void ResetPlayerVelocity(void);
extern void CreateBird(void);
void ItemOcarina(ItemBehavior* this, u32 arg1) {
gOcarinaStates[this->stateID](this, arg1);
void ItemOcarina(ItemBehavior* this, u32 idx) {
gOcarinaStates[this->stateID](this, idx);
gPlayerEntity.field_0x7a.HWORD += 1;
}
void OcarinaUse(ItemBehavior* this, u32 arg1) {
void OcarinaUse(ItemBehavior* this, u32 idx) {
if (gPlayerState.queued_action == PLAYER_ROLL) {
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
} else {
this->field_0x5[4] |= 0xf;
gPlayerEntity.animationState = 0x04;
@@ -25,16 +25,16 @@ void OcarinaUse(ItemBehavior* this, u32 arg1) {
gPlayerState.flags |= PL_USE_OCARINA;
gPlayerState.field_0x27[0] = -1;
gPauseMenuOptions.disabled = 1;
gPlayerState.field_0xa = (8 >> arg1) | gPlayerState.field_0xa;
gPlayerState.keepFacing = (8 >> arg1) | gPlayerState.keepFacing;
gPlayerState.field_0xa = (8 >> idx) | gPlayerState.field_0xa;
gPlayerState.keepFacing = (8 >> idx) | gPlayerState.keepFacing;
ResetPlayerVelocity();
sub_08077D38(this, arg1);
sub_08077D38(this, idx);
SoundReq(SFX_216);
SetPlayerEventPriority();
}
}
NONMATCH("asm/non_matching/ocarina/OcarinaUpdate.inc", void OcarinaUpdate(ItemBehavior* this, u32 arg1)) {
NONMATCH("asm/non_matching/ocarina/OcarinaUpdate.inc", void OcarinaUpdate(ItemBehavior* this, u32 idx)) {
// TODO regalloc
UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) {
@@ -44,7 +44,7 @@ NONMATCH("asm/non_matching/ocarina/OcarinaUpdate.inc", void OcarinaUpdate(ItemBe
gPauseMenuOptions.disabled = 0;
CreateBird();
ResetPlayerEventPriority();
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
}
}
END_NONMATCH
+6 -6
View File
@@ -5,20 +5,20 @@
extern void (*const gUnk_0811BDE0[])(ItemBehavior* beh, u32);
void ItemPacciCane(ItemBehavior* beh, u32 arg1) {
gUnk_0811BDE0[beh->stateID](beh, arg1);
void ItemPacciCane(ItemBehavior* beh, u32 idx) {
gUnk_0811BDE0[beh->stateID](beh, idx);
}
void sub_08076C98(ItemBehavior* beh, u32 arg1) {
void sub_08076C98(ItemBehavior* beh, u32 idx) {
beh->field_0x5[4] |= 0xf;
sub_08077D38(beh, arg1);
sub_08077D38(beh, idx);
sub_0806F948(&gPlayerEntity);
sub_08077BB8(beh);
}
void sub_08076CBC(ItemBehavior* beh, u32 arg1) {
void sub_08076CBC(ItemBehavior* beh, u32 idx) {
if ((beh->field_0x5[9] & 0x80) != 0) {
DeletePlayerItem(beh, arg1);
DeletePlayerItem(beh, idx);
} else {
if ((beh->field_0x5[9] & 0x40) != 0) {
CreatePlayerItemWithParent(beh, 0x12);
+13 -13
View File
@@ -13,7 +13,7 @@ void sub_08076A88(ItemBehavior*, u32);
extern u16 gUnk_0800275C[];
extern u8 gUnk_0811BE38[];
void ItemPegasusBoots(ItemBehavior* this, u32 arg1) {
void ItemPegasusBoots(ItemBehavior* this, u32 idx) {
static void (*const ItemPegasusBoots_StateFunctions[])(ItemBehavior * beh, u32) = {
sub_080768F8,
sub_08076964,
@@ -26,7 +26,7 @@ void ItemPegasusBoots(ItemBehavior* this, u32 arg1) {
if (gPlayerEntity.field_0x7a.HWORD != 0) {
gPlayerState.dash_state = 0;
gPlayerState.field_0xe = 0;
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
} else {
bVar1 = this->field_0x5[2] - 1;
this->field_0x5[2] = bVar1;
@@ -54,11 +54,11 @@ void ItemPegasusBoots(ItemBehavior* this, u32 arg1) {
}
}
}
ItemPegasusBoots_StateFunctions[this->stateID](this, arg1);
ItemPegasusBoots_StateFunctions[this->stateID](this, idx);
}
}
void sub_080768F8(ItemBehavior* this, u32 arg1) {
void sub_080768F8(ItemBehavior* this, u32 idx) {
u32 bVar1;
u32 bVar2;
@@ -73,16 +73,16 @@ void sub_080768F8(ItemBehavior* this, u32 arg1) {
} else {
gPlayerState.animation = 0xc14;
}
sub_08077D38(this, arg1);
sub_08076964(this, arg1);
sub_08077D38(this, idx);
sub_08076964(this, idx);
} else {
gPlayerState.dash_state = 0;
gPlayerState.field_0xe = 0;
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
}
}
void sub_08076964(ItemBehavior* this, u32 arg1) {
void sub_08076964(ItemBehavior* this, u32 idx) {
Entity* bombEntity;
u32 uVar3;
if (sub_08077EFC(this) && gPlayerEntity.z.WORD == 0 && gPlayerState.dash_state) {
@@ -95,11 +95,11 @@ void sub_08076964(ItemBehavior* this, u32 arg1) {
if ((++gPlayerState.dash_state) == 0x1e) {
if ((gPlayerState.flags & PL_FLAGS2) != 0) {
gPlayerState.dash_state = 0;
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
return;
}
gPlayerState.dash_state = 0x40;
gPlayerState.field_0xa &= ~(8 >> arg1);
gPlayerState.field_0xa &= ~(8 >> idx);
this->stateID++;
if (HasSwordEquipped() && (gPlayerState.flags & PL_MINISH) == 0 &&
(gPlayerState.skills & SKILL_DASH_ATTACK) != 0) {
@@ -127,10 +127,10 @@ void sub_08076964(ItemBehavior* this, u32 arg1) {
}
}
gPlayerState.dash_state = 0;
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
}
void sub_08076A88(ItemBehavior* this, u32 arg1) {
void sub_08076A88(ItemBehavior* this, u32 idx) {
u32 uVar1;
u32 uVar2;
u8* ptr;
@@ -170,5 +170,5 @@ void sub_08076A88(ItemBehavior* this, u32 arg1) {
}
}
gPlayerState.dash_state = 0;
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
}
+9 -9
View File
@@ -6,40 +6,40 @@
extern void (*const gUnk_0811BDE8[])(ItemBehavior* beh, u32);
void ItemShield(ItemBehavior* beh, u32 arg1) {
gUnk_0811BDE8[beh->stateID](beh, arg1);
void ItemShield(ItemBehavior* beh, u32 idx) {
gUnk_0811BDE8[beh->stateID](beh, idx);
}
void sub_08076D04(ItemBehavior* beh, u32 arg1) {
void sub_08076D04(ItemBehavior* beh, u32 idx) {
gPlayerState.field_0x3[0] = 0x81;
beh->field_0x5[4] = 2;
sub_0806F948(&gPlayerEntity);
sub_08077D38(beh, arg1);
sub_08077D38(beh, idx);
sub_08077BB8(beh);
}
void sub_08076D34(ItemBehavior* beh, u32 arg1) {
void sub_08076D34(ItemBehavior* beh, u32 idx) {
if (sub_08077EFC(beh) != 0) {
gPlayerState.field_0x3[0] |= 1;
UpdateItemAnim(beh);
if (beh->field_0x5[9] != 0) {
beh->stateID++;
beh->field_0xf = 0;
gPlayerState.field_0xa &= ~(u8)(8 >> arg1);
gPlayerState.field_0xa &= ~(u8)(8 >> idx);
SoundReq(SFX_15D);
}
} else {
gPlayerState.field_0x3[0] = 0;
DeletePlayerItem(beh, arg1);
DeletePlayerItem(beh, idx);
}
}
void sub_08076D94(ItemBehavior* beh, u32 arg1) {
void sub_08076D94(ItemBehavior* beh, u32 idx) {
if (sub_08077EFC(beh)) {
gPlayerState.field_0x3[0] |= 1;
UpdateItemAnim(beh);
} else {
gPlayerState.field_0x3[0] = 0;
DeletePlayerItem(beh, arg1);
DeletePlayerItem(beh, idx);
}
}
+43 -43
View File
@@ -11,18 +11,18 @@ void sub_080754B8(ItemBehavior*, u32);
void sub_08075898(ItemBehavior*, u32);
void sub_08075580(ItemBehavior*, u32);
void sub_08075694(ItemBehavior* this, u32 arg1);
void sub_08075694(ItemBehavior* this, u32 idx);
void ItemSword(ItemBehavior* this, u32 arg1) {
void ItemSword(ItemBehavior* this, u32 idx) {
gPlayerState.framestate = PL_STATE_SWORD;
gUnk_0811BD44[this->stateID](this, arg1);
gUnk_0811BD44[this->stateID](this, idx);
}
void sub_08075338(ItemBehavior* this, u32 arg1) {
void sub_08075338(ItemBehavior* this, u32 idx) {
u32 temp, temp2;
if (gPlayerState.flags & PL_MINISH) {
this->field_0x5[4] |= 0x80;
sub_08077D38(this, arg1);
sub_08077D38(this, idx);
gPlayerState.animation = 0xc00;
SoundReq(SFX_PLY_VO1);
return;
@@ -34,19 +34,19 @@ void sub_08075338(ItemBehavior* this, u32 arg1) {
(gPlayerState.skills & SKILL_DOWN_THRUST) && gPlayerEntity.z.WORD) {
gPlayerState.jump_status |= 0x20;
gPlayerState.field_0xab = 7;
gPlayerState.field_0x3[1] |= (8 >> arg1) | ((8 >> arg1) << 4);
gPlayerState.field_0x3[1] |= (8 >> idx) | ((8 >> idx) << 4);
sub_08077B98(this);
this->stateID = 6;
sub_08075898(this, arg1);
sub_08075898(this, idx);
return;
}
}
#ifndef EU
sub_080759B8(this, arg1);
sub_080759B8(this, idx);
return;
} else if (gPlayerEntity.z.WORD) {
#endif
sub_080759B8(this, arg1);
sub_080759B8(this, idx);
return;
}
@@ -60,9 +60,9 @@ void sub_08075338(ItemBehavior* this, u32 arg1) {
}
// Do the roll attack.
sub_08077D38(this, arg1);
sub_08077D38(this, idx);
sub_08077B98(this);
temp = (8 >> arg1);
temp = (8 >> idx);
gPlayerState.field_0x3[1] |= temp | (temp << 4);
gPlayerState.field_0xa |= temp;
gPlayerState.keepFacing |= temp;
@@ -89,15 +89,15 @@ void sub_08075338(ItemBehavior* this, u32 arg1) {
}
}
sub_08077D38(this, arg1);
sub_08077D38(this, idx);
sub_08077B98(this);
}
void sub_080754B8(ItemBehavior* this, u32 arg1) {
void sub_080754B8(ItemBehavior* this, u32 idx) {
u32 iVar1;
if ((gPlayerState.sword_state & 0x80) != 0) {
sub_08075694(this, arg1);
sub_08075694(this, idx);
} else if (gPlayerState.field_0x3[1] != 0) {
UpdateItemAnim(this);
if (this->field_0x5[9] != 0) {
@@ -118,19 +118,19 @@ void sub_080754B8(ItemBehavior* this, u32 arg1) {
if ((this->field_0x5[9] & 0x80) != 0) {
if (((gPlayerState.flags & 0x80) != 0) || ((gPlayerState.skills & SKILL_SPIN_ATTACK) == 0)) {
sub_080759B8(this, arg1);
sub_080759B8(this, idx);
} else {
sub_08075580(this, arg1);
sub_08075580(this, idx);
}
}
} else {
sub_080759B8(this, arg1);
sub_080759B8(this, idx);
}
}
void sub_08075580(ItemBehavior* this, u32 arg1) {
void sub_08075580(ItemBehavior* this, u32 idx) {
if ((sub_08077EFC(this) != 0) && (gPlayerState.jump_status == 0)) {
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> arg1);
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> idx);
gPlayerState.sword_state = 1;
gPlayerState.item->hurtType = 0xd;
this->field_0xf = 0;
@@ -144,10 +144,10 @@ void sub_08075580(ItemBehavior* this, u32 arg1) {
CreateObject(OBJECT_43, 0, 0);
return;
}
sub_080759B8(this, arg1);
sub_080759B8(this, idx);
}
void sub_080755F0(ItemBehavior* this, u32 arg1) {
void sub_080755F0(ItemBehavior* this, u32 idx) {
if (sub_08077EFC(this) != 0) {
if (sub_08077EC8(this) == 0) {
if ((gPlayerState.sword_state | gPlayerState.field_0x3[1]) != 0) {
@@ -157,25 +157,25 @@ void sub_080755F0(ItemBehavior* this, u32 arg1) {
gPlayerState.sword_state = gPlayerState.sword_state | 0x20;
}
} else {
sub_080759B8(this, arg1);
sub_080759B8(this, idx);
}
}
} else {
sub_080759B8(this, arg1);
sub_080759B8(this, idx);
}
}
void sub_0807564C(ItemBehavior* this, u32 arg1) {
void sub_0807564C(ItemBehavior* this, u32 idx) {
if ((gPlayerState.sword_state | gPlayerState.field_0x3[1]) == 0) {
sub_080759B8(this, arg1);
sub_080759B8(this, idx);
} else {
if ((sub_08077EC8(this) == 0) && ((sub_08077EFC(this) == 0 || ((gPlayerState.sword_state & 0x80) != 0)))) {
sub_08075694(this, arg1);
sub_08075694(this, idx);
}
}
}
void sub_08075694(ItemBehavior* this, u32 arg1) {
void sub_08075694(ItemBehavior* this, u32 idx) {
this->field_0x5[2] = 1;
if (gPlayerState.flags & PL_SWORD_THRUST) {
gPlayerState.flags &= ~PL_SWORD_THRUST;
@@ -185,7 +185,7 @@ void sub_08075694(ItemBehavior* this, u32 arg1) {
gPlayerState.field_0xab = 1;
sub_08077DF4(this, 0x124);
}
gPlayerState.field_0xa = (8 >> arg1) | gPlayerState.field_0xa;
gPlayerState.field_0xa = (8 >> idx) | gPlayerState.field_0xa;
this->stateID = 4;
this->field_0xf = 6;
gPlayerEntity.hurtType = 0x1e;
@@ -198,11 +198,11 @@ void sub_08075694(ItemBehavior* this, u32 arg1) {
SoundReq(SFX_PLY_VO2);
}
void sub_08075738(ItemBehavior* this, u32 arg1) {
void sub_08075738(ItemBehavior* this, u32 idx) {
u32 bVar6;
if (gPlayerState.field_0x3[1] == 0) {
sub_080759B8(this, arg1);
sub_080759B8(this, idx);
} else {
UpdateItemAnim(this);
if (sub_08077F10(this)) {
@@ -222,7 +222,7 @@ void sub_08075738(ItemBehavior* this, u32 arg1) {
}
if ((bVar6 <= ++this->field_0x5[3]) || (--this->field_0x5[2] == 0)) {
sub_080759B8(this, arg1);
sub_080759B8(this, idx);
}
}
} else {
@@ -241,26 +241,26 @@ void sub_08075738(ItemBehavior* this, u32 arg1) {
this->field_0x5[6] = gPlayerEntity.animationState << 2;
this->field_0x5[2] = 1;
this->field_0x5[3] = 1;
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> arg1);
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> idx);
sub_08077DF4(this, 0x128);
}
if ((this->field_0x5[9] & 0x80) != 0) {
sub_080759B8(this, arg1);
sub_080759B8(this, idx);
}
}
}
}
void sub_08075898(ItemBehavior* this, u32 arg1) {
void sub_08075898(ItemBehavior* this, u32 idx) {
if (gPlayerState.field_0x3[1] == 0) {
sub_080759B8(this, arg1);
sub_080759B8(this, idx);
}
}
void sub_080758B0(ItemBehavior* this, u32 arg1) {
void sub_080758B0(ItemBehavior* this, u32 idx) {
if (gPlayerState.field_0x3[1] == 0) {
sub_080759B8(this, arg1);
sub_080759B8(this, idx);
} else {
UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) {
@@ -275,15 +275,15 @@ void sub_080758B0(ItemBehavior* this, u32 arg1) {
}
}
void sub_08075900(ItemBehavior* this, u32 arg1) {
void sub_08075900(ItemBehavior* this, u32 idx) {
if (gPlayerState.floor_type == SURFACE_SWAMP) {
gPlayerState.flags &= ~PL_ROLLING;
sub_080759B8(this, arg1);
sub_080759B8(this, idx);
} else {
UpdateItemAnim(this);
if ((gPlayerState.sword_state & 0x80) != 0) {
gPlayerState.sword_state = 0xa0;
sub_0807564C(this, arg1);
sub_0807564C(this, idx);
} else {
if (this->field_0x5[2] != 0) {
@@ -299,19 +299,19 @@ void sub_08075900(ItemBehavior* this, u32 arg1) {
} else {
if ((this->field_0x5[9] & 0x80) != 0) {
gPlayerState.flags &= ~PL_ROLLING;
sub_080759B8(this, arg1);
sub_080759B8(this, idx);
}
}
}
}
}
void sub_080759B8(ItemBehavior* this, u32 arg1) {
void sub_080759B8(ItemBehavior* this, u32 idx) {
if ((gPlayerState.flags & PL_MINISH) == 0) {
gPlayerEntity.hurtType = 0;
}
gPlayerState.flags &= ~PL_SWORD_THRUST;
gPlayerState.sword_state = 0;
gPlayerState.item = NULL;
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
}
+25 -26
View File
@@ -4,18 +4,18 @@
extern void (*const gUnk_0811BDB4[])(ItemBehavior*, u32);
u32 sub_08077F64(ItemBehavior* arg0, u32 unk);
u32 sub_08077F64(ItemBehavior* arg0, u32 idx);
u32 sub_080789A8(void);
void sub_080762C4(ItemBehavior*, void*, u8, u32);
void sub_08076088(ItemBehavior*, void*, u32);
void ItemTryPickupObject(ItemBehavior* this, u32 arg1) {
gUnk_0811BDB4[this->stateID](this, arg1);
void ItemTryPickupObject(ItemBehavior* this, u32 idx) {
gUnk_0811BDB4[this->stateID](this, idx);
}
void ItemPickupCheck(ItemBehavior* this, u32 param_2) {
Entity* entity;
void ItemPickupCheck(ItemBehavior* this, u32 idx) {
Entity* carried;
if (!(((gPlayerState.field_0x3[1] != 0) ||
(((gPlayerState.jump_status != 0 && ((gPlayerState.flags & (PL_BUSY | PL_FALLING | PL_IN_MINECART)) == 0)) ||
@@ -24,28 +24,28 @@ void ItemPickupCheck(ItemBehavior* this, u32 param_2) {
switch (sub_080789A8()) {
case 2:
if (((gCarriedEntity.unk_8)->field_0x16 & 0xf) == 0) {
sub_08076088(this, gCarriedEntity.unk_8, param_2);
sub_08076088(this, gCarriedEntity.unk_8, idx);
return;
}
entity = gCarriedEntity.unk_8;
this->field_0x18 = entity;
entity->action = 2;
entity->subAction = 5;
carried = gCarriedEntity.unk_8;
this->field_0x18 = carried;
carried->action = 2;
carried->subAction = 5;
gPlayerState.framestate = 5;
sub_080762C4(this, entity, 2, param_2);
sub_080762C4(this, carried, 2, idx);
gUnk_0200AF00.unk_2e = 8;
SoundReq(SFX_102);
break;
case 1:
sub_080762C4(this, 0, 1, param_2);
sub_080762C4(this, 0, 1, idx);
SoundReq(SFX_102);
break;
case 0:
this->stateID = 5;
this->field_0x5[2] = 0x0f;
this->field_0xf = 6;
gPlayerState.field_0xa = (8 >> param_2) | gPlayerState.field_0xa;
gPlayerState.keepFacing = (8 >> param_2) | gPlayerState.keepFacing;
gPlayerState.field_0xa = (8 >> idx) | gPlayerState.field_0xa;
gPlayerState.keepFacing = (8 >> idx) | gPlayerState.keepFacing;
if ((gPlayerState.flags & PL_NO_CAP) == 0) {
sub_08077DF4(this, 0x378);
} else {
@@ -56,9 +56,8 @@ void ItemPickupCheck(ItemBehavior* this, u32 param_2) {
default:
break;
}
} else {
PlayerCancelHoldItem(this, param_2);
PlayerCancelHoldItem(this, idx);
}
}
@@ -68,14 +67,14 @@ void sub_080762C4(ItemBehavior* this, void* arg1, u8 arg2, u32 arg3) {
sub_08077D38(this, arg3);
}
ASM_FUNC("asm/non_matching/itemTryPickupObject/sub_080762D8.inc", void sub_080762D8(ItemBehavior* this, u32 arg1))
ASM_FUNC("asm/non_matching/itemTryPickupObject/sub_080762D8.inc", void sub_080762D8(ItemBehavior* this, u32 idx))
void sub_08076488(ItemBehavior* this, u32 arg1) {
void sub_08076488(ItemBehavior* this, u32 idx) {
u32 bVar1;
s32 iVar2;
if (this->field_0x5[2] == 0) {
if (PlayerTryDropObject(this, arg1) != 0) {
if (PlayerTryDropObject(this, idx) != 0) {
if ((((this->field_0x18->field_0x16) & 0xf0) == 0x10) && ((gRoomTransition.frameCount & 1U) != 0)) {
return;
}
@@ -83,7 +82,7 @@ void sub_08076488(ItemBehavior* this, u32 arg1) {
if ((this->field_0x5[9] & 0x80) != 0) {
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerState.heldObject = 4;
bVar1 = ~(8 >> arg1);
bVar1 = ~(8 >> idx);
gPlayerState.keepFacing = bVar1 & gPlayerState.keepFacing;
gPlayerState.field_0xa = bVar1 & gPlayerState.field_0xa;
this->stateID += 1;
@@ -96,22 +95,22 @@ void sub_08076488(ItemBehavior* this, u32 arg1) {
gPlayerState.framestate = PL_STATE_HOLD;
}
ASM_FUNC("asm/non_matching/itemTryPickupObject/sub_08076518.inc", void sub_08076518(ItemBehavior* this, u32 arg1))
ASM_FUNC("asm/non_matching/itemTryPickupObject/sub_08076518.inc", void sub_08076518(ItemBehavior* this, u32 idx))
void sub_080765E0(ItemBehavior* this, u32 arg1) {
if (PlayerTryDropObject(this, arg1) != 0) {
void sub_080765E0(ItemBehavior* this, u32 idx) {
if (PlayerTryDropObject(this, idx) != 0) {
if ((this->field_0x5[9] & 0x80) != 0) {
PlayerCancelHoldItem(this, arg1);
PlayerCancelHoldItem(this, idx);
} else {
UpdateItemAnim(this);
}
}
}
void sub_0807660C(ItemBehavior* this, u32 arg1) {
void sub_0807660C(ItemBehavior* this, u32 idx) {
UpdateItemAnim(this);
if ((this->field_0x5[2]-- == 0) || (gPlayerState.field_0x0[1] == 0)) {
gPlayerState.field_0x0[1] = 0;
DeletePlayerItem(this, arg1);
DeletePlayerItem(this, idx);
}
}