summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2017-05-15 22:29:34 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2017-05-15 22:29:34 -0400
commitfa1fa0aaed315be804d76eaf116e633d6c535c73 (patch)
tree4ef003bb72d74f0bcf7ed8e2df47a124518eb8fc /src
parentd091a292b1159f3cd798c7c259e75c6fe6e27460 (diff)
Get sub_80BB764 matching
Diffstat (limited to 'src')
-rwxr-xr-xsrc/secret_base_80bb4ac.c112
1 files changed, 14 insertions, 98 deletions
diff --git a/src/secret_base_80bb4ac.c b/src/secret_base_80bb4ac.c
index 5a07e8b65..7e64a7083 100755
--- a/src/secret_base_80bb4ac.c
+++ b/src/secret_base_80bb4ac.c
@@ -106,17 +106,11 @@ s16 unref_sub_80BB724(u16 *a0, u8 a1) {
return -1;
}
-#ifdef NONMATCHING
void sub_80BB764(s16 *arg1, s16 *arg2, u16 arg3) {
- s16 height = gMapHeader.mapData->height;
- s16 width = gMapHeader.mapData->width;
- s16 x;
- s16 y;
- u16 *row;
- for (y=0; y<height; y++) {
- row = &(gMapHeader.mapData->map[y * width]);
- for (x=0; x<width; x++) {
- if ((row[x] & 0x3ff) == arg3) {
+ s16 x, y;
+ for (y=0; y<gMapHeader.mapData->height; y++) {
+ for (x=0; x<gMapHeader.mapData->width; x++) {
+ if ((gMapHeader.mapData->map[y * gMapHeader.mapData->width + x] & 0x3ff) == arg3) {
*arg1 = x;
*arg2 = y;
return;
@@ -124,91 +118,13 @@ void sub_80BB764(s16 *arg1, s16 *arg2, u16 arg3) {
}
}
}
-#else
-__attribute__((naked))
-void sub_80BB764(s16 *arg1, s16 *arg2, u16 arg3) {
- asm(".syntax unified\n\
- push {r4-r7,lr}\n\
- mov r7, r10\n\
- mov r6, r9\n\
- mov r5, r8\n\
- push {r5-r7}\n\
- sub sp, 0x8\n\
- mov r9, r0\n\
- mov r10, r1\n\
- lsls r2, 16\n\
- lsrs r2, 16\n\
- mov r8, r2\n\
- movs r0, 0\n\
- mov r12, r0\n\
- ldr r1, _080BB7C8 @ =gMapHeader\n\
- ldr r0, [r1]\n\
- ldr r3, [r0, 0x4]\n\
- cmp r12, r3\n\
- bge _080BB7EE\n\
- ldr r0, [r0]\n\
- str r0, [sp, 0x4]\n\
- str r3, [sp]\n\
- _080BB78E:\n\
- movs r2, 0\n\
- mov r1, r12\n\
- lsls r7, r1, 16\n\
- ldr r0, [sp, 0x4]\n\
- cmp r2, r0\n\
- bge _080BB7DC\n\
- ldr r0, _080BB7C8 @ =gMapHeader\n\
- ldr r1, [r0]\n\
- asrs r0, r7, 16\n\
- ldr r4, [r1]\n\
- adds r6, r0, 0\n\
- muls r6, r4\n\
- ldr r5, [r1, 0xC]\n\
- _080BB7A8:\n\
- lsls r0, r2, 16\n\
- asrs r3, r0, 16\n\
- adds r0, r6, r3\n\
- lsls r0, 1\n\
- adds r0, r5\n\
- ldrh r1, [r0]\n\
- ldr r0, _080BB7CC @ =0x000003ff\n\
- ands r0, r1\n\
- cmp r0, r8\n\
- bne _080BB7D0\n\
- mov r1, r9\n\
- strh r2, [r1]\n\
- mov r1, r12\n\
- mov r0, r10\n\
- strh r1, [r0]\n\
- b _080BB7EE\n\
- .align 2, 0\n\
- _080BB7C8: .4byte gMapHeader\n\
- _080BB7CC: .4byte 0x000003ff\n\
- _080BB7D0:\n\
- adds r0, r3, 0x1\n\
- lsls r0, 16\n\
- lsrs r2, r0, 16\n\
- asrs r0, 16\n\
- cmp r0, r4\n\
- blt _080BB7A8\n\
- _080BB7DC:\n\
- movs r1, 0x80\n\
- lsls r1, 9\n\
- adds r0, r7, r1\n\
- lsrs r1, r0, 16\n\
- mov r12, r1\n\
- asrs r0, 16\n\
- ldr r1, [sp]\n\
- cmp r0, r1\n\
- blt _080BB78E\n\
- _080BB7EE:\n\
- add sp, 0x8\n\
- pop {r3-r5}\n\
- mov r8, r3\n\
- mov r9, r4\n\
- mov r10, r5\n\
- pop {r4-r7}\n\
- pop {r0}\n\
- bx r0\n\
- .syntax divided\n");
-}
-#endif
+
+// void sub_80BB800(void) {
+ // s16 x, y;
+ // u16 v0, v1;
+ // GetXYCoordsOneStepInFrontOfPlayer(&x, &y);
+ // v1 = MapGridGetMetatileIdAt(x, y);
+ // for (v0=0; v0<7; v0++) {
+ // if (gUnknown_083D1358[v0] == v1)
+ // }
+// }