From b97c600b8203dc08a7a0084f620a6a4242437ad5 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Mon, 21 Jul 2025 08:04:50 -0500 Subject: [PATCH] sub_47FF8 --- asm/rom_3219C.s | 159 ------------------------------------------------ src/rom_49A34.c | 43 +++++++++++++ 2 files changed, 43 insertions(+), 159 deletions(-) diff --git a/asm/rom_3219C.s b/asm/rom_3219C.s index 68ba3c1..ca2810e 100644 --- a/asm/rom_3219C.s +++ b/asm/rom_3219C.s @@ -33502,162 +33502,3 @@ _08047FE8: .4byte 0x000001FF _08047FEC: .4byte 0x040000D4 _08047FF0: .4byte 0x06002000 _08047FF4: .4byte 0x80000400 - - thumb_func_start sub_47FF8 -sub_47FF8: @ 0x08047FF8 - push {r4, lr} - ldr r2, _08048068 @ =gMain - ldrh r1, [r2, #0x1c] - movs r0, #1 - ands r0, r1 - cmp r0, #0 - beq _08048074 - movs r0, #0x40 - ands r0, r1 - ldr r3, _0804806C @ =gCurrentPinballGame - cmp r0, #0 - beq _0804801E - ldr r0, [r3] - ldr r1, _08048070 @ =0x0000132C - adds r0, r0, r1 - ldr r1, [r0] - ldr r0, [r1, #0x38] - subs r0, #0x80 - str r0, [r1, #0x38] -_0804801E: - ldrh r1, [r2, #0x1c] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _08048036 - ldr r0, [r3] - ldr r4, _08048070 @ =0x0000132C - adds r0, r0, r4 - ldr r1, [r0] - ldr r0, [r1, #0x38] - adds r0, #0x80 - str r0, [r1, #0x38] -_08048036: - ldrh r1, [r2, #0x1c] - movs r0, #0x20 - ands r0, r1 - cmp r0, #0 - beq _0804804E - ldr r0, [r3] - ldr r1, _08048070 @ =0x0000132C - adds r0, r0, r1 - ldr r1, [r0] - ldr r0, [r1, #0x34] - subs r0, #0x80 - str r0, [r1, #0x34] -_0804804E: - ldrh r1, [r2, #0x1c] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _080480E0 - ldr r0, [r3] - ldr r2, _08048070 @ =0x0000132C - adds r0, r0, r2 - ldr r1, [r0] - ldr r0, [r1, #0x34] - adds r0, #0x80 - b _080480DE - .align 2, 0 -_08048068: .4byte gMain -_0804806C: .4byte gCurrentPinballGame -_08048070: .4byte 0x0000132C -_08048074: - movs r0, #0x40 - ands r0, r1 - ldr r3, _08048118 @ =gCurrentPinballGame - cmp r0, #0 - beq _0804808E - ldr r0, [r3] - ldr r4, _0804811C @ =0x0000132C - adds r0, r0, r4 - ldr r1, [r0] - ldr r0, [r1, #0x38] - ldr r4, _08048120 @ =0xFFFFFE00 - adds r0, r0, r4 - str r0, [r1, #0x38] -_0804808E: - ldrh r1, [r2, #0x1c] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _080480AA - ldr r0, [r3] - ldr r1, _0804811C @ =0x0000132C - adds r0, r0, r1 - ldr r1, [r0] - ldr r0, [r1, #0x38] - movs r4, #0x80 - lsls r4, r4, #2 - adds r0, r0, r4 - str r0, [r1, #0x38] -_080480AA: - ldrh r1, [r2, #0x1c] - movs r0, #0x20 - ands r0, r1 - cmp r0, #0 - beq _080480C4 - ldr r0, [r3] - ldr r1, _0804811C @ =0x0000132C - adds r0, r0, r1 - ldr r1, [r0] - ldr r0, [r1, #0x34] - ldr r4, _08048120 @ =0xFFFFFE00 - adds r0, r0, r4 - str r0, [r1, #0x34] -_080480C4: - ldrh r1, [r2, #0x1c] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _080480E0 - ldr r0, [r3] - ldr r1, _0804811C @ =0x0000132C - adds r0, r0, r1 - ldr r1, [r0] - ldr r0, [r1, #0x34] - movs r2, #0x80 - lsls r2, r2, #2 - adds r0, r0, r2 -_080480DE: - str r0, [r1, #0x34] -_080480E0: - ldr r0, [r3] - ldr r4, _0804811C @ =0x0000132C - adds r2, r0, r4 - ldr r1, [r2] - ldr r0, [r1, #0x28] - str r0, [r1, #0x2c] - ldr r1, [r2] - ldr r0, [r1, #0x34] - cmp r0, #0 - bge _080480F6 - adds r0, #0x7f -_080480F6: - asrs r0, r0, #7 - movs r3, #0 - strh r0, [r1, #0x28] - ldr r1, [r2] - ldr r0, [r1, #0x38] - cmp r0, #0 - bge _08048106 - adds r0, #0x7f -_08048106: - asrs r0, r0, #7 - strh r0, [r1, #0x2a] - ldr r0, [r2] - strh r3, [r0, #0x30] - ldr r0, [r2] - strh r3, [r0, #0x32] - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_08048118: .4byte gCurrentPinballGame -_0804811C: .4byte 0x0000132C -_08048120: .4byte 0xFFFFFE00 diff --git a/src/rom_49A34.c b/src/rom_49A34.c index 08781be..2b6dca8 100644 --- a/src/rom_49A34.c +++ b/src/rom_49A34.c @@ -10,6 +10,48 @@ extern const u8 gUnknown_08510CAC[][0x20]; extern const u8 gUnknown_0850558C[][0x20]; extern const s8 gUnknown_086B0128[][3][20]; +void sub_47FF8(void) +{ + int newX, newY; + + if (JOY_HELD(A_BUTTON)) + { + if (JOY_HELD(DPAD_UP)) + gCurrentPinballGame->ball->positionQ8.y -= 0x80; + if (JOY_HELD(DPAD_DOWN)) + gCurrentPinballGame->ball->positionQ8.y += 0x80; + if (JOY_HELD(DPAD_LEFT)) + gCurrentPinballGame->ball->positionQ8.x -= 0x80; + if (JOY_HELD(DPAD_RIGHT)) + gCurrentPinballGame->ball->positionQ8.x += 0x80; + } + else + { + if (JOY_HELD(DPAD_UP)) + gCurrentPinballGame->ball->positionQ8.y -= 0x200; + if (JOY_HELD(DPAD_DOWN)) + gCurrentPinballGame->ball->positionQ8.y += 0x200; + if (JOY_HELD(DPAD_LEFT)) + gCurrentPinballGame->ball->positionQ8.x -= 0x200; + if (JOY_HELD(DPAD_RIGHT)) + gCurrentPinballGame->ball->positionQ8.x += 0x200; + } + + gCurrentPinballGame->ball->prevPositionQ1 = gCurrentPinballGame->ball->positionQ1; + newX = gCurrentPinballGame->ball->positionQ8.x; + if (newX < 0) + newX += 0x7F; + gCurrentPinballGame->ball->positionQ1.x = newX >> 7; + + newY = gCurrentPinballGame->ball->positionQ8.y; + if (newY < 0) + newY += 0x7F; + gCurrentPinballGame->ball->positionQ1.y = newY >> 7; + + gCurrentPinballGame->ball->velocity.x = 0; + gCurrentPinballGame->ball->velocity.y = 0; +} + void sub_48124(void) { if (JOY_NEW(DPAD_UP)) @@ -22,6 +64,7 @@ void sub_48124(void) gCurrentPinballGame->ballSpeed^= 1; } +// This function updates/draws the "End of Ball Bonus" summary void sub_48190(void) { int i, j;