Skip to content

Commit

Permalink
Merge pull request #520 from red031000/master
Browse files Browse the repository at this point in the history
sync bag_view with heartgold
  • Loading branch information
red031000 authored Jul 2, 2023
2 parents b145ba9 + 47be63c commit d58ea76
Show file tree
Hide file tree
Showing 15 changed files with 220 additions and 245 deletions.
8 changes: 4 additions & 4 deletions arm9/asm/scrcmd_10.s
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ ScrCmd_Unk0297: ; 0x020429B8
bl Save_FrontierData_Get
mov r1, #0x0
add r2, r1, #0x0
bl FrontierData_SetField_0x0
bl FrontierData_BattlePointAction
strh r0, [r5, #0x0]
mov r0, #0x0
pop {r3-r5, pc}
Expand All @@ -888,7 +888,7 @@ ScrCmd_Unk0298: ; 0x020429E8
bl Save_FrontierData_Get
add r1, r5, #0x0
mov r2, #0x5
bl FrontierData_SetField_0x0
bl FrontierData_BattlePointAction
mov r0, #0x0
pop {r3-r5, pc}
.balign 4
Expand All @@ -911,7 +911,7 @@ ScrCmd_Unk0299: ; 0x02042A18
bl Save_FrontierData_Get
add r1, r5, #0x0
mov r2, #0x6
bl FrontierData_SetField_0x0
bl FrontierData_BattlePointAction
mov r0, #0x0
pop {r3-r5, pc}
.balign 4
Expand Down Expand Up @@ -942,7 +942,7 @@ ScrCmd_Unk029A: ; 0x02042A48
bl Save_FrontierData_Get
mov r1, #0x0
add r2, r1, #0x0
bl FrontierData_SetField_0x0
bl FrontierData_BattlePointAction
cmp r0, r6
bhs _02042A8E
mov r0, #0x0
Expand Down
2 changes: 1 addition & 1 deletion arm9/asm/unk_0205CE48.s
Original file line number Diff line number Diff line change
Expand Up @@ -1792,7 +1792,7 @@ sub_0205DBF0: ; 0x0205DBF0
ldrh r2, [r5, #0x28]
ldr r1, [r4, #0x10]
add r3, r6, #0x0
bl sub_0206E51C
bl GetItemUseErrorMessage
ldr r0, [r5, #0x0]
ldr r1, _0205DC34 ; =sub_0205D904
add r2, r4, #0x0
Expand Down
4 changes: 2 additions & 2 deletions arm9/global.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2008,7 +2008,7 @@
.extern sub_0202A36C
.extern SaveStruct23_Substruct1_GetFlag1
.extern SaveStruct23_Substruct1_SetFlag1
.extern FrontierData_SetField_0x0
.extern FrontierData_BattlePointAction
.extern FrontierData_SetField_0x2
.extern FrontierData_SetField_0x3
.extern FrontierData_SetArray
Expand Down Expand Up @@ -4987,7 +4987,7 @@
.extern sub_0206E38C
.extern sub_0206E394
.extern TryFormatRegisteredKeyItemUseMessage
.extern sub_0206E51C
.extern GetItemUseErrorMessage
.extern MoveItemSlotInList
.extern GetItemIndexMapping
.extern UpConvertItemId_Gen3to4
Expand Down
2 changes: 1 addition & 1 deletion arm9/overlays/05/asm/ov05_021E1AD8.s
Original file line number Diff line number Diff line change
Expand Up @@ -2076,7 +2076,7 @@ ov05_021E2AD4: ; 0x021E2AD4
bl Save_FrontierData_Get
mov r1, #0
add r2, r1, #0
bl FrontierData_SetField_0x0
bl FrontierData_BattlePointAction
add r2, r0, #0
mov r0, #1
str r0, [sp]
Expand Down
2 changes: 1 addition & 1 deletion arm9/overlays/06/asm/overlay_06.s
Original file line number Diff line number Diff line change
Expand Up @@ -21259,7 +21259,7 @@ _02243E1E:
ldr r0, [r4, #0x74]
add r1, r5, #0
mov r2, #5
bl FrontierData_SetField_0x0
bl FrontierData_BattlePointAction
add r0, r5, #0
pop {r3, r4, r5, pc}
.align 2, 0
Expand Down
4 changes: 2 additions & 2 deletions arm9/overlays/75/asm/overlay_75.s
Original file line number Diff line number Diff line change
Expand Up @@ -4451,7 +4451,7 @@ ov75_021E8E1C: ; 0x021E8E1C
ldrh r2, [r2]
ldr r0, [r0]
ldr r1, [r4, r1]
bl sub_0206E51C
bl GetItemUseErrorMessage
add r0, r4, #0
add r0, #0x64
mov r1, #0xf
Expand Down Expand Up @@ -6650,7 +6650,7 @@ _021EA016:
ldr r0, [r0]
ldr r1, [r4, r1]
sub r3, r3, #7
bl sub_0206E51C
bl GetItemUseErrorMessage
add r0, r4, #0
add r0, #0x64
mov r1, #0xf
Expand Down
62 changes: 31 additions & 31 deletions arm9/src/bag.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,63 +380,63 @@ struct Bag * Save_Bag_Get(struct SaveData * save)
return (struct Bag *)SaveArray_Get(save, 3);
}

struct UnkStruct_0206F164 * sub_0206F164(HeapID heapId)
struct BagCursor * sub_0206F164(HeapID heapId)
{
struct UnkStruct_0206F164 * ret = (struct UnkStruct_0206F164 *)AllocFromHeap(heapId, sizeof(struct UnkStruct_0206F164));
MI_CpuClear16(ret, sizeof(struct UnkStruct_0206F164));
struct BagCursor * ret = (struct BagCursor *)AllocFromHeap(heapId, sizeof(struct BagCursor));
MI_CpuClear16(ret, sizeof(struct BagCursor));
return ret;
}

void sub_0206F17C(struct UnkStruct_0206F164 * a0, u32 a1, u8 * a2, u8 * a3)
void sub_0206F17C(struct BagCursor * a0, u32 a1, u8 * a2, u8 * a3)
{
*a2 = a0->unk_08[a1];
*a3 = a0->unk_00[a1];
*a2 = a0->field.position[a1];
*a3 = a0->field.scroll[a1];
}

u16 sub_0206F18C(struct UnkStruct_0206F164 * a0)
u16 sub_0206F18C(struct BagCursor * a0)
{
return a0->unk_10;
return a0->field.pocket;
}

void sub_0206F190(struct UnkStruct_0206F164 * a0, u32 a1, u8 a2, u8 a3)
void sub_0206F190(struct BagCursor * a0, u32 a1, u8 a2, u8 a3)
{
a0->unk_08[a1] = a2;
a0->unk_00[a1] = a3;
a0->field.position[a1] = a2;
a0->field.scroll[a1] = a3;
}

void sub_0206F19C(struct UnkStruct_0206F164 * a0, u16 a1)
void sub_0206F19C(struct BagCursor * a0, u16 a1)
{
a0->unk_10 = a1;
a0->field.pocket = a1;
}

void sub_0206F1A0(struct UnkStruct_0206F164 * a0, u32 a1, u8 * a2, u8 * a3)
void sub_0206F1A0(struct BagCursor * a0, u32 a1, u8 * a2, u8 * a3)
{
*a2 = a0->unk_19[a1];
*a3 = a0->unk_14[a1];
*a2 = a0->battle.position[a1];
*a3 = a0->battle.scroll[a1];
}

u16 sub_0206F1AC(struct UnkStruct_0206F164 * a0)
u16 sub_0206F1AC(struct BagCursor * a0)
{
return a0->unk_1e;
return a0->battle.lastUsedItem;
}

u16 sub_0206F1B0(struct UnkStruct_0206F164 * a0)
u16 sub_0206F1B0(struct BagCursor * a0)
{
return a0->unk_20;
return a0->battle.lastUsedPocket;
}

u16 sub_0206F1B4(struct UnkStruct_0206F164 * a0)
u16 sub_0206F1B4(struct BagCursor * a0)
{
return a0->unk_22;
return a0->battle.pocket;
}

void sub_0206F1B8(struct UnkStruct_0206F164 * a0, u32 a1, u8 a2, u8 a3)
void sub_0206F1B8(struct BagCursor * a0, u32 a1, u8 a2, u8 a3)
{
a0->unk_19[a1] = a2;
a0->unk_14[a1] = a3;
a0->battle.position[a1] = a2;
a0->battle.scroll[a1] = a3;
}

void sub_0206F1C0(struct UnkStruct_0206F164 * a0)
void sub_0206F1C0(struct BagCursor * a0)
{
u32 i;
for (i = 0; i < 5; i++)
Expand All @@ -446,13 +446,13 @@ void sub_0206F1C0(struct UnkStruct_0206F164 * a0)
sub_0206F1EC(a0, 0);
}

void sub_0206F1E4(struct UnkStruct_0206F164 * a0, u16 a1, u16 a2)
void sub_0206F1E4(struct BagCursor * a0, u16 a1, u16 a2)
{
a0->unk_1e = a1;
a0->unk_20 = a2;
a0->battle.lastUsedItem = a1;
a0->battle.lastUsedPocket = a2;
}

void sub_0206F1EC(struct UnkStruct_0206F164 * a0, u16 a1)
void sub_0206F1EC(struct BagCursor * a0, u16 a1)
{
a0->unk_22 = a1;
a0->battle.pocket = a1;
}
Loading

0 comments on commit d58ea76

Please sign in to comment.