summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/rfu_union_tool.s133
-rw-r--r--data/rfu_union_tool.s30
-rw-r--r--include/rfu_union_tool.h2
-rw-r--r--include/union_room.h2
-rw-r--r--ld_script.txt2
-rw-r--r--src/rfu_union_tool.c80
6 files changed, 89 insertions, 160 deletions
diff --git a/asm/rfu_union_tool.s b/asm/rfu_union_tool.s
index 4213c3f56..65bdef3f9 100644
--- a/asm/rfu_union_tool.s
+++ b/asm/rfu_union_tool.s
@@ -5,133 +5,8 @@
.text
- thumb_func_start is_walking_or_running
-is_walking_or_running: @ 811B504
- push {lr}
- ldr r0, _0811B518 @ =gPlayerAvatar
- ldrb r0, [r0, 0x3]
- cmp r0, 0x2
- beq _0811B512
- cmp r0, 0
- bne _0811B51C
-_0811B512:
- movs r0, 0x1
- b _0811B51E
- .align 2, 0
-_0811B518: .4byte gPlayerAvatar
-_0811B51C:
- movs r0, 0
-_0811B51E:
- pop {r1}
- bx r1
- thumb_func_end is_walking_or_running
-
- thumb_func_start sub_811B524
-sub_811B524: @ 811B524
- ldr r3, _0811B538 @ =gUnknown_84570D8
- movs r2, 0x7
- ands r2, r1
- lsls r1, r0, 2
- adds r1, r0
- lsls r1, 1
- adds r2, r1
- adds r2, r3
- ldrb r0, [r2]
- bx lr
- .align 2, 0
-_0811B538: .4byte gUnknown_84570D8
- thumb_func_end sub_811B524
-
- thumb_func_start sub_811B53C
-sub_811B53C: @ 811B53C
- push {r4-r6,lr}
- mov r6, r8
- push {r6}
- ldr r4, _0811B584 @ =gUnknown_84570EC
- mov r8, r4
- lsls r0, 2
- adds r4, r0, r4
- movs r6, 0
- ldrsh r5, [r4, r6]
- ldr r6, _0811B588 @ =gUnknown_845710C
- lsls r1, 1
- adds r4, r1, r6
- ldrb r4, [r4]
- lsls r4, 24
- asrs r4, 24
- adds r5, r4
- adds r5, 0x7
- str r5, [r2]
- movs r2, 0x2
- add r8, r2
- add r0, r8
- movs r4, 0
- ldrsh r0, [r0, r4]
- adds r6, 0x1
- adds r1, r6
- ldrb r1, [r1]
- lsls r1, 24
- asrs r1, 24
- adds r0, r1
- adds r0, 0x7
- str r0, [r3]
- pop {r3}
- mov r8, r3
- pop {r4-r6}
- pop {r0}
- bx r0
- .align 2, 0
-_0811B584: .4byte gUnknown_84570EC
-_0811B588: .4byte gUnknown_845710C
- thumb_func_end sub_811B53C
-
- thumb_func_start sub_811B58C
-sub_811B58C: @ 811B58C
- push {r4-r7,lr}
- mov r12, r3
- ldr r7, _0811B5CC @ =gUnknown_84570EC
- lsls r5, r0, 2
- adds r0, r5, r7
- movs r4, 0
- ldrsh r3, [r0, r4]
- ldr r6, _0811B5D0 @ =gUnknown_845710C
- lsls r4, r1, 1
- adds r0, r4, r6
- ldrb r0, [r0]
- lsls r0, 24
- asrs r0, 24
- adds r3, r0
- adds r3, 0x7
- cmp r3, r2
- bne _0811B5D4
- adds r0, r7, 0x2
- adds r0, r5, r0
- movs r2, 0
- ldrsh r1, [r0, r2]
- adds r0, r6, 0x1
- adds r0, r4, r0
- ldrb r0, [r0]
- lsls r0, 24
- asrs r0, 24
- adds r1, r0
- adds r1, 0x7
- cmp r1, r12
- bne _0811B5D4
- movs r0, 0x1
- b _0811B5D6
- .align 2, 0
-_0811B5CC: .4byte gUnknown_84570EC
-_0811B5D0: .4byte gUnknown_845710C
-_0811B5D4:
- movs r0, 0
-_0811B5D6:
- pop {r4-r7}
- pop {r1}
- bx r1
- thumb_func_end sub_811B58C
-
- thumb_func_start sub_811B5DC
-sub_811B5DC: @ 811B5DC
+ thumb_func_start IsUnionRoomPlayerHidden
+IsUnionRoomPlayerHidden: @ 811B5DC
push {lr}
adds r0, 0x63
lsls r0, 16
@@ -141,7 +16,7 @@ sub_811B5DC: @ 811B5DC
lsrs r0, 24
pop {r1}
bx r1
- thumb_func_end sub_811B5DC
+ thumb_func_end IsUnionRoomPlayerHidden
thumb_func_start sub_811B5F0
sub_811B5F0: @ 811B5F0
@@ -757,7 +632,7 @@ sub_811BA78: @ 811BA78
movs r4, 0
_0811BA7C:
adds r0, r4, 0
- bl sub_811B5DC
+ bl IsUnionRoomPlayerHidden
cmp r0, 0
bne _0811BA92
adds r0, r4, 0
diff --git a/data/rfu_union_tool.s b/data/rfu_union_tool.s
index b0f87c282..0c6460116 100644
--- a/data/rfu_union_tool.s
+++ b/data/rfu_union_tool.s
@@ -6,36 +6,6 @@
.section .rodata
.align 2
-gUnknown_84570D8:: @ 84570D8
- .byte 0x29, 0x36, 0x27, 0x12, 0x13, 0x14, 0x19, 0x1A, 0x00, 0x00, 0x2A, 0x3A, 0x28, 0x16, 0x17, 0x18, 0x1C, 0x1D, 0x00, 0x00
-
-gUnknown_84570EC:: @ 84570EC
- .2byte 0x0004
- .2byte 0x0006
- .2byte 0x000D
- .2byte 0x0008
- .2byte 0x000A
- .2byte 0x0006
- .2byte 0x0001
- .2byte 0x0008
- .2byte 0x000D
- .2byte 0x0004
- .2byte 0x0007
- .2byte 0x0004
- .2byte 0x0001
- .2byte 0x0004
- .2byte 0x0007
- .2byte 0x0008
-
-gUnknown_845710C:: @ 845710C
- .byte 0x00, 0x00, 0x01, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x01
-
-gUnknown_8457116:: @ 8457116
- .byte 0x00, 0x02, 0x01, 0x04, 0x03
-
-gUnknown_845711B:: @ 845711B
- .byte 0x01, 0x03, 0x01, 0x04, 0x02
-
gUnknown_8457120:: @ 8457120
.byte 0x09, 0x08, 0x07, 0x02, 0x06, 0x05, 0x04, 0x03, 0x63, 0x00, 0x64, 0x00, 0x65, 0x00, 0x66, 0x00, 0x67, 0x00, 0x68, 0x00, 0x69, 0x00, 0x6A, 0x00
diff --git a/include/rfu_union_tool.h b/include/rfu_union_tool.h
index 46e448e83..4672d8c61 100644
--- a/include/rfu_union_tool.h
+++ b/include/rfu_union_tool.h
@@ -1,6 +1,8 @@
#ifndef GUARD_UNION_ROOM_PLAYER_AVATAR_H
#define GUARD_UNION_ROOM_PLAYER_AVATAR_H
+#include "union_room.h"
+
void sub_811C1C8(void);
void sub_811BAAC(u8 *spriteIds, s32 arg1);
void sub_811BB40(u8 *spriteIds);
diff --git a/include/union_room.h b/include/union_room.h
index f9abd3d9f..00ed90a14 100644
--- a/include/union_room.h
+++ b/include/union_room.h
@@ -2,7 +2,7 @@
#define GUARD_UNION_ROOM_H
#include "global.h"
-#include "librfu.h"
+#include "link_rfu.h"
struct UnkStruct_Shared
{
diff --git a/ld_script.txt b/ld_script.txt
index 22ac7dd54..e1079704f 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -242,6 +242,7 @@ SECTIONS {
src/menu.o(.text);
src/quest_log.o(.text);
src/union_room.o(.text);
+ src/rfu_union_tool.o(.text);
asm/rfu_union_tool.o(.text);
asm/pokemon_special_anim.o(.text);
src/party_menu.o(.text);
@@ -528,6 +529,7 @@ SECTIONS {
src/menu.o(.rodata);
src/quest_log.o(.rodata);
src/union_room.o(.rodata);
+ src/rfu_union_tool.o(.rodata);
data/rfu_union_tool.o(.rodata);
data/union_room_message.o(.rodata);
data/pokemon_special_anim.o(.rodata);
diff --git a/src/rfu_union_tool.c b/src/rfu_union_tool.c
new file mode 100644
index 000000000..d50187b56
--- /dev/null
+++ b/src/rfu_union_tool.c
@@ -0,0 +1,80 @@
+#include "global.h"
+#include "event_data.h"
+#include "rfu_union_tool.h"
+#include "constants/flags.h"
+
+const u8 gUnknown_84570D8[][10] = {
+ {0x29, 0x36, 0x27, 0x12, 0x13, 0x14, 0x19, 0x1A},
+ {0x2A, 0x3A, 0x28, 0x16, 0x17, 0x18, 0x1C, 0x1D}
+};
+
+const s16 gUnknown_84570EC[][2] = {
+ {0x4, 0x6},
+ {0xd, 0x8},
+ {0xa, 0x6},
+ {0x1, 0x8},
+ {0xd, 0x4},
+ {0x7, 0x4},
+ {0x1, 0x4},
+ {0x7, 0x8}
+};
+
+const s8 gUnknown_845710C[][2] = {
+ { 0, 0},
+ { 1, 0},
+ { 0, -1},
+ {-1, 0},
+ { 0, 1}
+};
+
+const u8 gUnknown_8457116[] = {
+ 0x00, 0x02, 0x01, 0x04, 0x03
+};
+
+const u8 gUnknown_845711B[] = {
+ 0x01, 0x03, 0x01, 0x04, 0x02
+};
+
+bool32 is_walking_or_running(void)
+{
+ if (gPlayerAvatar.tileTransitionState == 2 || gPlayerAvatar.tileTransitionState == 0)
+ {
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+}
+
+u8 sub_811B524(u32 a0, u32 a1)
+{
+ return gUnknown_84570D8[a0][a1 % 8];
+}
+
+void sub_811B53C(u32 a0, u32 a1, s32 * a2, s32 * a3)
+{
+ *a2 = gUnknown_84570EC[a0][0] + gUnknown_845710C[a1][0] + 7;
+ *a3 = gUnknown_84570EC[a0][1] + gUnknown_845710C[a1][1] + 7;
+}
+
+bool32 sub_811B58C(u32 a0, u32 a1, s32 a2, s32 a3)
+{
+ if (gUnknown_84570EC[a0][0] + gUnknown_845710C[a1][0] + 7 != a2)
+ {
+ return FALSE;
+ }
+ else if (gUnknown_84570EC[a0][1] + gUnknown_845710C[a1][1] + 7 != a3)
+ {
+ return FALSE;
+ }
+ else
+ {
+ return TRUE;
+ }
+}
+//
+//bool32 IsUnionRoomPlayerHidden(u32 player_idx)
+//{
+// return FlagGet(FLAG_HIDE_UNION_ROOM_PLAYER_1 + player_idx);
+//}