From 1f515e6958497600f277114f163b31f92acbf22c Mon Sep 17 00:00:00 2001 From: theo3 Date: Sat, 25 Dec 2021 16:35:54 -0800 Subject: [PATCH] doc surface types --- asm/code_080732D0.s | 6 +- asm/code_08078778.s | 4 +- asm/non_matching/player/PlayerNormal.inc | 4 +- asm/non_matching/player/sub_08070DC4.inc | 2 +- include/functions.h | 2 +- include/player.h | 83 ++++++--- src/code_08077B98.c | 18 +- src/collision.c | 4 +- src/coord.c | 4 +- src/enemy/vaatiWrath.c | 2 +- src/item/itemBow.c | 18 +- src/item/itemLantern.c | 4 +- src/item/itemPegasusBoots.c | 10 +- src/item/itemRocsCape.c | 6 +- src/item/itemSword.c | 4 +- src/manager/manager15.c | 2 +- src/manager/manager6.c | 2 +- src/npcUtils.c | 2 +- src/object/furniture.c | 2 +- src/overworld.c | 2 +- src/player.c | 211 ++++++++++++----------- src/playerItem/playerItem11.c | 2 +- src/playerItem/playerItemC.c | 12 +- src/playerItem/playerItemGustJar.c | 2 +- 24 files changed, 227 insertions(+), 181 deletions(-) diff --git a/asm/code_080732D0.s b/asm/code_080732D0.s index 8a27c50a..36957a76 100644 --- a/asm/code_080732D0.s +++ b/asm/code_080732D0.s @@ -182,7 +182,7 @@ PlayerParachute: @ 0x08073420 bl sub_08078EFC cmp r0, #0 bne _0807345E - bl sub_0807A1B8 + bl UpdateFloorType ldrb r2, [r4, #0x1b] movs r1, #0x3f adds r0, r1, #0 @@ -1105,7 +1105,7 @@ _08073AFA: bl sub_0807A2B8 movs r0, #0 strb r0, [r6, #2] - bl sub_0807A1B8 + bl UpdateFloorType ldrb r0, [r6, #0xc] cmp r0, #0 bne _08073B5C @@ -1422,7 +1422,7 @@ _08073D74: _08073D80: adds r0, r4, #0 bl sub_08073904 - bl sub_0807A1B8 + bl UpdateFloorType ldrb r0, [r5, #2] cmp r0, #0 beq _08073D96 diff --git a/asm/code_08078778.s b/asm/code_08078778.s index d6955113..36074a2e 100644 --- a/asm/code_08078778.s +++ b/asm/code_08078778.s @@ -3371,8 +3371,8 @@ sub_0807A180: @ 0x0807A180 .align 2, 0 _0807A1B4: .4byte 0xFFFC0000 - thumb_func_start sub_0807A1B8 -sub_0807A1B8: @ 0x0807A1B8 + thumb_func_start UpdateFloorType +UpdateFloorType: @ 0x0807A1B8 push {r4, lr} ldr r4, _0807A1DC @ =gPlayerEntity adds r0, r4, #0 diff --git a/asm/non_matching/player/PlayerNormal.inc b/asm/non_matching/player/PlayerNormal.inc index a1555771..17b2e5e8 100644 --- a/asm/non_matching/player/PlayerNormal.inc +++ b/asm/non_matching/player/PlayerNormal.inc @@ -154,7 +154,7 @@ _080708AC: ands r0, r6 cmp r0, #0 bne _080708C4 - bl sub_0807A1B8 + bl UpdateFloorType _080708C4: bl sub_08078EFC cmp r0, #0 @@ -194,7 +194,7 @@ _08070902: beq _0807090C b _08070BE4 _0807090C: - bl sub_0807A1B8 + bl UpdateFloorType bl sub_08078EFC b _08070BE4 .align 2, 0 diff --git a/asm/non_matching/player/sub_08070DC4.inc b/asm/non_matching/player/sub_08070DC4.inc index 0b73a553..c7142c97 100644 --- a/asm/non_matching/player/sub_08070DC4.inc +++ b/asm/non_matching/player/sub_08070DC4.inc @@ -5,7 +5,7 @@ adds r0, r4, #0 bl sub_080085B0 bl sub_08079E08 - bl sub_0807A1B8 + bl UpdateFloorType bl sub_08078EFC cmp r0, #0 bne _08070E76 diff --git a/include/functions.h b/include/functions.h index 31402827..7c875323 100644 --- a/include/functions.h +++ b/include/functions.h @@ -147,7 +147,7 @@ extern void sub_08077728(); extern void sub_0807AEE4(); extern u32 sub_08078EFC(); extern void sub_0807921C(); -extern void sub_0807A1B8(); +extern void UpdateFloorType(); extern void sub_08079938(); extern void sub_0807ACCC(Entity*); extern void sub_080A2BE4(Entity*, u32); diff --git a/include/player.h b/include/player.h index be0e0987..943d7f5e 100644 --- a/include/player.h +++ b/include/player.h @@ -107,6 +107,54 @@ enum PlayerFlags { PL_USE_OCARINA = (1 << 28), }; +enum SurfaceType { + SURFACE_NORMAL, + SURFACE_PIT, + SURFACE_2, + SURFACE_3, + SURFACE_SLOPE_GNDGND_V, + SURFACE_SLOPE_GNDGND_H, + SURFACE_6, + SURFACE_7, + SURFACE_MINISH_DOOR_FRONT, + SURFACE_MINISH_DOOR_BACK, + SURFACE_A, + SURFACE_B, + SURFACE_SLOPE_GNDWATER, + SURFACE_D, + SURFACE_E, + SURFACE_F, + SURFACE_10, + SURFACE_11, + SURFACE_DOOR, + SURFACE_DOOR_13, + SURFACE_14, + SURFACE_CLONE_TILE, + SURFACE_16, + SURFACE_ICE, + SURFACE_SHALLOW_WATER, + SURFACE_WATER, + SURFACE_BUTTON, + SURFACE_1B, + SURFACE_1C, + SURFACE_1D, + SURFACE_LADDER, + SURFACE_1F, + SURFACE_20, + SURFACE_21, + SURFACE_22, + SURFACE_EDGE, + SURFACE_24, + SURFACE_DUST, + SURFACE_26, + SURFACE_HOLE, + SURFACE_LIGHT_GRADE, + SURFACE_29, + SURFACE_AUTO_LADDER, + SURFACE_CLIMB_WALL, + SURFACE_2C, +}; + typedef struct { /*0x00*/ u8 field_0x0[2]; /*0x02*/ u8 jumpStatus; @@ -121,32 +169,24 @@ typedef struct { /*0x0d*/ u8 field_0xd; /*0x0e*/ u8 field_0xe; /*0x0f*/ u8 hurtBlinkSpeed; - /*0x10*/ u8 field_0x10[4]; - /*0x11*/ u8 field_0x14; - /*0x11*/ u8 field_0x15; - /*0x14*/ u16 startPosX; - /*0x16*/ u16 startPosY; + /*0x10*/ u8 field_0x10; + /*0x11*/ u8 field_0x11; + /*0x12*/ u8 floor_type; + /*0x13*/ u8 floor_type_last; + /*0x14*/ u8 field_0x14; + /*0x15*/ u8 field_0x15; + /*0x16*/ u16 startPosX; + /*0x18*/ u16 startPosY; /*0x1a*/ u8 field_0x1a[2]; /*0x1c*/ u8 field_0x1c; - /*0x1d*/ u8 field_0x1d[5]; + /*0x1d*/ u8 field_0x1d; + /*0x1e*/ u8 dash_state; + /*0x1f*/ u8 field_0x1f[3]; /*0x22*/ u16 field_0x22[2]; /*0x26*/ u8 swimState; /*0x27*/ u8 field_0x27[5]; - /*0x2c*/ u8* field_0x2c; + /*0x2c*/ Entity* item; /*0x30*/ u32 flags; - /* unk1 : 1; */ - /* unk2 : 1; */ - /* unk4 : 1; */ - /* noMinishCap : 1; */ - /* pullingState : 1; */ - /* windyState : 1; */ - /* filler6 : 1; */ - /* unk7 : 1; */ - /* unk8 : 1; */ - /* unk9 : 1; */ - /* slipperyState : 1; */ - /* filler11 : 5; */ - /* filler11b : 16; */ /*0x34*/ u8 field_0x34[2]; /*0x36*/ s16 field_0x36; /*0x38*/ u8 field_0x38; @@ -162,7 +202,8 @@ typedef struct { /*0x80*/ u16 field_0x80; /*0x82*/ u8 field_0x82[9]; /*0x8b*/ u8 controlMode; - /*0x8c*/ u32 field_0x8c; + /*0x8c*/ u16 vel_x; + /*0x8e*/ u16 vel_y; /*0x90*/ union SplitWord field_0x90; /*0x94*/ u32 field_0x94; /*0x98*/ u16 field_0x98; diff --git a/src/code_08077B98.c b/src/code_08077B98.c index eb3dcd88..ca1863f7 100644 --- a/src/code_08077B98.c +++ b/src/code_08077B98.c @@ -18,18 +18,18 @@ extern Entity* sub_0805E744(); extern struct_0811BE48 gUnk_0811BE48[]; void sub_08077B98(UnkItemStruct* unk) { - if ((gPlayerState.field_0x2c == NULL) || (gPlayerState.field_0x2c[9] != 1)) { - gPlayerState.field_0x2c = sub_08077C54(unk); + if ((gPlayerState.item == NULL) || (gPlayerState.item->id != 1)) { + gPlayerState.item = sub_08077C54(unk); } } void sub_08077BB8(ItemBehavior* beh) { UnkItemStruct* unk = (UnkItemStruct*)beh; // @nocheckin - u8* temp = sub_08077C54(unk); + Entity* temp = sub_08077C54(unk); if (temp != NULL) { - temp[0x10] = 0x20; + temp->flags = 0x20; } - gPlayerState.field_0x2c = temp; + gPlayerState.item = temp; } Entity* sub_08077BD4(ItemBehavior* beh) { @@ -164,11 +164,11 @@ void sub_08077E78(ItemBehavior* arg0, u32 bits) { u32 not ; if (bits == 0) { - if (gPlayerState.field_0x2c != NULL) { - ((Unk_bitfield*)gPlayerState.field_0x2c)[0x11].b0 = 6; - gPlayerState.field_0x2c = (u8*)bits; + if (gPlayerState.item != NULL) { + ((Unk_bitfield*)gPlayerState.item)[0x11].b0 = 6; + gPlayerState.item = NULL; } else { - gPlayerState.field_0x2c = (u8*)bits; + gPlayerState.item = NULL; } } diff --git a/src/collision.c b/src/collision.c index cadaf421..3dac2783 100644 --- a/src/collision.c +++ b/src/collision.c @@ -359,7 +359,7 @@ s32 CollisionGroundItem(Entity* org, Entity* tgt, u32 direction, ColSettings* se } s32 sub_08017B1C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { - if ((gPlayerState.field_0x1d[1] & 0x60) != 0) { + if ((gPlayerState.dash_state & 0x60) != 0) { COLLISION_OFF(tgt); } else { org->knockbackDuration = 0x10; @@ -372,7 +372,7 @@ s32 sub_08017B1C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) s32 sub_08017B58(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { if ((tgt->field_0x3a & 4) != 0) { if (tgt->field_0x1d) { - s32 x = tgt->field_0x1d = tgt->field_0x1d - gPlayerState.field_0x1d[0]; + s32 x = tgt->field_0x1d = tgt->field_0x1d - gPlayerState.field_0x1d; if (x << 24 <= 0) { tgt->field_0x1d = 0; tgt->subAction = 2; diff --git a/src/coord.c b/src/coord.c index 7bad978a..e982aa9d 100644 --- a/src/coord.c +++ b/src/coord.c @@ -62,7 +62,7 @@ u32 sub_0806F3E4(Entity* ent) { if ((gPlayerState.field_0x1c & 0x7F) != 1) return 0; - switch (gPlayerState.field_0x1d[0]) { + switch (gPlayerState.field_0x1d) { case 1: ent->field_0x46 += 64; break; @@ -93,7 +93,7 @@ u32 sub_0806F3E4(Entity* ent) { } SoundReq(SFX_ED); } else if (state == 1) { - gPlayerState.field_0x2c[10] = 1; + gPlayerState.item->type = 1; SoundReq(SFX_EF); } return 1; diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c index 1b2f96e2..25fb3dba 100644 --- a/src/enemy/vaatiWrath.c +++ b/src/enemy/vaatiWrath.c @@ -1001,7 +1001,7 @@ void VaatiWrathType0PreAction(Entity* this) { temp = gPlayerState.framestate_last; if (temp < 2) { if (temp >= 0) { - if (gPlayerState.field_0x2c == NULL) { + if (gPlayerState.item == NULL) { if (gPlayerEntity.field_0x7a.HWORD == 0) { if ((gPlayerEntity.z.HALF.HI & 0x8000U) == 0 || (gPlayerState.field_0xa != 0)) { CreateEzloHint(0xb70, 0); diff --git a/src/item/itemBow.c b/src/item/itemBow.c index 9a4e5e89..c4c29947 100644 --- a/src/item/itemBow.c +++ b/src/item/itemBow.c @@ -16,7 +16,7 @@ void sub_08075DF4(ItemBehavior* this, u32 arg1) { sub_0806F948(&gPlayerEntity); sub_08077BB8(this); sub_08077D38(this, arg1); - gPlayerState.field_0x1d[4] = 1; + gPlayerState.field_0x1f[2] = 1; } else { sub_08077E78(this, arg1); } @@ -25,7 +25,7 @@ void sub_08075DF4(ItemBehavior* this, u32 arg1) { void sub_08075E40(ItemBehavior* this, u32 arg1) { u8 bVar1; - if (gPlayerState.field_0x1d[4] != 0) { + if (gPlayerState.field_0x1f[2] != 0) { bVar1 = gPlayerState.field_0x3[1] & 0x80; if (bVar1 == 0) { UpdateItemAnim(this); @@ -40,7 +40,7 @@ void sub_08075E40(ItemBehavior* this, u32 arg1) { return; } } - gPlayerState.field_0x1d[4] = 0; + gPlayerState.field_0x1f[2] = 0; sub_08077E78(this, arg1); } @@ -51,8 +51,8 @@ void sub_08075EC0(ItemBehavior* this, u32 arg1) { arrowCount = gSave.stats.arrowCount; iVar2 = sub_08077EFC(this); if (iVar2 != 0 && arrowCount != 0) { - if (((gPlayerState.field_0x3[1] & 0x80) != 0) || (gPlayerState.field_0x1d[4] == 0)) { - gPlayerState.field_0x1d[4] = 0; + if (((gPlayerState.field_0x3[1] & 0x80) != 0) || (gPlayerState.field_0x1f[2] == 0)) { + gPlayerState.field_0x1f[2] = 0; sub_08077E78(this, arg1); } } else { @@ -65,19 +65,19 @@ void sub_08075EC0(ItemBehavior* this, u32 arg1) { } void sub_08075F38(ItemBehavior* this, u32 arg1) { - if (((gPlayerState.field_0x3[1] & 0x80) == 0) && (gPlayerState.field_0x1d[4] != 0)) { + if (((gPlayerState.field_0x3[1] & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) { UpdateItemAnim(this); if ((this->field_0x5[9] & 1) != 0) { this->stateID = 4; } } else { - gPlayerState.field_0x1d[4] = 0; + gPlayerState.field_0x1f[2] = 0; sub_08077E78(this, arg1); } } void sub_08075F84(ItemBehavior* this, u32 arg1) { - if (((gPlayerState.field_0x3[1] & 0x80) == 0) && (gPlayerState.field_0x1d[4] != 0)) { + if (((gPlayerState.field_0x3[1] & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) { if (GetInventoryValue(0x70) == 1) { sub_08077E3C(this, 5); } else { @@ -87,6 +87,6 @@ void sub_08075F84(ItemBehavior* this, u32 arg1) { return; } } - gPlayerState.field_0x1d[4] = 0; + gPlayerState.field_0x1f[2] = 0; sub_08077E78(this, arg1); } diff --git a/src/item/itemLantern.c b/src/item/itemLantern.c index acb3a728..2903b2de 100644 --- a/src/item/itemLantern.c +++ b/src/item/itemLantern.c @@ -21,7 +21,7 @@ void sub_08075A0C(ItemBehavior* this, u32 arg1) { s8* tmp; itemSlot = IsItemEquipped(this->behaviorID); if (gPlayerState.heldObject != 0 || gPlayerState.playerAction == 0x18 || gPlayerState.jumpStatus != 0 || - gPlayerState.field_0x2c != NULL || (gPlayerState.flags & PL_MINISH) != 0) { + gPlayerState.item != NULL || (gPlayerState.flags & PL_MINISH) != 0) { ForceEquipItem(0xf, itemSlot); gPlayerState.flags &= 0xff7fffff; ForceEquipItem(0xf, itemSlot); @@ -50,7 +50,7 @@ ASM_FUNC("asm/non_matching/eu/sub_08075ADC.inc", void sub_08075ADC(ItemBehavior* void sub_08075ADC(ItemBehavior* this, u32 arg1) { u32 bVar1; - if (gPlayerState.field_0x2c != NULL || (this->field_0x5[9] & 1) == 0 || (gPlayerState.flags & 0x110) != 0 || + if (gPlayerState.item != NULL || (this->field_0x5[9] & 1) == 0 || (gPlayerState.flags & 0x110) != 0 || sub_08079D48() == 0) { this->field_0xf = 0; this->stateID += 1; diff --git a/src/item/itemPegasusBoots.c b/src/item/itemPegasusBoots.c index e2d9a268..a12e31f3 100644 --- a/src/item/itemPegasusBoots.c +++ b/src/item/itemPegasusBoots.c @@ -14,7 +14,7 @@ void ItemPegasusBoots(ItemBehavior* this, u32 arg1) { u32 uVar4; if (gPlayerEntity.field_0x7a.HWORD != 0) { - gPlayerState.field_0x1d[1] = 0; + gPlayerState.dash_state = 0; gPlayerState.field_0xe = 0; sub_08077E78(this, arg1); } else { @@ -24,7 +24,7 @@ void ItemPegasusBoots(ItemBehavior* this, u32 arg1) { SoundReq(SFX_PLY_LAND); } if (((gPlayerState.flags & PL_MINISH) == 0) && ((this->field_0x5[2] & 7) == 0)) { - if (gPlayerState.field_0x10[2] == 0x11) { + if (gPlayerState.floor_type == SURFACE_11) { if (gPlayerEntity.spriteOffsetY == 0) { CreateFx(&gPlayerEntity, FX_GREEN_SPLASH, 0); } @@ -56,8 +56,8 @@ void sub_080768F8(ItemBehavior* this, u32 arg1) { bVar2 = (gPlayerState.flags & 0x1000); bVar1 |= bVar2; if (bVar1 == 0) { - gPlayerState.field_0x1d[1] = 1; - gPlayerState.field_0x1d[4] = bVar1; + gPlayerState.dash_state = 1; + gPlayerState.field_0x1f[2] = bVar1; if ((gPlayerState.flags & PL_MINISH) == 0) { this->field_0x5[2] = 0x10; } else { @@ -66,7 +66,7 @@ void sub_080768F8(ItemBehavior* this, u32 arg1) { sub_08077D38(this, arg1); sub_08076964(this, arg1); } else { - gPlayerState.field_0x1d[1] = 0; + gPlayerState.dash_state = 0; gPlayerState.field_0xe = 0; sub_08077E78(this, arg1); } diff --git a/src/item/itemRocsCape.c b/src/item/itemRocsCape.c index dd4c69bd..a24967e9 100644 --- a/src/item/itemRocsCape.c +++ b/src/item/itemRocsCape.c @@ -12,7 +12,7 @@ extern bool32 sub_08077EFC(ItemBehavior*); sub_08076758(this, arg1); return; } - if (gPlayerState.field_0x2c == NULL) { + if (gPlayerState.item == NULL) { if (gPlayerState.field_0x0[1] == 0) { if (((u8)(gPlayerState.field_0x1a[1] | gPlayerState.field_0xa | gPlayerState.field_0x3[1] | gPlayerState.heldObject | gPlayerState.field_0x1c | gPlayerState.field_0x3c[1]) == 0) && @@ -24,7 +24,7 @@ extern bool32 sub_08077EFC(ItemBehavior*); if (-1 < gPlayerEntity.z.WORD) { gPlayerEntity.zVelocity = 0x20000; gPlayerState.jumpStatus = 1; - gPlayerState.field_0x2c = NULL; + gPlayerState.item = NULL; this->stateID += 1; goto _0807673C; } @@ -44,7 +44,7 @@ extern bool32 sub_08077EFC(ItemBehavior*); gPlayerState.keepFacing = 0; gPlayerState.jumpStatus = 1; gPlayerState.field_0xe = -1; - gPlayerState.field_0x2c = NULL; + gPlayerState.item = NULL; gPlayerEntity.zVelocity = 0x20000; _0807673C: sub_08077F84(); diff --git a/src/item/itemSword.c b/src/item/itemSword.c index 47dc95ba..45441f72 100644 --- a/src/item/itemSword.c +++ b/src/item/itemSword.c @@ -27,7 +27,7 @@ void sub_08075580(ItemBehavior* this, u32 arg1) { if ((sub_08077EFC(this) != 0) && (gPlayerState.jumpStatus == 0)) { gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> arg1); gPlayerState.field_0x1a[1] = 1; - gPlayerState.field_0x2c[0x40] = 0xd; + gPlayerState.item->hurtType = 0xd; this->field_0xf = 0; this->stateID = 2; if ((gPlayerState.field_0xac & 0x200) != 0) { @@ -126,6 +126,6 @@ void sub_080759B8(ItemBehavior* this, u32 arg1) { } gPlayerState.flags &= 0xf7ffffff; gPlayerState.field_0x1a[1] = 0; - gPlayerState.field_0x2c = NULL; + gPlayerState.item = NULL; sub_08077E78(this, arg1); } diff --git a/src/manager/manager15.c b/src/manager/manager15.c index 5289a511..b73beba0 100644 --- a/src/manager/manager15.c +++ b/src/manager/manager15.c @@ -296,7 +296,7 @@ void sub_0805A758(Manager15* this) { } void sub_0805A76C(Manager15* this) { - if ((gPlayerEntity.health != 0) && (gPlayerEntity.z.HALF.HI == 0) && (!gPlayerState.field_0x2c)) { + if ((gPlayerEntity.health != 0) && (gPlayerEntity.z.HALF.HI == 0) && (!gPlayerState.item)) { switch (gPlayerState.framestate_last) { case PL_STATE_IDLE: case PL_STATE_WALK: diff --git a/src/manager/manager6.c b/src/manager/manager6.c index dfacaf3a..f412a208 100644 --- a/src/manager/manager6.c +++ b/src/manager/manager6.c @@ -14,7 +14,7 @@ void Manager6_Main(Manager6* this) { return; } } - if (this->manager.unk_0e == 0 || gPlayerState.field_0x10[2] == 0x1e) { + if (this->manager.unk_0e == 0 || gPlayerState.floor_type == SURFACE_LADDER) { for (i = this->warpList; i->posX != 0xFFFF; i++) { tmp = (i->unk_07.all & 0x3); if (((tmp & (gPlayerEntity.collisionLayer)) != 0) && diff --git a/src/npcUtils.c b/src/npcUtils.c index f1c8f1b8..a1dca14f 100644 --- a/src/npcUtils.c +++ b/src/npcUtils.c @@ -103,7 +103,7 @@ Entity* CreateNPC(u32 subtype, u32 form, u32 parameter) { u32 sub_0806ED78(Entity* ent) { u32 result = sub_0800445C(ent); if (result) { - if (gPlayerState.field_0x1d[1] & 0x40) { + if (gPlayerState.dash_state & 0x40) { sub_08077B20(); } } diff --git a/src/object/furniture.c b/src/object/furniture.c index a4d003bd..6429e776 100644 --- a/src/object/furniture.c +++ b/src/object/furniture.c @@ -282,7 +282,7 @@ static void FurnitureUpdate(FurnitureEntity* this) { break; case 0x80: if (gPlayerEntity.y.HALF.HI < super->y.HALF.HI + 8) { - if (gPlayerState.field_0x10[2] != 30 && GetTileTypeByEntity(super) == 0x4017) { + if (gPlayerState.floor_type != SURFACE_LADDER && GetTileTypeByEntity(super) == 0x4017) { SetTile(0x4026, this->tile, super->collisionLayer); SetTile(0x403D, this->tile - 64, super->collisionLayer); SetTile(0x403D, this->tile - 128, super->collisionLayer); diff --git a/src/overworld.c b/src/overworld.c index c087776c..997ce29d 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -666,7 +666,7 @@ u32 sub_08052B24(void) { gUnk_0200AF00.filler0[1]) return 0; - if ((gPlayerState.flags & 0x118) || (gPlayerState.framestate_last > tmp) || gPlayerState.field_0x2c || + if ((gPlayerState.flags & 0x118) || (gPlayerState.framestate_last > tmp) || gPlayerState.item || gPlayerEntity.field_0x7a.HWORD) return 0; diff --git a/src/player.c b/src/player.c index 2b3f8371..455f018c 100644 --- a/src/player.c +++ b/src/player.c @@ -54,12 +54,12 @@ static EntityAction PlayerUseEntrance; EntityAction PlayerParachute; // PLAYER_FALL -static EntityAction sub_08070C3C; -static EntityAction sub_08070CB4; +static EntityAction PlayerFallInit; +static EntityAction PlayerFallUpdate; // PLAYER_BOUNCE -static EntityAction sub_08070D38; -static EntityAction sub_08070DC4; +static EntityAction PlayerBounceInit; +static EntityAction PlayerBounceUpdate; static EntityAction sub_08070E7C; // PLAYER_08070E9C @@ -67,17 +67,17 @@ static EntityAction sub_08070EDC; static EntityAction sub_08070f24; // PLAYER_ITEMGET -static EntityAction sub_08070FA4; -static EntityAction sub_08071020; +static EntityAction PlayerItemGetInit; +static EntityAction PlayerItemGetUpdate; static EntityAction sub_08071038; // PLAYER_JUMP -static EntityAction sub_080710A8; +static EntityAction PlayerJumpInit; static EntityAction sub_08071130; static EntityAction sub_08071208; // PLAYER_DROWN -static EntityAction sub_0807127C; +static EntityAction PlayerDrownInit; static EntityAction sub_080712F0; // PLAYER_USEPORTAL @@ -91,18 +91,18 @@ static EntityAction PortalEnterUpdate; static EntityAction PortalUnknownUpdate; // PLAYER_TALKEZLO -static EntityAction sub_080718A0; +static EntityAction PlayerTalkEzloInit; static EntityAction sub_0807193C; static EntityAction sub_08071990; static EntityAction sub_08071A4C; // PLAYER_PUSH -static EntityAction sub_08071AB0; -static EntityAction sub_08071AF0; +static EntityAction PlayerPushInit; +static EntityAction PlayerPushUpdate; static EntityAction sub_08071B60; // PLAYER_MINISHDIE -static EntityAction sub_08071BDC; +static EntityAction PlayerMinishDieInit; static EntityAction sub_08071CAC; static EntityAction sub_08071D04; static EntityAction sub_08071D80; @@ -113,12 +113,12 @@ static EntityAction sub_08071E04; static EntityAction sub_08071E74; // PLAYER_EMPTYBOTTLE -static EntityAction sub_08071EB0; -static EntityAction sub_08071F14; +static EntityAction PlayerEmptyBottleInit; +static EntityAction PlayerEmptyBottleUpdate; // PLAYER_FROZEN -static EntityAction sub_08071F50; -static EntityAction sub_08071F80; +static EntityAction PlayerFrozenInit; +static EntityAction PlayerFrozenUpdate; // PLAYER_0807204C static EntityAction sub_08072064; @@ -133,7 +133,7 @@ static EntityAction sub_08072214; static EntityAction sub_08072260; // PLAYER_LAVA -static EntityAction sub_080722DC; +static EntityAction PlayerLavaInit; static EntityAction sub_08072354; static EntityAction sub_080723D0; static EntityAction sub_0807240C; @@ -147,12 +147,12 @@ static EntityAction sub_080724DC; static EntityAction sub_0807258C; // PLAYER_ROLL -static EntityAction sub_08072650; -static EntityAction sub_080726F4; +static EntityAction PlayerRollInit; +static EntityAction PlayerRollUpdate; // PLAYER_INHOLE -static EntityAction sub_08072970; -static EntityAction sub_08072A60; +static EntityAction PlayerInHoleInit; +static EntityAction PlayerInHoleUpdate; static EntityAction sub_08072ACC; static EntityAction sub_08072B5C; static EntityAction sub_08072C48; @@ -280,7 +280,7 @@ static void PlayerInit(Entity* this) { if (sub_08078EFC() == 0) { sub_0807921C(); - sub_0807A1B8(); + UpdateFloorType(); if (gPlayerState.swimState != 0) { Entity* ent; gPlayerState.swimState = 1; @@ -310,8 +310,8 @@ static void sub_08070BEC(Entity* this, u32 r0) { static void PlayerFall(Entity* this) { static EntityAction* const sPlayerFallStates[] = { - sub_08070C3C, - sub_08070CB4, + PlayerFallInit, + PlayerFallUpdate, }; gPlayerState.field_0xd = 0xFF; @@ -321,7 +321,7 @@ static void PlayerFall(Entity* this) { sPlayerFallStates[this->subAction](this); } -static void sub_08070C3C(Entity* this) { +static void PlayerFallInit(Entity* this) { sub_08004168(this); gPlayerState.flags |= PL_BUSY | PL_DROWNING; @@ -345,7 +345,7 @@ static void sub_08070C3C(Entity* this) { SoundReq(SFX_FALL_HOLE); } -static void sub_08070CB4(Entity* this) { +static void PlayerFallUpdate(Entity* this) { UpdateAnimationSingleFrame(this); if ((this->frame & 0x80) != 0) { if ((gSave.stats.health != 0) && ((gPlayerState.flags & 0x8000) != 0)) { @@ -363,14 +363,14 @@ static void sub_08070CB4(Entity* this) { static void PlayerBounce(Entity* this) { static EntityAction* const sPlayerBounceStates[] = { - sub_08070D38, - sub_08070DC4, + PlayerBounceInit, + PlayerBounceUpdate, sub_08070E7C, }; sPlayerBounceStates[this->subAction](this); } -static void sub_08070D38(Entity* this) { +static void PlayerBounceInit(Entity* this) { COLLISION_OFF(this); this->direction = DirectionTurnAround(Direction8FromAnimationState(AnimationStateWalk(this->animationState))); this->speed = 0x100; @@ -395,11 +395,11 @@ static void sub_08070D38(Entity* this) { } // minor regalloc -static NONMATCH("asm/non_matching/player/sub_08070DC4.inc", void sub_08070DC4(Entity* this)) { +static NONMATCH("asm/non_matching/player/sub_08070DC4.inc", void PlayerBounceUpdate(Entity* this)) { UpdateAnimationSingleFrame(this); sub_080085B0(this); sub_08079E08(); - sub_0807A1B8(); + UpdateFloorType(); if (sub_08078EFC() || sub_08003FC4(this, 0x2000)) return; @@ -423,7 +423,7 @@ static NONMATCH("asm/non_matching/player/sub_08070DC4.inc", void sub_08070DC4(En COLLISION_ON(this); if ((gPlayerState.field_0x14 == 0) && sub_08008B22()) { - gPlayerState.field_0x10[1] = 7; + gPlayerState.field_0x11 = 7; sub_08079938(); sub_080791BC(); return; @@ -456,7 +456,7 @@ static void sub_08070E9C(Entity* this) { } else { gPlayerState.field_0x27[0] = 4; gPlayerState.framestate = PL_STATE_TALKEZLO; - sub_0807A1B8(); + UpdateFloorType(); gUnk_0811BA74[this->subAction](this); } } @@ -483,8 +483,8 @@ static void sub_08070f24(Entity* this) { static void PlayerItemGet(Entity* this) { static EntityAction* const sPlayerItemGetStates[] = { - sub_08070FA4, - sub_08071020, + PlayerItemGetInit, + PlayerItemGetUpdate, sub_08071038, }; @@ -504,7 +504,7 @@ static void PlayerItemGet(Entity* this) { } } -static void sub_08070FA4(Entity* this) { +static void PlayerItemGetInit(Entity* this) { this->spriteSettings.flipX = FALSE; this->animationState = IdleSouth; @@ -534,9 +534,9 @@ static void sub_08070FA4(Entity* this) { sub_08078F60(); } -static void sub_08071020(Entity* this) { +static void PlayerItemGetUpdate(Entity* this) { UpdateAnimationSingleFrame(this); - if (this->frame != 0) + if (this->frame != /* entire animation is a static frame */ 0) this->subAction = 2; } @@ -557,7 +557,7 @@ static void sub_08071038(Entity* this) { static void PlayerJump(Entity* this) { static EntityAction* const sPlayerJumpStates[] = { - sub_080710A8, + PlayerJumpInit, sub_08071130, sub_08071208, }; @@ -566,7 +566,7 @@ static void PlayerJump(Entity* this) { sPlayerJumpStates[this->subAction](this); } -static void sub_080710A8(Entity* this) { +static void PlayerJumpInit(Entity* this) { u32 temp; this->subAction++; @@ -588,7 +588,7 @@ static void sub_080710A8(Entity* this) { } } - gPlayerState.field_0x1d[1] = 0; + gPlayerState.dash_state = 0; this->direction = Direction8FromAnimationState(AnimationStateWalk(this->animationState)); temp = sub_08079FC4(1); @@ -629,7 +629,7 @@ static void sub_08071130(Entity* this) { if (gPlayerState.field_0x14) return; - sub_0807A1B8(); + UpdateFloorType(); if (sub_08078EFC()) return; @@ -672,7 +672,7 @@ static void sub_08071208(Entity* this) { static void PlayerDrown(Entity* this) { static EntityAction* const sPlayerDrownStates[] = { - sub_0807127C, + PlayerDrownInit, sub_080712F0, }; @@ -682,7 +682,7 @@ static void PlayerDrown(Entity* this) { sPlayerDrownStates[this->subAction](this); } -static void sub_0807127C(Entity* this) { +static void PlayerDrownInit(Entity* this) { this->subAction = 1; this->spritePriority.b1 = 0; @@ -934,7 +934,7 @@ static void sub_080717F8(Entity* this) { static void PlayerTalkEzlo(Entity* this) { static EntityAction* const sPlayerTalkEzloStates[] = { - sub_080718A0, + PlayerTalkEzloInit, sub_0807193C, sub_08071990, sub_08071A4C, @@ -950,7 +950,7 @@ static void PlayerTalkEzlo(Entity* this) { } } -static void sub_080718A0(Entity* this) { +static void PlayerTalkEzloInit(Entity* this) { ResetPlayer(); gUnk_03000B80.filler[0x63] = 0; this->iframes = 0; @@ -1053,8 +1053,8 @@ static void ResetPlayerPriority(void) { static void PlayerPush(Entity* this) { static EntityAction* const sPlayerPushStates[] = { - sub_08071AB0, - sub_08071AF0, + PlayerPushInit, + PlayerPushUpdate, sub_08071B60, }; @@ -1062,7 +1062,7 @@ static void PlayerPush(Entity* this) { sPlayerPushStates[this->subAction](this); } -static void sub_08071AB0(Entity* this) { +static void PlayerPushInit(Entity* this) { u32 speed; this->subAction++; @@ -1074,10 +1074,10 @@ static void sub_08071AB0(Entity* this) { } else { this->speed = (gPlayerState.flags & PL_MINISH) ? 64 : 128; } - sub_08071AF0(this); + PlayerPushUpdate(this); } -static void sub_08071AF0(Entity* this) { +static void PlayerPushUpdate(Entity* this) { typedef struct { u8 frame; u16 speed; @@ -1125,7 +1125,7 @@ static void sub_08071B60(Entity* this) { static void PlayerMinishDie(Entity* this) { static EntityAction* const sPlayerMinishDieStates[] = { - sub_08071BDC, + PlayerMinishDieInit, sub_08071CAC, sub_08071D04, sub_08071D80, @@ -1136,7 +1136,7 @@ static void PlayerMinishDie(Entity* this) { gPlayerState.framestate = PL_STATE_DIE; } -static void sub_08071BDC(Entity* this) { +static void PlayerMinishDieInit(Entity* this) { u32 temp; if (gPlayerState.flags & (0x10 | 0x100)) @@ -1152,7 +1152,8 @@ static void sub_08071BDC(Entity* this) { gPlayerState.playerAction = 0; if (gPlayerState.flags & PL_MINISH) { - if ((u8)(gPlayerState.field_0x10[2] - 8) < 3) { + if (gPlayerState.floor_type == SURFACE_MINISH_DOOR_FRONT || + gPlayerState.floor_type == SURFACE_MINISH_DOOR_BACK || gPlayerState.floor_type == SURFACE_A) { sub_0807A298(this); RespawnPlayer(); this->action = 10; @@ -1258,9 +1259,9 @@ static void sub_08071DD0(Entity* this) { static void sub_08071E04(Entity* this) { if ((this->z.WORD != 0) && (gPlayerState.field_0x14 == '\0')) { - sub_0807A1B8(); - if (gPlayerState.field_0x10[2] == 1) { - gPlayerState.field_0x10[1] = 7; + UpdateFloorType(); + if (gPlayerState.floor_type == SURFACE_PIT) { + gPlayerState.field_0x11 = 7; gPlayerState.flags |= 0x200; sub_080791BC(); return; @@ -1295,14 +1296,14 @@ static void sub_08071E74(Entity* this) { static void PlayerEmptyBottle(Entity* this) { static EntityAction* const sPlayerEmptyBottleStates[] = { - sub_08071EB0, - sub_08071F14, + PlayerEmptyBottleInit, + PlayerEmptyBottleUpdate, }; sPlayerEmptyBottleStates[this->subAction](this); } -static void sub_08071EB0(Entity* this) { +static void PlayerEmptyBottleInit(Entity* this) { Entity* ent; ResetPlayer(); @@ -1325,24 +1326,24 @@ static void sub_08071EB0(Entity* this) { } } -static void sub_08071F14(Entity* this) { +static void PlayerEmptyBottleUpdate(Entity* this) { UpdateAnimationSingleFrame(this); if (this->frame & 0x80) { - gPlayerState.field_0x2c = NULL; + gPlayerState.item = NULL; sub_0807921C(); } } static void PlayerFrozen(Entity* this) { static EntityAction* const sPlayerFrozenStates[] = { - sub_08071F50, - sub_08071F80, + PlayerFrozenInit, + PlayerFrozenUpdate, }; sPlayerFrozenStates[this->subAction](this); } -static void sub_08071F50(Entity* this) { +static void PlayerFrozenInit(Entity* this) { COLLISION_OFF(this); this->actionDelay = 120; this->subAction++; @@ -1351,7 +1352,7 @@ static void sub_08071F50(Entity* this) { SoundReq(SFX_195); } -static void sub_08071F80(Entity* this) { +static void PlayerFrozenUpdate(Entity* this) { if (sub_08003FC4(this, 0x2000) == 0) { UpdateSpriteForCollisionLayer(this); gPlayerState.jumpStatus = 0; @@ -1515,7 +1516,7 @@ static void sub_08072260(Entity* this) { static void PlayerLava(Entity* this) { static EntityAction* const sPlayerLavaStates[] = { - sub_080722DC, + PlayerLavaInit, sub_08072354, sub_080723D0, sub_0807240C, @@ -1525,7 +1526,7 @@ static void PlayerLava(Entity* this) { sPlayerLavaStates[this->subAction](this); } -static void sub_080722DC(Entity* this) { +static void PlayerLavaInit(Entity* this) { Entity* ent; COLLISION_OFF(this); @@ -1674,15 +1675,15 @@ static void sub_0807258C(Entity* this) { static void PlayerRoll(Entity* this) { static EntityAction* const sPlayerRollStates[] = { - sub_08072650, - sub_080726F4, + PlayerRollInit, + PlayerRollUpdate, }; gPlayerState.framestate = PL_STATE_ROLL; sPlayerRollStates[this->subAction](this); } -static void sub_08072650(Entity* this) { +static void PlayerRollInit(Entity* this) { u32 temp; if ((gPlayerState.flags & 0x200000) == 0) { @@ -1713,7 +1714,7 @@ static void sub_08072650(Entity* this) { SoundReq(SFX_7E); } -static void sub_080726F4(Entity* this) { +static void PlayerRollUpdate(Entity* this) { if (((gPlayerState.flags & (PL_ROLLING | 0x80000)) != PL_ROLLING) || (!(gPlayerState.flags & 0x200000) && (this->iframes != 0) && (this->bitfield & 0x80))) { gPlayerState.flags &= ~PL_ROLLING; @@ -1728,7 +1729,7 @@ static void sub_080726F4(Entity* this) { this->actionDelay = 4; } if ((gPlayerState.flags & 2) == 0) { - sub_0807A1B8(); + UpdateFloorType(); } if (sub_08078EFC()) { gPlayerState.flags &= ~PL_ROLLING; @@ -1750,7 +1751,8 @@ static void sub_080726F4(Entity* this) { return; } - if (gPlayerState.field_0x10[2] == 0x17) { + if (gPlayerState.floor_type == SURFACE_ICE) { + // roll in place when on ice sub_0800892E(this); } else { switch (this->frame & 0xf) { @@ -1773,7 +1775,8 @@ static void sub_080726F4(Entity* this) { sub_08079E08(); } if (((this->frame & 0x10) == 0) && ((gPlayerState.flags & PL_MINISH) == 0)) { - *(u8*)&this->hurtType = 0; + // dont take damage + this->hurtType = 0; } if ((this->frame & 0x40) != 0) { sub_08077698(this); @@ -1796,31 +1799,31 @@ static void sub_080728AC(Entity* this) { if (gPlayerState.swimState != 0) this->speed = 0; - if (!(gPlayerState.flags & 0x40)) + if ((gPlayerState.flags & 0x40) == 0) gPlayerEntity.spriteSettings.draw = 3; - if (!(gPlayerState.flags & PL_MINISH)) + if ((gPlayerState.flags & PL_MINISH) == 0) gPlayerEntity.spritePriority.b1 = 1; - if (!(gRoomControls.unk6 & 4)) { - if ((gPlayerState.flags & 0x40)) + if ((gRoomControls.unk6 & 4) == 0) { + if (gPlayerState.flags & 0x40) COLLISION_ON(this); sub_080791D0(); } - if (!(gPlayerState.flags & 2)) { - sub_0807A1B8(); + if ((gPlayerState.flags & 2) == 0) { + UpdateFloorType(); } } static void PlayerInHole(Entity* this) { static EntityAction* const sPlayerInHoleStates[] = { - sub_08072970, sub_08072A60, sub_08072ACC, sub_08072B5C, sub_08072C48, + PlayerInHoleInit, PlayerInHoleUpdate, sub_08072ACC, sub_08072B5C, sub_08072C48, }; gPlayerState.framestate = PL_STATE_HOLE; sPlayerInHoleStates[this->subAction](this); } -static void sub_08072970(Entity* this) { +static void PlayerInHoleInit(Entity* this) { if (this->health != 0) { this->subAction = 1; this->x.HALF.HI = (this->x.HALF.HI & ~0xF) | 8; @@ -1840,12 +1843,12 @@ static void sub_08072970(Entity* this) { } SetTile(0x4070, COORD_TO_TILE(this), this->collisionLayer); ResetPlayer(); - sub_08072A60(this); + PlayerInHoleUpdate(this); SoundReq(0x81); } } -static void sub_08072A60(Entity* this) { +static void PlayerInHoleUpdate(Entity* this) { if (this->frame & 0x80) { if (this->actionDelay == 1) { this->subAction = 3; @@ -1932,7 +1935,7 @@ static void sub_08072C48(Entity* this) { sub_08008790(this, 7); if (gPlayerState.field_0x14) { if (sub_08008B22()) { - gPlayerState.field_0x10[1] = 7; + gPlayerState.field_0x11 = 7; if (!(gPlayerState.flags & PL_MINISH)) { sub_080791BC(); } @@ -2061,7 +2064,7 @@ static NONMATCH("asm/non_matching/player/sub_08072D54.inc", void sub_08072D54(En sub_08008790(this, 7); if (gPlayerState.field_0x14 != 0) { if (sub_08008B22() == 0) { - gPlayerState.field_0x10[1] = 7; + gPlayerState.field_0x11 = 7; if (!(gPlayerState.flags & PL_MINISH)) { sub_080791BC(); } @@ -2097,7 +2100,7 @@ static void sub_08072F34(Entity* this) { if (!sub_08078EFC()) { gPlayerState.framestate = PL_STATE_CLIMB; - gPlayerState.field_0x10[2] = GetSurfaceCalcType(this, 0, 0); + gPlayerState.floor_type = GetSurfaceCalcType(this, 0, 0); gUnk_0811BBE4[this->subAction](this); if (this->knockbackDuration != 0) { sub_080792D8(); @@ -2114,18 +2117,20 @@ static void sub_08072F34(Entity* this) { static void sub_08072F94(Entity* this) { u32 bVar1; - switch (gPlayerState.field_0x10[2]) { + switch (gPlayerState.floor_type) { default: sub_0807921C(); break; - case 0x1E: - case 0x2A ... 0x2C: + case SURFACE_LADDER: + case SURFACE_AUTO_LADDER: + case SURFACE_CLIMB_WALL: + case SURFACE_2C: this->spritePriority.b1 = 0; bVar1 = gPlayerState.field_0xd; if ((gPlayerState.field_0xd & 0x80) == 0) { this->direction = gPlayerState.field_0xd; if ((gPlayerState.field_0xd == 8) || (gPlayerState.field_0xd == 0x18)) { - if (gPlayerState.field_0x10[2] == 0x1e) { + if (gPlayerState.floor_type == SURFACE_LADDER) { return; } if ((this->frame & 0x10)) { @@ -2135,7 +2140,7 @@ static void sub_08072F94(Entity* this) { } sub_08073094(this); } else { - if ((gPlayerState.field_0x10[2] == 0x1e) && ((bVar1 & 7) != 0)) { + if ((gPlayerState.floor_type == SURFACE_LADDER) && ((bVar1 & 7) != 0)) { this->direction = (bVar1 + 8) & 0x10; } if (this->direction & 0x10) { @@ -2174,36 +2179,36 @@ static void sub_08073094(Entity* this) { sub_08079E08(); if (!sub_08019840()) { gPlayerState.pushedObject ^= 0x80; - if ((gPlayerState.field_0x10[2] != 0x2a) && (gPlayerState.field_0x10[2] != 0x2c)) { - sub_0807A1B8(); + if ((gPlayerState.floor_type != SURFACE_AUTO_LADDER) && (gPlayerState.floor_type != SURFACE_2C)) { + UpdateFloorType(); } if (sub_08078EFC() == 0) { - switch (gPlayerState.field_0x10[2]) { - case 0x2a: - case 0x2c: + switch (gPlayerState.floor_type) { + case SURFACE_AUTO_LADDER: + case SURFACE_2C: this->knockbackDuration = 0; gPlayerState.flags |= 0x20000000; UpdateAnimationSingleFrame(this); if ((this->frame & 0x40) != 0) { - sub_0807A1B8(); + UpdateFloorType(); if (!sub_08078EFC()) { this->subAction--; } } break; - case 0x19: + case SURFACE_WATER: sub_08074808(this); sub_080791D0(); break; default: sub_0807921C(); break; - case 0x1e: - case 0x2b: + case SURFACE_LADDER: + case SURFACE_CLIMB_WALL: UpdateAnimationSingleFrame(this); if ((this->frame & 0x40) != 0) { - sub_0807A1B8(); + UpdateFloorType(); if (!sub_08078EFC()) { this->subAction--; } diff --git a/src/playerItem/playerItem11.c b/src/playerItem/playerItem11.c index 7b0aaac2..242dc616 100644 --- a/src/playerItem/playerItem11.c +++ b/src/playerItem/playerItem11.c @@ -55,7 +55,7 @@ void sub_08018CBC(Entity* this) { this->spriteIndex = 0xa6; this->palette.raw = 0x33; this->spriteVramOffset = 0; - this->type = gPlayerState.field_0x1d[0] - 1; + this->type = gPlayerState.field_0x1d - 1; this->actionDelay = gUnk_080B3DE0[this->type * 2]; this->damage = gUnk_080B3DE0[this->type * 2 + 1]; this->hurtType = 0x1b; diff --git a/src/playerItem/playerItemC.c b/src/playerItem/playerItemC.c index d223b637..cc494f79 100644 --- a/src/playerItem/playerItemC.c +++ b/src/playerItem/playerItemC.c @@ -17,8 +17,8 @@ void PlayerItemC(Entity* this) { } void sub_0801B8B0(Entity* this) { - if (gPlayerState.field_0x1d[1] != 0) { - gPlayerState.field_0x2c = (u8*)this; + if (gPlayerState.dash_state != 0) { + gPlayerState.item = this; this->flags |= 0x20; this->action = 0x01; this->flags2 = 8; @@ -33,12 +33,12 @@ void sub_0801B8B0(Entity* this) { void sub_0801B8FC(Entity* this) { Entity* pbVar1; - pbVar1 = (Entity*)gPlayerState.field_0x2c; - if ((Entity*)gPlayerState.field_0x2c != this) { + pbVar1 = (Entity*)gPlayerState.item; + if ((Entity*)gPlayerState.item != this) { DeleteThisEntity(); } else { - if ((u8*)(u32)gPlayerState.field_0x1d[1] == NULL) { - gPlayerState.field_0x2c = (u8*)(u32)gPlayerState.field_0x1d[1]; + if (gPlayerState.dash_state == 0) { + gPlayerState.item = NULL; DeleteThisEntity(); } else { pbVar1->flags |= 0x80; diff --git a/src/playerItem/playerItemGustJar.c b/src/playerItem/playerItemGustJar.c index 119a884a..43e3bd74 100644 --- a/src/playerItem/playerItemGustJar.c +++ b/src/playerItem/playerItemGustJar.c @@ -10,7 +10,7 @@ void sub_080ADC84(Entity*); void sub_080ADCA0(Entity*, u32); void PlayerItemGustJar(Entity* this) { - if (((Entity*)gPlayerState.field_0x2c != this) || (gPlayerState.field_0x1c == 0)) { + if (((Entity*)gPlayerState.item != this) || (gPlayerState.field_0x1c == 0)) { DeleteThisEntity(); } gUnk_08132700[this->action](this);