diff options
-rw-r--r-- | asm/trade.s | 80 | ||||
-rw-r--r-- | include/text.h | 2 | ||||
-rw-r--r-- | src/text.c | 4 | ||||
-rw-r--r-- | src/trade.c | 16 |
4 files changed, 19 insertions, 83 deletions
diff --git a/asm/trade.s b/asm/trade.s index b68905d0f..19fbf83d7 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -380,84 +380,4 @@ _0804AFB0: .4byte gSaveBlock1 + 0x3110 _0804AFB4: .4byte gUnknown_03004824 thumb_func_end sub_804AF84 - thumb_func_start sub_804AFB8 -sub_804AFB8: @ 804AFB8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - mov r9, r0 - mov r8, r1 - mov r10, r2 - lsls r3, 24 - lsrs r6, r3, 24 - adds r0, r6, 0x3 - lsrs r6, r0, 2 - ldr r7, _0804B054 @ =gTileBuffer - mov r0, sp - movs r5, 0 - strh r5, [r0] - lsls r4, r6, 6 - movs r0, 0x80 - lsls r0, 17 - orrs r4, r0 - mov r0, sp - adds r1, r7, 0 - adds r2, r4, 0 - bl CpuSet - mov r0, sp - adds r0, 0x2 - strh r5, [r0] - mov r2, r9 - ldrb r1, [r2, 0xD] - lsls r1, 5 - adds r1, r7 - adds r2, r4, 0 - bl CpuSet - mov r0, r9 - adds r1, r7, 0 - mov r2, r10 - bl sub_8004E3C - movs r4, 0 - cmp r4, r6 - bcs _0804B042 -_0804B010: - lsls r0, r4, 7 - adds r0, r7, r0 - lsls r1, r4, 8 - add r1, r8 - movs r2, 0x40 - bl CpuSet - lsls r0, r4, 2 - mov r1, r9 - ldrb r1, [r1, 0xD] - adds r0, r1 - lsls r0, 5 - adds r0, r7, r0 - lsls r1, r4, 3 - adds r1, 0x4 - lsls r1, 5 - add r1, r8 - movs r2, 0x40 - bl CpuSet - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r6 - bcc _0804B010 -_0804B042: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_0804B054: .4byte gTileBuffer - thumb_func_end sub_804AFB8 - .align 2, 0 @ Don't pad with nop. diff --git a/include/text.h b/include/text.h index 6b2efc7ae..b93653bc2 100644 --- a/include/text.h +++ b/include/text.h @@ -245,7 +245,7 @@ u8 sub_8004D38(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 l u8 sub_8004DB0(struct Window *win, const u8 *text, u16 tileDataStartOffset, u8 left, u8 top, u16 a6); u8 sub_8004E24(struct Window *win); void sub_8004E28(struct Window *win, u8 *foreground, u8 *background, u8 *shadow); -void sub_8004E3C(struct WindowConfig *winConfig, u8 *tileData, const u8 *text); +void sub_8004E3C(const struct WindowConfig *winConfig, u8 *tileData, const u8 *text); u8 GetStringWidthGivenWindowConfig(const struct WindowConfig *winConfig, const u8 *s); void ConvertInternationalString(u8 *s, u8 language); void StripExtCtrlCodes(u8 *str); diff --git a/src/text.c b/src/text.c index 1dc81df0c..35f74b339 100644 --- a/src/text.c +++ b/src/text.c @@ -2342,7 +2342,7 @@ u8 sub_8003490(struct Window *win, u8 c, u16 tileDataStartOffset, u8 left, u8 to void sub_80034D4(u8 *tileData, const u8 *text) { - sub_8004E3C((struct WindowConfig *)&gWindowConfig_81E6C74, tileData, text); + sub_8004E3C(&gWindowConfig_81E6C74, tileData, text); } u8 sub_80034EC(u8 *str) @@ -3645,7 +3645,7 @@ void sub_8004E28(struct Window *win, u8 *foreground, u8 *background, u8 *shadow) *shadow = win->shadowColor; } -void sub_8004E3C(struct WindowConfig *winConfig, u8 *tileData, const u8 *text) +void sub_8004E3C(const struct WindowConfig *winConfig, u8 *tileData, const u8 *text) { sTempWindow.config = winConfig; InitWindow(&sTempWindow, text, 0, 0, 0); diff --git a/src/trade.c b/src/trade.c index 13811336e..3cb292a1b 100644 --- a/src/trade.c +++ b/src/trade.c @@ -3511,6 +3511,22 @@ static bool8 sub_804ABF8(void) asm(".section .text.sub_804DAD4"); +void sub_804AFB8(const struct WindowConfig *windowConfig, u8 *dest, const u8 *src, u8 size) +{ + u8 i; + u8 *tileBuffer; + size = (size + 3) / 4; + tileBuffer = gTileBuffer; + CpuFill16(0, tileBuffer, size * 0x80); + CpuFill16(0, tileBuffer + windowConfig->width * 0x20, size * 0x80); + sub_8004E3C(windowConfig, tileBuffer, src); + for (i = 0; i < size; i ++) + { + CpuCopy16(&tileBuffer[32 * (i * 4)], &dest[32 * (i * 8)], 0x80); + CpuCopy16(&tileBuffer[32 * (i * 4 + windowConfig->width)], &dest[32 * (i * 8 + 4)], 0x80); + } +} + void sub_804B058(struct Sprite *sprite) { if (++ sprite->data0 == 10) |