diff --git a/asm/battle_frontier_2.s b/asm/battle_frontier_2.s index f92f964bb1..85bf356e42 100755 --- a/asm/battle_frontier_2.s +++ b/asm/battle_frontier_2.s @@ -14280,7 +14280,7 @@ sub_81A1C4C: @ 81A1C4C adds r3, r0, 0 lsls r0, r5, 3 adds r5, r0, 0x1 - ldr r0, =gUnknown_0203AB74 + ldr r0, =gResultsWindowId ldrb r0, [r0] lsls r3, 24 lsrs r3, 24 @@ -14306,7 +14306,7 @@ sub_81A1C90: @ 81A1C90 push {r4,lr} sub sp, 0x34 adds r2, r0, 0 - ldr r3, =gUnknown_0203AB74 + ldr r3, =gResultsWindowId movs r1, 0xAE mov r0, sp adds r0, 0x2F @@ -14361,7 +14361,7 @@ sub_81A1CD8: @ 81A1CD8 lsls r0, 24 lsrs r0, 24 adds r7, r0, 0 - ldr r0, =gUnknown_0203AB74 + ldr r0, =gResultsWindowId mov r10, r0 ldrb r0, [r0] str r7, [sp] @@ -14580,7 +14580,7 @@ sub_81A1EA8: @ 81A1EA8 sub sp, 0xC lsls r0, 24 lsrs r7, r0, 24 - ldr r4, =gUnknown_0203AB74 + ldr r4, =gResultsWindowId ldr r0, =gUnknown_08611C74 bl AddWindow strb r0, [r4] @@ -14621,7 +14621,7 @@ _081A1F28: ldr r0, =gStringVar4 movs r1, 0x2 bl sub_81A1C4C - ldr r6, =gUnknown_0203AB74 + ldr r6, =gResultsWindowId ldrb r0, [r6] ldr r2, =gText_Lv502 movs r1, 0x31 @@ -14734,7 +14734,7 @@ sub_81A2008: @ 81A2008 lsrs r6, 24 lsls r5, 24 lsrs r5, 24 - ldr r0, =gUnknown_0203AB74 + ldr r0, =gResultsWindowId mov r10, r0 ldrb r0, [r0] str r5, [sp] @@ -14868,7 +14868,7 @@ sub_81A2134: @ 81A2134 sub sp, 0xC lsls r0, 24 lsrs r7, r0, 24 - ldr r4, =gUnknown_0203AB74 + ldr r4, =gResultsWindowId ldr r0, =gUnknown_08611C74 bl AddWindow strb r0, [r4] @@ -14893,7 +14893,7 @@ _081A2184: ldr r0, =gStringVar4 movs r1, 0 bl sub_81A1C4C - ldr r1, =gUnknown_0203AB74 + ldr r1, =gResultsWindowId ldrb r0, [r1] ldr r2, =gText_Lv502 movs r6, 0x21 @@ -14905,7 +14905,7 @@ _081A2184: movs r1, 0x1 movs r3, 0x8 bl PrintTextOnWindow - ldr r1, =gUnknown_0203AB74 + ldr r1, =gResultsWindowId ldrb r0, [r1] ldr r2, =gText_OpenLv movs r1, 0x61 @@ -14988,10 +14988,10 @@ _081A2184: mov r1, r8 movs r3, 0x40 bl sub_81A2008 - ldr r1, =gUnknown_0203AB74 + ldr r1, =gResultsWindowId ldrb r0, [r1] bl PutWindowTilemap - ldr r1, =gUnknown_0203AB74 + ldr r1, =gResultsWindowId ldrb r0, [r1] movs r1, 0x3 bl CopyWindowToVram @@ -15027,7 +15027,7 @@ sub_81A22B8: @ 81A22B8 lsls r0, 24 lsrs r0, 24 adds r7, r0, 0 - ldr r0, =gUnknown_0203AB74 + ldr r0, =gResultsWindowId mov r10, r0 ldrb r0, [r0] str r7, [sp] @@ -15221,7 +15221,7 @@ sub_81A2460: @ 81A2460 sub sp, 0xC lsls r0, 24 lsrs r7, r0, 24 - ldr r4, =gUnknown_0203AB74 + ldr r4, =gResultsWindowId ldr r0, =gUnknown_08611C74 bl AddWindow strb r0, [r4] @@ -15246,7 +15246,7 @@ _081A24B0: ldr r0, =gStringVar4 movs r1, 0x2 bl sub_81A1C4C - ldr r6, =gUnknown_0203AB74 + ldr r6, =gResultsWindowId ldrb r0, [r6] ldr r2, =gText_Lv502 movs r1, 0x31 @@ -15356,7 +15356,7 @@ sub_81A258C: @ 81A258C lsrs r6, 24 lsls r5, 24 lsrs r5, 24 - ldr r0, =gUnknown_0203AB74 + ldr r0, =gResultsWindowId mov r10, r0 ldrb r0, [r0] str r5, [sp] @@ -15469,7 +15469,7 @@ sub_81A2698: @ 81A2698 mov r5, r8 push {r5-r7} sub sp, 0xC - ldr r6, =gUnknown_0203AB74 + ldr r6, =gResultsWindowId ldr r0, =gUnknown_08611C74 bl AddWindow strb r0, [r6] @@ -15608,7 +15608,7 @@ sub_81A27E8: @ 81A27E8 lsls r0, 24 lsrs r0, 24 adds r7, r0, 0 - ldr r0, =gUnknown_0203AB74 + ldr r0, =gResultsWindowId mov r10, r0 ldrb r0, [r0] str r7, [sp] @@ -15772,7 +15772,7 @@ _081A2956: sub_81A2968: @ 81A2968 push {r4-r6,lr} sub sp, 0xC - ldr r5, =gUnknown_0203AB74 + ldr r5, =gResultsWindowId ldr r0, =gUnknown_08611C74 bl AddWindow strb r0, [r5] @@ -15871,7 +15871,7 @@ sub_81A2A28: @ 81A2A28 lsls r0, 24 lsrs r0, 24 adds r6, r0, 0 - ldr r0, =gUnknown_0203AB74 + ldr r0, =gResultsWindowId mov r10, r0 ldrb r0, [r0] str r6, [sp] @@ -16147,7 +16147,7 @@ sub_81A2C94: @ 81A2C94 sub sp, 0xC lsls r0, 24 lsrs r7, r0, 24 - ldr r4, =gUnknown_0203AB74 + ldr r4, =gResultsWindowId ldr r0, =gUnknown_08611C74 bl AddWindow strb r0, [r4] @@ -16172,7 +16172,7 @@ _081A2CE0: ldr r0, =gStringVar4 movs r1, 0 bl sub_81A1C4C - ldr r0, =gUnknown_0203AB74 + ldr r0, =gResultsWindowId mov r8, r0 ldrb r0, [r0] ldr r2, =gText_Lv502 @@ -16276,7 +16276,7 @@ sub_81A2DB4: @ 81A2DB4 lsls r0, 24 lsrs r0, 24 adds r7, r0, 0 - ldr r0, =gUnknown_0203AB74 + ldr r0, =gResultsWindowId mov r10, r0 ldrb r0, [r0] str r7, [sp] @@ -16442,7 +16442,7 @@ _081A2F26: sub_81A2F38: @ 81A2F38 push {r4-r6,lr} sub sp, 0xC - ldr r5, =gUnknown_0203AB74 + ldr r5, =gResultsWindowId ldr r0, =gUnknown_08611C74 bl AddWindow strb r0, [r5] @@ -16520,7 +16520,7 @@ sub_81A2FF8: @ 81A2FF8 mov r6, r8 push {r6,r7} sub sp, 0xC - ldr r4, =gUnknown_0203AB74 + ldr r4, =gResultsWindowId ldr r0, =gUnknown_08611C7C bl AddWindow strb r0, [r4] @@ -16686,7 +16686,7 @@ _081A315C: movs r2, 0x1 movs r3, 0x4 bl ConvertIntToDecimalStringN - ldr r6, =gUnknown_0203AB74 + ldr r6, =gResultsWindowId ldrb r0, [r6] movs r1, 0x26 adds r3, r5, 0 @@ -18962,7 +18962,7 @@ sub_81A4594: @ 81A4594 sub sp, 0x2C mov r8, r1 adds r6, r3, 0 - ldr r1, =gUnknown_0203AB74 + ldr r1, =gResultsWindowId ldrb r5, [r1] lsls r4, r0, 1 adds r4, r0 @@ -18998,7 +18998,7 @@ sub_81A4594: @ 81A4594 ldrb r2, [r6, 0xE] add r0, sp, 0xC bl TVShowConvertInternationalString - ldr r1, =gUnknown_0203AB74 + ldr r1, =gResultsWindowId ldrb r0, [r1] mov r3, r8 adds r3, 0x2 @@ -19038,7 +19038,7 @@ _081A4618: adds r3, r0, 0 lsls r3, 24 lsrs r3, 24 - ldr r1, =gUnknown_0203AB74 + ldr r1, =gResultsWindowId ldrb r0, [r1] str r7, [sp] mov r1, r10 @@ -19072,7 +19072,7 @@ sub_81A4684: @ 81A4684 adds r7, r1, 0 mov r10, r2 adds r5, r3, 0 - ldr r1, =gUnknown_0203AB74 + ldr r1, =gResultsWindowId ldrb r0, [r1] lsls r2, r6, 1 adds r2, r6 @@ -19112,7 +19112,7 @@ sub_81A4684: @ 81A4684 ldrb r2, [r5, 0x1A] add r0, sp, 0xC bl TVShowConvertInternationalString - ldr r1, =gUnknown_0203AB74 + ldr r1, =gResultsWindowId ldrb r0, [r1] adds r3, r7, 0x2 lsls r3, 27 @@ -19147,7 +19147,7 @@ _081A4734: adds r1, r4, 0 bl StringCopy _081A473C: - ldr r2, =gUnknown_0203AB74 + ldr r2, =gResultsWindowId mov r9, r2 ldrb r0, [r2] adds r3, r7, 0x4 @@ -19468,7 +19468,7 @@ sub_81A4998: @ 81A4998 ldr r1, [r5] adds r0, r6, 0 bl StringExpandPlaceholders - ldr r0, =gUnknown_0203AB74 + ldr r0, =gResultsWindowId mov r8, r0 ldrb r0, [r0] movs r1, 0x1 @@ -19567,7 +19567,7 @@ _081A4A90: thumb_func_start sub_81A4AA0 sub_81A4AA0: @ 81A4AA0 push {r4,lr} - ldr r4, =gUnknown_0203AB74 + ldr r4, =gResultsWindowId ldr r0, =gUnknown_08611C84 bl AddWindow strb r0, [r4] @@ -19595,7 +19595,7 @@ sub_81A4AA0: @ 81A4AA0 thumb_func_start sub_81A4AE8 sub_81A4AE8: @ 81A4AE8 push {r4,lr} - ldr r4, =gUnknown_0203AB74 + ldr r4, =gResultsWindowId ldrb r0, [r4] movs r1, 0x11 bl FillWindowPixelBuffer diff --git a/asm/battle_records.s b/asm/battle_records.s index c961aefe3b..c441adc74f 100644 --- a/asm/battle_records.s +++ b/asm/battle_records.s @@ -496,7 +496,7 @@ sub_813C2F4: @ 813C2F4 movs r2, 0xD0 bl GetStringCenterAlignXOffset adds r3, r0, 0 - ldr r0, =gUnknown_0203AB74 + ldr r0, =gResultsWindowId ldrb r0, [r0] lsls r3, 24 lsrs r3, 24 @@ -531,7 +531,7 @@ sub_813C384: @ 813C384 ldr r7, [r6, 0xC] cmp r7, 0 bne _0813C40C - ldr r0, =gUnknown_0203AB74 + ldr r0, =gResultsWindowId mov r8, r0 ldrb r0, [r0] ldr r2, =gUnknown_085B3D84 @@ -587,7 +587,7 @@ _0813C40C: lsrs r1, 24 ldr r0, =gStringVar1 bl ConvertInternationalString - ldr r0, =gUnknown_0203AB74 + ldr r0, =gResultsWindowId mov r8, r0 ldrb r0, [r0] lsls r4, 3 @@ -661,7 +661,7 @@ sub_813C4BC: @ 813C4BC mov r6, r8 push {r6,r7} sub sp, 0xC - ldr r6, =gUnknown_0203AB74 + ldr r6, =gResultsWindowId ldr r0, =gUnknown_085B3D7C bl AddWindow strb r0, [r6] @@ -729,7 +729,7 @@ _0813C540: adds r4, 0x1 cmp r4, 0x4 ble _0813C540 - ldr r4, =gUnknown_0203AB74 + ldr r4, =gResultsWindowId ldrb r0, [r4] bl PutWindowTilemap ldrb r0, [r4] @@ -748,7 +748,7 @@ _0813C540: thumb_func_start sub_813C5A0 sub_813C5A0: @ 813C5A0 push {r4,lr} - ldr r4, =gUnknown_0203AB74 + ldr r4, =gResultsWindowId ldrb r0, [r4] movs r1, 0 bl sub_819746C diff --git a/asm/berry_blender.s b/asm/berry_blender.s deleted file mode 100644 index bb9eb72aef..0000000000 --- a/asm/berry_blender.s +++ /dev/null @@ -1,5439 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - - - - thumb_func_start sub_80814F4 -sub_80814F4: @ 80814F4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r0, 0 - beq _0808153C - ldr r3, =gSendCmd - ldrh r0, [r3, 0x4] - ldr r2, =gRecvCmds - cmp r0, 0 - beq _0808151C - movs r1, 0 - strh r0, [r2, 0x4] - ldr r0, =0x00004444 - strh r0, [r2] - strh r1, [r3, 0x4] -_0808151C: - ldr r0, =gRecvCmds - ldr r3, =0x00004444 - adds r1, r2, 0 - adds r1, 0x10 - adds r2, r0, 0 - adds r2, 0x14 - movs r7, 0x2 -_0808152A: - ldrh r0, [r2] - cmp r0, 0 - beq _08081532 - strh r3, [r1] -_08081532: - adds r1, 0x10 - adds r2, 0x10 - subs r7, 0x1 - cmp r7, 0 - bge _0808152A -_0808153C: - movs r7, 0 - ldr r1, =sBerryBlenderData - ldr r0, [r1] - adds r0, 0x7C - ldrb r0, [r0] - cmp r7, r0 - blt _0808154C - b _080816F6 -_0808154C: - ldr r0, =gRecvCmds - adds r2, r0, 0 - adds r2, 0x20 - str r2, [sp] - movs r1, 0 - mov r9, r1 - movs r2, 0 - str r2, [sp, 0x4] - mov r8, r0 - ldr r0, =0x00005432 - mov r10, r0 -_08081562: - mov r1, r8 - ldrh r0, [r1] - ldr r1, =0x00004444 - movs r2, 0x88 - lsls r2, 7 - bl sub_80814B0 - cmp r0, 0 - bne _08081576 - b _080816D2 -_08081576: - ldr r6, =sBerryBlenderData - ldr r0, [r6] - adds r0, 0x96 - ldr r2, [sp, 0x4] - adds r0, r2 - ldrh r5, [r0] - mov r0, r8 - ldrh r4, [r0, 0x4] - ldr r1, =0x00004523 - cmp r4, r1 - bne _080815F4 - adds r0, r1, 0 - bl sub_8081370 - ldr r0, [r6] - movs r2, 0x8B - lsls r2, 1 - adds r4, r0, r2 - adds r0, 0x4C - movs r1, 0 - ldrsh r0, [r0, r1] - movs r1, 0x37 - bl __divsi3 - ldrh r1, [r4] - adds r1, r0 - strh r1, [r4] - lsls r1, 16 - ldr r0, =0x03e70000 - cmp r1, r0 - bls _080815BA - movs r0, 0xFA - lsls r0, 2 - strh r0, [r4] -_080815BA: - lsls r1, r5, 24 - lsrs r1, 24 - ldr r0, =0x00004523 - bl sub_8081288 - ldr r1, [r6] - movs r2, 0x92 - lsls r2, 1 - adds r1, r2 - add r1, r9 - ldrh r0, [r1] - adds r0, 0x1 - b _0808165E - .pool -_080815F4: - cmp r4, r10 - bne _08081632 - mov r0, r10 - bl sub_8081370 - ldr r0, [r6] - movs r1, 0x8B - lsls r1, 1 - adds r4, r0, r1 - adds r0, 0x4C - movs r2, 0 - ldrsh r0, [r0, r2] - movs r1, 0x46 - bl __divsi3 - ldrh r1, [r4] - adds r1, r0 - strh r1, [r4] - lsls r1, r5, 24 - lsrs r1, 24 - mov r0, r10 - bl sub_8081288 - ldr r1, [r6] - movs r0, 0x93 - lsls r0, 1 - adds r1, r0 - add r1, r9 - ldrh r0, [r1] - adds r0, 0x1 - b _0808165E -_08081632: - ldr r0, =0x00002345 - cmp r4, r0 - bne _0808166A - lsls r1, r5, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl sub_8081288 - adds r0, r4, 0 - bl sub_8081370 - ldr r0, [r6] - movs r1, 0x94 - lsls r1, 1 - adds r0, r1 - mov r2, r9 - adds r1, r0, r2 - ldrh r2, [r1] - ldr r0, =0x000003e6 - cmp r2, r0 - bhi _08081660 - adds r0, r2, 0x1 -_0808165E: - strh r0, [r1] -_08081660: - mov r0, r8 - ldrh r1, [r0, 0x4] - ldr r0, =0x00002345 - cmp r1, r0 - beq _08081678 -_0808166A: - ldr r1, [sp] - ldrh r0, [r1] - ldr r2, =0x00004523 - cmp r0, r2 - beq _08081678 - cmp r0, r10 - bne _080816D2 -_08081678: - ldr r0, =sBerryBlenderData - ldr r0, [r0] - adds r2, r0, 0 - adds r2, 0x4C - movs r0, 0 - ldrsh r1, [r2, r0] - ldr r0, =0x000005dc - cmp r1, r0 - ble _080816C8 - adds r0, r1, 0 - ldr r2, =0xfffffd12 - adds r0, r2 - movs r1, 0x14 - bl __divsi3 - adds r1, r0, 0 - movs r0, 0x80 - lsls r0, 1 - adds r1, r0 - lsls r1, 16 - lsrs r1, 16 - ldr r0, =gMPlay_BGM - bl m4aMPlayTempoControl - b _080816D2 - .pool -_080816C8: - ldr r0, =gMPlay_BGM - movs r1, 0x80 - lsls r1, 1 - bl m4aMPlayTempoControl -_080816D2: - ldr r1, [sp] - adds r1, 0x2 - str r1, [sp] - movs r2, 0x6 - add r9, r2 - ldr r0, [sp, 0x4] - adds r0, 0x2 - str r0, [sp, 0x4] - movs r1, 0x10 - add r8, r1 - adds r7, 0x1 - ldr r0, =sBerryBlenderData - ldr r0, [r0] - adds r0, 0x7C - ldrb r0, [r0] - cmp r7, r0 - bge _080816F6 - b _08081562 -_080816F6: - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r0, 0 - beq _08081722 - movs r7, 0 - ldr r3, =sBerryBlenderData - ldr r0, [r3] - adds r0, 0x7C - ldrb r0, [r0] - cmp r7, r0 - bge _08081722 - movs r2, 0 - ldr r1, =gRecvCmds -_08081710: - strh r2, [r1] - strh r2, [r1, 0x4] - adds r1, 0x10 - adds r7, 0x1 - ldr r0, [r3] - adds r0, 0x7C - ldrb r0, [r0] - cmp r7, r0 - blt _08081710 -_08081722: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80814F4 - - thumb_func_start sub_8081744 -sub_8081744: @ 8081744 - push {r4-r6,lr} - movs r4, 0 - movs r6, 0 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _0808175A - bl GetMultiplayerId - lsls r0, 24 - lsrs r6, r0, 24 -_0808175A: - ldr r3, =sBerryBlenderData - ldr r1, [r3] - lsls r2, r6, 1 - adds r0, r1, 0 - adds r0, 0x96 - adds r0, r2 - ldrb r5, [r0] - adds r1, 0x63 - ldrb r0, [r1] - cmp r0, 0 - bne _0808182C - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x13] - cmp r0, 0x2 - bne _080817A8 - ldr r2, =gMain - ldrh r1, [r2, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080817B6 - ldrh r2, [r2, 0x28] - ldr r1, =0x00000201 - adds r0, r1, 0 - ands r0, r2 - cmp r0, r1 - beq _080817B6 - b _080817BA - .pool -_080817A8: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080817B6 - movs r4, 0x1 -_080817B6: - cmp r4, 0 - beq _0808182C -_080817BA: - ldr r4, =sBerryBlenderData - ldr r1, [r4] - lsls r2, r5, 1 - adds r0, r1, 0 - adds r0, 0x8E - adds r0, r2 - adds r1, 0x50 - ldrh r0, [r0] - adds r1, r0 - ldrb r1, [r1] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - adds r1, r5, 0x4 - lsls r1, 24 - lsrs r1, 24 - bl StartSpriteAnim - ldr r0, [r4] - adds r0, 0x4A - ldrh r0, [r0] - adds r1, r6, 0 - bl sub_8080624 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _08081810 - ldr r1, =gSendCmd - ldr r0, =0x00004523 - b _08081828 - .pool -_08081810: - cmp r0, 0x1 - bne _08081824 - ldr r1, =gSendCmd - ldr r0, =0x00005432 - b _08081828 - .pool -_08081824: - ldr r1, =gSendCmd - ldr r0, =0x00002345 -_08081828: - strh r0, [r1, 0x4] - adds r3, r4, 0 -_0808182C: - ldr r1, [r3] - adds r1, 0x72 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x5 - bls _0808185A - ldr r0, [r3] - adds r1, r0, 0 - adds r1, 0x4C - ldrh r2, [r1] - movs r4, 0 - ldrsh r0, [r1, r4] - cmp r0, 0x80 - ble _08081852 - subs r0, r2, 0x1 - strh r0, [r1] -_08081852: - ldr r0, [r3] - adds r0, 0x72 - movs r1, 0 - strb r1, [r0] -_0808185A: - ldr r0, =gUnknown_020322D5 - ldrb r0, [r0] - cmp r0, 0 - beq _0808187E - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x80 - lsls r0, 2 - ands r0, r1 - cmp r0, 0 - beq _0808187E - ldr r0, [r3] - ldr r1, =0x00000123 - adds r2, r0, r1 - ldrb r0, [r2] - movs r1, 0x1 - eors r0, r1 - strb r0, [r2] -_0808187E: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8081744 - - thumb_func_start sub_8081898 -sub_8081898: @ 8081898 - push {r4-r6,lr} - bl sub_8082D28 - ldr r4, =sBerryBlenderData - ldr r0, [r4] - movs r1, 0x82 - lsls r1, 1 - adds r2, r0, r1 - ldr r1, [r2] - ldr r0, =0x00057e03 - cmp r1, r0 - bhi _080818B4 - adds r0, r1, 0x1 - str r0, [r2] -_080818B4: - bl sub_8081744 - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x4C - ldrh r0, [r0] - movs r5, 0x8B - lsls r5, 1 - adds r1, r5 - ldrh r1, [r1] - bl sub_800A994 - bl sub_80814F4 - ldr r0, [r4] - adds r0, r5 - ldrh r0, [r0] - movs r6, 0xFA - lsls r6, 2 - adds r1, r6, 0 - bl sub_8083140 - ldr r0, [r4] - adds r0, 0x4C - ldrh r0, [r0] - bl sub_8083230 - bl sub_808330C - bl sub_8082AD4 - ldr r2, [r4] - adds r3, r2, 0 - adds r3, 0x63 - ldrb r0, [r3] - cmp r0, 0 - bne _0808191A - movs r1, 0x8C - lsls r1, 1 - adds r0, r2, r1 - ldrh r1, [r0] - ldr r0, =0x000003e7 - cmp r1, r0 - bls _0808191A - adds r0, r2, r5 - strh r6, [r0] - movs r0, 0x1 - strb r0, [r3] - ldr r0, =sub_8081FC8 - bl SetMainCallback2 -_0808191A: - ldr r0, =sBerryBlenderData - ldr r1, [r0] - movs r2, 0x8E - lsls r2, 1 - adds r0, r1, r2 - movs r2, 0 - ldrsh r0, [r0, r2] - movs r2, 0x8F - lsls r2, 1 - adds r1, r2 - movs r2, 0 - ldrsh r1, [r1, r2] - bl Blender_DummiedOutFunc - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl RunTextPrinters - bl UpdatePaletteFade - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8081898 - - thumb_func_start Blender_DummiedOutFunc -Blender_DummiedOutFunc: @ 8081960 - bx lr - thumb_func_end Blender_DummiedOutFunc - - thumb_func_start help_system_is_not_first_time -help_system_is_not_first_time: @ 8081964 - push {r4,r5,lr} - lsls r1, 24 - lsls r2, 24 - lsrs r1, 20 - adds r4, r1, r0 - lsrs r2, 20 - adds r5, r2, r0 - ldrh r0, [r4] - ldrh r1, [r5] - cmp r0, r1 - bne _080819A2 - adds r0, r4, 0x2 - adds r1, r5, 0x2 - bl StringCompare - cmp r0, 0 - bne _080819B0 - ldr r0, [r4, 0x8] - ldr r2, =0xffffff00 - ands r0, r2 - ldr r1, [r5, 0x8] - ands r1, r2 - cmp r0, r1 - bne _080819B0 - ldr r0, [r4, 0xC] - ldr r2, =0x00ffffff - ands r0, r2 - ldr r1, [r5, 0xC] - ands r1, r2 - cmp r0, r1 - bne _080819B0 -_080819A2: - movs r0, 0x1 - b _080819B2 - .pool -_080819B0: - movs r0, 0 -_080819B2: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end help_system_is_not_first_time - - thumb_func_start sub_80819B8 -sub_80819B8: @ 80819B8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - mov r10, r0 - lsls r2, 24 - lsrs r2, 24 - str r2, [sp, 0x10] - lsls r3, 24 - lsrs r3, 24 - mov r2, sp - movs r4, 0x5 -_080819D4: - ldrh r0, [r1] - strh r0, [r2] - adds r1, 0x2 - adds r2, 0x2 - subs r4, 0x1 - cmp r4, 0 - bge _080819D4 - movs r6, 0 - mov r1, sp - movs r4, 0x4 -_080819E8: - movs r2, 0 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _080819F2 - adds r6, 0x1 -_080819F2: - adds r1, 0x2 - subs r4, 0x1 - cmp r4, 0 - bge _080819E8 - cmp r6, 0x5 - beq _08081A46 - cmp r3, 0x3 - bhi _08081A46 - movs r4, 0 - ldr r3, [sp, 0x10] - cmp r4, r3 - bge _08081A5E - mov r3, r10 -_08081A0C: - movs r6, 0 - ldr r7, [sp, 0x10] - cmp r6, r7 - bge _08081A54 - mov r9, r3 - mov r5, r10 - lsls r0, r4, 24 - mov r8, r0 -_08081A1C: - mov r1, r9 - ldrh r0, [r1] - ldrh r2, [r5] - cmp r0, r2 - bne _08081A4A - cmp r4, r6 - beq _08081A4A - cmp r0, 0xAF - bne _08081A46 - lsls r2, r6, 24 - lsrs r2, 24 - mov r0, r10 - mov r7, r8 - lsrs r1, r7, 24 - str r3, [sp, 0xC] - bl help_system_is_not_first_time - lsls r0, 24 - ldr r3, [sp, 0xC] - cmp r0, 0 - beq _08081A4A -_08081A46: - movs r0, 0xC - b _08081B9E -_08081A4A: - adds r5, 0x10 - adds r6, 0x1 - ldr r0, [sp, 0x10] - cmp r6, r0 - blt _08081A1C -_08081A54: - adds r3, 0x10 - adds r4, 0x1 - ldr r1, [sp, 0x10] - cmp r4, r1 - blt _08081A0C -_08081A5E: - movs r2, 0 - mov r1, sp - movs r4, 0x4 -_08081A64: - movs r3, 0 - ldrsh r0, [r1, r3] - cmp r0, 0 - ble _08081A72 - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 -_08081A72: - adds r1, 0x2 - subs r4, 0x1 - cmp r4, 0 - bge _08081A64 - cmp r2, 0x3 - bls _08081A82 - movs r0, 0xD - b _08081B9E -_08081A82: - cmp r2, 0x3 - bne _08081A8A - movs r0, 0xB - b _08081B9E -_08081A8A: - movs r4, 0 - mov r1, sp -_08081A8E: - movs r7, 0 - ldrsh r0, [r1, r7] - cmp r0, 0x32 - ble _08081A98 - b _08081B98 -_08081A98: - adds r1, 0x2 - adds r4, 0x1 - cmp r4, 0x4 - ble _08081A8E - cmp r2, 0x1 - bne _08081AEA - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, 0 - ble _08081AB2 - movs r0, 0x1 - b _08081B9E -_08081AB2: - mov r0, sp - ldrh r0, [r0, 0x2] - lsls r0, 16 - cmp r0, 0 - ble _08081AC0 - movs r0, 0x2 - b _08081B9E -_08081AC0: - mov r0, sp - movs r3, 0x4 - ldrsh r0, [r0, r3] - cmp r0, 0 - ble _08081ACE - movs r0, 0x3 - b _08081B9E -_08081ACE: - mov r0, sp - movs r4, 0x6 - ldrsh r0, [r0, r4] - cmp r0, 0 - ble _08081ADC - movs r0, 0x4 - b _08081B9E -_08081ADC: - mov r0, sp - movs r7, 0x8 - ldrsh r0, [r0, r7] - cmp r0, 0 - ble _08081AEA - movs r0, 0x5 - b _08081B9E -_08081AEA: - cmp r2, 0x2 - bne _08081B9C - movs r4, 0 - ldr r5, =gUnknown_03000DF8 - mov r1, sp - adds r2, r5, 0 -_08081AF6: - movs r3, 0 - ldrsh r0, [r1, r3] - cmp r0, 0 - ble _08081B02 - strh r4, [r2] - adds r2, 0x2 -_08081B02: - adds r1, 0x2 - adds r4, 0x1 - cmp r4, 0x4 - ble _08081AF6 - movs r4, 0 - ldrsh r3, [r5, r4] - lsls r0, r3, 1 - mov r7, sp - adds r1, r7, r0 - movs r0, 0x2 - ldrsh r2, [r5, r0] - lsls r0, r2, 1 - add r0, sp - movs r4, 0 - ldrsh r1, [r1, r4] - movs r7, 0 - ldrsh r0, [r0, r7] - cmp r1, r0 - blt _08081B58 - adds r0, r3, 0 - cmp r0, 0 - bne _08081B38 - lsls r0, r2, 16 - b _08081B62 - .pool -_08081B38: - cmp r0, 0x1 - bne _08081B40 - lsls r0, r2, 16 - b _08081B6E -_08081B40: - cmp r0, 0x2 - bne _08081B48 - lsls r0, r2, 16 - b _08081B7A -_08081B48: - cmp r0, 0x3 - bne _08081B50 - lsls r0, r2, 16 - b _08081B86 -_08081B50: - cmp r0, 0x4 - bne _08081B9C - lsls r0, r2, 16 - b _08081B92 -_08081B58: - movs r2, 0x2 - ldrsh r0, [r5, r2] - cmp r0, 0 - bne _08081B68 - lsls r0, r3, 16 -_08081B62: - movs r1, 0x6 - orrs r0, r1 - b _08081B9E -_08081B68: - cmp r0, 0x1 - bne _08081B74 - lsls r0, r3, 16 -_08081B6E: - movs r1, 0x7 - orrs r0, r1 - b _08081B9E -_08081B74: - cmp r0, 0x2 - bne _08081B80 - lsls r0, r3, 16 -_08081B7A: - movs r1, 0x8 - orrs r0, r1 - b _08081B9E -_08081B80: - cmp r0, 0x3 - bne _08081B8C - lsls r0, r3, 16 -_08081B86: - movs r1, 0x9 - orrs r0, r1 - b _08081B9E -_08081B8C: - cmp r0, 0x4 - bne _08081B9C - lsls r0, r3, 16 -_08081B92: - movs r1, 0xA - orrs r0, r1 - b _08081B9E -_08081B98: - movs r0, 0xE - b _08081B9E -_08081B9C: - movs r0, 0 -_08081B9E: - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80819B8 - - thumb_func_start sub_8081BB0 -sub_8081BB0: @ 8081BB0 - ldr r1, =gUnknown_03000E04 - strh r0, [r1] - bx lr - .pool - thumb_func_end sub_8081BB0 - - thumb_func_start sub_8081BBC -sub_8081BBC: @ 8081BBC - ldr r0, =gUnknown_03000E04 - movs r1, 0 - ldrsh r0, [r0, r1] - bx lr - .pool - thumb_func_end sub_8081BBC - - thumb_func_start sub_8081BC8 -sub_8081BC8: @ 8081BC8 - ldr r1, =gUnknown_03000E06 - strh r0, [r1] - bx lr - .pool - thumb_func_end sub_8081BC8 - - thumb_func_start sub_8081BD4 -sub_8081BD4: @ 8081BD4 - ldr r0, =gUnknown_03000E06 - movs r1, 0 - ldrsh r0, [r0, r1] - bx lr - .pool - thumb_func_end sub_8081BD4 - - thumb_func_start sub_8081BE0 -sub_8081BE0: @ 8081BE0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - str r0, [sp] - mov r8, r1 - str r3, [sp, 0x4] - ldr r0, [sp, 0x30] - lsls r2, 24 - lsrs r2, 24 - mov r9, r2 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0x8] - ldr r7, =gUnknown_03000DE8 - adds r2, r7, 0 - movs r1, 0 - adds r0, r7, 0 - adds r0, 0xA -_08081C0A: - strh r1, [r0] - subs r0, 0x2 - cmp r0, r2 - bge _08081C0A - movs r6, 0 - cmp r6, r9 - bge _08081C40 - ldr r0, =gUnknown_03000DE8 - mov r12, r0 - ldr r5, [sp] - adds r5, 0x9 -_08081C20: - movs r3, 0 - adds r4, r5, 0 - mov r2, r12 -_08081C26: - adds r1, r4, r3 - ldrh r0, [r2] - ldrb r1, [r1] - adds r0, r1 - strh r0, [r2] - adds r2, 0x2 - adds r3, 0x1 - cmp r3, 0x5 - ble _08081C26 - adds r5, 0x10 - adds r6, 0x1 - cmp r6, r9 - blt _08081C20 -_08081C40: - movs r1, 0 - ldrsh r3, [r7, r1] - ldrh r0, [r7] - ldrh r1, [r7, 0x2] - subs r0, r1 - strh r0, [r7] - ldrh r0, [r7, 0x4] - subs r1, r0 - strh r1, [r7, 0x2] - ldrh r1, [r7, 0x6] - subs r0, r1 - strh r0, [r7, 0x4] - ldrh r0, [r7, 0x8] - subs r1, r0 - strh r1, [r7, 0x6] - subs r0, r3 - strh r0, [r7, 0x8] - movs r3, 0 - movs r2, 0 - adds r1, r7, 0 - movs r6, 0x4 -_08081C6A: - movs r4, 0 - ldrsh r0, [r1, r4] - cmp r0, 0 - bge _08081C76 - strh r2, [r1] - adds r3, 0x1 -_08081C76: - adds r1, 0x2 - subs r6, 0x1 - cmp r6, 0 - bge _08081C6A - lsls r0, r3, 24 - lsrs r0, 24 - mov r10, r0 - movs r4, 0 - ldr r1, =gUnknown_03000DE8 - movs r6, 0x4 -_08081C8A: - ldrh r2, [r1] - movs r5, 0 - ldrsh r0, [r1, r5] - cmp r0, 0 - ble _08081CA4 - cmp r0, r3 - bge _08081CA0 - strh r4, [r1] - b _08081CA4 - .pool -_08081CA0: - subs r0, r2, r3 - strh r0, [r1] -_08081CA4: - adds r1, 0x2 - subs r6, 0x1 - cmp r6, 0 - bge _08081C8A - ldr r1, =gUnknown_03000DE8 - ldr r2, =gUnknown_020322A8 - movs r6, 0x4 -_08081CB2: - movs r3, 0 - ldrsh r0, [r1, r3] - stm r2!, {r0} - adds r1, 0x2 - subs r6, 0x1 - cmp r6, 0 - bge _08081CB2 - ldr r1, =0x0000014d - ldr r0, [sp, 0x8] - bl __udivsi3 - lsls r0, 16 - lsrs r0, 16 - adds r3, r0, 0 - adds r3, 0x64 - ldr r4, =gUnknown_020322D0 - str r3, [r4] - movs r6, 0x4 -_08081CD6: - movs r0, 0 - ldrsh r5, [r7, r0] - adds r0, r5, 0 - muls r0, r3 - movs r1, 0xA - str r3, [sp, 0xC] - bl __divsi3 - adds r5, r0, 0 - movs r1, 0xA - bl __modsi3 - adds r4, r0, 0 - adds r0, r5, 0 - movs r1, 0xA - bl __divsi3 - adds r5, r0, 0 - ldr r3, [sp, 0xC] - cmp r4, 0x4 - ble _08081D02 - adds r5, 0x1 -_08081D02: - strh r5, [r7] - adds r7, 0x2 - subs r6, 0x1 - cmp r6, 0 - bge _08081CD6 - ldr r1, =gUnknown_03000DE8 - ldr r2, =gUnknown_020322BC - movs r6, 0x4 -_08081D12: - movs r3, 0 - ldrsh r0, [r1, r3] - stm r2!, {r0} - adds r1, 0x2 - subs r6, 0x1 - cmp r6, 0 - bge _08081D12 - ldr r4, =gUnknown_03000DE8 - ldr r0, [sp] - adds r1, r4, 0 - mov r2, r9 - mov r3, r10 - bl sub_80819B8 - mov r5, r8 - strb r0, [r5] - movs r1, 0xA - ldrsh r0, [r4, r1] - mov r1, r9 - bl __divsi3 - mov r3, r9 - subs r0, r3 - strh r0, [r4, 0xA] - lsls r0, 16 - cmp r0, 0 - bge _08081D4C - movs r0, 0 - strh r0, [r4, 0xA] -_08081D4C: - mov r5, r8 - ldrb r0, [r5] - cmp r0, 0xC - bne _08081DA6 - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xA - bl __umodsi3 - lsls r0, 16 - lsrs r3, r0, 16 - movs r6, 0 - ldr r0, =gUnknown_08339CC8 - adds r0, r3, r0 - ldrb r0, [r0] - adds r1, r4, 0 - movs r4, 0x1 - movs r3, 0x2 -_08081D74: - adds r2, r0, 0 - asrs r2, r6 - ands r2, r4 - cmp r2, 0 - beq _08081D9C - strh r3, [r1] - b _08081D9E - .pool -_08081D9C: - strh r2, [r1] -_08081D9E: - adds r1, 0x2 - adds r6, 0x1 - cmp r6, 0x4 - ble _08081D74 -_08081DA6: - ldr r7, =gUnknown_03000DE8 - movs r2, 0xFF - adds r1, r7, 0 - movs r6, 0x5 -_08081DAE: - movs r3, 0 - ldrsh r0, [r1, r3] - cmp r0, 0xFF - ble _08081DB8 - strh r2, [r1] -_08081DB8: - adds r1, 0x2 - subs r6, 0x1 - cmp r6, 0 - bge _08081DAE - ldrh r0, [r7] - mov r4, r8 - strb r0, [r4, 0x1] - ldrh r0, [r7, 0x2] - strb r0, [r4, 0x2] - ldrh r0, [r7, 0x4] - strb r0, [r4, 0x3] - ldrh r0, [r7, 0x6] - strb r0, [r4, 0x4] - ldrh r0, [r7, 0x8] - strb r0, [r4, 0x5] - ldrh r0, [r7, 0xA] - strb r0, [r4, 0x6] - movs r6, 0 - adds r2, r7, 0 -_08081DDE: - ldr r5, [sp, 0x4] - adds r1, r5, r6 - ldrh r0, [r2] - strb r0, [r1] - adds r2, 0x2 - adds r6, 0x1 - cmp r6, 0x5 - ble _08081DDE - 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 sub_8081BE0 - - thumb_func_start sub_8081E04 -sub_8081E04: @ 8081E04 - push {r4,lr} - sub sp, 0x4 - ldr r4, [sp, 0xC] - lsls r2, 24 - lsrs r2, 24 - lsls r4, 16 - lsrs r4, 16 - str r4, [sp] - bl sub_8081BE0 - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8081E04 - - thumb_func_start sub_8081E20 -sub_8081E20: @ 8081E20 - push {r4-r6,lr} - ldr r0, =sBerryBlenderData - ldr r0, [r0] - movs r2, 0x82 - lsls r2, 1 - adds r1, r0, r2 - ldrh r1, [r1] - adds r0, 0x4E - ldrh r4, [r0] - movs r2, 0 - ldr r5, =0x00000383 - cmp r1, r5 - bhi _08081E48 - movs r2, 0x5 - b _08081E9A - .pool -_08081E48: - ldr r3, =0xfffffc7c - adds r0, r1, r3 - lsls r0, 16 - lsrs r0, 16 - ldr r3, =0x00000257 - cmp r0, r3 - bhi _08081E64 - movs r2, 0x4 - b _08081E9A - .pool -_08081E64: - ldr r6, =0xfffffa24 - adds r0, r1, r6 - lsls r0, 16 - lsrs r0, 16 - cmp r0, r3 - bhi _08081E78 - movs r2, 0x3 - b _08081E9A - .pool -_08081E78: - ldr r3, =0xfffff7cc - adds r0, r1, r3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, r5 - bhi _08081E8C - movs r2, 0x2 - b _08081E9A - .pool -_08081E8C: - ldr r6, =0xfffff31c - adds r0, r1, r6 - lsls r0, 16 - ldr r1, =0x012b0000 - cmp r0, r1 - bhi _08081E9A - movs r2, 0x1 -_08081E9A: - lsls r0, r2, 16 - asrs r0, 16 - bl sub_8081BC8 - movs r2, 0 - cmp r4, 0x40 - bhi _08081F7C - adds r0, r4, 0 - subs r0, 0x32 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x31 - bhi _08081EC4 - ldr r2, =0x0000ffff - b _08081F7C - .pool -_08081EC4: - adds r0, r4, 0 - subs r0, 0x64 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x31 - bhi _08081ED8 - ldr r2, =0x0000fffe - b _08081F7C - .pool -_08081ED8: - adds r0, r4, 0 - subs r0, 0x96 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x31 - bhi _08081EEC - ldr r2, =0x0000fffd - b _08081F7C - .pool -_08081EEC: - adds r0, r4, 0 - subs r0, 0xC8 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x31 - bhi _08081F00 - ldr r2, =0x0000fffc - b _08081F7C - .pool -_08081F00: - adds r0, r4, 0 - subs r0, 0xFA - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x31 - bhi _08081F14 - ldr r2, =0x0000fffb - b _08081F7C - .pool -_08081F14: - ldr r1, =0xfffffea2 - adds r0, r4, r1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x31 - bhi _08081F2C - ldr r2, =0x0000fffa - b _08081F7C - .pool -_08081F2C: - ldr r3, =0xfffffe70 - adds r0, r4, r3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x31 - bhi _08081F44 - ldr r2, =0x0000fff9 - b _08081F7C - .pool -_08081F44: - ldr r6, =0xfffffe0c - adds r0, r4, r6 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x31 - bhi _08081F5C - ldr r2, =0x0000fff8 - b _08081F7C - .pool -_08081F5C: - ldr r1, =0xfffffdda - adds r0, r4, r1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x31 - bhi _08081F74 - ldr r2, =0x0000fff7 - b _08081F7C - .pool -_08081F74: - ldr r0, =0x00000257 - cmp r4, r0 - bls _08081F7C - ldr r2, =0x0000fff6 -_08081F7C: - lsls r0, r2, 16 - asrs r0, 16 - bl sub_8081BB0 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8081E20 - - thumb_func_start sub_8081F94 -sub_8081F94: @ 8081F94 - push {lr} - adds r1, r0, 0 - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _08081FB8 - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - beq _08081FB8 - movs r2, 0xBC - lsls r2, 6 - b _08081FBA - .pool -_08081FB8: - ldr r2, =0x00002fff -_08081FBA: - adds r0, r2, 0 - strh r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8081F94 - - thumb_func_start sub_8081FC8 -sub_8081FC8: @ 8081FC8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r4, =sBerryBlenderData - ldr r0, [r4] - adds r0, 0x63 - ldrb r0, [r0] - cmp r0, 0x2 - bhi _08081FDE - bl sub_8082D28 -_08081FDE: - bl GetMultiplayerId - ldr r0, [r4] - adds r0, 0x63 - ldrb r0, [r0] - subs r0, 0x1 - cmp r0, 0xC - bls _08081FF0 - b _0808249E -_08081FF0: - lsls r0, 2 - ldr r1, =_08082004 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08082004: - .4byte _08082038 - .4byte _08082078 - .4byte _080820D4 - .4byte _080821C8 - .4byte _08082278 - .4byte _08082286 - .4byte _080822B0 - .4byte _08082458 - .4byte _080822E4 - .4byte _08082308 - .4byte _080823B0 - .4byte _08082430 - .4byte _0808246C -_08082038: - ldr r0, =gMPlay_BGM - movs r1, 0x80 - lsls r1, 1 - bl m4aMPlayTempoControl - movs r4, 0 - b _08082064 - .pool -_0808204C: - ldr r0, =sBerryBlenderData - ldr r0, [r0] - movs r1, 0x90 - lsls r1, 1 - adds r0, r1 - adds r0, r4 - ldrb r0, [r0] - bl DestroyTask - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_08082064: - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - cmp r4, r0 - bcc _0808204C - b _08082458 - .pool -_08082078: - ldr r4, =sBerryBlenderData - ldr r1, [r4] - adds r1, 0x4C - ldrh r0, [r1] - subs r0, 0x20 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - bgt _080820C6 - bl sub_8009F8C - ldr r2, [r4] - adds r1, r2, 0 - adds r1, 0x4C - movs r0, 0 - strh r0, [r1] - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _080820B0 - adds r1, 0x17 - ldrb r0, [r1] - adds r0, 0x1 - b _080820B6 - .pool -_080820B0: - adds r1, r2, 0 - adds r1, 0x63 - movs r0, 0x5 -_080820B6: - strb r0, [r1] - ldr r0, =sBerryBlenderData - ldr r1, [r0] - movs r0, 0 - strb r0, [r1] - ldr r0, =gMPlay_SE2 - bl m4aMPlayStop -_080820C6: - bl Blender_ControlHitPitch - b _0808249E - .pool -_080820D4: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - beq _080820E0 - b _08082458 -_080820E0: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _080820EC - b _0808249E -_080820EC: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _0808218C - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - beq _0808218C - ldr r3, =sBerryBlenderData - ldr r1, [r3] - movs r4, 0x8E - lsls r4, 5 - adds r2, r1, r4 - movs r5, 0x82 - lsls r5, 1 - adds r0, r1, r5 - ldr r0, [r0] - str r0, [r2] - adds r0, r1, 0 - adds r0, 0x4E - ldrh r0, [r0] - ldr r2, =0x000011c4 - adds r1, r2 - strh r0, [r1] - movs r4, 0 - mov r8, r3 - mov r12, r8 - ldr r7, =0x000011c8 - movs r6, 0x92 - lsls r6, 1 -_08082128: - movs r3, 0 - adds r5, r4, 0x1 - lsls r0, r4, 1 - adds r0, r4 - lsls r4, r0, 1 -_08082132: - mov r1, r12 - ldr r0, [r1] - lsls r1, r3, 1 - adds r1, r4 - adds r2, r0, r7 - adds r2, r1 - adds r0, r6 - adds r0, r1 - ldrh r0, [r0] - strh r0, [r2] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x2 - bls _08082132 - lsls r0, r5, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _08082128 - mov r2, r8 - ldr r1, [r2] - movs r4, 0x8E - lsls r4, 5 - adds r1, r4 - movs r0, 0 - movs r2, 0x20 - bl SendBlock - lsls r0, 24 - cmp r0, 0 - bne _08082172 - b _0808249E -_08082172: - mov r5, r8 - ldr r1, [r5] - b _0808245C - .pool -_0808218C: - ldr r4, =sBerryBlenderData - ldr r3, [r4] - movs r0, 0xCC - lsls r0, 1 - adds r1, r3, r0 - movs r2, 0x82 - lsls r2, 1 - adds r0, r3, r2 - ldr r0, [r0] - str r0, [r1] - adds r0, r3, 0 - adds r0, 0x4E - ldrh r2, [r0] - movs r5, 0xCE - lsls r5, 1 - adds r0, r3, r5 - strh r2, [r0] - movs r0, 0 - movs r2, 0x28 - bl SendBlock - lsls r0, 24 - cmp r0, 0 - bne _080821BE - b _0808249E -_080821BE: - ldr r1, [r4] - b _0808245C - .pool -_080821C8: - bl GetBlockReceivedStatus - lsls r0, 24 - cmp r0, 0 - bne _080821D4 - b _0808249E -_080821D4: - bl ResetBlockReceivedFlags - ldr r5, =sBerryBlenderData - ldr r1, [r5] - adds r1, 0x63 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _08082254 - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - beq _08082254 - ldr r2, =gBlockRecvBuffer - ldr r3, [r5] - ldrh r0, [r2, 0x4] - adds r1, r3, 0 - adds r1, 0x4E - strh r0, [r1] - movs r0, 0x82 - lsls r0, 1 - adds r1, r3, r0 - ldr r0, [r2] - str r0, [r1] - movs r4, 0 - adds r7, r2, 0 - adds r7, 0x8 - adds r6, r5, 0 - movs r2, 0x92 - lsls r2, 1 -_08082216: - movs r3, 0 - adds r5, r4, 0x1 - lsls r0, r4, 1 - adds r0, r4 - lsls r4, r0, 1 -_08082220: - ldr r1, [r6] - lsls r0, r3, 1 - adds r0, r4 - adds r1, r2 - adds r1, r0 - adds r0, r7, r0 - ldrh r0, [r0] - strh r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x2 - bls _08082220 - lsls r0, r5, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _08082216 - b _0808249E - .pool -_08082254: - ldr r2, =gBlockRecvBuffer - ldr r0, =sBerryBlenderData - ldr r3, [r0] - ldrh r0, [r2, 0x4] - adds r1, r3, 0 - adds r1, 0x4E - strh r0, [r1] - movs r4, 0x82 - lsls r4, 1 - adds r1, r3, r4 - ldr r0, [r2] - str r0, [r1] - b _0808249E - .pool -_08082278: - bl sub_8083B08 - lsls r0, 24 - cmp r0, 0 - bne _08082284 - b _0808249E -_08082284: - b _08082458 -_08082286: - bl berry_blender_related - lsls r0, 24 - cmp r0, 0 - bne _08082292 - b _0808249E -_08082292: - ldr r0, =gInGameOpponentsNo - ldrb r0, [r0] - cmp r0, 0 - bne _080822A8 - movs r0, 0x22 - bl IncrementGameStat - b _08082458 - .pool -_080822A8: - movs r0, 0x21 - bl IncrementGameStat - b _08082458 -_080822B0: - ldr r6, =sBerryBlenderData - ldr r4, [r6] - ldr r5, =0x000011b8 - adds r4, r5 - ldr r5, =sText_WouldLikeToBlendAnotherBerry - bl GetPlayerTextSpeed - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r5, 0 - bl Blender_PrintText - cmp r0, 0 - bne _080822D2 - b _0808249E -_080822D2: - ldr r1, [r6] - b _0808245C - .pool -_080822E4: - ldr r4, =sBerryBlenderData - ldr r0, [r4] - adds r0, 0x9E - movs r1, 0 - strb r1, [r0] - ldr r0, =gUnknown_083399B8 - movs r1, 0x1 - movs r2, 0xD - movs r3, 0 - bl CreateYesNoMenu - ldr r1, [r4] - b _0808245C - .pool -_08082308: - bl sub_8198C58 - lsls r0, 24 - asrs r2, r0, 24 - cmp r2, 0 - beq _0808236C - cmp r2, 0 - bgt _08082322 - movs r0, 0x1 - negs r0, r0 - cmp r2, r0 - beq _08082328 - b _0808249E -_08082322: - cmp r2, 0x1 - beq _08082328 - b _0808249E -_08082328: - ldr r2, =sBerryBlenderData - ldr r0, [r2] - adds r0, 0x9E - movs r1, 0x1 - strb r1, [r0] - ldr r1, [r2] - adds r1, 0x63 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - movs r4, 0 -_0808233E: - ldr r0, =sBerryBlenderData - ldr r0, [r0] - lsls r1, r4, 1 - adds r0, 0x8E - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0xFF - beq _0808235C - adds r0, r4, 0 - bl PutWindowTilemap - adds r0, r4, 0 - movs r1, 0x3 - bl CopyWindowToVram -_0808235C: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _0808233E - b _0808249E - .pool -_0808236C: - ldr r1, =sBerryBlenderData - ldr r0, [r1] - adds r0, 0x9E - strb r2, [r0] - ldr r1, [r1] - adds r1, 0x63 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - movs r4, 0 -_08082380: - ldr r0, =sBerryBlenderData - ldr r0, [r0] - lsls r1, r4, 1 - adds r0, 0x8E - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0xFF - beq _0808239E - adds r0, r4, 0 - bl PutWindowTilemap - adds r0, r4, 0 - movs r1, 0x3 - bl CopyWindowToVram -_0808239E: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _08082380 - b _0808249E - .pool -_080823B0: - ldr r6, =gSendCmd - adds r0, r6, 0 - bl sub_8081F94 - ldr r4, =sBerryBlenderData - ldr r2, [r4] - adds r0, r2, 0 - adds r0, 0x9E - ldrb r5, [r0] - cmp r5, 0 - bne _0808241C - movs r0, 0x4 - bl IsBagPocketNonEmpty - lsls r0, 24 - cmp r0, 0 - bne _080823EC - ldr r0, [r4] - adds r0, 0x70 - movs r1, 0x2 - strh r1, [r0] - ldr r0, =0x00009999 - b _08082414 - .pool -_080823EC: - bl sub_8136EF4 - lsls r0, 24 - asrs r0, 24 - movs r1, 0x1 - negs r1, r1 - cmp r0, r1 - bne _0808240C - ldr r0, [r4] - adds r0, 0x70 - movs r1, 0x3 - strh r1, [r0] - ldr r0, =0x0000aaaa - b _08082414 - .pool -_0808240C: - ldr r0, [r4] - adds r0, 0x70 - strh r5, [r0] - ldr r0, =0x00007779 -_08082414: - strh r0, [r6, 0x2] - b _08082458 - .pool -_0808241C: - adds r1, r2, 0 - adds r1, 0x70 - movs r0, 0x1 - strh r0, [r1] - ldr r0, =0x00008888 - strh r0, [r6, 0x2] - subs r1, 0xD - b _0808245E - .pool -_08082430: - ldr r0, =gInGameOpponentsNo - ldrb r0, [r0] - cmp r0, 0 - beq _08082458 - ldr r0, =sub_8082924 - bl SetMainCallback2 - ldr r2, =sBerryBlenderData - ldr r0, [r2] - adds r0, 0x63 - movs r1, 0 - strb r1, [r0] - ldr r0, [r2] - b _0808249C - .pool -_08082458: - ldr r0, =sBerryBlenderData - ldr r1, [r0] -_0808245C: - adds r1, 0x63 -_0808245E: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0808249E - .pool -_0808246C: - ldr r6, =sBerryBlenderData - ldr r4, [r6] - ldr r0, =0x000011b8 - adds r4, r0 - ldr r5, =sText_CommunicationStandby - bl GetPlayerTextSpeed - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r5, 0 - bl Blender_PrintText - cmp r0, 0 - beq _0808249E - ldr r0, =sub_8082644 - bl SetMainCallback2 - ldr r0, [r6] - adds r0, 0x63 - movs r1, 0 - strb r1, [r0] - ldr r0, [r6] -_0808249C: - strb r1, [r0] -_0808249E: - bl sub_808330C - ldr r4, =sBerryBlenderData - ldr r0, [r4] - adds r0, 0x4C - ldrh r0, [r0] - bl sub_8083230 - bl sub_8082AD4 - ldr r1, [r4] - movs r2, 0x8E - lsls r2, 1 - adds r0, r1, r2 - movs r4, 0 - ldrsh r0, [r0, r4] - movs r5, 0x8F - lsls r5, 1 - adds r1, r5 - movs r2, 0 - ldrsh r1, [r1, r2] - bl Blender_DummiedOutFunc - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl RunTextPrinters - bl UpdatePaletteFade - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8081FC8 - - thumb_func_start sub_80824FC -sub_80824FC: @ 80824FC - push {r4,lr} - ldr r1, =sBerryBlenderData - ldr r0, [r1] - movs r2, 0xD0 - lsls r2, 1 - adds r0, r2 - ldr r0, [r0] - adds r4, r1, 0 - cmp r0, 0x6 - bls _08082512 - b _0808263C -_08082512: - lsls r0, 2 - ldr r1, =_08082524 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08082524: - .4byte _08082540 - .4byte _08082558 - .4byte _08082584 - .4byte _08082594 - .4byte _080825BA - .4byte _08082600 - .4byte _0808261A -_08082540: - bl sub_800ADF8 - ldr r0, =sBerryBlenderData - ldr r2, [r0] - movs r3, 0xD0 - lsls r3, 1 - adds r1, r2, r3 - movs r0, 0x1 - b _0808260C - .pool -_08082558: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0808263C - ldr r0, =sBerryBlenderData - ldr r1, [r0] - movs r2, 0xD0 - lsls r2, 1 - adds r1, r2 - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - ldr r1, =gSoftResetDisabled - movs r0, 0x1 - strb r0, [r1] - b _0808263C - .pool -_08082584: - bl sub_8153430 - ldr r0, =sBerryBlenderData - ldr r2, [r0] - b _08082602 - .pool -_08082594: - ldr r1, [r4] - movs r2, 0x84 - lsls r2, 1 - adds r1, r2 - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - cmp r0, 0xA - bne _0808263C - bl sub_800ADF8 - ldr r1, [r4] - movs r3, 0xD0 - lsls r3, 1 - adds r1, r3 - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - b _0808263C -_080825BA: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _0808263C - bl sub_8153474 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - beq _080825E4 - ldr r0, =sBerryBlenderData - ldr r0, [r0] - movs r1, 0xD0 - lsls r1, 1 - adds r0, r1 - movs r1, 0x5 - str r1, [r0] - b _0808263C - .pool -_080825E4: - ldr r0, =sBerryBlenderData - ldr r1, [r0] - movs r3, 0x84 - lsls r3, 1 - adds r0, r1, r3 - str r2, [r0] - movs r0, 0xD0 - lsls r0, 1 - adds r1, r0 - movs r0, 0x3 - str r0, [r1] - b _0808263C - .pool -_08082600: - ldr r2, [r4] -_08082602: - movs r3, 0xD0 - lsls r3, 1 - adds r1, r2, r3 - ldr r0, [r1] - adds r0, 0x1 -_0808260C: - str r0, [r1] - movs r0, 0x84 - lsls r0, 1 - adds r1, r2, r0 - movs r0, 0 - str r0, [r1] - b _0808263C -_0808261A: - ldr r1, [r4] - movs r2, 0x84 - lsls r2, 1 - adds r1, r2 - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - cmp r0, 0x5 - ble _0808263C - ldr r1, =gSoftResetDisabled - movs r0, 0 - strb r0, [r1] - movs r0, 0x1 - b _0808263E - .pool -_0808263C: - movs r0, 0 -_0808263E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80824FC - - thumb_func_start sub_8082644 -sub_8082644: @ 8082644 - push {r4-r6,lr} - sub sp, 0x4 - ldr r1, =sBerryBlenderData - ldr r0, [r1] - adds r0, 0x63 - ldrb r0, [r0] - adds r6, r1, 0 - cmp r0, 0xC - bls _08082658 - b _080828DC -_08082658: - lsls r0, 2 - ldr r1, =_0808266C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0808266C: - .4byte _080826A0 - .4byte _080826EC - .4byte _0808271C - .4byte _08082754 - .4byte _0808278C - .4byte _080827AA - .4byte _080827C8 - .4byte _080827FC - .4byte _08082818 - .4byte _08082828 - .4byte _0808284C - .4byte _080828A4 - .4byte _080828C6 -_080826A0: - ldr r1, [r6] - adds r0, r1, 0 - adds r0, 0x64 - ldrh r2, [r0] - ldr r0, =0x00002222 - cmp r2, r0 - bne _080826B0 - b _080827A2 -_080826B0: - ldr r0, =0x00001111 - cmp r2, r0 - beq _080826B8 - b _080828DC -_080826B8: - adds r0, r1, 0 - adds r0, 0x6C - ldrh r2, [r0] - ldr r0, =0x00009999 - cmp r2, r0 - bne _080826D8 - adds r1, 0x63 - movs r0, 0x2 - strb r0, [r1] - b _080828DC - .pool -_080826D8: - ldr r0, =0x0000aaaa - cmp r2, r0 - bne _080827A2 - adds r1, 0x63 - movs r0, 0x1 - strb r0, [r1] - b _080828DC - .pool -_080826EC: - ldr r0, [r6] - adds r0, 0x63 - movs r1, 0x3 - strb r1, [r0] - ldr r4, =gStringVar4 - ldr r0, [r6] - adds r0, 0x6E - ldrh r0, [r0] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - ldr r0, =gLinkPlayers + 8 - adds r1, r0 - adds r0, r4, 0 - bl StringCopy - ldr r1, =sText_ApostropheSPokeblockCaseIsFull - b _08082740 - .pool -_0808271C: - ldr r1, [r6] - adds r1, 0x63 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r4, =gStringVar4 - ldr r0, [r6] - adds r0, 0x6E - ldrh r0, [r0] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - ldr r0, =gLinkPlayers + 8 - adds r1, r0 - adds r0, r4, 0 - bl StringCopy - ldr r1, =sText_HasNoBerriesToPut -_08082740: - adds r0, r4, 0 - bl StringAppend - b _080828DC - .pool -_08082754: - ldr r4, [r6] - ldr r0, =0x000011b8 - adds r4, r0 - ldr r5, =gStringVar4 - bl GetPlayerTextSpeed - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r5, 0 - bl Blender_PrintText - cmp r0, 0 - bne _08082774 - b _080828DC -_08082774: - ldr r1, [r6] - movs r0, 0x84 - lsls r0, 1 - adds r2, r1, r0 - movs r0, 0 - str r0, [r2] - b _080828BC - .pool -_0808278C: - ldr r4, [r6] - movs r2, 0x84 - lsls r2, 1 - adds r1, r4, r2 - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - cmp r0, 0x3C - bgt _080827A0 - b _080828DC -_080827A0: - adds r1, r4, 0 -_080827A2: - adds r1, 0x63 - movs r0, 0x5 - strb r0, [r1] - b _080828DC -_080827AA: - ldr r0, [r6] - ldr r1, =0x000011b8 - adds r0, r1 - ldr r1, =gText_SavingDontTurnOff2 - movs r2, 0 - bl Blender_PrintText - bl sub_800ADF8 - b _080828BA - .pool -_080827C8: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - bne _080827D4 - b _080828DC -_080827D4: - ldr r3, =sBerryBlenderData - ldr r1, [r3] - movs r2, 0x84 - lsls r2, 1 - adds r0, r1, r2 - movs r2, 0 - str r2, [r0] - adds r1, 0x63 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r3] - movs r1, 0xD0 - lsls r1, 1 - adds r0, r1 - str r2, [r0] - b _080828DC - .pool -_080827FC: - bl sub_80824FC - lsls r0, 24 - cmp r0, 0 - beq _080828DC - movs r0, 0x37 - bl PlaySE - ldr r0, =sBerryBlenderData - ldr r1, [r0] - b _080828BC - .pool -_08082818: - ldr r1, [r6] - adds r1, 0x63 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - bl sub_800ADF8 - b _080828DC -_08082828: - bl sub_800A520 - lsls r0, 24 - cmp r0, 0 - beq _080828DC - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =sBerryBlenderData - ldr r1, [r0] - b _080828BC - .pool -_0808284C: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _080828DC - ldr r2, [r6] - adds r0, r2, 0 - adds r0, 0x64 - ldrh r1, [r0] - ldr r0, =0x00002222 - cmp r1, r0 - bne _08082898 - bl FreeAllWindowBuffers - movs r0, 0x2 - bl UnsetBgTilemapBuffer - movs r0, 0x1 - bl UnsetBgTilemapBuffer - ldr r0, [r6] - bl Free - str r4, [r6] - ldr r0, =DoBerryBlending - bl SetMainCallback2 - b _080828DC - .pool -_08082898: - movs r1, 0x84 - lsls r1, 1 - adds r0, r2, r1 - str r4, [r0] - adds r1, r2, 0 - b _080828BC -_080828A4: - ldr r1, [r6] - movs r2, 0x84 - lsls r2, 1 - adds r1, r2 - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - cmp r0, 0x1E - ble _080828DC - bl sub_800AC34 -_080828BA: - ldr r1, [r6] -_080828BC: - adds r1, 0x63 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080828DC -_080828C6: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r4, [r0] - cmp r4, 0 - bne _080828DC - ldr r0, [r6] - bl Free - str r4, [r6] - ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music - bl SetMainCallback2 -_080828DC: - bl sub_8082AD4 - ldr r0, =sBerryBlenderData - ldr r1, [r0] - movs r2, 0x8E - lsls r2, 1 - adds r0, r1, r2 - movs r2, 0 - ldrsh r0, [r0, r2] - movs r2, 0x8F - lsls r2, 1 - adds r1, r2 - movs r2, 0 - ldrsh r1, [r1, r2] - bl Blender_DummiedOutFunc - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl RunTextPrinters - bl UpdatePaletteFade - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8082644 - - thumb_func_start sub_8082924 -sub_8082924: @ 8082924 - push {r4-r6,lr} - ldr r1, =sBerryBlenderData - ldr r0, [r1] - adds r0, 0x63 - ldrb r0, [r0] - adds r6, r1, 0 - cmp r0, 0xA - bls _08082936 - b _08082A92 -_08082936: - lsls r0, 2 - ldr r1, =_08082948 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08082948: - .4byte _08082974 - .4byte _080829AA - .4byte _080829D4 - .4byte _08082A00 - .4byte _08082A92 - .4byte _08082A92 - .4byte _08082A92 - .4byte _08082A92 - .4byte _08082A92 - .4byte _08082A30 - .4byte _08082A48 -_08082974: - ldr r1, [r6] - adds r0, r1, 0 - adds r0, 0x70 - ldrh r0, [r0] - cmp r0, 0x1 - bhi _08082986 - adds r1, 0x63 - movs r0, 0x9 - strb r0, [r1] -_08082986: - ldr r2, [r6] - adds r0, r2, 0 - adds r0, 0x70 - ldrh r1, [r0] - cmp r1, 0x2 - bne _08082996 - subs r0, 0xD - strb r1, [r0] -_08082996: - ldr r1, [r6] - adds r0, r1, 0 - adds r0, 0x70 - ldrh r0, [r0] - cmp r0, 0x3 - bne _08082A92 - adds r1, 0x63 - movs r0, 0x1 - strb r0, [r1] - b _08082A92 -_080829AA: - ldr r0, [r6] - adds r0, 0x63 - movs r2, 0 - movs r1, 0x3 - strb r1, [r0] - ldr r0, [r6] - ldr r1, =0x000011b8 - adds r0, r1 - strh r2, [r0] - ldr r0, =gStringVar4 - ldr r1, =sText_YourPokeblockCaseIsFull - bl StringCopy - b _08082A92 - .pool -_080829D4: - ldr r1, [r6] - adds r1, 0x63 - ldrb r0, [r1] - adds r0, 0x1 - movs r2, 0 - strb r0, [r1] - ldr r0, [r6] - ldr r1, =0x000011b8 - adds r0, r1 - strh r2, [r0] - ldr r0, =gStringVar4 - ldr r1, =sText_RunOutOfBerriesForBlending - bl StringCopy - b _08082A92 - .pool -_08082A00: - ldr r4, [r6] - ldr r2, =0x000011b8 - adds r4, r2 - ldr r5, =gStringVar4 - bl GetPlayerTextSpeed - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r4, 0 - adds r1, r5, 0 - bl Blender_PrintText - cmp r0, 0 - beq _08082A92 - ldr r0, [r6] - adds r0, 0x63 - movs r1, 0x9 - strb r1, [r0] - b _08082A92 - .pool -_08082A30: - movs r0, 0x3 - bl BeginFastPaletteFade - ldr r0, =sBerryBlenderData - ldr r1, [r0] - adds r1, 0x63 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08082A92 - .pool -_08082A48: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08082A92 - ldr r0, [r6] - adds r0, 0x70 - ldrh r0, [r0] - cmp r0, 0 - bne _08082A70 - ldr r0, =DoBerryBlending - bl SetMainCallback2 - b _08082A76 - .pool -_08082A70: - ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music - bl SetMainCallback2 -_08082A76: - bl FreeAllWindowBuffers - movs r0, 0x2 - bl UnsetBgTilemapBuffer - movs r0, 0x1 - bl UnsetBgTilemapBuffer - ldr r4, =sBerryBlenderData - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] -_08082A92: - bl sub_8082AD4 - ldr r0, =sBerryBlenderData - ldr r1, [r0] - movs r2, 0x8E - lsls r2, 1 - adds r0, r1, r2 - movs r2, 0 - ldrsh r0, [r0, r2] - movs r2, 0x8F - lsls r2, 1 - adds r1, r2 - movs r2, 0 - ldrsh r1, [r1, r2] - bl Blender_DummiedOutFunc - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl RunTextPrinters - bl UpdatePaletteFade - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8082924 - - thumb_func_start sub_8082AD4 -sub_8082AD4: @ 8082AD4 - push {r4-r7,lr} - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _08082AE0 - b _08082CA4 -_08082AE0: - ldr r4, =gRecvCmds - ldrh r0, [r4] - ldr r1, =0x00002fff - movs r2, 0xBC - lsls r2, 6 - bl sub_80814B0 - cmp r0, 0 - beq _08082B66 - ldrh r1, [r4, 0x2] - ldr r0, =0x00001111 - cmp r1, r0 - bne _08082B58 - ldrh r3, [r4, 0x4] - ldr r0, =0x00009999 - cmp r3, r0 - beq _08082B38 - cmp r3, r0 - bgt _08082B24 - ldr r0, =0x00008888 - b _08082B26 - .pool -_08082B24: - ldr r0, =0x0000aaaa -_08082B26: - cmp r3, r0 - beq _08082B38 - ldr r2, =sBerryBlenderData - b _08082B48 - .pool -_08082B38: - ldr r2, =sBerryBlenderData - ldr r0, [r2] - adds r1, r0, 0 - adds r1, 0x6C - strh r3, [r1] - ldrh r1, [r4, 0x6] - adds r0, 0x6E - strh r1, [r0] -_08082B48: - ldr r0, [r2] - adds r0, 0x64 - ldr r1, =0x00001111 - b _08082B64 - .pool -_08082B58: - ldr r0, =0x00002222 - cmp r1, r0 - bne _08082B66 - ldr r0, =sBerryBlenderData - ldr r0, [r0] - adds r0, 0x64 -_08082B64: - strh r1, [r0] -_08082B66: - bl GetMultiplayerId - lsls r0, 24 - cmp r0, 0 - beq _08082B72 - b _08082CA4 -_08082B72: - ldr r2, =sBerryBlenderData - ldr r0, [r2] - adds r0, 0x64 - ldrh r1, [r0] - ldr r0, =0x00001111 - cmp r1, r0 - bne _08082B82 - b _08082CA4 -_08082B82: - ldr r0, =0x00002222 - cmp r1, r0 - bne _08082B8A - b _08082CA4 -_08082B8A: - movs r5, 0 - adds r7, r2, 0 - b _08082BF4 - .pool -_08082B9C: - ldr r6, =gRecvCmds - lsls r4, r5, 4 - adds r0, r4, r6 - ldrh r0, [r0] - ldr r1, =0x00002fff - movs r2, 0xBC - lsls r2, 6 - bl sub_80814B0 - cmp r0, 0 - beq _08082BEE - adds r0, r6, 0x2 - adds r0, r4, r0 - ldrh r2, [r0] - ldr r0, =0x00008888 - cmp r2, r0 - beq _08082BE4 - cmp r2, r0 - bgt _08082BD8 - ldr r0, =0x00007779 - b _08082BE0 - .pool -_08082BD8: - ldr r0, =0x00009999 - cmp r2, r0 - beq _08082BE4 - ldr r0, =0x0000aaaa -_08082BE0: - cmp r2, r0 - bne _08082BEE -_08082BE4: - ldr r0, [r7] - lsls r1, r5, 1 - adds r0, 0x64 - adds r0, r1 - strh r2, [r0] -_08082BEE: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_08082BF4: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - bcc _08082B9C - movs r5, 0 - b _08082C12 - .pool -_08082C0C: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_08082C12: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - bcs _08082C2E - ldr r0, =sBerryBlenderData - ldr r0, [r0] - lsls r1, r5, 1 - adds r0, 0x64 - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0 - bne _08082C0C -_08082C2E: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - bne _08082CA4 - movs r5, 0 - ldr r4, =0x00007779 - b _08082C4E - .pool -_08082C48: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_08082C4E: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - bcs _08082C6A - ldr r0, =sBerryBlenderData - ldr r0, [r0] - lsls r1, r5, 1 - adds r0, 0x64 - adds r0, r1 - ldrh r0, [r0] - cmp r0, r4 - beq _08082C48 -_08082C6A: - ldr r4, =gSendCmd - adds r0, r4, 0 - bl sub_8081F94 - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - bne _08082C90 - ldr r0, =0x00002222 - strh r0, [r4, 0x2] - b _08082CA4 - .pool -_08082C90: - ldr r0, =0x00001111 - strh r0, [r4, 0x2] - ldr r0, =sBerryBlenderData - ldr r0, [r0] - lsls r1, r5, 1 - adds r0, 0x64 - adds r0, r1 - ldrh r0, [r0] - strh r0, [r4, 0x4] - strh r5, [r4, 0x6] -_08082CA4: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8082AD4 - - thumb_func_start sub_8082CB4 -sub_8082CB4: @ 8082CB4 - push {r4,lr} - sub sp, 0x14 - movs r1, 0xF0 - lsls r1, 7 - str r1, [sp] - movs r1, 0xA0 - lsls r1, 7 - str r1, [sp, 0x4] - mov r3, sp - ldr r1, =sBerryBlenderData - ldr r1, [r1] - mov r12, r1 - movs r1, 0x8E - lsls r1, 1 - add r1, r12 - ldrh r2, [r1] - movs r1, 0x78 - subs r1, r2 - strh r1, [r3, 0x8] - movs r1, 0x8F - lsls r1, 1 - add r1, r12 - ldrh r2, [r1] - movs r1, 0x50 - subs r1, r2 - strh r1, [r3, 0xA] - mov r2, sp - movs r3, 0x8D - lsls r3, 1 - add r3, r12 - ldrh r1, [r3] - strh r1, [r2, 0xC] - ldrh r1, [r3] - strh r1, [r2, 0xE] - mov r1, r12 - adds r1, 0x4A - ldrh r1, [r1] - strh r1, [r2, 0x10] - mov r1, sp - ldm r1!, {r2-r4} - stm r0!, {r2-r4} - ldm r1!, {r2,r3} - stm r0!, {r2,r3} - add sp, 0x14 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8082CB4 - - thumb_func_start sub_8082D18 -sub_8082D18: @ 8082D18 - ldr r0, =sBerryBlenderData - ldr r0, [r0] - adds r0, 0x4A - ldrh r0, [r0] - bx lr - .pool - thumb_func_end sub_8082D18 - - thumb_func_start sub_8082D28 -sub_8082D28: @ 8082D28 - push {r4,lr} - movs r1, 0 - ldr r4, =gReceivedRemoteLinkPlayers - ldrb r0, [r4] - cmp r0, 0 - beq _08082D3C - bl GetMultiplayerId - lsls r0, 24 - lsrs r1, r0, 24 -_08082D3C: - ldr r0, =gLinkVSyncDisabled - ldrb r0, [r0] - cmp r0, 0 - beq _08082DCC - ldrb r0, [r4] - cmp r0, 0 - beq _08082DCC - cmp r1, 0 - bne _08082D90 - ldr r0, =sBerryBlenderData - ldr r3, [r0] - adds r2, r3, 0 - adds r2, 0x4A - adds r0, r3, 0 - adds r0, 0x4C - ldrh r0, [r0] - ldrh r1, [r2] - adds r0, r1 - strh r0, [r2] - ldr r1, =gSendCmd - movs r4, 0x8B - lsls r4, 1 - adds r0, r3, r4 - ldrh r0, [r0] - strh r0, [r1, 0xA] - ldrh r0, [r2] - strh r0, [r1, 0xC] - movs r1, 0xA0 - lsls r1, 1 - adds r0, r3, r1 - bl sub_8082CB4 - b _08082DEA - .pool -_08082D90: - ldr r3, =gRecvCmds - ldrh r0, [r3] - movs r1, 0xFF - lsls r1, 8 - ands r1, r0 - movs r0, 0x88 - lsls r0, 7 - cmp r1, r0 - bne _08082DEA - ldr r0, =sBerryBlenderData - ldr r2, [r0] - ldrh r0, [r3, 0xA] - movs r4, 0x8B - lsls r4, 1 - adds r1, r2, r4 - strh r0, [r1] - ldrh r0, [r3, 0xC] - adds r1, r2, 0 - adds r1, 0x4A - strh r0, [r1] - movs r1, 0xA0 - lsls r1, 1 - adds r0, r2, r1 - bl sub_8082CB4 - b _08082DEA - .pool -_08082DCC: - ldr r0, =sBerryBlenderData - ldr r1, [r0] - adds r2, r1, 0 - adds r2, 0x4A - adds r0, r1, 0 - adds r0, 0x4C - ldrh r0, [r0] - ldrh r3, [r2] - adds r0, r3 - strh r0, [r2] - movs r4, 0xA0 - lsls r4, 1 - adds r0, r1, r4 - bl sub_8082CB4 -_08082DEA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8082D28 - - thumb_func_start BerryBlender_SetGpuRegs -BerryBlender_SetGpuRegs: @ 8082DF4 - push {r4-r6,lr} - ldr r4, =sBerryBlenderData - ldr r0, [r4] - movs r6, 0x8E - lsls r6, 1 - adds r0, r6 - ldrh r1, [r0] - movs r0, 0x14 - bl SetGpuReg - ldr r0, [r4] - movs r5, 0x8F - lsls r5, 1 - adds r0, r5 - ldrh r1, [r0] - movs r0, 0x16 - bl SetGpuReg - ldr r0, [r4] - adds r0, r6 - ldrh r1, [r0] - movs r0, 0x10 - bl SetGpuReg - ldr r0, [r4] - adds r0, r5 - ldrh r1, [r0] - movs r0, 0x12 - bl SetGpuReg - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end BerryBlender_SetGpuRegs - - thumb_func_start sub_8082E3C -sub_8082E3C: @ 8082E3C - push {lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x2E] - ldrh r1, [r2, 0x32] - adds r0, r1 - strh r0, [r2, 0x32] - ldrh r0, [r2, 0x30] - ldrh r1, [r2, 0x34] - adds r0, r1 - strh r0, [r2, 0x34] - movs r1, 0x32 - ldrsh r0, [r2, r1] - cmp r0, 0 - bge _08082E5A - adds r0, 0x7 -_08082E5A: - asrs r0, 3 - strh r0, [r2, 0x24] - movs r1, 0x34 - ldrsh r0, [r2, r1] - cmp r0, 0 - bge _08082E68 - adds r0, 0x7 -_08082E68: - asrs r0, 3 - strh r0, [r2, 0x26] - adds r0, r2, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08082E80 - adds r0, r2, 0 - bl DestroySprite -_08082E80: - pop {r0} - bx r0 - thumb_func_end sub_8082E3C - - thumb_func_start sub_8082E84 -sub_8082E84: @ 8082E84 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - bl Random - lsls r0, 16 - lsrs r1, r0, 16 - movs r0, 0x1 - ands r1, r0 - adds r0, r1, 0x1 - cmp r0, 0 - beq _08082F40 - ldr r0, =gSineTable - mov r9, r0 - ldr r2, =gSprites - mov r10, r2 - adds r6, r1, 0x1 - movs r3, 0x1F - mov r8, r3 - movs r7, 0x10 -_08082EB0: - bl Random - ldr r1, =sBerryBlenderData - ldr r4, [r1] - adds r4, 0x4A - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x14 - bl __umodsi3 - ldrh r1, [r4] - adds r1, r0 - lsls r1, 16 - movs r0, 0xFF - lsls r0, 16 - ands r0, r1 - lsrs r2, r0, 16 - adds r0, r2, 0 - adds r0, 0x40 - lsls r0, 1 - add r0, r9 - movs r3, 0 - ldrsh r1, [r0, r3] - cmp r1, 0 - bge _08082EE4 - adds r1, 0x3 -_08082EE4: - asrs r1, 2 - lsls r0, r2, 1 - add r0, r9 - movs r2, 0 - ldrsh r0, [r0, r2] - cmp r0, 0 - bge _08082EF4 - adds r0, 0x3 -_08082EF4: - asrs r2, r0, 2 - adds r1, 0x78 - adds r2, 0x50 - ldr r0, =gUnknown_08339BE0 - movs r3, 0x1 - bl CreateSprite - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl Random - lsls r5, r4, 4 - adds r5, r4 - lsls r5, 2 - mov r3, r10 - adds r4, r5, r3 - lsls r0, 16 - lsrs r0, 16 - mov r1, r8 - ands r0, r1 - subs r0, r7, r0 - strh r0, [r4, 0x2E] - bl Random - lsls r0, 16 - lsrs r0, 16 - mov r2, r8 - ands r0, r2 - subs r0, r7, r0 - strh r0, [r4, 0x30] - ldr r3, =gSprites + 0x1C - adds r5, r3 - ldr r0, =sub_8082E3C - str r0, [r5] - subs r6, 0x1 - cmp r6, 0 - bne _08082EB0 -_08082F40: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8082E84 - - thumb_func_start sub_8082F68 -sub_8082F68: @ 8082F68 - push {r4,lr} - adds r4, r0, 0 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - movs r1, 0x2E - ldrsh r0, [r4, r1] - movs r1, 0x3 - bl __divsi3 - negs r0, r0 - strh r0, [r4, 0x26] - adds r0, r4, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08082F94 - adds r0, r4, 0 - bl DestroySprite -_08082F94: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8082F68 - - thumb_func_start sub_8082F9C -sub_8082F9C: @ 8082F9C - push {lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x2E] - adds r0, 0x1 - strh r0, [r2, 0x2E] - movs r1, 0x2E - ldrsh r0, [r2, r1] - lsls r0, 1 - negs r0, r0 - strh r0, [r2, 0x26] - lsls r0, 16 - asrs r0, 16 - movs r1, 0xC - negs r1, r1 - cmp r0, r1 - bge _08082FC0 - ldr r0, =0x0000fff4 - strh r0, [r2, 0x26] -_08082FC0: - adds r0, r2, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08082FD4 - adds r0, r2, 0 - bl DestroySprite -_08082FD4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8082F9C - - thumb_func_start Blender_SetBankBerryData -Blender_SetBankBerryData: @ 8082FDC - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 16 - lsrs r1, 16 - ldr r2, =sBerryBlenderData - ldr r3, [r2] - lsls r4, r0, 1 - adds r2, r3, 0 - adds r2, 0x74 - adds r2, r4 - strh r1, [r2] - lsls r0, 4 - movs r2, 0xAC - lsls r2, 1 - adds r0, r2 - adds r3, r0 - adds r0, r3, 0 - bl Blender_CopyBerryData - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end Blender_SetBankBerryData - - thumb_func_start sub_8083010 -sub_8083010: @ 8083010 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _0808304C - cmp r0, 0x1 - bgt _08083026 - cmp r0, 0 - beq _0808302C - b _080830B2 -_08083026: - cmp r0, 0x2 - beq _08083066 - b _080830B2 -_0808302C: - ldrh r0, [r4, 0x30] - adds r0, 0x8 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x58 - ble _080830B2 - movs r0, 0x58 - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - movs r0, 0x38 - bl PlaySE - b _080830B2 -_0808304C: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x14 - ble _080830B2 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - movs r0, 0 - strh r0, [r4, 0x32] - b _080830B2 -_08083066: - ldrh r0, [r4, 0x30] - adds r0, 0x4 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xB0 - ble _080830B2 - ldrh r0, [r4, 0x34] - adds r0, 0x1 - adds r1, r0, 0 - strh r0, [r4, 0x34] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3 - bne _080830A0 - adds r0, r4, 0 - bl DestroySprite - ldr r0, =gUnknown_08339C60 - movs r2, 0x14 - negs r2, r2 - movs r1, 0x78 - movs r3, 0x2 - bl CreateSprite - b _080830B2 - .pool -_080830A0: - movs r0, 0 - strh r0, [r4, 0x2E] - ldr r0, =0x0000fff0 - strh r0, [r4, 0x30] - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim -_080830B2: - ldrh r0, [r4, 0x30] - strh r0, [r4, 0x26] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8083010 - - thumb_func_start sub_80830C0 -sub_80830C0: @ 80830C0 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _080830FC - cmp r0, 0x1 - bgt _080830D6 - cmp r0, 0 - beq _080830DC - b _08083130 -_080830D6: - cmp r0, 0x2 - beq _08083112 - b _08083130 -_080830DC: - ldrh r0, [r4, 0x30] - adds r0, 0x8 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5C - ble _08083130 - movs r0, 0x5C - strh r0, [r4, 0x30] - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - movs r0, 0x15 - bl PlaySE - b _08083130 -_080830FC: - ldrh r0, [r4, 0x32] - adds r0, 0x1 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x14 - ble _08083130 - ldrh r0, [r4, 0x2E] - adds r0, 0x1 - strh r0, [r4, 0x2E] - b _08083130 -_08083112: - ldrh r0, [r4, 0x30] - adds r0, 0x4 - strh r0, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xB0 - ble _08083130 - ldr r0, =sBerryBlenderData - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - adds r0, r4, 0 - bl DestroySprite -_08083130: - ldrh r0, [r4, 0x30] - strh r0, [r4, 0x26] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80830C0 - - thumb_func_start sub_8083140 -sub_8083140: @ 8083140 - push {lr} - lsls r0, 16 - lsrs r0, 16 - lsls r1, 16 - lsrs r3, r1, 16 - ldr r1, =sBerryBlenderData - ldr r1, [r1] - movs r2, 0x8C - lsls r2, 1 - adds r1, r2 - ldrh r2, [r1] - cmp r2, r0 - bcs _08083166 - adds r0, r2, 0x2 - strh r0, [r1] - ldrh r0, [r1] - adds r1, r3, 0 - bl sub_8083170 -_08083166: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8083140 - - thumb_func_start sub_8083170 -sub_8083170: @ 8083170 - push {r4-r7,lr} - lsls r0, 16 - lsls r1, 16 - lsrs r1, 16 - ldr r7, =0x06006000 - lsrs r0, 10 - bl __divsi3 - adds r1, r0, 0 - cmp r1, 0 - bge _08083188 - adds r0, r1, 0x7 -_08083188: - asrs r4, r0, 3 - movs r3, 0 - cmp r3, r4 - bge _080831B0 - ldr r0, =0x000080e9 - adds r6, r0, 0 - adds r0, 0x10 - adds r5, r0, 0 - adds r2, r7, 0 - adds r2, 0x56 - adds r0, r7, 0 - adds r3, r4, 0 -_080831A0: - strh r6, [r0, 0x16] - strh r5, [r2] - adds r2, 0x2 - adds r0, 0x2 - subs r3, 0x1 - cmp r3, 0 - bne _080831A0 - adds r3, r4, 0 -_080831B0: - adds r0, r1, 0 - cmp r1, 0 - bge _080831B8 - adds r0, r1, 0x7 -_080831B8: - asrs r2, r0, 3 - lsls r0, r2, 3 - subs r2, r1, r0 - cmp r2, 0 - beq _080831D6 - lsls r0, r3, 1 - adds r0, r7 - ldr r4, =0xffff80e1 - adds r1, r2, r4 - strh r1, [r0, 0x16] - adds r0, 0x56 - adds r4, 0x10 - adds r1, r2, r4 - strh r1, [r0] - adds r3, 0x1 -_080831D6: - cmp r3, 0x7 - bgt _080831FA - ldr r0, =0x000080e1 - adds r4, r0, 0 - adds r0, 0x10 - adds r2, r0, 0 - lsls r1, r3, 1 - adds r0, r1, 0 - adds r0, 0x56 - adds r0, r7 - adds r1, r7 -_080831EC: - strh r4, [r1, 0x16] - strh r2, [r0] - adds r0, 0x2 - adds r1, 0x2 - adds r3, 0x1 - cmp r3, 0x7 - ble _080831EC -_080831FA: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8083170 - - thumb_func_start sub_8083210 -sub_8083210: @ 8083210 - push {lr} - lsls r0, 16 - lsrs r0, 16 - ldr r1, =0x00057e40 - muls r0, r1 - cmp r0, 0 - bge _08083222 - ldr r1, =0x0000ffff - adds r0, r1 -_08083222: - asrs r0, 16 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8083210 - - thumb_func_start sub_8083230 -sub_8083230: @ 8083230 - push {r4-r6,lr} - sub sp, 0x8 - lsls r0, 16 - lsrs r0, 16 - bl sub_8083210 - adds r5, r0, 0 - ldr r0, =sBerryBlenderData - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0x4E - ldrh r0, [r1] - cmp r0, r5 - bcs _0808324E - strh r5, [r1] -_0808324E: - movs r6, 0 -_08083250: - mov r0, sp - adds r4, r0, r6 - adds r0, r5, 0 - movs r1, 0xA - bl __umodsi3 - strb r0, [r4] - adds r0, r5, 0 - movs r1, 0xA - bl __udivsi3 - adds r5, r0, 0 - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x4 - bls _08083250 - ldr r2, =0x06006458 - mov r0, sp - ldr r3, =0x00008072 - adds r1, r3, 0 - ldrb r0, [r0, 0x4] - adds r0, r1, r0 - strh r0, [r2] - adds r2, 0x2 - mov r0, sp - ldrb r0, [r0, 0x3] - adds r0, r1 - strh r0, [r2] - adds r2, 0x2 - mov r0, sp - ldrb r0, [r0, 0x2] - adds r0, r1 - strh r0, [r2] - adds r2, 0x4 - mov r0, sp - ldrb r0, [r0, 0x1] - adds r0, r1 - strh r0, [r2] - adds r2, 0x2 - mov r0, sp - ldrb r0, [r0] - adds r1, r0 - strh r1, [r2] - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8083230 - - thumb_func_start sub_80832BC -sub_80832BC: @ 80832BC - push {r4-r6,lr} - adds r6, r0, 0 - lsls r4, r1, 16 - lsrs r5, r4, 16 - movs r1, 0 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _080832E0 - bl Random - lsls r0, 16 - lsrs r0, 16 - adds r1, r5, 0 - bl __umodsi3 - lsrs r1, r4, 17 - subs r0, r1 - strh r0, [r6] -_080832E0: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80832BC - - thumb_func_start sub_80832E8 -sub_80832E8: @ 80832E8 - push {lr} - adds r1, r0, 0 - ldrh r2, [r1] - movs r3, 0 - ldrsh r0, [r1, r3] - cmp r0, 0 - bge _080832FA - adds r0, r2, 0x1 - strh r0, [r1] -_080832FA: - ldrh r2, [r1] - movs r3, 0 - ldrsh r0, [r1, r3] - cmp r0, 0 - ble _08083308 - subs r0, r2, 0x1 - strh r0, [r1] -_08083308: - pop {r0} - bx r0 - thumb_func_end sub_80832E8 - - thumb_func_start sub_808330C -sub_808330C: @ 808330C - push {r4,lr} - ldr r4, =sBerryBlenderData - ldr r0, [r4] - movs r1, 0x8E - lsls r1, 1 - adds r0, r1 - bl sub_80832E8 - ldr r0, [r4] - movs r1, 0x8F - lsls r1, 1 - adds r0, r1 - bl sub_80832E8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808330C - - thumb_func_start sub_8083334 -sub_8083334: @ 8083334 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r1, 16 - lsrs r1, 16 - movs r5, 0x8 - cmp r1, 0x9 - bhi _08083344 - movs r5, 0x10 -_08083344: - ldrh r0, [r4] - movs r2, 0 - ldrsh r1, [r4, r2] - cmp r1, 0 - bne _08083362 - bl Random - lsls r0, 16 - lsrs r0, 16 - adds r1, r5, 0 - bl __modsi3 - lsrs r1, r5, 1 - subs r0, r1 - b _08083376 -_08083362: - cmp r1, 0 - bge _0808336A - adds r0, 0x1 - strh r0, [r4] -_0808336A: - ldrh r1, [r4] - movs r2, 0 - ldrsh r0, [r4, r2] - cmp r0, 0 - ble _08083378 - subs r0, r1, 0x1 -_08083376: - strh r0, [r4] -_08083378: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8083334 - - thumb_func_start sub_8083380 -sub_8083380: @ 8083380 - push {r4,r5,lr} - ldr r5, =sBerryBlenderData - ldr r2, [r5] - movs r4, 0x84 - lsls r4, 1 - adds r0, r2, r4 - ldr r1, [r0] - cmp r1, 0 - bne _080833A0 - movs r3, 0x8E - lsls r3, 1 - adds r0, r2, r3 - strh r1, [r0] - adds r3, 0x2 - adds r0, r2, r3 - strh r1, [r0] -_080833A0: - ldr r0, [r5] - adds r2, r0, r4 - ldr r1, [r2] - adds r1, 0x1 - str r1, [r2] - movs r2, 0x8E - lsls r2, 1 - adds r0, r2 - lsls r1, 16 - lsrs r1, 16 - bl sub_8083334 - ldr r1, [r5] - movs r3, 0x8F - lsls r3, 1 - adds r0, r1, r3 - adds r1, r4 - ldrh r1, [r1] - bl sub_8083334 - ldr r2, [r5] - adds r0, r2, r4 - ldr r0, [r0] - cmp r0, 0x14 - beq _080833DC - movs r0, 0 - b _080833F0 - .pool -_080833DC: - movs r1, 0x8E - lsls r1, 1 - adds r0, r2, r1 - movs r1, 0 - strh r1, [r0] - movs r3, 0x8F - lsls r3, 1 - adds r0, r2, r3 - strh r1, [r0] - movs r0, 0x1 -_080833F0: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8083380 - - thumb_func_start sub_80833F8 -sub_80833F8: @ 80833F8 - ldr r1, =sBerryBlenderData - ldr r2, [r1] - movs r3, 0x8E - lsls r3, 1 - adds r1, r2, r3 - ldrh r1, [r1] - negs r1, r1 - strh r1, [r0, 0x24] - adds r3, 0x2 - adds r1, r2, r3 - ldrh r1, [r1] - negs r1, r1 - strh r1, [r0, 0x26] - bx lr - .pool - thumb_func_end sub_80833F8 - - thumb_func_start UpdateBerryBlenderRecord -@ void UpdateBerryBlenderRecord() -UpdateBerryBlenderRecord: @ 8083418 - push {lr} - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldr r0, =sBerryBlenderData - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0x7C - ldrb r0, [r0] - subs r0, 0x2 - lsls r0, 1 - ldr r3, =0x000009bc - adds r2, r3 - adds r2, r0 - adds r1, 0x4E - ldrh r1, [r1] - ldrh r0, [r2] - cmp r0, r1 - bcs _0808343E - strh r1, [r2] -_0808343E: - pop {r0} - bx r0 - .pool - thumb_func_end UpdateBerryBlenderRecord - - thumb_func_start berry_blender_related -berry_blender_related: @ 8083450 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4C - ldr r1, =sBerryBlenderData - ldr r0, [r1] - ldrb r0, [r0] - adds r4, r1, 0 - cmp r0, 0x6 - bls _0808346A - b _08083898 -_0808346A: - lsls r0, 2 - ldr r1, =_0808347C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0808347C: - .4byte _08083498 - .4byte _080834AE - .4byte _080834C8 - .4byte _08083518 - .4byte _08083790 - .4byte _080837A8 - .4byte _0808386C -_08083498: - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r4] - movs r1, 0x84 - lsls r1, 1 - adds r0, r1 - movs r1, 0x11 - str r1, [r0] - b _08083898 -_080834AE: - ldr r1, [r4] - movs r3, 0x84 - lsls r3, 1 - adds r2, r1, r3 - ldr r0, [r2] - subs r0, 0xA - str r0, [r2] - cmp r0, 0 - blt _080834C2 - b _08083898 -_080834C2: - movs r0, 0 - str r0, [r2] - b _08083854 -_080834C8: - ldr r1, [r4] - movs r0, 0x84 - lsls r0, 1 - adds r1, r0 - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - cmp r0, 0x14 - bgt _080834DC - b _08083898 -_080834DC: - movs r6, 0 -_080834DE: - ldr r4, =sBerryBlenderData - ldr r0, [r4] - adds r0, 0x46 - adds r0, r6 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x2 - bls _080834DE - ldr r1, [r4] - movs r3, 0x84 - lsls r3, 1 - adds r2, r1, r3 - movs r0, 0 - str r0, [r2] - b _08083854 - .pool -_08083518: - ldr r4, =sText_BlendingResults - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0xA8 - bl GetStringCenterAlignXOffset - lsls r2, r0, 24 - lsrs r2, 24 - movs r0, 0xFF - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - movs r0, 0x5 - adds r1, r4, 0 - movs r3, 0x1 - bl Blender_AddTextPrinter - ldr r1, =sBerryBlenderData - ldr r0, [r1] - adds r2, r0, 0 - adds r2, 0x7C - ldrb r0, [r2] - movs r3, 0x15 - mov r9, r3 - cmp r0, 0x4 - bne _08083550 - movs r0, 0x11 - mov r9, r0 -_08083550: - movs r6, 0 - mov r3, sp - adds r3, 0x10 - str r3, [sp, 0x48] - ldrb r2, [r2] - cmp r6, r2 - bcs _0808361A - adds r7, r1, 0 - movs r0, 0x3 - mov r10, r0 -_08083564: - ldr r0, [r7] - movs r2, 0x9E - lsls r2, 1 - adds r1, r0, r2 - adds r1, r6 - ldrb r5, [r1] - adds r0, 0x9F - adds r6, 0x1 - mov r8, r6 - mov r1, r8 - movs r2, 0 - movs r3, 0x1 - bl ConvertIntToDecimalStringN - ldr r0, [r7] - adds r0, 0x9F - ldr r1, =sText_Dot - bl StringAppend - ldr r0, [r7] - adds r0, 0x9F - ldr r1, =gText_Space - bl StringAppend - ldr r0, [r7] - adds r0, 0x9F - lsls r4, r5, 3 - subs r4, r5 - lsls r4, 2 - ldr r3, =gLinkPlayers + 8 - adds r1, r4, r3 - bl StringAppend - ldr r1, [r7] - adds r1, 0x9F - mov r0, r9 - lsls r6, r0, 24 - lsrs r6, 24 - movs r2, 0xFF - str r2, [sp] - mov r3, r10 - str r3, [sp, 0x4] - movs r0, 0x5 - movs r2, 0x8 - adds r3, r6, 0 - bl Blender_AddTextPrinter - ldr r1, [r7] - adds r0, r1, 0 - adds r0, 0x9F - lsls r5, 4 - adds r5, r1 - movs r1, 0xAD - lsls r1, 1 - adds r5, r1 - adds r1, r5, 0 - bl StringCopy - ldr r0, [r7] - adds r0, 0x9F - ldr r2, =gLinkPlayers - adds r4, r2 - ldrb r1, [r4, 0x1A] - bl ConvertInternationalString - ldr r0, [r7] - adds r0, 0x9F - ldr r1, =sText_SpaceBerry - bl StringAppend - ldr r1, [r7] - adds r1, 0x9F - movs r3, 0xFF - str r3, [sp] - mov r0, r10 - str r0, [sp, 0x4] - movs r0, 0x5 - movs r2, 0x54 - adds r3, r6, 0 - bl Blender_AddTextPrinter - movs r1, 0x10 - add r9, r1 - mov r2, r8 - lsls r2, 16 - lsrs r6, r2, 16 - ldr r0, [r7] - adds r0, 0x7C - ldrb r0, [r0] - cmp r6, r0 - bcc _08083564 -_0808361A: - ldr r1, =sText_MaximumSpeed - movs r3, 0xFF - mov r10, r3 - str r3, [sp] - movs r0, 0x3 - mov r9, r0 - str r0, [sp, 0x4] - movs r0, 0x5 - movs r2, 0 - movs r3, 0x51 - bl Blender_AddTextPrinter - ldr r6, =sBerryBlenderData - ldr r0, [r6] - adds r4, r0, 0 - adds r4, 0x9F - adds r0, 0x4E - ldrh r0, [r0] - movs r1, 0x64 - bl __udivsi3 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r0, [r6] - adds r0, 0x9F - ldr r1, =sText_Dot - bl StringAppend - ldr r0, [r6] - adds r0, 0x4E - ldrh r0, [r0] - movs r1, 0x64 - bl __umodsi3 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - ldr r0, [sp, 0x48] - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r0, [r6] - adds r0, 0x9F - ldr r1, [sp, 0x48] - bl StringAppend - ldr r0, [r6] - adds r0, 0x9F - ldr r1, =sText_RPM - bl StringAppend - ldr r1, [r6] - adds r1, 0x9F - movs r0, 0x1 - movs r2, 0xA8 - bl GetStringRightAlignXOffset - ldr r1, [r6] - adds r1, 0x9F - lsls r2, r0, 24 - lsrs r2, 24 - mov r3, r10 - str r3, [sp] - mov r0, r9 - str r0, [sp, 0x4] - movs r0, 0x5 - movs r3, 0x51 - bl Blender_AddTextPrinter - ldr r1, =sText_Time - mov r2, r10 - str r2, [sp] - mov r3, r9 - str r3, [sp, 0x4] - movs r0, 0x5 - movs r2, 0 - movs r3, 0x61 - bl Blender_AddTextPrinter - ldr r5, [r6] - movs r1, 0x82 - lsls r1, 1 - adds r0, r5, r1 - ldr r0, [r0] - mov r8, r0 - movs r1, 0x3C - bl __udivsi3 - movs r1, 0x3C - bl __umodsi3 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - movs r1, 0xE1 - lsls r1, 4 - mov r0, r8 - bl __udivsi3 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r5, 0x9F - adds r0, r5, 0 - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r0, [r6] - adds r0, 0x9F - ldr r1, =sText_Min - bl StringAppend - adds r1, r4, 0 - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r0, [r6] - adds r0, 0x9F - ldr r1, =sText_Sec - bl StringAppend - ldr r1, [r6] - adds r1, 0x9F - movs r0, 0x1 - movs r2, 0xA8 - bl GetStringRightAlignXOffset - ldr r1, [r6] - adds r1, 0x9F - lsls r2, r0, 24 - lsrs r2, 24 - mov r3, r10 - str r3, [sp] - mov r0, r9 - str r0, [sp, 0x4] - movs r0, 0x5 - movs r3, 0x61 - bl Blender_AddTextPrinter - ldr r1, [r6] - movs r3, 0x84 - lsls r3, 1 - adds r2, r1, r3 - movs r0, 0 - str r0, [r2] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - movs r0, 0x5 - movs r1, 0x2 - bl CopyWindowToVram - b _08083898 - .pool -_08083790: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0808379E - b _08083898 -_0808379E: - ldr r1, [r4] - b _08083854 - .pool -_080837A8: - movs r0, 0x5 - movs r1, 0x1 - bl sub_8198070 - movs r6, 0 - add r7, sp, 0x40 - ldr r5, =sBerryBlenderData -_080837B6: - ldr r0, [r5] - lsls r2, r6, 1 - adds r0, 0x74 - adds r0, r2 - ldrh r1, [r0] - cmp r1, 0 - beq _080837CC - add r0, sp, 0x38 - adds r0, r2 - subs r1, 0x85 - strh r1, [r0] -_080837CC: - ldr r0, [r5] - adds r0, 0x8E - adds r0, r2 - ldrh r0, [r0] - cmp r0, 0xFF - beq _080837EA - lsls r4, r6, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl PutWindowTilemap - adds r0, r4, 0 - movs r1, 0x3 - bl CopyWindowToVram -_080837EA: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x3 - bls _080837B6 - bl sub_8081E20 - ldr r4, =sBerryBlenderData - ldr r3, [r4] - movs r1, 0xAC - lsls r1, 1 - adds r0, r3, r1 - adds r1, r3, 0 - adds r1, 0x7C - ldrb r2, [r1] - subs r1, 0x2E - ldrh r1, [r1] - str r1, [sp] - adds r1, r7, 0 - add r3, sp, 0x8 - bl sub_8081BE0 - ldr r1, [r4] - adds r1, 0x9F - adds r0, r7, 0 - bl sub_80838AC - ldr r1, [r4] - movs r2, 0xD4 - lsls r2, 1 - adds r1, r2 - adds r0, r7, 0 - bl sub_8083F94 - ldr r0, =sub_8083F3C - movs r1, 0x6 - bl CreateTask - bl sub_80EECEC - ldr r0, =gSpecialVar_ItemId - ldrh r0, [r0] - movs r1, 0x1 - bl RemoveBagItem - adds r0, r7, 0 - bl sub_8136F2C - ldr r1, [r4] - ldr r3, =0x000011b8 - adds r2, r1, r3 - movs r0, 0 - strh r0, [r2] -_08083854: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08083898 - .pool -_0808386C: - ldr r4, [r4] - ldr r0, =0x000011b8 - adds r5, r4, r0 - adds r4, 0x9F - bl GetPlayerTextSpeed - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r5, 0 - adds r1, r4, 0 - bl Blender_PrintText - cmp r0, 0 - beq _08083898 - bl UpdateBerryBlenderRecord - movs r0, 0x1 - b _0808389A - .pool -_08083898: - movs r0, 0 -_0808389A: - add sp, 0x4C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end berry_blender_related - - thumb_func_start sub_80838AC -sub_80838AC: @ 80838AC - push {r4-r6,lr} - sub sp, 0xC - adds r5, r0, 0 - adds r6, r1, 0 - movs r0, 0xFF - strb r0, [r6] - ldr r1, =gPokeblockNames - ldrb r0, [r5] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - adds r0, r6, 0 - bl StringCopy - ldr r1, =gText_WasMade - adds r0, r6, 0 - bl StringAppend - ldr r1, =sText_NewLine - adds r0, r6, 0 - bl StringAppend - adds r0, r5, 0 - bl sub_8136EA4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r5, 0 - bl sub_8136EDC - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r1, =sText_TheLevelIs - adds r0, r6, 0 - bl StringAppend - mov r0, sp - adds r1, r4, 0 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r0, r6, 0 - mov r1, sp - bl StringAppend - ldr r1, =sText_TheFeelIs - adds r0, r6, 0 - bl StringAppend - mov r0, sp - adds r1, r5, 0 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r0, r6, 0 - mov r1, sp - bl StringAppend - ldr r1, =sText_Dot2 - adds r0, r6, 0 - bl StringAppend - ldr r1, =gText_NewParagraph - adds r0, r6, 0 - bl StringAppend - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80838AC - - thumb_func_start sub_808395C -sub_808395C: @ 808395C - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - mov r9, r0 - mov r12, r2 - lsls r1, 24 - lsrs r7, r1, 24 - movs r0, 0 - cmp r0, r7 - bge _080839A8 -_08083972: - movs r5, 0 - adds r1, r0, 0x1 - mov r8, r1 - cmp r5, r7 - bge _080839A2 - mov r1, r9 - adds r6, r1, r0 -_08083980: - ldrb r4, [r6] - lsls r1, r4, 2 - add r1, r12 - mov r0, r9 - adds r2, r0, r5 - ldrb r3, [r2] - lsls r0, r3, 2 - add r0, r12 - ldr r1, [r1] - ldr r0, [r0] - cmp r1, r0 - bls _0808399C - strb r3, [r6] - strb r4, [r2] -_0808399C: - adds r5, 0x1 - cmp r5, r7 - blt _08083980 -_080839A2: - mov r0, r8 - cmp r0, r7 - blt _08083972 -_080839A8: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_808395C - - thumb_func_start sub_80839B4 -sub_80839B4: @ 80839B4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - movs r5, 0 - ldr r2, =sBerryBlenderData - ldr r0, [r2] - adds r0, 0x7C - adds r1, r2, 0 - add r3, sp, 0x4 - mov r10, r3 - b _080839E4 - .pool -_080839D4: - mov r4, sp - adds r0, r4, r5 - strb r5, [r0] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, [r2] - adds r0, 0x7C -_080839E4: - ldrb r0, [r0] - cmp r5, r0 - bcc _080839D4 - movs r5, 0 - ldr r0, [r1] - adds r1, r0, 0 - adds r1, 0x7C - ldrb r2, [r1] - cmp r5, r2 - bcs _08083A5E - mov r9, r10 - movs r3, 0x92 - lsls r3, 1 - adds r3, r0 - mov r8, r3 - mov r12, r1 - movs r4, 0x93 - lsls r4, 1 - adds r7, r0, r4 - movs r1, 0x94 - lsls r1, 1 - adds r6, r0, r1 -_08083A10: - lsls r4, r5, 2 - add r4, r9 - lsls r3, r5, 1 - adds r3, r5 - lsls r3, 1 - mov r2, r8 - adds r0, r2, r3 - ldrh r2, [r0] - lsls r0, r2, 5 - subs r0, r2 - lsls r1, r0, 6 - subs r1, r0 - lsls r1, 3 - adds r1, r2 - lsls r1, 6 - str r1, [r4] - adds r0, r7, r3 - ldrh r2, [r0] - lsls r0, r2, 5 - subs r0, r2 - lsls r0, 2 - adds r0, r2 - lsls r0, 3 - adds r1, r0 - str r1, [r4] - movs r0, 0xFA - lsls r0, 2 - adds r1, r0 - adds r3, r6, r3 - ldrh r0, [r3] - subs r1, r0 - str r1, [r4] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - mov r1, r12 - ldrb r1, [r1] - cmp r5, r1 - bcc _08083A10 -_08083A5E: - ldr r4, =sBerryBlenderData - ldr r0, [r4] - adds r0, 0x7C - ldrb r1, [r0] - mov r0, sp - mov r2, r10 - bl sub_808395C - movs r5, 0 - ldr r0, [r4] - adds r0, 0x7C - ldrb r0, [r0] - cmp r5, r0 - bcs _08083A9E - adds r2, r4, 0 - movs r3, 0x9E - lsls r3, 1 -_08083A80: - ldr r1, [r2] - adds r1, r3 - adds r1, r5 - mov r4, sp - adds r0, r4, r5 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, [r2] - adds r0, 0x7C - ldrb r0, [r0] - cmp r5, r0 - bcc _08083A80 -_08083A9E: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _08083AB4 - movs r3, 0 - b _08083ABC - .pool -_08083AB4: - bl GetMultiplayerId - lsls r0, 24 - lsrs r3, r0, 24 -_08083ABC: - movs r5, 0 - ldr r1, =sBerryBlenderData - ldr r0, [r1] - adds r0, 0x7C - ldrb r0, [r0] - cmp r5, r0 - bcs _08083AF2 - movs r6, 0x9E - lsls r6, 1 - movs r4, 0xD2 - lsls r4, 1 -_08083AD2: - ldr r2, [r1] - adds r0, r2, r6 - adds r0, r5 - ldrb r0, [r0] - cmp r0, r3 - bne _08083AE2 - adds r0, r2, r4 - strb r5, [r0] -_08083AE2: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, [r1] - adds r0, 0x7C - ldrb r0, [r0] - cmp r5, r0 - bcc _08083AD2 -_08083AF2: - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80839B4 - - thumb_func_start sub_8083B08 -sub_8083B08: @ 8083B08 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - ldr r1, =sBerryBlenderData - ldr r0, [r1] - ldrb r0, [r0] - adds r2, r1, 0 - cmp r0, 0x6 - bls _08083B22 - b _08083E12 -_08083B22: - lsls r0, 2 - ldr r1, =_08083B34 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08083B34: - .4byte _08083B50 - .4byte _08083B66 - .4byte _08083B80 - .4byte _08083B9A - .4byte _08083DC8 - .4byte _08083DE2 - .4byte _08083E08 -_08083B50: - ldr r1, [r2] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, [r2] - movs r1, 0x84 - lsls r1, 1 - adds r0, r1 - movs r1, 0xFF - str r1, [r0] - b _08083E12 -_08083B66: - ldr r1, [r2] - movs r3, 0x84 - lsls r3, 1 - adds r2, r1, r3 - ldr r0, [r2] - subs r0, 0xA - str r0, [r2] - cmp r0, 0 - blt _08083B7A - b _08083E12 -_08083B7A: - movs r0, 0 - str r0, [r2] - b _08083DF8 -_08083B80: - ldr r1, [r2] - movs r0, 0x84 - lsls r0, 1 - adds r2, r1, r0 - ldr r0, [r2] - adds r0, 0x1 - str r0, [r2] - cmp r0, 0x14 - bgt _08083B94 - b _08083E12 -_08083B94: - movs r0, 0 - str r0, [r2] - b _08083DF8 -_08083B9A: - movs r0, 0x5 - movs r1, 0 - movs r2, 0x1 - movs r3, 0xD - bl SetWindowBorderStyle - ldr r4, =sText_Ranking - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0xA8 - bl GetStringCenterAlignXOffset - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0xFF - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - movs r0, 0x5 - adds r1, r4, 0 - movs r3, 0x1 - bl Blender_AddTextPrinter - ldr r1, =gUnknown_08339B40 - mov r8, r1 - mov r0, r8 - movs r1, 0x80 - movs r2, 0x34 - movs r3, 0 - bl CreateSprite - ldr r7, =sBerryBlenderData - ldr r1, [r7] - adds r1, 0x46 - strb r0, [r1] - ldr r0, [r7] - adds r0, 0x46 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r6, =gSprites - adds r0, r6 - movs r1, 0x3 - bl StartSpriteAnim - ldr r0, [r7] - adds r0, 0x46 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r5, r6, 0 - adds r5, 0x1C - adds r0, r5 - ldr r4, =SpriteCallbackDummy - str r4, [r0] - mov r0, r8 - movs r1, 0xA0 - movs r2, 0x34 - movs r3, 0 - bl CreateSprite - ldr r1, [r7] - adds r1, 0x47 - strb r0, [r1] - ldr r0, [r7] - adds r0, 0x47 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - str r4, [r0] - mov r0, r8 - movs r1, 0xC0 - movs r2, 0x34 - movs r3, 0 - bl CreateSprite - ldr r1, [r7] - adds r1, 0x48 - strb r0, [r1] - ldr r0, [r7] - adds r0, 0x48 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0x1 - bl StartSpriteAnim - ldr r0, [r7] - adds r0, 0x48 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - str r4, [r0] - bl sub_80839B4 - movs r2, 0x29 - str r2, [sp, 0x8] - movs r2, 0 - ldr r0, [r7] - adds r0, 0x7C - ldrb r0, [r0] - cmp r2, r0 - bcc _08083C7C - b _08083D8A -_08083C7C: - movs r3, 0xFF - mov r10, r3 - movs r0, 0x3 - mov r9, r0 -_08083C84: - ldr r0, [r7] - movs r3, 0x9E - lsls r3, 1 - adds r1, r0, r3 - adds r1, r2 - ldrb r5, [r1] - adds r0, 0x9F - adds r2, 0x1 - mov r8, r2 - mov r1, r8 - movs r2, 0 - movs r3, 0x1 - bl ConvertIntToDecimalStringN - ldr r0, [r7] - adds r0, 0x9F - ldr r1, =sText_Dot - bl StringAppend - ldr r0, [r7] - adds r0, 0x9F - ldr r1, =gText_Space - bl StringAppend - ldr r0, [r7] - adds r0, 0x9F - lsls r1, r5, 3 - subs r1, r5 - lsls r1, 2 - ldr r2, =gLinkPlayers + 8 - adds r1, r2 - bl StringAppend - ldr r1, [r7] - adds r1, 0x9F - ldr r0, [sp, 0x8] - lsls r6, r0, 24 - lsrs r6, 24 - mov r2, r10 - str r2, [sp] - mov r3, r9 - str r3, [sp, 0x4] - movs r0, 0x5 - movs r2, 0 - adds r3, r6, 0 - bl Blender_AddTextPrinter - ldr r1, [r7] - adds r0, r1, 0 - adds r0, 0x9F - lsls r4, r5, 1 - adds r4, r5 - lsls r4, 1 - movs r2, 0x92 - lsls r2, 1 - adds r1, r2 - adds r1, r4 - ldrh r1, [r1] - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r1, [r7] - adds r1, 0x9F - mov r3, r10 - str r3, [sp] - mov r0, r9 - str r0, [sp, 0x4] - movs r0, 0x5 - movs r2, 0x4E - adds r3, r6, 0 - bl Blender_AddTextPrinter - ldr r1, [r7] - adds r0, r1, 0 - adds r0, 0x9F - movs r2, 0x93 - lsls r2, 1 - adds r1, r2 - adds r1, r4 - ldrh r1, [r1] - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r1, [r7] - adds r1, 0x9F - mov r3, r10 - str r3, [sp] - mov r0, r9 - str r0, [sp, 0x4] - movs r0, 0x5 - movs r2, 0x6E - adds r3, r6, 0 - bl Blender_AddTextPrinter - ldr r1, [r7] - adds r0, r1, 0 - adds r0, 0x9F - movs r2, 0x94 - lsls r2, 1 - adds r1, r2 - adds r1, r4 - ldrh r1, [r1] - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r1, [r7] - adds r1, 0x9F - mov r3, r10 - str r3, [sp] - mov r0, r9 - str r0, [sp, 0x4] - movs r0, 0x5 - movs r2, 0x8E - adds r3, r6, 0 - bl Blender_AddTextPrinter - ldr r1, [sp, 0x8] - adds r1, 0x10 - str r1, [sp, 0x8] - mov r2, r8 - lsls r2, 16 - lsrs r2, 16 - ldr r0, [r7] - adds r0, 0x7C - ldrb r0, [r0] - cmp r2, r0 - bcs _08083D8A - b _08083C84 -_08083D8A: - movs r0, 0x5 - bl PutWindowTilemap - movs r0, 0x5 - movs r1, 0x3 - bl CopyWindowToVram - ldr r0, =sBerryBlenderData - ldr r1, [r0] - movs r3, 0x84 - lsls r3, 1 - adds r2, r1, r3 - movs r0, 0 - str r0, [r2] - b _08083DF8 - .pool -_08083DC8: - ldr r2, [r2] - movs r0, 0x84 - lsls r0, 1 - adds r1, r2, r0 - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - cmp r0, 0x14 - ble _08083E12 - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] - b _08083E12 -_08083DE2: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08083E12 - movs r0, 0x5 - bl PlaySE - ldr r0, =sBerryBlenderData - ldr r1, [r0] -_08083DF8: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08083E12 - .pool -_08083E08: - ldr r1, [r2] - movs r0, 0 - strb r0, [r1] - movs r0, 0x1 - b _08083E14 -_08083E12: - movs r0, 0 -_08083E14: - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8083B08 - - thumb_func_start ShowBerryBlenderRecordWindow -ShowBerryBlenderRecordWindow: @ 8083E24 - push {r4-r7,lr} - sub sp, 0x34 - ldr r0, =gUnknown_08339D14 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x2C] - str r1, [sp, 0x30] - ldr r5, =gUnknown_0203AB74 - add r0, sp, 0x2C - bl AddWindow - strb r0, [r5] - ldrb r0, [r5] - movs r1, 0 - bl sub_81973FC - ldrb r0, [r5] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r6, =gText_BlenderMaxSpeedRecord - movs r0, 0x1 - adds r1, r6, 0 - movs r2, 0x90 - bl GetStringCenterAlignXOffset - adds r3, r0, 0 - ldrb r0, [r5] - lsls r3, 24 - lsrs r3, 24 - movs r1, 0x1 - str r1, [sp] - movs r4, 0 - str r4, [sp, 0x4] - str r4, [sp, 0x8] - adds r2, r6, 0 - bl PrintTextOnWindow - ldrb r0, [r5] - ldr r2, =gText_234Players - movs r1, 0x29 - str r1, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x4 - bl PrintTextOnWindow - movs r6, 0 - movs r7, 0xA4 - lsls r7, 22 -_08083E8A: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - lsls r1, r6, 1 - ldr r2, =0x000009bc - adds r0, r2 - adds r0, r1 - ldrh r4, [r0] - adds r0, r4, 0 - movs r1, 0x64 - bl __udivsi3 - adds r1, r0, 0 - add r0, sp, 0xC - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r5, r0, 0 - ldr r1, =sText_Dot - bl StringAppend - adds r5, r0, 0 - adds r0, r4, 0 - movs r1, 0x64 - bl __umodsi3 - adds r1, r0, 0 - adds r0, r5, 0 - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - adds r5, r0, 0 - ldr r1, =sText_RPM - bl StringAppend - movs r0, 0x1 - add r1, sp, 0xC - movs r2, 0x8C - bl GetStringRightAlignXOffset - adds r3, r0, 0 - ldr r4, =gUnknown_0203AB74 - ldrb r0, [r4] - lsls r3, 24 - lsrs r3, 24 - lsrs r1, r7, 24 - str r1, [sp] - movs r1, 0 - str r1, [sp, 0x4] - str r1, [sp, 0x8] - movs r1, 0x1 - add r2, sp, 0xC - bl PrintTextOnWindow - movs r0, 0x80 - lsls r0, 21 - adds r7, r0 - adds r6, 0x1 - cmp r6, 0x2 - ble _08083E8A - ldrb r0, [r4] - bl PutWindowTilemap - ldrb r0, [r4] - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0x34 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end ShowBerryBlenderRecordWindow - - thumb_func_start sub_8083F3C -sub_8083F3C: @ 8083F3C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - movs r1, 0x8 - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08083F62 - ldr r0, =0x0000016f - bl PlayFanfare - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_08083F62: - bl IsFanfareTaskInactive - lsls r0, 24 - cmp r0, 0 - beq _08083F82 - ldr r0, =sBerryBlenderData - ldr r0, [r0] - movs r1, 0xAA - lsls r1, 1 - adds r0, r1 - ldrh r0, [r0] - bl PlayBGM - adds r0, r5, 0 - bl DestroyTask -_08083F82: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8083F3C - - thumb_func_start sub_8083F94 -sub_8083F94: @ 8083F94 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - adds r6, r0, 0 - adds r7, r1, 0 - bl sub_8136EA4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r6, 0 - bl sub_8136EDC - adds r1, r0, 0 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 1 - lsls r1, 24 - lsrs r1, 24 - bl __divsi3 - lsls r0, 16 - lsrs r3, r0, 16 - strb r3, [r7, 0xD] - ldrb r0, [r6] - strb r0, [r7, 0xC] - movs r0, 0xFF - strb r0, [r7] - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _080840C4 - ldr r0, =sBerryBlenderData - ldr r2, [r0] - movs r4, 0xD2 - lsls r4, 1 - adds r1, r2, r4 - ldrb r1, [r1] - mov r8, r0 - cmp r1, 0 - bne _08084058 - cmp r3, 0x14 - bls _08084058 - adds r0, r2, 0 - adds r0, 0x7C - ldrb r1, [r0] - subs r1, 0x1 - movs r0, 0x9E - lsls r0, 1 - mov r9, r0 - adds r0, r2, r0 - adds r0, r1 - ldrb r0, [r0] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - ldr r5, =gLinkPlayers + 8 - adds r1, r5 - adds r0, r7, 0 - bl StringCopy - adds r0, r6, 0 - bl sub_81370B4 - strb r0, [r7, 0xB] - ldrb r1, [r7, 0xB] - ldrb r2, [r7, 0xC] - ldrb r3, [r7, 0xD] - mov r6, r8 - ldr r4, [r6] - adds r0, r4, 0 - adds r0, 0x7C - ldrb r0, [r0] - subs r0, 0x1 - add r4, r9 - adds r4, r0 - ldrb r4, [r4] - lsls r0, r4, 3 - subs r0, r4 - lsls r0, 2 - adds r5, r0 - ldrb r0, [r5, 0x12] - str r0, [sp] - adds r0, r7, 0 - bl Put3CheersForPokeblocksOnTheAir - lsls r0, 24 - cmp r0, 0 - bne _080840BA - b _080840C4 - .pool -_08084058: - mov r0, r8 - ldr r2, [r0] - movs r1, 0xD2 - lsls r1, 1 - adds r0, r2, r1 - ldrb r1, [r0] - adds r0, r2, 0 - adds r0, 0x7C - ldrb r0, [r0] - subs r0, 0x1 - cmp r1, r0 - bne _080840C4 - cmp r3, 0x14 - bhi _080840C4 - movs r4, 0x9E - lsls r4, 1 - adds r0, r2, r4 - ldrb r0, [r0] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - ldr r5, =gLinkPlayers + 8 - adds r1, r5 - adds r0, r7, 0 - bl StringCopy - adds r0, r6, 0 - bl sub_81370B4 - strb r0, [r7, 0xB] - ldrb r1, [r7, 0xB] - ldrb r2, [r7, 0xC] - ldrb r3, [r7, 0xD] - mov r6, r8 - ldr r0, [r6] - adds r0, r4 - ldrb r4, [r0] - lsls r0, r4, 3 - subs r0, r4 - lsls r0, 2 - adds r5, r0 - ldrb r0, [r5, 0x12] - str r0, [sp] - adds r0, r7, 0 - bl Put3CheersForPokeblocksOnTheAir - lsls r0, 24 - cmp r0, 0 - beq _080840C4 -_080840BA: - movs r0, 0x1 - b _080840C6 - .pool -_080840C4: - movs r0, 0 -_080840C6: - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8083F94 - - thumb_func_start Blender_AddTextPrinter -Blender_AddTextPrinter: @ 80840D4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x18 - mov r9, r1 - ldr r4, [sp, 0x38] - lsls r0, 24 - lsrs r6, r0, 24 - lsls r2, 24 - lsrs r2, 24 - mov r8, r2 - lsls r3, 24 - lsrs r7, r3, 24 - movs r5, 0 - cmp r4, 0x1 - beq _08084116 - cmp r4, 0x1 - bgt _08084100 - cmp r4, 0 - beq _08084108 - b _08084132 -_08084100: - cmp r4, 0x2 - beq _08084124 - cmp r4, 0x3 - bne _08084136 -_08084108: - add r1, sp, 0x14 - movs r0, 0x1 - strb r0, [r1] - movs r0, 0x2 - strb r0, [r1, 0x1] - movs r0, 0x3 - b _08084130 -_08084116: - add r0, sp, 0x14 - strb r5, [r0] - adds r1, r0, 0 - movs r0, 0x2 - strb r0, [r1, 0x1] - movs r0, 0x3 - b _08084130 -_08084124: - add r0, sp, 0x14 - strb r5, [r0] - adds r1, r0, 0 - movs r0, 0x4 - strb r0, [r1, 0x1] - movs r0, 0x5 -_08084130: - strb r0, [r1, 0x2] -_08084132: - cmp r4, 0x3 - beq _08084148 -_08084136: - add r0, sp, 0x14 - ldrb r0, [r0] - lsls r1, r0, 4 - orrs r1, r0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl FillWindowPixelBuffer -_08084148: - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - add r0, sp, 0x14 - str r0, [sp, 0x8] - ldr r0, [sp, 0x34] - lsls r0, 24 - asrs r0, 24 - str r0, [sp, 0xC] - mov r0, r9 - str r0, [sp, 0x10] - adds r0, r6, 0 - movs r1, 0x1 - mov r2, r8 - adds r3, r7, 0 - bl AddTextPrinterParametrized2 - add sp, 0x18 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end Blender_AddTextPrinter - - thumb_func_start Blender_PrintText -Blender_PrintText: @ 808417C - push {r4-r7,lr} - sub sp, 0x8 - adds r5, r0, 0 - adds r7, r1, 0 - adds r6, r2, 0 - movs r0, 0 - ldrsh r4, [r5, r0] - cmp r4, 0 - beq _08084194 - cmp r4, 0x1 - beq _080841C6 - b _080841DA -_08084194: - movs r0, 0x4 - movs r1, 0 - movs r2, 0x14 - movs r3, 0xF - bl sub_8197B1C - str r6, [sp] - str r4, [sp, 0x4] - movs r0, 0x4 - adds r1, r7, 0 - movs r2, 0 - movs r3, 0x1 - bl Blender_AddTextPrinter - movs r0, 0x4 - bl PutWindowTilemap - movs r0, 0x4 - movs r1, 0x3 - bl CopyWindowToVram - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - b _080841DA -_080841C6: - movs r0, 0x4 - bl IsTextPrinterActive - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _080841DA - strh r0, [r5] - movs r0, 0x1 - b _080841DC -_080841DA: - movs r0, 0 -_080841DC: - add sp, 0x8 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end Blender_PrintText - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/link.s b/asm/link.s index 92fc951020..1ce6f77109 100644 --- a/asm/link.s +++ b/asm/link.s @@ -646,7 +646,7 @@ _08009976: orrs r1, r0 _08009990: adds r0, r2, 0 - bl sub_800A994 + bl SetLinkDebugValues _08009996: add sp, 0x4 pop {r4,r5} @@ -2644,15 +2644,15 @@ _0800A94E: .pool thumb_func_end task00_link_test - thumb_func_start sub_800A994 -sub_800A994: @ 800A994 + thumb_func_start SetLinkDebugValues +SetLinkDebugValues: @ 800A994 ldr r2, =gUnknown_0300302C str r0, [r2] ldr r0, =gUnknown_03003070 str r1, [r0] bx lr .pool - thumb_func_end sub_800A994 + thumb_func_end SetLinkDebugValues thumb_func_start sub_800A9A8 sub_800A9A8: @ 800A9A8 @@ -12305,7 +12305,7 @@ sub_800F820: @ 800F820 lsls r0, 24 cmp r0, 0 bne _0800F83C - bl sub_8082D18 + bl GetBlenderArrowPosition ldr r1, =gSendCmd strh r0, [r1, 0xC] _0800F83C: diff --git a/asm/rom6.s b/asm/rom6.s index 719feaae0a..6fed08e6ca 100644 --- a/asm/rom6.s +++ b/asm/rom6.s @@ -1223,7 +1223,7 @@ sub_8135F04: @ 8135F04 adds r4, 0x1 ldr r6, =gStringVar1 adds r0, r5, 0 - bl sub_8136EA4 + bl GetHighestPokeblocksFlavourLevel adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -1364,7 +1364,7 @@ _08136032: bls _08136002 ldr r4, =gStringVar1 mov r0, r8 - bl sub_8136EDC + bl GetPokeblocksFeel adds r1, r0, 0 lsls r1, 24 lsrs r1, 24 @@ -2995,8 +2995,8 @@ _08136E8C: bx r0 thumb_func_end ClearPokeblocks - thumb_func_start sub_8136EA4 -sub_8136EA4: @ 8136EA4 + thumb_func_start GetHighestPokeblocksFlavourLevel +GetHighestPokeblocksFlavourLevel: @ 8136EA4 push {r4-r6,lr} adds r6, r0, 0 movs r1, 0x1 @@ -3024,10 +3024,10 @@ _08136ECC: pop {r4-r6} pop {r1} bx r1 - thumb_func_end sub_8136EA4 + thumb_func_end GetHighestPokeblocksFlavourLevel - thumb_func_start sub_8136EDC -sub_8136EDC: @ 8136EDC + thumb_func_start GetPokeblocksFeel +GetPokeblocksFeel: @ 8136EDC push {lr} movs r1, 0x6 bl sub_8136F9C @@ -3039,10 +3039,10 @@ sub_8136EDC: @ 8136EDC _08136EEE: pop {r1} bx r1 - thumb_func_end sub_8136EDC + thumb_func_end GetPokeblocksFeel - thumb_func_start sub_8136EF4 -sub_8136EF4: @ 8136EF4 + thumb_func_start GetFirstFreePokeblockSlot +GetFirstFreePokeblockSlot: @ 8136EF4 push {lr} movs r1, 0 ldr r0, =gSaveBlock1Ptr @@ -3070,13 +3070,13 @@ _08136F18: _08136F26: pop {r1} bx r1 - thumb_func_end sub_8136EF4 + thumb_func_end GetFirstFreePokeblockSlot - thumb_func_start sub_8136F2C -sub_8136F2C: @ 8136F2C + thumb_func_start AddPokeblock +AddPokeblock: @ 8136F2C push {r4,lr} adds r4, r0, 0 - bl sub_8136EF4 + bl GetFirstFreePokeblockSlot lsls r0, 24 asrs r1, r0, 24 movs r0, 0x1 @@ -3102,7 +3102,7 @@ _08136F62: pop {r4} pop {r1} bx r1 - thumb_func_end sub_8136F2C + thumb_func_end AddPokeblock thumb_func_start sub_8136F68 sub_8136F68: @ 8136F68 @@ -3287,8 +3287,8 @@ _081370AC: bx r1 thumb_func_end sub_8137068 - thumb_func_start sub_81370B4 -sub_81370B4: @ 81370B4 + thumb_func_start GetPokeblocksFlavour +GetPokeblocksFlavour: @ 81370B4 push {r4-r7,lr} adds r5, r0, 0 movs r7, 0 @@ -3324,7 +3324,7 @@ _081370E2: pop {r4-r7} pop {r1} bx r1 - thumb_func_end sub_81370B4 + thumb_func_end GetPokeblocksFlavour thumb_func_start sub_81370FC sub_81370FC: @ 81370FC diff --git a/data/scripts/pokeblocks.inc b/data/scripts/pokeblocks.inc index d8f2f2e482..a93c44615e 100644 --- a/data/scripts/pokeblocks.inc +++ b/data/scripts/pokeblocks.inc @@ -290,7 +290,7 @@ LilycoveCity_ContestLobby_EventScript_293CEE:: @ 8293CEE checkitem ITEM_POKEBLOCK_CASE, 1 compare_var_to_value VAR_RESULT, 0 goto_eq LilycoveCity_ContestLobby_EventScript_293D43 - specialvar VAR_RESULT, sub_8136EF4 + specialvar VAR_RESULT, GetFirstFreePokeblockSlot compare_var_to_value VAR_RESULT, 65535 goto_eq LilycoveCity_ContestLobby_EventScript_293D39 specialvar VAR_RESULT, PlayerHasBerries @@ -365,7 +365,7 @@ LilycoveCity_ContestLobby_EventScript_293DC6:: @ 8293DC6 compare_var_to_value VAR_RESULT, 0 goto_eq LilycoveCity_ContestLobby_EventScript_293E14 msgbox LilycoveCity_ContestLobby_Text_293237, 4 - specialvar VAR_RESULT, sub_8136EF4 + specialvar VAR_RESULT, GetFirstFreePokeblockSlot compare_var_to_value VAR_RESULT, 65535 goto_if 5, LilycoveCity_ContestLobby_EventScript_293D91 compare_var_to_value VAR_RESULT, 65535 @@ -431,7 +431,7 @@ LilycoveCity_ContestLobby_EventScript_293EA3:: @ 8293EA3 compare_var_to_value VAR_RESULT, 0 goto_eq LilycoveCity_ContestLobby_EventScript_293EF1 msgbox LilycoveCity_ContestLobby_Text_29354E, 4 - specialvar VAR_RESULT, sub_8136EF4 + specialvar VAR_RESULT, GetFirstFreePokeblockSlot compare_var_to_value VAR_RESULT, 65535 goto_if 5, LilycoveCity_ContestLobby_EventScript_293E6E compare_var_to_value VAR_RESULT, 65535 @@ -470,7 +470,7 @@ LilycoveCity_ContestLobby_EventScript_293F28:: @ 8293F28 specialvar VAR_RESULT, PlayerHasBerries compare_var_to_value VAR_RESULT, 0 goto_eq LilycoveCity_ContestLobby_EventScript_293F1E - specialvar VAR_RESULT, sub_8136EF4 + specialvar VAR_RESULT, GetFirstFreePokeblockSlot compare_var_to_value VAR_RESULT, 65535 goto_if 5, LilycoveCity_ContestLobby_EventScript_293F64 compare_var_to_value VAR_RESULT, 65535 @@ -536,7 +536,7 @@ LilycoveCity_ContestLobby_EventScript_293FF8:: @ 8293FF8 checkitem ITEM_POKEBLOCK_CASE, 1 compare_var_to_value VAR_RESULT, 0 goto_eq LilycoveCity_ContestLobby_EventScript_294028 - specialvar VAR_RESULT, sub_8136EF4 + specialvar VAR_RESULT, GetFirstFreePokeblockSlot compare_var_to_value VAR_RESULT, 65535 goto_eq LilycoveCity_ContestLobby_EventScript_294028 dodailyevents @@ -570,7 +570,7 @@ LilycoveCity_ContestLobby_EventScript_294055:: @ 8294055 checkitem ITEM_POKEBLOCK_CASE, 1 compare_var_to_value VAR_RESULT, 0 goto_eq LilycoveCity_ContestLobby_EventScript_29416C - specialvar VAR_RESULT, sub_8136EF4 + specialvar VAR_RESULT, GetFirstFreePokeblockSlot compare_var_to_value VAR_RESULT, 65535 goto_if 5, LilycoveCity_ContestLobby_EventScript_294092 compare_var_to_value VAR_RESULT, 65535 diff --git a/data/specials.inc b/data/specials.inc index dac9467fd6..003435ce47 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -170,7 +170,7 @@ gSpecials:: @ 81DBA64 def_special sub_80B086C def_special ChangePokemonNickname def_special sub_81B94B0 - def_special sub_8136EF4 + def_special GetFirstFreePokeblockSlot def_special DoBerryBlending def_special sub_8142BC8 def_special sub_813BD60 diff --git a/include/berry_blender.h b/include/berry_blender.h new file mode 100644 index 0000000000..fb62e3fa35 --- /dev/null +++ b/include/berry_blender.h @@ -0,0 +1,8 @@ +#ifndef GUARD_BERRY_BLENDER_H +#define GUARD_BERRY_BLENDER_H + +void DoBerryBlending(void); +u16 GetBlenderArrowPosition(void); +void ShowBerryBlenderRecordWindow(void); + +#endif // GUARD_BERRY_BLENDER_H diff --git a/include/menu.h b/include/menu.h index e93d688e43..2052a8dadc 100644 --- a/include/menu.h +++ b/include/menu.h @@ -1,6 +1,7 @@ #ifndef GUARD_MENU_H #define GUARD_MENU_H +#include "text.h" #include "window.h" struct MenuAction @@ -31,5 +32,7 @@ void CreateYesNoMenu(const struct WindowTemplate *windowTemplate, u16 borderFirs s8 sub_8198C58(void); void do_scheduled_bg_tilemap_copies_to_vram(void); void clear_scheduled_bg_copies_to_vram(void); +void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor *color, s8 speed, const u8 *str); +void sub_8197B1C(u8 windowId, bool8 copyToVram, u16 a2, u16 a3); #endif // GUARD_MENU_H diff --git a/include/pokeblock.h b/include/pokeblock.h index 5d52f8e55a..0247ab2e0e 100644 --- a/include/pokeblock.h +++ b/include/pokeblock.h @@ -22,24 +22,13 @@ enum PBLOCK_FEEL, }; +// rom6 void ClearPokeblocks(void); +s8 GetFirstFreePokeblockSlot(void); -/* -void sub_810B96C(void); -u8 sub_810BA50(s16, s16, u8); -u8 sub_810C9B0(struct Pokeblock *); -s16 GetPokeblockData(const struct Pokeblock *, u8); -u8 sub_810C9E8(struct Pokeblock *); -void sub_810BA7C(u8); -bool8 PokeblockClearIfExists(u8); -s16 PokeblockGetGain(u8, const struct Pokeblock *); -u8 sub_810CB68(u8, u8*); -void PokeblockCopyName(struct Pokeblock *pokeblock, u8 *dest); -void CB2_PreparePokeblockFeedScene(void); - -#include "main.h" - -void sub_8136130(struct Pokeblock *, MainCallback); -*/ +bool32 AddPokeblock(struct Pokeblock *pokeblock); +u8 GetHighestPokeblocksFlavourLevel(const struct Pokeblock *pokeblock); +u8 GetPokeblocksFeel(const struct Pokeblock *pokeblock); +u8 GetPokeblocksFlavour(const struct Pokeblock *pokeblock); #endif // GUARD_POKEBLOCK_H diff --git a/include/text.h b/include/text.h index 594661717e..86a25df3a3 100644 --- a/include/text.h +++ b/include/text.h @@ -85,6 +85,8 @@ #define NUM_TEXT_PRINTERS 32 +#define TEXT_SPEED_FF 0xFF + struct TextPrinterSubStruct { u8 font_type:4; // 0x14 diff --git a/include/tv.h b/include/tv.h index 43f36d69f1..35b41cef90 100644 --- a/include/tv.h +++ b/include/tv.h @@ -13,5 +13,6 @@ void sub_80EE184(void); void sub_80EEA70(void); void sub_80F14F8(TVShow *shows); size_t sub_80EF370(int value); +bool8 Put3CheersForPokeblocksOnTheAir(const u8 *partnersName, u8 flavor, u8 unused, u8 sheen, u8 language); #endif //GUARD_TV_H diff --git a/ld_script.txt b/ld_script.txt index c6ee53febe..2732c8d4cd 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -86,7 +86,6 @@ SECTIONS { asm/load_save.o(.text); asm/trade.o(.text); src/berry_blender.o(.text); - asm/berry_blender.o(.text); src/play_time.o(.text); src/new_game.o(.text); asm/rom4.o(.text); diff --git a/src/berry_blender.c b/src/berry_blender.c index 21706d4dc6..869f8b8345 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -1,4 +1,5 @@ #include "global.h" +#include "berry_blender.h" #include "bg.h" #include "window.h" #include "task.h" @@ -18,12 +19,16 @@ #include "new_menu_helpers.h" #include "item_menu_icons.h" #include "berry.h" +#include "item.h" #include "items.h" #include "string_util.h" #include "international_string_util.h" #include "rng.h" +#include "menu.h" +#include "pokeblock.h" +#include "trig.h" +#include "tv.h" -// Static type declarations #define BLENDER_SCORE_BEST 0 #define BLENDER_SCORE_GOOD 1 #define BLENDER_SCORE_MISS 2 @@ -31,6 +36,14 @@ #define BLENDER_MAX_PLAYERS 4 #define BLENDER_SCORES_NO 3 +enum +{ + PLAY_AGAIN_OK, + DONT_PLAY_AGAIN, + CANT_PLAY_NO_BERRIES, + CANT_PLAY_NO_PKBLCK_SPACE +}; + struct BlenderBerry { u16 itemId; @@ -39,317 +52,87 @@ struct BlenderBerry u8 smoothness; }; +struct TimeAndRPM +{ + u32 time; + u16 max_RPM; +}; + +struct BlenderGameBlock +{ + struct TimeAndRPM timeRPM; + u16 scores[BLENDER_MAX_PLAYERS][BLENDER_SCORES_NO]; +}; + +struct TvBlenderStruct +{ + u8 name[11]; + u8 pokeblockFlavour; + u8 pokeblockColor; + u8 pokeblockSheen; +}; + struct BerryBlenderData { u8 mainState; u8 loadGfxState; - u8 field_02; - u8 field_03; - u8 field_04; - u8 field_05; - u8 field_06; - u8 field_07; - u8 field_08; - u8 field_09; - u8 field_0A; - u8 field_0B; - u8 field_0C; - u8 field_0D; - u8 field_0E; - u8 field_0F; - - u8 field_10; - u8 field_11; - u8 field_12; - u8 field_13; - u8 field_14; - u8 field_15; - u8 field_16; - u8 field_17; - u8 field_18; - u8 field_19; - u8 field_1A; - u8 field_1B; - u8 field_1C; - u8 field_1D; - u8 field_1E; - u8 field_1F; - - u8 field_20; - u8 field_21; - u8 field_22; - u8 field_23; - u8 field_24; - u8 field_25; - u8 field_26; - u8 field_27; - u8 field_28; - u8 field_29; - u8 field_2A; - u8 field_2B; - u8 field_2C; - u8 field_2D; - u8 field_2E; - u8 field_2F; - - u8 field_30; - u8 field_31; - u8 field_32; - u8 field_33; - u8 field_34; - u8 field_35; - u8 field_36; - u8 field_37; - u8 field_38; - u8 field_39; - u8 field_3A; - u8 field_3B; - u8 field_3C; - u8 field_3D; - u8 field_3E; - u8 field_3F; - - u8 field_40; - u8 field_41; - u8 field_42; - u8 field_43; + u8 unused_02[0x42]; u16 field_44; - u8 field_46; - u8 field_47; - u16 field_48; + u8 scoreIconIds[BLENDER_SCORES_NO]; u16 arrowPos; s16 field_4C; - s16 field_4E; - + u16 max_RPM; u8 syncArrowSpriteIds[BLENDER_MAX_PLAYERS]; u8 syncArrowSprite2Ids[BLENDER_MAX_PLAYERS]; - u8 field_58; - u8 field_59; - u8 field_5A; - u8 field_5B; - u8 field_5C; - u8 field_5D; - u8 field_5E; - u8 field_5F; - - u8 field_60; - u8 field_61; - u8 field_62; - u8 field_63; + u8 unused_57[0xB]; + u8 gameEndState; u16 field_64[BLENDER_MAX_PLAYERS]; - u8 field_6C; - u8 field_6D; - u8 field_6E; - u8 field_6F; - - u16 field_70; + u16 field_6C; + u16 field_6E; + u16 playAgainState; u8 field_72; - u8 field_73; u16 chosenItemId[BLENDER_MAX_PLAYERS]; u8 playersNo; - u8 field_7D; - u8 field_7E; - u8 field_7F; - - u8 field_80; - u8 field_81; - u8 field_82; - u8 field_83; - u8 field_84; - u8 field_85; - u8 field_86; - u8 field_87; - u8 field_88; - u8 field_89; - u8 field_8A; - u8 field_8B; - u8 field_8C; - u8 field_8D; + u8 unused_7D[0x10]; u16 field_8E[BLENDER_MAX_PLAYERS]; u16 field_96[BLENDER_MAX_PLAYERS]; - u8 field_9E; - u8 field_9F; - - u8 field_A0; - u8 field_A1; - u8 field_A2; - u8 field_A3; - u8 field_A4; - u8 field_A5; - u8 field_A6; - u8 field_A7; - u8 field_A8; - u8 field_A9; - u8 field_AA; - u8 field_AB; - u8 field_AC; - u8 field_AD; - u8 field_AE; - u8 field_AF; - - u8 field_B0; - u8 field_B1; - u8 field_B2; - u8 field_B3; - u8 field_B4; - u8 field_B5; - u8 field_B6; - u8 field_B7; - u8 field_B8; - u8 field_B9; - u8 field_BA; - u8 field_BB; - u8 field_BC; - u8 field_BD; - u8 field_BE; - u8 field_BF; - - u8 field_C0; - u8 field_C1; - u8 field_C2; - u8 field_C3; - u8 field_C4; - u8 field_C5; - u8 field_C6; - u8 field_C7; - u8 field_C8; - u8 field_C9; - u8 field_CA; - u8 field_CB; - u8 field_CC; - u8 field_CD; - u8 field_CE; - u8 field_CF; - - u8 field_D0; - u8 field_D1; - u8 field_D2; - u8 field_D3; - u8 field_D4; - u8 field_D5; - u8 field_D6; - u8 field_D7; - u8 field_D8; - u8 field_D9; - u8 field_DA; - u8 field_DB; - u8 field_DC; - u8 field_DD; - u8 field_DE; - u8 field_DF; - - u8 field_E0; - u8 field_E1; - u8 field_E2; - u8 field_E3; - u8 field_E4; - u8 field_E5; - u8 field_E6; - u8 field_E7; - u8 field_E8; - u8 field_E9; - u8 field_EA; - u8 field_EB; - u8 field_EC; - u8 field_ED; - u8 field_EE; - u8 field_EF; - - u8 field_F0; - u8 field_F1; - u8 field_F2; - u8 field_F3; - u8 field_F4; - u8 field_F5; - u8 field_F6; - u8 field_F7; - u8 field_F8; - u8 field_F9; - u8 field_FA; - u8 field_FB; - u8 field_FC; - u8 field_FD; - u8 field_FE; - u8 field_FF; - - u8 field_100; - u8 field_101; - u8 field_102; - u8 field_103; + u8 yesNoAnswer; + u8 stringVar[100]; u32 gameFrameTime; s32 framesToWait; u32 field_10C; - - u8 field_110; - u8 field_111; - u8 field_112; - u8 field_113; + u8 unused_110[4]; u8 field_114; - u8 field_115; u16 field_116; u16 field_118; u16 field_11A; - s16 field_11C; - s16 field_11E; - + u16 bg_X; + u16 bg_Y; u8 field_120[3]; u8 field_123; u16 scores[BLENDER_MAX_PLAYERS][BLENDER_SCORES_NO]; - u8 field_13C; - u8 field_13D; - u8 field_13E; - u8 field_13F; - + u8 playerPlaces[BLENDER_MAX_PLAYERS]; struct BgAffineSrcData bgAffineSrc; - u16 field_154; - u8 field_156; - u8 field_157; struct BlenderBerry blendedBerries[BLENDER_MAX_PLAYERS]; - u8 field_198; - u8 field_199; - u8 field_19A; - u8 field_19B; - u8 field_19C; - u8 field_19D; - u8 field_19E; - u8 field_19F; - - u8 field_1A0; - u8 field_1A1; - u8 field_1A2; - u8 field_1A3; + struct TimeAndRPM smallBlock; + u32 field_1A0; u8 field_1A4; - u8 field_1A5; - u8 field_1A6; - u8 field_1A7; - u8 field_1A8; - u8 field_1A9; - u8 field_1AA; - u8 field_1AB; - u8 field_1AC; - u8 field_1AD; - u8 field_1AE; - u8 field_1AF; - - u8 field_1B0; - u8 field_1B1; - u8 field_1B2; - u8 field_1B3; - u8 field_1B4; - u8 field_1B5; - u8 field_1B6; - u8 field_1B7; + struct TvBlenderStruct tvBlender; u8 tilemapBuffers[2][0x800]; s16 textState; void *tilesBuffer; - u8 field_11C0[0x20]; + struct BlenderGameBlock gameBlock; }; extern struct MusicPlayerInfo gMPlay_SE2; extern struct MusicPlayerInfo gMPlay_BGM; extern u16 gSpecialVar_ItemId; extern u8 gInGameOpponentsNo; +extern u8 gUnknown_020322D5; +extern u8 gResultsWindowId; + +extern const u8 * const gPokeblockNames[]; // graphics extern const u8 gBerryBlenderArrowTiles[]; @@ -359,9 +142,15 @@ extern const u8 gBerryBlenderParticlesTiles[]; extern const u8 gBerryBlenderCountdownNumbersTiles[]; extern const u16 gBerryBlenderMiscPalette[]; extern const u16 gBerryBlenderArrowPalette[]; +extern const u8 sBlenderCenterGfx[]; +extern const u8 gUnknown_08D91DB8[]; +extern const u8 gUnknown_08D927EC[]; // text -extern const u8 gText_BerryBlenderStart[]; +extern const u8 gText_SavingDontTurnOff2[]; +extern const u8 gText_Space[]; +extern const u8 gText_BlenderMaxSpeedRecord[]; +extern const u8 gText_234Players[]; extern void sub_81978B0(u16); extern void sub_800A418(void); @@ -372,51 +161,73 @@ extern void sub_809882C(u8, u16, u8); extern void copy_textbox_border_tile_patterns_to_vram(u8, u16, u8); extern void sub_81AABF0(void (*callback)(void)); extern void sub_800B4C0(void); +extern void sub_8009F8C(void); +extern void c2_exit_to_overworld_1_continue_scripts_restart_music(void); +extern void sub_8153430(void); +extern bool8 sub_8153474(void); +extern void sub_80EECEC(void); // this file's functions -void BerryBlender_SetGpuRegs(void); -void sub_8080EA4(u8 taskId); -void sub_8080FD0(u8 taskId); -void sub_80810F8(u8 taskId); -void sub_8081224(u8 taskId); -void sub_80833F8(struct Sprite *sprite); -void sub_8082F68(struct Sprite *sprite); -void sub_8083010(struct Sprite *sprite); -void sub_80830C0(struct Sprite *sprite); -void sub_8082F9C(struct Sprite *sprite); -void Blender_SetPlayerNamesLocal(u8 opponentsNum); -void sub_807FAC8(void); -void sub_8082D28(void); -bool32 Blender_PrintText(s16 *textState, const u8 *string, u8 textSpeed); -void sub_807FFA4(void); -void sub_8080018(void); -void sub_80808D4(void); -void Blender_DummiedOutFunc(s16 a0, s16 a1); -void sub_8081898(void); -void sub_8082CB4(struct BgAffineSrcData *bgAffineSrc); -bool8 sub_8083380(void); -void sub_808074C(void); -void Blender_PrintPlayerNames(void); -void sub_8080588(void); -void Blender_SetBankBerryData(u8 bank, u16 itemId); -void Blender_AddTextPrinter(u8 windowId, const u8 *string, u8 width, s8 x, s8 y, s32 state); -void sub_8080DF8(void); -void sub_8082E84(void); -void sub_80832BC(s16* a0, u16 a1); +static void BerryBlender_SetBackgroundsPos(void); +static void sub_8080EA4(u8 taskId); +static void sub_8080FD0(u8 taskId); +static void sub_80810F8(u8 taskId); +static void sub_8081224(u8 taskId); +static void sub_8083F3C(u8 taskId); +static void sub_80833F8(struct Sprite *sprite); +static void sub_8082F68(struct Sprite *sprite); +static void sub_8083010(struct Sprite *sprite); +static void sub_80830C0(struct Sprite *sprite); +static void sub_8082F9C(struct Sprite *sprite); +static void Blender_SetPlayerNamesLocal(u8 opponentsNum); +static void sub_807FAC8(void); +static void sub_8082D28(void); +static bool32 Blender_PrintText(s16 *textState, const u8 *string, s32 textSpeed); +static void sub_807FFA4(void); +static void sub_8080018(void); +static void sub_80808D4(void); +static void Blender_DummiedOutFunc(s16 a0, s16 a1); +static void sub_8081898(void); +static void sub_8082CB4(struct BgAffineSrcData *bgAffineSrc); +static bool8 sub_8083380(void); +static void sub_808074C(void); +static void Blender_PrintPlayerNames(void); +static void sub_8080588(void); +static void Blender_SetBankBerryData(u8 bank, u16 itemId); +static void Blender_AddTextPrinter(u8 windowId, const u8 *string, u8 x, u8 y, s32 speed, s32 caseId); +static void sub_8080DF8(void); +static void sub_8082E84(void); +static void sub_80832BC(s16* a0, u16 a1); +static void sub_8083140(u16 a0, u16 a2); +static void sub_8083230(u16 a0); +static void sub_808330C(void); +static void sub_8082AD4(void); +static void CB2_HandleBlenderEndGame(void); +static bool8 Blender_PrintBlendingRanking(void); +static bool8 Blender_PrintBlendingResults(void); +static void CB2_HandlePlayerPlayAgainChoice(void); +static void CB2_HandlePlayerLinkPlayAgainChoice(void); +static void sub_8083170(u16 a0, u16 a1); +static void Blender_PrintMadePokeblockString(struct Pokeblock *pokeblock, u8 *dst); +static bool32 TryAddContestLinkTvShow(struct Pokeblock *pokeblock, struct TvBlenderStruct *a1); -extern struct BerryBlenderData *sBerryBlenderData; +// ewram +EWRAM_DATA static struct BerryBlenderData *sBerryBlenderData = NULL; +EWRAM_DATA static s32 sUnknown_020322A8[5] = {0}; +EWRAM_DATA static s32 sUnknown_020322BC[5] = {0}; +EWRAM_DATA static u32 sUnknown_020322D0 = 0; -// Static RAM declarations -IWRAM_DATA void *berry_blender_c_unused_03000de4; -IWRAM_DATA s16 gUnknown_03000DE8[8]; -IWRAM_DATA s16 gUnknown_03000DF8[6]; -IWRAM_DATA s16 gUnknown_03000E04; -IWRAM_DATA s16 gUnknown_03000E06; +// iwram +IWRAM_DATA static s16 sUnknown_03000DE8[8]; +IWRAM_DATA static s16 sUnknown_03000DF8[6]; +IWRAM_DATA static s16 sUnknown_03000E04; +IWRAM_DATA static s16 sUnknown_03000E06; -// TODO: make those static once the file is decompiled -const u16 sBlenderCenterPal[] = INCBIN_U16("graphics/berry_blender/center.gbapal"); -const u8 sBlenderCenterMap[] = INCBIN_U8("graphics/berry_blender/center_map.bin"); -const u16 sBlenderOuterPal[] = INCBIN_U16("graphics/berry_blender/outer.gbapal"); +// rom + +static const u16 sBlenderCenterPal[] = INCBIN_U16("graphics/berry_blender/center.gbapal"); +static const u8 sBlenderCenterMap[] = INCBIN_U8("graphics/berry_blender/center_map.bin"); +static const u16 sBlenderOuterPal[] = INCBIN_U16("graphics/berry_blender/outer.gbapal"); // unreferenced pals? static const u16 sUnknownPal_0[] = INCBIN_U16("graphics/unknown/unknown_339514.gbapal"); @@ -429,9 +240,9 @@ static const u8 sUnusedText_Space[] = _(" "); static const u8 sUnusedText_Terminating[] = _("Terminating."); static const u8 sUnusedText_LinkPartnerNotFound[] = _("Link partner(s) not found.\nPlease try again.\p"); -const u8 gText_BerryBlenderStart[] = _("Starting up the BERRY BLENDER.\pPlease select a BERRY from your BAG\nto put in the BERRY BLENDER.\p"); -const u8 gText_NewParagraph[] = _("\p"); -const u8 gText_WasMade[] = _(" was made!"); +static const u8 sText_BerryBlenderStart[] = _("Starting up the BERRY BLENDER.\pPlease select a BERRY from your BAG\nto put in the BERRY BLENDER.\p"); +static const u8 sText_NewParagraph[] = _("\p"); +static const u8 sText_WasMade[] = _(" was made!"); static const u8 sText_Mister[] = _("MISTER"); static const u8 sText_Laddie[] = _("LADDIE"); static const u8 sText_Lassie[] = _("LASSIE"); @@ -439,7 +250,7 @@ static const u8 sText_Master[] = _("MASTER"); static const u8 sText_Dude[] = _("DUDE"); static const u8 sText_Miss[] = _("MISS"); -const u8* const sBlenderOpponentsNames[] = +static const u8* const sBlenderOpponentsNames[] = { sText_Mister, sText_Laddie, @@ -461,29 +272,29 @@ enum static const u8 sText_PressAToStart[] = _("Press the A Button to start."); static const u8 sText_PleaseWaitAWhile[] = _("Please wait a while."); -const u8 sText_CommunicationStandby[] = _("Communication standby…"); -const u8 sText_WouldLikeToBlendAnotherBerry[] = _("Would you like to blend another BERRY?"); -const u8 sText_RunOutOfBerriesForBlending[] = _("You’ve run out of BERRIES for\nblending in the BERRY BLENDER.\p"); -const u8 sText_YourPokeblockCaseIsFull[] = _("Your {POKEBLOCK} CASE is full.\p"); -const u8 sText_HasNoBerriesToPut[] = _(" has no BERRIES to put in\nthe BERRY BLENDER."); -const u8 sText_ApostropheSPokeblockCaseIsFull[] = _("’s {POKEBLOCK} CASE is full.\p"); -const u8 sText_BlendingResults[] = _("RESULTS OF BLENDING"); +static const u8 sText_CommunicationStandby[] = _("Communication standby…"); +static const u8 sText_WouldLikeToBlendAnotherBerry[] = _("Would you like to blend another BERRY?"); +static const u8 sText_RunOutOfBerriesForBlending[] = _("You’ve run out of BERRIES for\nblending in the BERRY BLENDER.\p"); +static const u8 sText_YourPokeblockCaseIsFull[] = _("Your {POKEBLOCK} CASE is full.\p"); +static const u8 sText_HasNoBerriesToPut[] = _(" has no BERRIES to put in\nthe BERRY BLENDER."); +static const u8 sText_ApostropheSPokeblockCaseIsFull[] = _("’s {POKEBLOCK} CASE is full.\p"); +static const u8 sText_BlendingResults[] = _("RESULTS OF BLENDING"); static const u8 sText_BerryUsed[] = _("BERRY USED"); -const u8 sText_SpaceBerry[] = _(" BERRY"); -const u8 sText_Time[] = _("Time:"); -const u8 sText_Min[] = _(" min. "); -const u8 sText_Sec[] = _(" sec."); -const u8 sText_MaximumSpeed[] = _("MAXIMUM SPEED"); -const u8 sText_RPM[] = _(" RPM"); -const u8 sText_Dot[] = _("."); -const u8 sText_NewLine[] = _("\n"); +static const u8 sText_SpaceBerry[] = _(" BERRY"); +static const u8 sText_Time[] = _("Time:"); +static const u8 sText_Min[] = _(" min. "); +static const u8 sText_Sec[] = _(" sec."); +static const u8 sText_MaximumSpeed[] = _("MAXIMUM SPEED"); +static const u8 sText_RPM[] = _(" RPM"); +static const u8 sText_Dot[] = _("."); +static const u8 sText_NewLine[] = _("\n"); static const u8 sText_Space[] = _(" "); -const u8 sText_Ranking[] = _("RANKING"); -const u8 sText_TheLevelIs[] = _("The level is "); -const u8 sText_TheFeelIs[] = _(", and the feel is "); -const u8 sText_Dot2[] = _("."); +static const u8 sText_Ranking[] = _("RANKING"); +static const u8 sText_TheLevelIs[] = _("The level is "); +static const u8 sText_TheFeelIs[] = _(", and the feel is "); +static const u8 sText_Dot2[] = _("."); -const struct BgTemplate sBerryBlenderBgTemplates[3] = +static const struct BgTemplate sBerryBlenderBgTemplates[3] = { { .bg = 0, @@ -525,31 +336,31 @@ static const struct WindowTemplate sBerryBlender_WindowTemplates[] = DUMMY_WIN_TEMPLATE }; -const struct WindowTemplate gUnknown_083399B8 = +static const struct WindowTemplate sBlender_YesNoWindowTemplate = { 0, 0x15, 9, 5, 4, 0xE, 0xCC }; -const s8 gUnknown_083399C0[][2] = +static const s8 sUnknown_083399C0[][2] = { {-1, -1}, {1, -1}, {-1, 1}, {1, 1} }; -const u8 sBlenderSyncArrowsPos[BLENDER_MAX_PLAYERS][2] = +static const u8 sBlenderSyncArrowsPos[BLENDER_MAX_PLAYERS][2] = { {72, 32}, {168, 32}, {72, 128}, {168, 128} }; -const u8 gUnknown_083399D0[3][4] = +static const u8 sUnknown_083399D0[3][4] = { {-1, 0, 1, -1}, {-1, 0, 1, 2}, {0, 1, 2, 3} }; -const u16 gUnknown_083399DC[] = {0, 0xC000, 0x4000, 0x8000}; -const u8 gUnknown_083399E4[] = {1, 1, 0}; -const u8 gUnknown_083399E7[] = {32, 224, 96, 160, 0}; +static const u16 sUnknown_083399DC[] = {0, 0xC000, 0x4000, 0x8000}; +static const u8 sUnknown_083399E4[] = {1, 1, 0}; +static const u8 sUnknown_083399E7[] = {32, 224, 96, 160, 0}; -const TaskFunc gUnknown_083399EC[] = +static const TaskFunc sUnknown_083399EC[] = { sub_8080EA4, sub_8080FD0, sub_80810F8 }; @@ -671,22 +482,22 @@ static const union AnimCmd *const sSpriteAnimTable_82163AC[] = sSpriteAnim_82163A4 }; -const struct SpriteSheet sSpriteSheet_BlenderArrow = +static const struct SpriteSheet sSpriteSheet_BlenderArrow = { gBerryBlenderArrowTiles, 0x800, 46545 }; -const struct SpritePalette sSpritePal_BlenderMisc = +static const struct SpritePalette sSpritePal_BlenderMisc = { gBerryBlenderMiscPalette, 46546 }; -const struct SpritePalette sSpritePal_BlenderArrow = +static const struct SpritePalette sSpritePal_BlenderArrow = { gBerryBlenderArrowPalette, 12312 }; -const struct SpriteTemplate sBlenderSyncArrow_SpriteTemplate = +static const struct SpriteTemplate sBlenderSyncArrow_SpriteTemplate = { .tileTag = 46545, .paletteTag = 12312, @@ -750,12 +561,12 @@ static const union AnimCmd *const sSpriteAnimTable_8216444[] = sSpriteAnim_821643C, }; -const struct SpriteSheet gUnknown_08339B38 = +static const struct SpriteSheet sUnknown_08339B38 = { gBerryBlenderMarubatsuTiles, 0x200, 48888 }; -const struct SpriteTemplate gUnknown_08339B40 = +static const struct SpriteTemplate sUnknown_08339B40 = { .tileTag = 48888, .paletteTag = 46546, @@ -837,12 +648,12 @@ static const union AnimCmd *const sSpriteAnimTable_82164E0[] = sSpriteAnim_82164D8, }; -const struct SpriteSheet gUnknown_08339BD8 = +static const struct SpriteSheet sUnknown_08339BD8 = { gBerryBlenderParticlesTiles, 0xE0, 23456 }; -const struct SpriteTemplate gUnknown_08339BE0 = +static const struct SpriteTemplate sUnknown_08339BE0 = { .tileTag = 23456, .paletteTag = 46546, @@ -895,12 +706,12 @@ static const union AnimCmd *const sSpriteAnimTable_8216534[] = sSpriteAnim_821652C, }; -const struct SpriteSheet gUnknown_08339C24 = +static const struct SpriteSheet sUnknown_08339C24 = { gBerryBlenderCountdownNumbersTiles, 0x600, 12345 }; -const struct SpriteTemplate gUnknown_08339C2C = +static const struct SpriteTemplate sUnknown_08339C2C = { .tileTag = 12345, .paletteTag = 46546, @@ -939,12 +750,12 @@ static const union AnimCmd *const sSpriteAnimTable_8216570[] = sSpriteAnim_8216568, }; -const struct SpriteSheet gUnknown_08339C58 = +static const struct SpriteSheet sUnknown_08339C58 = { gBerryBlenderStartTiles, 0x400, 12346 }; -const struct SpriteTemplate gUnknown_08339C60 = +static const struct SpriteTemplate sUnknown_08339C60 = { .tileTag = 12346, .paletteTag = 46546, @@ -955,7 +766,7 @@ const struct SpriteTemplate gUnknown_08339C60 = .callback = sub_80830C0 }; -const s16 gUnknown_08339C78[][5] = +static const s16 sUnknown_08339C78[][5] = { {-10, 20, 10, 2, 1}, {250, 20, 10, -2, 1}, @@ -970,11 +781,11 @@ static const u8 sOpponentBerrySets[][3] = static const u8 sSpecialOpponentBerrySets[] = {30, 31, 32, 33, 34}; -const u8 gUnknown_08339CC3[] = {1, 1, 2, 3, 4}; +static const u8 sUnknown_08339CC3[] = {1, 1, 2, 3, 4}; -const u8 gUnknown_08339CC8[] = {0x1C, 0x16, 0x13, 0x1A, 0x19, 0x0E, 0x0D, 0x0B, 0x07, 0x15}; +static const u8 sUnknown_08339CC8[] = {0x1C, 0x16, 0x13, 0x1A, 0x19, 0x0E, 0x0D, 0x0B, 0x07, 0x15}; -static const u8 gUnknown_08339CD2[] = +static const u8 sUnknown_08339CD2[] = { 0xfe, 0x02, 0x02, 0xce, 0xd0, 0x37, 0x44, 0x07, 0x1f, 0x0c, 0x10, 0x00, 0xff, 0xfe, 0x91, 0x72, 0xce, 0xd0, 0x37, 0x44, 0x07, 0x1f, @@ -984,18 +795,18 @@ static const u8 gUnknown_08339CD2[] = 0x05, 0x03, 0x03, 0x03, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x02 }; -const struct WindowTemplate gUnknown_08339D14[] = {0, 6, 4, 0x12, 0xB, 0xF, 8}; +static const struct WindowTemplate sBlenderRecordWindowTemplate = {0, 6, 4, 0x12, 0xB, 0xF, 8}; // code -void Blender_ControlHitPitch(void) +static void Blender_ControlHitPitch(void) { m4aMPlayPitchControl(&gMPlay_SE2, 0xFFFF, 2 * (sBerryBlenderData->field_4C - 128)); } -void VBlankCB0_BerryBlender(void) +static void VBlankCB0_BerryBlender(void) { - BerryBlender_SetGpuRegs(); + BerryBlender_SetBackgroundsPos(); SetBgAffine(2, sBerryBlenderData->bgAffineSrc.texX, sBerryBlenderData->bgAffineSrc.texY, sBerryBlenderData->bgAffineSrc.scrX, sBerryBlenderData->bgAffineSrc.scrY, sBerryBlenderData->bgAffineSrc.sx, sBerryBlenderData->bgAffineSrc.sy, @@ -1005,11 +816,7 @@ void VBlankCB0_BerryBlender(void) TransferPlttBuffer(); } -extern const u8 sBlenderCenterGfx[]; -extern const u8 gUnknown_08D91DB8[]; -extern const u8 gUnknown_08D927EC[]; - -bool8 LoadBerryBlenderGfx(void) +static bool8 LoadBerryBlenderGfx(void) { switch (sBerryBlenderData->loadGfxState) { @@ -1051,13 +858,13 @@ bool8 LoadBerryBlenderGfx(void) break; case 8: LoadSpriteSheet(&sSpriteSheet_BlenderArrow); - LoadSpriteSheet(&gUnknown_08339BD8); - LoadSpriteSheet(&gUnknown_08339B38); + LoadSpriteSheet(&sUnknown_08339BD8); + LoadSpriteSheet(&sUnknown_08339B38); sBerryBlenderData->loadGfxState++; break; case 9: - LoadSpriteSheet(&gUnknown_08339C24); - LoadSpriteSheet(&gUnknown_08339C58); + LoadSpriteSheet(&sUnknown_08339C24); + LoadSpriteSheet(&sUnknown_08339C58); LoadSpritePalette(&sSpritePal_BlenderArrow); LoadSpritePalette(&sSpritePal_BlenderMisc); Free(sBerryBlenderData->tilesBuffer); @@ -1068,7 +875,7 @@ bool8 LoadBerryBlenderGfx(void) return FALSE; } -void sub_807F9D0(void) +static void sub_807F9D0(void) { FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14); CopyBgTilemapBufferToVram(0); @@ -1081,7 +888,7 @@ void sub_807F9D0(void) ChangeBgY(1, 0, 0); } -void InitBerryBlenderWindows(void) +static void InitBerryBlenderWindows(void) { if (InitWindows(sBerryBlender_WindowTemplates)) { @@ -1101,15 +908,15 @@ void DoBerryBlending(void) if (sBerryBlenderData == NULL) sBerryBlenderData = AllocZeroed(sizeof(*sBerryBlenderData)); - sBerryBlenderData->field_63 = 0; + sBerryBlenderData->gameEndState = 0; sBerryBlenderData->mainState = 0; - sBerryBlenderData->field_63 = 0; + sBerryBlenderData->gameEndState = 0; Blender_SetPlayerNamesLocal(gSpecialVar_0x8004); SetMainCallback2(sub_807FAC8); } -void sub_807FAC8(void) +static void sub_807FAC8(void) { s32 i; @@ -1132,8 +939,8 @@ void sub_807FAC8(void) sBerryBlenderData->field_118 = 0; sBerryBlenderData->field_116 = 0; sBerryBlenderData->field_11A = 0x50; - sBerryBlenderData->field_11C = 0; - sBerryBlenderData->field_11E = 0; + sBerryBlenderData->bg_X = 0; + sBerryBlenderData->bg_Y = 0; sBerryBlenderData->loadGfxState = 0; sub_8082D28(); @@ -1166,7 +973,7 @@ void sub_807FAC8(void) sBerryBlenderData->mainState++; break; case 4: - if (Blender_PrintText(&sBerryBlenderData->textState, gText_BerryBlenderStart, GetPlayerTextSpeed())) + if (Blender_PrintText(&sBerryBlenderData->textState, sText_BerryBlenderStart, GetPlayerTextSpeed())) sBerryBlenderData->mainState++; break; case 5: @@ -1193,7 +1000,7 @@ void sub_807FAC8(void) UpdatePaletteFade(); } -void sub_807FD08(struct Sprite* sprite) +static void sub_807FD08(struct Sprite* sprite) { sprite->data1 += sprite->data6; sprite->data2 -= sprite->data4; @@ -1214,7 +1021,7 @@ void sub_807FD08(struct Sprite* sprite) sprite->pos1.y = sprite->data2; } -void sub_807FD64(struct Sprite* sprite, s16 a2, s16 a3, s16 a4, s16 a5, s16 a6) +static void sub_807FD64(struct Sprite* sprite, s16 a2, s16 a3, s16 a4, s16 a5, s16 a6) { sprite->data0 = a3; sprite->data1 = a2; @@ -1227,13 +1034,13 @@ void sub_807FD64(struct Sprite* sprite, s16 a2, s16 a3, s16 a4, s16 a5, s16 a6) sprite->callback = sub_807FD08; } -void sub_807FD90(u16 a0, u8 a1) +static void sub_807FD90(u16 a0, u8 a1) { u8 spriteId = sub_80D511C(a0 + 123, 0, 80, a1 & 1); - sub_807FD64(&gSprites[spriteId], gUnknown_08339C78[a1][0], gUnknown_08339C78[a1][1], gUnknown_08339C78[a1][2], gUnknown_08339C78[a1][3], gUnknown_08339C78[a1][4]); + sub_807FD64(&gSprites[spriteId], sUnknown_08339C78[a1][0], sUnknown_08339C78[a1][1], sUnknown_08339C78[a1][2], sUnknown_08339C78[a1][3], sUnknown_08339C78[a1][4]); } -void Blender_CopyBerryData(struct BlenderBerry* berry, u16 itemId) +static void Blender_CopyBerryData(struct BlenderBerry* berry, u16 itemId) { const struct Berry *berryInfo = GetBerryInfo(ITEM_TO_BERRY(itemId)); @@ -1247,7 +1054,7 @@ void Blender_CopyBerryData(struct BlenderBerry* berry, u16 itemId) berry->smoothness = berryInfo->smoothness; } -void Blender_SetPlayerNamesLocal(u8 opponentsNum) +static void Blender_SetPlayerNamesLocal(u8 opponentsNum) { switch (opponentsNum) { @@ -1294,7 +1101,7 @@ void Blender_SetPlayerNamesLocal(u8 opponentsNum) } } -void sub_807FFA4(void) +static void sub_807FFA4(void) { s32 i; @@ -1316,7 +1123,7 @@ void sub_807FFA4(void) SetMainCallback2(sub_80808D4); } -void sub_8080018(void) +static void sub_8080018(void) { s32 i, j; @@ -1334,8 +1141,8 @@ void sub_8080018(void) sBerryBlenderData->scores[i][j] = 0; } } - sBerryBlenderData->field_70 = 0; - sBerryBlenderData->field_4E = 0; + sBerryBlenderData->playAgainState = 0; + sBerryBlenderData->max_RPM = 0; sBerryBlenderData->loadGfxState = 0; sBerryBlenderData->mainState++; break; @@ -1414,7 +1221,7 @@ void sub_8080018(void) for (i = 0; i < BLENDER_MAX_PLAYERS; i++) { - if (sBerryBlenderData->field_114 == gUnknown_083399D0[sBerryBlenderData->playersNo - 2][i]) + if (sBerryBlenderData->field_114 == sUnknown_083399D0[sBerryBlenderData->playersNo - 2][i]) { sub_807FD90(sBerryBlenderData->chosenItemId[sBerryBlenderData->field_114], i); break; @@ -1431,7 +1238,7 @@ void sub_8080018(void) if (sBerryBlenderData->field_114 >= sBerryBlenderData->playersNo) { sBerryBlenderData->mainState++; - sBerryBlenderData->arrowPos = gUnknown_083399DC[gUnknown_083399E4[sBerryBlenderData->playersNo - 2]] - 22528; + sBerryBlenderData->arrowPos = sUnknown_083399DC[sUnknown_083399E4[sBerryBlenderData->playersNo - 2]] - 22528; } else { @@ -1458,7 +1265,7 @@ void sub_8080018(void) SetGpuRegBits(REG_OFFSET_BG2CNT, 2); sBerryBlenderData->mainState++; sBerryBlenderData->field_11A = 256; - sBerryBlenderData->arrowPos = gUnknown_083399DC[gUnknown_083399E4[sBerryBlenderData->playersNo - 2]]; + sBerryBlenderData->arrowPos = sUnknown_083399DC[sUnknown_083399E4[sBerryBlenderData->playersNo - 2]]; sBerryBlenderData->framesToWait = 0; PlaySE(SE_TRACK_DOOR); sub_808074C(); @@ -1475,7 +1282,7 @@ void sub_8080018(void) sub_8082CB4(&sBerryBlenderData->bgAffineSrc); break; case 16: - CreateSprite(&gUnknown_08339C2C, 120, -16, 3); + CreateSprite(&sUnknown_08339C2C, 120, -16, 3); sBerryBlenderData->mainState++; break; case 18: @@ -1504,7 +1311,7 @@ void sub_8080018(void) break; } - Blender_DummiedOutFunc(sBerryBlenderData->field_11C, sBerryBlenderData->field_11E); + Blender_DummiedOutFunc(sBerryBlenderData->bg_X, sBerryBlenderData->bg_Y); RunTasks(); AnimateSprites(); BuildOamBuffer(); @@ -1512,7 +1319,7 @@ void sub_8080018(void) UpdatePaletteFade(); } -void sub_8080588(void) +static void sub_8080588(void) { SetGpuReg(REG_OFFSET_DISPCNT, 0); @@ -1535,16 +1342,16 @@ void sub_8080588(void) sBerryBlenderData->field_44 = 0; sBerryBlenderData->field_4C = 0; sBerryBlenderData->arrowPos = 0; - sBerryBlenderData->field_4E = 0; - sBerryBlenderData->field_11C = 0; - sBerryBlenderData->field_11E = 0; + sBerryBlenderData->max_RPM = 0; + sBerryBlenderData->bg_X = 0; + sBerryBlenderData->bg_Y = 0; } -u8 sub_8080624(u16 arrowPos, u8 playerId) +static u8 sub_8080624(u16 arrowPos, u8 playerId) { u32 var1 = (arrowPos / 256) + 24; u8 arrID = sBerryBlenderData->field_96[playerId]; - u32 var2 = gUnknown_083399E7[arrID]; + u32 var2 = sUnknown_083399E7[arrID]; if (var1 >= var2 && var1 < var2 + 48) { @@ -1557,7 +1364,7 @@ u8 sub_8080624(u16 arrowPos, u8 playerId) return 0; } -void Blender_SetOpponentsBerryData(u16 playerBerryItemId, u8 playersNum, struct BlenderBerry* playerBerry) +static void Blender_SetOpponentsBerryData(u16 playerBerryItemId, u8 playersNum, struct BlenderBerry* playerBerry) { u16 opponentSetId = 0; u16 opponentBerryId; @@ -1594,14 +1401,14 @@ void Blender_SetOpponentsBerryData(u16 playerBerryItemId, u8 playersNum, struct } } -void sub_808074C(void) +static void sub_808074C(void) { s32 i, j; for (i = 0; i < BLENDER_MAX_PLAYERS; i++) { sBerryBlenderData->field_96[i] = 0xFF; - sBerryBlenderData->field_8E[i] = gUnknown_083399D0[sBerryBlenderData->playersNo - 2][i]; + sBerryBlenderData->field_8E[i] = sUnknown_083399D0[sBerryBlenderData->playersNo - 2][i]; } for (j = 0; j < BLENDER_MAX_PLAYERS; j++) { @@ -1613,9 +1420,9 @@ void sub_808074C(void) } } -void Blender_PrintPlayerNames(void) +static void Blender_PrintPlayerNames(void) { - s32 i, width; + s32 i, xPos; u32 multiplayerId = 0; u8 text[20]; @@ -1631,12 +1438,12 @@ void Blender_PrintPlayerNames(void) text[0] = EOS; StringCopy(text, gLinkPlayers[sBerryBlenderData->field_8E[i]].name); - width = GetStringCenterAlignXOffset(1, text, 0x38); + xPos = GetStringCenterAlignXOffset(1, text, 0x38); if (multiplayerId == sBerryBlenderData->field_8E[i]) - Blender_AddTextPrinter(i, text, width, 1, 0, 2); + Blender_AddTextPrinter(i, text, xPos, 1, 0, 2); else - Blender_AddTextPrinter(i, text, width, 1, 0, 1); + Blender_AddTextPrinter(i, text, xPos, 1, 0, 1); PutWindowTilemap(i); CopyWindowToVram(i, 3); @@ -1644,7 +1451,7 @@ void Blender_PrintPlayerNames(void) } } -void sub_80808D4(void) +static void sub_80808D4(void) { s32 i, j; @@ -1666,7 +1473,7 @@ void sub_80808D4(void) } } - sBerryBlenderData->field_70 = 0; + sBerryBlenderData->playAgainState = 0; sBerryBlenderData->loadGfxState = 0; gLinkType = 0x4422; sBerryBlenderData->mainState++; @@ -1704,7 +1511,7 @@ void sub_80808D4(void) case 11: for (i = 0; i < BLENDER_MAX_PLAYERS; i++) { - u32 var = gUnknown_083399D0[sBerryBlenderData->playersNo - 2][i]; + u32 var = sUnknown_083399D0[sBerryBlenderData->playersNo - 2][i]; if (sBerryBlenderData->field_114 == var) { sub_807FD90(sBerryBlenderData->chosenItemId[sBerryBlenderData->field_114], i); @@ -1720,7 +1527,7 @@ void sub_80808D4(void) { if (sBerryBlenderData->field_114 >= sBerryBlenderData->playersNo) { - sBerryBlenderData->arrowPos = gUnknown_083399DC[gUnknown_083399E4[sBerryBlenderData->playersNo - 2]] - 22528; + sBerryBlenderData->arrowPos = sUnknown_083399DC[sUnknown_083399E4[sBerryBlenderData->playersNo - 2]] - 22528; sBerryBlenderData->mainState++; } else @@ -1745,7 +1552,7 @@ void sub_80808D4(void) { sBerryBlenderData->mainState++; sBerryBlenderData->field_11A = 256; - sBerryBlenderData->arrowPos = gUnknown_083399DC[gUnknown_083399E4[sBerryBlenderData->playersNo - 2]]; + sBerryBlenderData->arrowPos = sUnknown_083399DC[sUnknown_083399E4[sBerryBlenderData->playersNo - 2]]; SetGpuRegBits(REG_OFFSET_BG2CNT, 2); sBerryBlenderData->framesToWait = 0; PlaySE(SE_TRACK_DOOR); @@ -1761,7 +1568,7 @@ void sub_80808D4(void) sub_8082CB4(&sBerryBlenderData->bgAffineSrc); break; case 16: - CreateSprite(&gUnknown_08339C2C, 120, -16, 3); + CreateSprite(&sUnknown_08339C2C, 120, -16, 3); sBerryBlenderData->mainState++; break; case 18: @@ -1786,13 +1593,13 @@ void sub_80808D4(void) if (!FlagGet(FLAG_340)) sBerryBlenderData->field_120[0] = CreateTask(sub_8081224, 10); else - sBerryBlenderData->field_120[0] = CreateTask(gUnknown_083399EC[0], 10); + sBerryBlenderData->field_120[0] = CreateTask(sUnknown_083399EC[0], 10); } if (gSpecialVar_0x8004 > 1) { for (i = 0; i < gSpecialVar_0x8004; i++) - sBerryBlenderData->field_120[i] = CreateTask(gUnknown_083399EC[i], 10 + i); + sBerryBlenderData->field_120[i] = CreateTask(sUnknown_083399EC[i], 10 + i); } if (GetCurrentMapMusic() != BGM_CYCLING) @@ -1804,7 +1611,7 @@ void sub_80808D4(void) break; } - Blender_DummiedOutFunc(sBerryBlenderData->field_11C, sBerryBlenderData->field_11E); + Blender_DummiedOutFunc(sBerryBlenderData->bg_X, sBerryBlenderData->bg_Y); RunTasks(); AnimateSprites(); BuildOamBuffer(); @@ -1812,7 +1619,7 @@ void sub_80808D4(void) UpdatePaletteFade(); } -void sub_8080DF8(void) +static void sub_8080DF8(void) { s32 i; for (i = 0; i < 4; i++) @@ -1824,7 +1631,7 @@ void sub_8080DF8(void) } } -void sub_8080E20(u8 taskId) +static void sub_8080E20(u8 taskId) { if(++gTasks[taskId].data[0] > gTasks[taskId].data[1]) { @@ -1833,14 +1640,14 @@ void sub_8080E20(u8 taskId) } } -void sub_8080E6C(u8 a0, u8 a1) +static void sub_8080E6C(u8 a0, u8 a1) { u8 taskId = CreateTask(sub_8080E20, 80); gTasks[taskId].data[1] = a1; gTasks[taskId].data[2] = a0; } -void sub_8080EA4(u8 taskId) +static void sub_8080EA4(u8 taskId) { if (sub_8080624(sBerryBlenderData->arrowPos, 1) == 2) { @@ -1900,11 +1707,11 @@ void sub_8080EA4(u8 taskId) } } -void sub_8080FD0(u8 taskId) +static void sub_8080FD0(u8 taskId) { u32 var1 = (sBerryBlenderData->arrowPos + 0x1800) & 0xFFFF; u32 var2 = sBerryBlenderData->field_96[2] & 0xFF; - if ((var1 >> 8) > gUnknown_083399E7[var2] + 20 && (var1 >> 8) < gUnknown_083399E7[var2] + 40) + if ((var1 >> 8) > sUnknown_083399E7[var2] + 20 && (var1 >> 8) < sUnknown_083399E7[var2] + 40) { if (gTasks[taskId].data[0] == 0) { @@ -1945,13 +1752,13 @@ void sub_8080FD0(u8 taskId) } } -void sub_80810F8(u8 taskId) +static void sub_80810F8(u8 taskId) { u32 var1, var2; var1 = (sBerryBlenderData->arrowPos + 0x1800) & 0xFFFF; var2 = sBerryBlenderData->field_96[3] & 0xFF; - if ((var1 >> 8) > gUnknown_083399E7[var2] + 20 && (var1 >> 8) < gUnknown_083399E7[var2] + 40) + if ((var1 >> 8) > sUnknown_083399E7[var2] + 20 && (var1 >> 8) < sUnknown_083399E7[var2] + 40) { if (gTasks[taskId].data[0] == 0) { @@ -1996,7 +1803,7 @@ void sub_80810F8(u8 taskId) } } -void sub_8081224(u8 taskId) +static void sub_8081224(u8 taskId) { if (sub_8080624(sBerryBlenderData->arrowPos, 1) == 2) { @@ -2012,13 +1819,13 @@ void sub_8081224(u8 taskId) } } -void sub_8081288(u16 a0, u8 a1) +static void sub_8081288(u16 a0, u8 a1) { u8 spriteId; - spriteId = CreateSprite(&gUnknown_08339B40, - sBlenderSyncArrowsPos[a1][0] - (10 * gUnknown_083399C0[a1][0]), - sBlenderSyncArrowsPos[a1][1] - (10 * gUnknown_083399C0[a1][1]), + spriteId = CreateSprite(&sUnknown_08339B40, + sBlenderSyncArrowsPos[a1][0] - (10 * sUnknown_083399C0[a1][0]), + sBlenderSyncArrowsPos[a1][1] - (10 * sUnknown_083399C0[a1][1]), 1); if (a0 == 0x4523) { @@ -2039,34 +1846,34 @@ void sub_8081288(u16 a0, u8 a1) sub_8082E84(); } -void sub_8081370(u16 a0) +static void sub_8081370(u16 a0) { Blender_ControlHitPitch(); switch (a0) { case 0x4523: if (sBerryBlenderData->field_4C < 1500) - sBerryBlenderData->field_4C += (384 / gUnknown_08339CC3[sBerryBlenderData->playersNo]); + sBerryBlenderData->field_4C += (384 / sUnknown_08339CC3[sBerryBlenderData->playersNo]); else { - sBerryBlenderData->field_4C += (128 / gUnknown_08339CC3[sBerryBlenderData->playersNo]); - sub_80832BC(&sBerryBlenderData->field_11C, (sBerryBlenderData->field_4C / 100) - 10); - sub_80832BC(&sBerryBlenderData->field_11E, (sBerryBlenderData->field_4C / 100) - 10); + sBerryBlenderData->field_4C += (128 / sUnknown_08339CC3[sBerryBlenderData->playersNo]); + sub_80832BC(&sBerryBlenderData->bg_X, (sBerryBlenderData->field_4C / 100) - 10); + sub_80832BC(&sBerryBlenderData->bg_Y, (sBerryBlenderData->field_4C / 100) - 10); } break; case 0x5432: if (sBerryBlenderData->field_4C < 1500) - sBerryBlenderData->field_4C += (256 / gUnknown_08339CC3[sBerryBlenderData->playersNo]); + sBerryBlenderData->field_4C += (256 / sUnknown_08339CC3[sBerryBlenderData->playersNo]); break; case 0x2345: - sBerryBlenderData->field_4C -= (256 / gUnknown_08339CC3[sBerryBlenderData->playersNo]); + sBerryBlenderData->field_4C -= (256 / sUnknown_08339CC3[sBerryBlenderData->playersNo]); if (sBerryBlenderData->field_4C < 128) sBerryBlenderData->field_4C = 128; break; } } -bool32 sub_80814B0(u16 arg0, u16 arg1, u16 arg2) +static bool32 sub_80814B0(u16 arg0, u16 arg1, u16 arg2) { if (gReceivedRemoteLinkPlayers != 0 && gLinkVSyncDisabled) { @@ -2082,8 +1889,7 @@ bool32 sub_80814B0(u16 arg0, u16 arg1, u16 arg2) return FALSE; } -/* -void sub_80814B0(void) +static void sub_80814F4(void) { s32 i; @@ -2091,50 +1897,48 @@ void sub_80814B0(void) { if (gSendCmd[2] != 0) { - gRecvCmds[2][0] = gSendCmd[2]; + gRecvCmds[0][2] = gSendCmd[2]; gRecvCmds[0][0] = 0x4444; gSendCmd[2] = 0; } for (i = 1; i < 4; i++) { - if (gRecvCmds[2][i] != 0) - gRecvCmds[0][i] = 0x4444; + if (gRecvCmds[i][2] != 0) + gRecvCmds[i][0] = 0x4444; } } - for (i = 0; i < gBerryBlenderData->playersNo; i++) + for (i = 0; i < sBerryBlenderData->playersNo; i++) { - if (gRecvCmds[0][i] == 0x4444) + if (sub_80814B0(gRecvCmds[i][0], 0x4444, 0x4400)) { - u32 var = gBerryBlenderData->field_A2[i]; - if (gRecvCmds[2][i] == 0x4523) + u32 var = sBerryBlenderData->field_96[i]; + if (gRecvCmds[i][2] == 0x4523) { - sub_804FD30(0x4523); - gBerryBlenderData->field_13E += (gBerryBlenderData->field_56 / 55); - if (gBerryBlenderData->field_13E >= 1000) - gBerryBlenderData->field_13E = 1000; - sub_804FC48(0x4523, var); - gBerryBlenderData->scores[i][BLENDER_SCORE_BEST]++; + sub_8081370(0x4523); + sBerryBlenderData->field_116 += (sBerryBlenderData->field_4C / 55); + if (sBerryBlenderData->field_116 >= 1000) + sBerryBlenderData->field_116 = 1000; + sub_8081288(0x4523, var); + sBerryBlenderData->scores[i][BLENDER_SCORE_BEST]++; } - else if (gRecvCmds[2][i] == 0x5432) + else if (gRecvCmds[i][2] == 0x5432) { - sub_804FD30(0x5432); - gBerryBlenderData->field_13E += (gBerryBlenderData->field_56 / 70); - sub_804FC48(0x5432, var); - gBerryBlenderData->scores[i][BLENDER_SCORE_GOOD]++; + sub_8081370(0x5432); + sBerryBlenderData->field_116 += (sBerryBlenderData->field_4C / 70); + sub_8081288(0x5432, var); + sBerryBlenderData->scores[i][BLENDER_SCORE_GOOD]++; } - else if (gRecvCmds[2][i] == 0x2345) + else if (gRecvCmds[i][2] == 0x2345) { - sub_804FC48(0x2345, var); - sub_804FD30(0x2345); - if (gBerryBlenderData->field_4.win_field_F > 1000) - gBerryBlenderData->field_13E = 1000; - if (gBerryBlenderData->scores[i][BLENDER_SCORE_MISS] < 999) - gBerryBlenderData->scores[i][BLENDER_SCORE_MISS]++; + sub_8081288(0x2345, var); + sub_8081370(0x2345); + if (sBerryBlenderData->scores[i][BLENDER_SCORE_MISS] < 999) + sBerryBlenderData->scores[i][BLENDER_SCORE_MISS]++; } - if (gRecvCmds[2][i] == 0x2345 || gRecvCmds[2][i] == 0x4523 || gRecvCmds[2][i] == 0x5432) + if (gRecvCmds[i][2] == 0x2345 || gRecvCmds[2][i] == 0x4523 || gRecvCmds[2][i] == 0x5432) // could be a bug, 2 and i are reversed { - if (gBerryBlenderData->field_56 > 1500) - m4aMPlayTempoControl(&gMPlay_BGM, ((gBerryBlenderData->field_56 - 750) / 20) + 256); + if (sBerryBlenderData->field_4C > 1500) + m4aMPlayTempoControl(&gMPlay_BGM, ((sBerryBlenderData->field_4C - 750) / 20) + 256); else m4aMPlayTempoControl(&gMPlay_BGM, 256); } @@ -2142,11 +1946,1684 @@ void sub_80814B0(void) } if (gSpecialVar_0x8004 != 0) { - for (i = 0; i < gBerryBlenderData->playersNo; i++) + for (i = 0; i < sBerryBlenderData->playersNo; i++) { - gRecvCmds[0][i] = 0; - gRecvCmds[2][i] = 0; + gRecvCmds[i][0] = 0; + gRecvCmds[i][2] = 0; } } -}*/ +} +static void sub_8081744(void) +{ + u8 var2; + bool8 A_pressed = FALSE; + u8 playerId = 0; + + if (gReceivedRemoteLinkPlayers != 0) + playerId = GetMultiplayerId(); + + var2 = sBerryBlenderData->field_96[playerId]; + + if (sBerryBlenderData->gameEndState == 0) + { + if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A && gMain.newKeys & A_BUTTON) + { + if ((gMain.heldKeysRaw & (A_BUTTON | L_BUTTON)) != (A_BUTTON | L_BUTTON)) + A_pressed = TRUE; + } + else if (gMain.newKeys & A_BUTTON) + { + A_pressed = TRUE; + } + + if (A_pressed) + { + u8 var3; + StartSpriteAnim(&gSprites[sBerryBlenderData->syncArrowSpriteIds[sBerryBlenderData->field_8E[var2]]], var2 + 4); + var3 = sub_8080624(sBerryBlenderData->arrowPos, playerId); + + if (var3 == 2) + gSendCmd[2] = 0x4523; + else if (var3 == 1) + gSendCmd[2] = 0x5432; + else + gSendCmd[2] = 0x2345; + } + } + if (++sBerryBlenderData->field_72 > 5) + { + if (sBerryBlenderData->field_4C > 128) + sBerryBlenderData->field_4C--; + sBerryBlenderData->field_72 = 0; + } + if (gUnknown_020322D5 && gMain.newKeys & L_BUTTON) + sBerryBlenderData->field_123 ^= 1; +} + +static void sub_8081898(void) +{ + sub_8082D28(); + + if (sBerryBlenderData->gameFrameTime < (99 * 60 * 60) + (59 * 60)) // game time can't be longer than 99 minutes and 59 seconds, can't print 3 digits + sBerryBlenderData->gameFrameTime++; + + sub_8081744(); + SetLinkDebugValues((u16)(sBerryBlenderData->field_4C), sBerryBlenderData->field_116); + sub_80814F4(); + sub_8083140(sBerryBlenderData->field_116, 1000); + sub_8083230(sBerryBlenderData->field_4C); + sub_808330C(); + sub_8082AD4(); + if (sBerryBlenderData->gameEndState == 0 && sBerryBlenderData->field_118 >= 1000) + { + sBerryBlenderData->field_116 = 1000; + sBerryBlenderData->gameEndState = 1; + SetMainCallback2(CB2_HandleBlenderEndGame); + } + + Blender_DummiedOutFunc(sBerryBlenderData->bg_X, sBerryBlenderData->bg_Y); + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + RunTextPrinters(); + UpdatePaletteFade(); +} + +static void Blender_DummiedOutFunc(s16 a0, s16 a1) +{ + +} + +static bool8 sub_8081964(struct BlenderBerry* berries, u8 index1, u8 index2) +{ + if (berries[index1].itemId != berries[index2].itemId + || (StringCompare(berries[index1].name, berries[index2].name) == 0 + && (berries[index1].flavours[FLAVOUR_SPICY] == berries[index2].flavours[FLAVOUR_SPICY] + && berries[index1].flavours[FLAVOUR_DRY] == berries[index2].flavours[FLAVOUR_DRY] + && berries[index1].flavours[FLAVOUR_SWEET] == berries[index2].flavours[FLAVOUR_SWEET] + && berries[index1].flavours[FLAVOUR_BITTER] == berries[index2].flavours[FLAVOUR_BITTER] + && berries[index1].flavours[FLAVOUR_SOUR] == berries[index2].flavours[FLAVOUR_SOUR] + && berries[index1].smoothness == berries[index2].smoothness))) + return TRUE; + else + return FALSE; +} + +static u32 Blender_GetPokeblockColor(struct BlenderBerry* berries, s16* a1, u8 playersNo, u8 a3) +{ + s16 vars[6]; + s32 i; + s32 r6; + u8 r2; + + for (i = 0; i < 6; i++) + vars[i] = a1[i]; + + r6 = 0; + for (i = 0; i < 5; i++) + { + if (vars[i] == 0) + r6++; + } + if (r6 == 5 || a3 > 3) + return 12; + for (i = 0; i < playersNo; i++) + { + for (r6 = 0; r6 < playersNo; r6++) + { + if (berries[i].itemId == berries[r6].itemId && i != r6 + && (berries[i].itemId != ITEM_ENIGMA_BERRY || sub_8081964(berries, i, r6))) + return 12; + } + } + r2 = 0; + for (r2 = 0, i = 0; i < 5; i++) + { + if (vars[i] > 0) + r2++; + } + if (r2 > 3) + return 13; + if (r2 == 3) + return 11; + for (i = 0; i < 5; i++) + { + if (vars[i] > 50) + return 14; + } + if (r2 == 1 && vars[0] > 0) + return 1; + if (r2 == 1 && vars[1] > 0) + return 2; + if (r2 == 1 && vars[2] > 0) + return 3; + if (r2 == 1 && vars[3] > 0) + return 4; + if (r2 == 1 && vars[4] > 0) + return 5; + if (r2 == 2) + { + s32 var = 0; + for (i = 0; i < 5; i++) + { + if (vars[i] > 0) + sUnknown_03000DF8[var++] = i; + } + if (vars[sUnknown_03000DF8[0]] >= vars[sUnknown_03000DF8[1]]) + { + if (sUnknown_03000DF8[0] == 0) + return (sUnknown_03000DF8[1] << 16) | 6; + if (sUnknown_03000DF8[0] == 1) + return (sUnknown_03000DF8[1] << 16) | 7; + if (sUnknown_03000DF8[0] == 2) + return (sUnknown_03000DF8[1] << 16) | 8; + if (sUnknown_03000DF8[0] == 3) + return (sUnknown_03000DF8[1] << 16) | 9; + if (sUnknown_03000DF8[0] == 4) + return (sUnknown_03000DF8[1] << 16) | 10; + } + else + { + if (sUnknown_03000DF8[1] == 0) + return (sUnknown_03000DF8[0] << 16) | 6; + if (sUnknown_03000DF8[1] == 1) + return (sUnknown_03000DF8[0] << 16) | 7; + if (sUnknown_03000DF8[1] == 2) + return (sUnknown_03000DF8[0] << 16) | 8; + if (sUnknown_03000DF8[1] == 3) + return (sUnknown_03000DF8[0] << 16) | 9; + if (sUnknown_03000DF8[1] == 4) + return (sUnknown_03000DF8[0] << 16) | 10; + } + } + return 0; +} + +static void sub_8081BB0(s16 value) +{ + sUnknown_03000E04 = value; +} + +static s16 sub_8081BBC(void) +{ + return sUnknown_03000E04; +} + +static void sub_8081BC8(s16 value) +{ + sUnknown_03000E06 = value; +} + +static s16 sub_8081BD4(void) +{ + return sUnknown_03000E06; +} + +static void Blender_CalculatePokeblock(struct BlenderBerry *berries, struct Pokeblock *pokeblock, u8 playersNo, u8 *flavours, u16 maxRPM) +{ + s32 i, j; + s32 multiuseVar, var2; + u8 var3; + + for (i = 0; i < 6; i++) + sUnknown_03000DE8[i] = 0; + + for (i = 0; i < playersNo; i++) + { + for (j = 0; j < 6; j++) + sUnknown_03000DE8[j] += berries[i].flavours[j]; + } + + multiuseVar = sUnknown_03000DE8[0]; + sUnknown_03000DE8[0] -= sUnknown_03000DE8[1]; + sUnknown_03000DE8[1] -= sUnknown_03000DE8[2]; + sUnknown_03000DE8[2] -= sUnknown_03000DE8[3]; + sUnknown_03000DE8[3] -= sUnknown_03000DE8[4]; + sUnknown_03000DE8[4] -= multiuseVar; + + multiuseVar = 0; + for (i = 0; i < 5; i++) + { + if (sUnknown_03000DE8[i] < 0) + { + sUnknown_03000DE8[i] = 0; + multiuseVar++; + } + } + var3 = multiuseVar; + for (i = 0; i < 5; i++) + { + if (sUnknown_03000DE8[i] > 0) + { + if (sUnknown_03000DE8[i] < multiuseVar) + sUnknown_03000DE8[i] = 0; + else + sUnknown_03000DE8[i] -= multiuseVar; + } + } + for (i = 0; i < 5; i++) + { + sUnknown_020322A8[i] = sUnknown_03000DE8[i]; + } + + multiuseVar = maxRPM / 333 + 100; + sUnknown_020322D0 = multiuseVar; + + for (i = 0; i < 5; i++) + { + s32 r4; + s32 r5 = sUnknown_03000DE8[i]; + r5 = (r5 * multiuseVar) / 10; + r4 = r5 % 10; + r5 /= 10; + if (r4 > 4) + r5++; + sUnknown_03000DE8[i] = r5; + } + for (i = 0; i < 5; i++) + { + sUnknown_020322BC[i] = sUnknown_03000DE8[i]; + } + + pokeblock->color = Blender_GetPokeblockColor(berries, &sUnknown_03000DE8[0], playersNo, var3); + sUnknown_03000DE8[5] = (sUnknown_03000DE8[5] / playersNo) - playersNo; + + if (sUnknown_03000DE8[5] < 0) + sUnknown_03000DE8[5] = 0; + + if (pokeblock->color == 12) + { + multiuseVar = Random() % 10; + for (i = 0; i < 5; i++) + { + if ((sUnknown_08339CC8[multiuseVar] >> i) & 1) + sUnknown_03000DE8[i] = 2; + else + sUnknown_03000DE8[i] = 0; + } + } + + for (i = 0; i < 6; i++) + { + if (sUnknown_03000DE8[i] > 255) + sUnknown_03000DE8[i] = 255; + } + + pokeblock->spicy = sUnknown_03000DE8[0]; + pokeblock->dry = sUnknown_03000DE8[1]; + pokeblock->sweet = sUnknown_03000DE8[2]; + pokeblock->bitter = sUnknown_03000DE8[3]; + pokeblock->sour = sUnknown_03000DE8[4]; + pokeblock->feel = sUnknown_03000DE8[5]; + + for (i = 0; i < 6; i++) + { + flavours[i] = sUnknown_03000DE8[i]; + } +} + +static void BlenderDebug_CalculatePokeblock(struct BlenderBerry* berries, struct Pokeblock* pokeblock, u8 playersNo, u8* flavours, u16 a4) +{ + Blender_CalculatePokeblock(berries, pokeblock, playersNo, flavours, a4); +} + +static void sub_8081E20(void) +{ + u32 frames = (u16)(sBerryBlenderData->gameFrameTime); + u16 max_RPM = sBerryBlenderData->max_RPM; + s16 var = 0; + + if (frames < 900) + var = 5; + else if ((u16)(frames - 900) < 600) + var = 4; + else if ((u16)(frames - 1500) < 600) + var = 3; + else if ((u16)(frames - 2100) < 900) + var = 2; + else if ((u16)(frames - 3300) < 300) + var = 1; + + sub_8081BC8(var); + + var = 0; + if (max_RPM <= 64) + { + if (max_RPM >= 50 && max_RPM < 100) + var = -1; + else if (max_RPM >= 100 && max_RPM < 150) + var = -2; + else if (max_RPM >= 150 && max_RPM < 200) + var = -3; + else if (max_RPM >= 200 && max_RPM < 250) + var = -4; + else if (max_RPM >= 250 && max_RPM < 300) + var = -5; + else if (max_RPM >= 350 && max_RPM < 400) + var = -6; + else if (max_RPM >= 400 && max_RPM < 450) + var = -7; + else if (max_RPM >= 500 && max_RPM < 550) + var = -8; + else if (max_RPM >= 550 && max_RPM < 600) + var = -9; + else if (max_RPM >= 600) + var = -10; + } + + sub_8081BB0(var); +} + +static void sub_8081F94(u16 *a0) +{ + if (gReceivedRemoteLinkPlayers != 0 && gLinkVSyncDisabled) + *a0 = 0x2F00; + else + *a0 = 0x2FFF; +} + +static void CB2_HandleBlenderEndGame(void) +{ + u8 i, j; + + if (sBerryBlenderData->gameEndState < 3) + sub_8082D28(); + + GetMultiplayerId(); // unused return value + + switch (sBerryBlenderData->gameEndState) + { + case 1: + m4aMPlayTempoControl(&gMPlay_BGM, 256); + for (i = 0; i < gSpecialVar_0x8004; i++) + { + DestroyTask(sBerryBlenderData->field_120[i]); + } + sBerryBlenderData->gameEndState++; + break; + case 2: + sBerryBlenderData->field_4C -= 32; + if (sBerryBlenderData->field_4C <= 0) + { + sub_8009F8C(); + sBerryBlenderData->field_4C = 0; + + if (gReceivedRemoteLinkPlayers != 0) + sBerryBlenderData->gameEndState++; + else + sBerryBlenderData->gameEndState = 5; + + sBerryBlenderData->mainState = 0; + m4aMPlayStop(&gMPlay_SE2); + } + Blender_ControlHitPitch(); + break; + case 3: + if (GetMultiplayerId() != 0) + { + sBerryBlenderData->gameEndState++; + } + else if (sub_800A520()) + { + if (gReceivedRemoteLinkPlayers != 0 && gLinkVSyncDisabled) + { + sBerryBlenderData->gameBlock.timeRPM.time = sBerryBlenderData->gameFrameTime; + sBerryBlenderData->gameBlock.timeRPM.max_RPM = sBerryBlenderData->max_RPM; + + for (i = 0; i < BLENDER_MAX_PLAYERS; i++) + { + for (j = 0; j < BLENDER_SCORES_NO; j++) + sBerryBlenderData->gameBlock.scores[i][j] = sBerryBlenderData->scores[i][j]; + } + + if (SendBlock(0, &sBerryBlenderData->gameBlock, sizeof(sBerryBlenderData->gameBlock))) + sBerryBlenderData->gameEndState++; + } + else + { + sBerryBlenderData->smallBlock.time = sBerryBlenderData->gameFrameTime; + sBerryBlenderData->smallBlock.max_RPM = sBerryBlenderData->max_RPM; + if (SendBlock(0, &sBerryBlenderData->smallBlock, sizeof(sBerryBlenderData->smallBlock) + 32)) + sBerryBlenderData->gameEndState++; + } + } + break; + case 4: + if (GetBlockReceivedStatus()) + { + ResetBlockReceivedFlags(); + sBerryBlenderData->gameEndState++; + + if (gReceivedRemoteLinkPlayers != 0 && gLinkVSyncDisabled) + { + struct BlenderGameBlock *receivedBlock = (struct BlenderGameBlock*)(&gBlockRecvBuffer); + + sBerryBlenderData->max_RPM = receivedBlock->timeRPM.max_RPM; + sBerryBlenderData->gameFrameTime = receivedBlock->timeRPM.time; + + for (i = 0; i < BLENDER_MAX_PLAYERS; i++) + { + for (j = 0; j < BLENDER_SCORES_NO; j++) + sBerryBlenderData->scores[i][j] = receivedBlock->scores[i][j]; + } + } + else + { + struct TimeAndRPM *receivedBlock = (struct TimeAndRPM*)(&gBlockRecvBuffer); + + sBerryBlenderData->max_RPM = receivedBlock->max_RPM; + sBerryBlenderData->gameFrameTime = receivedBlock->time; + } + } + break; + case 5: + if (Blender_PrintBlendingRanking()) + sBerryBlenderData->gameEndState++; + break; + case 6: + if (Blender_PrintBlendingResults()) + { + if (gInGameOpponentsNo == 0) + IncrementGameStat(GAME_STAT_POKEBLOCKS_WITH_FRIENDS); + else + IncrementGameStat(GAME_STAT_POKEBLOCKS); + + sBerryBlenderData->gameEndState++; + } + break; + case 7: + if (Blender_PrintText(&sBerryBlenderData->textState, sText_WouldLikeToBlendAnotherBerry, GetPlayerTextSpeed())) + sBerryBlenderData->gameEndState++; + break; + case 9: + sBerryBlenderData->yesNoAnswer = 0; + CreateYesNoMenu(&sBlender_YesNoWindowTemplate, 1, 0xD, 0); + sBerryBlenderData->gameEndState++; + break; + case 10: + switch (sub_8198C58()) + { + case 1: + case -1: + sBerryBlenderData->yesNoAnswer = 1; + sBerryBlenderData->gameEndState++; + for (i = 0; i field_8E[i] != 0xFF) + { + PutWindowTilemap(i); + CopyWindowToVram(i, 3); + } + } + break; + case 0: + sBerryBlenderData->yesNoAnswer = 0; + sBerryBlenderData->gameEndState++; + for (i = 0; i field_8E[i] != 0xFF) + { + PutWindowTilemap(i); + CopyWindowToVram(i, 3); + } + } + break; + } + break; + case 11: + sub_8081F94(&gSendCmd[0]); + if (sBerryBlenderData->yesNoAnswer == 0) + { + if (IsBagPocketNonEmpty(BAG_BERRIES) == FALSE) // no berries + { + sBerryBlenderData->playAgainState = CANT_PLAY_NO_BERRIES; + gSendCmd[1] = 0x9999; + } + else if (GetFirstFreePokeblockSlot() == -1) // no space for pokeblocks + { + sBerryBlenderData->playAgainState = CANT_PLAY_NO_PKBLCK_SPACE; + gSendCmd[1] = 0xAAAA; + } + else + { + sBerryBlenderData->playAgainState = PLAY_AGAIN_OK; + gSendCmd[1] = 0x7779; + } + sBerryBlenderData->gameEndState++; + } + else + { + sBerryBlenderData->playAgainState = DONT_PLAY_AGAIN; + gSendCmd[1] = 0x8888; + sBerryBlenderData->gameEndState++; + } + break; + case 12: + if (gInGameOpponentsNo) + { + SetMainCallback2(CB2_HandlePlayerPlayAgainChoice); + sBerryBlenderData->gameEndState = 0; + sBerryBlenderData->mainState = 0; + } + else + { + sBerryBlenderData->gameEndState++; + } + break; + case 8: + sBerryBlenderData->gameEndState++; + break; + case 13: + if (Blender_PrintText(&sBerryBlenderData->textState, sText_CommunicationStandby, GetPlayerTextSpeed())) + { + SetMainCallback2(CB2_HandlePlayerLinkPlayAgainChoice); + sBerryBlenderData->gameEndState = 0; + sBerryBlenderData->mainState = 0; + } + break; + } + + sub_808330C(); + sub_8083230(sBerryBlenderData->field_4C); + sub_8082AD4(); + Blender_DummiedOutFunc(sBerryBlenderData->bg_X, sBerryBlenderData->bg_Y); + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + RunTextPrinters(); + UpdatePaletteFade(); +} + +static bool8 LinkPlayAgainHandleSaving(void) +{ + switch (sBerryBlenderData->field_1A0) + { + case 0: + sub_800ADF8(); + sBerryBlenderData->field_1A0 = 1; + sBerryBlenderData->framesToWait = 0; + break; + case 1: + if (sub_800A520()) + { + sBerryBlenderData->field_1A0++; + gSoftResetDisabled = TRUE; + } + break; + case 2: + sub_8153430(); + sBerryBlenderData->field_1A0++; + sBerryBlenderData->framesToWait = 0; + break; + case 3: + if (++sBerryBlenderData->framesToWait == 10) + { + sub_800ADF8(); + sBerryBlenderData->field_1A0++; + } + break; + case 4: + if (sub_800A520()) + { + if (sub_8153474()) + { + sBerryBlenderData->field_1A0 = 5; + } + else + { + sBerryBlenderData->framesToWait = 0; + sBerryBlenderData->field_1A0 = 3; + } + } + break; + case 5: + sBerryBlenderData->field_1A0++; + sBerryBlenderData->framesToWait = 0; + break; + case 6: + if (++sBerryBlenderData->framesToWait > 5) + { + gSoftResetDisabled = FALSE; + return TRUE; + } + break; + } + + return FALSE; +} + +static void CB2_HandlePlayerLinkPlayAgainChoice(void) +{ + switch (sBerryBlenderData->gameEndState) + { + case 0: + if (sBerryBlenderData->field_64[0] == 0x2222) + { + sBerryBlenderData->gameEndState = 5; + } + else if (sBerryBlenderData->field_64[0] == 0x1111) + { + if (sBerryBlenderData->field_6C == 0x9999) + sBerryBlenderData->gameEndState = 2; + else if (sBerryBlenderData->field_6C == 0xAAAA) + sBerryBlenderData->gameEndState = 1; + else + sBerryBlenderData->gameEndState = 5; + } + break; + case 1: + sBerryBlenderData->gameEndState = 3; + StringCopy(gStringVar4, gLinkPlayers[sBerryBlenderData->field_6E].name); + StringAppend(gStringVar4, sText_ApostropheSPokeblockCaseIsFull); + break; + case 2: + sBerryBlenderData->gameEndState++; + StringCopy(gStringVar4, gLinkPlayers[sBerryBlenderData->field_6E].name); + StringAppend(gStringVar4, sText_HasNoBerriesToPut); + break; + case 3: + if (Blender_PrintText(&sBerryBlenderData->textState, gStringVar4, GetPlayerTextSpeed())) + { + sBerryBlenderData->framesToWait = 0; + sBerryBlenderData->gameEndState++; + } + break; + case 4: + if (++sBerryBlenderData->framesToWait > 60) + sBerryBlenderData->gameEndState = 5; + break; + case 5: + Blender_PrintText(&sBerryBlenderData->textState, gText_SavingDontTurnOff2, 0); + sub_800ADF8(); + sBerryBlenderData->gameEndState++; + break; + case 6: + if (sub_800A520()) + { + sBerryBlenderData->framesToWait = 0; + sBerryBlenderData->gameEndState++; + sBerryBlenderData->field_1A0 = 0; + } + break; + case 7: + if (LinkPlayAgainHandleSaving()) + { + PlaySE(SE_SAVE); + sBerryBlenderData->gameEndState++; + } + break; + case 8: + sBerryBlenderData->gameEndState++; + sub_800ADF8(); + break; + case 9: + if (sub_800A520()) + { + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + sBerryBlenderData->gameEndState++; + } + break; + case 10: + if (!gPaletteFade.active) + { + if (sBerryBlenderData->field_64[0] == 0x2222) + { + FreeAllWindowBuffers(); + UnsetBgTilemapBuffer(2); + UnsetBgTilemapBuffer(1); + FREE_AND_SET_NULL(sBerryBlenderData); + SetMainCallback2(DoBerryBlending); + } + else + { + sBerryBlenderData->framesToWait = 0; + sBerryBlenderData->gameEndState++; + } + } + break; + case 11: + if (++sBerryBlenderData->framesToWait > 30) + { + sub_800AC34(); + sBerryBlenderData->gameEndState++; + } + break; + case 12: + if (gReceivedRemoteLinkPlayers == 0) + { + FREE_AND_SET_NULL(sBerryBlenderData); + SetMainCallback2(c2_exit_to_overworld_1_continue_scripts_restart_music); + } + break; + } + + sub_8082AD4(); + Blender_DummiedOutFunc(sBerryBlenderData->bg_X, sBerryBlenderData->bg_Y); + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + RunTextPrinters(); + UpdatePaletteFade(); +} + +static void CB2_HandlePlayerPlayAgainChoice(void) +{ + switch (sBerryBlenderData->gameEndState) + { + case 0: + if (sBerryBlenderData->playAgainState == PLAY_AGAIN_OK || sBerryBlenderData->playAgainState == DONT_PLAY_AGAIN) + sBerryBlenderData->gameEndState = 9; + if (sBerryBlenderData->playAgainState == CANT_PLAY_NO_BERRIES) + sBerryBlenderData->gameEndState = 2; + if (sBerryBlenderData->playAgainState == CANT_PLAY_NO_PKBLCK_SPACE) + sBerryBlenderData->gameEndState = 1; + break; + case 1: + sBerryBlenderData->gameEndState = 3; + sBerryBlenderData->textState = 0; + StringCopy(gStringVar4, sText_YourPokeblockCaseIsFull); + break; + case 2: + sBerryBlenderData->gameEndState++; + sBerryBlenderData->textState = 0; + StringCopy(gStringVar4, sText_RunOutOfBerriesForBlending); + break; + case 3: + if (Blender_PrintText(&sBerryBlenderData->textState, gStringVar4, GetPlayerTextSpeed())) + sBerryBlenderData->gameEndState = 9; + break; + case 9: + BeginFastPaletteFade(3); + sBerryBlenderData->gameEndState++; + break; + case 10: + if (!gPaletteFade.active) + { + if (sBerryBlenderData->playAgainState == PLAY_AGAIN_OK) + SetMainCallback2(DoBerryBlending); + else + SetMainCallback2(c2_exit_to_overworld_1_continue_scripts_restart_music); + + FreeAllWindowBuffers(); + UnsetBgTilemapBuffer(2); + UnsetBgTilemapBuffer(1); + FREE_AND_SET_NULL(sBerryBlenderData); + } + break; + } + + sub_8082AD4(); + Blender_DummiedOutFunc(sBerryBlenderData->bg_X, sBerryBlenderData->bg_Y); + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + RunTextPrinters(); + UpdatePaletteFade(); +} + +static void sub_8082AD4(void) +{ + if (gReceivedRemoteLinkPlayers) + { + if (sub_80814B0(gRecvCmds[0][0], 0x2FFF, 0x2F00)) + { + if (gRecvCmds[0][1] == 0x1111) + { + switch (gRecvCmds[0][2]) + { + case 0x8888: + sBerryBlenderData->field_6C = 0x8888; + sBerryBlenderData->field_6E = gRecvCmds[0][3]; + break; + case 0x9999: + sBerryBlenderData->field_6C = 0x9999; + sBerryBlenderData->field_6E = gRecvCmds[0][3]; + break; + case 0xAAAA: + sBerryBlenderData->field_6C = 0xAAAA; + sBerryBlenderData->field_6E = gRecvCmds[0][3]; + break; + } + + sBerryBlenderData->field_64[0] = 0x1111; + } + else if (gRecvCmds[0][1] == 0x2222) + { + sBerryBlenderData->field_64[0] = 0x2222; + } + } + if (GetMultiplayerId() == 0 && sBerryBlenderData->field_64[0] != 0x1111 && sBerryBlenderData->field_64[0] != 0x2222) + { + u8 i; + for (i = 0; i < GetLinkPlayerCount(); i++) + { + if (sub_80814B0(gRecvCmds[i][0], 0x2FFF, 0x2F00)) + { + switch (gRecvCmds[i][1]) + { + case 0x8888: + sBerryBlenderData->field_64[i] = 0x8888; + break; + case 0x7779: + sBerryBlenderData->field_64[i] = 0x7779; + break; + case 0x9999: + sBerryBlenderData->field_64[i] = 0x9999; + break; + case 0xAAAA: + sBerryBlenderData->field_64[i] = 0xAAAA; + break; + } + } + } + for (i = 0; i < GetLinkPlayerCount(); i++) + { + if (sBerryBlenderData->field_64[i] == 0) + break; + } + if (i == GetLinkPlayerCount()) + { + for (i = 0; i < GetLinkPlayerCount(); i++) + { + if (sBerryBlenderData->field_64[i] != 0x7779) + break; + } + sub_8081F94(&gSendCmd[0]); + if (i == GetLinkPlayerCount()) + { + gSendCmd[1] = 0x2222; + } + else + { + gSendCmd[1] = 0x1111; + gSendCmd[2] = sBerryBlenderData->field_64[i]; + gSendCmd[3] = i; + } + } + } + } +} + +static void sub_8082CB4(struct BgAffineSrcData *dest) +{ + struct BgAffineSrcData affineSrc; + + affineSrc.texX = 30720; + affineSrc.texY = 20480; + affineSrc.scrX = 120 - sBerryBlenderData->bg_X; + affineSrc.scrY = 80 - sBerryBlenderData->bg_Y; + affineSrc.sx = sBerryBlenderData->field_11A; + affineSrc.sy = sBerryBlenderData->field_11A; + affineSrc.alpha = sBerryBlenderData->arrowPos; + + *dest = affineSrc; +} + +u16 GetBlenderArrowPosition(void) +{ + return sBerryBlenderData->arrowPos; +} + +static void sub_8082D28(void) +{ + u8 playerId = 0; + + if (gReceivedRemoteLinkPlayers != 0) + playerId = GetMultiplayerId(); + + if (gLinkVSyncDisabled && gReceivedRemoteLinkPlayers != 0) + { + if (playerId == 0) + { + sBerryBlenderData->arrowPos += sBerryBlenderData->field_4C; + gSendCmd[5] = sBerryBlenderData->field_116; + gSendCmd[6] = sBerryBlenderData->arrowPos; + sub_8082CB4(&sBerryBlenderData->bgAffineSrc); + } + else + { + if ((gRecvCmds[0][0] & 0xFF00) == 0x4400) + { + sBerryBlenderData->field_116 = gRecvCmds[0][5]; + sBerryBlenderData->arrowPos = gRecvCmds[0][6]; + sub_8082CB4(&sBerryBlenderData->bgAffineSrc); + } + } + } + else + { + sBerryBlenderData->arrowPos += sBerryBlenderData->field_4C; + sub_8082CB4(&sBerryBlenderData->bgAffineSrc); + } +} + +static void BerryBlender_SetBackgroundsPos(void) +{ + SetGpuReg(REG_OFFSET_BG1HOFS, sBerryBlenderData->bg_X); + SetGpuReg(REG_OFFSET_BG1VOFS, sBerryBlenderData->bg_Y); + + SetGpuReg(REG_OFFSET_BG0HOFS, sBerryBlenderData->bg_X); + SetGpuReg(REG_OFFSET_BG0VOFS, sBerryBlenderData->bg_Y); +} + +static void sub_8082E3C(struct Sprite* sprite) +{ + sprite->data2 += sprite->data0; + sprite->data3 += sprite->data1; + sprite->pos2.x = sprite->data2 / 8; + sprite->pos2.y = sprite->data3 / 8; + + if (sprite->animEnded) + DestroySprite(sprite); +} + +static void sub_8082E84(void) +{ + s32 limit = (Random() % 2) + 1; + s32 i; + + for (i = 0; i < limit; i++) + { + u16 rand; + s32 x, y; + u8 spriteId; + + rand = sBerryBlenderData->arrowPos + (Random() % 20); + + x = gSineTable[(rand & 0xFF) + 64] / 4; + y = gSineTable[(rand & 0xFF)] / 4; + + spriteId = CreateSprite(&sUnknown_08339BE0, x + 120, y + 80, 1); + gSprites[spriteId].data0 = 16 - (Random() % 32); + gSprites[spriteId].data1 = 16 - (Random() % 32); + + gSprites[spriteId].callback = sub_8082E3C; + } +} + +static void sub_8082F68(struct Sprite* sprite) +{ + sprite->data0++; + sprite->pos2.y = -(sprite->data0 / 3); + + if (sprite->animEnded) + DestroySprite(sprite); +} + +static void sub_8082F9C(struct Sprite* sprite) +{ + sprite->data0++; + sprite->pos2.y = -(sprite->data0 * 2); + + if (sprite->pos2.y < -12) + sprite->pos2.y = -12; + if (sprite->animEnded) + DestroySprite(sprite); +} + +static void Blender_SetBankBerryData(u8 bank, u16 itemId) +{ + sBerryBlenderData->chosenItemId[bank] = itemId; + Blender_CopyBerryData(&sBerryBlenderData->blendedBerries[bank], itemId); +} + +static void sub_8083010(struct Sprite* sprite) +{ + switch (sprite->data0) + { + case 0: + sprite->data1 += 8; + if (sprite->data1 > 88) + { + sprite->data1 = 88; + sprite->data0++; + PlaySE(SE_KON); + } + break; + case 1: + sprite->data2 += 1; + if (sprite->data2 > 20) + { + sprite->data0++; + sprite->data2 = 0; + } + break; + case 2: + sprite->data1 += 4; + if (sprite->data1 > 176) + { + if (++sprite->data3 == 3) + { + DestroySprite(sprite); + CreateSprite(&sUnknown_08339C60, 120, -20, 2); + } + else + { + sprite->data0 = 0; + sprite->data1 = -16; + StartSpriteAnim(sprite, sprite->data3); + } + } + break; + } + + sprite->pos2.y = sprite->data1; +} + +static void sub_80830C0(struct Sprite* sprite) +{ + switch (sprite->data0) + { + case 0: + sprite->data1 += 8; + if (sprite->data1 > 92) + { + sprite->data1 = 92; + sprite->data0++; + PlaySE(SE_PIN); + } + break; + case 1: + sprite->data2 += 1; + if (sprite->data2 > 20) + sprite->data0++; + break; + case 2: + sprite->data1 += 4; + if (sprite->data1 > 176) + { + sBerryBlenderData->mainState++; + DestroySprite(sprite); + } + break; + } + + sprite->pos2.y = sprite->data1; +} + +static void sub_8083140(u16 a0, u16 a1) +{ + if (sBerryBlenderData->field_118 < a0) + { + sBerryBlenderData->field_118 += 2; + sub_8083170(sBerryBlenderData->field_118, a1); + } +} + +static void sub_8083170(u16 a0, u16 a1) +{ + s32 var1, var2, var3, var4; + u16 *vram; + + vram = (u16*)(VRAM + 0x6000); + var1 = (a0 * 64) / a1; + var2 = var1 / 8; + for (var4 = 0; var4 < var2; var4++) + { + vram[11 + var4] = 0x80E9; + vram[43 + var4] = 0x80F9; + } + var3 = var1 % 8; + if (var3 != 0) + { + vram[11 + var4] = var3 + 0x80E1; + vram[43 + var4] = var3 + 0x80F1; + var4++; + } + for (; var4 < 8; var4++) + { + vram[11 + var4] = 0x80E1; + vram[43 + var4] = 0x80F1; + } +} + +static u32 sub_8083210(u16 a0) +{ + return 0x57E40 * a0 / 0x10000; +} + +static void sub_8083230(u16 a0) +{ + u8 i; + u8 palAdders[5]; + + u32 var = sub_8083210(a0); + if (sBerryBlenderData->max_RPM < var) + sBerryBlenderData->max_RPM = var; + for (i = 0; i < 5; i++) + { + palAdders[i] = var % 10; + var /= 10; + } + *((u16*)(VRAM + 0x6458)) = palAdders[4] + 0x8072; + *((u16*)(VRAM + 0x645A)) = palAdders[3] + 0x8072; + *((u16*)(VRAM + 0x645C)) = palAdders[2] + 0x8072; + *((u16*)(VRAM + 0x6460)) = palAdders[1] + 0x8072; + *((u16*)(VRAM + 0x6462)) = palAdders[0] + 0x8072; +} + +static void sub_80832BC(s16* a0, u16 a1) +{ + if (*a0 == 0) + *a0 = (Random() % a1) - (a1 / 2); +} + +static void sub_80832E8(s16* a0) +{ + if (*a0 < 0) + (*a0)++; + if (*a0 > 0) + (*a0)--; +} + +static void sub_808330C(void) +{ + sub_80832E8(&sBerryBlenderData->bg_X); + sub_80832E8(&sBerryBlenderData->bg_Y); +} + +static void sub_8083334(s16* a0, u16 a1) +{ + s32 var; + + if (a1 < 10) + var = 16; + else + var = 8; + + if (*a0 == 0) + { + *a0 = (Random() % var) - (var / 2); + } + else + { + if (*a0 < 0) + (*a0)++; + if (*a0 > 0) + (*a0)--; + } +} + +static bool8 sub_8083380(void) +{ + if (sBerryBlenderData->framesToWait == 0) + { + sBerryBlenderData->bg_X = 0; + sBerryBlenderData->bg_Y = 0; + } + + sBerryBlenderData->framesToWait++; + sub_8083334(&sBerryBlenderData->bg_X, sBerryBlenderData->framesToWait); + sub_8083334(&sBerryBlenderData->bg_Y, sBerryBlenderData->framesToWait); + + if (sBerryBlenderData->framesToWait == 20) + { + sBerryBlenderData->bg_X = 0; + sBerryBlenderData->bg_Y = 0; + return TRUE; + } + + return FALSE; +} + +static void sub_80833F8(struct Sprite* sprite) +{ + sprite->pos2.x = -(sBerryBlenderData->bg_X); + sprite->pos2.y = -(sBerryBlenderData->bg_Y); +} + +static void TryUpdateBerryBlenderRecord(void) +{ + if (gSaveBlock1Ptr->berryBlenderRecords[sBerryBlenderData->playersNo - 2] < sBerryBlenderData->max_RPM) + gSaveBlock1Ptr->berryBlenderRecords[sBerryBlenderData->playersNo - 2] = sBerryBlenderData->max_RPM; +} + +static bool8 Blender_PrintBlendingResults(void) +{ + u16 i; + s32 xPos, yPos; + + struct Pokeblock pokeblock; + u8 flavours[6]; + u8 text[40]; + u16 berryIds[4]; // unused + + switch (sBerryBlenderData->mainState) + { + case 0: + sBerryBlenderData->mainState++; + sBerryBlenderData->framesToWait = 17; + break; + case 1: + sBerryBlenderData->framesToWait -= 10; + if (sBerryBlenderData->framesToWait < 0) + { + sBerryBlenderData->framesToWait = 0; + sBerryBlenderData->mainState++; + } + break; + case 2: + if (++sBerryBlenderData->framesToWait > 20) + { + for (i = 0; i < BLENDER_SCORES_NO; i++) + DestroySprite(&gSprites[sBerryBlenderData->scoreIconIds[i]]); + + sBerryBlenderData->framesToWait = 0; + sBerryBlenderData->mainState++; + } + break; + case 3: + { + u16 minutes, seconds; + u8 *txtPtr; + + xPos = GetStringCenterAlignXOffset(1, sText_BlendingResults, 0xA8); + Blender_AddTextPrinter(5, sText_BlendingResults, xPos, 1, TEXT_SPEED_FF, 0); + + if (sBerryBlenderData->playersNo == 4) + yPos = 17; + else + yPos = 21; + + for (i = 0; i < sBerryBlenderData->playersNo; yPos += 16, i++) + { + u8 place = sBerryBlenderData->playerPlaces[i]; + + ConvertIntToDecimalStringN(sBerryBlenderData->stringVar, i + 1, STR_CONV_MODE_LEFT_ALIGN, 1); + StringAppend(sBerryBlenderData->stringVar, sText_Dot); + StringAppend(sBerryBlenderData->stringVar, gText_Space); + StringAppend(sBerryBlenderData->stringVar, gLinkPlayers[place].name); + Blender_AddTextPrinter(5, sBerryBlenderData->stringVar, 8, yPos, TEXT_SPEED_FF, 3); + + StringCopy(sBerryBlenderData->stringVar, sBerryBlenderData->blendedBerries[place].name); + ConvertInternationalString(sBerryBlenderData->stringVar, gLinkPlayers[place].language); + StringAppend(sBerryBlenderData->stringVar, sText_SpaceBerry); + Blender_AddTextPrinter(5, sBerryBlenderData->stringVar, 0x54, yPos, TEXT_SPEED_FF, 3); + } + + Blender_AddTextPrinter(5, sText_MaximumSpeed, 0, 0x51, TEXT_SPEED_FF, 3); + ConvertIntToDecimalStringN(sBerryBlenderData->stringVar, sBerryBlenderData->max_RPM / 100, STR_CONV_MODE_RIGHT_ALIGN, 3); + StringAppend(sBerryBlenderData->stringVar, sText_Dot); + + ConvertIntToDecimalStringN(text, sBerryBlenderData->max_RPM % 100, STR_CONV_MODE_LEADING_ZEROS, 2); + StringAppend(sBerryBlenderData->stringVar, text); + StringAppend(sBerryBlenderData->stringVar, sText_RPM); + + xPos = GetStringRightAlignXOffset(1, sBerryBlenderData->stringVar, 0xA8); + Blender_AddTextPrinter(5, sBerryBlenderData->stringVar, xPos, 0x51, TEXT_SPEED_FF, 3); + Blender_AddTextPrinter(5, sText_Time, 0, 0x61, TEXT_SPEED_FF, 3); + + seconds = (sBerryBlenderData->gameFrameTime / 60) % 60; + minutes = (sBerryBlenderData->gameFrameTime / (60 * 60)); + + ConvertIntToDecimalStringN(sBerryBlenderData->stringVar, minutes, STR_CONV_MODE_LEADING_ZEROS, 2); + txtPtr = StringAppend(sBerryBlenderData->stringVar, sText_Min); + + ConvertIntToDecimalStringN(txtPtr, seconds, STR_CONV_MODE_LEADING_ZEROS, 2); + StringAppend(sBerryBlenderData->stringVar, sText_Sec); + + xPos = GetStringRightAlignXOffset(1, sBerryBlenderData->stringVar, 0xA8); + Blender_AddTextPrinter(5, sBerryBlenderData->stringVar, xPos, 0x61, TEXT_SPEED_FF, 3); + + sBerryBlenderData->framesToWait = 0; + sBerryBlenderData->mainState++; + + CopyWindowToVram(5, 2); + } + break; + case 4: + if (gMain.newKeys & A_BUTTON) + sBerryBlenderData->mainState++; + break; + case 5: + sub_8198070(5, 1); + + for (i = 0; i < BLENDER_MAX_PLAYERS; i++) + { + if (sBerryBlenderData->chosenItemId[i] != 0) + berryIds[i] = sBerryBlenderData->chosenItemId[i] - FIRST_BERRY_INDEX; + if (sBerryBlenderData->field_8E[i] != 0xFF) + { + PutWindowTilemap(i); + CopyWindowToVram(i, 3); + } + } + + sub_8081E20(); + + Blender_CalculatePokeblock(sBerryBlenderData->blendedBerries, &pokeblock, sBerryBlenderData->playersNo, flavours, sBerryBlenderData->max_RPM); + Blender_PrintMadePokeblockString(&pokeblock, sBerryBlenderData->stringVar); + TryAddContestLinkTvShow(&pokeblock, &sBerryBlenderData->tvBlender); + + CreateTask(sub_8083F3C, 6); + sub_80EECEC(); + + RemoveBagItem(gSpecialVar_ItemId, 1); + AddPokeblock(&pokeblock); + + sBerryBlenderData->textState = 0; + sBerryBlenderData->mainState++; + break; + case 6: + if (Blender_PrintText(&sBerryBlenderData->textState, sBerryBlenderData->stringVar, GetPlayerTextSpeed())) + { + TryUpdateBerryBlenderRecord(); + return TRUE; + } + break; + } + + return FALSE; +} + +static void Blender_PrintMadePokeblockString(struct Pokeblock *pokeblock, u8 *dst) +{ + u8 text[12]; + u8 flavourLvl, feel; + + dst[0] = EOS; + StringCopy(dst, gPokeblockNames[pokeblock->color]); + StringAppend(dst, sText_WasMade); + StringAppend(dst, sText_NewLine); + + flavourLvl = GetHighestPokeblocksFlavourLevel(pokeblock); + feel = GetPokeblocksFeel(pokeblock); + + StringAppend(dst, sText_TheLevelIs); + ConvertIntToDecimalStringN(text, flavourLvl, STR_CONV_MODE_LEFT_ALIGN, 3); + StringAppend(dst, text); + + StringAppend(dst, sText_TheFeelIs); + ConvertIntToDecimalStringN(text, feel, STR_CONV_MODE_LEFT_ALIGN, 3); + StringAppend(dst, text); + + StringAppend(dst, sText_Dot2); + StringAppend(dst, sText_NewParagraph); +} + +static void Blender_SortBasedOnPoints(u8 *places, u8 playersNum, u32 *scores) +{ + s32 i, j; + + for (i = 0; i < playersNum; i++) + { + for (j = 0; j < playersNum; j++) + { + if (scores[places[i]] > scores[places[j]]) + { + u8 temp = places[i]; + places[i] = places[j]; + places[j] = temp; + } + } + } +} + +static void Blender_SortScores(void) +{ + u8 playerId; + u8 i; + u8 places[BLENDER_MAX_PLAYERS]; + u32 points[BLENDER_MAX_PLAYERS]; + + for (i = 0; i < sBerryBlenderData->playersNo; i++) + places[i] = i; + for (i = 0; i < sBerryBlenderData->playersNo; i++) + { + points[i] = 1000000 * sBerryBlenderData->scores[i][BLENDER_SCORE_BEST]; + points[i] += 1000 * sBerryBlenderData->scores[i][BLENDER_SCORE_GOOD]; + points[i] += 1000 - sBerryBlenderData->scores[i][BLENDER_SCORE_MISS]; + } + Blender_SortBasedOnPoints(places, sBerryBlenderData->playersNo, points); + for (i = 0; i < sBerryBlenderData->playersNo; i++) + sBerryBlenderData->playerPlaces[i] = places[i]; + + if (gReceivedRemoteLinkPlayers == 0) + playerId = 0; + else + playerId = GetMultiplayerId(); + + for (i = 0; i < sBerryBlenderData->playersNo; i++) + { + if (sBerryBlenderData->playerPlaces[i] == playerId) + sBerryBlenderData->field_1A4 = i; + } +} + +static bool8 Blender_PrintBlendingRanking(void) +{ + u16 i; + s32 xPos, yPos; + + switch (sBerryBlenderData->mainState) + { + case 0: + sBerryBlenderData->mainState++; + sBerryBlenderData->framesToWait = 255; + break; + case 1: + sBerryBlenderData->framesToWait -= 10; + if (sBerryBlenderData->framesToWait < 0) + { + sBerryBlenderData->framesToWait = 0; + sBerryBlenderData->mainState++; + } + break; + case 2: + if (++sBerryBlenderData->framesToWait > 20) + { + sBerryBlenderData->framesToWait = 0; + sBerryBlenderData->mainState++; + } + break; + case 3: + SetWindowBorderStyle(5, 0, 1, 0xD); + xPos = GetStringCenterAlignXOffset(1, sText_Ranking, 0xA8); + Blender_AddTextPrinter(5, sText_Ranking, xPos, 1, TEXT_SPEED_FF, 0); + + sBerryBlenderData->scoreIconIds[BLENDER_SCORE_BEST] = CreateSprite(&sUnknown_08339B40, 128, 52, 0); + StartSpriteAnim(&gSprites[sBerryBlenderData->scoreIconIds[BLENDER_SCORE_BEST]], 3); + gSprites[sBerryBlenderData->scoreIconIds[BLENDER_SCORE_BEST]].callback = SpriteCallbackDummy; + + sBerryBlenderData->scoreIconIds[BLENDER_SCORE_GOOD] = CreateSprite(&sUnknown_08339B40, 160, 52, 0); + gSprites[sBerryBlenderData->scoreIconIds[BLENDER_SCORE_GOOD]].callback = SpriteCallbackDummy; + + sBerryBlenderData->scoreIconIds[BLENDER_SCORE_MISS] = CreateSprite(&sUnknown_08339B40, 192, 52, 0); + StartSpriteAnim(&gSprites[sBerryBlenderData->scoreIconIds[BLENDER_SCORE_MISS]], 1); + gSprites[sBerryBlenderData->scoreIconIds[BLENDER_SCORE_MISS]].callback = SpriteCallbackDummy; + + Blender_SortScores(); + + for (yPos = 0x29, i = 0; i < sBerryBlenderData->playersNo; yPos += 0x10, i++) + { + u8 place = sBerryBlenderData->playerPlaces[i]; + + ConvertIntToDecimalStringN(sBerryBlenderData->stringVar, i + 1, STR_CONV_MODE_LEFT_ALIGN, 1); + StringAppend(sBerryBlenderData->stringVar, sText_Dot); + StringAppend(sBerryBlenderData->stringVar, gText_Space); + StringAppend(sBerryBlenderData->stringVar, gLinkPlayers[place].name); + Blender_AddTextPrinter(5, sBerryBlenderData->stringVar, 0, yPos, TEXT_SPEED_FF, 3); + + ConvertIntToDecimalStringN(sBerryBlenderData->stringVar, sBerryBlenderData->scores[place][BLENDER_SCORE_BEST], STR_CONV_MODE_RIGHT_ALIGN, 3); + Blender_AddTextPrinter(5, sBerryBlenderData->stringVar, 0x4E, yPos, TEXT_SPEED_FF, 3); + + ConvertIntToDecimalStringN(sBerryBlenderData->stringVar, sBerryBlenderData->scores[place][BLENDER_SCORE_GOOD], STR_CONV_MODE_RIGHT_ALIGN, 3); + Blender_AddTextPrinter(5, sBerryBlenderData->stringVar, 0x6E, yPos, TEXT_SPEED_FF, 3); + + ConvertIntToDecimalStringN(sBerryBlenderData->stringVar, sBerryBlenderData->scores[place][BLENDER_SCORE_MISS], STR_CONV_MODE_RIGHT_ALIGN, 3); + Blender_AddTextPrinter(5, sBerryBlenderData->stringVar, 0x8E, yPos, TEXT_SPEED_FF, 3); + } + + PutWindowTilemap(5); + CopyWindowToVram(5, 3); + + sBerryBlenderData->framesToWait = 0; + sBerryBlenderData->mainState++; + break; + case 4: + if (++sBerryBlenderData->framesToWait > 20) + sBerryBlenderData->mainState++; + break; + case 5: + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + sBerryBlenderData->mainState++; + } + break; + case 6: + sBerryBlenderData->mainState = 0; + return TRUE; + } + + return FALSE; +} + +void ShowBerryBlenderRecordWindow(void) +{ + s32 i; + s32 xPos, yPos; + struct WindowTemplate winTemplate; + u8 text[32]; + + winTemplate = sBlenderRecordWindowTemplate; + gResultsWindowId = AddWindow(&winTemplate); + sub_81973FC(gResultsWindowId, 0); + FillWindowPixelBuffer(gResultsWindowId, 0x11); + + xPos = GetStringCenterAlignXOffset(1, gText_BlenderMaxSpeedRecord, 0x90); + PrintTextOnWindow(gResultsWindowId, 1, gText_BlenderMaxSpeedRecord, xPos, 1, 0, NULL); + PrintTextOnWindow(gResultsWindowId, 1, gText_234Players, 4, 0x29, 0, NULL); + + for (i = 0, yPos = 0x29; i < BLENDER_SCORES_NO; i++) + { + u8 *txtPtr; + u32 record; + + record = gSaveBlock1Ptr->berryBlenderRecords[i]; + + txtPtr = ConvertIntToDecimalStringN(text, record / 100, STR_CONV_MODE_RIGHT_ALIGN, 3); + txtPtr = StringAppend(txtPtr, sText_Dot); + txtPtr = ConvertIntToDecimalStringN(txtPtr, record % 100, STR_CONV_MODE_LEADING_ZEROS, 2); + txtPtr = StringAppend(txtPtr, sText_RPM); + + xPos = GetStringRightAlignXOffset(1, text, 0x8C); + PrintTextOnWindow(gResultsWindowId, 1, text, xPos, yPos + (i * 16), 0, NULL); + } + + PutWindowTilemap(gResultsWindowId); + CopyWindowToVram(gResultsWindowId, 3); +} + +static void sub_8083F3C(u8 taskId) +{ + if (gTasks[taskId].data[0] == 0) + { + PlayFanfare(BGM_FANFA1); + gTasks[taskId].data[0]++; + } + if (IsFanfareTaskInactive()) + { + PlayBGM(sBerryBlenderData->field_154); + DestroyTask(taskId); + } +} + +static bool32 TryAddContestLinkTvShow(struct Pokeblock *pokeblock, struct TvBlenderStruct *tvBlender) +{ + u8 flavourLevel = GetHighestPokeblocksFlavourLevel(pokeblock); + u16 sheen = (flavourLevel * 10) / GetPokeblocksFeel(pokeblock); + + tvBlender->pokeblockSheen = sheen; + tvBlender->pokeblockColor = pokeblock->color; + tvBlender->name[0] = EOS; + + if (gReceivedRemoteLinkPlayers != 0) + { + if (sBerryBlenderData->field_1A4 == 0 && sheen > 20) + { + StringCopy(tvBlender->name, gLinkPlayers[sBerryBlenderData->playerPlaces[sBerryBlenderData->playersNo - 1]].name); + tvBlender->pokeblockFlavour = GetPokeblocksFlavour(pokeblock); + if (Put3CheersForPokeblocksOnTheAir(tvBlender->name, tvBlender->pokeblockFlavour, + tvBlender->pokeblockColor, tvBlender->pokeblockSheen, + gLinkPlayers[sBerryBlenderData->playerPlaces[sBerryBlenderData->playersNo - 1]].language)) + { + return TRUE; + } + + return FALSE; + } + else if (sBerryBlenderData->field_1A4 == sBerryBlenderData->playersNo - 1 && sheen <= 20) + { + StringCopy(tvBlender->name, gLinkPlayers[sBerryBlenderData->playerPlaces[0]].name); + tvBlender->pokeblockFlavour = GetPokeblocksFlavour(pokeblock); + if (Put3CheersForPokeblocksOnTheAir(tvBlender->name, tvBlender->pokeblockFlavour, + tvBlender->pokeblockColor, tvBlender->pokeblockSheen, + gLinkPlayers[sBerryBlenderData->playerPlaces[0]].language)) + { + return TRUE; + } + + return FALSE; + } + } + + return FALSE; +} + +static void Blender_AddTextPrinter(u8 windowId, const u8 *string, u8 x, u8 y, s32 speed, s32 caseId) +{ + struct TextColor txtColor; + u32 letterSpacing = 0; + + switch (caseId) + { + case 0: + case 3: + txtColor.fgColor = 1; + txtColor.bgColor = 2; + txtColor.shadowColor = 3; + break; + case 1: + txtColor.fgColor = 0; + txtColor.bgColor = 2; + txtColor.shadowColor = 3; + break; + case 2: + txtColor.fgColor = 0; + txtColor.bgColor = 4; + txtColor.shadowColor = 5; + break; + } + + if (caseId != 3) + { + FillWindowPixelBuffer(windowId, txtColor.fgColor | (txtColor.fgColor << 4)); + } + + AddTextPrinterParametrized2(windowId, 1, x, y, letterSpacing, 1, &txtColor, speed, string); +} + +static bool32 Blender_PrintText(s16 *textState, const u8 *string, s32 textSpeed) +{ + switch (*textState) + { + case 0: + sub_8197B1C(4, FALSE, 0x14, 0xF); + Blender_AddTextPrinter(4, string, 0, 1, textSpeed, 0); + PutWindowTilemap(4); + CopyWindowToVram(4, 3); + (*textState)++; + break; + case 1: + if (!IsTextPrinterActive(4)) + { + *textState = 0; + return TRUE; + } + break; + } + + return FALSE; +} diff --git a/src/berry_fix_program.c b/src/berry_fix_program.c index eca20af9d5..bba39c3eb3 100644 --- a/src/berry_fix_program.c +++ b/src/berry_fix_program.c @@ -1,5 +1,3 @@ - -// Includes #include "global.h" #include "gpu_regs.h" #include "multiboot.h" @@ -10,6 +8,7 @@ #include "task.h" #include "unknown_task.h" #include "window.h" +#include "text.h" #include "menu.h" #include "m4a.h" diff --git a/src/clear_save_data_screen.c b/src/clear_save_data_screen.c index 3192e0e116..d5e173ee89 100755 --- a/src/clear_save_data_screen.c +++ b/src/clear_save_data_screen.c @@ -1,7 +1,7 @@ #include "global.h" #include "task.h" -#include "menu.h" #include "text.h" +#include "menu.h" #include "sound.h" #include "main.h" #include "save.h" diff --git a/src/decoration.c b/src/decoration.c index adcdc583b6..8093825f49 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -1,6 +1,7 @@ #include "global.h" #include "decompress.h" #include "malloc.h" +#include "text.h" #include "string_util.h" #include "international_string_util.h" #include "script.h" diff --git a/src/egg_hatch.c b/src/egg_hatch.c index a3f7c2ab07..d9d77d2e98 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -57,8 +57,6 @@ extern const u32 gUnknown_08331F60[]; // tilemap gameboy circle extern const u8 gText_HatchedFromEgg[]; extern const u8 gText_NickHatchPrompt[]; -extern u8* GetMonNick(struct Pokemon* mon, u8* dst); -extern u8* GetBoxMonNick(struct BoxPokemon* boxMon, u8* dst); extern u8 sav1_map_get_name(void); extern s8 sub_8198C58(void); extern void TVShowConvertInternationalString(u8* str1, u8* str2, u8); @@ -75,7 +73,6 @@ extern void play_some_sound(void); extern void copy_decompressed_tile_data_to_vram_autofree(u8 bg_id, const void* src, u16 size, u16 offset, u8 mode); extern void CreateYesNoMenu(const struct WindowTemplate*, u16, u8, u8); extern void DoNamingScreen(u8, const u8*, u16, u8, u32, MainCallback); -extern void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor* colors, s8 speed, u8 *str); extern u16 sub_80D22D0(void); extern u8 CountPartyAliveNonEggMonsExcept(u8); diff --git a/src/international_string_util.c b/src/international_string_util.c index 81985d614b..89b4a7a69c 100644 --- a/src/international_string_util.c +++ b/src/international_string_util.c @@ -1,6 +1,6 @@ #include "global.h" -#include "international_string_util.h" #include "text.h" +#include "international_string_util.h" extern s32 convert_pixel_width_to_tile_width(s32 a0); // script menu diff --git a/src/mail.c b/src/mail.c index 1ceb1be1aa..dddc06feb8 100644 --- a/src/mail.c +++ b/src/mail.c @@ -1,14 +1,12 @@ - -// Includes #include "global.h" #include "main.h" #include "overworld.h" #include "task.h" #include "unknown_task.h" #include "palette.h" +#include "text.h" #include "menu.h" #include "menu_helpers.h" -#include "text.h" #include "text_window.h" #include "string_util.h" #include "international_string_util.h" diff --git a/src/region_map.c b/src/region_map.c index da96475c0a..8c8f64df98 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -1,7 +1,6 @@ - -// Includes #include "global.h" #include "main.h" +#include "text.h" #include "menu.h" #include "malloc.h" #include "gpu_regs.h" @@ -17,7 +16,6 @@ #include "string_util.h" #include "international_string_util.h" #include "strings.h" -#include "text.h" #include "text_window.h" #include "songs.h" #include "m4a.h" diff --git a/src/save_failed_screen.c b/src/save_failed_screen.c index 3f49b89e6b..ef01f02932 100755 --- a/src/save_failed_screen.c +++ b/src/save_failed_screen.c @@ -13,8 +13,6 @@ #define MSG_WIN_TOP 12 #define CLOCK_WIN_TOP (MSG_WIN_TOP - 4) -extern void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, struct TextColor *color, s8 speed, u8 *str); - extern void (*gGameContinueCallback)(void); extern u32 gDamagedSaveSectors; diff --git a/src/text.c b/src/text.c index 8108a68675..7d688801c9 100644 --- a/src/text.c +++ b/src/text.c @@ -190,7 +190,7 @@ bool16 AddTextPrinter(struct TextSubPrinter *textSubPrinter, u8 speed, void (*ca gTempTextPrinter.japanese = 0; GenerateFontHalfRowLookupTable(textSubPrinter->fontColor_h, textSubPrinter->bgColor, textSubPrinter->shadowColor); - if (speed != 0xFF && speed != 0x0) + if (speed != TEXT_SPEED_FF && speed != 0x0) { --gTempTextPrinter.text_speed; gTextPrinters[textSubPrinter->windowId] = gTempTextPrinter; @@ -204,7 +204,7 @@ bool16 AddTextPrinter(struct TextSubPrinter *textSubPrinter, u8 speed, void (*ca break; } - if (speed != 0xFF) + if (speed != TEXT_SPEED_FF) CopyWindowToVram(gTempTextPrinter.subPrinter.windowId, 2); gTextPrinters[textSubPrinter->windowId].sub_union.sub.active = 0; } diff --git a/sym_ewram.txt b/sym_ewram.txt index 088ca27469..ce0e1055b1 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -570,18 +570,8 @@ gUnknown_0203229C: @ 203229C gUnknown_020322A0: @ 20322A0 .space 0x4 - -sBerryBlenderData: @ 20322A4 - .space 0x4 - -gUnknown_020322A8: @ 20322A8 - .space 0x14 - -gUnknown_020322BC: @ 20322BC - .space 0x14 - -gUnknown_020322D0: @ 20322D0 - .space 0x4 + + .include "src/berry_blender.o" gDifferentSaveFile: @ 20322D4 .space 0x1 @@ -1242,7 +1232,7 @@ gUnknown_0203AB6F: @ 203AB6F gUnknown_0203AB70: @ 203AB70 .space 0x4 -gUnknown_0203AB74: @ 203AB74 +gResultsWindowId: @ 203AB74 .space 0x4 gUnknown_0203AB78: @ 203AB78