2015-11-11 11:12:46 -08:00
|
|
|
const_def
|
|
|
|
const MARTTEXT_HOW_MANY
|
|
|
|
const MARTTEXT_COSTS_THIS_MUCH
|
|
|
|
const MARTTEXT_NOT_ENOUGH_MONEY
|
|
|
|
const MARTTEXT_BAG_FULL
|
|
|
|
const MARTTEXT_HERE_YOU_GO
|
|
|
|
const MARTTEXT_SOLD_OUT
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
OpenMartDialog::
|
2015-11-11 11:12:46 -08:00
|
|
|
call GetMart
|
|
|
|
ld a, c
|
2019-04-08 15:50:10 -07:00
|
|
|
ld [wMartType], a
|
2015-11-11 11:12:46 -08:00
|
|
|
call LoadMartPointer
|
2019-04-08 15:50:10 -07:00
|
|
|
ld a, [wMartType]
|
2015-11-11 11:12:46 -08:00
|
|
|
ld hl, .dialogs
|
|
|
|
rst JumpTable
|
|
|
|
ret
|
|
|
|
|
|
|
|
.dialogs
|
|
|
|
dw MartDialog
|
|
|
|
dw HerbShop
|
|
|
|
dw BargainShop
|
|
|
|
dw Pharmacist
|
|
|
|
dw RooftopSale
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
MartDialog:
|
2019-04-08 15:50:10 -07:00
|
|
|
ld a, MARTTYPE_STANDARD
|
|
|
|
ld [wMartType], a
|
2018-06-23 19:35:46 -07:00
|
|
|
xor a ; STANDARDMART_HOWMAYIHELPYOU
|
2019-04-08 15:50:10 -07:00
|
|
|
ld [wMartJumptableIndex], a
|
2015-11-11 11:12:46 -08:00
|
|
|
call StandardMart
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
HerbShop:
|
2015-11-11 11:12:46 -08:00
|
|
|
call FarReadMart
|
2018-01-23 13:08:43 -08:00
|
|
|
call LoadStandardMenuHeader
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, HerbShopLadyIntroText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MartTextbox
|
2015-11-11 11:12:46 -08:00
|
|
|
call BuyMenu
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, HerbalLadyComeAgainText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MartTextbox
|
2015-11-11 11:12:46 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BargainShop:
|
2015-11-11 11:12:46 -08:00
|
|
|
ld b, BANK(BargainShopData)
|
|
|
|
ld de, BargainShopData
|
|
|
|
call LoadMartPointer
|
|
|
|
call ReadMart
|
2018-01-23 13:08:43 -08:00
|
|
|
call LoadStandardMenuHeader
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, BargainShopIntroText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MartTextbox
|
2015-11-11 11:12:46 -08:00
|
|
|
call BuyMenu
|
|
|
|
ld hl, wBargainShopFlags
|
|
|
|
ld a, [hli]
|
|
|
|
or [hl]
|
|
|
|
jr z, .skip_set
|
2018-08-06 10:43:54 -07:00
|
|
|
ld hl, wDailyFlags1
|
|
|
|
set DAILYFLAGS1_GOLDENROD_UNDERGROUND_BARGAIN_F, [hl]
|
2015-11-11 11:12:46 -08:00
|
|
|
|
|
|
|
.skip_set
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, BargainShopComeAgainText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MartTextbox
|
2015-11-11 11:12:46 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Pharmacist:
|
2015-11-11 11:12:46 -08:00
|
|
|
call FarReadMart
|
2018-01-23 13:08:43 -08:00
|
|
|
call LoadStandardMenuHeader
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, PharmacyIntroText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MartTextbox
|
2015-11-11 11:12:46 -08:00
|
|
|
call BuyMenu
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, PharmacyComeAgainText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MartTextbox
|
2015-11-11 11:12:46 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
RooftopSale:
|
2018-01-23 13:08:43 -08:00
|
|
|
ld b, BANK(RooftopSaleMart1)
|
|
|
|
ld de, RooftopSaleMart1
|
2017-12-28 04:15:46 -08:00
|
|
|
ld hl, wStatusFlags
|
2018-01-22 12:40:43 -08:00
|
|
|
bit STATUSFLAGS_HALL_OF_FAME_F, [hl]
|
2015-11-11 11:12:46 -08:00
|
|
|
jr z, .ok
|
2018-01-23 13:08:43 -08:00
|
|
|
ld b, BANK(RooftopSaleMart2)
|
|
|
|
ld de, RooftopSaleMart2
|
2015-11-11 11:12:46 -08:00
|
|
|
|
|
|
|
.ok
|
|
|
|
call LoadMartPointer
|
|
|
|
call ReadMart
|
2018-01-23 13:08:43 -08:00
|
|
|
call LoadStandardMenuHeader
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, MartWelcomeText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MartTextbox
|
2015-11-11 11:12:46 -08:00
|
|
|
call BuyMenu
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, MartComeAgainText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MartTextbox
|
2015-11-11 11:12:46 -08:00
|
|
|
ret
|
|
|
|
|
2017-12-15 14:22:52 -08:00
|
|
|
INCLUDE "data/items/rooftop_sale.asm"
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
LoadMartPointer:
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, b
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMartPointerBank], a
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, e
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMartPointer], a
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, d
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMartPointer + 1], a
|
2021-03-08 06:41:55 -08:00
|
|
|
ld hl, wCurMartCount
|
|
|
|
assert wCurMartCount + 1 == wCurMartItems
|
2015-11-11 11:12:46 -08:00
|
|
|
xor a
|
2021-03-08 06:41:55 -08:00
|
|
|
ld bc, 16
|
2015-11-11 11:12:46 -08:00
|
|
|
call ByteFill
|
2019-04-08 15:50:10 -07:00
|
|
|
xor a ; STANDARDMART_HOWMAYIHELPYOU
|
|
|
|
ld [wMartJumptableIndex], a
|
2015-11-11 11:12:46 -08:00
|
|
|
ld [wBargainShopFlags], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wFacingDirection], a
|
2015-11-11 11:12:46 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetMart:
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, e
|
2020-11-03 07:13:06 -08:00
|
|
|
cp NUM_MARTS
|
2015-11-11 11:12:46 -08:00
|
|
|
jr c, .IsAMart
|
2016-01-27 09:25:12 -08:00
|
|
|
ld b, BANK(DefaultMart)
|
2015-11-11 11:12:46 -08:00
|
|
|
ld de, DefaultMart
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.IsAMart:
|
2015-11-11 11:12:46 -08:00
|
|
|
ld hl, Marts
|
|
|
|
add hl, de
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, de
|
2015-11-11 11:12:46 -08:00
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
2016-01-27 09:25:12 -08:00
|
|
|
ld b, BANK(Marts)
|
2015-11-11 11:12:46 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-23 19:35:46 -07:00
|
|
|
; StandardMart.MartFunctions indexes
|
|
|
|
const_def
|
|
|
|
const STANDARDMART_HOWMAYIHELPYOU ; 0
|
|
|
|
const STANDARDMART_TOPMENU ; 1
|
|
|
|
const STANDARDMART_BUY ; 2
|
|
|
|
const STANDARDMART_SELL ; 3
|
|
|
|
const STANDARDMART_QUIT ; 4
|
|
|
|
const STANDARDMART_ANYTHINGELSE ; 5
|
|
|
|
|
2019-04-08 15:50:10 -07:00
|
|
|
STANDARDMART_EXIT EQU -1
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StandardMart:
|
2015-11-11 11:12:46 -08:00
|
|
|
.loop
|
2019-04-08 15:50:10 -07:00
|
|
|
ld a, [wMartJumptableIndex]
|
2015-11-11 11:12:46 -08:00
|
|
|
ld hl, .MartFunctions
|
|
|
|
rst JumpTable
|
2019-04-08 15:50:10 -07:00
|
|
|
ld [wMartJumptableIndex], a
|
|
|
|
cp STANDARDMART_EXIT
|
2015-11-11 11:12:46 -08:00
|
|
|
jr nz, .loop
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.MartFunctions:
|
2018-06-23 19:35:46 -07:00
|
|
|
; entries correspond to STANDARDMART_* constants
|
2015-11-11 11:12:46 -08:00
|
|
|
dw .HowMayIHelpYou
|
|
|
|
dw .TopMenu
|
|
|
|
dw .Buy
|
|
|
|
dw .Sell
|
|
|
|
dw .Quit
|
|
|
|
dw .AnythingElse
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.HowMayIHelpYou:
|
2018-01-23 13:08:43 -08:00
|
|
|
call LoadStandardMenuHeader
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, MartWelcomeText
|
2015-11-11 11:12:46 -08:00
|
|
|
call PrintText
|
2018-06-23 19:35:46 -07:00
|
|
|
ld a, STANDARDMART_TOPMENU
|
2015-11-11 11:12:46 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.TopMenu:
|
2018-01-23 13:08:43 -08:00
|
|
|
ld hl, MenuHeader_BuySell
|
|
|
|
call CopyMenuHeader
|
2015-12-15 15:59:49 -08:00
|
|
|
call VerticalMenu
|
2015-11-11 11:12:46 -08:00
|
|
|
jr c, .quit
|
2015-12-15 15:59:49 -08:00
|
|
|
ld a, [wMenuCursorY]
|
2015-11-11 11:12:46 -08:00
|
|
|
cp $1
|
|
|
|
jr z, .buy
|
|
|
|
cp $2
|
|
|
|
jr z, .sell
|
|
|
|
.quit
|
2018-06-23 19:35:46 -07:00
|
|
|
ld a, STANDARDMART_QUIT
|
2015-11-11 11:12:46 -08:00
|
|
|
ret
|
|
|
|
.buy
|
2018-06-23 19:35:46 -07:00
|
|
|
ld a, STANDARDMART_BUY
|
2015-11-11 11:12:46 -08:00
|
|
|
ret
|
|
|
|
.sell
|
2018-06-23 19:35:46 -07:00
|
|
|
ld a, STANDARDMART_SELL
|
2015-11-11 11:12:46 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Buy:
|
2015-11-11 11:12:46 -08:00
|
|
|
call ExitMenu
|
|
|
|
call FarReadMart
|
|
|
|
call BuyMenu
|
|
|
|
and a
|
2018-06-23 19:35:46 -07:00
|
|
|
ld a, STANDARDMART_ANYTHINGELSE
|
2015-11-11 11:12:46 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Sell:
|
2015-11-11 11:12:46 -08:00
|
|
|
call ExitMenu
|
|
|
|
call SellMenu
|
2018-06-23 19:35:46 -07:00
|
|
|
ld a, STANDARDMART_ANYTHINGELSE
|
2015-11-11 11:12:46 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Quit:
|
2015-11-11 11:12:46 -08:00
|
|
|
call ExitMenu
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, MartComeAgainText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MartTextbox
|
2019-04-08 15:50:10 -07:00
|
|
|
ld a, STANDARDMART_EXIT
|
2015-11-11 11:12:46 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.AnythingElse:
|
2018-01-23 13:08:43 -08:00
|
|
|
call LoadStandardMenuHeader
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, MartAskMoreText
|
2015-11-11 11:12:46 -08:00
|
|
|
call PrintText
|
2018-06-23 19:35:46 -07:00
|
|
|
ld a, STANDARDMART_TOPMENU
|
2015-11-11 11:12:46 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
FarReadMart:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wMartPointer
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2021-03-08 06:41:55 -08:00
|
|
|
ld de, wCurMartCount
|
2016-04-10 11:42:14 -07:00
|
|
|
.CopyMart:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wMartPointerBank]
|
2015-11-11 11:12:46 -08:00
|
|
|
call GetFarByte
|
|
|
|
ld [de], a
|
|
|
|
inc hl
|
|
|
|
inc de
|
|
|
|
cp -1
|
|
|
|
jr nz, .CopyMart
|
|
|
|
ld hl, wMartItem1BCD
|
2021-03-08 06:41:55 -08:00
|
|
|
ld de, wCurMartItems
|
2016-04-10 11:42:14 -07:00
|
|
|
.ReadMartItem:
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
cp -1
|
|
|
|
jr z, .done
|
|
|
|
push de
|
|
|
|
call GetMartItemPrice
|
|
|
|
pop de
|
|
|
|
jr .ReadMartItem
|
|
|
|
|
|
|
|
.done
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetMartItemPrice:
|
2018-01-23 14:39:09 -08:00
|
|
|
; Return the price of item a in BCD at hl and in tiles at wStringBuffer1.
|
2015-11-11 11:12:46 -08:00
|
|
|
push hl
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurItem], a
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall GetItemPrice
|
2015-11-11 11:12:46 -08:00
|
|
|
pop hl
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetMartPrice:
|
2018-01-23 14:39:09 -08:00
|
|
|
; Return price de in BCD at hl and in tiles at wStringBuffer1.
|
2015-11-11 11:12:46 -08:00
|
|
|
push hl
|
|
|
|
ld a, d
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wStringBuffer2], a
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, e
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wStringBuffer2 + 1], a
|
|
|
|
ld hl, wStringBuffer1
|
|
|
|
ld de, wStringBuffer2
|
2015-11-11 11:12:46 -08:00
|
|
|
lb bc, PRINTNUM_LEADINGZEROS | 2, 6 ; 6 digits
|
|
|
|
call PrintNum
|
|
|
|
pop hl
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wStringBuffer1
|
2015-11-11 11:12:46 -08:00
|
|
|
ld c, 6 / 2 ; 6 digits
|
|
|
|
.loop
|
|
|
|
call .CharToNybble
|
|
|
|
swap a
|
|
|
|
ld b, a
|
|
|
|
call .CharToNybble
|
|
|
|
or b
|
|
|
|
ld [hli], a
|
|
|
|
dec c
|
|
|
|
jr nz, .loop
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.CharToNybble:
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
cp " "
|
|
|
|
jr nz, .not_space
|
|
|
|
ld a, "0"
|
|
|
|
|
|
|
|
.not_space
|
|
|
|
sub "0"
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ReadMart:
|
2015-11-11 11:12:46 -08:00
|
|
|
; Load the mart pointer. Mart data is local (no need for bank).
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wMartPointer
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
push hl
|
|
|
|
; set hl to the first item
|
|
|
|
inc hl
|
|
|
|
ld bc, wMartItem1BCD
|
2021-03-08 06:41:55 -08:00
|
|
|
ld de, wCurMartItems
|
2015-11-11 11:12:46 -08:00
|
|
|
.loop
|
2021-03-08 06:41:55 -08:00
|
|
|
; copy the items to wCurMartItems
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
; -1 is the terminator
|
|
|
|
cp -1
|
|
|
|
jr z, .done
|
|
|
|
|
|
|
|
push de
|
|
|
|
; copy the price to de
|
|
|
|
ld a, [hli]
|
|
|
|
ld e, a
|
|
|
|
ld a, [hli]
|
|
|
|
ld d, a
|
|
|
|
; convert the price to 3-byte BCD at [bc]
|
|
|
|
push hl
|
|
|
|
ld h, b
|
|
|
|
ld l, c
|
|
|
|
call GetMartPrice
|
|
|
|
ld b, h
|
|
|
|
ld c, l
|
|
|
|
pop hl
|
|
|
|
|
|
|
|
pop de
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.done
|
|
|
|
pop hl
|
|
|
|
ld a, [hl]
|
2021-03-08 06:41:55 -08:00
|
|
|
ld [wCurMartCount], a
|
2015-11-11 11:12:46 -08:00
|
|
|
ret
|
|
|
|
|
2017-12-15 14:22:52 -08:00
|
|
|
INCLUDE "data/items/bargain_shop.asm"
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BuyMenu:
|
2015-11-11 11:12:46 -08:00
|
|
|
call FadeToMenu
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall BlankScreen
|
2015-11-11 11:12:46 -08:00
|
|
|
xor a
|
2017-12-09 16:41:03 -08:00
|
|
|
ld [wMenuScrollPositionBackup], a
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, 1
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wMenuCursorPositionBackup], a
|
2015-11-11 11:12:46 -08:00
|
|
|
.loop
|
|
|
|
call BuyMenuLoop ; menu loop
|
|
|
|
jr nc, .loop
|
2015-12-01 18:54:11 -08:00
|
|
|
call CloseSubmenu
|
2015-11-11 11:12:46 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
LoadBuyMenuText:
|
2015-11-11 11:12:46 -08:00
|
|
|
; load text from a nested table
|
2019-04-08 15:50:10 -07:00
|
|
|
; which table is in wMartType
|
2015-11-11 11:12:46 -08:00
|
|
|
; which entry is in register a
|
|
|
|
push af
|
|
|
|
call GetMartDialogGroup ; gets a pointer from GetMartDialogGroup.MartTextFunctionPointers
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
pop af
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
add hl, de
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, de
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
call PrintText
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
MartAskPurchaseQuantity:
|
2015-11-11 11:12:46 -08:00
|
|
|
call GetMartDialogGroup ; gets a pointer from GetMartDialogGroup.MartTextFunctionPointers
|
|
|
|
inc hl
|
2016-05-04 08:46:23 -07:00
|
|
|
inc hl
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jp z, StandardMartAskPurchaseQuantity
|
|
|
|
cp 1
|
|
|
|
jp z, BargainShopAskPurchaseQuantity
|
|
|
|
jp RooftopSaleAskPurchaseQuantity
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetMartDialogGroup:
|
2019-04-08 15:50:10 -07:00
|
|
|
ld a, [wMartType]
|
2015-11-11 11:12:46 -08:00
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
ld hl, .MartTextFunctionPointers
|
|
|
|
add hl, de
|
2016-05-10 09:31:49 -07:00
|
|
|
add hl, de
|
|
|
|
add hl, de
|
2015-11-11 11:12:46 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.MartTextFunctionPointers:
|
2015-11-11 11:12:46 -08:00
|
|
|
dwb .StandardMartPointers, 0
|
|
|
|
dwb .HerbShopPointers, 0
|
|
|
|
dwb .BargainShopPointers, 1
|
|
|
|
dwb .PharmacyPointers, 0
|
|
|
|
dwb .StandardMartPointers, 2
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.StandardMartPointers:
|
2019-10-20 15:24:17 -07:00
|
|
|
dw MartHowManyText
|
|
|
|
dw MartFinalPriceText
|
|
|
|
dw MartNoMoneyText
|
|
|
|
dw MartPackFullText
|
|
|
|
dw MartThanksText
|
2015-11-11 11:12:46 -08:00
|
|
|
dw BuyMenuLoop
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.HerbShopPointers:
|
2019-10-20 15:24:17 -07:00
|
|
|
dw HerbalLadyHowManyText
|
|
|
|
dw HerbalLadyFinalPriceText
|
|
|
|
dw HerbalLadyNoMoneyText
|
|
|
|
dw HerbalLadyPackFullText
|
|
|
|
dw HerbalLadyThanksText
|
2015-11-11 11:12:46 -08:00
|
|
|
dw BuyMenuLoop
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.BargainShopPointers:
|
2015-11-11 11:12:46 -08:00
|
|
|
dw BuyMenuLoop
|
2019-10-20 15:24:17 -07:00
|
|
|
dw BargainShopFinalPriceText
|
|
|
|
dw BargainShopNoFundsText
|
|
|
|
dw BargainShopPackFullText
|
|
|
|
dw BargainShopThanksText
|
|
|
|
dw BargainShopSoldOutText
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PharmacyPointers:
|
2019-10-20 15:24:17 -07:00
|
|
|
dw PharmacyHowManyText
|
|
|
|
dw PharmacyFinalPriceText
|
|
|
|
dw PharmacyNoMoneyText
|
|
|
|
dw PharmacyPackFullText
|
|
|
|
dw PharmacyThanksText
|
2015-11-11 11:12:46 -08:00
|
|
|
dw BuyMenuLoop
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
BuyMenuLoop:
|
2018-01-24 08:17:05 -08:00
|
|
|
farcall PlaceMoneyTopRight
|
2015-11-11 11:12:46 -08:00
|
|
|
call UpdateSprites
|
2018-01-23 13:08:43 -08:00
|
|
|
ld hl, MenuHeader_Buy
|
|
|
|
call CopyMenuHeader
|
2020-12-23 13:29:30 -08:00
|
|
|
ld a, [wMenuCursorPositionBackup]
|
|
|
|
ld [wMenuCursorPosition], a
|
2017-12-09 16:41:03 -08:00
|
|
|
ld a, [wMenuScrollPositionBackup]
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wMenuScrollPosition], a
|
2015-12-17 19:31:16 -08:00
|
|
|
call ScrollingMenu
|
2015-11-23 13:04:53 -08:00
|
|
|
ld a, [wMenuScrollPosition]
|
2017-12-09 16:41:03 -08:00
|
|
|
ld [wMenuScrollPositionBackup], a
|
2015-12-15 15:59:49 -08:00
|
|
|
ld a, [wMenuCursorY]
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wMenuCursorPositionBackup], a
|
2019-04-08 05:15:10 -07:00
|
|
|
call SpeechTextbox
|
2015-12-15 15:59:49 -08:00
|
|
|
ld a, [wMenuJoypad]
|
2015-11-11 11:12:46 -08:00
|
|
|
cp B_BUTTON
|
|
|
|
jr z, .set_carry
|
|
|
|
cp A_BUTTON
|
|
|
|
jr z, .useless_pointer
|
|
|
|
|
|
|
|
.useless_pointer
|
|
|
|
call MartAskPurchaseQuantity
|
|
|
|
jr c, .cancel
|
2015-12-18 17:07:09 -08:00
|
|
|
call MartConfirmPurchase
|
2015-11-11 11:12:46 -08:00
|
|
|
jr c, .cancel
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wMoney
|
2015-11-11 11:12:46 -08:00
|
|
|
ld bc, hMoneyTemp
|
2018-06-23 19:35:46 -07:00
|
|
|
ld a, 3 ; useless load
|
2015-11-11 11:12:46 -08:00
|
|
|
call CompareMoney
|
|
|
|
jr c, .insufficient_funds
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wNumItems
|
2015-11-11 11:12:46 -08:00
|
|
|
call ReceiveItem
|
|
|
|
jr nc, .insufficient_bag_space
|
|
|
|
ld a, [wMartItemID]
|
|
|
|
ld e, a
|
2018-06-23 19:35:46 -07:00
|
|
|
ld d, 0
|
2015-11-11 11:12:46 -08:00
|
|
|
ld b, SET_FLAG
|
|
|
|
ld hl, wBargainShopFlags
|
|
|
|
call FlagAction
|
|
|
|
call PlayTransactionSound
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wMoney
|
2015-11-11 11:12:46 -08:00
|
|
|
ld bc, hMoneyTemp
|
|
|
|
call TakeMoney
|
|
|
|
ld a, MARTTEXT_HERE_YOU_GO
|
|
|
|
call LoadBuyMenuText
|
|
|
|
call JoyWaitAorB
|
|
|
|
|
|
|
|
.cancel
|
2019-04-08 05:15:10 -07:00
|
|
|
call SpeechTextbox
|
2015-11-11 11:12:46 -08:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.set_carry
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.insufficient_bag_space
|
|
|
|
ld a, MARTTEXT_BAG_FULL
|
|
|
|
call LoadBuyMenuText
|
|
|
|
call JoyWaitAorB
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.insufficient_funds
|
|
|
|
ld a, MARTTEXT_NOT_ENOUGH_MONEY
|
|
|
|
call LoadBuyMenuText
|
|
|
|
call JoyWaitAorB
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
StandardMartAskPurchaseQuantity:
|
2020-07-13 10:05:05 -07:00
|
|
|
ld a, MAX_ITEM_STACK
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wItemQuantity], a
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, MARTTEXT_HOW_MANY
|
|
|
|
call LoadBuyMenuText
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall SelectQuantityToBuy
|
2015-11-11 11:12:46 -08:00
|
|
|
call ExitMenu
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
MartConfirmPurchase:
|
2018-01-16 11:30:10 -08:00
|
|
|
predef PartyMonItemName
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, MARTTEXT_COSTS_THIS_MUCH
|
|
|
|
call LoadBuyMenuText
|
|
|
|
call YesNoBox
|
|
|
|
ret
|
|
|
|
|
|
|
|
BargainShopAskPurchaseQuantity:
|
|
|
|
ld a, 1
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wItemQuantityChange], a
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, [wMartItemID]
|
|
|
|
ld e, a
|
2018-06-23 19:35:46 -07:00
|
|
|
ld d, 0
|
2015-11-11 11:12:46 -08:00
|
|
|
ld b, CHECK_FLAG
|
|
|
|
ld hl, wBargainShopFlags
|
|
|
|
call FlagAction
|
|
|
|
ld a, c
|
|
|
|
and a
|
|
|
|
jr nz, .SoldOut
|
|
|
|
ld a, [wMartItemID]
|
|
|
|
ld e, a
|
2018-06-23 19:35:46 -07:00
|
|
|
ld d, 0
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wMartPointer
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
inc hl
|
|
|
|
add hl, de
|
2016-05-10 09:31:49 -07:00
|
|
|
add hl, de
|
|
|
|
add hl, de
|
2015-11-11 11:12:46 -08:00
|
|
|
inc hl
|
|
|
|
ld a, [hli]
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hMoneyTemp + 2], a
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, [hl]
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hMoneyTemp + 1], a
|
2015-11-11 11:12:46 -08:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hMoneyTemp], a
|
2015-11-11 11:12:46 -08:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.SoldOut:
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, MARTTEXT_SOLD_OUT
|
|
|
|
call LoadBuyMenuText
|
|
|
|
call JoyWaitAorB
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
RooftopSaleAskPurchaseQuantity:
|
|
|
|
ld a, MARTTEXT_HOW_MANY
|
|
|
|
call LoadBuyMenuText
|
|
|
|
call .GetSalePrice
|
2020-07-13 10:05:05 -07:00
|
|
|
ld a, MAX_ITEM_STACK
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wItemQuantity], a
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall RooftopSale_SelectQuantityToBuy
|
2015-11-11 11:12:46 -08:00
|
|
|
call ExitMenu
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.GetSalePrice:
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, [wMartItemID]
|
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wMartPointer
|
2015-11-11 11:12:46 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
inc hl
|
|
|
|
add hl, de
|
2016-05-10 09:31:49 -07:00
|
|
|
add hl, de
|
|
|
|
add hl, de
|
2015-11-11 11:12:46 -08:00
|
|
|
inc hl
|
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
MartHowManyText:
|
|
|
|
text_far _MartHowManyText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
MartFinalPriceText:
|
|
|
|
text_far _MartFinalPriceText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
MenuHeader_Buy:
|
2018-01-14 02:59:56 -08:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 13:38:14 -08:00
|
|
|
menu_coords 1, 3, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
|
2018-01-23 13:08:43 -08:00
|
|
|
dw .MenuData
|
2015-11-11 11:12:46 -08:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
.MenuData
|
2018-01-14 02:59:56 -08:00
|
|
|
db SCROLLINGMENU_DISPLAY_ARROWS | SCROLLINGMENU_ENABLE_FUNCTION3 ; flags
|
2015-11-11 11:12:46 -08:00
|
|
|
db 4, 8 ; rows, columns
|
2019-06-08 17:31:24 -07:00
|
|
|
db SCROLLINGMENU_ITEMS_NORMAL ; item format
|
2021-03-08 06:41:55 -08:00
|
|
|
dbw 0, wCurMartCount
|
2015-11-11 11:12:46 -08:00
|
|
|
dba PlaceMenuItemName
|
|
|
|
dba .PrintBCDPrices
|
2015-11-23 13:04:53 -08:00
|
|
|
dba UpdateItemDescription
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.PrintBCDPrices:
|
2015-12-17 14:51:32 -08:00
|
|
|
ld a, [wScrollingMenuCursorPosition]
|
2015-11-11 11:12:46 -08:00
|
|
|
ld c, a
|
|
|
|
ld b, 0
|
|
|
|
ld hl, wMartItem1BCD
|
|
|
|
add hl, bc
|
2016-05-10 09:31:49 -07:00
|
|
|
add hl, bc
|
|
|
|
add hl, bc
|
2015-11-11 11:12:46 -08:00
|
|
|
push de
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
pop hl
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
|
|
|
ld c, PRINTNUM_LEADINGZEROS | PRINTNUM_MONEY | 3
|
|
|
|
call PrintBCDNumber
|
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
HerbShopLadyIntroText:
|
|
|
|
text_far _HerbShopLadyIntroText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
HerbalLadyHowManyText:
|
|
|
|
text_far _HerbalLadyHowManyText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
HerbalLadyFinalPriceText:
|
|
|
|
text_far _HerbalLadyFinalPriceText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
HerbalLadyThanksText:
|
|
|
|
text_far _HerbalLadyThanksText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
HerbalLadyPackFullText:
|
|
|
|
text_far _HerbalLadyPackFullText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
HerbalLadyNoMoneyText:
|
|
|
|
text_far _HerbalLadyNoMoneyText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
HerbalLadyComeAgainText:
|
|
|
|
text_far _HerbalLadyComeAgainText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
BargainShopIntroText:
|
|
|
|
text_far _BargainShopIntroText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
BargainShopFinalPriceText:
|
|
|
|
text_far _BargainShopFinalPriceText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
BargainShopThanksText:
|
|
|
|
text_far _BargainShopThanksText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
BargainShopPackFullText:
|
|
|
|
text_far _BargainShopPackFullText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
BargainShopSoldOutText:
|
|
|
|
text_far _BargainShopSoldOutText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
BargainShopNoFundsText:
|
|
|
|
text_far _BargainShopNoFundsText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
BargainShopComeAgainText:
|
|
|
|
text_far _BargainShopComeAgainText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
PharmacyIntroText:
|
|
|
|
text_far _PharmacyIntroText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
PharmacyHowManyText:
|
|
|
|
text_far _PharmacyHowManyText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
PharmacyFinalPriceText:
|
|
|
|
text_far _PharmacyFinalPriceText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
PharmacyThanksText:
|
|
|
|
text_far _PharmacyThanksText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
PharmacyPackFullText:
|
|
|
|
text_far _PharmacyPackFullText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
PharmacyNoMoneyText:
|
|
|
|
text_far _PharmacyNoMoneyText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
PharmacyComeAgainText:
|
|
|
|
text_far _PharmacyComeAgainText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
SellMenu:
|
2015-11-11 11:12:46 -08:00
|
|
|
call DisableSpriteUpdates
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall DepositSellInitPackBuffers
|
2015-12-18 17:07:09 -08:00
|
|
|
.loop
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall DepositSellPack
|
2018-01-11 12:36:11 -08:00
|
|
|
ld a, [wPackUsedItem]
|
2015-11-11 11:12:46 -08:00
|
|
|
and a
|
2015-12-18 17:07:09 -08:00
|
|
|
jp z, .quit
|
|
|
|
call .TryToSellItem
|
|
|
|
jr .loop
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2015-12-18 17:07:09 -08:00
|
|
|
.quit
|
|
|
|
call ReturnToMapWithSpeechTextbox
|
2015-11-11 11:12:46 -08:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2020-06-21 13:27:43 -07:00
|
|
|
.NothingToSell: ; unreferenced
|
2015-12-18 17:07:09 -08:00
|
|
|
ld hl, .NothingToSellText
|
2019-04-08 05:15:10 -07:00
|
|
|
call MenuTextboxBackup
|
2015-11-11 11:12:46 -08:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
.NothingToSellText:
|
2019-10-20 15:24:17 -07:00
|
|
|
text_far _NothingToSellText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.TryToSellItem:
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall CheckItemMenu
|
2020-12-23 13:29:30 -08:00
|
|
|
ld a, [wItemAttributeValue]
|
2015-12-26 18:59:03 -08:00
|
|
|
ld hl, .dw
|
2015-11-11 11:12:46 -08:00
|
|
|
rst JumpTable
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.dw
|
2015-11-11 11:12:46 -08:00
|
|
|
dw .try_sell
|
|
|
|
dw .cant_buy
|
|
|
|
dw .cant_buy
|
|
|
|
dw .cant_buy
|
|
|
|
dw .try_sell
|
|
|
|
dw .try_sell
|
|
|
|
dw .try_sell
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.cant_buy
|
2015-11-11 11:12:46 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.try_sell
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall _CheckTossableItem
|
2020-12-23 13:29:30 -08:00
|
|
|
ld a, [wItemAttributeValue]
|
2015-11-11 11:12:46 -08:00
|
|
|
and a
|
|
|
|
jr z, .okay_to_sell
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, MartCantBuyText
|
2015-11-11 11:12:46 -08:00
|
|
|
call PrintText
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.okay_to_sell
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, MartSellHowManyText
|
2015-11-11 11:12:46 -08:00
|
|
|
call PrintText
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall PlaceMoneyAtTopLeftOfTextbox
|
|
|
|
farcall SelectQuantityToSell
|
2015-11-11 11:12:46 -08:00
|
|
|
call ExitMenu
|
|
|
|
jr c, .declined
|
|
|
|
hlcoord 1, 14
|
|
|
|
lb bc, 3, 18
|
|
|
|
call ClearBox
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, MartSellPriceText
|
2019-04-08 05:15:10 -07:00
|
|
|
call PrintTextboxText
|
2015-11-11 11:12:46 -08:00
|
|
|
call YesNoBox
|
|
|
|
jr c, .declined
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wMoney
|
2015-11-11 11:12:46 -08:00
|
|
|
ld bc, hMoneyTemp
|
|
|
|
call GiveMoney
|
|
|
|
ld a, [wMartItemID]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wNumItems
|
2015-11-11 11:12:46 -08:00
|
|
|
call TossItem
|
2018-01-16 11:30:10 -08:00
|
|
|
predef PartyMonItemName
|
2015-11-11 11:12:46 -08:00
|
|
|
hlcoord 1, 14
|
|
|
|
lb bc, 3, 18
|
|
|
|
call ClearBox
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, MartBoughtText
|
2019-04-08 05:15:10 -07:00
|
|
|
call PrintTextboxText
|
2015-11-11 11:12:46 -08:00
|
|
|
call PlayTransactionSound
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall PlaceMoneyBottomLeft
|
2015-11-11 11:12:46 -08:00
|
|
|
call JoyWaitAorB
|
|
|
|
|
|
|
|
.declined
|
|
|
|
call ExitMenu
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
MartSellHowManyText:
|
|
|
|
text_far _MartSellHowManyText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
MartSellPriceText:
|
|
|
|
text_far _MartSellPriceText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2020-10-06 15:09:33 -07:00
|
|
|
UnusedDummyString: ; unreferenced
|
|
|
|
db "!ダミー!@" ; "!Dummy!"
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
MartWelcomeText:
|
|
|
|
text_far _MartWelcomeText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
MenuHeader_BuySell:
|
2018-01-14 02:59:56 -08:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 13:38:14 -08:00
|
|
|
menu_coords 0, 0, 7, 8
|
2018-01-23 13:08:43 -08:00
|
|
|
dw .MenuData
|
2015-11-11 11:12:46 -08:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
.MenuData
|
2018-01-14 02:59:56 -08:00
|
|
|
db STATICMENU_CURSOR ; strings
|
2015-11-11 11:12:46 -08:00
|
|
|
db 3 ; items
|
|
|
|
db "BUY@"
|
|
|
|
db "SELL@"
|
|
|
|
db "QUIT@"
|
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
MartThanksText:
|
|
|
|
text_far _MartThanksText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
MartNoMoneyText:
|
|
|
|
text_far _MartNoMoneyText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
MartPackFullText:
|
|
|
|
text_far _MartPackFullText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
MartCantBuyText:
|
|
|
|
text_far _MartCantBuyText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
MartComeAgainText:
|
|
|
|
text_far _MartComeAgainText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
MartAskMoreText:
|
|
|
|
text_far _MartAskMoreText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
MartBoughtText:
|
|
|
|
text_far _MartBoughtText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-11 11:12:46 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PlayTransactionSound:
|
2015-11-11 11:12:46 -08:00
|
|
|
call WaitSFX
|
|
|
|
ld de, SFX_TRANSACTION
|
|
|
|
call PlaySFX
|
|
|
|
ret
|
|
|
|
|
2019-04-08 05:15:10 -07:00
|
|
|
MartTextbox:
|
|
|
|
call MenuTextbox
|
2015-11-11 11:12:46 -08:00
|
|
|
call JoyWaitAorB
|
|
|
|
call ExitMenu
|
|
|
|
ret
|