From efd23cb91b402ff44cf8139490ae37cf6990d1be Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 24 Nov 2017 20:06:29 -0500 Subject: [PATCH] Cb2_ViewWallClock --- asm/wallclock.s | 147 --------------------------------------------- include/graphics.h | 3 +- include/strings.h | 1 + src/wallclock.c | 47 ++++++++++++++- 4 files changed, 48 insertions(+), 150 deletions(-) diff --git a/asm/wallclock.s b/asm/wallclock.s index 0ca39b897..bf36815c5 100644 --- a/asm/wallclock.s +++ b/asm/wallclock.s @@ -5,153 +5,6 @@ .text - thumb_func_start Cb2_ViewWallClock -Cb2_ViewWallClock: @ 8134B44 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - bl LoadWallClockGraphics - ldr r0, =gUnknown_08DCC908 - ldr r1, =0x06003800 - bl LZ77UnCompVram - ldr r0, =sub_8134F10 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r7, r0, 24 - adds r0, r7, 0 - bl sub_8135130 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - movs r1, 0x12 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08134B9C - movs r2, 0x2D - mov r10, r2 - movs r0, 0x5A - str r0, [sp, 0xC] - b _08134BA4 - .pool -_08134B9C: - movs r1, 0x5A - mov r10, r1 - movs r2, 0x87 - str r2, [sp, 0xC] -_08134BA4: - ldr r0, =gUnknown_085B2250 - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0x1 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r6, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - movs r0, 0 - mov r9, r0 - strh r7, [r1, 0x2E] - ldrb r2, [r1, 0x1] - movs r5, 0x4 - negs r5, r5 - adds r0, r5, 0 - ands r0, r2 - movs r2, 0x1 - mov r8, r2 - mov r2, r8 - orrs r0, r2 - strb r0, [r1, 0x1] - ldrb r2, [r1, 0x3] - movs r4, 0x3F - negs r4, r4 - adds r0, r4, 0 - ands r0, r2 - strb r0, [r1, 0x3] - ldr r0, =gUnknown_085B2268 - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - strh r7, [r1, 0x2E] - ldrb r0, [r1, 0x1] - ands r5, r0 - mov r0, r8 - orrs r5, r0 - strb r5, [r1, 0x1] - ldrb r0, [r1, 0x3] - ands r4, r0 - movs r0, 0x2 - orrs r4, r0 - strb r4, [r1, 0x3] - ldr r0, =gUnknown_085B22A0 - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - strh r7, [r1, 0x2E] - mov r2, r10 - strh r2, [r1, 0x30] - ldr r0, =gUnknown_085B22B8 - movs r1, 0x78 - movs r2, 0x50 - movs r3, 0x2 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - strh r7, [r1, 0x2E] - mov r0, sp - ldrh r0, [r0, 0xC] - strh r0, [r1, 0x30] - bl sub_813498C - ldr r2, =gText_Cancel4 - movs r0, 0x1 - str r0, [sp] - mov r1, r9 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end Cb2_ViewWallClock - thumb_func_start sub_8134C9C sub_8134C9C: @ 8134C9C push {lr} diff --git a/include/graphics.h b/include/graphics.h index 528b7f49f..25a5431c6 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -94,6 +94,7 @@ extern const u8 gUnknown_08DBA12C[]; extern const u8 gUnknown_08DCC05C[]; extern const u16 gUnknown_08DCC01C[]; extern const u16 gUnknown_08DCC03C[]; -extern const u16 gUnknown_08DCC648[]; +extern const u8 gUnknown_08DCC648[]; +extern const u8 gUnknown_08DCC908[]; #endif //GUARD_GRAPHICS_H diff --git a/include/strings.h b/include/strings.h index 17ecdd565..b54c68c6e 100644 --- a/include/strings.h +++ b/include/strings.h @@ -83,5 +83,6 @@ extern const u8 gText_OkayToDeleteFromRegistry[]; extern const u8 gText_RegisteredDataDeleted[]; extern const u8 gUnknown_085EA79D[]; extern const u8 gText_Confirm3[]; +extern const u8 gText_Cancel4[]; #endif //GUARD_STRINGS_H diff --git a/src/wallclock.c b/src/wallclock.c index 2676bbf53..bb6f4cd19 100644 --- a/src/wallclock.c +++ b/src/wallclock.c @@ -23,6 +23,8 @@ void sub_8134C9C(void); void sub_8134CB8(u8 taskId); +void sub_8134F10(u8 taskId); +void sub_8135130(u8 taskId); void sub_81351AC(struct Sprite *sprite); void sub_8135244(struct Sprite *sprite); void sub_81352DC(struct Sprite *sprite); @@ -238,12 +240,53 @@ void Cb2_StartWallClock(void) gSprites[spriteId].oam.matrixNum = 1; spriteId = CreateSprite(&gUnknown_085B22A0, 0x78, 0x50, 2); gSprites[spriteId].data0 = taskId; - gSprites[spriteId].data1 = 0x2d; + gSprites[spriteId].data1 = 45; spriteId = CreateSprite(&gUnknown_085B22B8, 0x78, 0x50, 2); gSprites[spriteId].data0 = taskId; - gSprites[spriteId].data1 = 0x5a; + gSprites[spriteId].data1 = 90; sub_813498C(); PrintTextOnWindow(1, 1, gText_Confirm3, 0, 1, 0, NULL); PutWindowTilemap(1); schedule_bg_copy_tilemap_to_vram(2); } + +void Cb2_ViewWallClock(void) +{ + u8 taskId; + u8 spriteId; + u8 r10; + u8 spc; + + LoadWallClockGraphics(); + LZ77UnCompVram(gUnknown_08DCC908, (u16 *)BG_SCREEN_ADDR(7)); + taskId = CreateTask(sub_8134F10, 0); + sub_8135130(taskId); + if (gTasks[taskId].data[5] == 0) + { + r10 = 45; + spc = 90; + } + else + { + r10 = 90; + spc = 135; + } + spriteId = CreateSprite(&gUnknown_085B2250, 0x78, 0x50, 1); + gSprites[spriteId].data0 = taskId; + gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + gSprites[spriteId].oam.matrixNum = 0; + spriteId = CreateSprite(&gUnknown_085B2268, 0x78, 0x50, 0); + gSprites[spriteId].data0 = taskId; + gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + gSprites[spriteId].oam.matrixNum = 1; + spriteId = CreateSprite(&gUnknown_085B22A0, 0x78, 0x50, 2); + gSprites[spriteId].data0 = taskId; + gSprites[spriteId].data1 = r10; + spriteId = CreateSprite(&gUnknown_085B22B8, 0x78, 0x50, 2); + gSprites[spriteId].data0 = taskId; + gSprites[spriteId].data1 = spc; + sub_813498C(); + PrintTextOnWindow(1, 1, gText_Cancel4, 0, 1, 0, NULL); + PutWindowTilemap(1); + schedule_bg_copy_tilemap_to_vram(2); +}