summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2019-05-06 18:31:13 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2019-05-06 18:31:13 -0400
commit7f63cdfe25fad0761aec347b1260ec3c1d63f109 (patch)
treedc1c225de7d1dc3316cf79b7ed9780eda6229f39
parente9e87a0fe47406b5d2881b9360886842b8731c97 (diff)
Decompile two seagallop-related functions stuck in unk_8147500
-rw-r--r--asm/unk_8147500.s112
-rw-r--r--src/seagallop.c39
2 files changed, 39 insertions, 112 deletions
diff --git a/asm/unk_8147500.s b/asm/unk_8147500.s
index 53fc6a8a0..1af1fd10b 100644
--- a/asm/unk_8147500.s
+++ b/asm/unk_8147500.s
@@ -5,118 +5,6 @@
.text
- thumb_func_start sub_8147500
-sub_8147500: @ 8147500
- push {lr}
- ldr r0, _08147518 @ =gSpecialVar_0x8004
- ldrh r1, [r0]
- ldr r0, _0814751C @ =gSpecialVar_0x8006
- ldrh r2, [r0]
- cmp r1, 0x8
- beq _08147512
- cmp r2, 0x8
- bne _08147520
-_08147512:
- movs r0, 0x1
- b _0814758E
- .align 2, 0
-_08147518: .4byte gSpecialVar_0x8004
-_0814751C: .4byte gSpecialVar_0x8006
-_08147520:
- cmp r1, 0
- beq _08147528
- cmp r2, 0
- bne _0814752C
-_08147528:
- movs r0, 0x7
- b _0814758E
-_0814752C:
- cmp r1, 0x9
- beq _08147534
- cmp r2, 0x9
- bne _08147538
-_08147534:
- movs r0, 0xA
- b _0814758E
-_08147538:
- cmp r1, 0xA
- beq _08147540
- cmp r2, 0xA
- bne _08147544
-_08147540:
- movs r0, 0xC
- b _0814758E
-_08147544:
- subs r0, r1, 0x1
- lsls r0, 16
- lsrs r0, 16
- cmp r0, 0x2
- bhi _0814755C
- subs r0, r2, 0x1
- lsls r0, 16
- lsrs r0, 16
- cmp r0, 0x2
- bhi _0814755C
- movs r0, 0x2
- b _0814758E
-_0814755C:
- subs r0, r1, 0x4
- lsls r0, 16
- lsrs r0, 16
- cmp r0, 0x1
- bhi _08147574
- subs r0, r2, 0x4
- lsls r0, 16
- lsrs r0, 16
- cmp r0, 0x1
- bhi _08147574
- movs r0, 0x3
- b _0814758E
-_08147574:
- subs r0, r1, 0x6
- lsls r0, 16
- lsrs r0, 16
- cmp r0, 0x1
- bhi _0814758C
- subs r0, r2, 0x6
- lsls r0, 16
- lsrs r0, 16
- cmp r0, 0x1
- bhi _0814758C
- movs r0, 0x5
- b _0814758E
-_0814758C:
- movs r0, 0x6
-_0814758E:
- pop {r1}
- bx r1
- thumb_func_end sub_8147500
-
- thumb_func_start sub_8147594
-sub_8147594: @ 8147594
- push {lr}
- ldr r0, _081475B0 @ =gSaveBlock1Ptr
- ldr r2, [r0]
- ldrh r1, [r2, 0x4]
- ldr r0, _081475B4 @ =0x00000503
- cmp r1, r0
- bne _081475B8
- movs r1, 0
- ldrsh r0, [r2, r1]
- cmp r0, 0x17
- bgt _081475B8
- movs r0, 0x1
- b _081475BA
- .align 2, 0
-_081475B0: .4byte gSaveBlock1Ptr
-_081475B4: .4byte 0x00000503
-_081475B8:
- movs r0, 0
-_081475BA:
- pop {r1}
- bx r1
- thumb_func_end sub_8147594
-
thumb_func_start sub_81475C0
sub_81475C0: @ 81475C0
push {r4,r5,lr}
diff --git a/src/seagallop.c b/src/seagallop.c
index 39fb2b6df..e02b0887b 100644
--- a/src/seagallop.c
+++ b/src/seagallop.c
@@ -458,3 +458,42 @@ static bool8 GetDirectionOfTravel(void)
}
return (sTravelDirectionMatrix[gSpecialVar_0x8004] >> gSpecialVar_0x8006) & 1;
}
+
+u8 sub_8147500(void)
+{
+ u16 originId, destId;
+
+ originId = gSpecialVar_0x8004;
+ destId = gSpecialVar_0x8006;
+
+ if (originId == SEAGALLOP_CINNABAR_ISLAND || destId == SEAGALLOP_CINNABAR_ISLAND)
+ return 1;
+
+ if (originId == SEAGALLOP_VERMILION_CITY || destId == SEAGALLOP_VERMILION_CITY)
+ return 7;
+
+ if (originId == SEAGALLOP_NAVEL_ROCK || destId == SEAGALLOP_NAVEL_ROCK)
+ return 10;
+
+ if (originId == SEAGALLOP_BIRTH_ISLAND || destId == SEAGALLOP_BIRTH_ISLAND)
+ return 12;
+
+ if ((originId == SEAGALLOP_ONE_ISLAND || originId == SEAGALLOP_TWO_ISLAND || originId == SEAGALLOP_THREE_ISLAND) && (destId == SEAGALLOP_ONE_ISLAND || destId == SEAGALLOP_TWO_ISLAND || destId == SEAGALLOP_THREE_ISLAND))
+ return 2;
+
+ if ((originId == SEAGALLOP_FOUR_ISLAND || originId == SEAGALLOP_FIVE_ISLAND) && (destId == SEAGALLOP_FOUR_ISLAND || destId == SEAGALLOP_FIVE_ISLAND))
+ return 3;
+
+ if ((originId == SEAGALLOP_SIX_ISLAND || originId == SEAGALLOP_SEVEN_ISLAND) && (destId == SEAGALLOP_SIX_ISLAND || destId == SEAGALLOP_SEVEN_ISLAND))
+ return 5;
+
+ return 6;
+}
+
+bool8 sub_8147594(void)
+{
+ if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(VERMILIONCITY) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(VERMILIONCITY) && gSaveBlock1Ptr->pos.x < 24)
+ return TRUE;
+
+ return FALSE;
+}