summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2017-06-03 22:12:23 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2017-06-03 22:12:23 -0400
commit82373556f8ff16a6b532011c04c9128be814d160 (patch)
treec292bc60ee1298767345fab4c30fb18252e6696f
parent88181cf35b084689ee6b1a2dd2bdd4b32cbd4e80 (diff)
Another set of small subroutines in decoration
-rwxr-xr-xasm/decoration.s130
-rwxr-xr-xinclude/decoration.h7
-rwxr-xr-xsrc/decoration.c38
3 files changed, 41 insertions, 134 deletions
diff --git a/asm/decoration.s b/asm/decoration.s
index e8441e9a8..fefc90ce6 100755
--- a/asm/decoration.s
+++ b/asm/decoration.s
@@ -8,136 +8,6 @@
.equiv ewram_1f000, 0x0201f000
- thumb_func_start sub_810065C
-sub_810065C: @ 810065C
- push {r4,lr}
- adds r4, r0, 0
- lsls r4, 24
- lsrs r4, 24
- movs r0, 0
- movs r1, 0
- movs r2, 0x1D
- movs r3, 0x13
- bl MenuZeroFillWindowRect
- ldr r2, _08100698 @ =gSprites
- ldr r0, _0810069C @ =gUnknown_020391A8
- ldrb r1, [r0]
- lsls r0, r1, 4
- adds r0, r1
- lsls r0, 2
- adds r0, r2
- movs r2, 0
- strh r2, [r0, 0x3C]
- ldr r1, _081006A0 @ =gTasks
- lsls r0, r4, 2
- adds r0, r4
- lsls r0, 3
- adds r0, r1
- strh r2, [r0, 0x1C]
- ldr r1, _081006A4 @ =sub_8100494
- str r1, [r0]
- pop {r4}
- pop {r0}
- bx r0
- .align 2, 0
-_08100698: .4byte gSprites
-_0810069C: .4byte gUnknown_020391A8
-_081006A0: .4byte gTasks
-_081006A4: .4byte sub_8100494
- thumb_func_end sub_810065C
-
- thumb_func_start sub_81006A8
-sub_81006A8: @ 81006A8
- push {lr}
- lsls r0, 24
- lsrs r2, r0, 24
- ldr r0, _081006CC @ =gMain
- ldrh r1, [r0, 0x2E]
- movs r0, 0x1
- ands r0, r1
- cmp r0, 0
- bne _081006C2
- movs r0, 0x2
- ands r0, r1
- cmp r0, 0
- beq _081006C8
-_081006C2:
- adds r0, r2, 0
- bl sub_810065C
-_081006C8:
- pop {r0}
- bx r0
- .align 2, 0
-_081006CC: .4byte gMain
- thumb_func_end sub_81006A8
-
- thumb_func_start sub_81006D0
-sub_81006D0: @ 81006D0
- push {r4,r5,lr}
- adds r3, r0, 0
- movs r1, 0
- adds r2, r3, 0
- adds r2, 0x84
- movs r5, 0
- ldr r4, _08100708 @ =0x000007ff
-_081006DE:
- adds r0, r2, r1
- strb r5, [r0]
- adds r0, r1, 0x1
- lsls r0, 16
- lsrs r1, r0, 16
- cmp r1, r4
- bls _081006DE
- movs r1, 0
- adds r2, r3, 0x4
- movs r3, 0
-_081006F2:
- lsls r0, r1, 1
- adds r0, r2, r0
- strh r3, [r0]
- adds r0, r1, 0x1
- lsls r0, 16
- lsrs r1, r0, 16
- cmp r1, 0x3F
- bls _081006F2
- pop {r4,r5}
- pop {r0}
- bx r0
- .align 2, 0
-_08100708: .4byte 0x000007ff
- thumb_func_end sub_81006D0
-
- thumb_func_start sub_810070C
-sub_810070C: @ 810070C
- push {r4,r5,lr}
- adds r5, r0, 0
- lsls r1, 16
- movs r2, 0
- ldr r0, _0810073C @ =gMapHeader
- ldr r0, [r0]
- ldr r0, [r0, 0x10]
- lsrs r4, r1, 12
- ldr r3, [r0, 0x8]
-_0810071E:
- lsls r1, r2, 1
- adds r1, r5
- adds r0, r4, r2
- lsls r0, 1
- adds r0, r3
- ldrh r0, [r0]
- strh r0, [r1]
- adds r0, r2, 0x1
- lsls r0, 16
- lsrs r2, r0, 16
- cmp r2, 0xF
- bls _0810071E
- pop {r4,r5}
- pop {r0}
- bx r0
- .align 2, 0
-_0810073C: .4byte gMapHeader
- thumb_func_end sub_810070C
-
thumb_func_start sub_8100740
sub_8100740: @ 8100740
push {r4-r7,lr}
diff --git a/include/decoration.h b/include/decoration.h
index fd25fe27b..83090ae40 100755
--- a/include/decoration.h
+++ b/include/decoration.h
@@ -168,9 +168,8 @@ extern u8 ewram[];
struct UnkStruct_02038900
{
struct Decoration *decoration;
- u8 pad_004[0x18];
- u16 *unk_01C;
- u8 pad_020[0x864];
+ u16 unk_004[0x40];
+ u8 unk_084[0x800];
u16 unk_884[16];
};
@@ -273,7 +272,7 @@ void sub_810045C(void);
void sub_810065C(u8);
void sub_81006A8(u8);
void sub_81006D0(struct UnkStruct_02038900 *);
-void sub_810070C(u16 *, int);
+void sub_810070C(u16 *, u16);
void sub_8100874(struct UnkStruct_02038900 *);
void sub_81008BC(struct UnkStruct_02038900 *);
void sub_8100930(u8);
diff --git a/src/decoration.c b/src/decoration.c
index 5387ad27d..58537ec0e 100755
--- a/src/decoration.c
+++ b/src/decoration.c
@@ -1869,3 +1869,41 @@ void sub_8100494(u8 taskId)
}
}
}
+
+void sub_810065C(u8 taskId)
+{
+ MenuZeroFillWindowRect(0, 0, 29, 19);
+ gSprites[gUnknown_020391A8].data7 = 0;
+ gTasks[taskId].data[10] = 0;
+ gTasks[taskId].func = sub_8100494;
+}
+
+void sub_81006A8(u8 taskId)
+{
+ if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))
+ {
+ sub_810065C(taskId);
+ }
+}
+
+void sub_81006D0(struct UnkStruct_02038900 *unk_02038900)
+{
+ u16 i;
+ for (i=0; i<0x800; i++)
+ {
+ unk_02038900->unk_084[i] = 0;
+ }
+ for (i=0; i<0x40; i++)
+ {
+ unk_02038900->unk_004[i] = 0;
+ }
+}
+
+void sub_810070C(u16 *a0, u16 a1)
+{
+ u16 i;
+ for (i=0; i<16; i++)
+ {
+ a0[i] = ((u16 *)gMapHeader.mapData->primaryTileset->palettes)[16 * a1 + i];
+ }
+}