2015-12-13 14:11:58 -08:00
|
|
|
|
SelectQuantityToToss: ; 24fbf
|
2018-01-23 13:08:43 -08:00
|
|
|
|
ld hl, TossItem_MenuHeader
|
|
|
|
|
call LoadMenuHeader
|
2015-12-13 14:11:58 -08:00
|
|
|
|
call Toss_Sell_Loop
|
|
|
|
|
ret
|
|
|
|
|
; 24fc9
|
|
|
|
|
|
|
|
|
|
SelectQuantityToBuy: ; 24fc9
|
2017-12-24 09:47:30 -08:00
|
|
|
|
farcall GetItemPrice
|
2015-12-13 14:11:58 -08:00
|
|
|
|
RooftopSale_SelectQuantityToBuy: ; 24fcf
|
|
|
|
|
ld a, d
|
|
|
|
|
ld [Buffer1], a
|
|
|
|
|
ld a, e
|
|
|
|
|
ld [Buffer2], a
|
2018-01-23 13:08:43 -08:00
|
|
|
|
ld hl, BuyItem_MenuHeader
|
|
|
|
|
call LoadMenuHeader
|
2015-12-13 14:11:58 -08:00
|
|
|
|
call Toss_Sell_Loop
|
|
|
|
|
ret
|
|
|
|
|
; 24fe1
|
|
|
|
|
|
|
|
|
|
SelectQuantityToSell: ; 24fe1
|
2017-12-24 09:47:30 -08:00
|
|
|
|
farcall GetItemPrice
|
2015-12-13 14:11:58 -08:00
|
|
|
|
ld a, d
|
|
|
|
|
ld [Buffer1], a
|
|
|
|
|
ld a, e
|
|
|
|
|
ld [Buffer2], a
|
2018-01-23 13:08:43 -08:00
|
|
|
|
ld hl, SellItem_MenuHeader
|
|
|
|
|
call LoadMenuHeader
|
2015-12-13 14:11:58 -08:00
|
|
|
|
call Toss_Sell_Loop
|
|
|
|
|
ret
|
|
|
|
|
; 24ff9
|
|
|
|
|
|
|
|
|
|
Toss_Sell_Loop: ; 24ff9
|
|
|
|
|
ld a, 1
|
|
|
|
|
ld [wItemQuantityChangeBuffer], a
|
|
|
|
|
.loop
|
|
|
|
|
call BuySellToss_UpdateQuantityDisplay ; update display
|
|
|
|
|
call BuySellToss_InterpretJoypad ; joy action
|
|
|
|
|
jr nc, .loop
|
|
|
|
|
cp -1
|
|
|
|
|
jr nz, .nope ; pressed B
|
|
|
|
|
scf
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.nope
|
|
|
|
|
and a
|
|
|
|
|
ret
|
|
|
|
|
; 2500e
|
|
|
|
|
|
|
|
|
|
BuySellToss_InterpretJoypad: ; 2500e
|
2016-05-10 09:31:49 -07:00
|
|
|
|
call JoyTextDelay_ForcehJoyDown ; get joypad
|
2015-12-13 14:11:58 -08:00
|
|
|
|
bit B_BUTTON_F, c
|
|
|
|
|
jr nz, .b
|
|
|
|
|
bit A_BUTTON_F, c
|
|
|
|
|
jr nz, .a
|
|
|
|
|
bit D_DOWN_F, c
|
|
|
|
|
jr nz, .down
|
|
|
|
|
bit D_UP_F, c
|
|
|
|
|
jr nz, .up
|
|
|
|
|
bit D_LEFT_F, c
|
|
|
|
|
jr nz, .left
|
|
|
|
|
bit D_RIGHT_F, c
|
|
|
|
|
jr nz, .right
|
|
|
|
|
and a
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.b
|
|
|
|
|
ld a, -1
|
|
|
|
|
scf
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.a
|
|
|
|
|
ld a, 0
|
|
|
|
|
scf
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.down
|
|
|
|
|
ld hl, wItemQuantityChangeBuffer
|
|
|
|
|
dec [hl]
|
|
|
|
|
jr nz, .finish_down
|
|
|
|
|
ld a, [wItemQuantityBuffer]
|
|
|
|
|
ld [hl], a
|
|
|
|
|
|
|
|
|
|
.finish_down
|
|
|
|
|
and a
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.up
|
|
|
|
|
ld hl, wItemQuantityChangeBuffer
|
|
|
|
|
inc [hl]
|
|
|
|
|
ld a, [wItemQuantityBuffer]
|
|
|
|
|
cp [hl]
|
|
|
|
|
jr nc, .finish_up
|
|
|
|
|
ld [hl], 1
|
|
|
|
|
|
|
|
|
|
.finish_up
|
|
|
|
|
and a
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.left
|
|
|
|
|
ld a, [wItemQuantityChangeBuffer]
|
|
|
|
|
sub 10
|
|
|
|
|
jr c, .load_1
|
|
|
|
|
jr z, .load_1
|
|
|
|
|
jr .finish_left
|
|
|
|
|
|
|
|
|
|
.load_1
|
|
|
|
|
ld a, 1
|
|
|
|
|
|
|
|
|
|
.finish_left
|
|
|
|
|
ld [wItemQuantityChangeBuffer], a
|
|
|
|
|
and a
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.right
|
|
|
|
|
ld a, [wItemQuantityChangeBuffer]
|
2015-12-13 17:33:56 -08:00
|
|
|
|
add 10
|
2015-12-13 14:11:58 -08:00
|
|
|
|
ld b, a
|
|
|
|
|
ld a, [wItemQuantityBuffer]
|
|
|
|
|
cp b
|
|
|
|
|
jr nc, .finish_right
|
|
|
|
|
ld b, a
|
|
|
|
|
|
|
|
|
|
.finish_right
|
|
|
|
|
ld a, b
|
|
|
|
|
ld [wItemQuantityChangeBuffer], a
|
|
|
|
|
and a
|
|
|
|
|
ret
|
|
|
|
|
; 25072
|
|
|
|
|
|
|
|
|
|
BuySellToss_UpdateQuantityDisplay: ; 25072
|
|
|
|
|
call MenuBox
|
|
|
|
|
call MenuBoxCoord2Tile
|
|
|
|
|
ld de, SCREEN_WIDTH + 1
|
|
|
|
|
add hl, de
|
|
|
|
|
ld [hl], "×"
|
|
|
|
|
inc hl
|
|
|
|
|
ld de, wItemQuantityChangeBuffer
|
|
|
|
|
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
|
|
|
|
|
call PrintNum
|
2018-01-23 13:08:43 -08:00
|
|
|
|
ld a, [wMenuDataPointer]
|
2015-12-13 14:11:58 -08:00
|
|
|
|
ld e, a
|
2018-01-23 13:08:43 -08:00
|
|
|
|
ld a, [wMenuDataPointer + 1]
|
2015-12-13 14:11:58 -08:00
|
|
|
|
ld d, a
|
|
|
|
|
ld a, [wMenuDataBank]
|
|
|
|
|
call FarCall_de
|
|
|
|
|
ret
|
|
|
|
|
; 25097
|
|
|
|
|
|
|
|
|
|
ret_25097: ; 25097
|
|
|
|
|
ret
|
|
|
|
|
; 25098
|
|
|
|
|
|
|
|
|
|
DisplayPurchasePrice: ; 25098
|
|
|
|
|
call BuySell_MultiplyPrice
|
|
|
|
|
call BuySell_DisplaySubtotal
|
|
|
|
|
ret
|
|
|
|
|
; 2509f
|
|
|
|
|
|
|
|
|
|
DisplaySellingPrice: ; 2509f
|
|
|
|
|
call BuySell_MultiplyPrice
|
|
|
|
|
call Sell_HalvePrice
|
|
|
|
|
call BuySell_DisplaySubtotal
|
|
|
|
|
ret
|
|
|
|
|
; 250a9
|
|
|
|
|
|
|
|
|
|
BuySell_MultiplyPrice: ; 250a9
|
|
|
|
|
xor a
|
|
|
|
|
ld [hMultiplicand + 0], a
|
|
|
|
|
ld a, [Buffer1]
|
|
|
|
|
ld [hMultiplicand + 1], a
|
|
|
|
|
ld a, [Buffer2]
|
|
|
|
|
ld [hMultiplicand + 2], a
|
|
|
|
|
ld a, [wItemQuantityChangeBuffer]
|
|
|
|
|
ld [hMultiplier], a
|
|
|
|
|
push hl
|
|
|
|
|
call Multiply
|
|
|
|
|
pop hl
|
|
|
|
|
ret
|
|
|
|
|
; 250c1
|
|
|
|
|
|
|
|
|
|
Sell_HalvePrice: ; 250c1
|
|
|
|
|
push hl
|
|
|
|
|
ld hl, hProduct + 1
|
|
|
|
|
ld a, [hl]
|
|
|
|
|
srl a
|
|
|
|
|
ld [hli], a
|
|
|
|
|
ld a, [hl]
|
|
|
|
|
rra
|
|
|
|
|
ld [hli], a
|
|
|
|
|
ld a, [hl]
|
|
|
|
|
rra
|
|
|
|
|
ld [hl], a
|
|
|
|
|
pop hl
|
|
|
|
|
ret
|
|
|
|
|
; 250d1
|
|
|
|
|
|
|
|
|
|
BuySell_DisplaySubtotal: ; 250d1
|
|
|
|
|
push hl
|
|
|
|
|
ld hl, hMoneyTemp
|
|
|
|
|
ld a, [hProduct + 1]
|
|
|
|
|
ld [hli], a
|
|
|
|
|
ld a, [hProduct + 2]
|
|
|
|
|
ld [hli], a
|
|
|
|
|
ld a, [hProduct + 3]
|
|
|
|
|
ld [hl], a
|
|
|
|
|
pop hl
|
|
|
|
|
inc hl
|
|
|
|
|
ld de, hMoneyTemp
|
|
|
|
|
lb bc, PRINTNUM_MONEY | 3, 6
|
|
|
|
|
call PrintNum
|
|
|
|
|
call WaitBGMap
|
|
|
|
|
ret
|
|
|
|
|
; 250ed
|
|
|
|
|
|
2018-01-23 13:08:43 -08:00
|
|
|
|
TossItem_MenuHeader: ; 0x250ed
|
2018-01-14 02:59:56 -08:00
|
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 13:38:14 -08:00
|
|
|
|
menu_coords 15, 9, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2015-12-13 14:11:58 -08:00
|
|
|
|
dw ret_25097
|
|
|
|
|
db 0 ; default option
|
|
|
|
|
; 0x250f5
|
|
|
|
|
|
2018-01-23 13:08:43 -08:00
|
|
|
|
BuyItem_MenuHeader: ; 0x250f5
|
2018-01-14 02:59:56 -08:00
|
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 13:38:14 -08:00
|
|
|
|
menu_coords 7, 15, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
|
2015-12-13 14:11:58 -08:00
|
|
|
|
dw DisplayPurchasePrice
|
|
|
|
|
db -1 ; default option
|
|
|
|
|
; 0x250fd
|
|
|
|
|
|
2018-01-23 13:08:43 -08:00
|
|
|
|
SellItem_MenuHeader: ; 0x250fd
|
2018-01-14 02:59:56 -08:00
|
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 13:38:14 -08:00
|
|
|
|
menu_coords 7, 15, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
|
2015-12-13 14:11:58 -08:00
|
|
|
|
dw DisplaySellingPrice
|
|
|
|
|
db 0 ; default option
|
|
|
|
|
; 0x25105
|