2018-06-24 14:09:41 +00:00
|
|
|
BuenasPassword:
|
2015-10-16 17:35:43 +00:00
|
|
|
xor a
|
2015-12-19 01:07:09 +00:00
|
|
|
ld [wWhichIndexSet], a
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, .MenuHeader
|
|
|
|
call CopyMenuHeader
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wBuenasPassword]
|
2015-10-16 17:35:43 +00:00
|
|
|
ld c, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall GetBuenasPassword
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wMenuBorderLeftCoord]
|
2015-10-16 17:35:43 +00:00
|
|
|
add c
|
|
|
|
add $2
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wMenuBorderRightCoord], a
|
2015-12-23 03:19:33 +00:00
|
|
|
call PushWindow
|
2015-11-17 02:46:36 +00:00
|
|
|
call DoNthMenu ; menu
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall Buena_ExitMenu
|
2015-10-16 17:35:43 +00:00
|
|
|
ld b, $0
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
2015-10-16 17:35:43 +00:00
|
|
|
ld c, a
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wBuenasPassword]
|
2018-01-16 22:27:50 +00:00
|
|
|
maskbits NUM_PASSWORDS_PER_CATEGORY
|
2015-10-16 17:35:43 +00:00
|
|
|
cp c
|
2015-11-01 17:44:30 +00:00
|
|
|
jr nz, .wrong
|
2015-10-16 17:35:43 +00:00
|
|
|
ld b, $1
|
|
|
|
|
2015-11-01 17:44:30 +00:00
|
|
|
.wrong
|
2015-10-16 17:35:43 +00:00
|
|
|
ld a, b
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wScriptVar], a
|
2015-10-16 17:35:43 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuHeader:
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 0, 0, 10, 7
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .MenuData
|
2015-10-16 17:35:43 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
|
|
|
db 0
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuData:
|
2018-01-14 10:59:56 +00:00
|
|
|
db STATICMENU_CURSOR | STATICMENU_DISABLE_B ; flags
|
2015-10-16 17:35:43 +00:00
|
|
|
db 0 ; items
|
2015-11-01 17:44:30 +00:00
|
|
|
dw .PasswordIndices
|
|
|
|
dw .PlacePasswordChoices
|
2015-10-16 17:35:43 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.PasswordIndices:
|
2018-01-11 17:00:01 +00:00
|
|
|
db NUM_PASSWORDS_PER_CATEGORY
|
2018-01-15 04:43:51 +00:00
|
|
|
x = 0
|
|
|
|
rept NUM_PASSWORDS_PER_CATEGORY
|
|
|
|
db x
|
|
|
|
x = x + 1
|
|
|
|
endr
|
2015-10-16 17:35:43 +00:00
|
|
|
db -1
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.PlacePasswordChoices:
|
2015-10-16 17:35:43 +00:00
|
|
|
push de
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wBuenasPassword]
|
2015-10-16 17:35:43 +00:00
|
|
|
and $f0
|
|
|
|
ld c, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
2015-10-16 17:35:43 +00:00
|
|
|
add c
|
|
|
|
ld c, a
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall GetBuenasPassword
|
2015-10-16 17:35:43 +00:00
|
|
|
pop hl
|
|
|
|
call PlaceString
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
BuenaPrize:
|
2015-10-16 17:35:43 +00:00
|
|
|
xor a
|
2015-11-23 21:04:53 +00:00
|
|
|
ld [wMenuScrollPosition], a
|
2015-10-16 17:35:43 +00:00
|
|
|
ld a, $1
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMenuSelection], a
|
2015-12-19 01:07:09 +00:00
|
|
|
call Buena_PlacePrizeMenuBox
|
|
|
|
call Buena_DisplayBlueCardBalance
|
2015-11-01 17:44:30 +00:00
|
|
|
ld hl, .Text_AskWhichPrize
|
2015-10-16 17:35:43 +00:00
|
|
|
call PrintText
|
2015-11-01 17:44:30 +00:00
|
|
|
jr .okay
|
2015-10-16 17:35:43 +00:00
|
|
|
|
2015-11-01 17:44:30 +00:00
|
|
|
.loop
|
|
|
|
ld hl, .Text_AskWhichPrize
|
2015-11-01 01:05:02 +00:00
|
|
|
call BuenaPrintText
|
2015-10-16 17:35:43 +00:00
|
|
|
|
2015-11-01 17:44:30 +00:00
|
|
|
.okay
|
2015-10-16 17:35:43 +00:00
|
|
|
call DelayFrame
|
|
|
|
call UpdateSprites
|
2015-12-18 03:31:16 +00:00
|
|
|
call PrintBlueCardBalance
|
2015-12-19 01:07:09 +00:00
|
|
|
call Buena_PrizeMenu
|
2015-11-01 17:44:30 +00:00
|
|
|
jr z, .done
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMenuSelectionQuantity], a
|
2015-10-17 21:18:52 +00:00
|
|
|
call Buena_getprize
|
2015-10-16 17:35:43 +00:00
|
|
|
ld a, [hl]
|
2015-12-19 01:07:09 +00:00
|
|
|
ld [wNamedObjectIndexBuffer], a
|
2015-10-16 17:35:43 +00:00
|
|
|
call GetItemName
|
2015-11-01 17:44:30 +00:00
|
|
|
ld hl, .Text_IsThatRight
|
2015-11-01 01:05:02 +00:00
|
|
|
call BuenaPrintText
|
2015-10-16 17:35:43 +00:00
|
|
|
call YesNoBox
|
2015-11-01 17:44:30 +00:00
|
|
|
jr c, .loop
|
2015-10-24 14:34:19 +00:00
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelectionQuantity]
|
2015-10-17 21:18:52 +00:00
|
|
|
call Buena_getprize
|
2015-10-16 17:35:43 +00:00
|
|
|
inc hl
|
|
|
|
ld a, [hld]
|
|
|
|
ld c, a
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wBlueCardBalance]
|
2015-10-16 17:35:43 +00:00
|
|
|
cp c
|
2015-10-24 14:34:19 +00:00
|
|
|
jr c, .InsufficientBalance
|
|
|
|
|
2015-10-16 17:35:43 +00:00
|
|
|
ld a, [hli]
|
|
|
|
push hl
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurItem], a
|
2015-10-16 17:35:43 +00:00
|
|
|
ld a, $1
|
2015-11-01 23:13:31 +00:00
|
|
|
ld [wItemQuantityChangeBuffer], a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wNumItems
|
2015-10-16 17:35:43 +00:00
|
|
|
call ReceiveItem
|
|
|
|
pop hl
|
2015-11-01 17:44:30 +00:00
|
|
|
jr nc, .BagFull
|
2015-10-16 17:35:43 +00:00
|
|
|
ld a, [hl]
|
|
|
|
ld c, a
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wBlueCardBalance]
|
2015-10-16 17:35:43 +00:00
|
|
|
sub c
|
2015-10-24 14:34:19 +00:00
|
|
|
ld [wBlueCardBalance], a
|
2015-12-18 03:31:16 +00:00
|
|
|
call PrintBlueCardBalance
|
2015-11-01 17:44:30 +00:00
|
|
|
jr .Purchase
|
2015-10-16 17:35:43 +00:00
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.InsufficientBalance:
|
2015-11-01 17:44:30 +00:00
|
|
|
ld hl, .Text_NotEnoughPoints
|
|
|
|
jr .print
|
2015-10-16 17:35:43 +00:00
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.BagFull:
|
2015-11-01 17:44:30 +00:00
|
|
|
ld hl, .Text_NoRoom
|
|
|
|
jr .print
|
2015-10-16 17:35:43 +00:00
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Purchase:
|
2015-10-16 17:35:43 +00:00
|
|
|
ld de, SFX_TRANSACTION
|
|
|
|
call PlaySFX
|
2015-11-01 17:44:30 +00:00
|
|
|
ld hl, .Text_HereYouGo
|
2015-10-16 17:35:43 +00:00
|
|
|
|
2015-11-01 17:44:30 +00:00
|
|
|
.print
|
2015-11-01 01:05:02 +00:00
|
|
|
call BuenaPrintText
|
2015-11-01 17:44:30 +00:00
|
|
|
jr .loop
|
2015-10-16 17:35:43 +00:00
|
|
|
|
2015-11-01 17:44:30 +00:00
|
|
|
.done
|
2015-12-25 03:58:42 +00:00
|
|
|
call CloseWindow
|
|
|
|
call CloseWindow
|
2015-11-01 17:44:30 +00:00
|
|
|
ld hl, .Text_PleaseComeBackAgain
|
2015-10-16 17:35:43 +00:00
|
|
|
call PrintText
|
2015-10-17 16:58:26 +00:00
|
|
|
call JoyWaitAorB
|
2015-10-16 17:35:43 +00:00
|
|
|
call PlayClickSFX
|
|
|
|
ret
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.Text_AskWhichPrize:
|
2015-10-16 17:35:43 +00:00
|
|
|
; Which prize would you like?
|
2018-10-28 16:16:55 +00:00
|
|
|
text_far UnknownText_0x1c589f
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-10-16 17:35:43 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.Text_IsThatRight:
|
2015-10-16 17:35:43 +00:00
|
|
|
; ? Is that right?
|
2018-10-28 16:16:55 +00:00
|
|
|
text_far UnknownText_0x1c58bc
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-10-16 17:35:43 +00:00
|
|
|
|
2018-11-17 18:33:03 +00:00
|
|
|
.Text_HereYouGo:
|
|
|
|
; Here you go!
|
2018-10-28 16:16:55 +00:00
|
|
|
text_far UnknownText_0x1c58d1
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-10-16 17:35:43 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.Text_NotEnoughPoints:
|
2015-10-16 17:35:43 +00:00
|
|
|
; You don't have enough points.
|
2018-10-28 16:16:55 +00:00
|
|
|
text_far UnknownText_0x1c58e0
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-10-16 17:35:43 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.Text_NoRoom:
|
2015-10-16 17:35:43 +00:00
|
|
|
; You have no room for it.
|
2018-10-28 16:16:55 +00:00
|
|
|
text_far UnknownText_0x1c58ff
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-10-16 17:35:43 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.Text_PleaseComeBackAgain:
|
2015-10-16 17:35:43 +00:00
|
|
|
; Oh. Please come back again!
|
2018-10-28 16:16:55 +00:00
|
|
|
text_far UnknownText_0x1c591a
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-10-16 17:35:43 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Buena_DisplayBlueCardBalance:
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, BlueCardBalanceMenuHeader
|
|
|
|
call LoadMenuHeader
|
2015-10-16 17:35:43 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
PrintBlueCardBalance:
|
2015-10-24 14:34:19 +00:00
|
|
|
ld de, wBlueCardBalance
|
2015-12-18 03:31:16 +00:00
|
|
|
call .DrawBox
|
2015-10-16 17:35:43 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.DrawBox:
|
2015-10-16 17:35:43 +00:00
|
|
|
push de
|
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, BlueCardBalanceMenuHeader
|
|
|
|
call CopyMenuHeader
|
2015-11-04 19:02:11 +00:00
|
|
|
call MenuBox
|
2015-10-16 17:35:43 +00:00
|
|
|
call UpdateSprites
|
2015-11-10 21:53:37 +00:00
|
|
|
call MenuBoxCoord2Tile
|
2015-12-18 03:31:16 +00:00
|
|
|
ld bc, SCREEN_WIDTH + 1
|
2015-10-16 17:35:43 +00:00
|
|
|
add hl, bc
|
2015-10-17 21:18:52 +00:00
|
|
|
ld de, .Points_string
|
2015-10-16 17:35:43 +00:00
|
|
|
call PlaceString
|
|
|
|
ld h, b
|
|
|
|
ld l, c
|
|
|
|
inc hl
|
2015-12-18 03:31:16 +00:00
|
|
|
ld a, " "
|
2015-10-16 17:35:43 +00:00
|
|
|
ld [hli], a
|
|
|
|
ld [hld], a
|
|
|
|
pop de
|
|
|
|
lb bc, 1, 2
|
|
|
|
call PrintNum
|
|
|
|
ret
|
|
|
|
|
2015-10-17 21:18:52 +00:00
|
|
|
.Points_string:
|
2015-10-16 17:35:43 +00:00
|
|
|
db "Points@"
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
BlueCardBalanceMenuHeader:
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 0, 11, 11, 13
|
2015-10-16 17:35:43 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Buena_PlacePrizeMenuBox:
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, .MenuHeader
|
|
|
|
call LoadMenuHeader
|
2015-10-16 17:35:43 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuHeader
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 0, 0, 17, TEXTBOX_Y - 1
|
2015-10-16 17:35:43 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Buena_PrizeMenu:
|
2018-01-23 21:08:43 +00:00
|
|
|
ld hl, .MenuHeader
|
|
|
|
call CopyMenuHeader
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
2015-11-01 17:44:30 +00:00
|
|
|
ld [wMenuCursorBuffer], a
|
2015-10-16 17:35:43 +00:00
|
|
|
xor a
|
2015-12-19 01:07:09 +00:00
|
|
|
ld [wWhichIndexSet], a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2015-11-17 20:54:03 +00:00
|
|
|
call InitScrollingMenu
|
2015-10-16 17:35:43 +00:00
|
|
|
call UpdateSprites
|
2015-12-18 03:31:16 +00:00
|
|
|
call ScrollingMenu
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
2015-10-16 17:35:43 +00:00
|
|
|
ld c, a
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuCursorY]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wMenuSelection], a
|
2015-12-15 23:59:49 +00:00
|
|
|
ld a, [wMenuJoypad]
|
2015-10-16 17:35:43 +00:00
|
|
|
cp $2
|
2015-12-18 03:31:16 +00:00
|
|
|
jr z, .cancel
|
2015-10-16 17:35:43 +00:00
|
|
|
ld a, c
|
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
|
2015-12-18 03:31:16 +00:00
|
|
|
.cancel
|
2015-10-16 17:35:43 +00:00
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuHeader:
|
2018-01-14 10:59:56 +00:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 21:38:14 +00:00
|
|
|
menu_coords 1, 1, 16, 9
|
2018-01-23 21:08:43 +00:00
|
|
|
dw .MenuData
|
2015-10-16 17:35:43 +00:00
|
|
|
db 1 ; default option
|
|
|
|
|
|
|
|
db 0
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.MenuData:
|
2018-01-14 10:59:56 +00:00
|
|
|
db SCROLLINGMENU_DISPLAY_ARROWS ; flags
|
2015-12-18 03:31:16 +00:00
|
|
|
db 4, 13 ; rows, columns
|
|
|
|
db 1 ; spacing
|
2015-10-17 21:18:52 +00:00
|
|
|
dba .indices
|
|
|
|
dba .prizeitem
|
|
|
|
dba .prizepoints
|
2015-10-16 17:35:43 +00:00
|
|
|
|
2018-01-22 18:00:35 +00:00
|
|
|
NUM_BUENA_PRIZES EQU 9 ; ((BuenaPrizeItems.End - BuenaPrizeItems) / 2)
|
2017-12-23 05:31:04 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.indices
|
2017-12-15 22:22:52 +00:00
|
|
|
db NUM_BUENA_PRIZES
|
|
|
|
x = 1
|
|
|
|
rept NUM_BUENA_PRIZES
|
|
|
|
db x
|
|
|
|
x = x + 1
|
|
|
|
endr
|
2015-10-17 21:18:52 +00:00
|
|
|
db -1
|
2015-10-16 17:35:43 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.prizeitem
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
2015-10-17 21:18:52 +00:00
|
|
|
call Buena_getprize
|
2015-10-16 17:35:43 +00:00
|
|
|
ld a, [hl]
|
|
|
|
push de
|
2015-10-17 21:18:52 +00:00
|
|
|
ld [wNamedObjectIndexBuffer], a
|
2015-10-16 17:35:43 +00:00
|
|
|
call GetItemName
|
|
|
|
pop hl
|
|
|
|
call PlaceString
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.prizepoints
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMenuSelection]
|
2015-10-17 21:18:52 +00:00
|
|
|
call Buena_getprize
|
2015-10-16 17:35:43 +00:00
|
|
|
inc hl
|
|
|
|
ld a, [hl]
|
|
|
|
ld c, "0"
|
|
|
|
add c
|
|
|
|
ld [de], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Buena_getprize:
|
2015-10-16 17:35:43 +00:00
|
|
|
dec a
|
2017-12-15 22:22:52 +00:00
|
|
|
ld hl, BuenaPrizeItems
|
2015-10-16 17:35:43 +00:00
|
|
|
ld b, 0
|
|
|
|
ld c, a
|
|
|
|
add hl, bc
|
2016-05-04 15:46:23 +00:00
|
|
|
add hl, bc
|
2015-10-16 17:35:43 +00:00
|
|
|
ret
|
|
|
|
|
2017-12-15 22:22:52 +00:00
|
|
|
INCLUDE "data/items/buena_prizes.asm"
|