diff options
| -rwxr-xr-x | data/tm_prices.asm | 30 | ||||
| -rwxr-xr-x | engine/items/tm_prices.asm | 11 | ||||
| -rw-r--r-- | home.asm | 8 | 
3 files changed, 37 insertions, 12 deletions
| diff --git a/data/tm_prices.asm b/data/tm_prices.asm index 4fce3f60..89fdb8e9 100755 --- a/data/tm_prices.asm +++ b/data/tm_prices.asm @@ -1,7 +1,27 @@  TechnicalMachinePrices: ; 7bfa7 (1e:7fa7)  ; In thousands (nybbles). -	db $32, $21, $34, $24, $34 -	db $21, $45, $55, $32, $32 -	db $55, $52, $54, $52, $41 -	db $21, $12, $42, $25, $24 -	db $22, $52, $24, $34, $42 +	dn 3, 2  ; TM_01, TM_02 +	dn 2, 1  ; TM_03, TM_04 +	dn 3, 4  ; TM_05, TM_06 +	dn 2, 4  ; TM_07, TM_08 +	dn 3, 4  ; TM_09, TM_10 +	dn 2, 1  ; TM_11, TM_12 +	dn 4, 5  ; TM_13, TM_14 +	dn 5, 5  ; TM_15, TM_16 +	dn 3, 2  ; TM_17, TM_18 +	dn 3, 2  ; TM_19, TM_20 +	dn 5, 5  ; TM_21, TM_22 +	dn 5, 2  ; TM_23, TM_24 +	dn 5, 4  ; TM_25, TM_26 +	dn 5, 2  ; TM_27, TM_28 +	dn 4, 1  ; TM_29, TM_30 +	dn 2, 1  ; TM_31, TM_32 +	dn 1, 2  ; TM_33, TM_34 +	dn 4, 2  ; TM_35, TM_36 +	dn 2, 5  ; TM_37, TM_38 +	dn 2, 4  ; TM_39, TM_40 +	dn 2, 2  ; TM_41, TM_42 +	dn 5, 2  ; TM_43, TM_44 +	dn 2, 4  ; TM_45, TM_46 +	dn 3, 4  ; TM_47, TM_48 +	dn 4, 2  ; TM_49, TM_50 diff --git a/engine/items/tm_prices.asm b/engine/items/tm_prices.asm index c55a25b4..7c5c56fa 100755 --- a/engine/items/tm_prices.asm +++ b/engine/items/tm_prices.asm @@ -1,5 +1,8 @@  GetMachinePrice: ; 7bf86 (1e:7f86) -	ld a, [wcf91] +; Input:  [wcf91] = Item Id of a TM +; Output: Stores the 2-byte TM price in [H_DOWNARROWBLINKCNT1] and [H_DOWNARROWBLINKCNT2] +;         as a BCD +	ld a, [wcf91] ; a contains TM item id  	sub TM_01  	ret c  	ld d, a @@ -8,11 +11,11 @@ GetMachinePrice: ; 7bf86 (1e:7f86)  	ld c, a  	ld b, 0  	add hl, bc -	ld a, [hl] +	ld a, [hl] ; a contains byte whose high or low nybble is the TM price (in thousands)  	srl d -	jr nc, .asm_7bf9d +	jr nc, .highNybbleIsPrice ; is TM id odd?  	swap a -.asm_7bf9d +.highNybbleIsPrice  	and $f0  	ld [H_DOWNARROWBLINKCNT2], a ; $ff8c  	xor a @@ -3335,6 +3335,8 @@ GetName:: ; 376b (0:376b)  	ret  GetItemPrice:: ; 37df (0:37df) +; Stores item's price as BCD in [H_DOWNARROWBLINKCNT1] and [[H_DOWNARROWBLINKCNT2] +; Input: [wcf91] = item id  	ld a, [H_LOADEDROMBANK]  	push af  	ld a, [wListMenuID] ; wListMenuID @@ -3349,9 +3351,9 @@ GetItemPrice:: ; 37df (0:37df)  	ld a, [hli]  	ld h, [hl]  	ld l, a -	ld a, [wcf91] +	ld a, [wcf91] ; a contains item id  	cp HM_01 -	jr nc, .asm_3812 +	jr nc, .getTMPrice  	ld bc, $3  .asm_3802  	add hl, bc @@ -3365,7 +3367,7 @@ GetItemPrice:: ; 37df (0:37df)  	ld a, [hl]  	ld [H_DOWNARROWBLINKCNT1], a ; $ff8b  	jr .asm_381c -.asm_3812 +.getTMPrice  	ld a, Bank(GetMachinePrice)  	ld [H_LOADEDROMBANK], a  	ld [$2000], a | 
