diff --git a/asm/battle_controller_player.s b/asm/battle_controller_player.s index d2f90b4bf..e12719153 100644 --- a/asm/battle_controller_player.s +++ b/asm/battle_controller_player.s @@ -385,7 +385,7 @@ _0805775A: bhi _080577E8 adds r0, r5, 0 movs r1, 0x1 - bl bag_add_item + bl AddBagItem _080577B2: movs r0, 0x5 bl PlaySE diff --git a/asm/battle_message.s b/asm/battle_message.s index 6447e8221..6bd3f6835 100644 --- a/asm/battle_message.s +++ b/asm/battle_message.s @@ -1664,13 +1664,13 @@ _0814F05C: _0814F064: ldrh r0, [r2] mov r1, sp - bl itemid_get_name + bl CopyItemName b _0814F5BE _0814F06E: ldr r0, =gUnknown_02024208 ldrh r0, [r0] mov r1, sp - bl itemid_get_name + bl CopyItemName b _0814F5BE .pool _0814F080: @@ -2631,12 +2631,12 @@ _0814F8BE: _0814F8CC: adds r0, r2, 0 adds r1, r6, 0 - bl itemid_get_name + bl CopyItemName b _0814F8DE _0814F8D6: adds r0, r2, 0 adds r1, r6, 0 - bl itemid_get_name + bl CopyItemName _0814F8DE: adds r5, 0x3 _0814F8E0: diff --git a/asm/berry.s b/asm/berry.s index 8894afef1..67f768ddf 100644 --- a/asm/berry.s +++ b/asm/berry.s @@ -991,7 +991,7 @@ FieldObjectInteractionPickBerryTree: @ 80E1CDC lsls r1, 24 lsrs r1, 24 adds r0, r4, 0 - bl bag_add_item + bl AddBagItem lsls r0, 24 lsrs r0, 24 strh r0, [r6] diff --git a/asm/berry_tag_screen.s b/asm/berry_tag_screen.s index e9c4da4cb..b03c56ed4 100644 --- a/asm/berry_tag_screen.s +++ b/asm/berry_tag_screen.s @@ -1222,7 +1222,7 @@ sub_81786AC: @ 81786AC lsls r1, r0, 16 lsrs r1, 16 movs r0, 0x4 - bl bag_pocket_get_itemid + bl BagGetItemIdByPocketPosition lsls r0, 16 cmp r0, 0 beq _08178718 @@ -1274,7 +1274,7 @@ sub_8178728: @ 8178728 lsls r1, 16 lsrs r1, 16 movs r0, 0x4 - bl bag_pocket_get_itemid + bl BagGetItemIdByPocketPosition lsls r0, 16 cmp r0, 0 bne _08178760 @@ -1308,7 +1308,7 @@ _0817877A: lsls r1, 16 lsrs r1, 16 movs r0, 0x4 - bl bag_pocket_get_itemid + bl BagGetItemIdByPocketPosition lsls r0, 16 lsrs r0, 16 bl ItemIdToBerryType diff --git a/asm/field_tasks.s b/asm/field_tasks.s index 0425a504d..5f9a49f94 100644 --- a/asm/field_tasks.s +++ b/asm/field_tasks.s @@ -1521,7 +1521,7 @@ _0809E456: movs r0, 0x87 lsls r0, 1 movs r1, 0x1 - bl sub_80D6724 + bl CheckBagHasItem lsls r0, 24 cmp r0, 0 beq _0809E47A diff --git a/asm/item.s b/asm/item.s index 4e5998573..1473ae180 100644 --- a/asm/item.s +++ b/asm/item.s @@ -6,246 +6,8 @@ .text - thumb_func_start itemid_get_name -@ void itemid_get_name(int item_id, char *dest) -itemid_get_name: @ 80D6644 - push {r4,lr} - adds r4, r1, 0 - lsls r0, 16 - lsrs r0, 16 - bl itemid_get_item - adds r1, r0, 0 - adds r0, r4, 0 - bl StringCopy - pop {r4} - pop {r0} - bx r0 - thumb_func_end itemid_get_name - - thumb_func_start sub_80D6660 -sub_80D6660: @ 80D6660 - push {r4,lr} - adds r4, r1, 0 - lsls r0, 16 - lsrs r3, r0, 16 - adds r1, r3, 0 - cmp r3, 0x4 - bne _080D668C - cmp r2, 0x1 - bhi _080D667C - movs r0, 0x4 - bl itemid_get_item - adds r1, r0, 0 - b _080D667E -_080D667C: - ldr r1, =gUnknown_085EFCD4 -_080D667E: - adds r0, r4, 0 - bl StringCopy - b _080D66BE - .pool -_080D668C: - adds r0, r3, 0 - subs r0, 0x85 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x2A - bhi _080D66B0 - lsls r1, r3, 3 - subs r1, r3 - lsls r1, 2 - ldr r0, =gUnknown_085897E4 - adds r1, r0 - adds r0, r4, 0 - bl GetBerryCountString - b _080D66BE - .pool -_080D66B0: - adds r0, r1, 0 - bl itemid_get_item - adds r1, r0, 0 - adds r0, r4, 0 - bl StringCopy -_080D66BE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80D6660 - - thumb_func_start GetBerryCountString -@ void GetBerryCountString(struct berry_info *berryInfo, u8 *dest, u32 berryCount) -GetBerryCountString: @ 80D66C4 - push {r4,lr} - ldr r4, =gUnknown_085EFCE5 - cmp r2, 0x1 - bhi _080D66CE - ldr r4, =gUnknown_085EFCDF -_080D66CE: - bl StringCopy - movs r1, 0 - strb r1, [r0] - adds r0, 0x1 - adds r1, r4, 0 - bl StringCopy - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end GetBerryCountString - - thumb_func_start IsBagPocketNonEmpty -@ bool8 IsBagPocketNonEmpty(u8 pocketId) -IsBagPocketNonEmpty: @ 80D66EC - push {lr} - lsls r0, 24 - movs r2, 0 - ldr r1, =gBagItems - lsrs r0, 21 - subs r0, 0x8 - adds r0, r1 - ldrb r1, [r0, 0x4] - cmp r2, r1 - bcs _080D671E - ldr r3, [r0] -_080D6702: - lsls r0, r2, 2 - adds r0, r3 - ldrh r0, [r0] - cmp r0, 0 - beq _080D6714 - movs r0, 0x1 - b _080D6720 - .pool -_080D6714: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, r1 - bcc _080D6702 -_080D671E: - movs r0, 0 -_080D6720: - pop {r1} - bx r1 - thumb_func_end IsBagPocketNonEmpty - - thumb_func_start sub_80D6724 -sub_80D6724: @ 80D6724 - push {r4-r7,lr} - lsls r0, 16 - lsrs r7, r0, 16 - lsls r1, 16 - lsrs r5, r1, 16 - adds r0, r7, 0 - bl ItemId_GetPocket - lsls r0, 24 - cmp r0, 0 - beq _080D67B6 - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - bne _080D6752 - ldr r0, =0x00004004 - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080D6768 -_080D6752: - adds r0, r7, 0 - adds r1, r5, 0 - bl sub_80D710C - lsls r0, 24 - lsrs r0, 24 - b _080D67B8 - .pool -_080D6764: - movs r0, 0x1 - b _080D67B8 -_080D6768: - adds r0, r7, 0 - bl ItemId_GetPocket - subs r0, 0x1 - lsls r0, 24 - movs r6, 0 - ldr r1, =gBagItems - lsrs r4, r0, 21 - b _080D67AE - .pool -_080D6780: - adds r0, r4, r1 - ldr r1, [r0] - lsls r0, r6, 2 - adds r1, r0, r1 - ldrh r0, [r1] - cmp r0, r7 - bne _080D67A6 - adds r0, r1, 0x2 - bl GetBagItemQuantity - lsls r0, 16 - lsrs r0, 16 - cmp r0, r5 - bcs _080D6764 - subs r0, r5, r0 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0 - beq _080D6764 -_080D67A6: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gBagItems -_080D67AE: - adds r0, r4, r1 - ldrb r0, [r0, 0x4] - cmp r6, r0 - bcc _080D6780 -_080D67B6: - movs r0, 0 -_080D67B8: - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80D6724 - - thumb_func_start sub_80D67C4 -sub_80D67C4: @ 80D67C4 - push {r4,lr} - movs r4, 0x85 -_080D67C8: - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80D6724 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x1 - bne _080D67E4 - ldr r0, =gScriptResult - strh r1, [r0] - movs r0, 0x1 - b _080D67F6 - .pool -_080D67E4: - adds r0, r4, 0x1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0xB2 - bls _080D67C8 - ldr r1, =gScriptResult - movs r0, 0 - strh r0, [r1] - movs r0, 0 -_080D67F6: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80D67C4 - - thumb_func_start sub_80D6800 -sub_80D6800: @ 80D6800 + thumb_func_start CheckBagHasSpace +CheckBagHasSpace: @ 80D6800 push {r4-r7,lr} mov r7, r10 mov r6, r9 @@ -274,7 +36,7 @@ sub_80D6800: @ 80D6800 _080D6838: mov r0, r8 adds r1, r5, 0 - bl sub_80D7184 + bl CheckPyramidBagHasSpace lsls r0, 24 lsrs r0, 24 b _080D6916 @@ -291,7 +53,7 @@ _080D684C: movs r7, 0x63 _080D6860: movs r6, 0 - ldr r1, =gBagItems + ldr r1, =gBagPockets lsls r4, r2, 3 adds r0, r4, r1 mov r9, r4 @@ -332,7 +94,7 @@ _080D68AC: adds r0, r6, 0x1 lsls r0, 24 lsrs r6, r0, 24 - ldr r1, =gBagItems + ldr r1, =gBagPockets adds r0, r4, r1 ldrb r0, [r0, 0x4] cmp r6, r0 @@ -341,7 +103,7 @@ _080D68BC: cmp r5, 0 beq _080D6914 movs r6, 0 - ldr r3, =gBagItems + ldr r3, =gBagPockets mov r1, r9 adds r0, r1, r3 ldrb r0, [r0, 0x4] @@ -393,11 +155,11 @@ _080D6916: pop {r4-r7} pop {r1} bx r1 - thumb_func_end sub_80D6800 + thumb_func_end CheckBagHasSpace - thumb_func_start bag_add_item -@ int bag_add_item(int item_id, int quantity) -bag_add_item: @ 80D6928 + thumb_func_start AddBagItem +@ int AddBagItem(int item_id, int quantity) +AddBagItem: @ 80D6928 push {r4-r7,lr} mov r7, r10 mov r6, r9 @@ -429,7 +191,7 @@ _080D694C: _080D6964: mov r0, r9 adds r1, r5, 0 - bl sub_80D7204 + bl AddPyramidBagItem lsls r0, 24 lsrs r0, 24 b _080D6A92 @@ -442,7 +204,7 @@ _080D6978: lsrs r0, 24 mov r10, r0 lsls r1, r0, 3 - ldr r0, =gBagItems + ldr r0, =gBagPockets adds r7, r1, r0 ldrb r0, [r7, 0x4] lsls r0, 2 @@ -581,7 +343,7 @@ _080D6A92: pop {r4-r7} pop {r1} bx r1 - thumb_func_end bag_add_item + thumb_func_end AddBagItem thumb_func_start RemoveBagItem @ pokescrcmd @@ -616,7 +378,7 @@ RemoveBagItem: @ 80D6AA4 _080D6AE0: mov r0, r8 adds r1, r7, 0 - bl sub_80D7334 + bl RemovePyramidBagItem lsls r0, 24 lsrs r0, 24 b _080D6C5A @@ -629,7 +391,7 @@ _080D6AF4: lsrs r0, 24 mov r9, r0 lsls r1, r0, 3 - ldr r0, =gBagItems + ldr r0, =gBagPockets adds r5, r1, r0 movs r6, 0 ldrb r2, [r5, 0x4] @@ -1169,12 +931,12 @@ _080D6F0E: bx r0 thumb_func_end sub_80D6EDC - thumb_func_start bag_pocket_get_itemid -@ int bag_pocket_get_itemid(int pocket_id_plus_1, int item_index_in_pocket) -bag_pocket_get_itemid: @ 80D6F14 + thumb_func_start BagGetItemIdByPocketPosition +@ int BagGetItemIdByPocketPosition(int pocket_id_plus_1, int item_index_in_pocket) +BagGetItemIdByPocketPosition: @ 80D6F14 lsls r0, 24 lsls r1, 16 - ldr r2, =gBagItems + ldr r2, =gBagPockets lsrs r0, 21 subs r0, 0x8 adds r0, r2 @@ -1184,15 +946,15 @@ bag_pocket_get_itemid: @ 80D6F14 ldrh r0, [r1] bx lr .pool - thumb_func_end bag_pocket_get_itemid + thumb_func_end BagGetItemIdByPocketPosition - thumb_func_start bag_pocket_get_item_quantity -@ int bag_pocket_get_item_quantity(int pocket_id_plus_1, int item_index_in_pocket) -bag_pocket_get_item_quantity: @ 80D6F30 + thumb_func_start BagGetQuantityByPocketPosition +@ int BagGetQuantityByPocketPosition(int pocket_id_plus_1, int item_index_in_pocket) +BagGetQuantityByPocketPosition: @ 80D6F30 push {lr} lsls r0, 24 lsls r1, 16 - ldr r2, =gBagItems + ldr r2, =gBagPockets lsrs r0, 21 subs r0, 0x8 adds r0, r2 @@ -1206,7 +968,7 @@ bag_pocket_get_item_quantity: @ 80D6F30 pop {r1} bx r1 .pool - thumb_func_end bag_pocket_get_item_quantity + thumb_func_end BagGetQuantityByPocketPosition thumb_func_start swap32 swap32: @ 80D6F58 @@ -1395,7 +1157,7 @@ _080D708C: sub_80D7094: @ 80D7094 push {r4,r5,lr} movs r4, 0 - ldr r5, =gBagItems + ldr r5, =gBagPockets _080D709A: lsls r1, r4, 3 adds r1, r5 @@ -1457,8 +1219,8 @@ _080D70FE: .pool thumb_func_end CountTotalItemQuantityInBag - thumb_func_start sub_80D710C -sub_80D710C: @ 80D710C + thumb_func_start CheckPyramidBagHasItem +CheckPyramidBagHasItem: @ 80D710C push {r4,r5,lr} lsls r0, 16 lsrs r5, r0, 16 @@ -1515,10 +1277,10 @@ _080D717C: pop {r4,r5} pop {r1} bx r1 - thumb_func_end sub_80D710C + thumb_func_end CheckPyramidBagHasItem - thumb_func_start sub_80D7184 -sub_80D7184: @ 80D7184 + thumb_func_start CheckPyramidBagHasSpace +CheckPyramidBagHasSpace: @ 80D7184 push {r4,r5,lr} lsls r0, 16 lsrs r5, r0, 16 @@ -1579,10 +1341,10 @@ _080D71FC: pop {r4,r5} pop {r1} bx r1 - thumb_func_end sub_80D7184 + thumb_func_end CheckPyramidBagHasSpace - thumb_func_start sub_80D7204 -sub_80D7204: @ 80D7204 + thumb_func_start AddPyramidBagItem +AddPyramidBagItem: @ 80D7204 push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -1726,10 +1488,10 @@ _080D7326: pop {r4-r7} pop {r1} bx r1 - thumb_func_end sub_80D7204 + thumb_func_end AddPyramidBagItem - thumb_func_start sub_80D7334 -sub_80D7334: @ 80D7334 + thumb_func_start RemovePyramidBagItem +RemovePyramidBagItem: @ 80D7334 push {r4-r7,lr} mov r7, r9 mov r6, r8 @@ -1866,7 +1628,7 @@ _080D744E: pop {r4-r7} pop {r1} bx r1 - thumb_func_end sub_80D7334 + thumb_func_end RemovePyramidBagItem thumb_func_start SanitizeItemId SanitizeItemId: @ 80D745C @@ -1886,9 +1648,9 @@ _080D7470: bx r1 thumb_func_end SanitizeItemId - thumb_func_start itemid_get_item -@ item *itemid_get_item(s16 itemId) -itemid_get_item: @ 80D7474 + thumb_func_start ItemId_GetItem +@ item *ItemId_GetItem(s16 itemId) +ItemId_GetItem: @ 80D7474 push {lr} lsls r0, 16 lsrs r0, 16 @@ -1902,7 +1664,7 @@ itemid_get_item: @ 80D7474 pop {r1} bx r1 .pool - thumb_func_end itemid_get_item + thumb_func_end ItemId_GetItem thumb_func_start itemid_get_number itemid_get_number: @ 80D7494 diff --git a/asm/item_use.s b/asm/item_use.s index 5f1b06883..5e50e434d 100644 --- a/asm/item_use.s +++ b/asm/item_use.s @@ -2008,7 +2008,7 @@ sub_80FE058: @ 80FE058 bl RemoveBagItem ldrh r0, [r4] ldr r1, =gStringVar2 - bl itemid_get_name + bl CopyItemName ldr r0, =gStringVar4 ldr r1, =gUnknown_085E9080 bl StringExpandPlaceholders @@ -2208,7 +2208,7 @@ ItemUseOutOfBattle_BlackWhiteFlute: @ 80FE234 ldr r4, =gUnknown_0203CE7C ldrh r0, [r4] ldr r1, =gStringVar2 - bl itemid_get_name + bl CopyItemName ldrh r0, [r4] cmp r0, 0x2B bne _080FE278 diff --git a/asm/link.s b/asm/link.s index 11c210b74..88b2f5243 100644 --- a/asm/link.s +++ b/asm/link.s @@ -52126,7 +52126,7 @@ _08024270: bl memset cmp r4, 0 bne _080242A2 - bl sub_80D67C4 + bl HasAtLeastOneBerry lsls r0, 24 cmp r0, 0 beq _0802429E @@ -59121,7 +59121,7 @@ sub_80279C8: @ 80279C8 _080279F4: adds r0, r5, 0 movs r1, 0x1 - bl sub_80D6800 + bl CheckBagHasSpace lsls r0, 24 cmp r0, 0 bne _08027A06 @@ -59130,10 +59130,10 @@ _080279F4: _08027A06: adds r0, r6, 0 movs r1, 0x1 - bl bag_add_item + bl AddBagItem adds r0, r6, 0 movs r1, 0x1 - bl sub_80D6800 + bl CheckBagHasSpace lsls r0, 24 cmp r0, 0 beq _08027A20 @@ -63520,7 +63520,7 @@ _08029DA0: lsrs r0, 16 ldr r5, =gStringVar1 adds r1, r5, 0 - bl itemid_get_name + bl CopyItemName movs r0, 0 adds r1, r5, 0 bl sub_81AFC0C @@ -63553,7 +63553,7 @@ _08029DA0: lsls r0, 16 lsrs r0, 16 adds r1, r5, 0 - bl itemid_get_name + bl CopyItemName movs r0, 0 adds r1, r5, 0 bl sub_81AFC0C @@ -66997,14 +66997,14 @@ _0802BB00: beq _0802BB58 ldrh r0, [r1, 0x3E] ldrh r1, [r2] - bl bag_add_item + bl AddBagItem lsls r0, 24 cmp r0, 0 beq _0802BB58 ldr r0, [r4] ldrh r0, [r0, 0x3E] movs r1, 0x1 - bl sub_80D6800 + bl CheckBagHasSpace lsls r0, 24 cmp r0, 0 bne _0802BB50 @@ -68761,7 +68761,7 @@ _0802C892: beq _0802C8A4 adds r0, r5, 0 adds r1, r4, 0 - bl sub_80D6800 + bl CheckBagHasSpace lsls r0, 24 cmp r0, 0 beq _0802C88C @@ -70722,7 +70722,7 @@ sub_802D7E8: @ 802D7E8 ldr r1, [r5] adds r1, 0x26 adds r2, r4, 0 - bl sub_80D6660 + bl CopyItemNameHandlePlural ldr r0, [r5] adds r0, 0x66 adds r1, r4, 0 @@ -70785,7 +70785,7 @@ sub_802D884: @ 802D884 ldr r4, =gUnknown_02022D00 ldr r1, [r4] adds r1, 0x26 - bl itemid_get_name + bl CopyItemName bl sub_81AFBF0 ldr r1, [r4] adds r1, 0x26 @@ -70838,7 +70838,7 @@ sub_802D8FC: @ 802D8FC ldr r4, =gUnknown_02022D00 ldr r1, [r4] adds r1, 0x26 - bl itemid_get_name + bl CopyItemName bl sub_81AFBF0 ldr r1, [r4] adds r1, 0x26 diff --git a/asm/player_pc.s b/asm/player_pc.s index 408523012..4d46af800 100644 --- a/asm/player_pc.s +++ b/asm/player_pc.s @@ -1428,7 +1428,7 @@ sub_816BA18: @ 816BA18 adds r5, r1, r0 ldrh r0, [r5, 0x20] movs r1, 0x1 - bl bag_add_item + bl AddBagItem lsls r0, 24 cmp r0, 0 bne _0816BA68 @@ -1850,7 +1850,7 @@ sub_816BDC8: @ 816BDC8 lsls r0, r1, 16 lsrs r0, 16 adds r1, r2, 0 - bl itemid_get_name + bl CopyItemName pop {r0} bx r0 thumb_func_end sub_816BDC8 @@ -2653,7 +2653,7 @@ sub_816C450: @ 816C450 adds r1, r0 ldrh r0, [r1] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r0, =0x0000fff7 bl sub_816C228 bl sub_816C2C0 @@ -2960,7 +2960,7 @@ _0816C774: adds r0, r1, r2 ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r0, =0x0000fffe bl sub_816C228 bl sub_816C2C0 @@ -2986,7 +2986,7 @@ _0816C7BC: adds r0, r1, r2 ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r0, =0x0000fffc bl sub_816C228 bl sub_816C2C0 @@ -3145,7 +3145,7 @@ sub_816C8FC: @ 816C8FC adds r0, r1 ldrh r0, [r0] ldrh r1, [r4, 0x4] - bl bag_add_item + bl AddBagItem lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -3157,7 +3157,7 @@ sub_816C8FC: @ 816C8FC adds r0, r2 ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r0, =gStringVar2 movs r2, 0x4 ldrsh r1, [r4, r2] @@ -3234,7 +3234,7 @@ sub_816C9B8: @ 816C9B8 adds r0, r2 ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r0, =gStringVar2 movs r2, 0x4 ldrsh r1, [r7, r2] diff --git a/asm/record_mixing.s b/asm/record_mixing.s index 9cbaa8c5c..84cdaff7c 100644 --- a/asm/record_mixing.s +++ b/asm/record_mixing.s @@ -2260,7 +2260,7 @@ sub_80E7F68: @ 80E7F68 bne _080E7FEC ldrh r0, [r4] movs r1, 0x1 - bl sub_80D6724 + bl CheckBagHasItem lsls r0, 24 cmp r0, 0 bne _080E7FE4 @@ -2272,7 +2272,7 @@ sub_80E7F68: @ 80E7F68 bne _080E7FE4 ldrh r0, [r4] movs r1, 0x1 - bl bag_add_item + bl AddBagItem lsls r0, 24 cmp r0, 0 beq _080E7FE4 diff --git a/asm/rom6.s b/asm/rom6.s index e192a4738..be0170dae 100644 --- a/asm/rom6.s +++ b/asm/rom6.s @@ -1054,7 +1054,7 @@ sub_8135D7C: @ 8135D7C sub_8135DAC: @ 8135DAC push {r4,lr} ldr r0, =0x00000111 - bl itemid_get_item + bl ItemId_GetItem adds r4, r0, 0 movs r0, 0x1 adds r1, r4, 0 diff --git a/asm/rom_80C6FA0.s b/asm/rom_80C6FA0.s index bd312c1f4..8a56841e9 100644 --- a/asm/rom_80C6FA0.s +++ b/asm/rom_80C6FA0.s @@ -4045,7 +4045,7 @@ _080C92D0: adds r0, r1 ldrh r0, [r0] movs r1, 0x1 - bl bag_add_item + bl AddBagItem lsls r0, 24 cmp r0, 0 bne _080C92FC @@ -4374,7 +4374,7 @@ _080C95C8: adds r0, r1 ldrh r0, [r0] movs r1, 0x1 - bl bag_add_item + bl AddBagItem lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -15026,7 +15026,7 @@ _080CF020: beq _080CF0AC ldr r3, =0x00000d65 adds r4, r3 - bl itemid_get_item + bl ItemId_GetItem adds r1, r0, 0 adds r0, r4, 0 movs r2, 0 @@ -19273,7 +19273,7 @@ sub_80D12B8: @ 80D12B8 ldr r1, =0x00002234 adds r0, r1 ldrh r0, [r0] - bl itemid_get_item + bl ItemId_GetItem pop {r1} bx r1 .pool diff --git a/asm/rom_8184DA4.s b/asm/rom_8184DA4.s index b9220a688..ecb2d596d 100644 --- a/asm/rom_8184DA4.s +++ b/asm/rom_8184DA4.s @@ -16494,7 +16494,7 @@ sub_818DCAC: @ 818DCAC adds r4, r0, 0 lsls r0, r1, 16 lsrs r0, 16 - bl itemid_get_item + bl ItemId_GetItem adds r1, r0, 0 adds r0, r4, 0 bl StringCopy @@ -17186,7 +17186,7 @@ sub_818E274: @ 818E274 ldr r0, =gUnknown_0203CD68 ldr r0, [r0] ldrh r0, [r0, 0x28] - bl itemid_get_item + bl ItemId_GetItem adds r1, r0, 0 adds r0, r4, 0 bl StringCopy @@ -31530,7 +31530,7 @@ sub_8195DB8: @ 8195DB8 adds r0, r1 ldrh r0, [r0] movs r1, 0x1 - bl bag_add_item + bl AddBagItem lsls r0, 24 lsrs r5, r0, 24 cmp r5, 0x1 @@ -31540,7 +31540,7 @@ sub_8195DB8: @ 8195DB8 adds r0, r1 ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r0, [r4] ldr r1, =0x00000dc6 adds r0, r1 @@ -53623,7 +53623,7 @@ _081A10F4: adds r1, r0 adds r1, 0xBA ldrh r0, [r1] - bl itemid_get_item + bl ItemId_GetItem adds r1, r0, 0 b _081A1174 .pool @@ -62236,7 +62236,7 @@ sub_81A5B88: @ 81A5B88 adds r0, r1 ldrh r0, [r0] movs r1, 0x1 - bl bag_add_item + bl AddBagItem lsls r0, 24 lsrs r5, r0, 24 cmp r5, 0x1 @@ -62246,7 +62246,7 @@ sub_81A5B88: @ 81A5B88 adds r0, r1 ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r0, [r4] ldr r1, =0x00000dd8 adds r0, r1 @@ -68897,7 +68897,7 @@ sub_81A91FC: @ 81A91FC adds r0, r1 ldrh r0, [r0] movs r1, 0x1 - bl bag_add_item + bl AddBagItem lsls r0, 24 lsrs r5, r0, 24 cmp r5, 0x1 @@ -68907,7 +68907,7 @@ sub_81A91FC: @ 81A91FC adds r0, r1 ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r0, [r4] ldr r1, =0x00000e18 adds r0, r1 @@ -71953,10 +71953,10 @@ _081AAA9E: ble _081AAA9E movs r0, 0x15 movs r1, 0x1 - bl sub_80D7204 + bl AddPyramidBagItem movs r0, 0x22 movs r1, 0x1 - bl sub_80D7204 + bl AddPyramidBagItem pop {r3} mov r8, r3 pop {r4-r7} @@ -72817,7 +72817,7 @@ load_bag_item_list_buffers: @ 81AB240 lsls r0, 24 lsrs r7, r0, 24 lsls r1, r7, 3 - ldr r0, =gBagItems + ldr r0, =gBagPockets adds r1, r0 mov r8, r1 ldr r0, =gUnknown_0203CE54 @@ -72977,7 +72977,7 @@ get_name: @ 81AB39C beq _081AB420 adds r0, r5, 0 adds r1, r6, 0 - bl itemid_get_name + bl CopyItemName b _081AB43E .pool _081AB3C0: @@ -73023,7 +73023,7 @@ _081AB420: bl ConvertIntToDecimalStringN ldr r1, =gStringVar2 adds r0, r5, 0 - bl itemid_get_name + bl CopyItemName _081AB436: ldr r1, =gUnknown_085E9210 _081AB438: @@ -73074,7 +73074,7 @@ _081AB466: lsrs r0, 24 lsls r1, r6, 16 lsrs r1, 16 - bl bag_pocket_get_itemid + bl BagGetItemIdByPocketPosition lsls r0, 16 lsrs r0, 16 ldr r1, [r4] @@ -73176,7 +73176,7 @@ _081AB570: lsls r4, 16 lsrs r4, 16 adds r1, r4, 0 - bl bag_pocket_get_itemid + bl BagGetItemIdByPocketPosition lsls r0, 16 lsrs r6, r0, 16 ldrb r0, [r5, 0x5] @@ -73184,7 +73184,7 @@ _081AB570: lsls r0, 24 lsrs r0, 24 adds r1, r4, 0 - bl bag_pocket_get_item_quantity + bl BagGetQuantityByPocketPosition lsls r0, 16 lsrs r4, r0, 16 mov r9, r4 @@ -73318,7 +73318,7 @@ bag_menu_print_description_box_text: @ 81AB6B0 lsrs r0, 24 lsls r1, 16 lsrs r1, 16 - bl bag_pocket_get_itemid + bl BagGetItemIdByPocketPosition lsls r0, 16 lsrs r0, 16 bl ItemId_GetDescription @@ -73656,7 +73656,7 @@ sub_81AB9A8: @ 81AB9A8 lsls r0, 24 lsrs r5, r0, 24 lsls r1, r5, 3 - ldr r0, =gBagItems + ldr r0, =gBagPockets adds r4, r1, r0 cmp r5, 0x3 bgt _081AB9C8 @@ -74237,14 +74237,14 @@ _081ABE68: lsls r4, 16 lsrs r4, 16 adds r1, r4, 0 - bl bag_pocket_get_item_quantity + bl BagGetQuantityByPocketPosition strh r0, [r6, 0x4] ldrb r0, [r5, 0x5] adds r0, 0x1 lsls r0, 24 lsrs r0, 24 adds r1, r4, 0 - bl bag_pocket_get_itemid + bl BagGetItemIdByPocketPosition ldr r1, =gUnknown_0203CE7C strh r0, [r1] ldr r1, =gUnknown_08614054 @@ -74797,11 +74797,11 @@ bag_menu_swap_items: @ 81AC2E8 lsls r0, 24 lsrs r0, 24 ldrh r1, [r6, 0x2] - bl bag_pocket_get_itemid + bl BagGetItemIdByPocketPosition lsls r0, 16 lsrs r0, 16 ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r0, =gStringVar4 mov r8, r0 ldr r1, =gUnknown_085E8DFE @@ -74986,7 +74986,7 @@ _081AC4E2: b _081AC566 .pool _081AC4F8: - ldr r1, =gBagItems + ldr r1, =gBagPockets lsls r0, r6, 3 adds r0, r1 ldr r0, [r0] @@ -75517,7 +75517,7 @@ _081ACA50: ldr r0, =gUnknown_0203CE7C ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r4, =gStringVar4 ldr r1, =gUnknown_085E8DBE adds r0, r4, 0 @@ -76088,7 +76088,7 @@ _081ACF24: ldr r0, =gUnknown_0203CE7C ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r4, =gStringVar4 ldr r1, =gUnknown_085E8EE0 adds r0, r4, 0 @@ -76138,7 +76138,7 @@ BagMenuConfirmToss: @ 81ACF88 ldr r0, =gUnknown_0203CE7C ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r0, =gStringVar2 movs r2, 0x10 ldrsh r1, [r4, r2] @@ -76275,7 +76275,7 @@ BagMenuActuallyToss: @ 81AD0CC ldr r0, =gUnknown_0203CE7C ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r0, =gStringVar2 movs r2, 0x10 ldrsh r1, [r6, r2] @@ -76509,7 +76509,7 @@ bag_menu_print_cant_be_held_msg: @ 81AD30C ldr r0, =gUnknown_0203CE7C ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r5, =gStringVar4 ldr r1, =gUnknown_085E8E11 adds r0, r5, 0 @@ -76652,7 +76652,7 @@ _081AD44C: bne _081AD488 ldrh r0, [r4] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r4, =gStringVar4 ldr r1, =gUnknown_085E8E27 adds r0, r4, 0 @@ -76772,7 +76772,7 @@ _081AD550: cmp r0, 0 beq _081AD5CA movs r1, 0x1 - bl sub_80D6724 + bl CheckBagHasItem lsls r0, 24 lsrs r6, r0, 24 cmp r6, 0x1 @@ -76836,7 +76836,7 @@ display_sell_item_ask_str: @ 81AD5DC bne _081AD634 ldrh r0, [r6] ldr r1, =gStringVar2 - bl itemid_get_name + bl CopyItemName ldr r4, =gStringVar4 ldr r1, =gUnknown_085E960F adds r0, r4, 0 @@ -76862,7 +76862,7 @@ _081AD634: _081AD64C: ldrh r0, [r6] ldr r1, =gStringVar2 - bl itemid_get_name + bl CopyItemName ldr r4, =gStringVar4 ldr r1, =gUnknown_085E962F adds r0, r4, 0 @@ -77094,7 +77094,7 @@ sub_81AD84C: @ 81AD84C ldr r6, =gUnknown_0203CE7C ldrh r0, [r6] ldr r1, =gStringVar2 - bl itemid_get_name + bl CopyItemName ldr r0, =gStringVar1 mov r8, r0 ldrh r0, [r6] @@ -77274,7 +77274,7 @@ _081ADA18: ldr r0, =gUnknown_0203CE7C ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r4, =gStringVar4 ldr r1, =gUnknown_085E8E42 adds r0, r4, 0 @@ -77425,7 +77425,7 @@ _081ADB6C: bne _081ADBD4 ldrh r0, [r4] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r0, =gStringVar2 mov r2, r8 movs r3, 0x10 @@ -77660,10 +77660,10 @@ DoWallyTutorialBagMenu: @ 81ADD70 bl PrepareBagForWallyTutorial movs r0, 0xD movs r1, 0x1 - bl bag_add_item + bl AddBagItem movs r0, 0x4 movs r1, 0x1 - bl bag_add_item + bl AddBagItem ldr r2, =sub_8059D50 movs r0, 0xA movs r1, 0 @@ -85579,7 +85579,7 @@ sub_81B1C84: @ 81B1C84 bl GetMonNickname ldr r1, =gStringVar2 adds r0, r4, 0 - bl itemid_get_name + bl CopyItemName ldr r4, =gStringVar4 ldr r1, =gUnknown_085E991B adds r0, r4, 0 @@ -85608,7 +85608,7 @@ sub_81B1CD0: @ 81B1CD0 bl GetMonNickname ldr r1, =gStringVar2 adds r0, r4, 0 - bl itemid_get_name + bl CopyItemName ldr r4, =gStringVar4 ldr r1, =gUnknown_085E999D adds r0, r4, 0 @@ -85637,7 +85637,7 @@ sub_81B1D1C: @ 81B1D1C bl GetMonNickname ldr r1, =gStringVar2 adds r0, r4, 0 - bl itemid_get_name + bl CopyItemName ldr r4, =gStringVar4 ldr r1, =gUnknown_085E993A adds r0, r4, 0 @@ -85665,10 +85665,10 @@ sub_81B1D68: @ 81B1D68 lsls r5, 24 lsrs r5, 24 ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r1, =gStringVar2 adds r0, r4, 0 - bl itemid_get_name + bl CopyItemName ldr r4, =gStringVar4 ldr r1, =gUnknown_085E99DB adds r0, r4, 0 @@ -85739,7 +85739,7 @@ sub_81B1E00: @ 81B1E00 b _081B1E3E _081B1E1C: movs r1, 0x1 - bl bag_add_item + bl AddBagItem lsls r0, 24 cmp r0, 0 beq _081B1E3C @@ -88731,7 +88731,7 @@ _081B36C0: bl sub_81B31B0 ldr r1, =gStringVar2 adds r0, r6, 0 - bl itemid_get_name + bl CopyItemName movs r0, 0x1A bl display_pokemon_menu_message _081B36EA: @@ -90267,13 +90267,13 @@ _081B4402: ldr r6, =gUnknown_0203CEFC ldrh r0, [r6] movs r1, 0x1 - bl bag_add_item + bl AddBagItem lsls r0, 24 cmp r0, 0 bne _081B4458 ldrh r0, [r5] movs r1, 0x1 - bl bag_add_item + bl AddBagItem ldrh r0, [r6] bl pokemon_item_not_removed ldr r0, =gStringVar4 @@ -90442,7 +90442,7 @@ sub_81B4578: @ 81B4578 bl RemoveBagItem mov r0, r8 movs r1, 0x1 - bl bag_add_item + bl AddBagItem ldrb r0, [r6, 0x8] lsls r0, 28 lsrs r0, 28 @@ -90717,7 +90717,7 @@ sub_81B47E0: @ 81B47E0 _081B4864: ldr r1, =gStringVar1 adds r0, r5, 0 - bl itemid_get_name + bl CopyItemName ldr r4, =gStringVar4 ldr r1, =gUnknown_085E9E00 adds r0, r4, 0 @@ -90800,7 +90800,7 @@ _081B491A: lsls r0, 16 lsrs r0, 16 ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r4, =gStringVar4 ldr r1, =gUnknown_085E9E14 adds r0, r4, 0 @@ -91206,7 +91206,7 @@ _081B4CBE: lsrs r4, r0, 16 adds r0, r4, 0 movs r1, 0x1 - bl bag_add_item + bl AddBagItem lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -91317,7 +91317,7 @@ _081B4DE4: lsls r0, 16 lsrs r0, 16 ldr r1, =gStringVar2 - bl itemid_get_name + bl CopyItemName movs r0, 0x1A bl display_pokemon_menu_message _081B4E02: @@ -97369,7 +97369,7 @@ _081B82FA: ldr r6, =gUnknown_0203CEFC ldrh r0, [r6] movs r1, 0x1 - bl bag_add_item + bl AddBagItem lsls r0, 24 cmp r0, 0 bne _081B8338 @@ -97502,7 +97502,7 @@ sub_81B841C: @ 81B841C _081B8438: adds r0, r1, 0 movs r1, 0x1 - bl bag_add_item + bl AddBagItem _081B8440: lsls r0, 24 lsrs r0, 24 @@ -100291,7 +100291,7 @@ sub_81B9B28: @ 81B9B28 adds r0, r1 ldrh r0, [r0] movs r1, 0x1 - bl bag_add_item + bl AddBagItem lsls r0, 24 lsrs r5, r0, 24 cmp r5, 0x1 @@ -100301,7 +100301,7 @@ sub_81B9B28: @ 81B9B28 adds r0, r1 ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r0, [r4] ldr r1, =0x00000e6a adds r0, r1 @@ -100452,7 +100452,7 @@ sub_81B9C98: @ 81B9C98 adds r0, r1 ldrh r0, [r0] movs r1, 0x1 - bl bag_add_item + bl AddBagItem lsls r0, 24 lsrs r5, r0, 24 cmp r5, 0x1 @@ -100462,7 +100462,7 @@ sub_81B9C98: @ 81B9C98 adds r0, r1 ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r0, [r4] ldr r1, =0x00000e6c adds r0, r1 @@ -100625,7 +100625,7 @@ sub_81B9E20: @ 81B9E20 adds r0, r1 ldrh r0, [r0] movs r1, 0x1 - bl bag_add_item + bl AddBagItem lsls r0, 24 lsrs r5, r0, 24 cmp r5, 0x1 @@ -100635,7 +100635,7 @@ sub_81B9E20: @ 81B9E20 adds r0, r1 ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r0, [r4] ldr r1, =0x00000e6e adds r0, r1 diff --git a/asm/rom_81BE66C.s b/asm/rom_81BE66C.s index 7f60b9947..529434c9c 100644 --- a/asm/rom_81BE66C.s +++ b/asm/rom_81BE66C.s @@ -9114,7 +9114,7 @@ sub_81C35E4: @ 81C35E4 bne _081C3628 _081C3614: movs r0, 0xAF - bl itemid_get_item + bl ItemId_GetItem adds r5, r0, 0 b _081C3650 .pool @@ -9133,7 +9133,7 @@ _081C3644: ldrh r0, [r1] ldr r4, =gStringVar1 adds r1, r4, 0 - bl itemid_get_name + bl CopyItemName adds r5, r4, 0 _081C3650: movs r0, 0x1 @@ -12592,7 +12592,7 @@ sub_81C540C: @ 81C540C bl ConvertIntToDecimalStringN ldr r1, =gStringVar2 adds r0, r4, 0 - bl itemid_get_name + bl CopyItemName ldr r1, =gUnknown_085E9210 adds r0, r5, 0 bl StringExpandPlaceholders @@ -12601,7 +12601,7 @@ sub_81C540C: @ 81C540C _081C5450: adds r0, r4, 0 adds r1, r5, 0 - bl itemid_get_name + bl CopyItemName _081C5458: pop {r4,r5} pop {r0} @@ -13714,7 +13714,7 @@ _081C5DDA: ldr r0, =gUnknown_0203CE7C ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r4, =gStringVar4 ldr r1, =gUnknown_085E8DBE adds r0, r4, 0 @@ -14307,7 +14307,7 @@ _081C62F4: ldr r0, =gUnknown_0203CE7C ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r4, =gStringVar4 ldr r1, =gUnknown_085E8EE0 adds r0, r4, 0 @@ -14354,7 +14354,7 @@ sub_81C6350: @ 81C6350 ldr r0, =gUnknown_0203CE7C ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r0, =gStringVar2 movs r2, 0x10 ldrsh r1, [r4, r2] @@ -14569,7 +14569,7 @@ sub_81C654C: @ 81C654C ldr r0, =gUnknown_0203CE7C ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r0, =gStringVar2 movs r2, 0x10 ldrsh r1, [r6, r2] @@ -14627,7 +14627,7 @@ sub_81C65CC: @ 81C65CC ldr r0, =gUnknown_0203CE7C ldrh r0, [r0] ldrh r1, [r4, 0x10] - bl sub_80D7334 + bl RemovePyramidBagItem ldrb r0, [r4] adds r1, r6, 0 adds r2, r7, 0 @@ -14705,7 +14705,7 @@ sub_81C66AC: @ 81C66AC ldr r0, =gUnknown_0203CE7C ldrh r0, [r0] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r5, =gStringVar4 ldr r1, =gUnknown_085E8E11 adds r0, r5, 0 @@ -14877,7 +14877,7 @@ sub_81C67CC: @ 81C67CC adds r3, r2 ldrh r0, [r3] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r6, =gStringVar4 ldr r1, =gUnknown_085E8DFE adds r0, r6, 0 @@ -15189,7 +15189,7 @@ _081C6AF8: cmp r0, 0 beq _081C6B88 movs r1, 0x1 - bl bag_add_item + bl AddBagItem lsls r0, 24 cmp r0, 0 bne _081C6B88 @@ -45448,14 +45448,14 @@ _081D5952: _081D596C: adds r0, r5, 0 movs r1, 0x1 - bl bag_add_item + bl AddBagItem lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 bne _081D59BC ldr r1, =gStringVar2 adds r0, r5, 0 - bl itemid_get_name + bl CopyItemName mov r0, r8 ldr r1, [r0] adds r1, r7 diff --git a/asm/rtc.s b/asm/rtc.s deleted file mode 100644 index e69de29bb..000000000 diff --git a/asm/scrcmd.s b/asm/scrcmd.s index 9d6d2fe27..e549ab035 100644 --- a/asm/scrcmd.s +++ b/asm/scrcmd.s @@ -970,7 +970,7 @@ sub_80999A0: @ 80999A0 lsls r1, 24 lsrs r1, 24 adds r0, r4, 0 - bl bag_add_item + bl AddBagItem lsls r0, 24 lsrs r0, 24 strh r0, [r5] @@ -1034,7 +1034,7 @@ sub_8099A28: @ 8099A28 lsls r1, 24 lsrs r1, 24 adds r0, r4, 0 - bl sub_80D6800 + bl CheckBagHasSpace lsls r0, 24 lsrs r0, 24 strh r0, [r5] @@ -1066,7 +1066,7 @@ sub_8099A6C: @ 8099A6C lsls r1, 24 lsrs r1, 24 adds r0, r4, 0 - bl sub_80D6724 + bl CheckBagHasItem lsls r0, 24 lsrs r0, 24 strh r0, [r5] @@ -3914,7 +3914,7 @@ s80_load_item_name: @ 809B090 lsls r4, 2 adds r4, r1 ldr r1, [r4] - bl itemid_get_name + bl CopyItemName movs r0, 0 pop {r4} pop {r1} @@ -3951,7 +3951,7 @@ sub_809B0C4: @ 809B0C4 adds r6, r0 ldr r1, [r6] adds r0, r4, 0 - bl sub_80D6660 + bl CopyItemNameHandlePlural movs r0, 0 pop {r4-r6} pop {r1} diff --git a/asm/script_menu.s b/asm/script_menu.s index 1a3a58113..0562b9aeb 100644 --- a/asm/script_menu.s +++ b/asm/script_menu.s @@ -956,7 +956,7 @@ _080E258A: _080E25D2: ldr r0, =0x00000113 movs r1, 0x1 - bl sub_80D6724 + bl CheckBagHasItem lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -1002,7 +1002,7 @@ _080E2630: movs r0, 0xB9 lsls r0, 1 movs r1, 0x1 - bl sub_80D6724 + bl CheckBagHasItem lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -1047,7 +1047,7 @@ _080E2668: _080E2690: ldr r0, =0x00000173 movs r1, 0x1 - bl sub_80D6724 + bl CheckBagHasItem lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -1092,7 +1092,7 @@ _080E26EC: movs r0, 0xBC lsls r0, 1 movs r1, 0x1 - bl sub_80D6724 + bl CheckBagHasItem lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 diff --git a/asm/shop.s b/asm/shop.s index 2f3f42fe9..deda193ba 100644 --- a/asm/shop.s +++ b/asm/shop.s @@ -652,7 +652,7 @@ BuyMenuSetListEntry: @ 80E0000 bne _080E0020 adds r0, r4, 0 adds r1, r5, 0 - bl itemid_get_name + bl CopyItemName b _080E002C .pool _080E0020: @@ -2073,7 +2073,7 @@ _080E0BD0: lsrs r5, r0, 16 ldr r1, =gStringVar1 adds r0, r5, 0 - bl itemid_get_name + bl CopyItemName adds r0, r5, 0 bl ItemId_GetPocket lsls r0, 24 @@ -2303,7 +2303,7 @@ _080E0DF0: bl PutWindowTilemap ldrh r0, [r5, 0xA] ldr r1, =gStringVar1 - bl itemid_get_name + bl CopyItemName ldr r0, =gStringVar2 movs r2, 0x2 ldrsh r1, [r5, r2] @@ -2395,7 +2395,7 @@ BuyMenuTryMakePurchase: @ 80E0EDC bne _080E0F40 ldrh r0, [r4, 0xA] ldrh r1, [r4, 0x2] - bl bag_add_item + bl AddBagItem lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 @@ -2531,7 +2531,7 @@ Task_ReturnToItemListAfterItemPurchase: @ 80E100C ble _080E106C movs r0, 0xC movs r1, 0x1 - bl bag_add_item + bl AddBagItem lsls r0, 24 lsrs r0, 24 cmp r0, 0x1 diff --git a/asm/tv.s b/asm/tv.s index 94c38d69b..e4fc54486 100644 --- a/asm/tv.s +++ b/asm/tv.s @@ -11041,7 +11041,7 @@ _080F1CC8: bl sub_81DB5E8 ldr r4, =gStringVar2 ldrh r0, [r5, 0x6] - bl itemid_get_item + bl ItemId_GetItem adds r1, r0, 0 adds r0, r4, 0 bl StringCopy @@ -11093,7 +11093,7 @@ _080F1D40: _080F1D4C: ldr r4, =gStringVar2 ldrh r0, [r5, 0x8] - bl itemid_get_item + bl ItemId_GetItem adds r1, r0, 0 adds r0, r4, 0 bl StringCopy @@ -11111,7 +11111,7 @@ _080F1D4C: _080F1D7C: ldr r4, =gStringVar2 ldrh r0, [r5, 0xA] - bl itemid_get_item + bl ItemId_GetItem adds r1, r0, 0 adds r0, r4, 0 bl StringCopy @@ -11159,7 +11159,7 @@ _080F1DD8: bl sub_81DB5E8 ldr r4, =gStringVar2 ldrh r0, [r5, 0x6] - bl itemid_get_item + bl ItemId_GetItem adds r1, r0, 0 adds r0, r4, 0 bl StringCopy @@ -11574,7 +11574,7 @@ _080F21EC: _080F21F2: ldr r4, =gStringVar2 ldrb r0, [r5, 0xF] - bl itemid_get_item + bl ItemId_GetItem adds r1, r0, 0 adds r0, r4, 0 bl StringCopy @@ -14297,7 +14297,7 @@ _080F3DB8: _080F3DBE: ldr r4, =gStringVar1 ldrh r0, [r5, 0x2] - bl itemid_get_item + bl ItemId_GetItem adds r1, r0, 0 adds r0, r4, 0 bl StringCopy @@ -14328,7 +14328,7 @@ _080F3DFC: _080F3E02: ldr r4, =gStringVar1 ldrh r0, [r5, 0x2] - bl itemid_get_item + bl ItemId_GetItem adds r1, r0, 0 adds r0, r4, 0 bl StringCopy @@ -14347,7 +14347,7 @@ _080F3E02: _080F3E3C: ldr r4, =gStringVar1 ldrh r0, [r5, 0x2] - bl itemid_get_item + bl ItemId_GetItem adds r1, r0, 0 adds r0, r4, 0 bl StringCopy @@ -14645,7 +14645,7 @@ _080F4140: bl sub_80EF340 ldr r4, =gStringVar2 ldrh r0, [r6, 0x6] - bl itemid_get_item + bl ItemId_GetItem adds r1, r0, 0 adds r0, r4, 0 bl StringCopy @@ -15124,7 +15124,7 @@ _080F462C: _080F4634: ldr r4, =gStringVar3 ldrh r0, [r5, 0x2] - bl itemid_get_item + bl ItemId_GetItem adds r1, r0, 0 adds r0, r4, 0 bl StringCopy @@ -16618,7 +16618,7 @@ _080F54EC: _080F54F0: ldr r4, =gStringVar2 ldrh r0, [r5, 0x10] - bl itemid_get_item + bl ItemId_GetItem adds r1, r0, 0 adds r0, r4, 0 bl StringCopy diff --git a/data/strings.s b/data/strings.s index 300796c0f..751449a1f 100644 --- a/data/strings.s +++ b/data/strings.s @@ -2199,11 +2199,11 @@ gUnknown_085EFC0C:: @ 85EFC0C gUnknown_085EFC27:: @ 85EFC27 .incbin "baserom.gba", 0x5efc27, 0xad -gUnknown_085EFCD4:: @ 85EFCD4 +gOtherText_PokeBalls:: @ 85EFCD4 .incbin "baserom.gba", 0x5efcd4, 0xb -gUnknown_085EFCDF:: @ 85EFCDF +gOtherText_Berry:: @ 85EFCDF .incbin "baserom.gba", 0x5efcdf, 0x6 -gUnknown_085EFCE5:: @ 85EFCE5 +gOtherText_Berries:: @ 85EFCE5 .incbin "baserom.gba", 0x5efce5, 0xb diff --git a/include/item.h b/include/item.h index adcbfb01d..eaefa0298 100644 --- a/include/item.h +++ b/include/item.h @@ -1,4 +1,62 @@ #ifndef ITEM_H #define ITEM_H +typedef void (*ItemUseFunc)(u8); + +struct Item +{ + u8 name[14]; + u16 itemId; + u16 price; + u8 holdEffect; + u8 holdEffectParam; + const u8 *description; + u8 importance; + u8 unk19; + u8 pocket; + u8 type; + ItemUseFunc fieldUseFunc; + u8 battleUsage; + ItemUseFunc battleUseFunc; + u8 secondaryId; +}; + +struct BagPocket +{ + struct ItemSlot *itemSlots; + u8 capacity; +}; + +extern struct BagPocket gBagPockets[]; + +void GetBerryCountString(u8* dst, const u8* berryName, u32 quantity); +void CopyItemName(u16 itemId, u8 *string); +bool8 IsBagPocketNonEmpty(u8 pocket); +bool8 CheckBagHasItem(u16 itemId, u16 count); +bool8 CheckBagHasSpace(u16 itemId, u16 count); +bool8 AddBagItem(u16 itemId, u16 count); +bool8 RemoveBagItem(u16 itemId, u16 count); +u8 GetPocketByItemId(u16 itemId); +void ClearItemSlots(struct ItemSlot *itemSlots, u8 b); +u8 CountUsedPCItemSlots(void); +bool8 CheckPCHasItem(u16 itemId, u16 count); +bool8 AddPCItem(u16 itemId, u16 count); +void RemovePCItem(u8 index, u16 count); +void SwapRegisteredBike(void); +const struct Item *ItemId_GetItem(u16 itemId); +u16 ItemId_GetId(u16 itemId); +u16 ItemId_GetPrice(u16 itemId); +u8 ItemId_GetHoldEffect(u16 itemId); +u8 ItemId_GetHoldEffectParam(u16 itemId); +const u8 *ItemId_GetDescription(u16 itemId); +bool32 ItemId_CopyDescription(u8 *a, u32 itemId, u32 c); +u8 ItemId_GetImportance(u16 itemId); +u8 ItemId_GetUnknownValue(u16 itemId); +u8 ItemId_GetPocket(u16 itemId); +u8 ItemId_GetType(u16 itemId); +ItemUseFunc ItemId_GetFieldFunc(u16 itemId); +u8 ItemId_GetBattleUsage(u16 itemId); +ItemUseFunc ItemId_GetBattleFunc(u16 itemId); +u8 ItemId_GetSecondaryId(u16 itemId); + #endif // ITEM_H diff --git a/src/item.c b/src/item.c index c68922c0e..4ad70e11f 100644 --- a/src/item.c +++ b/src/item.c @@ -1,7 +1,19 @@ #include "global.h" #include "item.h" +#include "string_util.h" +#include "text.h" +#include "event_data.h" extern void ApplyNewEncyprtionKeyToHword(u16* hword, u32 newKey); +extern bool8 InBattlePyramid(void); + +extern const u8 gOtherText_PokeBalls[]; +extern const u8 gOtherText_Berries[]; +extern const u8 gOtherText_Berry[]; +extern const u8 gUnknown_085897E4[][28]; // not sure what this one is + +bool8 CheckPyramidBagHasItem(u16 itemId, u16 count); +bool8 CheckPyramidBagHasSpace(u16 itemId, u16 count); enum { @@ -12,14 +24,6 @@ enum KEYITEMS_POCKET }; -struct BagItem -{ - struct ItemSlot (*items)[]; - u8 maxPerPocket; -}; - -extern struct BagItem gBagItems[]; - u16 GetBagItemQuantity(u16* quantity) { return gSaveBlock2Ptr->encryptionKey ^ *quantity; @@ -45,8 +49,8 @@ void ApplyNewEncyprtionKeyToBagItems(u32 newKey) u32 pocket, item; for (pocket = 0; pocket < 5; pocket++) { - for (item = 0; item < gBagItems[pocket].maxPerPocket; item++) - ApplyNewEncyprtionKeyToHword(&((*gBagItems[pocket].items)[item].quantity), newKey); + for (item = 0; item < gBagPockets[pocket].capacity; item++) + ApplyNewEncyprtionKeyToHword(&(gBagPockets[pocket].itemSlots[item].quantity), newKey); } } @@ -59,18 +63,166 @@ void ApplyNewEncyprtionKeyToBagItems_(u32 newKey) // really GF? void SetBagItemsPointers(void) { - gBagItems[ITEMS_POCKET].items = &gSaveBlock1Ptr->bagPocket_Items; - gBagItems[ITEMS_POCKET].maxPerPocket = 30; + gBagPockets[ITEMS_POCKET].itemSlots = gSaveBlock1Ptr->bagPocket_Items; + gBagPockets[ITEMS_POCKET].capacity = 30; - gBagItems[KEYITEMS_POCKET].items = &gSaveBlock1Ptr->bagPocket_KeyItems; - gBagItems[KEYITEMS_POCKET].maxPerPocket = 30; + gBagPockets[KEYITEMS_POCKET].itemSlots = gSaveBlock1Ptr->bagPocket_KeyItems; + gBagPockets[KEYITEMS_POCKET].capacity = 30; - gBagItems[BALLS_POCKET].items = &gSaveBlock1Ptr->bagPocket_PokeBalls; - gBagItems[BALLS_POCKET].maxPerPocket = 16; + gBagPockets[BALLS_POCKET].itemSlots = gSaveBlock1Ptr->bagPocket_PokeBalls; + gBagPockets[BALLS_POCKET].capacity = 16; - gBagItems[TMHM_POCKET].items = &gSaveBlock1Ptr->bagPocket_TMHM; - gBagItems[TMHM_POCKET].maxPerPocket = 64; + gBagPockets[TMHM_POCKET].itemSlots = gSaveBlock1Ptr->bagPocket_TMHM; + gBagPockets[TMHM_POCKET].capacity = 64; - gBagItems[BERRIES_POCKET].items = &gSaveBlock1Ptr->bagPocket_Berries; - gBagItems[BERRIES_POCKET].maxPerPocket = 46; + gBagPockets[BERRIES_POCKET].itemSlots = gSaveBlock1Ptr->bagPocket_Berries; + gBagPockets[BERRIES_POCKET].capacity = 46; } + +void CopyItemName(u16 itemId, u8 *string) +{ + StringCopy(string, ItemId_GetItem(itemId)->name); +} + +void CopyItemNameHandlePlural(u16 itemId, u8 *string, u32 quantity) +{ + if (itemId == 4) + { + if (quantity < 2) + StringCopy(string, ItemId_GetItem(4)->name); + else + StringCopy(string, gOtherText_PokeBalls); + } + else + { + if (itemId >= 0x85 && itemId <= 0xAF) + GetBerryCountString(string, gUnknown_085897E4[itemId], quantity); + else + StringCopy(string, ItemId_GetItem(itemId)->name); + } +} + +void GetBerryCountString(u8* dst, const u8* berryName, u32 quantity) +{ + const u8* berryString; + u8* txtPtr; + + if (quantity < 2) + berryString = gOtherText_Berry; + else + berryString = gOtherText_Berries; + txtPtr = StringCopy(dst, berryName); + *txtPtr = CHAR_SPACE; + StringCopy(txtPtr + 1, berryString); +} + +bool8 IsBagPocketNonEmpty(u8 pocket) +{ + u8 i; + + for (i = 0; i < gBagPockets[pocket - 1].capacity; i++) + { + if (gBagPockets[pocket - 1].itemSlots[i].itemId != 0) + return TRUE; + } + return FALSE; +} + +bool8 CheckBagHasItem(u16 itemId, u16 count) +{ + u8 i; + u8 pocket; + + if (ItemId_GetPocket(itemId) == 0) + return FALSE; + if (InBattlePyramid() || FlagGet(0x4004) == TRUE) + return CheckPyramidBagHasItem(itemId, count); + pocket = ItemId_GetPocket(itemId) - 1; + //Check for item slots that contain the item + for (i = 0; i < gBagPockets[pocket].capacity; i++) + { + if (gBagPockets[pocket].itemSlots[i].itemId == itemId) + { + u16 quantity; + //Does this item slot contain enough of the item? + quantity = GetBagItemQuantity(&gBagPockets[pocket].itemSlots[i].quantity); + if (quantity >= count) + return TRUE; + count -= quantity; + //Does this item slot and all previous slots contain enough of the item? + if (count == 0) + return TRUE; + } + } + return FALSE; +} + +bool8 HasAtLeastOneBerry(void) +{ + u16 i; + for (i = 0x85; i < 0xB3; i++) + { + if (CheckBagHasItem(i, 1) == TRUE) + { + gScriptResult = 1; + return TRUE; + } + } + gScriptResult = 0; + return FALSE; +} + +/* Refuses to match. +bool8 CheckBagHasSpace(u16 itemId, u16 count) +{ + u8 i; + u8 pocket; + u16 slotCapacity; + u16 quantity; + + if (ItemId_GetPocket(itemId) == 0) + return FALSE; + if (InBattlePyramid() || FlagGet(0x4004) == TRUE) + return CheckPyramidBagHasSpace(itemId, count); + pocket = ItemId_GetPocket(itemId) - 1; + if (pocket != BERRIES_POCKET) + slotCapacity = 99; + else + slotCapacity = 999; + + //Check space in any existing item slots that already contain this item + for (i = 0; i < gBagPockets[pocket].capacity; i++) + { + if (gBagPockets[pocket].itemSlots[i].itemId == itemId) + { + quantity = GetBagItemQuantity(&gBagPockets[pocket].itemSlots[i].quantity); + if (quantity + count <= slotCapacity) + return TRUE; + if (pocket == TMHM_POCKET || pocket == BERRIES_POCKET) + return FALSE; + count -= slotCapacity - quantity; + if (count == 0) + return TRUE; + } + } + + //Check space in empty item slots + if (count > 0) + { + for (i = 0; i < gBagPockets[pocket].capacity; i++) + { + if (gBagPockets[pocket].itemSlots[i].itemId == 0) + { + if (count <= slotCapacity) + return TRUE; + if (pocket == TMHM_POCKET || pocket == BERRIES_POCKET) + return FALSE; + count -= slotCapacity; + } + } + if (count > 0) + return FALSE; //No more item slots. The bag is full + } + + return TRUE; +}*/ diff --git a/sym_ewram.txt b/sym_ewram.txt index 7a9c63ce1..274d14ba4 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1149,7 +1149,7 @@ gUnknown_02039DD0: @ 2039DD0 gUnknown_02039DD4: @ 2039DD4 .space 0x4 -gBagItems: @ 2039DD8 +gBagPockets: @ 2039DD8 .space 0x28 gUnknown_02039E00: @ 2039E00