summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xasm/use_pokeblock.s44
-rw-r--r--ld_script.txt1
-rw-r--r--src/use_pokeblock.c35
3 files changed, 46 insertions, 34 deletions
diff --git a/asm/use_pokeblock.s b/asm/use_pokeblock.s
index 3c580654c..4e278a22a 100755
--- a/asm/use_pokeblock.s
+++ b/asm/use_pokeblock.s
@@ -5,30 +5,6 @@
.text
- thumb_func_start sub_8166204
-sub_8166204: @ 8166204
- push {r4-r6,lr}
- adds r5, r0, 0
- adds r6, r1, 0
- ldr r4, =gUnknown_0203BCAC
- ldr r0, =0x0000806c
- bl AllocZeroed
- str r0, [r4]
- ldr r1, =gUnknown_0203BC90
- ldr r2, =0x00007fd0
- adds r0, r2
- str r0, [r1]
- str r5, [r0, 0x8]
- str r6, [r0, 0x4]
- ldr r0, =sub_8166380
- bl launch_c3_walk_stairs_and_run_once
- ldr r0, =sub_816631C
- bl SetMainCallback2
- pop {r4-r6}
- pop {r0}
- bx r0
- .pool
- thumb_func_end sub_8166204
thumb_func_start sub_816624C
sub_816624C: @ 816624C
@@ -63,7 +39,7 @@ _08166284:
adds r0, 0x56
strb r1, [r0]
ldr r0, =sub_8166380
- bl launch_c3_walk_stairs_and_run_once
+ bl sub_816636C
ldr r0, =sub_81662C0
bl SetMainCallback2
pop {r4,r5}
@@ -144,8 +120,8 @@ sub_8166340: @ 8166340
.pool
thumb_func_end sub_8166340
- thumb_func_start launch_c3_walk_stairs_and_run_once
-launch_c3_walk_stairs_and_run_once: @ 816636C
+ thumb_func_start sub_816636C
+sub_816636C: @ 816636C
ldr r1, =gUnknown_0203BC90
ldr r1, [r1]
str r0, [r1]
@@ -154,7 +130,7 @@ launch_c3_walk_stairs_and_run_once: @ 816636C
strb r0, [r1]
bx lr
.pool
- thumb_func_end launch_c3_walk_stairs_and_run_once
+ thumb_func_end sub_816636C
thumb_func_start sub_8166380
sub_8166380: @ 8166380
@@ -338,7 +314,7 @@ _08166540:
.pool
_08166550:
ldr r0, =map_warp_consider_1_to_outside_or_stair_or_dive
- bl launch_c3_walk_stairs_and_run_once
+ bl sub_816636C
_08166556:
add sp, 0x4
pop {r4,r5}
@@ -424,7 +400,7 @@ _081665C0:
bl sub_81D3480
_0816660A:
ldr r0, =sub_8166634
- bl launch_c3_walk_stairs_and_run_once
+ bl sub_816636C
_08166610:
add sp, 0x4
pop {r4}
@@ -567,7 +543,7 @@ _0816675C:
.pool
_08166788:
ldr r0, =sub_8166BEC
- bl launch_c3_walk_stairs_and_run_once
+ bl sub_816636C
b _0816680E
.pool
_08166794:
@@ -611,7 +587,7 @@ _081667CC:
.pool
_081667E8:
ldr r0, =sub_816681C
- bl launch_c3_walk_stairs_and_run_once
+ bl sub_816636C
b _0816680E
.pool
_081667F4:
@@ -837,7 +813,7 @@ _081669F4:
adds r0, r1
bl sub_81D3464
ldr r0, =sub_8166A34
- bl launch_c3_walk_stairs_and_run_once
+ bl sub_816636C
ldr r0, =sub_816631C
bl SetMainCallback2
_08166A18:
@@ -1020,7 +996,7 @@ _08166BB6:
ldrb r0, [r0]
bl sub_8136F68
ldr r0, =sub_8166BEC
- bl launch_c3_walk_stairs_and_run_once
+ bl sub_816636C
_08166BDA:
pop {r4-r6}
pop {r0}
diff --git a/ld_script.txt b/ld_script.txt
index e71b63e6c..3d28740b1 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -206,6 +206,7 @@ SECTIONS {
src/decoration_inventory.o(.text);
src/roamer.o(.text);
asm/battle_tower.o(.text);
+ src/use_pokeblock.o(.text);
asm/use_pokeblock.o(.text);
src/battle_controller_wally.o(.text);
asm/player_pc.o(.text);
diff --git a/src/use_pokeblock.c b/src/use_pokeblock.c
new file mode 100644
index 000000000..7057b0528
--- /dev/null
+++ b/src/use_pokeblock.c
@@ -0,0 +1,35 @@
+#include "global.h"
+#include "main.h"
+#include "pokeblock.h"
+#include "malloc.h"
+
+struct UsePokeblockSubStruct
+{
+ void *field_0;
+ void (*callback)(void);
+ struct Pokeblock *pokeblock;
+};
+
+struct UsePokeblockStruct1
+{
+ u8 field_0[0x7FD0];
+ struct UsePokeblockSubStruct info;
+};
+
+extern struct UsePokeblockStruct1 *gUnknown_0203BCAC;
+extern struct UsePokeblockSubStruct *gUnknown_0203BC90;
+
+// this file's functions
+void sub_816636C(void *arg0);
+void sub_8166380(void);
+void sub_816631C(void);
+
+void sub_8166204(struct Pokeblock *pokeblock, void (*callback)(void))
+{
+ gUnknown_0203BCAC = AllocZeroed(0x806C);
+ gUnknown_0203BC90 = &gUnknown_0203BCAC->info;
+ gUnknown_0203BC90->pokeblock = pokeblock;
+ gUnknown_0203BC90->callback = callback;
+ sub_816636C(sub_8166380);
+ SetMainCallback2(sub_816631C);
+}