subtract rupees when buying magic bean

This commit is contained in:
scawful
2024-06-13 22:08:19 -04:00
parent 12acfb15fe
commit ec05fac8ee

View File

@@ -122,6 +122,19 @@ Sprite_BeanVendor_Main:
{ {
%PlayAnimation(0,0,1) %PlayAnimation(0,0,1)
REP #$20
LDA.l $7EF360
CMP.w #$64 ; 100 rupees
SEP #$30
BCC .not_enough_rupees
REP #$20
LDA.l $7EF360
SEC
SBC.w #$64 ; Subtract 100 rupees
STA.l $7EF360
SEP #$30
LDA.b #$07 LDA.b #$07
JSL Sprite_SpawnDynamically JSL Sprite_SpawnDynamically
LDA.b #$02 : STA.w SprAction, Y LDA.b #$02 : STA.w SprAction, Y
@@ -130,16 +143,19 @@ Sprite_BeanVendor_Main:
LDA.w SprYH, X : STA $03 LDA.w SprYH, X : STA $03
LDA.w SprXH, X : STA $01 LDA.w SprXH, X : STA $01
; TODO: Set a flag that says you've got the magic bean ; TODO: Set a flag that says you've got the magic bean
%ShowUnconditionalMessage($144) %ShowUnconditionalMessage($145)
%GotoAction(0) %GotoAction(0)
RTS RTS
.not_enough_rupees
%GotoAction(4)
RTS
} }
; 0x04 - Player Said No ; 0x04 - Player Said No
PlayerSaidNo: PlayerSaidNo:
{ {
%PlayAnimation(0,0,1) %PlayAnimation(0,0,1)
%ShowUnconditionalMessage($145) %ShowUnconditionalMessage($144)
%GotoAction(0) %GotoAction(0)
RTS RTS
} }