diff --git a/asm/code_0801C85C.s b/asm/code_0801C85C.s index 0c145b51..e4015df8 100644 --- a/asm/code_0801C85C.s +++ b/asm/code_0801C85C.s @@ -575,7 +575,7 @@ sub_0801CC80: @ 0x0801CC80 adds r0, r0, r1 ldrb r4, [r0] adds r0, r4, #0 - bl sub_080544C8 + bl ItemIsBottle cmp r0, #0 beq _0801CCA8 adds r0, r5, r4 diff --git a/asm/code_080526F8.s b/asm/code_080526F8.s index 52e84d20..ec44266e 100644 --- a/asm/code_080526F8.s +++ b/asm/code_080526F8.s @@ -3279,7 +3279,7 @@ _08054014: mov r8, r2 _08054018: adds r0, r6, #0 - bl sub_080544C8 + bl ItemIsBottle cmp r0, #0 bne _08054034 adds r0, r6, #0 diff --git a/asm/code_080732D0.s b/asm/code_080732D0.s index a2e22468..6b1dde5b 100644 --- a/asm/code_080732D0.s +++ b/asm/code_080732D0.s @@ -2323,7 +2323,7 @@ sub_0807441C: @ 0x0807441C adds r4, r6, #0 adds r4, #0xb4 ldrb r0, [r4] - bl sub_0805449C + bl ItemIsSword cmp r0, #0 beq _08074448 ldrb r0, [r4] diff --git a/asm/code_08077B98.s b/asm/code_08077B98.s index 75eb2a4b..972fafe0 100644 --- a/asm/code_08077B98.s +++ b/asm/code_08077B98.s @@ -29,13 +29,13 @@ sub_08078008: @ 0x08078008 adds r5, r6, #0 adds r5, #0xb4 ldrb r0, [r5] - bl sub_0805449C + bl ItemIsSword cmp r0, #0 bne _0807802C adds r5, r6, #0 adds r5, #0xb5 ldrb r0, [r5] - bl sub_0805449C + bl ItemIsSword movs r2, #0 cmp r0, #0 beq _0807802E diff --git a/asm/code_08078778.s b/asm/code_08078778.s index 0905212a..fb676371 100644 --- a/asm/code_08078778.s +++ b/asm/code_08078778.s @@ -3327,13 +3327,13 @@ sub_0807A158: @ 0x0807A158 adds r0, r4, #0 adds r0, #0xb4 ldrb r0, [r0] - bl sub_0805449C + bl ItemIsSword cmp r0, #0 bne _0807A17C adds r0, r4, #0 adds r0, #0xb5 ldrb r0, [r0] - bl sub_0805449C + bl ItemIsSword b _0807A17E .align 2, 0 _0807A178: .4byte gSave diff --git a/asm/non_matching/itemPegasusBoots/sub_08076964.inc b/asm/non_matching/itemPegasusBoots/sub_08076964.inc index ab565b3d..979d4f34 100644 --- a/asm/non_matching/itemPegasusBoots/sub_08076964.inc +++ b/asm/non_matching/itemPegasusBoots/sub_08076964.inc @@ -92,7 +92,7 @@ _080769CC: adds r4, r6, #0 adds r4, #0xb4 ldrb r0, [r4] - bl sub_0805449C + bl ItemIsSword cmp r0, #0 beq _08076A38 ldrb r1, [r4] diff --git a/src/code_08018C58.c b/src/code_08018C58.c index 14caf9cd..04d39a04 100644 --- a/src/code_08018C58.c +++ b/src/code_08018C58.c @@ -15,12 +15,10 @@ void CreateMinishEntrance(u32 tilePos) { } void sub_08018C58(u32 tilePos) { - u32 i = 0; + u32 i; - for (; i < 6;) { + for (i = 0; i < 6; i += 2, tilePos += 0x40) { SetTileType(0x260 + i, tilePos, 1); SetTileType(0x261 + i, tilePos + 1, 1); - i += 2; - tilePos += 0x40; } } diff --git a/src/code_0805436C.c b/src/code_0805436C.c index 2273aab3..c8a446c8 100644 --- a/src/code_0805436C.c +++ b/src/code_0805436C.c @@ -4,22 +4,14 @@ #include "menu.h" #include "area.h" #include "utils.h" - -typedef struct { - u8 filler[0xa8]; - Stats stats; -} SaveFile; +#include "structures.h" +#include "save.h" typedef struct { u8 unk; u8 filler[7]; } struct_080FD5B4; -typedef struct { - u8 filler[0x2e]; - u8 unk; -} ScreenTransition; - extern SaveFile gSave; extern struct_080FD5B4 gUnk_080FD5B4[]; extern ScreenTransition gScreenTransition; @@ -105,7 +97,7 @@ u32 SetBottleContents(u32 itemID, u32 bottleIndex) { return bottleIndex; } -u32 sub_0805449C(u32 arg0) { +u32 ItemIsSword(u32 arg0) { switch (arg0) { case 1: case 2: @@ -118,8 +110,8 @@ u32 sub_0805449C(u32 arg0) { } } -u32 sub_080544B4(u32 arg0) { - switch (arg0) { +u32 ItemIsShield(u32 id) { + switch (id) { case 13: case 14: return 1; @@ -128,8 +120,8 @@ u32 sub_080544B4(u32 arg0) { } } -u32 sub_080544C8(u32 arg0) { - switch (arg0) { +u32 ItemIsBottle(u32 id) { + switch (id) { case 28: case 29: case 30: @@ -140,14 +132,14 @@ u32 sub_080544C8(u32 arg0) { } } -u32 GetBottleContaining(u32 arg0) { - if (arg0 == gSave.stats.bottles[0]) { +u32 GetBottleContaining(u32 id) { + if (id == gSave.stats.bottles[0]) { return 1; - } else if (arg0 == gSave.stats.bottles[1]) { + } else if (id == gSave.stats.bottles[1]) { return 2; - } else if (arg0 == gSave.stats.bottles[2]) { + } else if (id == gSave.stats.bottles[2]) { return 3; - } else if (arg0 == gSave.stats.bottles[3]) { + } else if (id == gSave.stats.bottles[3]) { return 4; } else { return 0; @@ -160,7 +152,7 @@ NONMATCH("asm/non_matching/sub_08054524.inc", void sub_08054524(void)) { bVar1 = gArea.locationIndex; if (gArea.locationIndex == 0) { - bVar1 = gScreenTransition.unk; + bVar1 = gScreenTransition.field_0x24[0xa]; } if (bVar1 > 0x16) { bVar1 = 0; diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c index b6a5988f..6824d4eb 100644 --- a/src/enemy/likeLike.c +++ b/src/enemy/likeLike.c @@ -6,7 +6,7 @@ #include "createObject.h" #include "functions.h" -extern bool32 sub_080544B4(u32); +extern bool32 ItemIsShield(u32); void sub_0802810C(Entity*); void sub_080281A0(Entity*); @@ -241,11 +241,11 @@ void sub_080281A0(Entity* this) { bool32 sub_080281E0(u32 param_1) { bool32 ret = FALSE; if (GetInventoryValue(param_1) == 1) { - if (sub_080544B4(gSave.stats.itemOnA)) { + if (ItemIsShield(gSave.stats.itemOnA)) { gSave.stats.itemOnA = 0; } - if (sub_080544B4(gSave.stats.itemOnB)) { + if (ItemIsShield(gSave.stats.itemOnB)) { gSave.stats.itemOnB = 0; } diff --git a/src/item/itemPegasusBoots.c b/src/item/itemPegasusBoots.c index 9cd2ef72..54c3db73 100644 --- a/src/item/itemPegasusBoots.c +++ b/src/item/itemPegasusBoots.c @@ -17,7 +17,6 @@ void ItemPegasusBoots(ItemBehavior* this, u32 arg1) { gPlayerState.field_0x1d[1] = 0; gPlayerState.field_0xe = 0; sub_08077E78(this, arg1); - } else { bVar1 = this->field_0x5[2] - 1; this->field_0x5[2] = bVar1;