# Conflicts:
#	engine/items/mart.asm
This commit is contained in:
Rangi
2018-06-24 21:23:51 -04:00
1206 changed files with 14376 additions and 24565 deletions

View File

@@ -6,7 +6,7 @@
const MARTTEXT_HERE_YOU_GO
const MARTTEXT_SOLD_OUT
OpenMartDialog:: ; 15a45
OpenMartDialog::
call GetMart
ld a, c
ld [wEngineBuffer1], a
@@ -15,7 +15,6 @@ OpenMartDialog:: ; 15a45
ld hl, .dialogs
rst JumpTable
ret
; 15a57
.dialogs
dw MartDialog
@@ -23,18 +22,16 @@ OpenMartDialog:: ; 15a45
dw BargainShop
dw Pharmacist
dw RooftopSale
; 15a61
MartDialog: ; 15a61
MartDialog:
ld a, 0
ld [wEngineBuffer1], a
xor a ; STANDARDMART_HOWMAYIHELPYOU
ld [wEngineBuffer5], a
call StandardMart
ret
; 15a6e
HerbShop: ; 15a6e
HerbShop:
call FarReadMart
call LoadStandardMenuHeader
ld hl, Text_HerbShop_Intro
@@ -43,9 +40,8 @@ HerbShop: ; 15a6e
ld hl, Text_HerbShop_ComeAgain
call MartTextBox
ret
; 15a84
BargainShop: ; 15a84
BargainShop:
ld b, BANK(BargainShopData)
ld de, BargainShopData
call LoadMartPointer
@@ -65,9 +61,8 @@ BargainShop: ; 15a84
ld hl, Text_BargainShop_ComeAgain
call MartTextBox
ret
; 15aae
Pharmacist: ; 15aae
Pharmacist:
call FarReadMart
call LoadStandardMenuHeader
ld hl, Text_Pharmacist_Intro
@@ -76,9 +71,8 @@ Pharmacist: ; 15aae
ld hl, Text_Pharmacist_ComeAgain
call MartTextBox
ret
; 15ac4
RooftopSale: ; 15ac4
RooftopSale:
ld b, BANK(RooftopSaleMart1)
ld de, RooftopSaleMart1
ld hl, wStatusFlags
@@ -97,11 +91,10 @@ RooftopSale: ; 15ac4
ld hl, Text_Mart_ComeAgain
call MartTextBox
ret
; 15aee
INCLUDE "data/items/rooftop_sale.asm"
LoadMartPointer: ; 15b10
LoadMartPointer:
ld a, b
ld [wMartPointerBank], a
ld a, e
@@ -117,9 +110,8 @@ LoadMartPointer: ; 15b10
ld [wBargainShopFlags], a
ld [wFacingDirection], a
ret
; 15b31
GetMart: ; 15b31
GetMart:
ld a, e
cp (Marts.End - Marts) / 2
jr c, .IsAMart
@@ -136,7 +128,6 @@ GetMart: ; 15b31
ld d, [hl]
ld b, BANK(Marts)
ret
; 15b47
; StandardMart.MartFunctions indexes
const_def
@@ -147,7 +138,7 @@ GetMart: ; 15b31
const STANDARDMART_QUIT ; 4
const STANDARDMART_ANYTHINGELSE ; 5
StandardMart: ; 15b47
StandardMart:
.loop
ld a, [wEngineBuffer5]
ld hl, .MartFunctions
@@ -165,17 +156,15 @@ StandardMart: ; 15b47
dw .Sell
dw .Quit
dw .AnythingElse
; 15b62
.HowMayIHelpYou: ; 15b62
.HowMayIHelpYou:
call LoadStandardMenuHeader
ld hl, Text_Mart_HowMayIHelpYou
call PrintText
ld a, STANDARDMART_TOPMENU
ret
; 15b6e
.TopMenu: ; 15b6e
.TopMenu:
ld hl, MenuHeader_BuySell
call CopyMenuHeader
call VerticalMenu
@@ -194,41 +183,36 @@ StandardMart: ; 15b47
.sell
ld a, STANDARDMART_SELL
ret
; 15b8d
.Buy: ; 15b8d
.Buy:
call ExitMenu
call FarReadMart
call BuyMenu
and a
ld a, STANDARDMART_ANYTHINGELSE
ret
; 15b9a
.Sell: ; 15b9a
.Sell:
call ExitMenu
call SellMenu
ld a, STANDARDMART_ANYTHINGELSE
ret
; 15ba3
.Quit: ; 15ba3
.Quit:
call ExitMenu
ld hl, Text_Mart_ComeAgain
call MartTextBox
ld a, -1
ret
; 15baf
.AnythingElse: ; 15baf
.AnythingElse:
call LoadStandardMenuHeader
ld hl, Text_Mart_AnythingElse
call PrintText
ld a, STANDARDMART_TOPMENU
ret
; 15bbb
FarReadMart: ; 15bbb
FarReadMart:
ld hl, wMartPointer
ld a, [hli]
ld h, [hl]
@@ -256,16 +240,15 @@ FarReadMart: ; 15bbb
.done
ret
; 15be5
GetMartItemPrice: ; 15be5
GetMartItemPrice:
; Return the price of item a in BCD at hl and in tiles at wStringBuffer1.
push hl
ld [wCurItem], a
farcall GetItemPrice
pop hl
GetMartPrice: ; 15bf0
GetMartPrice:
; Return price de in BCD at hl and in tiles at wStringBuffer1.
push hl
ld a, d
@@ -290,9 +273,8 @@ GetMartPrice: ; 15bf0
dec c
jr nz, .loop
ret
; 15c1a
.CharToNybble: ; 15c1a
.CharToNybble:
ld a, [de]
inc de
cp " "
@@ -302,9 +284,8 @@ GetMartPrice: ; 15bf0
.not_space
sub "0"
ret
; 15c25
ReadMart: ; 15c25
ReadMart:
; Load the mart pointer. Mart data is local (no need for bank).
ld hl, wMartPointer
ld a, [hli]
@@ -347,12 +328,11 @@ ReadMart: ; 15c25
ld a, [hl]
ld [wCurMart], a
ret
; 15c51
INCLUDE "data/items/bargain_shop.asm"
BuyMenu: ; 15c62
BuyMenu:
call FadeToMenu
farcall BlankScreen
xor a
@@ -364,9 +344,8 @@ BuyMenu: ; 15c62
jr nc, .loop
call CloseSubmenu
ret
; 15c7d
LoadBuyMenuText: ; 15c7d
LoadBuyMenuText:
; load text from a nested table
; which table is in wEngineBuffer1
; which entry is in register a
@@ -385,9 +364,8 @@ LoadBuyMenuText: ; 15c7d
ld l, a
call PrintText
ret
; 15c91
MartAskPurchaseQuantity: ; 15c91
MartAskPurchaseQuantity:
call GetMartDialogGroup ; gets a pointer from GetMartDialogGroup.MartTextFunctionPointers
inc hl
inc hl
@@ -397,9 +375,8 @@ MartAskPurchaseQuantity: ; 15c91
cp 1
jp z, BargainShopAskPurchaseQuantity
jp RooftopSaleAskPurchaseQuantity
; 15ca3
GetMartDialogGroup: ; 15ca3
GetMartDialogGroup:
ld a, [wEngineBuffer1]
ld e, a
ld d, 0
@@ -408,17 +385,15 @@ GetMartDialogGroup: ; 15ca3
add hl, de
add hl, de
ret
; 15cb0
.MartTextFunctionPointers: ; 15cb0
.MartTextFunctionPointers:
dwb .StandardMartPointers, 0
dwb .HerbShopPointers, 0
dwb .BargainShopPointers, 1
dwb .PharmacyPointers, 0
dwb .StandardMartPointers, 2
; 15cbf
.StandardMartPointers: ; 15cbf
.StandardMartPointers:
dw Text_Mart_HowMany
dw Text_Mart_CostsThisMuch
dw Text_Mart_InsufficientFunds
@@ -426,7 +401,7 @@ GetMartDialogGroup: ; 15ca3
dw Text_Mart_HereYouGo
dw BuyMenuLoop
.HerbShopPointers: ; 15ccb
.HerbShopPointers:
dw Text_HerbShop_HowMany
dw Text_HerbShop_CostsThisMuch
dw Text_HerbShop_InsufficientFunds
@@ -434,7 +409,7 @@ GetMartDialogGroup: ; 15ca3
dw Text_HerbShop_HereYouGo
dw BuyMenuLoop
.BargainShopPointers: ; 15cd7
.BargainShopPointers:
dw BuyMenuLoop
dw Text_BargainShop_CostsThisMuch
dw Text_BargainShop_InsufficientFunds
@@ -442,17 +417,16 @@ GetMartDialogGroup: ; 15ca3
dw Text_BargainShop_HereYouGo
dw Text_BargainShop_SoldOut
.PharmacyPointers: ; 15ce3
.PharmacyPointers:
dw Text_Pharmacy_HowMany
dw Text_Pharmacy_CostsThisMuch
dw Text_Pharmacy_InsufficientFunds
dw Text_Pharmacy_BagFull
dw Text_Pharmacy_HereYouGo
dw BuyMenuLoop
; 15cef
BuyMenuLoop: ; 15cef
BuyMenuLoop:
farcall PlaceMoneyTopRight
call UpdateSprites
ld hl, MenuHeader_Buy
@@ -522,7 +496,6 @@ BuyMenuLoop: ; 15cef
call JoyWaitAorB
and a
ret
; 15d83
StandardMartAskPurchaseQuantity:
ld a, 99
@@ -532,15 +505,13 @@ StandardMartAskPurchaseQuantity:
farcall SelectQuantityToBuy
call ExitMenu
ret
; 15d97
MartConfirmPurchase: ; 15d97
MartConfirmPurchase:
predef PartyMonItemName
ld a, MARTTEXT_COSTS_THIS_MUCH
call LoadBuyMenuText
call YesNoBox
ret
; 15da5
BargainShopAskPurchaseQuantity:
ld a, 1
@@ -581,7 +552,6 @@ BargainShopAskPurchaseQuantity:
call JoyWaitAorB
scf
ret
; 15de2
RooftopSaleAskPurchaseQuantity:
ld a, MARTTEXT_HOW_MANY
@@ -592,9 +562,8 @@ RooftopSaleAskPurchaseQuantity:
farcall RooftopSale_SelectQuantityToBuy
call ExitMenu
ret
; 15df9
.GetSalePrice: ; 15df9
.GetSalePrice:
ld a, [wMartItemID]
ld e, a
ld d, 0
@@ -611,29 +580,25 @@ RooftopSaleAskPurchaseQuantity:
inc hl
ld d, [hl]
ret
; 15e0e
Text_Mart_HowMany: ; 0x15e0e
Text_Mart_HowMany:
; How many?
text_jump UnknownText_0x1c4bfd
db "@"
; 0x15e13
Text_Mart_CostsThisMuch: ; 0x15e13
Text_Mart_CostsThisMuch:
; @ (S) will be ¥@ .
text_jump UnknownText_0x1c4c08
db "@"
; 0x15e18
MenuHeader_Buy: ; 0x15e18
MenuHeader_Buy:
db MENU_BACKUP_TILES ; flags
menu_coords 1, 3, SCREEN_WIDTH - 1, TEXTBOX_Y - 1
dw .MenuData
db 1 ; default option
; 0x15e20
.MenuData ; 0x15e20
.MenuData
db SCROLLINGMENU_DISPLAY_ARROWS | SCROLLINGMENU_ENABLE_FUNCTION3 ; flags
db 4, 8 ; rows, columns
db 1 ; horizontal spacing
@@ -641,9 +606,8 @@ MenuHeader_Buy: ; 0x15e18
dba PlaceMenuItemName
dba .PrintBCDPrices
dba UpdateItemDescription
; 15e30
.PrintBCDPrices: ; 15e30
.PrintBCDPrices:
ld a, [wScrollingMenuCursorPosition]
ld c, a
ld b, 0
@@ -660,136 +624,114 @@ MenuHeader_Buy: ; 0x15e18
ld c, PRINTNUM_LEADINGZEROS | PRINTNUM_MONEY | 3
call PrintBCDNumber
ret
; 15e4a (5:5e4a)
Text_HerbShop_Intro: ; 0x15e4a
Text_HerbShop_Intro:
; Hello, dear. I sell inexpensive herbal medicine. They're good, but a trifle bitter. Your #MON may not like them. Hehehehe…
text_jump UnknownText_0x1c4c28
db "@"
; 0x15e4f
Text_HerbShop_HowMany: ; 0x15e4f
Text_HerbShop_HowMany:
; How many?
text_jump UnknownText_0x1c4ca3
db "@"
; 0x15e54
Text_HerbShop_CostsThisMuch: ; 0x15e54
Text_HerbShop_CostsThisMuch:
; @ (S) will be ¥@ .
text_jump UnknownText_0x1c4cae
db "@"
; 0x15e59
Text_HerbShop_HereYouGo: ; 0x15e59
Text_HerbShop_HereYouGo:
; Thank you, dear. Hehehehe…
text_jump UnknownText_0x1c4cce
db "@"
; 0x15e5e
Text_HerbShop_BagFull: ; 0x15e5e
Text_HerbShop_BagFull:
; Oh? Your PACK is full, dear.
text_jump UnknownText_0x1c4cea
db "@"
; 0x15e63
Text_HerbShop_InsufficientFunds: ; 0x15e63
Text_HerbShop_InsufficientFunds:
; Hehehe… You don't have the money.
text_jump UnknownText_0x1c4d08
db "@"
; 0x15e68
Text_HerbShop_ComeAgain: ; 0x15e68
Text_HerbShop_ComeAgain:
; Come again, dear. Hehehehe…
text_jump UnknownText_0x1c4d2a
db "@"
; 0x15e6d
Text_BargainShop_Intro: ; 0x15e6d
Text_BargainShop_Intro:
; Hiya! Care to see some bargains? I sell rare items that nobody else carries--but only one of each item.
text_jump UnknownText_0x1c4d47
db "@"
; 0x15e72
Text_BargainShop_CostsThisMuch: ; 0x15e72
Text_BargainShop_CostsThisMuch:
; costs ¥@ . Want it?
text_jump UnknownText_0x1c4db0
db "@"
; 0x15e77
Text_BargainShop_HereYouGo: ; 0x15e77
Text_BargainShop_HereYouGo:
; Thanks.
text_jump UnknownText_0x1c4dcd
db "@"
; 0x15e7c
Text_BargainShop_BagFull: ; 0x15e7c
Text_BargainShop_BagFull:
; Uh-oh, your PACK is chock-full.
text_jump UnknownText_0x1c4dd6
db "@"
; 0x15e81
Text_BargainShop_SoldOut: ; 0x15e81
Text_BargainShop_SoldOut:
; You bought that already. I'm all sold out of it.
text_jump UnknownText_0x1c4df7
db "@"
; 0x15e86
Text_BargainShop_InsufficientFunds: ; 0x15e86
Text_BargainShop_InsufficientFunds:
; Uh-oh, you're short on funds.
text_jump UnknownText_0x1c4e28
db "@"
; 0x15e8b
Text_BargainShop_ComeAgain: ; 0x15e8b
Text_BargainShop_ComeAgain:
; Come by again sometime.
text_jump UnknownText_0x1c4e46
db "@"
; 0x15e90
Text_Pharmacist_Intro: ; 0x15e90
Text_Pharmacist_Intro:
; What's up? Need some medicine?
text_jump UnknownText_0x1c4e5f
db "@"
; 0x15e95
Text_Pharmacy_HowMany: ; 0x15e95
Text_Pharmacy_HowMany:
; How many?
text_jump UnknownText_0x1c4e7e
db "@"
; 0x15e9a
Text_Pharmacy_CostsThisMuch: ; 0x15e9a
Text_Pharmacy_CostsThisMuch:
; @ (S) will cost ¥@ .
text_jump UnknownText_0x1c4e89
db "@"
; 0x15e9f
Text_Pharmacy_HereYouGo: ; 0x15e9f
Text_Pharmacy_HereYouGo:
; Thanks much!
text_jump UnknownText_0x1c4eab
db "@"
; 0x15ea4
Text_Pharmacy_BagFull: ; 0x15ea4
Text_Pharmacy_BagFull:
; You don't have any more space.
text_jump UnknownText_0x1c4eb9
db "@"
; 0x15ea9
Text_Pharmacy_InsufficientFunds: ; 0x15ea9
Text_Pharmacy_InsufficientFunds:
; Huh? That's not enough money.
text_jump UnknownText_0x1c4ed8
db "@"
; 0x15eae
Text_Pharmacist_ComeAgain: ; 0x15eae
Text_Pharmacist_ComeAgain:
; All right. See you around.
text_jump UnknownText_0x1c4ef6
db "@"
; 0x15eb3
SellMenu: ; 15eb3
SellMenu:
call DisableSpriteUpdates
farcall DepositSellInitPackBuffers
.loop
@@ -804,31 +746,27 @@ SellMenu: ; 15eb3
call ReturnToMapWithSpeechTextbox
and a
ret
; 15ed3
.Unreferenced_NothingToSell:
ld hl, .NothingToSellText
call MenuTextBoxBackup
and a
ret
; 15edb
.NothingToSellText: ; 0x15edb
.NothingToSellText:
; You don't have anything to sell.
text_jump UnknownText_0x1c4f12
db "@"
; 0x15ee0
.TryToSellItem: ; 15ee0
.TryToSellItem:
farcall CheckItemMenu
ld a, [wItemAttributeParamBuffer]
ld hl, .dw
rst JumpTable
ret
; 15eee
.dw ; 15eee
.dw
dw .try_sell
dw .cant_buy
dw .cant_buy
@@ -836,14 +774,12 @@ SellMenu: ; 15eb3
dw .try_sell
dw .try_sell
dw .try_sell
; 15efc
.cant_buy ; 15efc
.cant_buy
ret
; 15efd
.try_sell ; 15efd
.try_sell
farcall _CheckTossableItem
ld a, [wItemAttributeParamBuffer]
and a
@@ -887,94 +823,79 @@ SellMenu: ; 15eb3
call ExitMenu
and a
ret
; 15f73
Text_Mart_SellHowMany: ; 0x15f73
Text_Mart_SellHowMany:
; How many?
text_jump UnknownText_0x1c4f33
db "@"
; 0x15f78
Text_Mart_ICanPayThisMuch: ; 0x15f78
Text_Mart_ICanPayThisMuch:
; I can pay you ¥@ . Is that OK?
text_jump UnknownText_0x1c4f3e
db "@"
; 0x15f7d
.UnusedString15f7d: ; 15f7d
.UnusedString15f7d:
db "!ダミー!@"
Text_Mart_HowMayIHelpYou: ; 0x15f83
Text_Mart_HowMayIHelpYou:
; Welcome! How may I help you?
text_jump UnknownText_0x1c4f62
db "@"
; 0x15f88
MenuHeader_BuySell: ; 0x15f88
MenuHeader_BuySell:
db MENU_BACKUP_TILES ; flags
menu_coords 0, 0, 7, 8
dw .MenuData
db 1 ; default option
; 0x15f90
.MenuData ; 0x15f90
.MenuData
db STATICMENU_CURSOR ; strings
db 3 ; items
db "BUY@"
db "SELL@"
db "QUIT@"
; 0x15f96
Text_Mart_HereYouGo: ; 0x15fa0
Text_Mart_HereYouGo:
; Here you are. Thank you!
text_jump UnknownText_0x1c4f80
db "@"
; 0x15fa5
Text_Mart_InsufficientFunds: ; 0x15fa5
Text_Mart_InsufficientFunds:
; You don't have enough money.
text_jump UnknownText_0x1c4f9a
db "@"
; 0x15faa
Text_Mart_BagFull: ; 0x15faa
Text_Mart_BagFull:
; You can't carry any more items.
text_jump UnknownText_0x1c4fb7
db "@"
; 0x15faf
TextMart_CantBuyFromYou: ; 0x15faf
TextMart_CantBuyFromYou:
; Sorry, I can't buy that from you.
text_jump UnknownText_0x1c4fd7
db "@"
; 0x15fb4
Text_Mart_ComeAgain: ; 0x15fb4
Text_Mart_ComeAgain:
; Please come again!
text_jump UnknownText_0x1c4ff9
db "@"
; 0x15fb9
Text_Mart_AnythingElse: ; 0x15fb9
Text_Mart_AnythingElse:
text_jump UnknownText_0x1c500d
db "@"
; 0x15fbe
Text_Mart_SoldForAmount: ; 0x15fbe
Text_Mart_SoldForAmount:
text_jump UnknownText_0x1c502e
db "@"
; 0x15fc3
PlayTransactionSound: ; 15fc3
PlayTransactionSound:
call WaitSFX
ld de, SFX_TRANSACTION
call PlaySFX
ret
; 15fcd
MartTextBox: ; 15fcd
MartTextBox:
call MenuTextBox
call JoyWaitAorB
call ExitMenu
ret
; 15fd7