start working on berry blender

This commit is contained in:
DizzyEggg 2017-11-18 16:11:34 +01:00
parent 3883c39991
commit 8fd3081306
37 changed files with 1229 additions and 1870 deletions

View File

@ -14531,7 +14531,7 @@ sub_81965D8: @ 81965D8
negs r0, r0
ands r0, r1
strb r0, [r2]
bl sav2_get_text_speed
bl GetPlayerTextSpeed
adds r1, r0, 0
lsls r1, 24
lsrs r1, 24

File diff suppressed because it is too large Load Diff

View File

@ -244,7 +244,7 @@ sub_80B252C: @ 80B252C
lsrs r1, r0, 24
cmp r1, 0
bne _080B2570
ldr r0, =gUnknown_020229C6
ldr r0, =gLinkType
strh r1, [r0]
ldr r1, =gTasks
lsls r0, r4, 2
@ -286,7 +286,7 @@ _080B258E:
b _080B25BA
.pool
_080B25A4:
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
movs r0, 0
strh r0, [r1]
ldr r1, =gTasks
@ -743,7 +743,7 @@ _080B2994:
strb r0, [r1]
ldrb r0, [r4]
bl sub_800AA04
ldr r4, =gUnknown_020228C4
ldr r4, =gBlockSendBuffer
adds r0, r4, 0
bl sub_80C30A4
ldr r0, =gUnknown_0203CEF8
@ -833,7 +833,7 @@ _080B2A6C:
strb r0, [r1]
ldrb r0, [r4]
bl sub_800AA04
ldr r4, =gUnknown_020228C4
ldr r4, =gBlockSendBuffer
adds r0, r4, 0
bl sub_80C30A4
ldr r0, =gUnknown_0203CEF8
@ -964,7 +964,7 @@ task_map_chg_seq_0807EC34: @ 80B2B94
ldrh r0, [r5]
cmp r0, 0x1
bne _080B2C10
ldr r0, =gUnknown_020229C6
ldr r0, =gLinkType
ldrh r2, [r0]
ldr r0, =0x00002266
cmp r2, r0
@ -1215,20 +1215,20 @@ _080B2DC0:
b _080B2E34
_080B2DCA:
movs r3, 0x2
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r4, =0x00002233
b _080B2E30
.pool
_080B2DDC:
movs r3, 0x2
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r4, =0x00002244
b _080B2E30
.pool
_080B2DEC:
movs r3, 0x4
movs r2, 0x4
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r4, =0x00002255
b _080B2E30
.pool
@ -1243,12 +1243,12 @@ _080B2E00:
ands r0, r1
cmp r0, 0
bne _080B2E2C
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r4, =0x00002266
b _080B2E30
.pool
_080B2E2C:
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r4, =0x00002277
_080B2E30:
adds r0, r4, 0
@ -1266,7 +1266,7 @@ _080B2E34:
thumb_func_start sub_80B2E4C
sub_80B2E4C: @ 80B2E4C
push {lr}
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00001133
adds r0, r2, 0
strh r0, [r1]
@ -1287,7 +1287,7 @@ sub_80B2E74: @ 80B2E74
ldr r1, =gSpecialVar_Result
movs r0, 0
strh r0, [r1]
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00003311
adds r0, r2, 0
strh r0, [r1]
@ -1454,7 +1454,7 @@ _080B2FC6:
thumb_func_start sub_80B2FD8
sub_80B2FD8: @ 80B2FD8
push {lr}
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00004411
adds r0, r2, 0
strh r0, [r1]
@ -1472,7 +1472,7 @@ sub_80B2FD8: @ 80B2FD8
thumb_func_start sub_80B3000
sub_80B3000: @ 80B3000
push {lr}
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00006601
adds r0, r2, 0
strh r0, [r1]
@ -1490,7 +1490,7 @@ sub_80B3000: @ 80B3000
thumb_func_start sub_80B3028
sub_80B3028: @ 80B3028
push {lr}
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00006602
adds r0, r2, 0
strh r0, [r1]
@ -1540,17 +1540,17 @@ _080B3084:
.4byte _080B3128
.4byte _080B30D8
_080B30A8:
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00002233
b _080B3124
.pool
_080B30B8:
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00002244
b _080B3124
.pool
_080B30C8:
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00002255
b _080B3124
.pool
@ -1564,22 +1564,22 @@ _080B30D8:
ands r0, r1
cmp r0, 0
bne _080B3100
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00002266
b _080B3124
.pool
_080B3100:
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00002277
b _080B3124
.pool
_080B3110:
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00001111
b _080B3124
.pool
_080B3120:
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00003322
_080B3124:
adds r0, r2, 0
@ -1809,7 +1809,7 @@ _080B32F8:
movs r0, 0x1
movs r1, 0
bl fade_screen
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00002211
adds r0, r2, 0
strh r0, [r1]
@ -1922,7 +1922,7 @@ _080B3408:
movs r0, 0x1
movs r1, 0
bl fade_screen
ldr r0, =gUnknown_020229C6
ldr r0, =gLinkType
ldr r2, =0x00002211
adds r1, r2, 0
strh r1, [r0]
@ -2548,7 +2548,7 @@ nullsub_37: @ 80B3964
thumb_func_start sub_80B3968
sub_80B3968: @ 80B3968
push {lr}
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00002211
adds r0, r2, 0
strh r0, [r1]
@ -2829,7 +2829,7 @@ sub_80B3BC4: @ 80B3BC4
ldrb r0, [r0]
cmp r0, 0
bne _080B3BD6
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00002288
adds r0, r2, 0
strh r0, [r1]

View File

@ -14067,7 +14067,7 @@ _080DEC80:
b _080DEC9C
.pool
_080DEC94:
bl sav2_get_text_speed
bl GetPlayerTextSpeed
lsls r0, 24
lsrs r1, r0, 24
_080DEC9C:

View File

@ -284,7 +284,7 @@ _080FC6FE:
lsls r0, 24
cmp r0, 0
beq _080FC7F4
ldr r0, =gUnknown_020228C4
ldr r0, =gBlockSendBuffer
ldr r1, =gUnknown_02039F25
ldrb r1, [r1]
lsls r1, 6
@ -297,7 +297,7 @@ _080FC6FE:
b _080FC7F4
.pool
_080FC738:
ldr r0, =gUnknown_020228C4
ldr r0, =gBlockSendBuffer
ldr r1, =gUnknown_02039F25
ldrb r1, [r1]
lsls r1, 6
@ -487,7 +487,7 @@ _080FC8D8:
beq _080FC954
b _080FC96E
_080FC8DE:
ldr r1, =gUnknown_020228C4
ldr r1, =gBlockSendBuffer
ldrh r0, [r4, 0x1A]
strb r0, [r1]
bl GetMultiplayerId
@ -1142,7 +1142,7 @@ _080FCE8C:
beq _080FCEFC
b _080FCF16
_080FCE92:
ldr r1, =gUnknown_020228C4
ldr r1, =gBlockSendBuffer
movs r0, 0x6E
strb r0, [r1]
bl GetMultiplayerId

View File

@ -1863,7 +1863,7 @@ DisplayItemMessage: @ 81ABB4C
strh r0, [r4, 0x14]
movs r1, 0x11
bl FillWindowPixelBuffer
bl sav2_get_text_speed
bl GetPlayerTextSpeed
lsls r0, 24
lsrs r0, 24
ldrb r1, [r4, 0x14]

View File

@ -206,7 +206,7 @@ sub_8009570: @ 8009570
ldr r0, =sub_80096BC
bl SetVBlankCallback
bl sub_800A2E0
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00001111
adds r0, r2, 0
strh r0, [r1]
@ -291,7 +291,7 @@ sub_8009638: @ 8009638
ldr r0, [r4]
ldrb r0, [r0, 0x8]
strb r0, [r5, 0x13]
ldr r0, =gUnknown_020229C6
ldr r0, =gLinkType
ldrh r0, [r0]
str r0, [r5, 0x14]
ldr r0, =gGameLanguage
@ -1185,7 +1185,7 @@ _08009E2C:
_08009E38:
ldr r0, =gUnknown_03003110
strh r2, [r0]
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldrh r1, [r1]
b _08009F04
.pool
@ -1814,7 +1814,7 @@ _0800A30C:
str r7, [r4, 0x4]
b _0800A336
_0800A324:
ldr r5, =gUnknown_020228C4
ldr r5, =gBlockSendBuffer
cmp r7, r5
beq _0800A334
adds r0, r5, 0
@ -2772,7 +2772,7 @@ sub_800AA60: @ 800AA60
ldr r0, =gUnknown_02022A74
ldr r2, =0x00002288
mov r8, r2
ldr r7, =gUnknown_020229C6
ldr r7, =gLinkType
mov r6, r12
adds r6, 0x14
adds r5, r0, 0x4
@ -3798,7 +3798,7 @@ sub_800B348: @ 800B348
strh r2, [r0]
ldrb r2, [r3, 0x2]
strb r2, [r0, 0x2]
ldr r0, =gUnknown_020228C4
ldr r0, =gBlockSendBuffer
movs r2, 0x3C
bl memcpy
pop {r4-r6}
@ -10306,7 +10306,7 @@ sub_800E700: @ 800E700
lsrs r1, r0, 16
cmp r1, 0
bne _0800E732
ldr r0, =gUnknown_020229C6
ldr r0, =gLinkType
strh r1, [r0]
bl sub_800AAF4
movs r0, 0
@ -13149,7 +13149,7 @@ _0800FEC8:
str r7, [r5, 0x70]
b _0800FF1C
_0800FF0A:
ldr r4, =gUnknown_020228C4
ldr r4, =gBlockSendBuffer
cmp r7, r4
beq _0800FF1A
adds r0, r4, 0
@ -14734,7 +14734,7 @@ _08010B8C:
b _08010C4A
.pool
_08010BC0:
ldr r5, =gUnknown_020228C4
ldr r5, =gBlockSendBuffer
adds r1, r5, 0
ldr r0, =gUnknown_082ED7EC
ldm r0!, {r2-r4}
@ -14772,7 +14772,7 @@ _08010BE2:
adds r0, 0x1
strh r0, [r1, 0x8]
_08010C0A:
ldr r5, =gUnknown_020228C4
ldr r5, =gBlockSendBuffer
ldr r1, =gUnknown_03005000
ldrb r0, [r1, 0xD]
strb r0, [r5, 0xF]
@ -14796,7 +14796,7 @@ _08010C20:
mov r1, r12
movs r2, 0x8C
bl memcpy
ldr r1, =gUnknown_020228C4
ldr r1, =gBlockSendBuffer
movs r0, 0
movs r2, 0xA0
bl SendBlock
@ -14921,7 +14921,7 @@ _08010D56:
cmp r0, 0
beq _08010DA6
bl sub_800B348
ldr r1, =gUnknown_020228C4
ldr r1, =gBlockSendBuffer
movs r0, 0
movs r2, 0x3C
bl SendBlock
@ -16608,7 +16608,7 @@ sub_8011AFC: @ 8011AFC
lsls r0, 24
cmp r0, 0
beq _08011B70
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00001111
adds r0, r2, 0
strh r0, [r1]
@ -20832,7 +20832,7 @@ _08013FFC:
b _0801405A
.pool
_08014038:
ldr r4, =gUnknown_020228C4
ldr r4, =gBlockSendBuffer
ldr r0, =gSaveBlock1Ptr
ldr r1, [r0]
ldr r0, =0x00002be0
@ -21403,7 +21403,7 @@ _080145D8:
.pool
_080145F4:
bl overworld_free_bg_tilemaps
ldr r0, =gUnknown_020228C4
ldr r0, =gBlockSendBuffer
movs r1, 0x1
bl sub_80143E4
bl sp000_heal_pokemon
@ -21422,7 +21422,7 @@ _08014620:
bl sp000_heal_pokemon
bl copy_player_party_to_sav1
bl copy_bags_and_unk_data_from_save_blocks
ldr r0, =gUnknown_020228C4
ldr r0, =gBlockSendBuffer
movs r1, 0x1
bl sub_80143E4
movs r0, 0x2
@ -21438,7 +21438,7 @@ _0801464C:
bl sp000_heal_pokemon
bl copy_player_party_to_sav1
bl copy_bags_and_unk_data_from_save_blocks
ldr r0, =gUnknown_020228C4
ldr r0, =gBlockSendBuffer
movs r1, 0x1
bl sub_80143E4
movs r0, 0x5
@ -21450,7 +21450,7 @@ _0801464C:
b _080146B0
.pool
_08014678:
ldr r0, =gUnknown_020228C4
ldr r0, =gBlockSendBuffer
movs r1, 0x1
bl sub_80143E4
bl overworld_free_bg_tilemaps
@ -21463,7 +21463,7 @@ _08014678:
b _080146B0
.pool
_08014698:
ldr r0, =gUnknown_020228C4
ldr r0, =gBlockSendBuffer
movs r1, 0x1
bl sub_80143E4
bl overworld_free_bg_tilemaps
@ -21503,7 +21503,7 @@ _080146F6:
bl sub_801DD98
b _08014764
_080146FC:
ldr r0, =gUnknown_020228C4
ldr r0, =gBlockSendBuffer
movs r1, 0
bl sub_80143E4
ldr r0, =sub_80141A4
@ -21573,7 +21573,7 @@ sub_8014790: @ 8014790
lsls r0, 3
ldr r1, =gTasks + 0x8
adds r7, r0, r1
ldr r0, =gUnknown_020228C4
ldr r0, =gBlockSendBuffer
mov r9, r0
movs r1, 0
ldrsh r0, [r7, r1]
@ -23720,7 +23720,7 @@ _08015BBE:
bne _08015BCA
bl _08016878
_08015BCA:
ldr r0, =gUnknown_020228C4
ldr r0, =gBlockSendBuffer
movs r1, 0x1
bl sub_80143E4
ldr r0, =sub_80140E0
@ -24247,7 +24247,7 @@ _080160DA:
bne _080160E4
b _08016878
_080160E4:
ldr r0, =gUnknown_020228C4
ldr r0, =gBlockSendBuffer
movs r1, 0x1
bl sub_80143E4
ldr r0, =sub_80140E0
@ -33721,7 +33721,7 @@ _0801AE48:
beq _0801AE54
b _0801AFAE
_0801AE54:
ldr r4, =gUnknown_020228C4
ldr r4, =gBlockSendBuffer
adds r0, r4, 0
movs r1, 0
movs r2, 0x20
@ -33738,7 +33738,7 @@ _0801AE78:
movs r0, 0x51
_0801AE7A:
strb r0, [r4]
ldr r1, =gUnknown_020228C4
ldr r1, =gBlockSendBuffer
movs r0, 0
movs r2, 0x20
bl SendBlock

View File

@ -22,7 +22,7 @@ AddTextPrinterWithCallbackForMessage: @ 8197A9C
ands r1, r2
orrs r1, r0
strb r1, [r3]
bl sav2_get_text_speed
bl GetPlayerTextSpeed
adds r3, r0, 0
lsls r3, 24
lsrs r3, 24

View File

@ -232,7 +232,7 @@ _08178B56:
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00005501
adds r0, r2, 0
strh r0, [r1]

View File

@ -904,7 +904,7 @@ _080E3586:
movs r1, 0x1
orrs r0, r1
strb r0, [r2]
bl sav2_get_text_speed
bl GetPlayerTextSpeed
adds r3, r0, 0
lsls r3, 24
lsrs r3, 24

View File

@ -185,7 +185,7 @@ AddTextPrinterForMessage: @ 81972C4
ands r1, r2
orrs r1, r0
strb r1, [r3]
bl sav2_get_text_speed
bl GetPlayerTextSpeed
adds r3, r0, 0
lsls r3, 24
lsrs r3, 24
@ -222,7 +222,7 @@ AddTextPrinterForMessage_2: @ 8197310
ands r1, r2
orrs r1, r0
strb r1, [r3]
bl sav2_get_text_speed
bl GetPlayerTextSpeed
adds r3, r0, 0
lsls r3, 24
lsrs r3, 24
@ -945,7 +945,7 @@ DisplayItemMessageOnField: @ 81978EC
lsls r4, 24
lsrs r4, 24
bl sub_81973A4
bl sav2_get_text_speed
bl GetPlayerTextSpeed
lsls r0, 24
lsrs r0, 24
movs r2, 0x80
@ -1021,8 +1021,8 @@ _0819798A:
bx r1
thumb_func_end sub_8197964
thumb_func_start sav2_get_text_speed
sav2_get_text_speed: @ 8197990
thumb_func_start GetPlayerTextSpeed
GetPlayerTextSpeed: @ 8197990
push {lr}
ldr r0, =gSaveBlock2Ptr
ldr r2, [r0]
@ -1045,7 +1045,7 @@ _081979AC:
pop {r1}
bx r1
.pool
thumb_func_end sav2_get_text_speed
thumb_func_end GetPlayerTextSpeed
thumb_func_start sub_81979C4
sub_81979C4: @ 81979C4

View File

@ -5992,7 +5992,7 @@ sub_81B3300: @ 81B3300
movs r1, 0x1
orrs r0, r1
strb r0, [r2]
bl sav2_get_text_speed
bl GetPlayerTextSpeed
adds r3, r0, 0
lsls r3, 24
lsrs r3, 24

View File

@ -740,7 +740,7 @@ _0817A268:
movs r1, 0x1
orrs r0, r1
strb r0, [r2]
bl sav2_get_text_speed
bl GetPlayerTextSpeed
adds r3, r0, 0
lsls r3, 24
lsrs r3, 24

View File

@ -5547,7 +5547,7 @@ DisplayItemMessageInBattlePyramid: @ 81C6DD8
movs r0, 0x2
movs r1, 0x11
bl FillWindowPixelBuffer
bl sav2_get_text_speed
bl GetPlayerTextSpeed
lsls r0, 24
lsrs r0, 24
movs r1, 0x1

View File

@ -10207,7 +10207,7 @@ sub_81CC158: @ 81CC158
adds r1, 0xF
bl sub_81CAF78
adds r5, r0, 0
bl sav2_get_text_speed
bl GetPlayerTextSpeed
lsls r0, 24
lsrs r0, 24
ldrb r2, [r4, 0x14]
@ -23751,7 +23751,7 @@ sub_81D2BF4: @ 81D2BF4
movs r1, 0x1
orrs r0, r1
strb r0, [r2]
bl sav2_get_text_speed
bl GetPlayerTextSpeed
adds r3, r0, 0
lsls r3, 24
lsrs r3, 24
@ -28068,7 +28068,7 @@ sub_81D4E30: @ 81D4E30
lsls r2, 6
movs r1, 0
bl memset
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00005503
adds r0, r2, 0
strh r0, [r1]

View File

@ -993,7 +993,7 @@ _080E75AC:
movs r0, 0xC8
muls r0, r2
adds r1, r0
ldr r0, =gUnknown_020228C4
ldr r0, =gBlockSendBuffer
movs r2, 0xC8
bl memcpy
b _080E75FC

View File

@ -2601,7 +2601,7 @@ sub_8136AB4: @ 8136AB4
ldr r1, =gText_ThrowAwayVar1
adds r0, r5, 0
bl StringExpandPlaceholders
bl sav2_get_text_speed
bl GetPlayerTextSpeed
lsls r0, 24
lsrs r0, 24
movs r1, 0x1
@ -2657,7 +2657,7 @@ sub_8136B78: @ 8136B78
ldr r1, =gText_Var1ThrownAway
adds r0, r5, 0
bl StringExpandPlaceholders
bl sav2_get_text_speed
bl GetPlayerTextSpeed
lsls r0, 24
lsrs r0, 24
movs r1, 0x1

View File

@ -1219,7 +1219,7 @@ BuyMenuDisplayMessage: @ 80E04E8
adds r6, r2, 0
lsls r4, 24
lsrs r4, 24
bl sav2_get_text_speed
bl GetPlayerTextSpeed
lsls r0, 24
lsrs r0, 24
movs r1, 0x1

View File

@ -401,7 +401,7 @@ _080774B2:
ldrb r2, [r0]
cmp r2, 0
bne _0807754C
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r5, =0x00001122
adds r0, r5, 0
strh r0, [r1]
@ -2142,7 +2142,7 @@ _08078484:
.4byte _080786F0
.4byte _08078720
_080784DC:
ldr r0, =gUnknown_020228C4
ldr r0, =gBlockSendBuffer
ldr r1, =gPlayerParty
movs r2, 0xC8
bl sub_8078438
@ -2208,7 +2208,7 @@ _08078552:
b _080787A2
.pool
_0807857C:
ldr r0, =gUnknown_020228C4
ldr r0, =gBlockSendBuffer
ldr r1, =gPlayerParty + 200
movs r2, 0xC8
bl sub_8078438
@ -2247,7 +2247,7 @@ _080785B6:
b _080787A2
.pool
_080785E0:
ldr r0, =gUnknown_020228C4
ldr r0, =gBlockSendBuffer
ldr r1, =gPlayerParty + 400
movs r2, 0xC8
bl sub_8078438
@ -2286,7 +2286,7 @@ _0807861A:
b _080787A2
.pool
_08078644:
ldr r0, =gUnknown_020228C4
ldr r0, =gBlockSendBuffer
ldr r1, =gSaveBlock1Ptr
ldr r1, [r1]
ldr r2, =0x00002be0
@ -2328,7 +2328,7 @@ _0807868A:
b _080787A2
.pool
_080786B4:
ldr r0, =gUnknown_020228C4
ldr r0, =gBlockSendBuffer
ldr r1, =gSaveBlock1Ptr
ldr r1, [r1]
ldr r2, =0x000031a8
@ -7258,7 +7258,7 @@ _0807AEAC:
ldrb r0, [r0]
cmp r0, 0
bne _0807AEC0
ldr r1, =gUnknown_020229C6
ldr r1, =gLinkType
ldr r2, =0x00001144
adds r0, r2, 0
strh r0, [r1]

View File

@ -682,7 +682,7 @@ gMonIcon_Egg:: @ 8D8FC74
.incbin "baserom.gba", 0xd90074, 0x1524
gUnknown_08D91598:: @ 8D91598
sBlenderCenterGfx:: @ 8D91598
.incbin "baserom.gba", 0xd91598, 0x820
gUnknown_08D91DB8:: @ 8D91DB8

View File

@ -28,15 +28,15 @@ g2BlankTilesGfx:: @ 82ED168
.incbin "graphics/interface/blank_1x2.4bpp"
gUnknown_082ED1A8:: @ 82ED1A8
.4byte gUnknown_020228C4
.4byte gBlockSendBuffer
.4byte 0x000000C8
.4byte gUnknown_020228C4
.4byte gBlockSendBuffer
.4byte 0x000000C8
.4byte gUnknown_020228C4
.4byte gBlockSendBuffer
.4byte 0x00000064
.4byte gUnknown_020228C4
.4byte gBlockSendBuffer
.4byte 0x000000DC
.4byte gUnknown_020228C4
.4byte gBlockSendBuffer
.4byte 0x00000028
gUnknown_082ED1D0:: @ 82ED1D0
@ -224,15 +224,15 @@ gUnknown_082ED6A5:: @ 82ED6A5
.align 2
gUnknown_082ED6B8:: @ 82ED6B8
.4byte gUnknown_020228C4
.4byte gBlockSendBuffer
.4byte 0x000000c8
.4byte gUnknown_020228C4
.4byte gBlockSendBuffer
.4byte 0x000000c8
.4byte gUnknown_020228C4
.4byte gBlockSendBuffer
.4byte 0x00000064
.4byte gUnknown_020228C4
.4byte gBlockSendBuffer
.4byte 0x000000dc
.4byte gUnknown_020228C4
.4byte gBlockSendBuffer
.4byte 0x00000028
.align 2

View File

@ -303,7 +303,7 @@ LilycoveCity_ContestLobby_EventScript_293CEE:: @ 8293CEE
LilycoveCity_ContestLobby_EventScript_293D2C:: @ 8293D2C
copyvar VAR_0x8004, VAR_0x8009
fadescreen 1
special sub_807FA80
special DoBerryBlending
waitstate
releaseall
end
@ -635,7 +635,7 @@ LilycoveCity_ContestLobby_EventScript_294147:: @ 8294147
removeobject 239
removeobject 238
removeobject 237
special sub_807FA80
special DoBerryBlending
waitstate
releaseall
end

View File

@ -171,7 +171,7 @@ gSpecials:: @ 81DBA64
def_special ChangePokemonNickname
def_special sub_81B94B0
def_special sub_8136EF4
def_special sub_807FA80
def_special DoBerryBlending
def_special sub_8142BC8
def_special sub_813BD60
def_special sub_813BCA8

View File

@ -11,6 +11,16 @@ enum
BERRY_FIRMNESS_SUPER_HARD,
};
enum
{
FLAVOUR_SPICY,
FLAVOUR_DRY,
FLAVOUR_SWEET,
FLAVOUR_BITTER,
FLAVOUR_SOUR,
FLAVOUR_COUNT
};
#define NUM_BERRIES 44
extern const u8 *const gBerryTreeFieldObjectGraphicsIdTablePointers[NUM_BERRIES];

View File

@ -28,4 +28,6 @@ void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32
void LoadSpecialPokePic_2(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic);
void LoadSpecialPokePic_DontHandleDeoxys(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic);
u32 sub_8034974(const u8 *ptr);
#endif // GUARD_DECOMPRESS_H

View File

@ -2,6 +2,7 @@
#define GUARD_FLAGS_H
#define FLAG_PENDING_DAYCARE_EGG 0x86
#define FLAG_340 0x340
#define FLAG_TRAINER_FLAG_START 0x500

View File

@ -406,7 +406,7 @@ void m4aSoundVSyncOff(void);
void m4aMPlayTempoControl(struct MusicPlayerInfo *mplayInfo, u16 tempo);
void m4aMPlayVolumeControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u16 volume);
void m4aMPlayPitchControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u16 pitch);
void m4aMPlayPitchControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, s16 pitch);
void m4aMPlayPanpotControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, s8 pan);
void ClearModM(struct MusicPlayerTrack *track);
void m4aMPlayModDepthSet(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u8 modDepth);

View File

@ -0,0 +1,6 @@
#ifndef GUARD_ITEM_MENU_ICONS
#define GUARD_ITEM_MENU_ICONS
u8 sub_80D511C(u8 a0, u8 a1, u8 a2, u8 a3);
#endif // GUARD_ITEM_MENU_ICONS

View File

@ -386,6 +386,10 @@ enum
ITEM_OLD_SEA_MAP, // 0x178
};
#define FIRST_BERRY_INDEX ITEM_CHERI_BERRY
#define LAST_BERRY_INDEX ITEM_ENIGMA_BERRY
#define ITEM_TO_BERRY(itemId)(((itemId - FIRST_BERRY_INDEX) + 1))
#define NUM_TECHNICAL_MACHINES 50
#define NUM_HIDDEN_MACHINES 8

View File

@ -13,5 +13,6 @@ void DisplayItemMessageOnField(u8 taskId, const u8 *src, TaskFunc callback);
void sub_8197434(u8 a0, u8 a1);
void SetStandardWindowBorderStyle(u8 a0, u8 a1);
void sub_8197930(void);
u8 GetPlayerTextSpeed(void);
#endif // GUARD_NEW_MENU_HELPERS_H

View File

@ -59,7 +59,7 @@ extern const u8* GetTrainer2LoseText(void); // battle_setup
extern void GetFrontierTrainerName(u8 *dst, u16 trainerId);
extern s32 GetStringCenterAlignXOffsetWithLetterSpacing(u8 fontId, const u8 *str, s32 totalWidth, s16 letterSpacing);
extern u8 sub_8185FC4(void);
extern u8 sav2_get_text_speed(void);
extern u8 GetPlayerTextSpeed(void);
// this file's functions
static void sub_814F8F8(u8 *textPtr);
@ -2266,7 +2266,7 @@ void BattleHandleAddTextPrinter(const u8 *text, u8 arg1)
else if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
speed = sRecordedBattleTextSpeeds[sub_8185FC4()];
else
speed = sav2_get_text_speed();
speed = GetPlayerTextSpeed();
gTextFlags.flag_0 = 1;
}

View File

@ -18,12 +18,6 @@ extern u16 gSpecialVar_ItemId;
extern const u8 BerryTreeScript[];
#define BERRY_NAME_LENGTH 6
#define FIRST_BERRY ITEM_CHERI_BERRY
#define LAST_BERRY ITEM_ENIGMA_BERRY
static const u8 sBerryDescriptionPart1_Cheri[] = _("Blooms with delicate pretty flowers.");
static const u8 sBerryDescriptionPart2_Cheri[] = _("The bright red BERRY is very spicy.");
static const u8 sBerryDescriptionPart1_Chesto[] = _("The BERRYs thick skin and fruit are");
@ -1062,28 +1056,28 @@ u8 GetStageByBerryTreeId(u8 id)
u8 ItemIdToBerryType(u16 item)
{
u16 berry = item - FIRST_BERRY;
u16 berry = item - FIRST_BERRY_INDEX;
if (berry > LAST_BERRY - FIRST_BERRY)
if (berry > LAST_BERRY_INDEX - FIRST_BERRY_INDEX)
return 1;
else
return item - FIRST_BERRY + 1;
return ITEM_TO_BERRY(item);
}
u16 BerryTypeToItemId(u16 berry)
{
u16 item = berry - 1;
if (item > LAST_BERRY - FIRST_BERRY)
return FIRST_BERRY;
if (item > LAST_BERRY_INDEX - FIRST_BERRY_INDEX)
return FIRST_BERRY_INDEX;
else
return berry + FIRST_BERRY - 1;
return berry + FIRST_BERRY_INDEX - 1;
}
void GetBerryNameByBerryType(u8 berry, u8 *string)
{
memcpy(string, GetBerryInfo(berry)->name, BERRY_NAME_LENGTH);
string[BERRY_NAME_LENGTH] = EOS;
memcpy(string, GetBerryInfo(berry)->name, BERRY_NAME_COUNT - 1);
string[BERRY_NAME_COUNT - 1] = EOS;
}
void GetBerryCountStringByBerryType(u8 berry, u8* dest, u32 berryCount)

View File

@ -3,15 +3,370 @@
#include "window.h"
#include "task.h"
#include "sprite.h"
#include "sound.h"
#include "songs.h"
#include "m4a.h"
#include "bg.h"
#include "palette.h"
#include "decompress.h"
#include "malloc.h"
#include "gpu_regs.h"
#include "text.h"
#include "event_data.h"
#include "main.h"
#include "link.h"
#include "new_menu_helpers.h"
#include "item_menu_icons.h"
#include "berry.h"
#include "items.h"
#include "string_util.h"
// Static type declarations
#define BLENDER_SCORE_BEST 0
#define BLENDER_SCORE_GOOD 1
#define BLENDER_SCORE_MISS 2
// 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;
#define BLENDER_MAX_PLAYERS 4
#define BLENDER_SCORES_NO 3
struct BlenderBerry
{
u16 itemId;
u8 name[BERRY_NAME_COUNT];
u8 flavours[FLAVOUR_COUNT];
u8 smoothness;
};
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 field_44;
u8 field_45;
u8 field_46;
u8 field_47;
u8 field_48;
u8 field_49;
u16 arrowPos;
s16 field_4C;
s16 field_4E;
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;
u16 field_64[BLENDER_MAX_PLAYERS];
u8 field_6C;
u8 field_6D;
u8 field_6E;
u8 field_6F;
u16 field_70;
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 field_8E;
u8 field_8F;
u8 field_90;
u8 field_91;
u8 field_92;
u8 field_93;
u8 field_94;
u8 field_95;
u8 field_96;
u8 field_97;
u8 field_98;
u8 field_99;
u8 field_9A;
u8 field_9B;
u8 field_9C;
u8 field_9D;
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;
u32 gameFrameTime;
s32 framesToWait;
u32 field_10C;
u8 field_110;
u8 field_111;
u8 field_112;
u8 field_113;
u8 field_114;
u8 field_115;
u16 field_116;
u16 field_118;
u16 field_11A;
s16 field_11C;
s16 field_11E;
u8 field_120;
u8 field_121;
u8 field_122;
u8 field_123;
u16 scores[BLENDER_MAX_PLAYERS][BLENDER_SCORES_NO];
u8 field_13C;
u8 field_13D;
u8 field_13E;
u8 field_13F;
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;
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;
u8 tilemapBuffers[2][0x800];
s16 textState;
void *tilesBuffer;
u8 field_11C0[0x20];
};
extern struct MusicPlayerInfo gMPlay_SE2;
extern struct MusicPlayerInfo gMPlay_BGM;
extern u16 gSpecialVar_ItemId;
extern u8 gInGameOpponentsNo;
// graphics
extern const u8 gBerryBlenderArrowTiles[];
@ -22,6 +377,20 @@ extern const u8 gBerryBlenderCountdownNumbersTiles[];
extern const u16 gBerryBlenderMiscPalette[];
extern const u16 gBerryBlenderArrowPalette[];
// text
extern const u8 gText_BerryBlenderStart[];
extern void sub_81978B0(u16);
extern void sub_800A418(void);
extern u8 sub_800A9D8(void);
extern bool8 sub_800A4D8(u8);
extern void sub_8197DF8(u8 windowId, bool8 copyToVram);
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));
// this file's functions
void BerryBlender_SetGpuRegs(void);
void sub_8080EA4(u8 taskId);
void sub_8080FD0(u8 taskId);
void sub_80810F8(u8 taskId);
@ -29,8 +398,30 @@ 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 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 sub_80807BC(void);
void sub_8080588(void);
extern struct BerryBlenderData *sBerryBlenderData;
// 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;
// .rodata
// 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");
@ -67,6 +458,16 @@ const u8* const sBlenderOpponentsNames[] =
sText_Miss
};
enum
{
BLENDER_MISTER,
BLENDER_LADDIE,
BLENDER_LASSIE,
BLENDER_MASTER,
BLENDER_DUDE,
BLENDER_MISS
};
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…");
@ -91,7 +492,7 @@ const u8 sText_TheLevelIs[] = _("The level is ");
const u8 sText_TheFeelIs[] = _(", and the feel is ");
const u8 sText_Dot2[] = _(".");
const struct BgTemplate gUnknown_08339974[3] =
const struct BgTemplate sBerryBlenderBgTemplates[3] =
{
{
.bg = 0,
@ -122,7 +523,7 @@ const struct BgTemplate gUnknown_08339974[3] =
}
};
const struct WindowTemplate gUnknown_08339980[] =
static const struct WindowTemplate sBerryBlender_WindowTemplates[] =
{
{0, 1, 6, 7, 2, 0xE, 0x28},
{0, 0x16, 6, 7, 2, 0xE, 0x36},
@ -143,7 +544,7 @@ const s8 gUnknown_083399C0[][2] =
{-1, -1}, {1, -1}, {-1, 1}, {1, 1}
};
const u8 sBlenderSyncArrowsPos[][2] =
const u8 sBlenderSyncArrowsPos[BLENDER_MAX_PLAYERS][2] =
{
{72, 32}, {168, 32}, {72, 128}, {168, 128}
};
@ -594,4 +995,528 @@ static const u8 gUnknown_08339CD2[] =
const struct WindowTemplate gUnknown_08339D14[] = {0, 6, 4, 0x12, 0xB, 0xF, 8};
// .text
// code
void Blender_ControlHitPitch(void)
{
m4aMPlayPitchControl(&gMPlay_SE2, 0xFFFF, 2 * (sBerryBlenderData->field_4C - 128));
}
void VBlankCB0_BerryBlender(void)
{
BerryBlender_SetGpuRegs();
SetBgAffine(2, sBerryBlenderData->bgAffineSrc.texX, sBerryBlenderData->bgAffineSrc.texY,
sBerryBlenderData->bgAffineSrc.scrX, sBerryBlenderData->bgAffineSrc.scrY,
sBerryBlenderData->bgAffineSrc.sx, sBerryBlenderData->bgAffineSrc.sy,
sBerryBlenderData->bgAffineSrc.alpha);
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
}
extern const u8 sBlenderCenterGfx[];
extern const u8 gUnknown_08D91DB8[];
extern const u8 gUnknown_08D927EC[];
bool8 LoadBerryBlenderGfx(void)
{
switch (sBerryBlenderData->loadGfxState)
{
case 0:
sBerryBlenderData->tilesBuffer = AllocZeroed(sub_8034974(sBlenderCenterGfx) + 100);
LZDecompressWram(sBlenderCenterGfx, sBerryBlenderData->tilesBuffer);
sBerryBlenderData->loadGfxState++;
break;
case 1:
CopyToBgTilemapBuffer(2, sBlenderCenterMap, 0x400, 0);
CopyBgTilemapBufferToVram(2);
LoadPalette(sBlenderCenterPal, 0, 0x100);
sBerryBlenderData->loadGfxState++;
break;
case 2:
LoadBgTiles(2, sBerryBlenderData->tilesBuffer, sub_8034974(sBlenderCenterGfx), 0);
sBerryBlenderData->loadGfxState++;
break;
case 3:
LZDecompressWram(gUnknown_08D91DB8, sBerryBlenderData->tilesBuffer);
sBerryBlenderData->loadGfxState++;
break;
case 4:
LoadBgTiles(1, sBerryBlenderData->tilesBuffer, sub_8034974(gUnknown_08D91DB8), 0);
sBerryBlenderData->loadGfxState++;
break;
case 5:
LZDecompressWram(gUnknown_08D927EC, sBerryBlenderData->tilesBuffer);
sBerryBlenderData->loadGfxState++;
break;
case 6:
CopyToBgTilemapBuffer(1, sBerryBlenderData->tilesBuffer, sub_8034974(gUnknown_08D927EC), 0);
CopyBgTilemapBufferToVram(1);
sBerryBlenderData->loadGfxState++;
break;
case 7:
LoadPalette(sBlenderOuterPal, 0x80, 0x20);
sBerryBlenderData->loadGfxState++;
break;
case 8:
LoadSpriteSheet(&sSpriteSheet_BlenderArrow);
LoadSpriteSheet(&gUnknown_08339BD8);
LoadSpriteSheet(&gUnknown_08339B38);
sBerryBlenderData->loadGfxState++;
break;
case 9:
LoadSpriteSheet(&gUnknown_08339C24);
LoadSpriteSheet(&gUnknown_08339C58);
LoadSpritePalette(&sSpritePal_BlenderArrow);
LoadSpritePalette(&sSpritePal_BlenderMisc);
Free(sBerryBlenderData->tilesBuffer);
sBerryBlenderData->loadGfxState = 0;
return TRUE;
}
return FALSE;
}
void sub_807F9D0(void)
{
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14);
CopyBgTilemapBufferToVram(0);
ShowBg(0);
ShowBg(1);
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
}
void InitBerryBlenderWindows(void)
{
if (InitWindows(sBerryBlender_WindowTemplates))
{
s32 i;
DeactivateAllTextPrinters();
for (i = 0; i < 5; i++)
FillWindowPixelBuffer(i, 0);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14);
sub_81978B0(0xE0);
}
}
void DoBerryBlending(void)
{
if (sBerryBlenderData == NULL)
sBerryBlenderData = AllocZeroed(sizeof(*sBerryBlenderData));
sBerryBlenderData->field_63 = 0;
sBerryBlenderData->mainState = 0;
sBerryBlenderData->field_63 = 0;
Blender_SetPlayerNamesLocal(gSpecialVar_0x8004);
SetMainCallback2(sub_807FAC8);
}
void sub_807FAC8(void)
{
s32 i;
switch (sBerryBlenderData->mainState)
{
case 0:
SetGpuReg(REG_OFFSET_DISPCNT, 0);
ResetSpriteData();
FreeAllSpritePalettes();
SetVBlankCallback(NULL);
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(1, sBerryBlenderBgTemplates, ARRAY_COUNT(sBerryBlenderBgTemplates));
SetBgTilemapBuffer(1, sBerryBlenderData->tilemapBuffers[0]);
SetBgTilemapBuffer(2, sBerryBlenderData->tilemapBuffers[1]);
sub_809882C(0, 1, 0xD0);
copy_textbox_border_tile_patterns_to_vram(0, 0x14, 0xF0);
InitBerryBlenderWindows();
sBerryBlenderData->mainState++;
sBerryBlenderData->field_118 = 0;
sBerryBlenderData->field_116 = 0;
sBerryBlenderData->field_11A = 0x50;
sBerryBlenderData->field_11C = 0;
sBerryBlenderData->field_11E = 0;
sBerryBlenderData->loadGfxState = 0;
sub_8082D28();
break;
case 1:
if (LoadBerryBlenderGfx())
{
for (i = 0; i < BLENDER_MAX_PLAYERS; i++)
{
sBerryBlenderData->syncArrowSpriteIds[i] = CreateSprite(&sBlenderSyncArrow_SpriteTemplate, sBlenderSyncArrowsPos[i][0], sBlenderSyncArrowsPos[i][1], 1);
StartSpriteAnim(&gSprites[sBerryBlenderData->syncArrowSpriteIds[i]], i + 8);
}
if (gReceivedRemoteLinkPlayers != 0 && gLinkVSyncDisabled)
{
sub_800E0E8();
sub_800DFB4(0, 0);
}
SetVBlankCallback(VBlankCB0_BerryBlender);
sBerryBlenderData->mainState++;
}
break;
case 2:
BeginNormalPaletteFade(-1, 0, 0x10, 0, 0);
sub_8082D28();
sBerryBlenderData->mainState++;
break;
case 3:
sub_807F9D0();
if (!gPaletteFade.active)
sBerryBlenderData->mainState++;
break;
case 4:
if (Blender_PrintText(&sBerryBlenderData->textState, gText_BerryBlenderStart, GetPlayerTextSpeed()))
sBerryBlenderData->mainState++;
break;
case 5:
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
sBerryBlenderData->mainState++;
break;
case 6:
if (!gPaletteFade.active)
{
FreeAllWindowBuffers();
UnsetBgTilemapBuffer(2);
UnsetBgTilemapBuffer(1);
SetVBlankCallback(NULL);
sub_81AABF0(sub_807FFA4);
sBerryBlenderData->mainState = 0;
}
break;
}
AnimateSprites();
BuildOamBuffer();
RunTextPrinters();
UpdatePaletteFade();
}
void sub_807FD08(struct Sprite* sprite)
{
sprite->data1 += sprite->data6;
sprite->data2 -= sprite->data4;
sprite->data2 += sprite->data7;
sprite->data0 += sprite->data7;
sprite->data4--;
if (sprite->data0 < sprite->data2)
{
sprite->data3 = sprite->data4 = sprite->data3 - 1;
if (++sprite->data5 > 3)
DestroySprite(sprite);
else
PlaySE(SE_TB_KARA);
}
sprite->pos1.x = sprite->data1;
sprite->pos1.y = sprite->data2;
}
void sub_807FD64(struct Sprite* sprite, s16 a2, s16 a3, s16 a4, s16 a5, s16 a6)
{
sprite->data0 = a3;
sprite->data1 = a2;
sprite->data2 = a3;
sprite->data3 = a4;
sprite->data4 = 10;
sprite->data5 = 0;
sprite->data6 = a5;
sprite->data7 = a6;
sprite->callback = sub_807FD08;
}
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]);
}
void Blender_CopyBerryData(struct BlenderBerry* berry, u16 itemId)
{
const struct Berry *berryInfo = GetBerryInfo(ITEM_TO_BERRY(itemId));
berry->itemId = itemId;
StringCopy(berry->name, berryInfo->name);
berry->flavours[FLAVOUR_SPICY] = berryInfo->spicy;
berry->flavours[FLAVOUR_DRY] = berryInfo->dry;
berry->flavours[FLAVOUR_SWEET] = berryInfo->sweet;
berry->flavours[FLAVOUR_BITTER] = berryInfo->bitter;
berry->flavours[FLAVOUR_SOUR] = berryInfo->sour;
berry->smoothness = berryInfo->smoothness;
}
void Blender_SetPlayerNamesLocal(u8 opponentsNum)
{
switch (opponentsNum)
{
case 0:
gInGameOpponentsNo = 0;
break;
case 1:
gInGameOpponentsNo = 1;
sBerryBlenderData->playersNo = 2;
StringCopy(gLinkPlayers[0].name, gSaveBlock2Ptr->playerName);
if (!FlagGet(FLAG_340))
StringCopy(gLinkPlayers[1].name, sBlenderOpponentsNames[BLENDER_MASTER]);
else
StringCopy(gLinkPlayers[1].name, sBlenderOpponentsNames[BLENDER_MISTER]);
gLinkPlayers[0].language = GAME_LANGUAGE;
gLinkPlayers[1].language = GAME_LANGUAGE;
break;
case 2:
gInGameOpponentsNo = 2;
sBerryBlenderData->playersNo = 3;
StringCopy(gLinkPlayers[0].name, gSaveBlock2Ptr->playerName);
StringCopy(gLinkPlayers[1].name, sBlenderOpponentsNames[BLENDER_DUDE]);
StringCopy(gLinkPlayers[2].name, sBlenderOpponentsNames[BLENDER_LASSIE]);
gLinkPlayers[0].language = GAME_LANGUAGE;
gLinkPlayers[1].language = GAME_LANGUAGE;
gLinkPlayers[2].language = GAME_LANGUAGE;
break;
case 3:
gInGameOpponentsNo = 3;
sBerryBlenderData->playersNo = 4;
StringCopy(gLinkPlayers[0].name, gSaveBlock2Ptr->playerName);
StringCopy(gLinkPlayers[1].name, sBlenderOpponentsNames[BLENDER_MISS]);
StringCopy(gLinkPlayers[2].name, sBlenderOpponentsNames[BLENDER_LADDIE]);
StringCopy(gLinkPlayers[3].name, sBlenderOpponentsNames[BLENDER_LASSIE]);
gLinkPlayers[0].language = GAME_LANGUAGE;
gLinkPlayers[1].language = GAME_LANGUAGE;
gLinkPlayers[2].language = GAME_LANGUAGE;
gLinkPlayers[3].language = GAME_LANGUAGE;
break;
}
}
void sub_807FFA4(void)
{
s32 i;
SetGpuReg(REG_OFFSET_DISPCNT, 0);
if (sBerryBlenderData == NULL)
sBerryBlenderData = AllocZeroed(sizeof(*sBerryBlenderData));
sBerryBlenderData->mainState = 0;
sBerryBlenderData->field_10C = 0;
for (i = 0; i < BLENDER_MAX_PLAYERS; i++)
sBerryBlenderData->chosenItemId[i] = ITEM_NONE;
Blender_SetPlayerNamesLocal(gSpecialVar_0x8004);
if (gSpecialVar_0x8004 == 0)
SetMainCallback2(sub_8080018);
else
SetMainCallback2(sub_80808D4);
}
void sub_8080018(void)
{
s32 i, j;
switch (sBerryBlenderData->mainState)
{
case 0:
sub_8080588();
gLinkType = 0x4422;
sBerryBlenderData->field_72 = 0;
for (i = 0; i < BLENDER_MAX_PLAYERS; i++)
{
sBerryBlenderData->field_64[i] = 0;
for (j = 0; j < 3; j++)
{
sBerryBlenderData->scores[i][j] = 0;
}
}
sBerryBlenderData->field_70 = 0;
sBerryBlenderData->field_4E = 0;
sBerryBlenderData->loadGfxState = 0;
sBerryBlenderData->mainState++;
break;
case 1:
if (LoadBerryBlenderGfx())
{
sBerryBlenderData->mainState++;
sub_8082D28();
}
break;
case 2:
for (i = 0; i < BLENDER_MAX_PLAYERS; i++)
{
sBerryBlenderData->syncArrowSprite2Ids[i] = CreateSprite(&sBlenderSyncArrow_SpriteTemplate, sBlenderSyncArrowsPos[i][0], sBlenderSyncArrowsPos[i][1], 1);
StartSpriteAnim(&gSprites[sBerryBlenderData->syncArrowSprite2Ids[i]], i + 8);
}
if (gReceivedRemoteLinkPlayers != 0 && gLinkVSyncDisabled)
{
sub_800E0E8();
sub_800DFB4(0, 0);
}
sBerryBlenderData->mainState++;
break;
case 3:
BeginNormalPaletteFade(-1, 0, 0x10, 0, 0);
sBerryBlenderData->mainState++;
break;
case 4:
sub_807F9D0();
if (!gPaletteFade.active)
{
sBerryBlenderData->mainState++;
}
break;
case 5:
Blender_PrintText(&sBerryBlenderData->textState, sText_CommunicationStandby, 0);
sBerryBlenderData->mainState = 8;
sBerryBlenderData->framesToWait = 0;
break;
case 8:
sBerryBlenderData->mainState++;
sBerryBlenderData->field_114 = 0;
Blender_CopyBerryData(&sBerryBlenderData->blendedBerries[0], gSpecialVar_ItemId);
memcpy(gBlockSendBuffer, &sBerryBlenderData->blendedBerries[0], sizeof(struct BlenderBerry));
sub_800ADF8();
sBerryBlenderData->framesToWait = 0;
break;
case 9:
if (sub_800A520())
{
ResetBlockReceivedFlags();
if (GetMultiplayerId() == 0)
sub_800A4D8(4);
sBerryBlenderData->mainState++;
}
break;
case 10:
if (++sBerryBlenderData->framesToWait > 20)
{
sub_8197DF8(4, TRUE);
if (GetBlockReceivedStatus() == sub_800A9D8())
{
for (i = 0; i < GetLinkPlayerCount(); i++)
{
memcpy(&sBerryBlenderData->blendedBerries[i], &gBlockRecvBuffer[i][0], sizeof(struct BlenderBerry));
sBerryBlenderData->chosenItemId[i] = sBerryBlenderData->blendedBerries[i].itemId;
}
ResetBlockReceivedFlags();
sBerryBlenderData->mainState++;
}
}
break;
case 11:
sBerryBlenderData->playersNo = GetLinkPlayerCount();
for (i = 0; i < BLENDER_MAX_PLAYERS; i++)
{
if (sBerryBlenderData->field_114 == gUnknown_083399D0[sBerryBlenderData->playersNo - 2][i])
{
sub_807FD90(sBerryBlenderData->chosenItemId[sBerryBlenderData->field_114], i);
break;
}
}
sBerryBlenderData->framesToWait = 0;
sBerryBlenderData->mainState++;
sBerryBlenderData->field_114++;
break;
case 12:
if (++sBerryBlenderData->framesToWait > 60)
{
if (sBerryBlenderData->field_114 >= sBerryBlenderData->playersNo)
{
sBerryBlenderData->mainState++;
sBerryBlenderData->arrowPos = gUnknown_083399DC[gUnknown_083399E4[sBerryBlenderData->playersNo - 2]] - 22528;
}
else
{
sBerryBlenderData->mainState--;
}
sBerryBlenderData->framesToWait = 0;
}
break;
case 13:
if (sub_800A520())
{
sBerryBlenderData->mainState++;
sub_8082CB4(&sBerryBlenderData->bgAffineSrc);
PlaySE(SE_RU_HYUU);
ShowBg(2);
}
break;
case 14:
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON);
sBerryBlenderData->arrowPos += 0x200;
sBerryBlenderData->field_11A += 4;
if (sBerryBlenderData->field_11A > 255)
{
SetGpuRegBits(REG_OFFSET_BG2CNT, 2);
sBerryBlenderData->mainState++;
sBerryBlenderData->field_11A = 256;
sBerryBlenderData->arrowPos = gUnknown_083399DC[gUnknown_083399E4[sBerryBlenderData->playersNo - 2]];
sBerryBlenderData->framesToWait = 0;
PlaySE(SE_TRACK_DOOR);
sub_808074C();
sub_80807BC();
}
sub_8082CB4(&sBerryBlenderData->bgAffineSrc);
break;
case 15:
if (sub_8083380())
{
sBerryBlenderData->framesToWait = 0;
sBerryBlenderData->mainState++;
}
sub_8082CB4(&sBerryBlenderData->bgAffineSrc);
break;
case 16:
CreateSprite(&gUnknown_08339C2C, 120, -16, 3);
sBerryBlenderData->mainState++;
break;
case 18:
sBerryBlenderData->mainState++;
break;
case 19:
sub_800ADF8();
sBerryBlenderData->mainState++;
break;
case 20:
if (sub_800A520())
{
sub_800A418();
sBerryBlenderData->mainState++;
}
break;
case 21:
sBerryBlenderData->field_4C = 128;
sBerryBlenderData->gameFrameTime = 0;
SetMainCallback2(sub_8081898);
if (GetCurrentMapMusic() != BGM_CYCLING)
{
sBerryBlenderData->field_154 = GetCurrentMapMusic();
}
PlayBGM(BGM_CYCLING);
break;
}
Blender_DummiedOutFunc(sBerryBlenderData->field_11C, sBerryBlenderData->field_11E);
RunTasks();
AnimateSprites();
BuildOamBuffer();
RunTextPrinters();
UpdatePaletteFade();
}

View File

@ -459,10 +459,9 @@ _08034964:\n\
.syntax divided");
}
u32 sub_8034974(void* ptr)
u32 sub_8034974(const u8 *ptr)
{
u8* ptr_ = (u8*)(ptr);
return (ptr_[3] << 16) | (ptr_[2] << 8) | (ptr_[1]);
return (ptr[3] << 16) | (ptr[2] << 8) | (ptr[1]);
}
bool8 LoadCompressedObjectPicUsingHeap(const struct CompressedSpriteSheet* src)

View File

@ -45,7 +45,7 @@ void m4aMPlayVolumeControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u16
mplayInfo->ident = ID_NUMBER;
}
void m4aMPlayPitchControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u16 pitch)
void m4aMPlayPitchControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, s16 pitch)
{
s32 i;
u32 bit;
@ -66,7 +66,7 @@ void m4aMPlayPitchControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u16
{
if (track->flags & MPT_FLG_EXIST)
{
track->keyShiftX = (s16)pitch >> 8;
track->keyShiftX = pitch >> 8;
track->pitX = pitch;
track->flags |= MPT_FLG_PITCHG;
}

View File

@ -248,7 +248,7 @@ gSaveBlock2Ptr: @ 3005D90
gPokemonStoragePtr: @ 3005D94
.space 0x4
gUnknown_03005D98: @ 3005D98
gInGameOpponentsNo: @ 3005D98
.space 0x4
gUnknown_03005D9C: @ 3005D9C

View File

@ -34,13 +34,13 @@ gUnknown_020223C0: @ 20223C0
gBlockRecvBuffer: @ 20223C4
.space 0x500
gUnknown_020228C4: @ 20228C4 gBlockSendBuffer
gBlockSendBuffer: @ 20228C4 gBlockSendBuffer
.space 0x100
gUnknown_020229C4: @ 20229C4
.space 0x2
gUnknown_020229C6: @ 20229C6
gLinkType: @ 20229C6
.space 0x2
gUnknown_020229C8: @ 20229C8
@ -571,7 +571,7 @@ gUnknown_0203229C: @ 203229C
gUnknown_020322A0: @ 20322A0
.space 0x4
gUnknown_020322A4: @ 20322A4
sBerryBlenderData: @ 20322A4
.space 0x4
gUnknown_020322A8: @ 20322A8