pokecrystal-board/event/buena.asm

342 lines
5.1 KiB
NASM
Raw Normal View History

2015-10-16 10:35:43 -07:00
SpecialBuenasPassword: ; 8af6b
xor a
2015-12-18 17:07:09 -08:00
ld [wWhichIndexSet], a
2015-11-01 09:44:30 -08:00
ld hl, .MenuDataHeader
2015-10-16 10:35:43 -07:00
call CopyMenuDataHeader
2015-10-24 07:34:19 -07:00
ld a, [wBuenasPassword]
2015-10-16 10:35:43 -07:00
ld c, a
callba GetBuenasPassword
2015-10-24 07:34:19 -07:00
ld a, [wMenuBorderLeftCoord]
2015-10-16 10:35:43 -07:00
add c
add $2
2015-10-24 07:34:19 -07:00
ld [wMenuBorderRightCoord], a
call BackUpTiles
2015-11-16 18:46:36 -08:00
call DoNthMenu ; menu
2015-11-17 09:29:37 -08:00
callba Buena_ExitMenu
2015-10-16 10:35:43 -07:00
ld b, $0
ld a, [MenuSelection]
ld c, a
2015-10-24 07:34:19 -07:00
ld a, [wBuenasPassword]
2015-10-16 10:35:43 -07:00
and $3
cp c
2015-11-01 09:44:30 -08:00
jr nz, .wrong
2015-10-16 10:35:43 -07:00
ld b, $1
2015-11-01 09:44:30 -08:00
.wrong
2015-10-16 10:35:43 -07:00
ld a, b
ld [ScriptVar], a
ret
; 8afa9
2015-11-01 09:44:30 -08:00
.MenuDataHeader: ; 0x8afa9
2015-10-16 10:35:43 -07:00
db $40 ; flags
db 00, 00 ; start coords
db 07, 10 ; end coords
2015-11-01 09:44:30 -08:00
dw .MenuData2
2015-10-16 10:35:43 -07:00
db 1 ; default option
; 0x8afb1
db 0
2015-11-01 09:44:30 -08:00
.MenuData2: ; 0x8afb2
2015-10-16 10:35:43 -07:00
db $81 ; flags
db 0 ; items
2015-11-01 09:44:30 -08:00
dw .PasswordIndices
dw .PlacePasswordChoices
2015-10-16 10:35:43 -07:00
; 0x8afb4
2015-11-01 09:44:30 -08:00
.PasswordIndices: ; 8afb8
2015-10-16 10:35:43 -07:00
db 3
db 0, 1, 2
db -1
2015-11-01 09:44:30 -08:00
.PlacePasswordChoices: ; 8afbd
2015-10-16 10:35:43 -07:00
push de
2015-10-24 07:34:19 -07:00
ld a, [wBuenasPassword]
2015-10-16 10:35:43 -07:00
and $f0
ld c, a
ld a, [MenuSelection]
add c
ld c, a
callba GetBuenasPassword
pop hl
call PlaceString
ret
; 8afd4
SpecialBuenaPrize: ; 8afd4
xor a
2015-11-23 13:04:53 -08:00
ld [wMenuScrollPosition], a
2015-10-16 10:35:43 -07:00
ld a, $1
ld [MenuSelection], a
2015-12-18 17:07:09 -08:00
call Buena_PlacePrizeMenuBox
call Buena_DisplayBlueCardBalance
2015-11-01 09:44:30 -08:00
ld hl, .Text_AskWhichPrize
2015-10-16 10:35:43 -07:00
call PrintText
2015-11-01 09:44:30 -08:00
jr .okay
2015-10-16 10:35:43 -07:00
2015-11-01 09:44:30 -08:00
.loop
ld hl, .Text_AskWhichPrize
2015-10-31 18:05:02 -07:00
call BuenaPrintText
2015-10-16 10:35:43 -07:00
2015-11-01 09:44:30 -08:00
.okay
2015-10-16 10:35:43 -07:00
call DelayFrame
call UpdateSprites
2015-12-17 19:31:16 -08:00
call PrintBlueCardBalance
2015-12-18 17:07:09 -08:00
call Buena_PrizeMenu
2015-11-01 09:44:30 -08:00
jr z, .done
2015-12-17 19:31:16 -08:00
ld [MenuSelectionQuantity], a
2015-10-17 14:18:52 -07:00
call Buena_getprize
2015-10-16 10:35:43 -07:00
ld a, [hl]
2015-12-18 17:07:09 -08:00
ld [wNamedObjectIndexBuffer], a
2015-10-16 10:35:43 -07:00
call GetItemName
2015-11-01 09:44:30 -08:00
ld hl, .Text_IsThatRight
2015-10-31 18:05:02 -07:00
call BuenaPrintText
2015-10-16 10:35:43 -07:00
call YesNoBox
2015-11-01 09:44:30 -08:00
jr c, .loop
2015-10-24 07:34:19 -07:00
2015-12-17 19:31:16 -08:00
ld a, [MenuSelectionQuantity]
2015-10-17 14:18:52 -07:00
call Buena_getprize
2015-10-16 10:35:43 -07:00
inc hl
ld a, [hld]
ld c, a
2015-10-24 07:34:19 -07:00
ld a, [wBlueCardBalance]
2015-10-16 10:35:43 -07:00
cp c
2015-10-24 07:34:19 -07:00
jr c, .InsufficientBalance
2015-10-16 10:35:43 -07:00
ld a, [hli]
push hl
ld [CurItem], a
ld a, $1
2015-11-01 15:13:31 -08:00
ld [wItemQuantityChangeBuffer], a
2015-10-16 10:35:43 -07:00
ld hl, NumItems
call ReceiveItem
pop hl
2015-11-01 09:44:30 -08:00
jr nc, .BagFull
2015-10-16 10:35:43 -07:00
ld a, [hl]
ld c, a
2015-10-24 07:34:19 -07:00
ld a, [wBlueCardBalance]
2015-10-16 10:35:43 -07:00
sub c
2015-10-24 07:34:19 -07:00
ld [wBlueCardBalance], a
2015-12-17 19:31:16 -08:00
call PrintBlueCardBalance
2015-11-01 09:44:30 -08:00
jr .Purchase
2015-10-16 10:35:43 -07:00
2015-10-24 07:34:19 -07:00
.InsufficientBalance
2015-11-01 09:44:30 -08:00
ld hl, .Text_NotEnoughPoints
jr .print
2015-10-16 10:35:43 -07:00
2015-11-01 09:44:30 -08:00
.BagFull
ld hl, .Text_NoRoom
jr .print
2015-10-16 10:35:43 -07:00
2015-11-01 09:44:30 -08:00
.Purchase
2015-10-16 10:35:43 -07:00
ld de, SFX_TRANSACTION
call PlaySFX
2015-11-01 09:44:30 -08:00
ld hl, .Text_HereYouGo
2015-10-16 10:35:43 -07:00
2015-11-01 09:44:30 -08:00
.print
2015-10-31 18:05:02 -07:00
call BuenaPrintText
2015-11-01 09:44:30 -08:00
jr .loop
2015-10-16 10:35:43 -07:00
2015-11-01 09:44:30 -08:00
.done
2015-10-16 10:35:43 -07:00
call WriteBackup
call WriteBackup
2015-11-01 09:44:30 -08:00
ld hl, .Text_PleaseComeBackAgain
2015-10-16 10:35:43 -07:00
call PrintText
call JoyWaitAorB
2015-10-16 10:35:43 -07:00
call PlayClickSFX
ret
; 8b072
2015-11-01 09:44:30 -08:00
.Text_AskWhichPrize: ; 0x8b072
2015-10-16 10:35:43 -07:00
; Which prize would you like?
text_jump UnknownText_0x1c589f
db "@"
; 0x8b077
2015-11-01 09:44:30 -08:00
.Text_IsThatRight: ; 0x8b077
2015-10-16 10:35:43 -07:00
; ? Is that right?
text_jump UnknownText_0x1c58bc
db "@"
; 0x8b07c
2015-11-01 09:44:30 -08:00
.Text_HereYouGo ; Here you go!
2015-10-16 10:35:43 -07:00
text_jump UnknownText_0x1c58d1
db "@"
; 0x8b081
2015-11-01 09:44:30 -08:00
.Text_NotEnoughPoints: ; 0x8b081
2015-10-16 10:35:43 -07:00
; You don't have enough points.
text_jump UnknownText_0x1c58e0
db "@"
; 0x8b086
2015-11-01 09:44:30 -08:00
.Text_NoRoom: ; 0x8b086
2015-10-16 10:35:43 -07:00
; You have no room for it.
text_jump UnknownText_0x1c58ff
db "@"
; 0x8b08b
2015-11-01 09:44:30 -08:00
.Text_PleaseComeBackAgain: ; 0x8b08b
2015-10-16 10:35:43 -07:00
; Oh. Please come back again!
text_jump UnknownText_0x1c591a
db "@"
; 0x8b090
2015-12-18 17:07:09 -08:00
Buena_DisplayBlueCardBalance: ; 8b090
2015-12-17 19:31:16 -08:00
ld hl, BlueCardBalanceMenuDataHeader
2015-10-16 10:35:43 -07:00
call LoadMenuDataHeader
ret
; 8b097
2015-12-17 19:31:16 -08:00
PrintBlueCardBalance: ; 8b097
2015-10-24 07:34:19 -07:00
ld de, wBlueCardBalance
2015-12-17 19:31:16 -08:00
call .DrawBox
2015-10-16 10:35:43 -07:00
ret
; 8b09e
2015-12-17 19:31:16 -08:00
.DrawBox: ; 8b09e
2015-10-16 10:35:43 -07:00
push de
xor a
ld [hBGMapMode], a
2015-12-17 19:31:16 -08:00
ld hl, BlueCardBalanceMenuDataHeader
2015-10-16 10:35:43 -07:00
call CopyMenuDataHeader
2015-11-04 11:02:11 -08:00
call MenuBox
2015-10-16 10:35:43 -07:00
call UpdateSprites
call MenuBoxCoord2Tile
2015-12-17 19:31:16 -08:00
ld bc, SCREEN_WIDTH + 1
2015-10-16 10:35:43 -07:00
add hl, bc
2015-10-17 14:18:52 -07:00
ld de, .Points_string
2015-10-16 10:35:43 -07:00
call PlaceString
ld h, b
ld l, c
inc hl
2015-12-17 19:31:16 -08:00
ld a, " "
2015-10-16 10:35:43 -07:00
ld [hli], a
ld [hld], a
pop de
lb bc, 1, 2
call PrintNum
ret
; 8b0ca
2015-10-17 14:18:52 -07:00
.Points_string:
2015-10-16 10:35:43 -07:00
db "Points@"
; 8b0d1
2015-12-17 19:31:16 -08:00
BlueCardBalanceMenuDataHeader: ; 0x8b0d1
2015-10-16 10:35:43 -07:00
db $40 ; flags
db 11, 00 ; start coords
db 13, 11 ; end coords
; 8b0d6
2015-12-18 17:07:09 -08:00
Buena_PlacePrizeMenuBox: ; 8b0d6
2015-10-17 14:18:52 -07:00
ld hl, .menudataheader
2015-10-16 10:35:43 -07:00
call LoadMenuDataHeader
ret
; 8b0dd
2015-10-17 14:18:52 -07:00
.menudataheader: ; 0x8b0dd
2015-10-16 10:35:43 -07:00
db $40 ; flags
db 00, 00 ; start coords
db 11, 17 ; end coords
; 8b0e2
2015-12-18 17:07:09 -08:00
Buena_PrizeMenu: ; 8b0e2
2015-10-17 14:18:52 -07:00
ld hl, .MenuDataHeader
2015-10-16 10:35:43 -07:00
call CopyMenuDataHeader
ld a, [MenuSelection]
2015-11-01 09:44:30 -08:00
ld [wMenuCursorBuffer], a
2015-10-16 10:35:43 -07:00
xor a
2015-12-18 17:07:09 -08:00
ld [wWhichIndexSet], a
2015-10-16 10:35:43 -07:00
ld [hBGMapMode], a
2015-11-17 12:54:03 -08:00
call InitScrollingMenu
2015-10-16 10:35:43 -07:00
call UpdateSprites
2015-12-17 19:31:16 -08:00
call ScrollingMenu
2015-10-16 10:35:43 -07:00
ld a, [MenuSelection]
ld c, a
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-10-16 10:35:43 -07:00
ld [MenuSelection], a
2015-12-15 15:59:49 -08:00
ld a, [wMenuJoypad]
2015-10-16 10:35:43 -07:00
cp $2
2015-12-17 19:31:16 -08:00
jr z, .cancel
2015-10-16 10:35:43 -07:00
ld a, c
and a
ret nz
2015-12-17 19:31:16 -08:00
.cancel
2015-10-16 10:35:43 -07:00
xor a
ret
; 8b113
2015-10-17 14:18:52 -07:00
.MenuDataHeader: ; 0x8b113
2015-10-16 10:35:43 -07:00
db $40 ; flags
db 01, 01 ; start coords
db 09, 16 ; end coords
2015-10-17 14:18:52 -07:00
dw .MenuData2
2015-10-16 10:35:43 -07:00
db 1 ; default option
; 0x8b11b
db 0
2015-10-17 14:18:52 -07:00
.MenuData2: ; 0x8b11c
2015-10-16 10:35:43 -07:00
db $10 ; flags
2015-12-17 19:31:16 -08:00
db 4, 13 ; rows, columns
db 1 ; spacing
2015-10-17 14:18:52 -07:00
dba .indices
dba .prizeitem
dba .prizepoints
2015-10-16 10:35:43 -07:00
; 8b129
2015-10-17 14:18:52 -07:00
.indices: ; 8b129
2015-10-16 10:35:43 -07:00
db 9
2015-10-17 14:18:52 -07:00
db 1, 2, 3, 4, 5, 6, 7, 8, 9
db -1
2015-10-16 10:35:43 -07:00
; 8b134
2015-10-17 14:18:52 -07:00
.prizeitem: ; 8b134
2015-10-16 10:35:43 -07:00
ld a, [MenuSelection]
2015-10-17 14:18:52 -07:00
call Buena_getprize
2015-10-16 10:35:43 -07:00
ld a, [hl]
push de
2015-10-17 14:18:52 -07:00
ld [wNamedObjectIndexBuffer], a
2015-10-16 10:35:43 -07:00
call GetItemName
pop hl
call PlaceString
ret
; 8b147
2015-10-17 14:18:52 -07:00
.prizepoints: ; 8b147
2015-10-16 10:35:43 -07:00
ld a, [MenuSelection]
2015-10-17 14:18:52 -07:00
call Buena_getprize
2015-10-16 10:35:43 -07:00
inc hl
ld a, [hl]
ld c, "0"
add c
ld [de], a
ret
; 8b154
2015-10-17 14:18:52 -07:00
Buena_getprize: ; 8b154
2015-10-16 10:35:43 -07:00
dec a
2015-10-17 14:18:52 -07:00
ld hl, .prizes
2015-10-16 10:35:43 -07:00
ld b, 0
ld c, a
rept 2
add hl, bc
endr
ret
; 8b15e
2015-10-17 14:18:52 -07:00
.prizes: ; 8b15e
2015-10-16 10:35:43 -07:00
db ULTRA_BALL, 2
db FULL_RESTORE, 2
db NUGGET, 3
db RARE_CANDY, 3
db PROTEIN, 5
db IRON, 5
db CARBOS, 5
db CALCIUM, 5
db HP_UP, 5
; 8b170