summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2019-03-24 14:45:09 -0500
committerhuderlem <huderlem@gmail.com>2019-03-24 14:50:16 -0500
commitcf917a873392df734afde73d7ff6125fd56a3ed4 (patch)
treecd67875f9612e969e2960b522731dfc61457f141
parent456cc3a6f02b6f45753b47e5ea37bd92e616f089 (diff)
Decompile berry_powder.c
-rwxr-xr-xasm/berry_crush.s4
-rwxr-xr-xasm/berry_powder_vendor.s374
-rwxr-xr-xdata/berry_powder.s (renamed from data/berry_powder_vendor.s)3
-rw-r--r--data/maps/SlateportCity/scripts.inc16
-rw-r--r--data/specials.inc10
-rwxr-xr-xinclude/berry_powder.h9
-rw-r--r--include/strings.h3
-rw-r--r--ld_script.txt4
-rwxr-xr-xsrc/berry_powder.c128
-rwxr-xr-xsrc/item_use.c5
-rw-r--r--src/load_save.c3
-rw-r--r--src/new_game.c2
-rw-r--r--sym_ewram.txt4
13 files changed, 165 insertions, 400 deletions
diff --git a/asm/berry_crush.s b/asm/berry_crush.s
index 4d5840970..9286a9b4f 100755
--- a/asm/berry_crush.s
+++ b/asm/berry_crush.s
@@ -404,7 +404,7 @@ _08020F48:
ldr r1, [r4]
ldr r0, [r1, 0x68]
str r0, [r1, 0x1C]
- bl sub_8024700
+ bl GiveBerryPowder
lsls r0, 24
cmp r0, 0
bne _08020F66
@@ -6510,7 +6510,7 @@ _080240DC:
movs r3, 0x6
bl ConvertIntToDecimalStringN
ldr r4, =gStringVar2
- bl sub_80247BC
+ bl GetBerryPowder
adds r1, r0, 0
adds r0, r4, 0
movs r2, 0
diff --git a/asm/berry_powder_vendor.s b/asm/berry_powder_vendor.s
deleted file mode 100755
index 308e5af41..000000000
--- a/asm/berry_powder_vendor.s
+++ /dev/null
@@ -1,374 +0,0 @@
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .syntax unified
-
- .text
-
- thumb_func_start sub_8024668
-sub_8024668: @ 8024668
- ldr r1, =gSaveBlock2Ptr
- ldr r1, [r1]
- adds r1, 0xAC
- ldr r0, [r0]
- ldr r1, [r1]
- eors r0, r1
- bx lr
- .pool
- thumb_func_end sub_8024668
-
- thumb_func_start SetBerryPowder
-SetBerryPowder: @ 802467C
- ldr r2, =gSaveBlock2Ptr
- ldr r2, [r2]
- adds r2, 0xAC
- ldr r2, [r2]
- eors r2, r1
- str r2, [r0]
- bx lr
- .pool
- thumb_func_end SetBerryPowder
-
- thumb_func_start ApplyNewEncryptionKeyToBerryPowder
-ApplyNewEncryptionKeyToBerryPowder: @ 8024690
- push {lr}
- adds r1, r0, 0
- ldr r0, =gSaveBlock2Ptr
- ldr r0, [r0]
- movs r2, 0xFA
- lsls r2, 1
- adds r0, r2
- bl ApplyNewEncryptionKeyToWord
- pop {r0}
- bx r0
- .pool
- thumb_func_end ApplyNewEncryptionKeyToBerryPowder
-
- thumb_func_start sub_80246AC
-sub_80246AC: @ 80246AC
- push {r4,lr}
- adds r4, r0, 0
- ldr r0, =gSaveBlock2Ptr
- ldr r0, [r0]
- movs r1, 0xFA
- lsls r1, 1
- adds r0, r1
- bl sub_8024668
- cmp r0, r4
- bcc _080246CC
- movs r0, 0x1
- b _080246CE
- .pool
-_080246CC:
- movs r0, 0
-_080246CE:
- pop {r4}
- pop {r1}
- bx r1
- thumb_func_end sub_80246AC
-
- thumb_func_start sub_80246D4
-sub_80246D4: @ 80246D4
- push {lr}
- ldr r0, =gSaveBlock2Ptr
- ldr r0, [r0]
- movs r1, 0xFA
- lsls r1, 1
- adds r0, r1
- bl sub_8024668
- ldr r1, =gSpecialVar_0x8004
- ldrh r1, [r1]
- cmp r0, r1
- bcc _080246F8
- movs r0, 0x1
- b _080246FA
- .pool
-_080246F8:
- movs r0, 0
-_080246FA:
- pop {r1}
- bx r1
- thumb_func_end sub_80246D4
-
- thumb_func_start sub_8024700
-sub_8024700: @ 8024700
- push {r4,r5,lr}
- adds r4, r0, 0
- ldr r0, =gSaveBlock2Ptr
- ldr r0, [r0]
- movs r1, 0xFA
- lsls r1, 1
- adds r5, r0, r1
- adds r0, r5, 0
- bl sub_8024668
- adds r1, r0, r4
- ldr r2, =0x0001869f @ Note to decompiler: See UNKNOWN_OFFSET
- cmp r1, r2
- bhi _08024730
- adds r0, r5, 0
- bl SetBerryPowder
- movs r0, 0x1
- b _0802473A
- .pool
-_08024730:
- adds r0, r5, 0
- adds r1, r2, 0
- bl SetBerryPowder
- movs r0, 0
-_0802473A:
- pop {r4,r5}
- pop {r1}
- bx r1
- thumb_func_end sub_8024700
-
- thumb_func_start sub_8024740
-sub_8024740: @ 8024740
- push {r4,r5,lr}
- adds r5, r0, 0
- ldr r0, =gSaveBlock2Ptr
- ldr r0, [r0]
- movs r1, 0xFA
- lsls r1, 1
- adds r4, r0, r1
- adds r0, r5, 0
- bl sub_80246AC
- lsls r0, 24
- cmp r0, 0
- beq _08024774
- adds r0, r4, 0
- bl sub_8024668
- adds r1, r0, 0
- subs r1, r5
- adds r0, r4, 0
- bl SetBerryPowder
- movs r0, 0x1
- b _08024776
- .pool
-_08024774:
- movs r0, 0
-_08024776:
- pop {r4,r5}
- pop {r1}
- bx r1
- thumb_func_end sub_8024740
-
- thumb_func_start sub_802477C
-sub_802477C: @ 802477C
- push {r4,r5,lr}
- ldr r0, =gSaveBlock2Ptr
- ldr r0, [r0]
- movs r1, 0xFA
- lsls r1, 1
- adds r4, r0, r1
- ldr r5, =gSpecialVar_0x8004
- ldrh r0, [r5]
- bl sub_80246AC
- lsls r0, 24
- cmp r0, 0
- beq _080247B4
- adds r0, r4, 0
- bl sub_8024668
- adds r1, r0, 0
- ldrh r0, [r5]
- subs r1, r0
- adds r0, r4, 0
- bl SetBerryPowder
- movs r0, 0x1
- b _080247B6
- .pool
-_080247B4:
- movs r0, 0
-_080247B6:
- pop {r4,r5}
- pop {r1}
- bx r1
- thumb_func_end sub_802477C
-
- thumb_func_start sub_80247BC
-sub_80247BC: @ 80247BC
- push {lr}
- ldr r0, =gSaveBlock2Ptr
- ldr r0, [r0]
- movs r1, 0xFA
- lsls r1, 1
- adds r0, r1
- bl sub_8024668
- pop {r1}
- bx r1
- .pool
- thumb_func_end sub_80247BC
-
- thumb_func_start sub_80247D4
-sub_80247D4: @ 80247D4
- push {r4-r6,lr}
- mov r6, r9
- mov r5, r8
- push {r5,r6}
- sub sp, 0xC
- adds r6, r0, 0
- mov r8, r2
- adds r4, r3, 0
- ldr r5, [sp, 0x24]
- lsls r6, 24
- lsrs r6, 24
- mov r0, r8
- lsls r0, 24
- lsrs r0, 24
- mov r8, r0
- lsls r4, 24
- lsrs r4, 24
- lsls r5, 24
- lsrs r5, 24
- ldr r0, =gStringVar1
- mov r9, r0
- movs r2, 0x1
- movs r3, 0x5
- bl ConvertIntToDecimalStringN
- str r4, [sp]
- str r5, [sp, 0x4]
- movs r0, 0
- str r0, [sp, 0x8]
- adds r0, r6, 0
- movs r1, 0x1
- mov r2, r9
- mov r3, r8
- bl AddTextPrinterParameterized
- add sp, 0xC
- pop {r3,r4}
- mov r8, r3
- mov r9, r4
- pop {r4-r6}
- pop {r0}
- bx r0
- .pool
- thumb_func_end sub_80247D4
-
- thumb_func_start sub_802482C
-sub_802482C: @ 802482C
- push {r4-r6,lr}
- mov r6, r8
- push {r6}
- sub sp, 0xC
- adds r6, r0, 0
- adds r4, r1, 0
- adds r5, r2, 0
- mov r8, r3
- lsls r6, 24
- lsrs r6, 24
- lsls r4, 16
- lsrs r4, 16
- lsls r5, 24
- lsrs r5, 24
- adds r0, r6, 0
- movs r1, 0
- adds r2, r4, 0
- adds r3, r5, 0
- bl DrawStdFrameWithCustomTileAndPalette
- ldr r2, =gText_Powder
- movs r0, 0x1
- str r0, [sp]
- movs r0, 0xFF
- str r0, [sp, 0x4]
- movs r4, 0
- str r4, [sp, 0x8]
- adds r0, r6, 0
- movs r1, 0x1
- movs r3, 0
- bl AddTextPrinterParameterized
- str r4, [sp]
- adds r0, r6, 0
- mov r1, r8
- movs r2, 0x1A
- movs r3, 0x11
- bl sub_80247D4
- add sp, 0xC
- pop {r3}
- mov r8, r3
- pop {r4-r6}
- pop {r0}
- bx r0
- .pool
- thumb_func_end sub_802482C
-
- thumb_func_start sub_802488C
-sub_802488C: @ 802488C
- push {lr}
- sub sp, 0x4
- bl sub_80247BC
- adds r1, r0, 0
- ldr r0, =gUnknown_02022C94
- ldrb r0, [r0]
- movs r2, 0
- str r2, [sp]
- movs r2, 0x1A
- movs r3, 0x11
- bl sub_80247D4
- add sp, 0x4
- pop {r0}
- bx r0
- .pool
- thumb_func_end sub_802488C
-
- thumb_func_start sub_80248B0
-sub_80248B0: @ 80248B0
- push {r4,r5,lr}
- sub sp, 0x18
- movs r0, 0x7
- str r0, [sp]
- movs r0, 0x4
- str r0, [sp, 0x4]
- movs r0, 0xF
- str r0, [sp, 0x8]
- movs r0, 0x1C
- str r0, [sp, 0xC]
- add r0, sp, 0x10
- movs r1, 0
- movs r2, 0x1
- movs r3, 0x1
- bl SetWindowTemplateFields
- ldr r4, =gUnknown_02022C94
- add r0, sp, 0x10
- bl AddWindow
- strb r0, [r4]
- ldrb r0, [r4]
- movs r1, 0
- bl FillWindowPixelBuffer
- ldrb r0, [r4]
- bl PutWindowTilemap
- ldrb r0, [r4]
- ldr r5, =0x0000021d
- adds r1, r5, 0
- movs r2, 0xD0
- bl LoadUserWindowBorderGfx_
- ldrb r4, [r4]
- bl sub_80247BC
- adds r3, r0, 0
- adds r0, r4, 0
- adds r1, r5, 0
- movs r2, 0xD
- bl sub_802482C
- add sp, 0x18
- pop {r4,r5}
- pop {r0}
- bx r0
- .pool
- thumb_func_end sub_80248B0
-
- thumb_func_start sub_8024918
-sub_8024918: @ 8024918
- push {r4,lr}
- ldr r4, =gUnknown_02022C94
- ldrb r0, [r4]
- bl ClearWindowTilemap
- ldrb r0, [r4]
- movs r1, 0x1
- bl ClearStdWindowAndFrameToTransparent
- ldrb r0, [r4]
- bl RemoveWindow
- pop {r4}
- pop {r0}
- bx r0
- .pool
- thumb_func_end sub_8024918
-
- .align 2, 0 @ don't pad with nop
diff --git a/data/berry_powder_vendor.s b/data/berry_powder.s
index 22e40771f..2e8002bdd 100755
--- a/data/berry_powder_vendor.s
+++ b/data/berry_powder.s
@@ -3,8 +3,9 @@
.section .rodata
+
.align 2
-gUnknown_082F7BA4_UnrefDupe:: @ 82F444C struct BgTemplate
+gUnknown_082F7BA4_UnrefDupe:: @ 82F444C struct BgTemplate(???)
.4byte 0x000001e0
.4byte 0x000012c9
.4byte 0x000012ea
diff --git a/data/maps/SlateportCity/scripts.inc b/data/maps/SlateportCity/scripts.inc
index 1830c3f00..88bcb2e6c 100644
--- a/data/maps/SlateportCity/scripts.inc
+++ b/data/maps/SlateportCity/scripts.inc
@@ -732,11 +732,11 @@ SlateportCity_EventScript_1DD36E:: @ 81DD36E
SlateportCity_EventScript_1DD39A:: @ 81DD39A
setvar VAR_0x8004, 1
- specialvar VAR_RESULT, sub_80246D4
+ specialvar VAR_RESULT, HasEnoughBerryPowder
compare VAR_RESULT, 0
goto_if_eq SlateportCity_EventScript_1DD3C0
msgbox SlateportCity_Text_1DEE40, MSGBOX_DEFAULT
- special sub_80248B0
+ special DisplayBerryPowderVendorMenu
goto SlateportCity_EventScript_1DD3CA
end
@@ -846,7 +846,7 @@ SlateportCity_EventScript_1DD536:: @ 81DD536
SlateportCity_EventScript_1DD54A:: @ 81DD54A
msgbox SlateportCity_Text_1DEFBC, MSGBOX_DEFAULT
- special sub_8024918
+ special RemoveBerryPowderVendorMenu
release
end
@@ -855,26 +855,26 @@ SlateportCity_EventScript_1DD557:: @ 81DD557
compare VAR_RESULT, 0
goto_if_eq SlateportCity_EventScript_1DD3CA
copyvar VAR_0x8004, VAR_0x8009
- specialvar VAR_RESULT, sub_80246D4
+ specialvar VAR_RESULT, HasEnoughBerryPowder
compare VAR_RESULT, 0
goto_if_eq SlateportCity_EventScript_1DD5CE
giveitem_std VAR_0x8008
compare VAR_RESULT, 0
goto_if_eq SlateportCity_EventScript_1DD5C1
copyvar VAR_0x8004, VAR_0x8009
- special sub_802477C
- special sub_802488C
+ special TakeBerryPowder
+ special PrintPlayerBerryPowderAmount
msgbox SlateportCity_Text_1DEEF7, MSGBOX_YESNO
compare VAR_RESULT, 1
goto_if_eq SlateportCity_EventScript_1DD3CA
msgbox SlateportCity_Text_1DEF79, MSGBOX_DEFAULT
- special sub_8024918
+ special RemoveBerryPowderVendorMenu
release
end
SlateportCity_EventScript_1DD5C1:: @ 81DD5C1
msgbox gUnknown_08272A89, MSGBOX_DEFAULT
- special sub_8024918
+ special RemoveBerryPowderVendorMenu
release
end
diff --git a/data/specials.inc b/data/specials.inc
index 9364dcc46..5a812cffa 100644
--- a/data/specials.inc
+++ b/data/specials.inc
@@ -471,11 +471,11 @@ gSpecials:: @ 81DBA64
def_special sub_813AA04
def_special sub_813AA18
def_special sub_813AA44
- def_special sub_80248B0
- def_special sub_8024918
- def_special sub_80246D4
- def_special sub_802477C
- def_special sub_802488C
+ def_special DisplayBerryPowderVendorMenu
+ def_special RemoveBerryPowderVendorMenu
+ def_special HasEnoughBerryPowder
+ def_special TakeBerryPowder
+ def_special PrintPlayerBerryPowderAmount
def_special sub_813A820
def_special sub_813A854
def_special sub_813B7D8
diff --git a/include/berry_powder.h b/include/berry_powder.h
new file mode 100755
index 000000000..8deea7ec0
--- /dev/null
+++ b/include/berry_powder.h
@@ -0,0 +1,9 @@
+#ifndef GUARD_BERRY_POWDER_H
+#define GUARD_BERRY_POWDER_H
+
+void SetBerryPowder(u32 *powder, u32 amount);
+void ApplyNewEncryptionKeyToBerryPowder(u32 encryptionKey);
+bool8 GiveBerryPowder(u32 amountToAdd);
+u32 GetBerryPowder(void);
+
+#endif // GUARD_BERRY_POWDER_H
diff --git a/include/strings.h b/include/strings.h
index ded997b04..400e48036 100644
--- a/include/strings.h
+++ b/include/strings.h
@@ -2589,4 +2589,7 @@ extern const u8 gUnknown_085EE14B[];
extern const u8 gUnknown_085EE14F[];
extern const u8 gUnknown_085EE154[];
+// Berry Powder Menu
+extern const u8 gText_Powder[];
+
#endif // GUARD_STRINGS_H
diff --git a/ld_script.txt b/ld_script.txt
index a78890b9f..b9d8ed50e 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -64,7 +64,7 @@ SECTIONS {
asm/mevent_news.o(.text);
asm/union_room_chat.o(.text);
asm/berry_crush.o(.text);
- asm/berry_powder_vendor.o(.text);
+ src/berry_powder.o(.text);
asm/dodrio_berry_picking.o(.text);
asm/pokemon_jump.o(.text);
src/rtc.o(.text);
@@ -413,7 +413,7 @@ SECTIONS {
data/mevent_server.o(.rodata);
data/union_room_chat.o(.rodata);
data/berry_crush.o(.rodata);
- data/berry_powder_vendor.o(.rodata);
+ data/berry_powder.o(.rodata);
data/dodrio_berry_picking.o(.rodata);
data/pokemon_jump.o(.rodata);
src/rtc.o(.rodata);
diff --git a/src/berry_powder.c b/src/berry_powder.c
new file mode 100755
index 000000000..91f9d0d4e
--- /dev/null
+++ b/src/berry_powder.c
@@ -0,0 +1,128 @@
+#include "global.h"
+#include "berry_powder.h"
+#include "bg.h"
+#include "event_data.h"
+#include "load_save.h"
+#include "menu.h"
+#include "string_util.h"
+#include "strings.h"
+#include "text.h"
+#include "text_window.h"
+#include "window.h"
+
+#define MAX_BERRY_POWDER 99999
+
+static EWRAM_DATA u8 sBerryPowderVendorWindowId = 0;
+
+static u32 DecryptBerryPowder(u32 *powder)
+{
+ return *powder ^ gSaveBlock2Ptr->encryptionKey;
+}
+
+void SetBerryPowder(u32 *powder, u32 amount)
+{
+ *powder = amount ^ gSaveBlock2Ptr->encryptionKey;
+}
+
+void ApplyNewEncryptionKeyToBerryPowder(u32 encryptionKey)
+{
+ u32 *powder = &gSaveBlock2Ptr->berryCrush.berryPowderAmount;
+ ApplyNewEncryptionKeyToWord(powder, encryptionKey);
+}
+
+static bool8 HasEnoughBerryPowder_(u32 cost)
+{
+ u32 *powder = &gSaveBlock2Ptr->berryCrush.berryPowderAmount;
+ if (DecryptBerryPowder(powder) < cost)
+ return FALSE;
+ else
+ return TRUE;
+}
+
+bool8 HasEnoughBerryPowder(void)
+{
+ u32 *powder = &gSaveBlock2Ptr->berryCrush.berryPowderAmount;
+ if (DecryptBerryPowder(powder) < gSpecialVar_0x8004)
+ return FALSE;
+ else
+ return TRUE;
+}
+
+bool8 GiveBerryPowder(u32 amountToAdd)
+{
+ u32 *powder = &gSaveBlock2Ptr->berryCrush.berryPowderAmount;
+ u32 amount = DecryptBerryPowder(powder) + amountToAdd;
+ if (amount > MAX_BERRY_POWDER)
+ {
+ SetBerryPowder(powder, MAX_BERRY_POWDER);
+ return FALSE;
+ }
+ else
+ {
+ SetBerryPowder(powder, amount);
+ return TRUE;
+ }
+}
+
+static bool8 TakeBerryPowder_(u32 cost)
+{
+ u32 *powder = &gSaveBlock2Ptr->berryCrush.berryPowderAmount;
+ if (!HasEnoughBerryPowder_(cost))
+ return FALSE;
+
+ SetBerryPowder(powder, DecryptBerryPowder(powder) - cost);
+ return TRUE;
+}
+
+bool8 TakeBerryPowder(void)
+{
+ u32 *powder = &gSaveBlock2Ptr->berryCrush.berryPowderAmount;
+ if (!HasEnoughBerryPowder_(gSpecialVar_0x8004))
+ return FALSE;
+
+ SetBerryPowder(powder, DecryptBerryPowder(powder) - gSpecialVar_0x8004);
+ return TRUE;
+}
+
+u32 GetBerryPowder(void)
+{
+ u32 *powder = &gSaveBlock2Ptr->berryCrush.berryPowderAmount;
+ return DecryptBerryPowder(powder);
+}
+
+static void PrintBerryPowderAmount(u8 windowId, int amount, u8 x, u8 y, u8 speed)
+{
+ ConvertIntToDecimalStringN(gStringVar1, amount, STR_CONV_MODE_RIGHT_ALIGN, 5);
+ AddTextPrinterParameterized(windowId, 1, gStringVar1, x, y, speed, NULL);
+}
+
+static void DrawPlayerPowderAmount(u8 windowId, u16 baseTileOffset, u8 paletteNum, u32 amount)
+{
+ DrawStdFrameWithCustomTileAndPalette(windowId, FALSE, baseTileOffset, paletteNum);
+ AddTextPrinterParameterized(windowId, 1, gText_Powder, 0, 1, TEXT_SPEED_FF, NULL);
+ PrintBerryPowderAmount(windowId, amount, 26, 17, 0);
+}
+
+void PrintPlayerBerryPowderAmount(void)
+{
+ u32 amount = GetBerryPowder();
+ PrintBerryPowderAmount(sBerryPowderVendorWindowId, amount, 26, 17, 0);
+}
+
+void DisplayBerryPowderVendorMenu(void)
+{
+ struct WindowTemplate template;
+ SetWindowTemplateFields(&template, 0, 1, 1, 7, 4, 15, 0x1C);
+ sBerryPowderVendorWindowId = AddWindow(&template);
+ FillWindowPixelBuffer(sBerryPowderVendorWindowId, PIXEL_FILL(0));
+ PutWindowTilemap(sBerryPowderVendorWindowId);
+ LoadUserWindowBorderGfx_(sBerryPowderVendorWindowId, 0x21D, 0xD0);
+ DrawPlayerPowderAmount(sBerryPowderVendorWindowId, 0x21D, 13, GetBerryPowder());
+}
+
+void RemoveBerryPowderVendorMenu(void)
+{
+ ClearWindowTilemap(sBerryPowderVendorWindowId);
+ ClearStdWindowAndFrameToTransparent(sBerryPowderVendorWindowId, TRUE);
+ RemoveWindow(sBerryPowderVendorWindowId);
+}
diff --git a/src/item_use.c b/src/item_use.c
index e646a18ee..7947964ca 100755
--- a/src/item_use.c
+++ b/src/item_use.c
@@ -4,6 +4,7 @@
#include "battle_pyramid.h"
#include "battle_pyramid_bag.h"
#include "berry.h"
+#include "berry_powder.h"
#include "bike.h"
#include "coins.h"
#include "data2.h"
@@ -45,8 +46,6 @@ extern u8 Route102_EventScript_274482[];
extern u8 Route102_EventScript_2744C0[];
extern u8 BattleFrontier_OutsideEast_EventScript_242CFC[];
-extern s32 sub_80247BC(void);
-
void SetUpItemUseCallback(u8 taskId);
void MapPostLoadHook_UseItem(void);
void sub_80AF6D4(void);
@@ -638,7 +637,7 @@ void ItemUseOutOfBattle_CoinCase(u8 taskId)
void ItemUseOutOfBattle_PowderJar(u8 taskId)
{
- ConvertIntToDecimalStringN(gStringVar1, sub_80247BC(), 0, 5);
+ ConvertIntToDecimalStringN(gStringVar1, GetBerryPowder(), 0, 5);
StringExpandPlaceholders(gStringVar4, gText_PowderQty);
if (!gTasks[taskId].data[3])
diff --git a/src/load_save.c b/src/load_save.c
index d6785254f..150c557c6 100644
--- a/src/load_save.c
+++ b/src/load_save.c
@@ -1,5 +1,6 @@
#include "global.h"
#include "alloc.h"
+#include "berry_powder.h"
#include "item.h"
#include "load_save.h"
#include "main.h"
@@ -15,8 +16,6 @@
static void ApplyNewEncryptionKeyToAllEncryptedData(u32 encryptionKey);
-extern void ApplyNewEncryptionKeyToBerryPowder(u32 key);
-
#define SAVEBLOCK_MOVE_RANGE 128
struct LoadedSaveData
diff --git a/src/new_game.c b/src/new_game.c
index 2e8930f7c..64c5779c1 100644
--- a/src/new_game.c
+++ b/src/new_game.c
@@ -41,12 +41,12 @@
#include "secret_base.h"
#include "player_pc.h"
#include "field_specials.h"
+#include "berry_powder.h"
extern void copy_strings_to_sav1(void);
extern void sub_801AFD8(void);
extern void ResetPokeJumpResults(void);
-extern void SetBerryPowder(u32* powder, u32 newValue);
extern const u8 EventScript_ResetAllMapFlags[];
diff --git a/sym_ewram.txt b/sym_ewram.txt
index e4b315c92..660c7558d 100644
--- a/sym_ewram.txt
+++ b/sym_ewram.txt
@@ -73,9 +73,9 @@ gUnknown_02022C8C: @ 2022C8C
gUnknown_02022C90: @ 2022C90
.space 0x4
-gUnknown_02022C94: @ 2022C94
- .space 0x4
+ .include "src/berry_powder.o"
+ .align 2
gUnknown_02022C98: @ 2022C98
.space 0x4