start pokeblock feed

This commit is contained in:
DizzyEggg 2017-12-09 21:23:40 +01:00
parent ad07843f2d
commit 6561b62986
27 changed files with 803 additions and 1548 deletions

View File

@ -1433,13 +1433,13 @@ DrawMainBattleBackground: @ 8035770
ands r0, r1
cmp r0, 0
beq _080357B0
ldr r0, =gUnknown_08D7C440
ldr r0, =gBattleTerrainTiles_Building
ldr r1, =0x06008000
bl LZDecompressVram
ldr r0, =gUnknown_08D7CA28
ldr r1, =0x0600d000
bl LZDecompressVram
ldr r0, =gUnknown_08D7C9EC
ldr r0, =gBattleTerrainPalette_Frontier
b _08035A52
.pool
_080357B0:
@ -1502,7 +1502,7 @@ _0803584C:
ldrb r0, [r0, 0x1]
cmp r0, 0x20
bne _08035898
ldr r0, =gUnknown_08D7C440
ldr r0, =gBattleTerrainTiles_Building
ldr r1, =0x06008000
bl LZDecompressVram
ldr r0, =gUnknown_08D7CA28
@ -1576,7 +1576,7 @@ _08035904:
b _08035A52
.pool
_08035950:
ldr r0, =gUnknown_08D7C440
ldr r0, =gBattleTerrainTiles_Building
ldr r1, =0x06008000
bl LZDecompressVram
ldr r0, =gUnknown_08D7CA28
@ -1650,13 +1650,13 @@ _08035A52:
b _08035A8A
.pool
_08035A70:
ldr r0, =gUnknown_08D7C440
ldr r0, =gBattleTerrainTiles_Building
ldr r1, =0x06008000
bl LZDecompressVram
ldr r0, =gUnknown_08D7CA28
ldr r1, =0x0600d000
bl LZDecompressVram
ldr r0, =gUnknown_08D7C9EC
ldr r0, =gBattleTerrainPalette_Frontier
movs r1, 0x20
movs r2, 0x60
bl LoadCompressedPalette
@ -2813,7 +2813,7 @@ _08036510:
b _0803651A
.pool
_08036518:
ldr r0, =gUnknown_08D7C440
ldr r0, =gBattleTerrainTiles_Building
_0803651A:
ldr r1, =0x06008000
bl LZDecompressVram
@ -3043,7 +3043,7 @@ _08036738:
b _08036742
.pool
_08036740:
ldr r0, =gUnknown_08D7C9EC
ldr r0, =gBattleTerrainPalette_Frontier
_08036742:
movs r1, 0x20
movs r2, 0x60

View File

@ -115,7 +115,7 @@ _08177CD8:
.4byte _08177DC2
_08177D18:
bl SetVBlankHBlankCallbacksToNull
bl sub_8121DA0
bl ResetVramOamAndBgCntRegs
bl clear_scheduled_bg_copies_to_vram
b _08177DDC
_08177D26:
@ -246,7 +246,7 @@ sub_8177E14: @ 8177E14
adds r1, r0
movs r0, 0x3
bl SetBgTilemapBuffer
bl sub_8121E10
bl ResetAllBgsCoordinates
movs r0, 0x2
bl schedule_bg_copy_tilemap_to_vram
movs r0, 0x3

View File

@ -568,7 +568,7 @@ _081AB046:
thumb_func_start bag_menu_init_bgs
bag_menu_init_bgs: @ 81AB050
push {r4,lr}
bl sub_8121DA0
bl ResetVramOamAndBgCntRegs
ldr r4, =gUnknown_0203CE54
ldr r0, [r4]
adds r0, 0x4
@ -586,7 +586,7 @@ bag_menu_init_bgs: @ 81AB050
adds r1, 0x4
movs r0, 0x2
bl SetBgTilemapBuffer
bl sub_8121E10
bl ResetAllBgsCoordinates
movs r0, 0x2
bl schedule_bg_copy_tilemap_to_vram
movs r1, 0x82

View File

@ -175,14 +175,14 @@ sub_8160740: @ 8160740
thumb_func_start sub_81607EC
sub_81607EC: @ 81607EC
push {lr}
bl sub_8121DA0
bl ResetVramOamAndBgCntRegs
movs r0, 0
bl ResetBgsAndClearDma3BusyFlags
ldr r1, =gUnknown_085CEC28
movs r0, 0
movs r2, 0x2
bl InitBgsFromTemplates
bl sub_8121E10
bl ResetAllBgsCoordinates
movs r1, 0x82
lsls r1, 5
movs r0, 0

View File

@ -5,8 +5,8 @@
.text
thumb_func_start sub_8121DA0
sub_8121DA0: @ 8121DA0
thumb_func_start ResetVramOamAndBgCntRegs
ResetVramOamAndBgCntRegs: @ 8121DA0
push {r4,lr}
sub sp, 0xC
movs r0, 0
@ -50,10 +50,10 @@ sub_8121DA0: @ 8121DA0
pop {r0}
bx r0
.pool
thumb_func_end sub_8121DA0
thumb_func_end ResetVramOamAndBgCntRegs
thumb_func_start sub_8121E10
sub_8121E10: @ 8121E10
thumb_func_start ResetAllBgsCoordinates
ResetAllBgsCoordinates: @ 8121E10
push {lr}
movs r0, 0
movs r1, 0
@ -89,7 +89,7 @@ sub_8121E10: @ 8121E10
bl ChangeBgY
pop {r0}
bx r0
thumb_func_end sub_8121E10
thumb_func_end ResetAllBgsCoordinates
thumb_func_start SetVBlankHBlankCallbacksToNull
@ void SetVBlankHBlankCallbacksToNull()
@ -177,8 +177,8 @@ _08121EC0:
.pool
thumb_func_end DisplayMessageAndContinueTask
thumb_func_start sub_8121F20
sub_8121F20: @ 8121F20
thumb_func_start RunTextPrintersRetIsActive
RunTextPrintersRetIsActive: @ 8121F20
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
@ -191,7 +191,7 @@ sub_8121F20: @ 8121F20
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_8121F20
thumb_func_end RunTextPrintersRetIsActive
thumb_func_start Task_ContinueTaskAfterMessagePrints
@ void Task_ContinueTaskAfterMessagePrints(u8 taskId)
@ -201,7 +201,7 @@ Task_ContinueTaskAfterMessagePrints: @ 8121F3C
lsrs r4, r0, 24
ldr r0, =gUnknown_0203A140
ldrb r0, [r0]
bl sub_8121F20
bl RunTextPrintersRetIsActive
lsls r0, 16
cmp r0, 0
bne _08121F5A

View File

@ -98,7 +98,7 @@ _081B0234:
.4byte _081B0474
_081B0290:
bl SetVBlankHBlankCallbacksToNull
bl sub_8121DA0
bl ResetVramOamAndBgCntRegs
bl clear_scheduled_bg_copies_to_vram
ldr r1, =gMain
movs r0, 0x87
@ -429,7 +429,7 @@ sub_81B0550: @ 81B0550
ldr r1, [r5]
movs r0, 0x1
bl SetBgTilemapBuffer
bl sub_8121E10
bl ResetAllBgsCoordinates
movs r0, 0x1
bl schedule_bg_copy_tilemap_to_vram
movs r1, 0x82
@ -3161,7 +3161,7 @@ sub_81B1B8C: @ 81B1B8C
lsrs r4, r0, 24
adds r5, r4, 0
movs r0, 0x6
bl sub_8121F20
bl RunTextPrintersRetIsActive
lsls r0, 16
lsrs r0, 16
cmp r0, 0x1

File diff suppressed because it is too large Load Diff

View File

@ -2351,7 +2351,7 @@ _081C51D6:
thumb_func_start sub_81C51DC
sub_81C51DC: @ 81C51DC
push {lr}
bl sub_8121DA0
bl ResetVramOamAndBgCntRegs
movs r0, 0
bl ResetBgsAndClearDma3BusyFlags
ldr r1, =gUnknown_0861F2B4
@ -2363,7 +2363,7 @@ sub_81C51DC: @ 81C51DC
adds r1, 0x4
movs r0, 0x2
bl SetBgTilemapBuffer
bl sub_8121E10
bl ResetAllBgsCoordinates
movs r0, 0x2
bl schedule_bg_copy_tilemap_to_vram
movs r1, 0x82

View File

@ -1066,7 +1066,7 @@ sub_81D6FD0: @ 81D6FD0
thumb_func_start sub_81D6FE0
sub_81D6FE0: @ 81D6FE0
push {r4,lr}
bl sub_8121DA0
bl ResetVramOamAndBgCntRegs
movs r0, 0
bl ResetBgsAndClearDma3BusyFlags
ldr r1, =gUnknown_0862A888
@ -1088,7 +1088,7 @@ sub_81D6FE0: @ 81D6FE0
adds r1, r0
movs r0, 0x2
bl SetBgTilemapBuffer
bl sub_8121E10
bl ResetAllBgsCoordinates
movs r0, 0
bl schedule_bg_copy_tilemap_to_vram
movs r0, 0x1
@ -2758,7 +2758,7 @@ _081D7E08:
thumb_func_start sub_81D7E10
sub_81D7E10: @ 81D7E10
push {r4,lr}
bl sub_8121DA0
bl ResetVramOamAndBgCntRegs
movs r0, 0
bl ResetBgsAndClearDma3BusyFlags
ldr r1, =gUnknown_0862AA54
@ -2780,7 +2780,7 @@ sub_81D7E10: @ 81D7E10
adds r1, r0
movs r0, 0x2
bl SetBgTilemapBuffer
bl sub_8121E10
bl ResetAllBgsCoordinates
movs r0, 0
bl schedule_bg_copy_tilemap_to_vram
movs r0, 0x1
@ -3292,7 +3292,7 @@ _081D829A:
thumb_func_start sub_81D82B0
sub_81D82B0: @ 81D82B0
push {r4,lr}
bl sub_8121DA0
bl ResetVramOamAndBgCntRegs
movs r0, 0
bl ResetBgsAndClearDma3BusyFlags
ldr r1, =gUnknown_0862AACC
@ -3319,7 +3319,7 @@ sub_81D82B0: @ 81D82B0
adds r1, r0
movs r0, 0x3
bl SetBgTilemapBuffer
bl sub_8121E10
bl ResetAllBgsCoordinates
movs r0, 0
bl schedule_bg_copy_tilemap_to_vram
movs r0, 0x1
@ -3899,7 +3899,7 @@ _081D8818:
thumb_func_start sub_81D8828
sub_81D8828: @ 81D8828
push {r4,lr}
bl sub_8121DA0
bl ResetVramOamAndBgCntRegs
movs r0, 0
bl ResetBgsAndClearDma3BusyFlags
ldr r1, =gUnknown_0862AB44
@ -3926,7 +3926,7 @@ sub_81D8828: @ 81D8828
adds r1, r0
movs r0, 0x3
bl SetBgTilemapBuffer
bl sub_8121E10
bl ResetAllBgsCoordinates
movs r0, 0
bl schedule_bg_copy_tilemap_to_vram
movs r0, 0x1
@ -4354,7 +4354,7 @@ _081D8C26:
thumb_func_start sub_81D8C38
sub_81D8C38: @ 81D8C38
push {r4,lr}
bl sub_8121DA0
bl ResetVramOamAndBgCntRegs
movs r0, 0
bl ResetBgsAndClearDma3BusyFlags
ldr r1, =gUnknown_0862AD08
@ -4376,7 +4376,7 @@ sub_81D8C38: @ 81D8C38
adds r1, r0
movs r0, 0x2
bl SetBgTilemapBuffer
bl sub_8121E10
bl ResetAllBgsCoordinates
movs r0, 0
bl schedule_bg_copy_tilemap_to_vram
movs r0, 0x1

View File

@ -728,7 +728,7 @@ _08135A9A:
movs r0, 0x38
movs r1, 0x40
movs r2, 0
bl sub_8136444
bl CreatePokeblockCaseSprite
ldr r1, =gUnknown_0203AB50
ldr r1, [r1]
ldr r2, =0x00000e74
@ -859,7 +859,7 @@ _08135BD2:
thumb_func_start sub_8135BDC
sub_8135BDC: @ 8135BDC
push {lr}
bl sub_8121DA0
bl ResetVramOamAndBgCntRegs
movs r0, 0
bl ResetBgsAndClearDma3BusyFlags
ldr r1, =gUnknown_085B2620
@ -870,7 +870,7 @@ sub_8135BDC: @ 8135BDC
ldr r1, [r0]
movs r0, 0x2
bl SetBgTilemapBuffer
bl sub_8121E10
bl ResetAllBgsCoordinates
movs r0, 0x2
bl schedule_bg_copy_tilemap_to_vram
movs r1, 0x82
@ -949,12 +949,12 @@ _08135CBC:
b _08135CDE
.pool
_08135CCC:
ldr r0, =gUnknown_085B26F4
ldr r0, =gPokeblockCase_SpriteSheet
bl LoadCompressedObjectPic
b _08135CDE
.pool
_08135CD8:
ldr r0, =gUnknown_085B26FC
ldr r0, =gPokeblockCase_SpritePal
bl LoadCompressedObjectPalette
_08135CDE:
ldr r0, =gUnknown_0203AB50
@ -1313,7 +1313,7 @@ _08136002:
lsls r1, r4, 24
lsrs r1, 24
mov r0, r8
bl sub_8136F9C
bl GetPokeblockData
lsls r0, 16
adds r7, r4, 0
cmp r0, 0
@ -1842,8 +1842,8 @@ _08136436:
.pool
thumb_func_end sub_8136418
thumb_func_start sub_8136444
sub_8136444: @ 8136444
thumb_func_start CreatePokeblockCaseSprite
CreatePokeblockCaseSprite: @ 8136444
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
@ -1864,7 +1864,7 @@ sub_8136444: @ 8136444
pop {r1}
bx r1
.pool
thumb_func_end sub_8136444
thumb_func_end CreatePokeblockCaseSprite
thumb_func_start sub_8136470
sub_8136470: @ 8136470
@ -2549,7 +2549,7 @@ sub_8136A74: @ 8136A74
ldr r0, [r2]
adds r0, r1
ldr r1, =sub_8136AA0
bl sub_8166204
bl ChooseMonToGivePokeblock
pop {r0}
bx r0
.pool
@ -3000,7 +3000,7 @@ GetHighestPokeblocksFlavorLevel: @ 8136EA4
push {r4-r6,lr}
adds r6, r0, 0
movs r1, 0x1
bl sub_8136F9C
bl GetPokeblockData
lsls r0, 24
lsrs r5, r0, 24
movs r1, 0x1
@ -3010,7 +3010,7 @@ _08136EB4:
lsrs r4, r0, 24
adds r0, r6, 0
adds r1, r4, 0
bl sub_8136F9C
bl GetPokeblockData
lsls r0, 24
lsrs r0, 24
cmp r5, r0
@ -3030,7 +3030,7 @@ _08136ECC:
GetPokeblocksFeel: @ 8136EDC
push {lr}
movs r1, 0x6
bl sub_8136F9C
bl GetPokeblockData
lsls r0, 24
lsrs r0, 24
cmp r0, 0x63
@ -3130,8 +3130,8 @@ _08136F96:
bx r1
thumb_func_end sub_8136F68
thumb_func_start sub_8136F9C
sub_8136F9C: @ 8136F9C
thumb_func_start GetPokeblockData
GetPokeblockData: @ 8136F9C
push {lr}
lsls r1, 24
lsrs r1, 24
@ -3175,7 +3175,7 @@ _08136FDC:
_08136FDE:
pop {r1}
bx r1
thumb_func_end sub_8136F9C
thumb_func_end GetPokeblockData
thumb_func_start PokeblockGetGain
PokeblockGetGain: @ 8136FE4
@ -3198,7 +3198,7 @@ _08136FFE:
lsrs r5, r0, 24
mov r0, r8
adds r1, r5, 0
bl sub_8136F9C
bl GetPokeblockData
lsls r0, 16
asrs r1, r0, 16
cmp r1, 0
@ -3229,12 +3229,12 @@ _0813702A:
.pool
thumb_func_end PokeblockGetGain
thumb_func_start sub_8137044
sub_8137044: @ 8137044
thumb_func_start PokeblockCopyName
PokeblockCopyName: @ 8137044
push {r4,lr}
adds r4, r1, 0
movs r1, 0
bl sub_8136F9C
bl GetPokeblockData
lsls r0, 24
ldr r1, =gPokeblockNames
lsrs r0, 22
@ -3246,7 +3246,7 @@ sub_8137044: @ 8137044
pop {r0}
bx r0
.pool
thumb_func_end sub_8137044
thumb_func_end PokeblockCopyName
thumb_func_start sub_8137068
sub_8137068: @ 8137068
@ -3298,13 +3298,13 @@ _081370BC:
lsls r1, 24
lsrs r1, 24
adds r0, r5, 0
bl sub_8136F9C
bl GetPokeblockData
adds r4, r0, 0
adds r1, r6, 0x1
lsls r1, 24
lsrs r1, 24
adds r0, r5, 0
bl sub_8136F9C
bl GetPokeblockData
lsls r4, 16
lsls r0, 16
lsls r1, r6, 16

View File

@ -425,8 +425,8 @@ _08140618:
bl SetVBlankCallback
bl remove_some_task
bl SetVBlankHBlankCallbacksToNull
bl sub_8121DA0
bl sub_8121E10
bl ResetVramOamAndBgCntRegs
bl ResetAllBgsCoordinates
b _081407F8
_08140630:
bl sub_8140388
@ -3258,8 +3258,8 @@ sub_8141E7C: @ 8141E7C
ldr r0, =gSpriteCoordOffsetY
strh r4, [r0]
strh r4, [r1]
bl sub_8121DA0
bl sub_8121E10
bl ResetVramOamAndBgCntRegs
bl ResetAllBgsCoordinates
movs r0, 0x50
movs r1, 0
bl SetGpuReg

View File

@ -6,325 +6,9 @@
.text
thumb_func_start sub_816624C
sub_816624C: @ 816624C
push {r4,r5,lr}
ldr r4, =gUnknown_0203BCAC
ldr r0, =0x0000806c
bl AllocZeroed
str r0, [r4]
ldr r5, =gUnknown_0203BC90
ldr r1, =0x00007fd0
adds r0, r1
str r0, [r5]
ldr r1, =gUnknown_0203BC98
ldr r1, [r1]
str r1, [r0, 0x8]
ldr r1, =gUnknown_0203BC94
ldr r1, [r1]
str r1, [r0, 0x4]
ldr r4, =gUnknown_0203BC9C
ldrb r0, [r4]
bl sub_81672E4
strb r0, [r4]
ldr r5, [r5]
movs r1, 0
lsls r0, 24
lsrs r0, 24
cmp r0, 0x3
bls _08166284
movs r1, 0x1
_08166284:
adds r0, r5, 0
adds r0, 0x56
strb r1, [r0]
ldr r0, =sub_8166380
bl sub_816636C
ldr r0, =sub_81662C0
bl SetMainCallback2
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_816624C
thumb_func_start sub_81662C0
sub_81662C0: @ 81662C0
push {r4,lr}
ldr r4, =gUnknown_0203BC90
ldr r0, [r4]
ldr r0, [r0]
bl _call_via_r0
bl AnimateSprites
bl BuildOamBuffer
bl UpdatePaletteFade
ldr r4, [r4]
ldr r1, [r4]
ldr r0, =map_warp_consider_1_to_outside_or_stair_or_dive
cmp r1, r0
bne _081662F0
adds r0, r4, 0
adds r0, 0x50
movs r1, 0
strb r1, [r0]
ldr r0, =sub_8166304
bl SetMainCallback2
_081662F0:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81662C0
thumb_func_start sub_8166304
sub_8166304: @ 8166304
push {lr}
bl sub_81668F8
bl AnimateSprites
bl BuildOamBuffer
bl UpdatePaletteFade
pop {r0}
bx r0
thumb_func_end sub_8166304
thumb_func_start sub_816631C
sub_816631C: @ 816631C
push {lr}
ldr r0, =gUnknown_0203BC90
ldr r0, [r0]
ldr r0, [r0]
bl _call_via_r0
bl AnimateSprites
bl BuildOamBuffer
bl RunTextPrinters
bl UpdatePaletteFade
pop {r0}
bx r0
.pool
thumb_func_end sub_816631C
thumb_func_start sub_8166340
sub_8166340: @ 8166340
push {lr}
bl LoadOam
bl ProcessSpriteCopyRequests
bl TransferPlttBuffer
ldr r0, =gUnknown_0203BCAC
ldr r0, [r0]
ldr r1, =0x00007c58
adds r0, r1
bl sub_81D2108
bl sub_80BA0A8
pop {r0}
bx r0
.pool
thumb_func_end sub_8166340
thumb_func_start sub_816636C
sub_816636C: @ 816636C
ldr r1, =gUnknown_0203BC90
ldr r1, [r1]
str r0, [r1]
adds r1, 0x50
movs r0, 0
strb r0, [r1]
bx lr
.pool
thumb_func_end sub_816636C
thumb_func_start sub_8166380
sub_8166380: @ 8166380
push {r4,r5,lr}
sub sp, 0x4
ldr r1, =gUnknown_0203BC90
ldr r0, [r1]
adds r0, 0x50
ldrb r0, [r0]
adds r2, r1, 0
cmp r0, 0xF
bls _08166394
b _08166556
_08166394:
lsls r0, 2
ldr r1, =_081663A8
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_081663A8:
.4byte _081663E8
.4byte _0816640C
.4byte _08166416
.4byte _08166434
.4byte _08166464
.4byte _08166468
.4byte _08166474
.4byte _08166484
.4byte _08166490
.4byte _0816649C
.4byte _081664B8
.4byte _081664BC
.4byte _081664E4
.4byte _08166510
.4byte _08166528
.4byte _08166550
_081663E8:
ldr r2, =gUnknown_0203BCAC
ldr r0, [r2]
ldr r1, =0x00007b10
adds r0, r1
movs r1, 0xFF
strb r1, [r0]
ldr r0, [r2]
ldr r2, =0x00007c58
adds r0, r2
bl sub_81D1ED4
b _0816653C
.pool
_0816640C:
bl ResetSpriteData
bl FreeAllSpritePalettes
b _0816653C
_08166416:
movs r0, 0
bl SetVBlankCallback
movs r0, 0
str r0, [sp]
movs r1, 0xC0
lsls r1, 19
ldr r2, =0x05006000
mov r0, sp
bl CpuSet
b _0816653C
.pool
_08166434:
movs r0, 0
bl ResetBgsAndClearDma3BusyFlags
ldr r1, =gUnknown_085DFCCC
movs r0, 0
movs r2, 0x4
bl InitBgsFromTemplates
ldr r0, =gUnknown_085DFCDC
bl InitWindows
bl DeactivateAllTextPrinters
movs r0, 0
movs r1, 0x97
movs r2, 0xE0
bl sub_809882C
b _0816653C
.pool
_08166464:
ldr r1, [r2]
b _08166540
_08166468:
bl sub_8168328
lsls r0, 24
cmp r0, 0
bne _08166556
b _0816653C
_08166474:
ldr r1, =gKeyRepeatStartDelay
movs r0, 0x14
strh r0, [r1]
bl sub_8167420
b _0816653C
.pool
_08166484:
bl sub_8167930
lsls r0, 24
cmp r0, 0
bne _08166556
b _0816653C
_08166490:
movs r0, 0
bl sub_8167608
bl sub_8167760
b _0816653C
_0816649C:
ldr r0, =gUnknown_0203BCAC
ldr r0, [r0]
ldr r1, =0x00007b0e
adds r0, r1
bl sub_81D312C
lsls r0, 24
cmp r0, 0
bne _08166556
b _0816653C
.pool
_081664B8:
ldr r1, [r2]
b _08166540
_081664BC:
ldr r5, =gUnknown_0203BCAC
ldr r1, [r5]
ldr r4, =0x00007c58
adds r0, r1, r4
ldr r2, =0x00007c6c
adds r1, r2
bl sub_81D2754
ldr r0, [r5]
adds r0, r4
bl sub_81D20AC
b _0816653C
.pool
_081664E4:
ldr r4, =gUnknown_0203BCAC
ldr r0, [r4]
ldr r1, =0x00007c58
adds r0, r1
bl sub_81D20BC
lsls r0, 24
cmp r0, 0
bne _08166556
ldr r2, [r4]
ldr r1, =0x00007c58
adds r0, r2, r1
adds r1, 0x14
adds r2, r1
adds r1, r2, 0
bl sub_81D1F84
b _0816653C
.pool
_08166510:
ldr r0, =gUnknown_0203BCAC
ldr r0, [r0]
ldr r2, =0x00007c58
adds r0, r2
bl sub_81D2230
b _0816653C
.pool
_08166528:
movs r0, 0
bl PutWindowTilemap
movs r0, 0x1
bl PutWindowTilemap
movs r0, 0
movs r1, 0x1
bl sub_8167BA0
_0816653C:
ldr r0, =gUnknown_0203BC90
ldr r1, [r0]
_08166540:
adds r1, 0x50
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
b _08166556
.pool
_08166550:
ldr r0, =map_warp_consider_1_to_outside_or_stair_or_dive
bl sub_816636C
_08166556:
add sp, 0x4
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_8166380
thumb_func_start map_warp_consider_1_to_outside_or_stair_or_dive
map_warp_consider_1_to_outside_or_stair_or_dive: @ 8166564
thumb_func_start sub_8166564
sub_8166564: @ 8166564
push {r4,lr}
sub sp, 0x4
ldr r4, =gUnknown_0203BC90
@ -407,7 +91,7 @@ _08166610:
pop {r0}
bx r0
.pool
thumb_func_end map_warp_consider_1_to_outside_or_stair_or_dive
thumb_func_end sub_8166564
thumb_func_start sub_8166634
sub_8166634: @ 8166634
@ -632,7 +316,7 @@ _08166838:
adds r0, r1
ldrb r0, [r0]
bl sub_81672A4
ldr r1, =gUnknown_0203BC9C
ldr r1, =gPokeblockMonId
strb r0, [r1]
ldr r1, =gUnknown_0203BC94
ldr r2, [r5]
@ -684,9 +368,9 @@ _08166888:
str r5, [r4]
bl FreeAllWindowBuffers
ldr r1, =gMain
ldr r0, =sub_816624C
ldr r0, =CB2_ReturnAndChooseMonToGivePokeblock
str r0, [r1, 0x8]
bl sub_8179D70
bl CB2_PreparePokeblockFeedScene
_081668D4:
add sp, 0x4
pop {r4,r5}
@ -728,7 +412,7 @@ _0816693C:
ldr r0, [r0]
ldr r1, =0x00008041
adds r0, r1
ldr r1, =gUnknown_0203BC9C
ldr r1, =gPokeblockMonId
ldrb r0, [r0]
ldrb r1, [r1]
cmp r0, r1
@ -1695,7 +1379,7 @@ sub_8167184: @ 8167184
adds r0, r3, 0
adds r0, 0x6E
strh r1, [r0]
ldr r0, =gUnknown_0203BC9E
ldr r0, =gPokeblockGain
movs r1, 0
ldrsh r0, [r0, r1]
cmp r0, 0

View File

@ -4803,14 +4803,14 @@ gBattleTerrainTable:: @ 831ABA8
.4byte gUnknown_08D7C10C
@ building
.4byte gUnknown_08D7C440
.4byte gBattleTerrainTiles_Building
.4byte gUnknown_08D7CA28
.4byte gUnknown_08D820D4
.4byte gUnknown_08D824E4
.4byte gUnknown_08D7DEB4
@ plain
.4byte gUnknown_08D7C440
.4byte gBattleTerrainTiles_Building
.4byte gUnknown_08D7CA28
.4byte gUnknown_08D820D4
.4byte gUnknown_08D824E4

View File

@ -68,10 +68,10 @@ gUnknown_085B26A4:: @ 85B26A4
gUnknown_085B26F0:: @ 85B26F0
.incbin "baserom.gba", 0x5b26f0, 0x4
gUnknown_085B26F4:: @ 85B26F4
gPokeblockCase_SpriteSheet:: @ 85B26F4
.incbin "baserom.gba", 0x5b26f4, 0x8
gUnknown_085B26FC:: @ 85B26FC
gPokeblockCase_SpritePal:: @ 85B26FC
.incbin "baserom.gba", 0x5b26fc, 0x8
gUnknown_085B2704:: @ 85B2704

View File

@ -331,10 +331,10 @@ gUnknown_08D7C154:: @ 8D7C154
gUnknown_08D7C404:: @ 8D7C404
.incbin "baserom.gba", 0xd7c404, 0x3c
gUnknown_08D7C440:: @ 8D7C440
gBattleTerrainTiles_Building:: @ 8D7C440
.incbin "baserom.gba", 0xd7c440, 0x5ac
gUnknown_08D7C9EC:: @ 8D7C9EC
gBattleTerrainPalette_Frontier:: @ 8D7C9EC
.incbin "baserom.gba", 0xd7c9ec, 0x3c
gUnknown_08D7CA28:: @ 8D7CA28

View File

@ -21,23 +21,23 @@ gUnknown_085F0550:: @ 85F0550
gUnknown_085F0558:: @ 85F0558
.incbin "baserom.gba", 0x5f0558, 0x10
gUnknown_085F0568:: @ 85F0568
sPokeblocksPals:: @ 85F0568
.incbin "baserom.gba", 0x5f0568, 0x48
gUnknown_085F05B0:: @ 85F05B0
sSpriteAffineAnimTable_85F05B0:: @ 85F05B0
.incbin "baserom.gba", 0x5f05b0, 0xb4
gUnknown_085F0664:: @ 85F0664
sSpriteAffineAnimTable_85F0664:: @ 85F0664
.incbin "baserom.gba", 0x5f0664, 0x4
gUnknown_085F0668:: @ 85F0668
sSpriteAffineAnimTable_85F0668:: @ 85F0668
.incbin "baserom.gba", 0x5f0668, 0x4
gUnknown_085F066C:: @ 85F066C
sSpriteAffineAnimTable_85F066C:: @ 85F066C
.incbin "baserom.gba", 0x5f066c, 0x34
gUnknown_085F06A0:: @ 85F06A0
gPokeblock_SpriteSheet:: @ 85F06A0
.incbin "baserom.gba", 0x5f06a0, 0x8
gUnknown_085F06A8:: @ 85F06A8
sThrownPokeblockSpriteTemplate:: @ 85F06A8
.incbin "baserom.gba", 0x5f06a8, 0x18

View File

@ -16,5 +16,9 @@ void sub_812225C(u16 *, u16 *, u8, u8);
void sub_8122298(u16 *, u16 *, u8, u8, u8);
void sub_8121F68(u8 taskId, const struct YesNoFuncTable *data);
bool8 sub_81221AC(void);
void ResetVramOamAndBgCntRegs(void);
void SetVBlankHBlankCallbacksToNull(void);
void ResetAllBgsCoordinates(void);
bool16 RunTextPrintersRetIsActive(u8 textPrinterId);
#endif //GUARD_MENU_HELPERS_H

View File

@ -1,7 +1,8 @@
#ifndef GUARD_PARTY_MENU_H
#define GUARD_PARTY_MENU_H
enum {
enum
{
AILMENT_NONE,
AILMENT_PSN,
AILMENT_PRZ,
@ -14,5 +15,6 @@ bool8 pokemon_has_move(struct Pokemon *, u16);
void sub_81B58A8(void);
void DoWallyTutorialBagMenu(void);
u8 pokemon_ailments_get_primary(u32 status);
u8 *GetMonNickname(struct Pokemon *mon, u8 *dst);
#endif // GUARD_PARTY_MENU_H

View File

@ -1,6 +1,8 @@
#ifndef GUARD_POKEBLOCK_H
#define GUARD_POKEBLOCK_H
#define TAG_POKEBLOCK_GFX 0x39E2
enum
{
PBLOCK_CLR_BLACK,
@ -22,12 +24,22 @@ enum
PBLOCK_FEEL,
};
// use pokeblock
void ChooseMonToGivePokeblock(struct Pokeblock *pokeblock, void (*callback)(void));
// pokeblock feed
void CB2_PreparePokeblockFeedScene(void);
// pokeblock
u8 CreatePokeblockCaseSprite(s16 x, s16 y, u8 subpriority);
u8 GetPokeblockData(const struct Pokeblock *pokeblock, u8 dataId);
void ClearPokeblocks(void);
s8 GetFirstFreePokeblockSlot(void);
bool32 AddPokeblock(struct Pokeblock *pokeblock);
u8 GetHighestPokeblocksFlavorLevel(const struct Pokeblock *pokeblock);
u8 GetPokeblocksFeel(const struct Pokeblock *pokeblock);
u8 GetPokeblocksFlavor(const struct Pokeblock *pokeblock);
s16 PokeblockGetGain(u8, const struct Pokeblock *);
s16 PokeblockGetGain(u8, const struct Pokeblock *pokeblock);
void PokeblockCopyName(const struct Pokeblock *pokeblock, u8 *dst);
#endif // GUARD_POKEBLOCK_H

View File

@ -2,5 +2,15 @@
#define GUARD_POKENAV_H
bool8 sub_81D5C18(void);
bool8 sub_81D20BC(void *arg0);
bool8 sub_81D312C(void *arg0);
void sub_81D1ED4(void *arg0);
void sub_81D2108(void *arg0);
void sub_81D20AC(void *arg0);
void sub_81D2230(void *arg0);
void sub_81D3464(void *arg0);
void sub_81D3480(void *arg0, u8 arg1);
void sub_81D2754(void *arg0, void *arg1);
void sub_81D1F84(void *arg0, void *arg1, void *arg2);
#endif //GUARD_POKENAV_H

View File

@ -84,5 +84,8 @@ extern const u8 gText_RegisteredDataDeleted[];
extern const u8 gUnknown_085EA79D[];
extern const u8 gText_PkmnFainted3[];
extern const u8 gText_Coins[];
extern const u8 gText_Var1AteTheVar2[];
extern const u8 gText_Var1HappilyAteVar2[];
extern const u8 gText_Var1DisdainfullyAteVar2[];
#endif //GUARD_STRINGS_H

View File

@ -3,8 +3,8 @@
struct TilesPal
{
u32* tiles;
u16* pal;
u32 *tiles;
u16 *pal;
};
const struct TilesPal* sub_8098758(u8 id);

View File

@ -222,6 +222,7 @@ SECTIONS {
asm/mystery_event_menu.o(.text);
src/save_failed_screen.o(.text);
src/braille_puzzles.o(.text);
src/pokeblock_feed.o(.text);
asm/pokeblock_feed.o(.text);
src/clear_save_data_screen.o(.text);
asm/intro_credits_graphics.o(.text);

472
src/pokeblock_feed.c Normal file
View File

@ -0,0 +1,472 @@
#include "global.h"
#include "pokeblock.h"
#include "sprite.h"
#include "task.h"
#include "palette.h"
#include "menu.h"
#include "malloc.h"
#include "pokemon.h"
#include "blend_palette.h"
#include "main.h"
#include "menu_helpers.h"
#include "bg.h"
#include "gpu_regs.h"
#include "data2.h"
#include "decompress.h"
#include "event_data.h"
#include "strings.h"
#include "string_util.h"
#include "new_menu_helpers.h"
#include "party_menu.h"
#include "m4a.h"
#include "sound.h"
#include "battle.h" // to get rid of once gMonSpritesGfxPtr is put elsewhere
struct PokeblockFeedStruct
{
u8 field_0[0x48];
u8 tilemapBuffer[0x1008];
u8 field_1050;
u8 field_1051;
u8 field_1052;
bool8 noMonFlip;
u16 species;
u16 field_1056;
u16 field_1058;
u8 nature;
u8 monSpriteId_;
u8 field_105C;
u8 monSpriteId;
u8 pokeblockCaseSpriteId;
u8 pokeblockSpriteId;
u8 field_1060[0x1E];
s16 loadGfxState;
u8 somefield[2];
};
extern u8 gPokeblockMonId;
extern u16 gSpecialVar_ItemId;
extern s16 gPokeblockGain;
extern struct MusicPlayerInfo gMPlay_BGM;
extern struct SpriteTemplate gUnknown_0202499C;
extern struct PokeblockFeedStruct *sPokeblockFeed;
extern struct CompressedSpritePalette sPokeblockSpritePal;
extern bool8 sub_81221EC(void);
extern void sub_806A068(u16, u8);
// this file's functions
static void HandleInitBackgrounds(void);
static void HandleInitWindows(void);
static bool8 LoadMonAndSceneGfx(struct Pokemon *mon);
u8 CreatePokeblockCaseSpriteForFeeding(void);
static u8 CreateMonSprite(struct Pokemon *mon);
void LaunchPokeblockFeedTask(void);
static void SetPokeblockSpritePal(u8 pokeblockCaseId);
void sub_817A5CC(void);
void sub_8148108(u8 spriteId, bool8 a1);
u8 CreatePokeblockSprite(void);
void DoPokeblockCaseThrowEffect(u8 spriteId, bool8 arg1);
static void PrepareMonToMoveToPokeblock(u8 spriteId);
void Task_HandleMonAtePokeblock(u8 taskId);
void Task_PaletteFadeToReturn(u8 taskId);
void sub_817A634(void);
static void sub_817A468(struct Sprite *sprite);
static void CB2_PokeblockFeed(void)
{
RunTasks();
AnimateSprites();
BuildOamBuffer();
do_scheduled_bg_tilemap_copies_to_vram();
UpdatePaletteFade();
}
static void VBlankCB_PokeblockFeed(void)
{
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
}
bool8 TransitionToPokeblockFeedScene(void)
{
switch (gMain.state)
{
case 0:
sPokeblockFeed = AllocZeroed(sizeof(*sPokeblockFeed));
SetVBlankHBlankCallbacksToNull();
clear_scheduled_bg_copies_to_vram();
gMain.state++;
break;
case 1:
ResetPaletteFade();
gPaletteFade.bufferTransferDisabled = 1;
gMain.state++;
break;
case 2:
ResetSpriteData();
gMain.state++;
break;
case 3:
FreeAllSpritePalettes();
gMain.state++;
break;
case 4:
AllocateMonSpritesGfx();
gMain.state++;
break;
case 5:
HandleInitBackgrounds();
gMain.state++;
break;
case 6:
HandleInitWindows();
gMain.state++;
break;
case 7:
if (LoadMonAndSceneGfx(&gPlayerParty[gPokeblockMonId]))
{
gMain.state++;
}
break;
case 8:
sPokeblockFeed->pokeblockCaseSpriteId = CreatePokeblockCaseSpriteForFeeding();
gMain.state++;
break;
case 9:
sPokeblockFeed->monSpriteId = CreateMonSprite(&gPlayerParty[gPokeblockMonId]);
gMain.state++;
break;
case 10:
SetWindowBorderStyle(0, 1, 1, 14);
gMain.state++;
break;
case 11:
LaunchPokeblockFeedTask();
gMain.state++;
break;
case 12:
BlendPalettes(-1, 0x10, 0);
gMain.state++;
break;
case 13:
BeginNormalPaletteFade(-1, 0, 0x10, 0, 0);
gPaletteFade.bufferTransferDisabled = 0;
gMain.state++;
break;
default:
SetVBlankCallback(VBlankCB_PokeblockFeed);
SetMainCallback2(CB2_PokeblockFeed);
return TRUE;
}
return FALSE;
}
void CB2_PreparePokeblockFeedScene(void)
{
while (1)
{
if (sub_81221EC() == TRUE)
break;
if (TransitionToPokeblockFeedScene() == TRUE)
break;
if (sub_81221AC() == TRUE)
break;
}
}
extern const struct BgTemplate gUnknown_085F0550[2];
extern const u8 gBattleTerrainPalette_Frontier[];
extern const u8 gBattleTerrainTiles_Building[];
extern const u8 gUnknown_08D9BA44[];
extern const struct CompressedSpriteSheet gPokeblockCase_SpriteSheet;
extern const struct CompressedSpriteSheet gPokeblock_SpriteSheet;
extern const struct CompressedSpritePalette gPokeblockCase_SpritePal;
extern const struct CompressedSpriteSheet gMonFrontPicTable[];
extern const struct WindowTemplate gUnknown_085F0558[];
extern const u16 gUnknown_0860F074[];
extern const u8 *sPokeblocksPals[];
extern const union AffineAnimCmd * const sSpriteAffineAnimTable_85F05B0[];
extern const union AffineAnimCmd * const sSpriteAffineAnimTable_85F0664[];
extern const union AffineAnimCmd * const sSpriteAffineAnimTable_85F0668[];
extern const union AffineAnimCmd * const sSpriteAffineAnimTable_85F066C[];
extern const struct SpriteTemplate sThrownPokeblockSpriteTemplate;
static void HandleInitBackgrounds(void)
{
ResetVramOamAndBgCntRegs();
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, gUnknown_085F0550, ARRAY_COUNT(gUnknown_085F0550));
SetBgTilemapBuffer(1, sPokeblockFeed->tilemapBuffer);
ResetAllBgsCoordinates();
schedule_bg_copy_tilemap_to_vram(1);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
ShowBg(0);
ShowBg(1);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
}
static bool8 LoadMonAndSceneGfx(struct Pokemon *mon)
{
u16 species;
u32 personality, trainerId;
const struct CompressedSpritePalette *palette;
switch (sPokeblockFeed->loadGfxState)
{
case 0:
species = GetMonData(mon, MON_DATA_SPECIES2);
personality = GetMonData(mon, MON_DATA_PERSONALITY);
HandleLoadSpecialPokePic_2(&gMonFrontPicTable[species], gMonSpritesGfxPtr->sprites[1], species, personality);
sPokeblockFeed->loadGfxState++;
break;
case 1:
species = GetMonData(mon, MON_DATA_SPECIES2);
personality = GetMonData(mon, MON_DATA_PERSONALITY);
trainerId = GetMonData(mon, MON_DATA_OT_ID);
palette = GetMonSpritePalStructFromOtIdPersonality(species, trainerId, personality);
LoadCompressedObjectPalette(palette);
sub_806A068(palette->tag, 1);
sPokeblockFeed->loadGfxState++;
break;
case 2:
LoadCompressedObjectPic(&gPokeblockCase_SpriteSheet);
sPokeblockFeed->loadGfxState++;
break;
case 3:
LoadCompressedObjectPalette(&gPokeblockCase_SpritePal);
sPokeblockFeed->loadGfxState++;
break;
case 4:
LoadCompressedObjectPic(&gPokeblock_SpriteSheet);
sPokeblockFeed->loadGfxState++;
break;
case 5:
SetPokeblockSpritePal(gSpecialVar_ItemId);
LoadCompressedObjectPalette(&sPokeblockSpritePal);
sPokeblockFeed->loadGfxState++;
break;
case 6:
reset_temp_tile_data_buffers();
decompress_and_copy_tile_data_to_vram(1, gBattleTerrainTiles_Building, 0, 0, 0);
sPokeblockFeed->loadGfxState++;
break;
case 7:
if (free_temp_tile_data_buffers_if_possible() != TRUE)
{
LZDecompressWram(gUnknown_08D9BA44, sPokeblockFeed->tilemapBuffer);
sPokeblockFeed->loadGfxState++;
}
break;
case 8:
LoadCompressedPalette(gBattleTerrainPalette_Frontier, 0x20, 0x60);
sPokeblockFeed->loadGfxState = 0;
return TRUE;
}
return FALSE;
}
extern void sub_809882C(u8, u16, u8);
static void HandleInitWindows(void)
{
InitWindows(gUnknown_085F0558);
DeactivateAllTextPrinters();
sub_809882C(0, 1, 0xE0);
LoadPalette(gUnknown_0860F074, 0xF0, 0x20);
FillWindowPixelBuffer(0, 0);
PutWindowTilemap(0);
schedule_bg_copy_tilemap_to_vram(0);
}
static void SetPokeblockSpritePal(u8 pokeblockCaseId)
{
u8 colorId = GetPokeblockData(&gSaveBlock1Ptr->pokeblocks[pokeblockCaseId], PBLOCK_COLOR);
sPokeblockSpritePal.data = sPokeblocksPals[colorId - 1];
sPokeblockSpritePal.tag = TAG_POKEBLOCK_GFX;
}
#define tFrames data[0]
#define tData1 data[1]
void Task_HandlePokeblockFeed(u8 taskId)
{
if (!gPaletteFade.active)
{
switch (gTasks[taskId].tFrames)
{
case 0:
sPokeblockFeed->field_1050 = 0;
sPokeblockFeed->field_1058 = 0;
sub_817A5CC();
break;
case 255:
DoPokeblockCaseThrowEffect(sPokeblockFeed->pokeblockCaseSpriteId, gTasks[taskId].tData1);
break;
case 269:
sPokeblockFeed->pokeblockSpriteId = CreatePokeblockSprite();
break;
case 281:
PrepareMonToMoveToPokeblock(sPokeblockFeed->monSpriteId);
break;
case 297:
gTasks[taskId].func = Task_HandleMonAtePokeblock;
return;
}
if (sPokeblockFeed->field_1058 < sPokeblockFeed->field_1056)
sub_817A634();
else if (sPokeblockFeed->field_1058 == sPokeblockFeed->field_1056)
gTasks[taskId].tFrames = 254;
sPokeblockFeed->field_1058++;
gTasks[taskId].tFrames++;
}
}
void LaunchPokeblockFeedTask(void)
{
u8 taskId = CreateTask(Task_HandlePokeblockFeed, 0);
gTasks[taskId].tFrames = 0;
gTasks[taskId].tData1 = 1;
}
void Task_WaitForAtePokeblockText(u8 taskId)
{
if (RunTextPrintersRetIsActive(0) != TRUE)
gTasks[taskId].func = Task_PaletteFadeToReturn;
}
void Task_HandleMonAtePokeblock(u8 taskId)
{
struct Pokemon *mon = &gPlayerParty[gPokeblockMonId];
struct Pokeblock *pokeblock = &gSaveBlock1Ptr->pokeblocks[gSpecialVar_ItemId];
gPokeblockGain = PokeblockGetGain(GetNature(mon), pokeblock);
GetMonNickname(mon, gStringVar1);
PokeblockCopyName(pokeblock, gStringVar2);
if (gPokeblockGain == 0)
StringExpandPlaceholders(gStringVar4, gText_Var1AteTheVar2);
else if (gPokeblockGain > 0)
StringExpandPlaceholders(gStringVar4, gText_Var1HappilyAteVar2);
else
StringExpandPlaceholders(gStringVar4, gText_Var1DisdainfullyAteVar2);
gTextFlags.flag_0 = 1;
AddTextPrinterParametrized(0, 1, gStringVar4, GetPlayerTextSpeed(), NULL, 2, 1, 3);
gTasks[taskId].func = Task_WaitForAtePokeblockText;
}
void Task_ReturnAfterPaletteFade(u8 taskId)
{
if (!gPaletteFade.active)
{
ResetSpriteData();
FreeAllSpritePalettes();
m4aMPlayVolumeControl(&gMPlay_BGM, -1, 256);
SetMainCallback2(gMain.savedCallback);
DestroyTask(taskId);
FreeAllWindowBuffers();
Free(sPokeblockFeed);
FreeMonSpritesGfx();
}
}
void Task_PaletteFadeToReturn(u8 taskId)
{
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
gTasks[taskId].func = Task_ReturnAfterPaletteFade;
}
static u8 CreateMonSprite(struct Pokemon* mon)
{
u16 species = GetMonData(mon, MON_DATA_SPECIES2);
u8 spriteId = CreateSprite(&gUnknown_0202499C, 48, 80, 2);
sPokeblockFeed->species = species;
sPokeblockFeed->monSpriteId_ = spriteId;
sPokeblockFeed->nature = GetNature(mon);
gSprites[spriteId].data2 = species;
gSprites[spriteId].callback = SpriteCallbackDummy;
sPokeblockFeed->noMonFlip = TRUE;
if (!IsPokeSpriteNotFlipped(species))
{
gSprites[spriteId].affineAnims = sSpriteAffineAnimTable_85F05B0;
gSprites[spriteId].oam.affineMode = 3;
CalcCenterToCornerVec(&gSprites[spriteId], gSprites[spriteId].oam.shape, gSprites[spriteId].oam.size, gSprites[spriteId].oam.affineMode);
sPokeblockFeed->noMonFlip = FALSE;
}
return spriteId;
}
static void PrepareMonToMoveToPokeblock(u8 spriteId)
{
gSprites[spriteId].pos1.x = 48;
gSprites[spriteId].pos1.y = 80;
gSprites[spriteId].data0 = -8;
gSprites[spriteId].data1 = 1;
gSprites[spriteId].callback = sub_817A468;
}
static void sub_817A468(struct Sprite* sprite)
{
sprite->pos1.x += 4;
sprite->pos1.y += sprite->data0;
sprite->data0 += sprite->data1;
if (sprite->data0 == 0)
PlayCry1(sprite->data2, 0);
if (sprite->data0 == 9)
sprite->callback = SpriteCallbackDummy;
}
u8 CreatePokeblockCaseSpriteForFeeding(void)
{
u8 spriteId = CreatePokeblockCaseSprite(188, 100, 2);
gSprites[spriteId].oam.affineMode = 1;
gSprites[spriteId].affineAnims = sSpriteAffineAnimTable_85F0664;
gSprites[spriteId].callback = SpriteCallbackDummy;
InitSpriteAffineAnim(&gSprites[spriteId]);
return spriteId;
}
void DoPokeblockCaseThrowEffect(u8 spriteId, bool8 a1)
{
FreeOamMatrix(gSprites[spriteId].oam.matrixNum);
gSprites[spriteId].oam.affineMode = 3;
if (!a1)
gSprites[spriteId].affineAnims = sSpriteAffineAnimTable_85F0668;
else
gSprites[spriteId].affineAnims = sSpriteAffineAnimTable_85F066C;
InitSpriteAffineAnim(&gSprites[spriteId]);
}
u8 CreatePokeblockSprite(void)
{
u8 spriteId = CreateSprite(&sThrownPokeblockSpriteTemplate, 174, 84, 1);
gSprites[spriteId].data0 = -12;
gSprites[spriteId].data1 = 1;
return spriteId;
}
static void SpriteCB_ThrownPokeblock(struct Sprite* sprite)
{
sprite->pos1.x -= 4;
sprite->pos1.y += sprite->data0;
sprite->data0 += sprite->data1;
if (sprite->data0 == 10)
DestroySprite(sprite);
}

View File

@ -73,7 +73,7 @@ extern void do_scheduled_bg_tilemap_copies_to_vram(void);
extern u8 sub_81221EC();
extern u8 sub_81221AC();
extern void SetVBlankHBlankCallbacksToNull();
extern void sub_8121DA0();
extern void ResetVramOamAndBgCntRegs();
extern void clear_scheduled_bg_copies_to_vram();
extern void remove_some_task();
extern void ResetBgsAndClearDma3BusyFlags(u32 leftoverFireRedLeafGreenVariable);
@ -193,7 +193,7 @@ void sub_81C4A88();
void sub_81C4280();
void sub_81C0510(u8 taskId);
void sub_81C171C(u8 taskId);
void sub_8121E10();
void ResetAllBgsCoordinates();
u8 sub_81B205C(struct Pokemon* a);
void sub_81C1DA4(u16 a, s16 b);
void sub_81C1EFC(u16 a, s16 b, u16 c);
@ -450,7 +450,7 @@ bool8 sub_81BFB10(void)
{
case 0:
SetVBlankHBlankCallbacksToNull();
sub_8121DA0();
ResetVramOamAndBgCntRegs();
clear_scheduled_bg_copies_to_vram();
gMain.state++;
break;
@ -578,7 +578,7 @@ void sub_81BFE24()
SetBgTilemapBuffer(1, &gUnknown_0203CF1C->unkTilemap2);
SetBgTilemapBuffer(2, &gUnknown_0203CF1C->unkTilemap1);
SetBgTilemapBuffer(3, &gUnknown_0203CF1C->unkTilemap0);
sub_8121E10();
ResetAllBgsCoordinates();
schedule_bg_copy_tilemap_to_vram(1);
schedule_bg_copy_tilemap_to_vram(2);
schedule_bg_copy_tilemap_to_vram(3);

View File

@ -2,29 +2,69 @@
#include "main.h"
#include "pokeblock.h"
#include "malloc.h"
#include "palette.h"
#include "pokenav.h"
#include "unknown_task.h"
#include "text.h"
#include "bg.h"
#include "window.h"
#include "text_window.h"
struct UsePokeblockSubStruct
{
void *field_0;
void (*field_0)(void);
void (*callback)(void);
struct Pokeblock *pokeblock;
struct Pokemon *pokemon;
u8 stringBuffer[0x40];
u8 field_50;
u8 field_51;
u8 field_52;
u8 field_53;
u8 field_54;
u8 field_55;
u8 field_56;
u8 field_57[5];
u8 field_5c[5];
u8 field_61[5];
s16 field_66[5];
};
struct UsePokeblockStruct1
struct UsePokeblockStruct
{
u8 field_0[0x7FD0];
u8 field_0[0x7C58];
u8 field_7C58[0x378];
struct UsePokeblockSubStruct info;
};
extern struct UsePokeblockStruct1 *gUnknown_0203BCAC;
extern struct UsePokeblockStruct *gUnknown_0203BCAC;
extern struct UsePokeblockSubStruct *gUnknown_0203BC90;
extern struct Pokeblock *gUnknown_0203BC98;
extern void (*gUnknown_0203BC94)(void);
extern u8 gPokeblockMonId;
extern u16 gKeyRepeatStartDelay;
// this file's functions
void sub_816636C(void *arg0);
void sub_816636C(void (*func)(void));
void sub_8166380(void);
void sub_816631C(void);
void sub_81662C0(void);
void sub_8166564(void);
void sub_8166304(void);
void sub_81668F8(void);
void sub_8167420(void);
void sub_8167760(void);
u8 sub_81672E4(u8 arg0);
bool8 sub_8168328(void);
bool8 sub_8167930(void);
void sub_8167608(u8 arg0);
void sub_8167BA0(u16 arg0, u8 copyToVramMode);
void sub_8166204(struct Pokeblock *pokeblock, void (*callback)(void))
extern const struct BgTemplate gUnknown_085DFCCC[4];
extern const struct WindowTemplate gUnknown_085DFCDC[];
void ChooseMonToGivePokeblock(struct Pokeblock *pokeblock, void (*callback)(void))
{
gUnknown_0203BCAC = AllocZeroed(0x806C);
gUnknown_0203BC90 = &gUnknown_0203BCAC->info;
@ -33,3 +73,149 @@ void sub_8166204(struct Pokeblock *pokeblock, void (*callback)(void))
sub_816636C(sub_8166380);
SetMainCallback2(sub_816631C);
}
void CB2_ReturnAndChooseMonToGivePokeblock(void)
{
gUnknown_0203BCAC = AllocZeroed(0x806C);
gUnknown_0203BC90 = &gUnknown_0203BCAC->info;
gUnknown_0203BC90->pokeblock = gUnknown_0203BC98;
gUnknown_0203BC90->callback = gUnknown_0203BC94;
gPokeblockMonId = sub_81672E4(gPokeblockMonId);
gUnknown_0203BC90->field_56 = gPokeblockMonId < 4 ? 0 : 1;
sub_816636C(sub_8166380);
SetMainCallback2(sub_81662C0);
}
void sub_81662C0(void)
{
gUnknown_0203BC90->field_0();
AnimateSprites();
BuildOamBuffer();
UpdatePaletteFade();
if (gUnknown_0203BC90->field_0 == sub_8166564)
{
gUnknown_0203BC90->field_50 = 0;
SetMainCallback2(sub_8166304);
}
}
void sub_8166304(void)
{
sub_81668F8();
AnimateSprites();
BuildOamBuffer();
UpdatePaletteFade();
}
void sub_816631C(void)
{
gUnknown_0203BC90->field_0();
AnimateSprites();
BuildOamBuffer();
RunTextPrinters();
UpdatePaletteFade();
}
void sub_8166340(void)
{
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
sub_81D2108(gUnknown_0203BCAC->field_7C58);
sub_80BA0A8();
}
void sub_816636C(void (*func)(void))
{
gUnknown_0203BC90->field_0 = func;
gUnknown_0203BC90->field_50 = 0;
}
void sub_8166380(void)
{
switch (gUnknown_0203BC90->field_50)
{
case 0:
gUnknown_0203BCAC->field_0[0x7B10] = 0xFF;
sub_81D1ED4(gUnknown_0203BCAC->field_7C58);
gUnknown_0203BC90->field_50++;
break;
case 1:
ResetSpriteData();
FreeAllSpritePalettes();
gUnknown_0203BC90->field_50++;
break;
case 2:
SetVBlankCallback(NULL);
CpuFill32(0, (void*)(VRAM), VRAM_SIZE);
gUnknown_0203BC90->field_50++;
break;
case 3:
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, gUnknown_085DFCCC, ARRAY_COUNT(gUnknown_085DFCCC));
InitWindows(gUnknown_085DFCDC);
DeactivateAllTextPrinters();
sub_809882C(0, 0x97, 0xE0);
gUnknown_0203BC90->field_50++;
break;
case 4:
gUnknown_0203BC90->field_50++;
break;
case 5:
if (!sub_8168328())
{
gUnknown_0203BC90->field_50++;
}
break;
case 6:
gKeyRepeatStartDelay = 20;
sub_8167420();
gUnknown_0203BC90->field_50++;
break;
case 7:
if (!sub_8167930())
{
gUnknown_0203BC90->field_50++;
}
break;
case 8:
sub_8167608(0);
sub_8167760();
gUnknown_0203BC90->field_50++;
break;
case 9:
if (!sub_81D312C(&gUnknown_0203BCAC->field_0[0x7B0E]))
{
gUnknown_0203BC90->field_50++;
}
break;
case 10:
gUnknown_0203BC90->field_50++;
break;
case 11:
sub_81D2754(gUnknown_0203BCAC->field_7C58, &gUnknown_0203BCAC->field_0[0x7C6C]);
sub_81D20AC(gUnknown_0203BCAC->field_7C58);
gUnknown_0203BC90->field_50++;
break;
case 12:
if (!sub_81D20BC(gUnknown_0203BCAC->field_7C58))
{
sub_81D1F84(gUnknown_0203BCAC->field_7C58, &gUnknown_0203BCAC->field_7C58[0x14], &gUnknown_0203BCAC->field_7C58[0x14]);
gUnknown_0203BC90->field_50++;
}
break;
case 13:
sub_81D2230(gUnknown_0203BCAC->field_7C58);
gUnknown_0203BC90->field_50++;
break;
case 14:
PutWindowTilemap(0);
PutWindowTilemap(1);
sub_8167BA0(0, 1);
gUnknown_0203BC90->field_50++;
break;
case 15:
sub_816636C(sub_8166564);
break;
}
}

View File

@ -1315,10 +1315,10 @@ gUnknown_0203BC94: @ 203BC94
gUnknown_0203BC98: @ 203BC98
.space 0x4
gUnknown_0203BC9C: @ 203BC9C
gPokeblockMonId: @ 203BC9C
.space 0x2
gUnknown_0203BC9E: @ 203BC9E
gPokeblockGain: @ 203BC9E
.space 0x2
gUnknown_0203BCA0: @ 203BCA0
@ -1393,10 +1393,10 @@ gUnknown_0203BCF8: @ 203BCF8
gBraillePuzzleCallbackFlag: @ 203BD14
.space 0x4
gUnknown_0203BD18: @ 203BD18
sPokeblockFeed: @ 203BD18
.space 0x4
gUnknown_0203BD1C: @ 203BD1C
sPokeblockSpritePal: @ 203BD1C
.space 0x8
gUnknown_0203BD24: @ 203BD24