Resolve conflicts

This commit is contained in:
KDSKardabox 2018-03-19 16:15:13 +05:30
commit f9f64fff42
28 changed files with 3048 additions and 4309 deletions

View File

@ -4894,7 +4894,7 @@ sub_813A46C: @ 813A46C
lsrs r0, 24
mov r1, sp
movs r2, 0
bl sub_81AE860
bl ListMenuGetScrollAndRow
ldr r1, =gUnknown_0203AB68
mov r0, sp
ldrh r0, [r0]
@ -4903,7 +4903,7 @@ sub_813A46C: @ 813A46C
lsls r0, 24
lsrs r0, 24
mov r1, sp
bl sub_81AE838
bl ListMenuGetCurrentItemArrayId
ldrh r0, [r4, 0x1E]
ldr r5, =gUnknown_0203AB6A
ldrh r1, [r5]
@ -5007,7 +5007,7 @@ sub_813A570: @ 813A570
lsls r0, 24
lsrs r0, 24
mov r1, sp
bl sub_81AE838
bl ListMenuGetCurrentItemArrayId
ldrh r0, [r4, 0x1E]
mov r1, sp
ldrh r1, [r1]
@ -5019,7 +5019,7 @@ sub_813A570: @ 813A570
lsrs r0, 24
movs r1, 0
movs r2, 0
bl sub_81AE6C8
bl DestroyListMenuTask
ldr r0, =gUnknown_0203AB64
ldr r0, [r0]
bl Free
@ -6012,7 +6012,7 @@ sub_813ADD4: @ 813ADD4
adds r4, 0x16
add r1, sp, 0x14
adds r2, r4, 0
bl sub_81AE860
bl ListMenuGetScrollAndRow
ldrh r0, [r6, 0x22]
lsls r0, 24
lsrs r0, 24
@ -6173,7 +6173,7 @@ sub_813AF48: @ 813AF48
lsrs r0, 24
movs r1, 0
movs r2, 0
bl sub_81AE6C8
bl DestroyListMenuTask
ldr r0, =gUnknown_0203AB64
ldr r0, [r0]
bl Free

View File

@ -1,637 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start RemoveBagObject
@ void RemoveBagObject(u8 a1)
RemoveBagObject: @ 80D4CA8
push {r4,r5,lr}
lsls r0, 24
lsrs r4, r0, 24
ldr r0, =gUnknown_0203CE54
ldr r2, =0x00000804
adds r1, r4, r2
ldr r0, [r0]
adds r5, r0, r1
ldrb r0, [r5]
cmp r0, 0xFF
beq _080D4CEE
adds r4, 0x64
adds r0, r4, 0
bl FreeSpriteTilesByTag
adds r0, r4, 0
bl FreeSpritePaletteByTag
ldrb r1, [r5]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
ldr r4, =gSprites
adds r0, r4
bl FreeSpriteOamMatrix
ldrb r1, [r5]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r4
bl DestroySprite
movs r0, 0xFF
strb r0, [r5]
_080D4CEE:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end RemoveBagObject
thumb_func_start AddBagVisualObject
@ void AddBagVisualObject(u8 bagPocketId)
AddBagVisualObject: @ 80D4D00
push {r4,r5,lr}
adds r5, r0, 0
lsls r5, 24
lsrs r5, 24
ldr r0, =gUnknown_0203CE54
ldr r4, [r0]
ldr r0, =0x00000804
adds r4, r0
ldr r0, =gUnknown_0857FB4C
movs r1, 0x44
movs r2, 0x42
movs r3, 0
bl CreateSprite
strb r0, [r4]
adds r0, r5, 0
movs r1, 0
bl SetBagVisualPocketId
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end AddBagVisualObject
thumb_func_start SetBagVisualPocketId
@ void SetBagVisualPocketId(u8 bagPocketId, bool8 isSwitchingPockets)
SetBagVisualPocketId: @ 80D4D38
push {lr}
lsls r0, 24
lsrs r3, r0, 24
lsls r1, 24
ldr r0, =gUnknown_0203CE54
ldr r0, [r0]
ldr r2, =0x00000804
adds r0, r2
ldrb r2, [r0]
lsls r0, r2, 4
adds r0, r2
lsls r0, 2
ldr r2, =gSprites
adds r2, r0, r2
cmp r1, 0
beq _080D4D84
ldr r0, =0x0000fffb
strh r0, [r2, 0x26]
ldr r0, =ObjectCB_BagVisualSwitchingPockets
str r0, [r2, 0x1C]
adds r0, r3, 0x1
strh r0, [r2, 0x2E]
adds r0, r2, 0
movs r1, 0
bl StartSpriteAnim
b _080D4D90
.pool
_080D4D84:
adds r1, r3, 0x1
lsls r1, 24
lsrs r1, 24
adds r0, r2, 0
bl StartSpriteAnim
_080D4D90:
pop {r0}
bx r0
thumb_func_end SetBagVisualPocketId
thumb_func_start ObjectCB_BagVisualSwitchingPockets
@ void ObjectCB_BagVisualSwitchingPockets(struct obj *object)
ObjectCB_BagVisualSwitchingPockets: @ 80D4D94
push {r4,lr}
adds r4, r0, 0
ldrh r1, [r4, 0x26]
movs r2, 0x26
ldrsh r0, [r4, r2]
cmp r0, 0
beq _080D4DA8
adds r0, r1, 0x1
strh r0, [r4, 0x26]
b _080D4DB8
_080D4DA8:
ldrh r1, [r4, 0x2E]
lsls r1, 24
lsrs r1, 24
adds r0, r4, 0
bl StartSpriteAnim
ldr r0, =SpriteCallbackDummy
str r0, [r4, 0x1C]
_080D4DB8:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end ObjectCB_BagVisualSwitchingPockets
thumb_func_start ShakeBagVisual
@ void ShakeBagVisual()
ShakeBagVisual: @ 80D4DC4
push {r4,lr}
ldr r0, =gUnknown_0203CE54
ldr r0, [r0]
ldr r1, =0x00000804
adds r0, r1
ldrb r1, [r0]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
ldr r1, =gSprites
adds r4, r0, r1
adds r0, r4, 0
adds r0, 0x3F
ldrb r1, [r0]
movs r0, 0x20
ands r0, r1
cmp r0, 0
beq _080D4DF4
adds r0, r4, 0
movs r1, 0x1
bl StartSpriteAffineAnim
ldr r0, =ObjectCB_ShakeBagVisual
str r0, [r4, 0x1C]
_080D4DF4:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end ShakeBagVisual
thumb_func_start ObjectCB_ShakeBagVisual
@ void ObjectCB_ShakeBagVisual(struct obj *object)
ObjectCB_ShakeBagVisual: @ 80D4E0C
push {r4,lr}
adds r4, r0, 0
adds r0, 0x3F
ldrb r1, [r0]
movs r0, 0x20
ands r0, r1
cmp r0, 0
beq _080D4E28
adds r0, r4, 0
movs r1, 0
bl StartSpriteAffineAnim
ldr r0, =SpriteCallbackDummy
str r0, [r4, 0x1C]
_080D4E28:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end ObjectCB_ShakeBagVisual
thumb_func_start AddSwitchPocketRotatingBallObject
@ void AddSwitchPocketRotatingBallObject(u16 rotationDirection)
AddSwitchPocketRotatingBallObject: @ 80D4E34
push {r4,r5,lr}
adds r5, r0, 0
lsls r5, 16
lsrs r5, 16
ldr r0, =gUnknown_0203CE54
ldr r4, [r0]
ldr r0, =0x00000805
adds r4, r0
ldr r0, =gUnknown_0857FBA0
bl LoadSpriteSheet
ldr r0, =gUnknown_0857FBA8
bl LoadSpritePalette
ldr r0, =gUnknown_0857FBB0
movs r1, 0x10
movs r2, 0x10
movs r3, 0
bl CreateSprite
strb r0, [r4]
ldr r2, =gSprites
ldrb r1, [r4]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
adds r0, r2
strh r5, [r0, 0x2E]
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end AddSwitchPocketRotatingBallObject
thumb_func_start update_switch_pocket_rotating_ball_coords
@ void update_switch_pocket_rotating_ball_coords(struct obj *object)
update_switch_pocket_rotating_ball_coords: @ 80D4E8C
ldrh r2, [r0, 0x30]
ldrh r1, [r0, 0x34]
adds r1, 0x1
movs r3, 0x1
ands r1, r3
subs r2, r1
adds r1, r0, 0
adds r1, 0x28
strb r2, [r1]
ldrh r2, [r0, 0x30]
ldrh r1, [r0, 0x34]
adds r1, 0x1
ands r1, r3
subs r2, r1
adds r0, 0x29
strb r2, [r0]
bx lr
thumb_func_end update_switch_pocket_rotating_ball_coords
thumb_func_start ObjectCB_SwitchPocketRotatingBallInit
@ void ObjectCB_SwitchPocketRotatingBallInit(struct obj *object)
ObjectCB_SwitchPocketRotatingBallInit: @ 80D4EB0
push {r4,lr}
adds r4, r0, 0
ldrb r1, [r4, 0x1]
movs r0, 0x4
negs r0, r0
ands r0, r1
movs r1, 0x1
orrs r0, r1
strb r0, [r4, 0x1]
movs r0, 0x2E
ldrsh r1, [r4, r0]
movs r0, 0x1
negs r0, r0
cmp r1, r0
bne _080D4ED8
ldr r0, =gUnknown_0857FB98
b _080D4EDA
.pool
_080D4ED8:
ldr r0, =gUnknown_0857FB9C
_080D4EDA:
str r0, [r4, 0x10]
adds r0, r4, 0
bl InitSpriteAffineAnim
adds r0, r4, 0
adds r0, 0x28
ldrb r0, [r0]
lsls r0, 24
asrs r0, 24
strh r0, [r4, 0x30]
adds r0, r4, 0
adds r0, 0x29
ldrb r0, [r0]
lsls r0, 24
asrs r0, 24
strh r0, [r4, 0x30]
adds r0, r4, 0
bl update_switch_pocket_rotating_ball_coords
ldr r0, =ObjectCB_SwitchPocketRotatingBallContinue
str r0, [r4, 0x1C]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end ObjectCB_SwitchPocketRotatingBallInit
thumb_func_start ObjectCB_SwitchPocketRotatingBallContinue
@ void ObjectCB_SwitchPocketRotatingBallContinue(struct obj *object)
ObjectCB_SwitchPocketRotatingBallContinue: @ 80D4F14
push {r4,lr}
adds r4, r0, 0
ldrh r0, [r4, 0x34]
adds r0, 0x1
strh r0, [r4, 0x34]
adds r0, r4, 0
bl update_switch_pocket_rotating_ball_coords
movs r1, 0x34
ldrsh r0, [r4, r1]
cmp r0, 0x10
bne _080D4F32
movs r0, 0x1
bl RemoveBagObject
_080D4F32:
pop {r4}
pop {r0}
bx r0
thumb_func_end ObjectCB_SwitchPocketRotatingBallContinue
thumb_func_start AddBagItemIconObject
@ void AddBagItemIconObject(u16 itemId, u8 a2)
AddBagItemIconObject: @ 80D4F38
push {r4-r6,lr}
lsls r0, 16
lsrs r6, r0, 16
lsls r1, 24
lsrs r4, r1, 24
ldr r0, =gUnknown_0203CE54
ldr r2, =0x00000806
adds r1, r4, r2
ldr r0, [r0]
adds r5, r0, r1
ldrb r0, [r5]
cmp r0, 0xFF
bne _080D4F86
adds r4, 0x66
adds r0, r4, 0
bl FreeSpriteTilesByTag
adds r0, r4, 0
bl FreeSpritePaletteByTag
adds r0, r4, 0
adds r1, r4, 0
adds r2, r6, 0
bl AddItemIconSprite
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0x40
beq _080D4F86
strb r2, [r5]
ldr r1, =gSprites
lsls r0, r2, 4
adds r0, r2
lsls r0, 2
adds r0, r1
movs r1, 0x18
strh r1, [r0, 0x24]
movs r1, 0x58
strh r1, [r0, 0x26]
_080D4F86:
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end AddBagItemIconObject
thumb_func_start RemoveBagItemIconObject
@ void RemoveBagItemIconObject(u8 a1)
RemoveBagItemIconObject: @ 80D4F98
push {lr}
lsls r0, 24
movs r1, 0x80
lsls r1, 18
adds r0, r1
lsrs r0, 24
bl RemoveBagObject
pop {r0}
bx r0
thumb_func_end RemoveBagItemIconObject
thumb_func_start sub_80D4FAC
sub_80D4FAC: @ 80D4FAC
push {lr}
ldr r0, =gUnknown_0203CE54
ldr r0, [r0]
ldr r1, =0x00000808
adds r0, r1
movs r1, 0x8
bl sub_8122344
pop {r0}
bx r0
.pool
thumb_func_end sub_80D4FAC
thumb_func_start sub_80D4FC8
sub_80D4FC8: @ 80D4FC8
push {lr}
adds r2, r0, 0
lsls r2, 24
lsrs r2, 24
ldr r0, =gUnknown_0203CE54
ldr r0, [r0]
ldr r1, =0x00000808
adds r0, r1
movs r1, 0x8
bl sub_81223FC
pop {r0}
bx r0
.pool
thumb_func_end sub_80D4FC8
thumb_func_start sub_80D4FEC
sub_80D4FEC: @ 80D4FEC
push {lr}
adds r3, r0, 0
lsls r3, 24
ldr r0, =gUnknown_0203CE54
ldr r0, [r0]
ldr r1, =0x00000808
adds r0, r1
lsrs r3, 4
movs r1, 0x80
lsls r1, 13
adds r3, r1
lsrs r3, 16
movs r1, 0x88
movs r2, 0x78
bl sub_8122448
pop {r0}
bx r0
.pool
thumb_func_end sub_80D4FEC
thumb_func_start sub_80D5018
sub_80D5018: @ 80D5018
push {r4-r7,lr}
mov r7, r8
push {r7}
adds r6, r0, 0
adds r4, r1, 0
movs r2, 0x80
lsls r2, 4
adds r0, r4, 0
movs r1, 0
bl memset
movs r0, 0x80
lsls r0, 1
adds r4, r0
movs r7, 0
_080D5036:
adds r4, 0x20
movs r5, 0
adds r1, r7, 0x1
mov r8, r1
_080D503E:
adds r0, r4, 0
adds r1, r6, 0
movs r2, 0x20
bl memcpy
adds r4, 0x20
adds r6, 0x20
adds r0, r5, 0x1
lsls r0, 24
lsrs r5, r0, 24
cmp r5, 0x5
bls _080D503E
cmp r7, 0x5
beq _080D505C
adds r4, 0x20
_080D505C:
mov r1, r8
lsls r0, r1, 24
lsrs r7, r0, 24
cmp r7, 0x5
bls _080D5036
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_80D5018
thumb_func_start sub_80D5070
sub_80D5070: @ 80D5070
push {r4,r5,lr}
sub sp, 0x8
lsls r0, 24
lsrs r0, 24
adds r4, r0, 0
cmp r4, 0x2A
bne _080D5082
bl IsEnigmaBerryValid
_080D5082:
ldr r5, =gBerryPicTable
lsls r4, 3
adds r0, r5, 0x4
adds r0, r4, r0
ldr r0, [r0]
str r0, [sp]
ldr r1, =0xffff0000
ldr r0, [sp, 0x4]
ands r0, r1
ldr r1, =0x00007544
orrs r0, r1
str r0, [sp, 0x4]
mov r0, sp
bl LoadCompressedObjectPalette
adds r4, r5
ldr r0, [r4]
ldr r4, =0x0201d000
adds r1, r4, 0
bl LZDecompressWram
ldr r0, =0xfffff000
adds r1, r4, r0
adds r0, r4, 0
bl sub_80D5018
add sp, 0x8
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80D5070
thumb_func_start CreateBerryTagSprite
CreateBerryTagSprite: @ 80D50D4
push {r4,r5,lr}
adds r4, r1, 0
adds r5, r2, 0
lsls r0, 24
lsrs r0, 24
lsls r4, 16
lsrs r4, 16
lsls r5, 16
lsrs r5, 16
bl sub_80D5070
ldr r0, =gUnknown_0857FBEC
lsls r4, 16
asrs r4, 16
lsls r5, 16
asrs r5, 16
adds r1, r4, 0
adds r2, r5, 0
movs r3, 0
bl CreateSprite
lsls r0, 24
lsrs r0, 24
pop {r4,r5}
pop {r1}
bx r1
.pool
thumb_func_end CreateBerryTagSprite
thumb_func_start FreeBerryTagSpritePalette
FreeBerryTagSpritePalette: @ 80D510C
push {lr}
ldr r0, =0x00007544
bl FreeSpritePaletteByTag
pop {r0}
bx r0
.pool
thumb_func_end FreeBerryTagSpritePalette
thumb_func_start sub_80D511C
sub_80D511C: @ 80D511C
push {r4-r6,lr}
mov r6, r8
push {r6}
adds r4, r0, 0
adds r5, r1, 0
adds r6, r2, 0
mov r8, r3
lsls r4, 24
lsrs r4, 24
lsls r5, 24
lsrs r5, 24
lsls r6, 24
lsrs r6, 24
mov r0, r8
lsls r0, 24
lsrs r0, 24
mov r8, r0
ldr r0, =0x00007544
bl FreeSpritePaletteByTag
adds r0, r4, 0
bl sub_80D5070
ldr r0, =gUnknown_0857FC7C
adds r1, r5, 0
adds r2, r6, 0
movs r3, 0
bl CreateSprite
lsls r0, 24
lsrs r1, r0, 24
adds r4, r1, 0
mov r0, r8
cmp r0, 0x1
bne _080D5172
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
ldr r1, =gSprites
adds r0, r1
movs r1, 0x1
bl StartSpriteAffineAnim
_080D5172:
adds r0, r4, 0
pop {r3}
mov r8, r3
pop {r4-r6}
pop {r1}
bx r1
.pool
thumb_func_end sub_80D511C
thumb_func_start CreateBerryFlavorCircleSprite
CreateBerryFlavorCircleSprite: @ 80D518C
push {lr}
adds r1, r0, 0
ldr r0, =gUnknown_0857FE10
lsls r1, 16
asrs r1, 16
movs r2, 0x74
movs r3, 0
bl CreateSprite
lsls r0, 24
lsrs r0, 24
pop {r1}
bx r1
.pool
thumb_func_end CreateBerryFlavorCircleSprite
.align 2, 0 @ Don't pad with nop.

View File

@ -903,7 +903,7 @@ sub_8160EA0: @ 8160EA0
ldrb r0, [r0]
ldr r1, =gUnknown_0203BC38
adds r2, r1, 0x2
bl sub_81AE6C8
bl DestroyListMenuTask
bl FreeAllWindowBuffers
ldr r0, [r4]
bl Free
@ -988,7 +988,7 @@ sub_8160F50: @ 8160F50
ldr r4, =gUnknown_0203BC38
adds r2, r4, 0x2
adds r1, r4, 0
bl sub_81AE860
bl ListMenuGetScrollAndRow
movs r0, 0x2
negs r0, r0
cmp r5, r0

File diff suppressed because it is too large Load Diff

View File

@ -3469,7 +3469,7 @@ sub_81C5B4C: @ 81C5B4C
ldr r4, =gUnknown_0203CF38
subs r2, r4, 0x2
adds r1, r4, 0
bl sub_81AE6C8
bl DestroyListMenuTask
ldr r0, =gUnknown_0203CF2C
ldr r0, [r0]
ldr r0, [r0]
@ -3545,7 +3545,7 @@ _081C5C12:
adds r1, r4, 0
adds r1, 0x8
adds r2, r4, 0x6
bl sub_81AE860
bl ListMenuGetScrollAndRow
ldrh r1, [r4, 0x8]
ldrh r0, [r4, 0x6]
adds r1, r0
@ -3572,7 +3572,7 @@ _081C5C5C:
mov r8, r1
mov r2, r8
subs r2, 0x2
bl sub_81AE860
bl ListMenuGetScrollAndRow
movs r0, 0x2
negs r0, r0
cmp r6, r0
@ -4642,7 +4642,7 @@ sub_81C65CC: @ 81C65CC
ldrb r0, [r4]
adds r1, r6, 0
adds r2, r7, 0
bl sub_81AE6C8
bl DestroyListMenuTask
bl sub_81C5924
bl sub_81C59BC
bl sub_81C5314
@ -4953,7 +4953,7 @@ sub_81C68B0: @ 81C68B0
ldrb r0, [r4]
ldr r1, =gUnknown_0203CF38
subs r2, r1, 0x2
bl sub_81AE860
bl ListMenuGetScrollAndRow
b _081C6940
.pool
_081C68F8:
@ -4964,7 +4964,7 @@ _081C68F8:
ldr r4, =gUnknown_0203CF38
subs r2, r4, 0x2
adds r1, r4, 0
bl sub_81AE860
bl ListMenuGetScrollAndRow
movs r0, 0
bl sub_81C7028
subs r4, 0x8
@ -5054,7 +5054,7 @@ _081C69A8:
ldrb r0, [r5]
adds r1, r7, 0
mov r2, r8
bl sub_81AE6C8
bl DestroyListMenuTask
movs r3, 0x2
ldrsh r0, [r5, r3]
cmp r0, r4
@ -5109,7 +5109,7 @@ sub_81C6A14: @ 81C6A14
ldrb r0, [r4]
adds r1, r5, 0
adds r2, r7, 0
bl sub_81AE6C8
bl DestroyListMenuTask
movs r0, 0x2
ldrsh r2, [r4, r0]
ldrh r0, [r5]

View File

@ -1192,7 +1192,7 @@ sub_8012F64: @ 8012F64
ldrb r0, [r4, 0x12]
movs r1, 0
movs r2, 0
bl sub_81AE6C8
bl DestroyListMenuTask
ldrb r0, [r4, 0x10]
bl ClearWindowTilemap
ldrb r0, [r4, 0xF]
@ -2394,7 +2394,7 @@ _08013A8C:
ldrb r0, [r6, 0xE]
movs r1, 0
movs r2, 0
bl sub_81AE6C8
bl DestroyListMenuTask
ldrb r0, [r6, 0xC]
bl ClearWindowTilemap
ldrb r0, [r6, 0xB]
@ -4511,7 +4511,7 @@ _08014E16:
ldrb r0, [r5, 0x12]
movs r1, 0
movs r2, 0
bl sub_81AE6C8
bl DestroyListMenuTask
movs r0, 0
bl CopyBgTilemapBufferToVram
ldrb r0, [r5, 0xF]
@ -4567,7 +4567,7 @@ _08014EA8:
ldrb r0, [r5, 0x12]
movs r1, 0
movs r2, 0
bl sub_81AE6C8
bl DestroyListMenuTask
movs r0, 0
bl CopyBgTilemapBufferToVram
ldrb r0, [r5, 0xF]
@ -4923,7 +4923,7 @@ _08015204:
ldrb r0, [r7, 0xE]
movs r1, 0
movs r2, 0
bl sub_81AE6C8
bl DestroyListMenuTask
movs r0, 0
bl CopyBgTilemapBufferToVram
ldrb r0, [r7, 0xD]
@ -5292,7 +5292,7 @@ _08015564:
ldrb r0, [r5, 0xE]
movs r1, 0
movs r2, 0
bl sub_81AE6C8
bl DestroyListMenuTask
movs r0, 0
bl CopyBgTilemapBufferToVram
ldrb r0, [r5, 0xB]
@ -8545,7 +8545,7 @@ _08017228:
ldrb r0, [r4]
movs r1, 0
movs r2, 0
bl sub_81AE6C8
bl DestroyListMenuTask
ldrb r0, [r5]
movs r1, 0x1
bl sub_819746C
@ -8565,7 +8565,7 @@ _08017264:
ldrb r0, [r6]
movs r1, 0
movs r2, 0
bl sub_81AE6C8
bl DestroyListMenuTask
ldrb r0, [r5]
movs r1, 0x1
bl sub_819746C
@ -8669,7 +8669,7 @@ _0801733E:
ldrb r0, [r4]
movs r1, 0
movs r2, 0
bl sub_81AE6C8
bl DestroyListMenuTask
ldrb r0, [r6]
bl RemoveWindow
mov r7, r9
@ -8691,7 +8691,7 @@ _08017368:
ldrb r0, [r1]
movs r1, 0
movs r2, 0
bl sub_81AE6C8
bl DestroyListMenuTask
ldrb r0, [r6]
bl RemoveWindow
mov r3, r9

View File

@ -1985,7 +1985,7 @@ _080E0AEA:
adds r1, r2, r3
subs r3, 0x2
adds r2, r3
bl sub_81AE860
bl ListMenuGetScrollAndRow
movs r0, 0x2
negs r0, r0
cmp r5, r0

View File

@ -0,0 +1,2 @@
gUnknown_03006300
gMultiuseListMenuTemplate

File diff suppressed because it is too large Load Diff

View File

@ -1,45 +0,0 @@
.align 2
gBerryPicTable:: @ 857FC94
.4byte gBerryPic_Cheri, gBerryPalette_Cheri
.4byte gBerryPic_Chesto, gBerryPalette_Chesto
.4byte gBerryPic_Pecha, gBerryPalette_Pecha
.4byte gBerryPic_Rawst, gBerryPalette_Rawst
.4byte gBerryPic_Aspear, gBerryPalette_Aspear
.4byte gBerryPic_Leppa, gBerryPalette_Leppa
.4byte gBerryPic_Oran, gBerryPalette_Oran
.4byte gBerryPic_Persim, gBerryPalette_Persim
.4byte gBerryPic_Lum, gBerryPalette_Lum
.4byte gBerryPic_Sitrus, gBerryPalette_Sitrus
.4byte gBerryPic_Figy, gBerryPalette_Figy
.4byte gBerryPic_Wiki, gBerryPalette_Wiki
.4byte gBerryPic_Mago, gBerryPalette_Mago
.4byte gBerryPic_Aguav, gBerryPalette_Aguav
.4byte gBerryPic_Iapapa, gBerryPalette_Iapapa
.4byte gBerryPic_Razz, gBerryPalette_Razz
.4byte gBerryPic_Bluk, gBerryPalette_Bluk
.4byte gBerryPic_Nanab, gBerryPalette_Nanab
.4byte gBerryPic_Wepear, gBerryPalette_Wepear
.4byte gBerryPic_Pinap, gBerryPalette_Pinap
.4byte gBerryPic_Pomeg, gBerryPalette_Pomeg
.4byte gBerryPic_Kelpsy, gBerryPalette_Kelpsy
.4byte gBerryPic_Qualot, gBerryPalette_Qualot
.4byte gBerryPic_Hondew, gBerryPalette_Hondew
.4byte gBerryPic_Grepa, gBerryPalette_Grepa
.4byte gBerryPic_Tamato, gBerryPalette_Tamato
.4byte gBerryPic_Cornn, gBerryPalette_Cornn
.4byte gBerryPic_Magost, gBerryPalette_Magost
.4byte gBerryPic_Rabuta, gBerryPalette_Rabuta
.4byte gBerryPic_Nomel, gBerryPalette_Nomel
.4byte gBerryPic_Spelon, gBerryPalette_Spelon
.4byte gBerryPic_Pamtre, gBerryPalette_Pamtre
.4byte gBerryPic_Watmel, gBerryPalette_Watmel
.4byte gBerryPic_Durin, gBerryPalette_Durin
.4byte gBerryPic_Belue, gBerryPalette_Belue
.4byte gBerryPic_Liechi, gBerryPalette_Liechi
.4byte gBerryPic_Ganlon, gBerryPalette_Ganlon
.4byte gBerryPic_Salac, gBerryPalette_Salac
.4byte gBerryPic_Petaya, gBerryPalette_Petaya
.4byte gBerryPic_Apicot, gBerryPalette_Apicot
.4byte gBerryPic_Lansat, gBerryPalette_Lansat
.4byte gBerryPic_Starf, gBerryPalette_Starf
.4byte gBerryPic_Enigma, gBerryPalette_Enigma

View File

@ -4,219 +4,6 @@
.section .rodata
.align 2
gUnknown_0857F564:: @ 857F564
.incbin "graphics/interface/bag_spinner.gbapal"
.align 2
gUnknown_0857F584:: @ 857F584
.incbin "graphics/interface/bag_spinner.4bpp"
.align 2
gUnknown_0857F604:: @ 857F604
.incbin "graphics/unused/cherry.4bpp"
.align 2
gUnknown_0857FA84:: @ 857FA84
.incbin "graphics/unused/cherry.gbapal"
.align 2
gOamData_857FAA4:: @ 857FAA4
.2byte 0x0100, 0xc000, 0x0400, 0x0000
.align 2
gSpriteAnim_857FAAC:: @ 857FAAC
.2byte 0x0000, 0x0004, 0xffff, 0x0000
.align 2
gSpriteAnim_857FAB4:: @ 857FAB4
.2byte 0x0040, 0x0004, 0xffff, 0x0000
.align 2
gSpriteAnim_857FABC:: @ 857FABC
.2byte 0x0080, 0x0004, 0xffff, 0x0000
.align 2
gSpriteAnim_857FAC4:: @ 857FAC4
.2byte 0x00c0, 0x0004, 0xffff, 0x0000
.align 2
gSpriteAnim_857FACC:: @ 857FACC
.2byte 0x0100, 0x0004, 0xffff, 0x0000
.align 2
gSpriteAnim_857FAD4:: @ 857FAD4
.2byte 0x0140, 0x0004, 0xffff, 0x0000
.align 2
gSpriteAnimTable_857FADC:: @ 857FADC
.4byte gSpriteAnim_857FAAC
.4byte gSpriteAnim_857FAB4
.4byte gSpriteAnim_857FAC4
.4byte gSpriteAnim_857FACC
.4byte gSpriteAnim_857FAD4
.4byte gSpriteAnim_857FABC
.align 2
gSpriteAffineAnim_857FAF4:: @ 857FAF4
.2byte 0x0100, 0x0100, 0x0000, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_857FB04:: @ 857FB04
.2byte 0x0000, 0x0000, 0x02fe, 0x0000, 0x0000, 0x0000, 0x0402, 0x0000, 0x0000, 0x0000, 0x04fe, 0x0000, 0x0000, 0x0000, 0x0202, 0x0000
.2byte 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnimTable_857FB2C:: @ 857FB2C
.4byte gSpriteAffineAnim_857FAF4
.4byte gSpriteAffineAnim_857FB04
.align 2
gUnknown_0857FB34:: @ 857FB34
obj_tiles gBagMaleTiles, 0x3000, 0x0064
.align 2
gUnknown_0857FB3C:: @ 857FB3C
obj_tiles gBagFemaleTiles, 0x3000, 0x0064
.align 2
gUnknown_0857FB44:: @ 857FB44
obj_pal gBagPalette, 0x0064
.align 2
gUnknown_0857FB4C:: @ 857FB4C
spr_template 0x0064, 0x0064, gOamData_857FAA4, gSpriteAnimTable_857FADC, NULL, gSpriteAffineAnimTable_857FB2C, SpriteCallbackDummy
.align 2
gOamData_857FB64:: @ 857FB64
.2byte 0x0000, 0x4800, 0x0800, 0x0000
.align 2
gSpriteAnim_857FB6C:: @ 857FB6C
.2byte 0x0000, 0x0000, 0xffff, 0x0000
.align 2
gSpriteAnimTable_857FB74:: @ 857FB74
.4byte gSpriteAnim_857FB6C
.align 2
gSpriteAffineAnim_857FB78:: @ 857FB78
.2byte 0x0000, 0x0000, 0x1008, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_857FB88:: @ 857FB88
.2byte 0x0000, 0x0000, 0x10f8, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gUnknown_0857FB98:: @ 857FB98
.4byte gSpriteAffineAnim_857FB78
.align 2
gUnknown_0857FB9C:: @ 857FB9C
.4byte gSpriteAffineAnim_857FB88
.align 2
gUnknown_0857FBA0:: @ 857FBA0
obj_tiles gUnknown_0857F584, 0x0080, 0x0065
.align 2
gUnknown_0857FBA8:: @ 857FBA8
obj_pal gUnknown_0857F564, 0x0065
.align 2
gUnknown_0857FBB0:: @ 857FBB0
spr_template 0x0065, 0x0065, gOamData_857FB64, gSpriteAnimTable_857FB74, NULL, gUnknown_0857FB98, ObjectCB_SwitchPocketRotatingBallInit
.align 2
gOamData_857FBC8:: @ 857FBC8
.2byte 0x0000, 0xc000, 0x7400, 0x0000
.align 2
gOamData_857FBD0:: @ 857FBD0
.2byte 0x0300, 0xc000, 0x7000, 0x0000
.align 2
gSpriteAnim_857FBD8:: @ 857FBD8
.2byte 0x0000, 0x0000, 0xffff, 0x0000
.align 2
gSpriteAnimTable_857FBE0:: @ 857FBE0
.4byte gSpriteAnim_857FBD8
.align 2
gOamData_857FBE4:: @ 857FBE4
.2byte 0xc000, 0x0201, 0x0800, 0x0000
.align 2
gUnknown_0857FBEC:: @ 857FBEC
spr_template 0xffff, 0x7544, gOamData_857FBC8, gSpriteAnimTable_857FBE0, gOamData_857FBE4, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
gSpriteAffineAnim_857FC04:: @ 857FC04
.2byte 0xffff, 0xffff, 0x60fd, 0x0000, 0x0000, 0x0000, 0x1000, 0x0000, 0xfffe, 0xfffe, 0x40ff, 0x0000, 0xfff8, 0x0000, 0x1000, 0x0000
.2byte 0x0000, 0xfff8, 0x1000, 0x0000, 0x0100, 0x0100, 0x0000, 0x0000, 0x7ffe, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_857FC3C:: @ 857FC3C
.2byte 0xffff, 0xffff, 0x6003, 0x0000, 0x0000, 0x0000, 0x1000, 0x0000, 0xfffe, 0xfffe, 0x4001, 0x0000, 0xfff8, 0x0000, 0x1000, 0x0000
.2byte 0x0000, 0xfff8, 0x1000, 0x0000, 0x0100, 0x0100, 0x0000, 0x0000, 0x7ffe, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnimTable_857FC74:: @ 857FC74
.4byte gSpriteAffineAnim_857FC04
.4byte gSpriteAffineAnim_857FC3C
.align 2
gUnknown_0857FC7C:: @ 857FC7C
spr_template 0xffff, 0x7544, gOamData_857FBD0, gSpriteAnimTable_857FBE0, gOamData_857FBE4, gSpriteAffineAnimTable_857FC74, SpriteCallbackDummy
@ 857FC94
.include "data/graphics/berries/berry_pic_table.inc"
.align 2
gUnknown_0857FDEC:: @ 857FDEC
obj_tiles gBerryCheckCircle_Gfx, 0x0800, 0x2710
.align 2
gUnknown_0857FDF4:: @ 857FDF4
obj_pal gUnknown_08D9BEF0, 0x2710
.align 2
gOamData_857FDFC:: @ 857FDFC
.2byte 0x0000, 0xc000, 0x0400, 0x0000
.align 2
gSpriteAnim_857FE04:: @ 857FE04
.2byte 0x0000, 0x0000, 0xffff, 0x0000
.align 2
gSpriteAnimTable_857FE0C:: @ 857FE0C
.4byte gSpriteAnim_857FE04
.align 2
gUnknown_0857FE10:: @ 857FE10
spr_template 0x2710, 0x2710, gOamData_857FDFC, gSpriteAnimTable_857FE0C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
gUnknown_0857FE28:: @ 857FE28
spr_template 0x0000, 0x0000, gDummyOamData, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80D5860
.align 2
gUnknown_0857FE40:: @ 857FE40
spr_template 0x0000, 0x0000, gDummyOamData, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80D58F8
.align 2
gUnknown_0857FE58:: @ 857FE58
spr_template 0x0000, 0x0000, gDummyOamData, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80D5968
.align 2
gUnknown_0857FE70:: @ 857FE70
spr_template 0x0000, 0x0000, gDummyOamData, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80D5A94
.align 2
gUnknown_0857FE88:: @ 857FE88
spr_template 0x0000, 0x0000, gDummyOamData, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80D5B48
@ 857FEA0
.include "data/text/item_descriptions.inc"

View File

@ -2719,12 +2719,18 @@ extern const u16 gFireRedMenuElements2_Pal[16];
extern const u16 gFireRedMenuElements3_Pal[16];
extern const u8 gFireRedMenuElements_Gfx[];
//item menu graphics
// item menu graphics
extern const u8 gBagScreen_Gfx[];
extern const u16 gBagScreenFemale_Pal[];
extern const u16 gBagScreenMale_Pal[];
extern const u8 gBagMenuHMIcon_Gfx[];
// item menu icons graphics
extern const u8 gBagMaleTiles[];
extern const u8 gBagFemaleTiles[];
extern const u8 gBagPalette[];
extern const u8 gBerryCheckCircle_Gfx[];
//intro graphics
extern const u8 gIntro1SparkleGfx[];
extern const u8 gIntro1FlygonGfx[];
@ -2767,6 +2773,94 @@ extern const u16 gIntro2BrendanNoTurnPal[];
extern const u16 gIntro2FlygonPal[];
extern const u8 gIntro2FlygonGfx[];
// berry pics
extern const u8 gBerryPic_Cheri[];
extern const u8 gBerryPalette_Cheri[];
extern const u8 gBerryPic_Chesto[];
extern const u8 gBerryPalette_Chesto[];
extern const u8 gBerryPic_Pecha[];
extern const u8 gBerryPalette_Pecha[];
extern const u8 gBerryPic_Rawst[];
extern const u8 gBerryPalette_Rawst[];
extern const u8 gBerryPic_Aspear[];
extern const u8 gBerryPalette_Aspear[];
extern const u8 gBerryPic_Leppa[];
extern const u8 gBerryPalette_Leppa[];
extern const u8 gBerryPic_Oran[];
extern const u8 gBerryPalette_Oran[];
extern const u8 gBerryPic_Persim[];
extern const u8 gBerryPalette_Persim[];
extern const u8 gBerryPic_Lum[];
extern const u8 gBerryPalette_Lum[];
extern const u8 gBerryPic_Sitrus[];
extern const u8 gBerryPalette_Sitrus[];
extern const u8 gBerryPic_Figy[];
extern const u8 gBerryPalette_Figy[];
extern const u8 gBerryPic_Wiki[];
extern const u8 gBerryPalette_Wiki[];
extern const u8 gBerryPic_Mago[];
extern const u8 gBerryPalette_Mago[];
extern const u8 gBerryPic_Aguav[];
extern const u8 gBerryPalette_Aguav[];
extern const u8 gBerryPic_Iapapa[];
extern const u8 gBerryPalette_Iapapa[];
extern const u8 gBerryPic_Razz[];
extern const u8 gBerryPalette_Razz[];
extern const u8 gBerryPic_Bluk[];
extern const u8 gBerryPalette_Bluk[];
extern const u8 gBerryPic_Nanab[];
extern const u8 gBerryPalette_Nanab[];
extern const u8 gBerryPic_Wepear[];
extern const u8 gBerryPalette_Wepear[];
extern const u8 gBerryPic_Pinap[];
extern const u8 gBerryPalette_Pinap[];
extern const u8 gBerryPic_Pomeg[];
extern const u8 gBerryPalette_Pomeg[];
extern const u8 gBerryPic_Kelpsy[];
extern const u8 gBerryPalette_Kelpsy[];
extern const u8 gBerryPic_Qualot[];
extern const u8 gBerryPalette_Qualot[];
extern const u8 gBerryPic_Hondew[];
extern const u8 gBerryPalette_Hondew[];
extern const u8 gBerryPic_Grepa[];
extern const u8 gBerryPalette_Grepa[];
extern const u8 gBerryPic_Tamato[];
extern const u8 gBerryPalette_Tamato[];
extern const u8 gBerryPic_Cornn[];
extern const u8 gBerryPalette_Cornn[];
extern const u8 gBerryPic_Magost[];
extern const u8 gBerryPalette_Magost[];
extern const u8 gBerryPic_Rabuta[];
extern const u8 gBerryPalette_Rabuta[];
extern const u8 gBerryPic_Nomel[];
extern const u8 gBerryPalette_Nomel[];
extern const u8 gBerryPic_Spelon[];
extern const u8 gBerryPalette_Spelon[];
extern const u8 gBerryPic_Pamtre[];
extern const u8 gBerryPalette_Pamtre[];
extern const u8 gBerryPic_Watmel[];
extern const u8 gBerryPalette_Watmel[];
extern const u8 gBerryPic_Durin[];
extern const u8 gBerryPalette_Durin[];
extern const u8 gBerryPic_Belue[];
extern const u8 gBerryPalette_Belue[];
extern const u8 gBerryPic_Liechi[];
extern const u8 gBerryPalette_Liechi[];
extern const u8 gBerryPic_Ganlon[];
extern const u8 gBerryPalette_Ganlon[];
extern const u8 gBerryPic_Salac[];
extern const u8 gBerryPalette_Salac[];
extern const u8 gBerryPic_Petaya[];
extern const u8 gBerryPalette_Petaya[];
extern const u8 gBerryPic_Apicot[];
extern const u8 gBerryPalette_Apicot[];
extern const u8 gBerryPic_Lansat[];
extern const u8 gBerryPalette_Lansat[];
extern const u8 gBerryPic_Starf[];
extern const u8 gBerryPalette_Starf[];
extern const u8 gBerryPic_Enigma[];
extern const u8 gBerryPalette_Enigma[];
//credits
extern const u8 gCreditsCopyrightEnd_Gfx[];

View File

@ -4,17 +4,48 @@
// Exported type declarations
struct BagStruct
{
void *func;
u8 unk4;
void (*bagCallback)(void);
u8 location;
u8 pocket;
u8 unk6[2];
u16 unk8[5];
u16 unk12[5];
void *unk1C;
u16 cursorPosition[5];
u16 scrollPosition[5];
};
extern struct BagStruct gUnknown_0203CE58;
struct UnkBagStruct
{
void (*unk0)(void);
u8 unk4[0x800];
u8 unk804[12];
u8 unk810[7];
u8 unk817;
u8 unk818;
u8 unk819;
u8 unk81A;
u8 unk81B:4;
u8 unk81B_1:2;
u8 unk81B_3:1;
u8 unk81B_2:1;
u8 filler3[2];
u8 unk81E;
u8 unk81F;
const u8* unk820;
u8 unk824;
u8 unk825;
u8 filler[2];
u8 unk828;
u8 unk829[5];
u8 unk82E[6];
s16 unk834;
u8 filler4[0xE];
u8 unk844[32][32];
u8 filler2[4];
};
extern struct UnkBagStruct *gUnknown_0203CE54;
// Exported RAM declarations
extern u16 gSpecialVar_ItemId;

View File

@ -1,16 +1,25 @@
#ifndef GUARD_ITEM_MENU_ICONS
#define GUARD_ITEM_MENU_ICONS
extern const struct CompressedSpriteSheet gUnknown_0857FB34;
extern const struct CompressedSpriteSheet gUnknown_0857FB3C;
extern const struct CompressedSpritePalette gUnknown_0857FB44;
extern const struct CompressedSpriteSheet gUnknown_0857FDEC;
extern const struct CompressedSpritePalette gUnknown_0857FDF4;
u8 sub_80D511C(u8 a0, u8 a1, u8 a2, u8 a3);
void RemoveBagSprite(u8 id);
void AddBagVisualSprite(u8 bagPocketId);
void SetBagVisualPocketId(u8 bagPocketId, bool8 isSwitchingPockets);
void ShakeBagVisual(void);
void AddSwitchPocketRotatingBallSprite(s16 rotationDirection);
void AddBagItemIconSprite(u16 itemId, u8 id);
void RemoveBagItemIconSprite(u8 id);
void sub_80D4FAC(void);
void sub_80D4FC8(u8 arg0);
void sub_80D4FEC(u8 arg0);
u8 CreateBerryTagSprite(u8 id, s16 x, s16 y);
void FreeBerryTagSpritePalette(void);
u8 sub_80D511C(u8 berryId, u8 x, u8 y, bool8 startAffine);
u8 CreateBerryFlavorCircleSprite(s16 x);
void sub_80D4FAC(void);
void RemoveBagItemIconObject(u8);
void sub_80D4FEC(u8);
void sub_80D4FC8(u8);
#endif // GUARD_ITEM_MENU_ICONS

View File

@ -4,9 +4,11 @@
#define LIST_NOTHING_CHOSEN -1
#define LIST_B_PRESSED -2
// Exported type declarations
#define LIST_NO_MULTIPLE_SCROLL 0
#define LIST_MULTIPLE_SCROLL_DPAD 1
#define LIST_MULTIPLE_SCROLL_L_R 2
// Exported RAM declarations
struct ListMenu;
struct ListMenuItem
{
@ -14,33 +16,31 @@ struct ListMenuItem
s32 id;
};
struct ListMenu;
struct ListMenuTemplate
{
const struct ListMenuItem *items;
void (* moveCursorFunc)(u32, bool8, struct ListMenu *);
void (* unk_08)(u8, s32, u8);
void (* moveCursorFunc)(s32, bool8, struct ListMenu *);
void (* unk_08)(u8 windowId, s32 itemId, u8 y);
u16 totalItems;
u16 maxShowed;
u8 unk_10;
u8 windowId;
u8 unk_11;
u8 unk_12;
u8 cursor_Y;
u32 upText_Y:4; // x1, x2, x4, x8 = xF
u32 cursorColor:4; // x10, x20, x40, x80 = xF0
u32 fillColor:4; // x100, x200, x400, x800 = xF00
u32 cursorShadowColor:4; // x1000, x2000, x4000, x8000 = xF000
u32 unk_16_0:1; // x10000
u32 spaceBetweenItems:6; // x20000, x40000, x80000, x100000, x200000, x400000 = x7E0000
u32 unk_16_7:1; // x800000
u32 unk_17_0:6; // x1000000, x2000000, x4000000, x8000000, x10000000, x20000000 = x3F000000
u32 cursorKind:2; // x40000000, x80000000
u8 cursor_X;
u8 upText_Y:4; // x1, x2, x4, x8 = xF
u8 cursorPal:4; // x10, x20, x40, x80 = xF0
u8 fillValue:4; // x1, x2, x4, x8 = xF
u8 cursorShadowPal:4; // x10, x20, x40, x80 = xF0
u8 lettersSpacing:3;
u8 unk_16_3:3;
u8 scrollMultiple:2; // x40, x80 = xC0
u8 fontId:6; // x1, x2, x4, x8, x10, x20 = x3F
u8 cursorKind:2; // x40, x80
};
struct ListMenu
{
struct ListMenuTemplate _template;
struct ListMenuTemplate template;
u16 scrollOffset;
u16 selectedRow;
u8 unk_1C;
@ -49,14 +49,30 @@ struct ListMenu
u8 unk_1F;
};
struct UnknownListMenuWindowStruct
{
u8 x;
u8 y;
u8 width;
u8 height;
u8 palNum;
};
extern struct ListMenuTemplate gMultiuseListMenuTemplate;
// Exported ROM declarations
u8 ListMenuInit(struct ListMenuTemplate *template, u16 cursorPage, u16 cursorPosition);
s32 DoMysteryGiftListMenu(struct WindowTemplate *windowTemplate, struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum);
u8 ListMenuInit(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow);
u8 ListMenuInitWithWindows(struct ListMenuTemplate *listMenuTemplate, struct UnknownListMenuWindowStruct *arg1, u16 scrollOffset, u16 selectedRow);
s32 ListMenuHandleInputGetItemId(u8 listTaskId);
void sub_81AE860(u8 listTaskId, u16 *a1, u16 *a2);
void sub_81AE6C8(u8 listTaskId, u16 *a1, u16 *a2);
u8 ListMenuGetYCoordForPrintingArrowCursor(u8);
void DestroyListMenuTask(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow);
void sub_81AE70C(u8 listTaskId);
void ChangeListMenuPals(u8 listTaskId, u8 cursorPal, u8 fillValue, u8 cursorShadowPal);
void ChangeListMenuCoords(u8 listTaskId, u8 x, u8 y);
s32 ListMenuTestInput(struct ListMenuTemplate *template, u32 scrollOffset, u32 selectedRow, u16 keys, u16 *newScrollOffset, u16 *newSelectedRow);
void ListMenuGetCurrentItemArrayId(u8 listTaskId, u16 *arrayId);
void ListMenuGetScrollAndRow(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow);
u16 ListMenuGetYCoordForPrintingArrowCursor(u8 listTaskId);
void sub_81AF028(u8 cursorPal, u8 fillValue, u8 cursorShadowPal);
void sub_81AF078(s32 arg0, u8 arg1, struct ListMenu *list);
#endif //GUARD_LIST_MENU_H

View File

@ -7,16 +7,31 @@
// Exported ROM declarations
struct ArrowStruct {
struct ArrowStruct
{
u8 unk0[6];
u16 unk6[4];
u8 unkE;
};
struct CursorStruct
{
u8 unk0;
u8 unk1;
u16 unk2;
u16 unk4;
u16 unk6;
u16 unk8;
u8 unkA;
};
void Task_ScrollIndicatorArrowPairOnMainMenu(u8);
u8 AddScrollIndicatorArrowPairParametrized(u8, u8, u8, u8, s32, u16, u16, u16 *);
void RemoveScrollIndicatorArrowPair(u8);
u8 AddScrollIndicatorArrowPair(const struct ArrowStruct*, void*);
void sub_81AF15C(u8, u8, u8);
void ListMenuRemoveCursorObject(u8 taskId, u32 cursorKind);
void ListMenuUpdateCursorObject(u8 taskId, u16 x, u16 y, u32 cursorKind);
u8 ListMenuAddCursorObjectInternal(struct CursorStruct *cursor, u32 cursorKind);
#endif //GUARD_MENU_INDICATORS_H

View File

@ -136,7 +136,7 @@ SECTIONS {
asm/fldeff_cut.o(.text);
src/mail_data.o(.text);
asm/map_name_popup.o(.text);
asm/item_menu_icons.o(.text);
src/item_menu_icons.o(.text);
asm/battle_anim_80D51AC.o(.text);
src/item.o(.text);
asm/item.o(.text);
@ -247,7 +247,7 @@ SECTIONS {
src/menu.o(.text);
asm/battle_frontier_2.o(.text);
src/item_menu.o(.text);
asm/list_menu.o(.text);
src/list_menu.o(.text);
asm/menu_indicators.o(.text);
src/unk_text_util.o(.text);
src/save_location.o(.text);
@ -433,6 +433,7 @@ SECTIONS {
src/pokemon_icon.o(.rodata);
data/fldeff_cut.o(.rodata);
data/map_name_popup.o(.rodata);
src/item_menu_icons.o(.rodata);
data/item_menu_icons.o(.rodata);
data/contest.o(.rodata);
data/shop.o(.rodata);

View File

@ -515,7 +515,7 @@ static void Task_HandleInput(u8 taskId)
static void TryChangeDisplayedBerry(u8 taskId, s8 toMove)
{
s16 *data = gTasks[taskId].data;
s16 currPocketPosition = gUnknown_0203CE58.unk12[3] + gUnknown_0203CE58.unk8[3];
s16 currPocketPosition = gUnknown_0203CE58.scrollPosition[3] + gUnknown_0203CE58.cursorPosition[3];
u32 newPocketPosition = currPocketPosition + toMove;
if (newPocketPosition < 46 && BagGetItemIdByPocketPosition(BAG_BERRIES, newPocketPosition) != 0)
{
@ -533,8 +533,8 @@ static void TryChangeDisplayedBerry(u8 taskId, s8 toMove)
static void HandleBagCursorPositionChange(s8 toMove)
{
u16 *scrollPos = &gUnknown_0203CE58.unk12[3];
u16 *cursorPos = &gUnknown_0203CE58.unk8[3];
u16 *scrollPos = &gUnknown_0203CE58.scrollPosition[3];
u16 *cursorPos = &gUnknown_0203CE58.cursorPosition[3];
if (toMove > 0)
{
if (*cursorPos < 4 || BagGetItemIdByPocketPosition(BAG_BERRIES, *scrollPos + 8) == 0)

View File

@ -41,11 +41,10 @@ extern const u8 gDaycareText_PlayOther[];
extern u8 GetCursorSelectionMonId(void);
extern u16 ItemIdToBattleMoveId(u16);
extern s32 ListMenuHandleInputGetItemId(u8);
extern void sub_81AE6C8(u8, u16*, u16*);
extern void DestroyListMenuTask(u8, u16*, u16*);
extern void sub_819746C(u8, bool8);
extern void NewMenuHelpers_DrawStdWindowFrame(u8, bool8);
extern void sub_81B9328(void);
extern void sub_81AF078(u32, bool8, struct ListMenu *);
extern void CB2_ReturnToField(void);
// this file's functions
@ -79,18 +78,18 @@ static const struct ListMenuTemplate sDaycareListMenuLevelTemplate =
.unk_08 = DaycarePrintMonInfo,
.totalItems = 3,
.maxShowed = 3,
.unk_10 = 0,
.windowId = 0,
.unk_11 = 0,
.unk_12 = 8,
.cursor_Y = 0,
.cursor_X = 0,
.upText_Y = 1,
.cursorColor = 2,
.fillColor = 1,
.cursorShadowColor = 3,
.unk_16_0 = TRUE,
.spaceBetweenItems = 0,
.unk_16_7 = FALSE,
.unk_17_0 = 1,
.cursorPal = 2,
.fillValue = 1,
.cursorShadowPal = 3,
.lettersSpacing = 1,
.unk_16_3 = 0,
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
.fontId = 1,
.cursorKind = 0
};
@ -1271,7 +1270,7 @@ static void Task_HandleDaycareLevelMenuInput(u8 taskId)
gSpecialVar_Result = 2;
break;
}
sub_81AE6C8(gTasks[taskId].tMenuListTaskId, NULL, NULL);
DestroyListMenuTask(gTasks[taskId].tMenuListTaskId, NULL, NULL);
sub_819746C(gTasks[taskId].tWindowId, TRUE);
RemoveWindow(gTasks[taskId].tWindowId);
DestroyTask(taskId);
@ -1280,7 +1279,7 @@ static void Task_HandleDaycareLevelMenuInput(u8 taskId)
else if (gMain.newKeys & B_BUTTON)
{
gSpecialVar_Result = 2;
sub_81AE6C8(gTasks[taskId].tMenuListTaskId, NULL, NULL);
DestroyListMenuTask(gTasks[taskId].tMenuListTaskId, NULL, NULL);
sub_819746C(gTasks[taskId].tWindowId, TRUE);
RemoveWindow(gTasks[taskId].tWindowId);
DestroyTask(taskId);
@ -1299,7 +1298,7 @@ void ShowDaycareLevelMenu(void)
NewMenuHelpers_DrawStdWindowFrame(windowId, FALSE);
menuTemplate = sDaycareListMenuLevelTemplate;
menuTemplate.unk_10 = windowId;
menuTemplate.windowId = windowId;
listMenuTaskId = ListMenuInit(&menuTemplate, 0, 0);
CopyWindowToVram(windowId, 3);

View File

@ -113,7 +113,7 @@ void sub_812719C(u8 taskId);
void sub_81271CC(u8 taskId);
void sub_8127268(u8 taskId);
void sub_8127454(u8 *dest, u16 decorId);
void sub_8127480(u32 a0, bool8 flag, struct ListMenu *menu);
void sub_8127480(s32 a0, bool8 flag, struct ListMenu *menu);
void sub_81274A0(u8 a0, s32 a1, u8 a2);
void sub_8127620(u8 taskId);
void sub_812764C(u8 taskId);
@ -801,7 +801,7 @@ void sub_8127330(u8 taskId)
sDecorPCBuffer->items[i].name = sDecorPCBuffer->names[i];
sDecorPCBuffer->items[i].id = -2;
gMultiuseListMenuTemplate = gUnknown_085A6BD0;
gMultiuseListMenuTemplate.unk_10 = sDecorMenuWindowIndices[1];
gMultiuseListMenuTemplate.windowId = sDecorMenuWindowIndices[1];
gMultiuseListMenuTemplate.totalItems = sDecorPCBuffer->unk_520;
gMultiuseListMenuTemplate.items = sDecorPCBuffer->items;
gMultiuseListMenuTemplate.maxShowed = sDecorPCBuffer->unk_521;
@ -813,7 +813,7 @@ void sub_8127454(u8 *dest, u16 decorId)
StringAppend(dest, gDecorations[decorId].name);
}
void sub_8127480(u32 a0, bool8 flag, struct ListMenu *menu)
void sub_8127480(s32 a0, bool8 flag, struct ListMenu *menu)
{
if (flag != TRUE)
{
@ -892,7 +892,7 @@ void sub_812764C(u8 taskId)
if (!gPaletteFade.active)
{
input = ListMenuHandleInputGetItemId(data[13]);
sub_81AE860(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo);
ListMenuGetScrollAndRow(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo);
switch (input)
{
case -1:
@ -905,7 +905,7 @@ void sub_812764C(u8 taskId)
PlaySE(SE_SELECT);
gCurDecorationIndex = input;
sub_8127554();
sub_81AE6C8(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo);
DestroyListMenuTask(data[13], &sSecretBasePCSelectDecorPageNo, &sSecretBasePCSelectDecorLineNo);
sub_8126A58(1);
sub_81277A8();
free(sDecorPCBuffer);
@ -1074,7 +1074,7 @@ void sub_8127A8C(u8 taskId)
data = gTasks[taskId].data;
sub_8127554();
sub_81277A8();
sub_81AE6C8(data[13], NULL, NULL);
DestroyListMenuTask(data[13], NULL, NULL);
free(sDecorPCBuffer);
sub_8126E44(taskId);
}

View File

@ -1,4 +1,5 @@
#include "global.h"
#include "item_menu.h"
#include "battle.h"
#include "battle_controllers.h"
#include "battle_frontier_2.h"
@ -58,7 +59,6 @@ void load_bag_item_list_buffers(u8);
void bag_menu_print_pocket_names(u8*, u8*);
void bag_menu_copy_pocket_name_to_window(u32);
void bag_menu_draw_pocket_indicator_square(u8, u8);
void AddBagVisualObject(u8);
void bag_menu_add_pocket_scroll_arrow_indicators_maybe(void);
void bag_menu_add_list_scroll_arrow_indicators_maybe(void);
void bag_menu_prepare_tmhm_move_window(void);
@ -67,9 +67,8 @@ void Task_WallyTutorialBagMenu(u8);
void Task_BagMenu(u8);
void get_name(s8*, u16);
u16 ItemIdToBattleMoveId(u16);
void ShakeBagVisual(void);
u16 BagGetItemIdByPocketPosition(u8, u16);
void AddBagItemIconObject(u16, u8);
void AddBagItemIconSprite(u16, u8);
void bag_menu_print_description_box_text(int);
void bag_menu_print_cursor(u8, u8);
void bag_menu_print(u8, u8, const u8*, u8, u8, u8, u8, u8, u8);
@ -86,9 +85,6 @@ u8 GetSwitchBagPocketDirection(void);
void SwitchBagPocket(u8, s16, u16);
bool8 sub_81AC2C0(void);
void bag_menu_swap_items(u8);
void SetBagVisualPocketId(u8, u8);
void RemoveBagObject(u8);
void AddSwitchPocketRotatingBallObject(s16);
void sub_81AC10C(u8);
void sub_81AC3C0(u8);
void sub_81AC498(u8);
@ -128,7 +124,7 @@ void sub_81ABAC4(void);
void sub_81ABAE0(void);
u8 sub_81AB1F0(u8);
void sub_81AC23C(u8);
void bag_menu_change_item_callback(u32 a, bool8 b, struct ListMenu*);
void bag_menu_change_item_callback(s32 a, bool8 b, struct ListMenu*);
void sub_81AB520(u8 rboxId, int item_index_in_pocket, u8 a);
void ItemMenu_UseOutOfBattle(u8 taskId);
void ItemMenu_Toss(u8 taskId);
@ -251,46 +247,6 @@ const struct WindowTemplate gUnknown_086141AC[] = {
// .text
struct BagStruct {
void (*bagCallback)(void);
u8 location;
u8 pocket;
u8 unk6[2];
u16 cursorPosition[5];
u16 scrollPosition[5];
};
struct UnkBagStruct {
MainCallback unk0;
u8 unk4[0x800];
u8 unk804;
u8 unk805;
u8 unk806[10];
u8 unk810[7];
u8 unk817;
u8 unk818;
u8 unk819;
u8 unk81A;
u8 unk81B:4;
u8 unk81B_1:2;
u8 unk81B_3:1;
u8 unk81B_2:1;
u8 filler3[2];
u8 unk81E;
u8 unk81F;
const u8* unk820;
u8 unk824;
u8 unk825;
u8 filler[2];
u8 unk828;
u8 unk829[5];
u8 unk82E[6];
s16 unk834;
u8 filler4[0xE];
u8 unk844[32][32];
u8 filler2[4];
};
struct ListBuffer1 {
struct ListMenuItem subBuffers[65];
};
@ -319,14 +275,11 @@ void (*gFieldCallback)(void);
extern u8 *gPocketNamesStringsTable[];
extern u8 gUnknown_08D9A88C[];
extern struct CompressedSpriteSheet gUnknown_0857FB34;
extern struct CompressedSpriteSheet gUnknown_0857FB3C;
extern struct CompressedSpritePalette gUnknown_0857FB44;
extern struct ListMenuTemplate gUnknown_08613F9C;
extern u8 gMoveNames[][0xD];
extern const u8 gMoveNames[][0xD];
extern u8* gReturnToXStringsTable[];
extern u32 gUnknown_0203CE5E[];
extern u8 EventScript_2736B3[];
extern const u8 EventScript_2736B3[];
extern const u16 gUnknown_0860F074[];
void ResetBagScrollPositions(void)
@ -411,7 +364,7 @@ void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)
gUnknown_0203CE54->unk81A = 0xFF;
gUnknown_0203CE54->unk81E = -1;
gUnknown_0203CE54->unk81F = -1;
memset(&gUnknown_0203CE54->unk804, 0xFF, 12);
memset(gUnknown_0203CE54->unk804, 0xFF, sizeof(gUnknown_0203CE54->unk804));
memset(gUnknown_0203CE54->unk810, 0xFF, 10);
SetMainCallback2(CB2_Bag);
}
@ -517,7 +470,7 @@ bool8 setup_bag_menu(void)
gMain.state++;
break;
case 15:
AddBagVisualObject(gUnknown_0203CE58.pocket);
AddBagVisualSprite(gUnknown_0203CE58.pocket);
gMain.state++;
break;
case 16:
@ -688,7 +641,7 @@ void get_name(s8 *dest, u16 itemId)
}
}
void bag_menu_change_item_callback(u32 a, bool8 b, struct ListMenu *unused)
void bag_menu_change_item_callback(s32 a, bool8 b, struct ListMenu *unused)
{
if (b != 1)
{
@ -697,11 +650,11 @@ void bag_menu_change_item_callback(u32 a, bool8 b, struct ListMenu *unused)
}
if (gUnknown_0203CE54->unk81A == 0xFF)
{
RemoveBagItemIconObject(1 ^ gUnknown_0203CE54->unk81B_1);
RemoveBagItemIconSprite(1 ^ gUnknown_0203CE54->unk81B_1);
if (a != -2)
AddBagItemIconObject(BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, a), gUnknown_0203CE54->unk81B_1);
AddBagItemIconSprite(BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, a), gUnknown_0203CE54->unk81B_1);
else
AddBagItemIconObject(-1, gUnknown_0203CE54->unk81B_1);
AddBagItemIconSprite(-1, gUnknown_0203CE54->unk81B_1);
gUnknown_0203CE54->unk81B_1 ^= 1;
if (!gUnknown_0203CE54->unk81B_3)
bag_menu_print_description_box_text(a);
@ -830,7 +783,7 @@ void task_close_bag_menu_2(u8 taskId)
s16* data = gTasks[taskId].data;
if (!gPaletteFade.active)
{
sub_81AE6C8(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
DestroyListMenuTask(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
if (gUnknown_0203CE54->unk0 != 0)
SetMainCallback2(gUnknown_0203CE54->unk0);
else
@ -915,7 +868,7 @@ void bag_menu_inits_lists_menu(u8 taskId)
u16* scrollPos = &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket];
u16* cursorPos = &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket];
bag_menu_RemoveBagItem_message_window(4);
sub_81AE6C8(data[0], scrollPos, cursorPos);
DestroyListMenuTask(data[0], scrollPos, cursorPos);
sub_81AB9A8(gUnknown_0203CE58.pocket);
sub_81ABA88(gUnknown_0203CE58.pocket);
load_bag_item_list_buffers(gUnknown_0203CE58.pocket);
@ -967,7 +920,7 @@ void Task_BagMenu(u8 taskId)
{
if (sub_81AC2C0() == 1)
{
sub_81AE860(data[0], scrollPos, cursorPos);
ListMenuGetScrollAndRow(data[0], scrollPos, cursorPos);
if ((*scrollPos + *cursorPos) != gUnknown_0203CE54->unk829[gUnknown_0203CE58.pocket] - 1)
{
PlaySE(SE_SELECT);
@ -979,7 +932,7 @@ void Task_BagMenu(u8 taskId)
else
{
int r4 = ListMenuHandleInputGetItemId(data[0]);
sub_81AE860(data[0], scrollPos, cursorPos);
ListMenuGetScrollAndRow(data[0], scrollPos, cursorPos);
switch (r4)
{
case -1:
@ -1038,7 +991,6 @@ u8 GetSwitchBagPocketDirection(void)
return 0;
}
void ChangeBagPocketId(u8 *bagPocketId, s8 deltaBagPocketId)
{
if (deltaBagPocketId == 1 && *bagPocketId == 4)
@ -1049,13 +1001,11 @@ void ChangeBagPocketId(u8 *bagPocketId, s8 deltaBagPocketId)
*bagPocketId += deltaBagPocketId;
}
#ifdef NONMATCHING
void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, u16 a3)
{
s16* data = gTasks[taskId].data;
u8 pocketId;
data[13] = 0;
data[12] = 0;
data[11] = deltaBagPocketId;
@ -1063,9 +1013,9 @@ void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, u16 a3)
{
ClearWindowTilemap(0);
ClearWindowTilemap(1);
sub_81AE6C8(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
DestroyListMenuTask(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
schedule_bg_copy_tilemap_to_vram(0);
gSprites[gUnknown_0203CE54->unk806[gUnknown_0203CE54->unk81B_1 ^ 1]].invisible = 1;
gSprites[gUnknown_0203CE54->unk804[2 + (gUnknown_0203CE54->unk81B_1 ^ 1)]].invisible = 1;
sub_81AB824();
}
pocketId = gUnknown_0203CE58.pocket;
@ -1085,160 +1035,10 @@ void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, u16 a3)
FillBgTilemapBufferRect_Palette0(2, 11, 14, 2, 15, 16);
schedule_bg_copy_tilemap_to_vram(2);
SetBagVisualPocketId(pocketId, 1);
RemoveBagObject(1);
AddSwitchPocketRotatingBallObject(deltaBagPocketId);
RemoveBagSprite(1);
AddSwitchPocketRotatingBallSprite(deltaBagPocketId);
SetTaskFuncWithFollowupFunc(taskId, sub_81AC10C, gTasks[taskId].func);
}
#else
__attribute__((naked))
void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, u16 a3)
{
asm(".syntax unified\n\
push {r4-r6,lr}\n\
sub sp, 0xC\n\
lsls r0, 24\n\
lsrs r6, r0, 24\n\
lsls r1, 16\n\
lsrs r5, r1, 16\n\
lsls r2, 16\n\
lsls r0, r6, 2\n\
adds r0, r6\n\
lsls r0, 3\n\
ldr r1, =gTasks + 0x8\n\
adds r4, r0, r1\n\
movs r0, 0\n\
strh r0, [r4, 0x1A]\n\
strh r0, [r4, 0x18]\n\
strh r5, [r4, 0x16]\n\
cmp r2, 0\n\
bne _081AC026\n\
movs r0, 0\n\
bl ClearWindowTilemap\n\
movs r0, 0x1\n\
bl ClearWindowTilemap\n\
ldrb r0, [r4]\n\
ldr r3, =gUnknown_0203CE58\n\
ldrb r2, [r3, 0x5]\n\
lsls r2, 1\n\
adds r1, r3, 0\n\
adds r1, 0x12\n\
adds r1, r2, r1\n\
adds r3, 0x8\n\
adds r2, r3\n\
bl sub_81AE6C8\n\
movs r0, 0\n\
bl schedule_bg_copy_tilemap_to_vram\n\
ldr r3, =gSprites\n\
ldr r0, =gUnknown_0203CE54\n\
ldr r2, [r0]\n\
ldr r1, =0x0000081b\n\
adds r0, r2, r1\n\
ldrb r1, [r0]\n\
lsls r1, 26\n\
lsrs r1, 30\n\
movs r0, 0x1\n\
eors r0, r1\n\
adds r2, r0\n\
ldr r0, =0x00000806\n\
adds r2, r0\n\
ldrb r1, [r2]\n\
lsls r0, r1, 4\n\
adds r0, r1\n\
lsls r0, 2\n\
adds r0, r3\n\
adds r0, 0x3E\n\
ldrb r1, [r0]\n\
movs r2, 0x4\n\
orrs r1, r2\n\
strb r1, [r0]\n\
bl sub_81AB824\n\
_081AC026:\n\
ldr r4, =gUnknown_0203CE58\n\
ldrb r1, [r4, 0x5]\n\
add r0, sp, 0x8\n\
strb r1, [r0]\n\
lsls r1, r5, 24\n\
asrs r1, 24\n\
bl ChangeBagPocketId\n\
lsls r0, r5, 16\n\
asrs r1, r0, 16\n\
adds r5, r0, 0\n\
cmp r1, 0x1\n\
bne _081AC07C\n\
ldr r2, =gPocketNamesStringsTable\n\
ldrb r0, [r4, 0x5]\n\
lsls r0, 2\n\
adds r0, r2\n\
ldr r0, [r0]\n\
add r1, sp, 0x8\n\
ldrb r1, [r1]\n\
lsls r1, 2\n\
adds r1, r2\n\
ldr r1, [r1]\n\
bl bag_menu_print_pocket_names\n\
movs r0, 0\n\
bl bag_menu_copy_pocket_name_to_window\n\
b _081AC09A\n\
.pool\n\
_081AC07C:\n\
ldr r2, =gPocketNamesStringsTable\n\
add r0, sp, 0x8\n\
ldrb r0, [r0]\n\
lsls r0, 2\n\
adds r0, r2\n\
ldr r0, [r0]\n\
ldrb r1, [r4, 0x5]\n\
lsls r1, 2\n\
adds r1, r2\n\
ldr r1, [r1]\n\
bl bag_menu_print_pocket_names\n\
movs r0, 0x8\n\
bl bag_menu_copy_pocket_name_to_window\n\
_081AC09A:\n\
ldr r0, =gUnknown_0203CE58\n\
ldrb r0, [r0, 0x5]\n\
movs r1, 0\n\
bl bag_menu_draw_pocket_indicator_square\n\
add r0, sp, 0x8\n\
ldrb r0, [r0]\n\
movs r1, 0x1\n\
bl bag_menu_draw_pocket_indicator_square\n\
movs r0, 0xF\n\
str r0, [sp]\n\
movs r0, 0x10\n\
str r0, [sp, 0x4]\n\
movs r0, 0x2\n\
movs r1, 0xB\n\
movs r2, 0xE\n\
movs r3, 0x2\n\
bl FillBgTilemapBufferRect_Palette0\n\
movs r0, 0x2\n\
bl schedule_bg_copy_tilemap_to_vram\n\
add r0, sp, 0x8\n\
ldrb r0, [r0]\n\
movs r1, 0x1\n\
bl SetBagVisualPocketId\n\
movs r0, 0x1\n\
bl RemoveBagObject\n\
asrs r0, r5, 16\n\
bl AddSwitchPocketRotatingBallObject\n\
ldr r1, =sub_81AC10C\n\
ldr r2, =gTasks\n\
lsls r0, r6, 2\n\
adds r0, r6\n\
lsls r0, 3\n\
adds r0, r2\n\
ldr r2, [r0]\n\
adds r0, r6, 0\n\
bl SetTaskFuncWithFollowupFunc\n\
add sp, 0xC\n\
pop {r4-r6}\n\
pop {r0}\n\
bx r0\n\
.pool\n\
.syntax divided\n");
}
#endif
void sub_81AC10C(u8 taskId)
{
@ -1340,13 +1140,13 @@ void sub_81AC3C0(u8 taskId)
if (gMain.newKeys & SELECT_BUTTON)
{
PlaySE(SE_SELECT);
sub_81AE860(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
ListMenuGetScrollAndRow(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
sub_81AC498(taskId);
}
else
{
r7 = ListMenuHandleInputGetItemId(data[0]);
sub_81AE860(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
ListMenuGetScrollAndRow(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
sub_80D4FC8(0);
sub_80D4FEC(gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
switch (r7)
@ -1381,7 +1181,7 @@ void sub_81AC498(u8 taskId)
{
sub_80D702C(gBagPockets[gUnknown_0203CE58.pocket].itemSlots, data[1], realPos);
gUnknown_0203CE54->unk81A = -1;
sub_81AE6C8(data[0], scrollPos, cursorPos);
DestroyListMenuTask(data[0], scrollPos, cursorPos);
if (data[1] < realPos)
gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]--;
load_bag_item_list_buffers(gUnknown_0203CE58.pocket);
@ -1399,7 +1199,7 @@ void sub_81AC590(u8 taskId)
u16* cursorPos = &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket];
gUnknown_0203CE54->unk81A = -1;
sub_81AE6C8(data[0], scrollPos, cursorPos);
DestroyListMenuTask(data[0], scrollPos, cursorPos);
if (data[1] < (*scrollPos + *cursorPos))
gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]--;
load_bag_item_list_buffers(gUnknown_0203CE58.pocket);
@ -1771,7 +1571,7 @@ void Task_ActuallyToss(u8 taskId)
{
PlaySE(SE_SELECT);
RemoveBagItem(gSpecialVar_ItemId, data[8]);
sub_81AE6C8(data[0], scrollPos, cursorPos);
DestroyListMenuTask(data[0], scrollPos, cursorPos);
sub_81AB9A8(gUnknown_0203CE58.pocket);
sub_81ABA88(gUnknown_0203CE58.pocket);
load_bag_item_list_buffers(gUnknown_0203CE58.pocket);
@ -1791,7 +1591,7 @@ void ItemMenu_Register(u8 taskId)
gSaveBlock1Ptr->registeredItem = 0;
else
gSaveBlock1Ptr->registeredItem = gSpecialVar_ItemId;
sub_81AE6C8(data[0], scrollPos, cursorPos);
DestroyListMenuTask(data[0], scrollPos, cursorPos);
load_bag_item_list_buffers(gUnknown_0203CE58.pocket);
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos);
schedule_bg_copy_tilemap_to_vram(0);
@ -2039,7 +1839,7 @@ void sub_81AD8C8(u8 taskId)
PlaySE(SE_REGI);
RemoveBagItem(gSpecialVar_ItemId, data[8]);
AddMoney(&gSaveBlock1Ptr->money, (itemid_get_market_price(gSpecialVar_ItemId) / 2) * data[8]);
sub_81AE6C8(data[0], scrollPos, cursorPos);
DestroyListMenuTask(data[0], scrollPos, cursorPos);
sub_81AB9A8(gUnknown_0203CE58.pocket);
sub_81ABA88(gUnknown_0203CE58.pocket);
load_bag_item_list_buffers(gUnknown_0203CE58.pocket);
@ -2212,7 +2012,7 @@ void Task_WallyTutorialBagMenu(u8 taskId)
case 0x132:
PlaySE(SE_SELECT);
bag_menu_remove_some_window();
sub_81AE6C8(data[0], 0, 0);
DestroyListMenuTask(data[0], 0, 0);
RestoreBagAfterWallyTutorial();
unknown_ItemMenu_Confirm(taskId);
break;

678
src/item_menu_icons.c Normal file
View File

@ -0,0 +1,678 @@
#include "global.h"
#include "sprite.h"
#include "decompress.h"
#include "item_menu.h"
#include "item_icon.h"
#include "item_menu_icons.h"
#include "window.h"
#include "menu_helpers.h"
#include "berry.h"
#include "graphics.h"
#include "constants/items.h"
struct CompressedTilesPal
{
const u8 *tiles;
const u8 *pal;
};
extern void sub_80D5860(struct Sprite *sprite);
extern void sub_80D58F8(struct Sprite *sprite);
extern void sub_80D5968(struct Sprite *sprite);
extern void sub_80D5A94(struct Sprite *sprite);
extern void sub_80D5B48(struct Sprite *sprite);
// this file's functions
static void SpriteCB_BagVisualSwitchingPockets(struct Sprite *sprite);
static void SpriteCB_ShakeBagVisual(struct Sprite *sprite);
static void SpriteCB_SwitchPocketRotatingBallInit(struct Sprite *sprite);
static void SpriteCB_SwitchPocketRotatingBallContinue(struct Sprite *sprite);
// static const rom data
static const u16 gUnknown_0857F564[] = INCBIN_U16("graphics/interface/bag_spinner.gbapal");
static const u8 gUnknown_0857F584[] = INCBIN_U8("graphics/interface/bag_spinner.4bpp");
static const u8 gUnknown_0857F604[] = INCBIN_U8("graphics/unused/cherry.4bpp");
static const u16 gUnknown_0857FA84[] = INCBIN_U16("graphics/unused/cherry.gbapal");
static const struct OamData sOamData_857FAA4 =
{
.y = 0,
.affineMode = 1,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 3,
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0
};
static const union AnimCmd sSpriteAnim_857FAAC[] =
{
ANIMCMD_FRAME(0, 4),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_857FAB4[] =
{
ANIMCMD_FRAME(64, 4),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_857FABC[] =
{
ANIMCMD_FRAME(128, 4),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_857FAC4[] =
{
ANIMCMD_FRAME(192, 4),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_857FACC[] =
{
ANIMCMD_FRAME(256, 4),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_857FAD4[] =
{
ANIMCMD_FRAME(320, 4),
ANIMCMD_END
};
static const union AnimCmd *const sSpriteAnimTable_857FADC[] =
{
sSpriteAnim_857FAAC,
sSpriteAnim_857FAB4,
sSpriteAnim_857FAC4,
sSpriteAnim_857FACC,
sSpriteAnim_857FAD4,
sSpriteAnim_857FABC
};
static const union AffineAnimCmd sSpriteAffineAnim_857FAF4[] =
{
AFFINEANIMCMD_FRAME(256, 256, 0, 0),
AFFINEANIMCMD_END
};
static const union AffineAnimCmd sSpriteAffineAnim_857FB04[] =
{
AFFINEANIMCMD_FRAME(0, 0, 254, 2),
AFFINEANIMCMD_FRAME(0, 0, 2, 4),
AFFINEANIMCMD_FRAME(0, 0, 254, 4),
AFFINEANIMCMD_FRAME(0, 0, 2, 2),
AFFINEANIMCMD_END
};
static const union AffineAnimCmd *const sSpriteAffineAnimTable_857FB2C[] =
{
sSpriteAffineAnim_857FAF4,
sSpriteAffineAnim_857FB04
};
const struct CompressedSpriteSheet gUnknown_0857FB34 =
{
gBagMaleTiles, 0x3000, 100
};
const struct CompressedSpriteSheet gUnknown_0857FB3C =
{
gBagFemaleTiles, 0x3000, 100
};
const struct CompressedSpritePalette gUnknown_0857FB44 =
{
gBagPalette, 100
};
static const struct SpriteTemplate gUnknown_0857FB4C =
{
.tileTag = 100,
.paletteTag = 100,
.oam = &sOamData_857FAA4,
.anims = sSpriteAnimTable_857FADC,
.images = NULL,
.affineAnims = sSpriteAffineAnimTable_857FB2C,
.callback = SpriteCallbackDummy,
};
static const struct OamData sOamData_857FB64 =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 4,
.size = 1,
.tileNum = 0,
.priority = 2,
.paletteNum = 0,
.affineParam = 0
};
static const union AnimCmd sSpriteAnim_857FB6C[] =
{
ANIMCMD_FRAME(0, 0),
ANIMCMD_END
};
static const union AnimCmd *const sSpriteAnimTable_857FB74[] =
{
sSpriteAnim_857FB6C
};
static const union AffineAnimCmd sSpriteAffineAnim_857FB78[] =
{
AFFINEANIMCMD_FRAME(0, 0, 8, 16),
AFFINEANIMCMD_END
};
static const union AffineAnimCmd sSpriteAffineAnim_857FB88[] =
{
AFFINEANIMCMD_FRAME(0, 0, 248, 16),
AFFINEANIMCMD_END
};
static const union AffineAnimCmd *const sSpriteAffineAnimTable_857FB98[] =
{
sSpriteAffineAnim_857FB78,
};
static const union AffineAnimCmd *const sSpriteAffineAnimTable_857FB9C[] =
{
sSpriteAffineAnim_857FB88,
};
static const struct SpriteSheet gUnknown_0857FBA0 =
{
gUnknown_0857F584, 0x80, 101
};
static const struct SpritePalette gUnknown_0857FBA8 =
{
gUnknown_0857F564, 101
};
static const struct SpriteTemplate gUnknown_0857FBB0 =
{
.tileTag = 101,
.paletteTag = 101,
.oam = &sOamData_857FB64,
.anims = sSpriteAnimTable_857FB74,
.images = NULL,
.affineAnims = sSpriteAffineAnimTable_857FB98,
.callback = SpriteCB_SwitchPocketRotatingBallInit,
};
static const struct OamData sOamData_857FBC8 =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 3,
.tileNum = 0,
.priority = 1,
.paletteNum = 7,
.affineParam = 0
};
static const struct OamData sOamData_857FBD0 =
{
.y = 0,
.affineMode = 3,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 3,
.tileNum = 0,
.priority = 0,
.paletteNum = 7,
.affineParam = 0
};
static const union AnimCmd sSpriteAnim_857FBD8[] =
{
ANIMCMD_FRAME(0, 0),
ANIMCMD_END
};
static const union AnimCmd *const sSpriteAnimTable_857FBE0[] =
{
sSpriteAnim_857FBD8
};
static const struct SpriteFrameImage sSpriteImageTable_857FBE4[] =
{
{&gDecompressionBuffer[0], 0x800},
};
static const struct SpriteTemplate gUnknown_0857FBEC =
{
.tileTag = 65535,
.paletteTag = 30020,
.oam = &sOamData_857FBC8,
.anims = sSpriteAnimTable_857FBE0,
.images = sSpriteImageTable_857FBE4,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
static const union AffineAnimCmd sSpriteAffineAnim_857FC04[] =
{
AFFINEANIMCMD_FRAME(-1, -1, 253, 96),
AFFINEANIMCMD_FRAME(0, 0, 0, 16),
AFFINEANIMCMD_FRAME(-2, -2, 255, 64),
AFFINEANIMCMD_FRAME(-8, 0, 0, 16),
AFFINEANIMCMD_FRAME(0, -8, 0, 16),
AFFINEANIMCMD_FRAME(256, 256, 0, 0),
AFFINEANIMCMD_JUMP(0)
};
static const union AffineAnimCmd sSpriteAffineAnim_857FC3C[] =
{
AFFINEANIMCMD_FRAME(-1, -1, 3, 96),
AFFINEANIMCMD_FRAME(0, 0, 0, 16),
AFFINEANIMCMD_FRAME(-2, -2, 1, 64),
AFFINEANIMCMD_FRAME(-8, 0, 0, 16),
AFFINEANIMCMD_FRAME(0, -8, 0, 16),
AFFINEANIMCMD_FRAME(256, 256, 0, 0),
AFFINEANIMCMD_JUMP(0)
};
static const union AffineAnimCmd *const sSpriteAffineAnimTable_857FC74[] =
{
sSpriteAffineAnim_857FC04,
sSpriteAffineAnim_857FC3C
};
static const struct SpriteTemplate gUnknown_0857FC7C =
{
.tileTag = 0xFFFF,
.paletteTag = 0x7544,
.oam = &sOamData_857FBD0,
.anims = sSpriteAnimTable_857FBE0,
.images = sSpriteImageTable_857FBE4,
.affineAnims = sSpriteAffineAnimTable_857FC74,
.callback = SpriteCallbackDummy,
};
static const struct CompressedTilesPal gBerryPicTable[] =
{
{gBerryPic_Cheri, gBerryPalette_Cheri},
{gBerryPic_Chesto, gBerryPalette_Chesto},
{gBerryPic_Pecha, gBerryPalette_Pecha},
{gBerryPic_Rawst, gBerryPalette_Rawst},
{gBerryPic_Aspear, gBerryPalette_Aspear},
{gBerryPic_Leppa, gBerryPalette_Leppa},
{gBerryPic_Oran, gBerryPalette_Oran},
{gBerryPic_Persim, gBerryPalette_Persim},
{gBerryPic_Lum, gBerryPalette_Lum},
{gBerryPic_Sitrus, gBerryPalette_Sitrus},
{gBerryPic_Figy, gBerryPalette_Figy},
{gBerryPic_Wiki, gBerryPalette_Wiki},
{gBerryPic_Mago, gBerryPalette_Mago},
{gBerryPic_Aguav, gBerryPalette_Aguav},
{gBerryPic_Iapapa, gBerryPalette_Iapapa},
{gBerryPic_Razz, gBerryPalette_Razz},
{gBerryPic_Bluk, gBerryPalette_Bluk},
{gBerryPic_Nanab, gBerryPalette_Nanab},
{gBerryPic_Wepear, gBerryPalette_Wepear},
{gBerryPic_Pinap, gBerryPalette_Pinap},
{gBerryPic_Pomeg, gBerryPalette_Pomeg},
{gBerryPic_Kelpsy, gBerryPalette_Kelpsy},
{gBerryPic_Qualot, gBerryPalette_Qualot},
{gBerryPic_Hondew, gBerryPalette_Hondew},
{gBerryPic_Grepa, gBerryPalette_Grepa},
{gBerryPic_Tamato, gBerryPalette_Tamato},
{gBerryPic_Cornn, gBerryPalette_Cornn},
{gBerryPic_Magost, gBerryPalette_Magost},
{gBerryPic_Rabuta, gBerryPalette_Rabuta},
{gBerryPic_Nomel, gBerryPalette_Nomel},
{gBerryPic_Spelon, gBerryPalette_Spelon},
{gBerryPic_Pamtre, gBerryPalette_Pamtre},
{gBerryPic_Watmel, gBerryPalette_Watmel},
{gBerryPic_Durin, gBerryPalette_Durin},
{gBerryPic_Belue, gBerryPalette_Belue},
{gBerryPic_Liechi, gBerryPalette_Liechi},
{gBerryPic_Ganlon, gBerryPalette_Ganlon},
{gBerryPic_Salac, gBerryPalette_Salac},
{gBerryPic_Petaya, gBerryPalette_Petaya},
{gBerryPic_Apicot, gBerryPalette_Apicot},
{gBerryPic_Lansat, gBerryPalette_Lansat},
{gBerryPic_Starf, gBerryPalette_Starf},
{gBerryPic_Enigma, gBerryPalette_Enigma},
};
const struct CompressedSpriteSheet gUnknown_0857FDEC =
{
gBerryCheckCircle_Gfx, 0x800, 10000
};
const struct CompressedSpritePalette gUnknown_0857FDF4 =
{
gUnknown_08D9BEF0, 10000
};
static const struct OamData sOamData_857FDFC =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 3,
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0
};
static const union AnimCmd sSpriteAnim_857FE04[] =
{
ANIMCMD_FRAME(0, 0),
ANIMCMD_END
};
static const union AnimCmd *const sSpriteAnimTable_857FE0C[] =
{
sSpriteAnim_857FE04
};
static const struct SpriteTemplate gUnknown_0857FE10 =
{
.tileTag = 10000,
.paletteTag = 10000,
.oam = &sOamData_857FDFC,
.anims = sSpriteAnimTable_857FE0C,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
const struct SpriteTemplate gUnknown_0857FE28 =
{
.tileTag = 0,
.paletteTag = 0,
.oam = &gDummyOamData,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80D5860,
};
const struct SpriteTemplate gUnknown_0857FE40 =
{
.tileTag = 0,
.paletteTag = 0,
.oam = &gDummyOamData,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80D58F8,
};
const struct SpriteTemplate gUnknown_0857FE58 =
{
.tileTag = 0,
.paletteTag = 0,
.oam = &gDummyOamData,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80D5968,
};
const struct SpriteTemplate gUnknown_0857FE70 =
{
.tileTag = 0,
.paletteTag = 0,
.oam = &gDummyOamData,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80D5A94,
};
const struct SpriteTemplate gUnknown_0857FE88 =
{
.tileTag = 0,
.paletteTag = 0,
.oam = &gDummyOamData,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80D5B48,
};
// code
void RemoveBagSprite(u8 id)
{
u8 *spriteId = &gUnknown_0203CE54->unk804[id];
if (*spriteId != 0xFF)
{
FreeSpriteTilesByTag(id + 100);
FreeSpritePaletteByTag(id + 100);
FreeSpriteOamMatrix(&gSprites[*spriteId]);
DestroySprite(&gSprites[*spriteId]);
*spriteId = 0xFF;
}
}
void AddBagVisualSprite(u8 bagPocketId)
{
u8 *spriteId = &gUnknown_0203CE54->unk804[0];
*spriteId = CreateSprite(&gUnknown_0857FB4C, 68, 66, 0);
SetBagVisualPocketId(bagPocketId, FALSE);
}
void SetBagVisualPocketId(u8 bagPocketId, bool8 isSwitchingPockets)
{
struct Sprite *sprite = &gSprites[gUnknown_0203CE54->unk804[0]];
if (isSwitchingPockets)
{
sprite->pos2.y = -5;
sprite->callback = SpriteCB_BagVisualSwitchingPockets;
sprite->data[0] = bagPocketId + 1;
StartSpriteAnim(sprite, 0);
}
else
{
StartSpriteAnim(sprite, bagPocketId + 1);
}
}
static void SpriteCB_BagVisualSwitchingPockets(struct Sprite *sprite)
{
if (sprite->pos2.y != 0)
{
sprite->pos2.y++;
}
else
{
StartSpriteAnim(sprite, sprite->data[0]);
sprite->callback = SpriteCallbackDummy;
}
}
void ShakeBagVisual(void)
{
struct Sprite *sprite = &gSprites[gUnknown_0203CE54->unk804[0]];
if (sprite->affineAnimEnded)
{
StartSpriteAffineAnim(sprite, 1);
sprite->callback = SpriteCB_ShakeBagVisual;
}
}
static void SpriteCB_ShakeBagVisual(struct Sprite *sprite)
{
if (sprite->affineAnimEnded)
{
StartSpriteAffineAnim(sprite, 0);
sprite->callback = SpriteCallbackDummy;
}
}
void AddSwitchPocketRotatingBallSprite(s16 rotationDirection)
{
u8 *spriteId = &gUnknown_0203CE54->unk804[1];
LoadSpriteSheet(&gUnknown_0857FBA0);
LoadSpritePalette(&gUnknown_0857FBA8);
*spriteId = CreateSprite(&gUnknown_0857FBB0, 16, 16, 0);
gSprites[*spriteId].data[0] = rotationDirection;
}
static void update_switch_pocket_rotating_ball_coords(struct Sprite *sprite)
{
sprite->centerToCornerVecX = sprite->data[1] - ((sprite->data[3] + 1) & 1);
sprite->centerToCornerVecY = sprite->data[1] - ((sprite->data[3] + 1) & 1);
}
static void SpriteCB_SwitchPocketRotatingBallInit(struct Sprite *sprite)
{
sprite->oam.affineMode = 1;
if (sprite->data[0] == -1)
sprite->affineAnims = sSpriteAffineAnimTable_857FB98;
else
sprite->affineAnims = sSpriteAffineAnimTable_857FB9C;
InitSpriteAffineAnim(sprite);
sprite->data[1] = sprite->centerToCornerVecX;
sprite->data[1] = sprite->centerToCornerVecY;
update_switch_pocket_rotating_ball_coords(sprite);
sprite->callback = SpriteCB_SwitchPocketRotatingBallContinue;
}
static void SpriteCB_SwitchPocketRotatingBallContinue(struct Sprite *sprite)
{
sprite->data[3]++;
update_switch_pocket_rotating_ball_coords(sprite);
if (sprite->data[3] == 16)
RemoveBagSprite(1);
}
void AddBagItemIconSprite(u16 itemId, u8 id)
{
u8 *spriteId = &gUnknown_0203CE54->unk804[id + 2];
if (*spriteId == 0xFF)
{
u8 iconSpriteId;
FreeSpriteTilesByTag(id + 102);
FreeSpritePaletteByTag(id + 102);
iconSpriteId = AddItemIconSprite(id + 102, id + 102, itemId);
if (iconSpriteId != MAX_SPRITES)
{
*spriteId = iconSpriteId;
gSprites[iconSpriteId].pos2.x = 24;
gSprites[iconSpriteId].pos2.y = 88;
}
}
}
void RemoveBagItemIconSprite(u8 id)
{
RemoveBagSprite(id + 2);
}
void sub_80D4FAC(void)
{
sub_8122344(&gUnknown_0203CE54->unk804[4], 8);
}
void sub_80D4FC8(u8 arg0)
{
sub_81223FC(&gUnknown_0203CE54->unk804[4], 8, arg0);
}
void sub_80D4FEC(u8 arg0)
{
sub_8122448(&gUnknown_0203CE54->unk804[4], 136, 120, (arg0 + 1) * 16);
}
static void sub_80D5018(void *mem0, void *mem1)
{
u8 i, j;
memset(mem1, 0, 0x800);
mem1 += 0x100;
for (i = 0; i < 6; i++)
{
mem1 += 0x20;
for (j = 0; j < 6; j++)
{
memcpy(mem1, mem0, 0x20);
mem1 += 0x20;
mem0 += 0x20;
}
if (i != 5)
mem1 += 0x20;
}
}
static void sub_80D5070(u8 berryId)
{
struct CompressedSpritePalette pal;
if (berryId == ITEM_TO_BERRY(ITEM_ENIGMA_BERRY) - 1 && IsEnigmaBerryValid())
{
// unknown empty if statement
}
pal.data = gBerryPicTable[berryId].pal;
pal.tag = 0x7544;
LoadCompressedObjectPalette(&pal);
LZDecompressWram(gBerryPicTable[berryId].tiles, &gDecompressionBuffer[0x1000]);
sub_80D5018(&gDecompressionBuffer[0x1000], &gDecompressionBuffer[0]);
}
u8 CreateBerryTagSprite(u8 id, s16 x, s16 y)
{
sub_80D5070(id);
return CreateSprite(&gUnknown_0857FBEC, x, y, 0);
}
void FreeBerryTagSpritePalette(void)
{
FreeSpritePaletteByTag(0x7544);
}
u8 sub_80D511C(u8 berryId, u8 x, u8 y, bool8 startAffine)
{
u8 spriteId;
FreeSpritePaletteByTag(0x7544);
sub_80D5070(berryId);
spriteId = CreateSprite(&gUnknown_0857FC7C, x, y, 0);
if (startAffine == TRUE)
StartSpriteAffineAnim(&gSprites[spriteId], 1);
return spriteId;
}
u8 CreateBerryFlavorCircleSprite(s16 x)
{
return CreateSprite(&gUnknown_0857FE10, x, 116, 0);
}

633
src/list_menu.c Normal file
View File

@ -0,0 +1,633 @@
#include "global.h"
#include "menu.h"
#include "list_menu.h"
#include "window.h"
#include "text_window.h"
#include "main.h"
#include "task.h"
#include "menu_indicators.h"
#include "strings.h"
#include "sound.h"
#include "constants/songs.h"
struct UnknownMysteryGiftLinkMenuStruct
{
s32 field_0;
u8 field_4;
u8 field_5;
u8 field_6;
};
struct UnknownListMenuPals
{
u8 cursorPal:4;
u8 fillValue:4;
u8 cursorShadowPal:4;
u8 lettersSpacing:6;
u8 field_2_2:6; // unused
u8 fontId:7;
u8 field_3_7:1;
};
extern struct UnknownMysteryGiftLinkMenuStruct gUnknown_0203CE84;
// this file's functions
static u8 ListMenuInitInternal(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow);
static bool8 ListMenuChangeSelection(struct ListMenu *list, bool8 updateCursorAndCallCallback, u8 count, bool8 movingDown);
static void ListMenuPrintEntries(struct ListMenu *list, u16 startIndex, u16 yOffset, u16 count);
static void ListMenuDrawCursor(struct ListMenu *list);
static void ListMenuCallSelectionChangedCallback(struct ListMenu *list, u8 a2);
static u8 ListMenuAddCursorObject(struct ListMenu *list, u32 cursorKind);
// IWRAM common
struct UnknownListMenuPals gUnknown_03006300;
struct ListMenuTemplate gMultiuseListMenuTemplate;
// code
static void ListMenuDummyTask(u8 taskId)
{
}
s32 DoMysteryGiftListMenu(struct WindowTemplate *windowTemplate, struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum)
{
switch (gUnknown_0203CE84.field_4)
{
case 0:
default:
gUnknown_0203CE84.field_5 = AddWindow(windowTemplate);
switch (arg2)
{
case 2:
sub_809882C(gUnknown_0203CE84.field_5, tileNum, palNum);
case 1:
sub_8098858(gUnknown_0203CE84.field_5, tileNum, palNum / 16);
break;
}
gMultiuseListMenuTemplate = *listMenuTemplate;
gMultiuseListMenuTemplate.windowId = gUnknown_0203CE84.field_5;
gUnknown_0203CE84.field_6 = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0);
CopyWindowToVram(gUnknown_0203CE84.field_5, 1);
gUnknown_0203CE84.field_4 = 1;
break;
case 1:
gUnknown_0203CE84.field_0 = ListMenuHandleInputGetItemId(gUnknown_0203CE84.field_6);
if (gMain.newKeys & A_BUTTON)
{
gUnknown_0203CE84.field_4 = 2;
}
if (gMain.newKeys & B_BUTTON)
{
gUnknown_0203CE84.field_0 = LIST_B_PRESSED;
gUnknown_0203CE84.field_4 = 2;
}
if (gUnknown_0203CE84.field_4 == 2)
{
if (arg2 == 0)
{
ClearWindowTilemap(gUnknown_0203CE84.field_5);
}
else
{
switch (arg2)
{
case 0: // can never be reached, because of the if statement above
sub_819746C(gUnknown_0203CE84.field_5, FALSE);
break;
case 2:
case 1:
sub_819746C(gUnknown_0203CE84.field_5, FALSE);
break;
}
}
CopyWindowToVram(gUnknown_0203CE84.field_5, 1);
}
break;
case 2:
DestroyListMenuTask(gUnknown_0203CE84.field_6, NULL, NULL);
RemoveWindow(gUnknown_0203CE84.field_5);
gUnknown_0203CE84.field_4 = 0;
return gUnknown_0203CE84.field_0;
}
return -1;
}
u8 ListMenuInit(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow)
{
u8 taskId = ListMenuInitInternal(listMenuTemplate, scrollOffset, selectedRow);
PutWindowTilemap(listMenuTemplate->windowId);
CopyWindowToVram(listMenuTemplate->windowId, 2);
return taskId;
}
// unused
u8 ListMenuInitWithWindows(struct ListMenuTemplate *listMenuTemplate, struct UnknownListMenuWindowStruct *arg1, u16 scrollOffset, u16 selectedRow)
{
s32 i;
u8 taskId = ListMenuInitInternal(listMenuTemplate, scrollOffset, selectedRow);
for (i = 0; arg1[i].palNum != 0xFF; i++)
{
PutWindowRectTilemapOverridePalette(listMenuTemplate->windowId,
arg1[i].x,
arg1[i].y,
arg1[i].width,
arg1[i].height,
arg1[i].palNum);
}
CopyWindowToVram(listMenuTemplate->windowId, 2);
return taskId;
}
s32 ListMenuHandleInputGetItemId(u8 listTaskId)
{
struct ListMenu *list = (void*) gTasks[listTaskId].data;
if (gMain.newKeys & A_BUTTON)
{
return list->template.items[list->scrollOffset + list->selectedRow].id;
}
else if (gMain.newKeys & B_BUTTON)
{
return LIST_B_PRESSED;
}
else if (gMain.newAndRepeatedKeys & DPAD_UP)
{
ListMenuChangeSelection(list, TRUE, 1, FALSE);
return LIST_NOTHING_CHOSEN;
}
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
{
ListMenuChangeSelection(list, TRUE, 1, TRUE);
return LIST_NOTHING_CHOSEN;
}
else // try to move by one window scroll
{
bool16 rightButton, leftButton;
switch (list->template.scrollMultiple)
{
case LIST_NO_MULTIPLE_SCROLL:
default:
leftButton = FALSE;
rightButton = FALSE;
break;
case LIST_MULTIPLE_SCROLL_DPAD:
leftButton = gMain.newAndRepeatedKeys & DPAD_LEFT;
rightButton = gMain.newAndRepeatedKeys & DPAD_RIGHT;
break;
case LIST_MULTIPLE_SCROLL_L_R:
leftButton = gMain.newAndRepeatedKeys & L_BUTTON;
rightButton = gMain.newAndRepeatedKeys & R_BUTTON;
break;
}
if (leftButton)
{
ListMenuChangeSelection(list, TRUE, list->template.maxShowed, FALSE);
return LIST_NOTHING_CHOSEN;
}
else if (rightButton)
{
ListMenuChangeSelection(list, TRUE, list->template.maxShowed, TRUE);
return LIST_NOTHING_CHOSEN;
}
else
{
return LIST_NOTHING_CHOSEN;
}
}
}
void DestroyListMenuTask(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow)
{
struct ListMenu *list = (void*) gTasks[listTaskId].data;
if (scrollOffset != NULL)
*scrollOffset = list->scrollOffset;
if (selectedRow != NULL)
*selectedRow = list->selectedRow;
if (list->unk_1E != 0xFF)
ListMenuRemoveCursorObject(list->unk_1E, list->template.cursorKind - 2);
DestroyTask(listTaskId);
}
void sub_81AE70C(u8 listTaskId)
{
struct ListMenu *list = (void*) gTasks[listTaskId].data;
FillWindowPixelBuffer(list->template.windowId, (list->template.fillValue << 4) | (list->template.fillValue));
ListMenuPrintEntries(list, list->scrollOffset, 0, list->template.maxShowed);
ListMenuDrawCursor(list);
CopyWindowToVram(list->template.windowId, 2);
}
// unused
void ChangeListMenuPals(u8 listTaskId, u8 cursorPal, u8 fillValue, u8 cursorShadowPal)
{
struct ListMenu *list = (void*) gTasks[listTaskId].data;
list->template.cursorPal = cursorPal;
list->template.fillValue = fillValue;
list->template.cursorShadowPal = cursorShadowPal;
}
// unused
void ChangeListMenuCoords(u8 listTaskId, u8 x, u8 y)
{
struct ListMenu *list = (void*) gTasks[listTaskId].data;
SetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_LEFT, x);
SetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_TOP, y);
}
// unused
s32 ListMenuTestInput(struct ListMenuTemplate *template, u32 scrollOffset, u32 selectedRow, u16 keys, u16 *newScrollOffset, u16 *newSelectedRow)
{
struct ListMenu list;
list.template = *template;
list.scrollOffset = scrollOffset;
list.selectedRow = selectedRow;
list.unk_1C = 0;
list.unk_1D = 0;
if (keys == DPAD_UP)
ListMenuChangeSelection(&list, FALSE, 1, FALSE);
if (keys == DPAD_DOWN)
ListMenuChangeSelection(&list, FALSE, 1, TRUE);
if (newScrollOffset != NULL)
*newScrollOffset = list.scrollOffset;
if (newSelectedRow != NULL)
*newSelectedRow = list.selectedRow;
return LIST_NOTHING_CHOSEN;
}
void ListMenuGetCurrentItemArrayId(u8 listTaskId, u16 *arrayId)
{
struct ListMenu *list = (void*) gTasks[listTaskId].data;
if (arrayId != NULL)
*arrayId = list->scrollOffset + list->selectedRow;
}
void ListMenuGetScrollAndRow(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow)
{
struct ListMenu *list = (void*) gTasks[listTaskId].data;
if (scrollOffset != NULL)
*scrollOffset = list->scrollOffset;
if (selectedRow != NULL)
*selectedRow = list->selectedRow;
}
u16 ListMenuGetYCoordForPrintingArrowCursor(u8 listTaskId)
{
struct ListMenu *list = (void*) gTasks[listTaskId].data;
u8 yMultiplier = GetFontAttribute(list->template.fontId, 1) + list->template.unk_16_3;
return list->selectedRow * yMultiplier + list->template.upText_Y;
}
static u8 ListMenuInitInternal(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow)
{
u8 listTaskId = CreateTask(ListMenuDummyTask, 0);
struct ListMenu *list = (void*) gTasks[listTaskId].data;
list->template = *listMenuTemplate;
list->scrollOffset = scrollOffset;
list->selectedRow = selectedRow;
list->unk_1C = 0;
list->unk_1D = 0;
list->unk_1E = 0xFF;
list->unk_1F = 0;
gUnknown_03006300.cursorPal = list->template.cursorPal;
gUnknown_03006300.fillValue = list->template.fillValue;
gUnknown_03006300.cursorShadowPal = list->template.cursorShadowPal;
gUnknown_03006300.lettersSpacing = list->template.lettersSpacing;
gUnknown_03006300.fontId = list->template.fontId;
gUnknown_03006300.field_3_7 = 0;
if (list->template.totalItems < list->template.maxShowed)
list->template.maxShowed = list->template.totalItems;
FillWindowPixelBuffer(list->template.windowId, (list->template.fillValue << 4) | (list->template.fillValue));
ListMenuPrintEntries(list, list->scrollOffset, 0, list->template.maxShowed);
ListMenuDrawCursor(list);
ListMenuCallSelectionChangedCallback(list, 1);
return listTaskId;
}
static void ListMenuPrint(struct ListMenu *list, const u8 *str, u8 x, u8 y)
{
u8 colors[3];
if (gUnknown_03006300.field_3_7)
{
colors[0] = gUnknown_03006300.fillValue;
colors[1] = gUnknown_03006300.cursorPal;
colors[2] = gUnknown_03006300.cursorShadowPal;
AddTextPrinterParameterized2(list->template.windowId,
gUnknown_03006300.fontId,
x, y,
gUnknown_03006300.lettersSpacing,
0, colors, TEXT_SPEED_FF, str);
gUnknown_03006300.field_3_7 = 0;
}
else
{
colors[0] = list->template.fillValue;
colors[1] = list->template.cursorPal;
colors[2] = list->template.cursorShadowPal;
AddTextPrinterParameterized2(list->template.windowId,
list->template.fontId,
x, y,
list->template.lettersSpacing,
0, colors, TEXT_SPEED_FF, str);
}
}
static void ListMenuPrintEntries(struct ListMenu *list, u16 startIndex, u16 yOffset, u16 count)
{
s32 i;
u8 x, y;
u8 yMultiplier = GetFontAttribute(list->template.fontId, 1) + list->template.unk_16_3;
for (i = 0; i < count; i++)
{
if (list->template.items[startIndex].id != -3)
x = list->template.unk_12;
else
x = list->template.unk_11;
y = (yOffset + i) * yMultiplier + list->template.upText_Y;
if (list->template.unk_08 != NULL)
list->template.unk_08(list->template.windowId, list->template.items[startIndex].id, y);
ListMenuPrint(list, list->template.items[startIndex].name, x, y);
startIndex++;
}
}
static void ListMenuDrawCursor(struct ListMenu *list)
{
u8 yMultiplier = GetFontAttribute(list->template.fontId, 1) + list->template.unk_16_3;
u8 x = list->template.cursor_X;
u8 y = list->selectedRow * yMultiplier + list->template.upText_Y;
switch (list->template.cursorKind)
{
case 0:
ListMenuPrint(list, gText_SelectorArrow2, x, y);
break;
case 1:
break;
case 2:
if (list->unk_1E == 0xFF)
list->unk_1E = ListMenuAddCursorObject(list, 0);
ListMenuUpdateCursorObject(list->unk_1E,
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_LEFT) * 8 - 1,
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_TOP) * 8 + y - 1, 0);
break;
case 3:
if (list->unk_1E == 0xFF)
list->unk_1E = ListMenuAddCursorObject(list, 1);
ListMenuUpdateCursorObject(list->unk_1E,
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_LEFT) * 8 + x,
GetWindowAttribute(list->template.windowId, WINDOW_TILEMAP_TOP) * 8 + y, 1);
break;
}
}
static u8 ListMenuAddCursorObject(struct ListMenu *list, u32 cursorKind)
{
struct CursorStruct cursor;
cursor.unk0 = 0;
cursor.unk1 = 0xA0;
cursor.unk2 = GetWindowAttribute(list->template.windowId, WINDOW_WIDTH) * 8 + 2;
cursor.unk4 = GetFontAttribute(list->template.fontId, 1) + 2;
cursor.unk6 = 0x4000;
cursor.unk8 = 0xFFFF;
cursor.unkA = 0xF;
return ListMenuAddCursorObjectInternal(&cursor, cursorKind);
}
static void ListMenuErasePrintedCursor(struct ListMenu *list, u16 selectedRow)
{
u8 cursorKind = list->template.cursorKind;
if (cursorKind == 0)
{
u8 yMultiplier = GetFontAttribute(list->template.fontId, 1) + list->template.unk_16_3;
u8 width = GetMenuCursorDimensionByFont(list->template.fontId, 0);
u8 height = GetMenuCursorDimensionByFont(list->template.fontId, 1);
FillWindowPixelRect(list->template.windowId,
(list->template.fillValue << 4) | (list->template.fillValue),
list->template.cursor_X,
selectedRow * yMultiplier + list->template.upText_Y,
width,
height);
}
}
static u8 ListMenuUpdateSelectedRowIndexAndScrollOffset(struct ListMenu *list, bool8 movingDown)
{
u16 selectedRow = list->selectedRow;
u16 scrollOffset = list->scrollOffset;
u16 newRow;
u32 newScroll;
if (!movingDown)
{
if (list->template.maxShowed == 1)
newRow = 0;
else
newRow = list->template.maxShowed - ((list->template.maxShowed / 2) + (list->template.maxShowed % 2)) - 1;
if (scrollOffset == 0)
{
while (selectedRow != 0)
{
selectedRow--;
if (list->template.items[scrollOffset + selectedRow].id != -3)
{
list->selectedRow = selectedRow;
return 1;
}
}
return 0;
}
else
{
while (selectedRow > newRow)
{
selectedRow--;
if (list->template.items[scrollOffset + selectedRow].id != -3)
{
list->selectedRow = selectedRow;
return 1;
}
}
newScroll = scrollOffset - 1;
}
}
else
{
if (list->template.maxShowed == 1)
newRow = 0;
else
newRow = ((list->template.maxShowed / 2) + (list->template.maxShowed % 2));
if (scrollOffset == list->template.totalItems - list->template.maxShowed)
{
while (selectedRow < list->template.maxShowed - 1)
{
selectedRow++;
if (list->template.items[scrollOffset + selectedRow].id != -3)
{
list->selectedRow = selectedRow;
return 1;
}
}
return 0;
}
else
{
while (selectedRow < newRow)
{
selectedRow++;
if (list->template.items[scrollOffset + selectedRow].id != -3)
{
list->selectedRow = selectedRow;
return 1;
}
}
newScroll = scrollOffset + 1;
}
}
list->selectedRow = newRow;
list->scrollOffset = newScroll;
return 2;
}
static void ListMenuScroll(struct ListMenu *list, u8 count, bool8 movingDown)
{
if (count >= list->template.maxShowed)
{
FillWindowPixelBuffer(list->template.windowId, (list->template.fillValue << 4) | (list->template.fillValue));
ListMenuPrintEntries(list, list->scrollOffset, 0, list->template.maxShowed);
}
else
{
u8 yMultiplier = GetFontAttribute(list->template.fontId, 1) + list->template.unk_16_3;
if (!movingDown)
{
u16 y, width, height;
ScrollWindow(list->template.windowId, 1, count * yMultiplier, (list->template.fillValue << 4) | (list->template.fillValue));
ListMenuPrintEntries(list, list->scrollOffset, 0, count);
y = (list->template.maxShowed * yMultiplier) + list->template.upText_Y;
width = GetWindowAttribute(list->template.windowId, WINDOW_WIDTH) * 8;
height = (GetWindowAttribute(list->template.windowId, WINDOW_HEIGHT) * 8) - y;
FillWindowPixelRect(list->template.windowId,
(list->template.fillValue << 4) | (list->template.fillValue),
0, y, width, height);
}
else
{
u16 width;
ScrollWindow(list->template.windowId, 0, count * yMultiplier, (list->template.fillValue << 4) | (list->template.fillValue));
ListMenuPrintEntries(list, list->scrollOffset + (list->template.maxShowed - count), list->template.maxShowed - count, count);
width = GetWindowAttribute(list->template.windowId, WINDOW_WIDTH) * 8;
FillWindowPixelRect(list->template.windowId,
(list->template.fillValue << 4) | (list->template.fillValue),
0, 0, width, list->template.upText_Y);
}
}
}
static bool8 ListMenuChangeSelection(struct ListMenu *list, bool8 updateCursorAndCallCallback, u8 count, bool8 movingDown)
{
u16 oldSelectedRow;
u8 selectionChange, i, cursorCount;
oldSelectedRow = list->selectedRow;
cursorCount = 0;
selectionChange = 0;
for (i = 0; i < count; i++)
{
do
{
u8 ret = ListMenuUpdateSelectedRowIndexAndScrollOffset(list, movingDown);
selectionChange |= ret;
if (ret != 2)
break;
cursorCount++;
} while (list->template.items[list->scrollOffset + list->selectedRow].id == -3);
}
if (updateCursorAndCallCallback)
{
switch (selectionChange)
{
case 0:
default:
return TRUE;
case 1:
ListMenuErasePrintedCursor(list, oldSelectedRow);
ListMenuDrawCursor(list);
ListMenuCallSelectionChangedCallback(list, 0);
CopyWindowToVram(list->template.windowId, 2);
break;
case 2:
case 3:
ListMenuErasePrintedCursor(list, oldSelectedRow);
ListMenuScroll(list, cursorCount, movingDown);
ListMenuDrawCursor(list);
ListMenuCallSelectionChangedCallback(list, 0);
CopyWindowToVram(list->template.windowId, 2);
break;
}
}
return FALSE;
}
static void ListMenuCallSelectionChangedCallback(struct ListMenu *list, u8 a2)
{
if (list->template.moveCursorFunc != NULL)
list->template.moveCursorFunc(list->template.items[list->scrollOffset + list->selectedRow].id, a2, list);
}
// unused
void sub_81AF028(u8 cursorPal, u8 fillValue, u8 cursorShadowPal)
{
gUnknown_03006300.cursorPal = cursorPal;
gUnknown_03006300.fillValue = fillValue;
gUnknown_03006300.cursorShadowPal = cursorShadowPal;
gUnknown_03006300.field_3_7 = 1;
}
void sub_81AF078(s32 arg0, u8 arg1, struct ListMenu *list)
{
if (!arg1)
PlaySE(SE_SELECT);
}

View File

@ -32,6 +32,7 @@
#include "task.h"
#include "window.h"
// structures
struct Struct203BCC4
{
struct ListMenuItem unk0[51];
@ -42,8 +43,10 @@ struct Struct203BCC4
u8 spriteIds[7];
};
// extern offset
void (*gFieldCallback)(void);
// static functions
static void InitPlayerPCMenu(u8 taskId);
static void PlayerPCProcessMenuInput(u8 taskId);
static void InitItemStorageMenu(u8 taskId, u8 var);
@ -79,6 +82,7 @@ static void Mailbox_ReturnToFieldFromReadMail(void);
static void Mailbox_DoRedrawMailboxMenuAfterReturn(void);
static void pal_fill_for_maplights_or_black(void);
static void Mailbox_HandleReturnToProcessInput(u8 taskId);
static void Mailbox_UpdateMailListAfterDeposit(void);
static void ItemStorage_Withdraw(u8 taskId);
static void ItemStorage_Deposit(u8 taskId);
@ -119,18 +123,16 @@ static void sub_816C0C8(void);
static void sub_816C060(u16 itemId);
static void sub_816BEF0(s32 id);
static void sub_816B4DC(u8 taskId);
static void ItemStorage_DrawBothListAndDescription(u32 id, bool8 b, struct ListMenu * thisMenu);
static void ItemStorage_MoveCursor(s32 id, bool8 b, struct ListMenu * thisMenu);
static void fish4_goto_x5_or_x6(u8 windowId, s32 id, u8 yOffset);
static void Mailbox_UpdateMailListAfterDeposit(void);
// EWRAM
static EWRAM_DATA const u8 *gPcItemMenuOptionOrder = NULL;
static EWRAM_DATA u8 gPcItemMenuOptionsNum = 0;
EWRAM_DATA struct PlayerPCItemPageStruct playerPCItemPageInfo = {0, 0, 0, 0, {0, 0, 0}, 0};
static EWRAM_DATA struct Struct203BCC4 *gUnknown_0203BCC4 = NULL;
// .rodata
static const u8 *const gPCText_OptionDescList[] =
{
gText_TakeOutItemsFromPC,
@ -191,7 +193,7 @@ static const struct WindowTemplate gUnknown_085DFF24[3] =
{0x00, 0x01, 0x01, 0x0A, 0x08, 0x0F, 0x0001}
};
static const struct YesNoFuncTable gUnknown_085DFF3C = // ResumeFromWithdrawYesNoFuncList
static const struct YesNoFuncTable ResumeFromWithdrawYesNoFuncList = // ResumeFromWithdrawYesNoFuncList
{
ItemStorage_ResumeInputFromYesToss,
ItemStorage_ResumeInputFromNoToss
@ -199,7 +201,7 @@ static const struct YesNoFuncTable gUnknown_085DFF3C = // ResumeFromWithdrawYesN
static const struct ListMenuTemplate gUnknown_085DFF44 = {
NULL,
ItemStorage_DrawBothListAndDescription,
ItemStorage_MoveCursor,
fish4_goto_x5_or_x6,
0, 0,
0, 0, 8, 0,
@ -222,7 +224,7 @@ static const struct WindowTemplate gUnknown_085DFF84 =
static const u8 gUnknown_085DFF8C[] = {0x01, 0x03, 0x02, 0x00};
// text
void NewGameInitPCItems(void)
{
u8 i;
@ -560,7 +562,7 @@ static void Mailbox_ProcessInput(u8 taskId)
if(!gPaletteFade.active)
{
inputOptionId = ListMenuHandleInputGetItemId(data[5]);
sub_81AE860(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
ListMenuGetScrollAndRow(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
switch(inputOptionId)
{
@ -575,7 +577,7 @@ static void Mailbox_ProcessInput(u8 taskId)
PlaySE(SE_SELECT);
sub_81D1D04(0);
sub_81D1D04(1);
sub_81AE6C8(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
DestroyListMenuTask(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
schedule_bg_copy_tilemap_to_vram(0);
RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorId);
gTasks[taskId].func = Mailbox_PrintWhatToDoWithPlayerMailText;
@ -598,7 +600,7 @@ static void Mailbox_ReturnToPlayerPC(u8 taskId)
sub_81D1D04(0);
sub_81D1D04(1);
sub_81AE6C8(data[5], NULL, NULL);
DestroyListMenuTask(data[5], NULL, NULL);
schedule_bg_copy_tilemap_to_vram(0);
sub_81D1EC0();
ReshowPlayerPC(taskId);
@ -846,7 +848,7 @@ void ItemStorage_RefreshListMenu(void)
gUnknown_0203BCC4->unk0[i].name = &(gUnknown_0203BCC4->unk198[i][0]);
gUnknown_0203BCC4->unk0[i].id = -2;
gMultiuseListMenuTemplate = gUnknown_085DFF44;
gMultiuseListMenuTemplate.unk_10 = sub_816BC7C(0);
gMultiuseListMenuTemplate.windowId = sub_816BC7C(0);
gMultiuseListMenuTemplate.totalItems = playerPCItemPageInfo.count;
gMultiuseListMenuTemplate.items = gUnknown_0203BCC4->unk0;
gMultiuseListMenuTemplate.maxShowed = playerPCItemPageInfo.pageItems;
@ -857,7 +859,7 @@ void CopyItemName_PlayerPC(u8 *string, u16 itemId)
CopyItemName(itemId, string);
}
static void ItemStorage_DrawBothListAndDescription(u32 id, bool8 b, struct ListMenu *thisMenu)
static void ItemStorage_MoveCursor(s32 id, bool8 b, struct ListMenu *thisMenu)
{
if(b != TRUE)
PlaySE(SE_SELECT);
@ -1057,7 +1059,7 @@ static void ItemStorage_ProcessInput(u8 taskId)
data = gTasks[taskId].data;
if(gMain.newKeys & SELECT_BUTTON)
{
sub_81AE860(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
ListMenuGetScrollAndRow(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
if((playerPCItemPageInfo.itemsAbove + playerPCItemPageInfo.cursorPos) != (playerPCItemPageInfo.count - 1))
{
PlaySE(SE_SELECT);
@ -1067,7 +1069,7 @@ static void ItemStorage_ProcessInput(u8 taskId)
else
{
id = ListMenuHandleInputGetItemId(data[5]);
sub_81AE860(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
ListMenuGetScrollAndRow(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
switch(id)
{
case -1:
@ -1107,7 +1109,7 @@ static void ItemStorage_GoBackToPlayerPCMenu(u8 taskId)
data = gTasks[taskId].data;
sub_816C0C8();
ItemStorage_RemoveScrollIndicator();
sub_81AE6C8(data[5], NULL, NULL);
DestroyListMenuTask(data[5], NULL, NULL);
sub_81223B0(gUnknown_0203BCC4->spriteIds, 7);
sub_816BC58();
gTasks[taskId].func = ItemStorage_GoBackToPlayerPCMenu_InitStorage;
@ -1135,12 +1137,12 @@ static void sub_816C4FC(u8 taskId)
data = gTasks[taskId].data;
if(gMain.newKeys & SELECT_BUTTON)
{
sub_81AE860(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
ListMenuGetScrollAndRow(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
ItemStorage_DoItemSwap(taskId, FALSE);
return;
}
id = ListMenuHandleInputGetItemId(data[5]);
sub_81AE860(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
ListMenuGetScrollAndRow(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
sub_81223FC(gUnknown_0203BCC4->spriteIds, 7, 0);
sub_816C690(playerPCItemPageInfo.cursorPos);
switch(id)
@ -1170,7 +1172,7 @@ static void ItemStorage_DoItemSwap(u8 taskId, bool8 a)
data = gTasks[taskId].data;
b = (playerPCItemPageInfo.itemsAbove + playerPCItemPageInfo.cursorPos);
PlaySE(SE_SELECT);
sub_81AE6C8(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
DestroyListMenuTask(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
if(!a)
{
c = gUnknown_0203BCC4->unk666;
@ -1304,7 +1306,7 @@ static void ItemStorage_DoItemToss(u8 taskId)
CopyItemName(gSaveBlock1Ptr->pcItems[b].itemId, gStringVar1);
ConvertIntToDecimalStringN(gStringVar2, data[2], STR_CONV_MODE_LEFT_ALIGN, 3);
ItemStorage_PrintItemPcResponse(ItemStorage_GetItemPcResponse(ITEMPC_OKAY_TO_THROW_AWAY));
CreateYesNoMenuWithCallbacks(taskId, &gUnknown_085DFF84, 1, 0, 1, 0x214, 0xE, &gUnknown_085DFF3C);
CreateYesNoMenuWithCallbacks(taskId, &gUnknown_085DFF84, 1, 0, 1, 0x214, 0xE, &ResumeFromWithdrawYesNoFuncList);
}
else
{
@ -1334,7 +1336,7 @@ static void ItemStorage_HandleRemoveItem(u8 taskId)
if(gMain.newKeys & (A_BUTTON | B_BUTTON))
{
sub_80D6E48((playerPCItemPageInfo.cursorPos + playerPCItemPageInfo.itemsAbove), data[2]);
sub_81AE6C8(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
DestroyListMenuTask(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
sub_816C110();
sub_816C140();
ItemStorage_RefreshListMenu();

View File

@ -91,7 +91,7 @@ static void sub_81362E0(void);
static void sub_8136344(void);
static void HandlePokeblockListMenuItems(void);
static void sub_81363BC(void);
static void MovePokeblockMenuCursor(u32 pkblId, bool8 arg1, struct ListMenu *arg2);
static void MovePokeblockMenuCursor(s32 pkblId, bool8 arg1, struct ListMenu *arg2);
static void PutPokeblockInfoText(void);
static void HandlePokeblockMenuCursor(u16 cursorPos, u16 arg1);
static void PutPokeblockListMenuString(u8 *dst, u16 pkblId);
@ -319,18 +319,18 @@ static const struct ListMenuTemplate sPokeblockListMenuTemplate =
.unk_08 = NULL,
.totalItems = 0,
.maxShowed = 0,
.unk_10 = 1,
.windowId = 1,
.unk_11 = 0,
.unk_12 = 1,
.cursor_Y = 0,
.cursor_X = 0,
.upText_Y = 1,
.cursorColor = 2,
.fillColor = 0,
.cursorShadowColor = 3,
.unk_16_0 = FALSE,
.spaceBetweenItems = 32,
.unk_16_7 = FALSE,
.unk_17_0 = 1,
.cursorPal = 2,
.fillValue = 0,
.cursorShadowPal = 3,
.lettersSpacing = 0,
.unk_16_3 = 0,
.scrollMultiple = LIST_MULTIPLE_SCROLL_DPAD,
.fontId = 1,
.cursorKind = 1
};
@ -620,7 +620,7 @@ static void HandlePokeblockListMenuItems(void)
sPokeblockMenu->items[i].id = LIST_B_PRESSED;
gMultiuseListMenuTemplate = sPokeblockListMenuTemplate;
gMultiuseListMenuTemplate.unk_17_0 = 7;
gMultiuseListMenuTemplate.fontId = 7;
gMultiuseListMenuTemplate.totalItems = sPokeblockMenu->itemsNo;
gMultiuseListMenuTemplate.items = sPokeblockMenu->items;
gMultiuseListMenuTemplate.maxShowed = sPokeblockMenu->maxShowed;
@ -639,7 +639,7 @@ static void PutPokeblockListMenuString(u8 *dst, u16 pkblId)
StringExpandPlaceholders(txtPtr, gText_LvVar1);
}
static void MovePokeblockMenuCursor(u32 pkblId, bool8 arg1, struct ListMenu *arg2)
static void MovePokeblockMenuCursor(s32 pkblId, bool8 arg1, struct ListMenu *arg2)
{
if (arg1 != TRUE)
{
@ -869,7 +869,7 @@ static void Task_FreeDataAndExitPokeblockCase(u8 taskId)
if (sPokeblockMenu->caseId == PBLOCK_CASE_FEEDER || sPokeblockMenu->caseId == PBLOCK_CASE_GIVE)
gFieldCallback = sub_80AF168;
sub_81AE6C8(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
DestroyListMenuTask(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
sub_8136418();
ResetSpriteData();
FreeAllSpritePalettes();
@ -893,7 +893,7 @@ static void Task_HandlePokeblockMenuInput(u8 taskId)
{
if (gMain.newKeys & SELECT_BUTTON)
{
sub_81AE860(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
ListMenuGetScrollAndRow(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
if (sSavedPokeblockData.lastItemPage + sSavedPokeblockData.lastItemPos != sPokeblockMenu->itemsNo - 1)
{
PlaySE(SE_SELECT);
@ -908,7 +908,7 @@ static void Task_HandlePokeblockMenuInput(u8 taskId)
u16 oldPosition = sSavedPokeblockData.lastItemPos;
s32 itemId = ListMenuHandleInputGetItemId(data[0]);
sub_81AE860(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
ListMenuGetScrollAndRow(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
if (oldPosition != sSavedPokeblockData.lastItemPos)
{
HandlePokeblockMenuCursor(oldPosition, 5);
@ -945,7 +945,7 @@ static void Task_HandlePokeblocksSwapInput(u8 taskId)
if (gMain.newKeys & SELECT_BUTTON)
{
PlaySE(SE_SELECT);
sub_81AE860(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
ListMenuGetScrollAndRow(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
HandlePokeblocksSwap(taskId, FALSE);
}
else
@ -954,7 +954,7 @@ static void Task_HandlePokeblocksSwapInput(u8 taskId)
u16 var = sSavedPokeblockData.lastItemPos;
s32 itemId = ListMenuHandleInputGetItemId(data[0]);
sub_81AE860(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
ListMenuGetScrollAndRow(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
if (i != sSavedPokeblockData.lastItemPage || var != sSavedPokeblockData.lastItemPos)
{
for (i = 0; i < 9; i++)
@ -996,7 +996,7 @@ static void HandlePokeblocksSwap(u8 taskId, bool8 noSwap)
u16 swappedFromId = sSavedPokeblockData.lastItemPage + sSavedPokeblockData.lastItemPos;
sPokeblockMenu->isSwapping = FALSE;
sub_81AE6C8(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
DestroyListMenuTask(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
if (!noSwap && data[2] != swappedFromId && data[2] != swappedFromId - 1)
{
@ -1112,7 +1112,7 @@ static void HandleErasePokeblock(u8 taskId)
lastPos = &sSavedPokeblockData.lastItemPos;
data = gTasks[taskId].data;
sub_81AE6C8(data[0], lastPage, lastPos);
DestroyListMenuTask(data[0], lastPage, lastPos);
HandlePokeblockMenuCursor(*lastPos, 5);
SetMenuItemsCountAndMaxShowed();
sub_81362E0();

View File

@ -26,6 +26,7 @@
#include "international_string_util.h"
#include "scanline_effect.h"
#include "menu_helpers.h"
#include "daycare.h"
struct ContestMove
{
@ -3024,7 +3025,7 @@ void sub_81C31F0(u8 *a)
{
u8 level = gUnknown_0203CF1C->summary.metLevel;
if (level == 0)
level = 5;
level = EGG_HATCH_LEVEL;
ConvertIntToDecimalStringN(a, level, 0, 3);
UnkTextUtil_SetPtrI(3, a);
}

View File

@ -6,8 +6,8 @@
#include "main.h"
#include "task.h"
#include "palette.h"
#include "list_menu.h"
#include "window.h"
#include "list_menu.h"
#include "menu.h"
#include "menu_helpers.h"
#include "menu_indicators.h"
@ -66,7 +66,7 @@ EWRAM_DATA struct SecretBaseListMenuBuffer *gUnknown_0203A020 = NULL;
void sub_80E9C9C(u8 taskId);
void game_continue(u8 taskId);
void sub_80E9DEC(u32 a0, bool8 flag, struct ListMenu *menu);
void sub_80E9DEC(s32 a0, bool8 flag, struct ListMenu *menu);
void sub_80E9E00(u8 taskId);
void sub_80E9E44(u8 taskId);
void sub_80E9E90(u8 taskId);
@ -913,13 +913,13 @@ void game_continue(u8 taskId)
data[3] = 8;
}
gMultiuseListMenuTemplate = gUnknown_0858D07C;
gMultiuseListMenuTemplate.unk_10 = data[6];
gMultiuseListMenuTemplate.windowId = data[6];
gMultiuseListMenuTemplate.totalItems = data[0];
gMultiuseListMenuTemplate.items = gUnknown_0203A020->items;
gMultiuseListMenuTemplate.maxShowed = data[3];
}
void sub_80E9DEC(u32 a0, bool8 flag, struct ListMenu *menu)
void sub_80E9DEC(s32 a0, bool8 flag, struct ListMenu *menu)
{
if (flag != TRUE)
{
@ -953,14 +953,14 @@ void sub_80E9E90(u8 taskId)
data = gTasks[taskId].data;
input = ListMenuHandleInputGetItemId(data[5]);
sub_81AE860(data[5], &data[2], &data[1]);
ListMenuGetScrollAndRow(data[5], &data[2], &data[1]);
switch (input)
{
case -1:
break;
case -2:
PlaySE(SE_SELECT);
sub_81AE6C8(data[5], NULL, NULL);
DestroyListMenuTask(data[5], NULL, NULL);
RemoveScrollIndicatorArrowPair(data[8]);
sub_819746C(data[6], 0);
ClearWindowTilemap(data[6]);
@ -1042,7 +1042,7 @@ void sub_80EA08C(u8 taskId)
data = gTasks[taskId].data;
sub_8197434(0, 0);
sub_81AE6C8(data[5], &data[2], &data[1]);
DestroyListMenuTask(data[5], &data[2], &data[1]);
gSaveBlock1Ptr->secretBases[data[4]].sbr_field_1_6 = 0;
game_continue(taskId);
sub_812225C(&data[2], &data[1], data[3], data[0]);
@ -1061,7 +1061,7 @@ void sub_80EA13C(u8 taskId)
data = gTasks[taskId].data;
sub_8197434(0, 0);
sub_81AE6C8(data[5], &data[2], &data[1]);
DestroyListMenuTask(data[5], &data[2], &data[1]);
sub_80E9E00(taskId);
gTasks[taskId].func = sub_80E9E90;
}

View File

@ -178,11 +178,7 @@ gUnknown_030062F0: @ 30062F0
gUnknown_030062F4: @ 30062F4
.space 0xC
gUnknown_03006300: @ 3006300
.space 0x10
gMultiuseListMenuTemplate: @ 3006310
.space 0x18
.include "list_menu.o"
gUnknown_03006328: @ 3006328
.space 0x48