2018-01-22 10:00:35 -08:00
|
|
|
NUM_MOM_ITEMS_1 EQUS "((MomItems_1.End - MomItems_1) / 8)"
|
|
|
|
NUM_MOM_ITEMS_2 EQUS "((MomItems_2.End - MomItems_2) / 8)"
|
2017-12-22 21:31:04 -08:00
|
|
|
|
2017-12-08 21:50:59 -08:00
|
|
|
const_value = 1
|
|
|
|
const MOM_ITEM
|
|
|
|
const MOM_DOLL
|
|
|
|
|
2015-11-19 15:07:20 -08:00
|
|
|
MomTriesToBuySomething:: ; fcfec
|
|
|
|
ld a, [wMapReentryScriptQueueFlag]
|
|
|
|
and a
|
|
|
|
ret nz
|
2018-01-16 19:57:19 -08:00
|
|
|
call GetMapPhoneService
|
2015-11-19 15:07:20 -08:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
xor a
|
2015-12-26 15:11:55 -08:00
|
|
|
ld [wWhichMomItemSet], a
|
2015-11-19 15:07:20 -08:00
|
|
|
call CheckBalance_MomItem2
|
|
|
|
ret nc
|
2015-12-18 17:07:09 -08:00
|
|
|
call Mom_GiveItemOrDoll
|
2015-11-19 15:07:20 -08:00
|
|
|
ret nc
|
2015-12-18 17:07:09 -08:00
|
|
|
ld b, BANK(.Script)
|
|
|
|
ld de, .Script
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall LoadScriptBDE
|
2015-11-19 15:07:20 -08:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; fd00f
|
|
|
|
|
2015-12-18 17:07:09 -08:00
|
|
|
.Script: ; 0xfd00f
|
|
|
|
callasm .ASMFunction
|
2015-11-19 15:07:20 -08:00
|
|
|
farjump Script_ReceivePhoneCall
|
|
|
|
; 0xfd017
|
|
|
|
|
2015-12-18 17:07:09 -08:00
|
|
|
.ASMFunction: ; fd017
|
2015-11-19 15:07:20 -08:00
|
|
|
call MomBuysItem_DeductFunds
|
2015-12-18 17:07:09 -08:00
|
|
|
call Mom_GetScriptPointer
|
2015-12-26 15:11:55 -08:00
|
|
|
ld a, [wWhichMomItemSet]
|
2015-11-19 15:07:20 -08:00
|
|
|
and a
|
|
|
|
jr nz, .ok
|
2015-12-26 15:11:55 -08:00
|
|
|
ld hl, wWhichMomItem
|
2015-11-19 15:07:20 -08:00
|
|
|
inc [hl]
|
|
|
|
.ok
|
2015-12-18 17:07:09 -08:00
|
|
|
ld a, PHONE_MOM
|
2015-11-19 15:07:20 -08:00
|
|
|
ld [wCurrentCaller], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld bc, wEngineBuffer2
|
2015-11-19 15:07:20 -08:00
|
|
|
ld hl, 0
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], 0
|
|
|
|
inc hl
|
|
|
|
ld [hl], 1
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPhoneScriptPointer - wEngineBuffer2
|
2015-11-19 15:07:20 -08:00
|
|
|
add hl, bc
|
2015-12-18 17:07:09 -08:00
|
|
|
ld a, BANK(Mom_GetScriptPointer)
|
2015-11-19 15:07:20 -08:00
|
|
|
ld [hli], a
|
|
|
|
ld a, e
|
|
|
|
ld [hli], a
|
|
|
|
ld a, d
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; fd044
|
|
|
|
|
|
|
|
CheckBalance_MomItem2: ; fd044
|
2015-12-26 15:11:55 -08:00
|
|
|
ld a, [wWhichMomItem]
|
2017-12-22 21:31:04 -08:00
|
|
|
cp NUM_MOM_ITEMS_2
|
2015-11-19 15:07:20 -08:00
|
|
|
jr nc, .nope
|
|
|
|
call GetItemFromMom
|
|
|
|
ld a, [hli]
|
|
|
|
ld [hMoneyTemp], a
|
|
|
|
ld a, [hli]
|
|
|
|
ld [hMoneyTemp + 1], a
|
|
|
|
ld a, [hli]
|
|
|
|
ld [hMoneyTemp + 2], a
|
|
|
|
ld de, wMomsMoney
|
|
|
|
ld bc, hMoneyTemp
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall CompareMoney
|
2015-11-19 15:07:20 -08:00
|
|
|
jr nc, .have_enough_money
|
|
|
|
|
|
|
|
.nope
|
|
|
|
jr .check_have_2300
|
|
|
|
|
|
|
|
.have_enough_money
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.check_have_2300
|
|
|
|
ld hl, hMoneyTemp
|
2017-12-25 10:40:10 -08:00
|
|
|
ld [hl], HIGH(MOM_MONEY >> 8)
|
2015-11-19 15:07:20 -08:00
|
|
|
inc hl
|
2017-12-25 10:40:10 -08:00
|
|
|
ld [hl], HIGH(MOM_MONEY) ; mid
|
2015-11-19 15:07:20 -08:00
|
|
|
inc hl
|
2017-12-25 10:40:10 -08:00
|
|
|
ld [hl], LOW(MOM_MONEY)
|
2015-11-19 15:07:20 -08:00
|
|
|
.loop
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wMomItemTriggerBalance
|
2015-11-19 15:07:20 -08:00
|
|
|
ld bc, wMomsMoney
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall CompareMoney
|
2015-11-19 15:07:20 -08:00
|
|
|
jr z, .exact
|
|
|
|
jr nc, .less_than
|
2015-12-26 15:11:55 -08:00
|
|
|
call .AddMoney
|
2015-11-19 15:07:20 -08:00
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.less_than
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.exact
|
2015-12-26 15:11:55 -08:00
|
|
|
call .AddMoney
|
2017-12-22 21:31:04 -08:00
|
|
|
ld a, NUM_MOM_ITEMS_1
|
2015-11-19 15:07:20 -08:00
|
|
|
call RandomRange
|
|
|
|
inc a
|
2015-12-26 15:11:55 -08:00
|
|
|
ld [wWhichMomItemSet], a
|
2015-11-19 15:07:20 -08:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.AddMoney:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wMomItemTriggerBalance
|
2015-11-19 15:07:20 -08:00
|
|
|
ld bc, hMoneyTemp
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall AddMoney
|
2015-11-19 15:07:20 -08:00
|
|
|
ret
|
|
|
|
; fd0a6
|
|
|
|
|
|
|
|
|
|
|
|
MomBuysItem_DeductFunds: ; fd0a6 (3f:50a6)
|
|
|
|
call GetItemFromMom
|
2015-12-18 17:07:09 -08:00
|
|
|
ld de, 3 ; cost
|
2015-11-19 15:07:20 -08:00
|
|
|
add hl, de
|
|
|
|
ld a, [hli]
|
|
|
|
ld [hMoneyTemp], a
|
|
|
|
ld a, [hli]
|
|
|
|
ld [hMoneyTemp + 1], a
|
|
|
|
ld a, [hli]
|
|
|
|
ld [hMoneyTemp + 2], a
|
|
|
|
ld de, wMomsMoney
|
|
|
|
ld bc, hMoneyTemp
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall TakeMoney
|
2015-11-19 15:07:20 -08:00
|
|
|
ret
|
|
|
|
|
|
|
|
|
2015-12-18 17:07:09 -08:00
|
|
|
Mom_GiveItemOrDoll: ; fd0c3
|
2015-11-19 15:07:20 -08:00
|
|
|
call GetItemFromMom
|
2015-12-18 17:07:09 -08:00
|
|
|
ld de, 6 ; item type
|
2015-11-19 15:07:20 -08:00
|
|
|
add hl, de
|
|
|
|
ld a, [hli]
|
2015-12-18 17:07:09 -08:00
|
|
|
cp MOM_ITEM
|
2015-11-19 15:07:20 -08:00
|
|
|
jr z, .not_doll
|
|
|
|
ld a, [hl]
|
|
|
|
ld c, a
|
|
|
|
ld b, 1
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall DecorationFlagAction_c
|
2015-11-19 15:07:20 -08:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.not_doll
|
|
|
|
ld a, [hl]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurItem], a
|
2015-12-18 17:07:09 -08:00
|
|
|
ld a, 1
|
2015-11-19 15:07:20 -08:00
|
|
|
ld [wItemQuantityChangeBuffer], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPCItems
|
2015-11-19 15:07:20 -08:00
|
|
|
call ReceiveItem
|
|
|
|
ret
|
|
|
|
; fd0eb
|
|
|
|
|
|
|
|
|
2015-12-18 17:07:09 -08:00
|
|
|
Mom_GetScriptPointer: ; fd0eb (3f:50eb)
|
2015-11-19 15:07:20 -08:00
|
|
|
call GetItemFromMom
|
2015-12-18 17:07:09 -08:00
|
|
|
ld de, 6 ; item type
|
2015-11-19 15:07:20 -08:00
|
|
|
add hl, de
|
|
|
|
ld a, [hli]
|
2015-12-18 17:07:09 -08:00
|
|
|
ld de, .ItemScript
|
|
|
|
cp MOM_ITEM
|
2015-11-19 15:07:20 -08:00
|
|
|
ret z
|
2015-12-18 17:07:09 -08:00
|
|
|
ld de, .DollScript
|
2015-11-19 15:07:20 -08:00
|
|
|
ret
|
|
|
|
; fd0fd (3f:50fd)
|
|
|
|
|
2015-12-18 17:07:09 -08:00
|
|
|
.ItemScript: ; 0xfd0fd
|
2015-11-19 15:07:20 -08:00
|
|
|
writetext _MomText_HiHowAreYou
|
|
|
|
writetext _MomText_FoundAnItem
|
|
|
|
writetext _MomText_BoughtWithYourMoney
|
|
|
|
writetext _MomText_ItsInPC
|
|
|
|
end
|
|
|
|
; 0xfd10a
|
|
|
|
|
2015-12-18 17:07:09 -08:00
|
|
|
.DollScript: ; 0xfd10a
|
2015-11-19 15:07:20 -08:00
|
|
|
writetext _MomText_HiHowAreYou
|
|
|
|
writetext _MomText_FoundADoll
|
|
|
|
writetext _MomText_BoughtWithYourMoney
|
|
|
|
writetext _MomText_ItsInRoom
|
|
|
|
end
|
|
|
|
; 0xfd117
|
|
|
|
|
|
|
|
|
|
|
|
GetItemFromMom: ; fd117
|
2015-12-26 15:11:55 -08:00
|
|
|
ld a, [wWhichMomItemSet]
|
2015-11-19 15:07:20 -08:00
|
|
|
and a
|
|
|
|
jr z, .zero
|
|
|
|
dec a
|
|
|
|
ld de, MomItems_1
|
2015-12-18 17:07:09 -08:00
|
|
|
jr .GetFromList1
|
2015-11-19 15:07:20 -08:00
|
|
|
|
|
|
|
.zero
|
2015-12-26 15:11:55 -08:00
|
|
|
ld a, [wWhichMomItem]
|
2017-12-22 21:31:04 -08:00
|
|
|
cp NUM_MOM_ITEMS_2
|
2015-11-19 15:07:20 -08:00
|
|
|
jr c, .ok
|
|
|
|
xor a
|
|
|
|
|
|
|
|
.ok
|
|
|
|
ld de, MomItems_2
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.GetFromList1:
|
2015-11-19 15:07:20 -08:00
|
|
|
ld l, a
|
|
|
|
ld h, 0
|
|
|
|
rept 3 ; multiply hl by 8
|
|
|
|
add hl, hl
|
|
|
|
endr
|
|
|
|
add hl, de
|
|
|
|
ret
|
|
|
|
; fd136
|
|
|
|
|
2017-12-15 14:22:52 -08:00
|
|
|
INCLUDE "data/items/mom_phone.asm"
|
2015-11-19 15:07:20 -08:00
|
|
|
|
2018-01-02 04:24:05 -08:00
|
|
|
db 0, 0, 0 ; unused
|
2015-11-19 15:07:20 -08:00
|
|
|
|
|
|
|
_MomText_HiHowAreYou: ; 0xfd1b1
|
|
|
|
; Hi, ! How are you?
|
|
|
|
text_jump UnknownText_0x1bc615
|
|
|
|
db "@"
|
|
|
|
; 0xfd1b6
|
|
|
|
|
|
|
|
_MomText_FoundAnItem: ; 0xfd1b6
|
|
|
|
; I found a useful item shopping, so
|
|
|
|
text_jump UnknownText_0x1bc62a
|
|
|
|
db "@"
|
|
|
|
; 0xfd1bb
|
|
|
|
|
|
|
|
_MomText_BoughtWithYourMoney: ; 0xfd1bb
|
|
|
|
; I bought it with your money. Sorry!
|
|
|
|
text_jump UnknownText_0x1bc64e
|
|
|
|
db "@"
|
|
|
|
; 0xfd1c0
|
|
|
|
|
|
|
|
_MomText_ItsInPC: ; 0xfd1c0
|
|
|
|
; It's in your PC. You'll like it!
|
|
|
|
text_jump UnknownText_0x1bc673
|
|
|
|
db "@"
|
|
|
|
; 0xfd1c5
|
|
|
|
|
|
|
|
_MomText_FoundADoll: ; 0xfd1c5
|
|
|
|
; While shopping today, I saw this adorable doll, so
|
|
|
|
text_jump UnknownText_0x1bc693
|
|
|
|
db "@"
|
|
|
|
; 0xfd1ca
|
|
|
|
|
|
|
|
_MomText_ItsInRoom: ; 0xfd1ca
|
|
|
|
; It's in your room. You'll love it!
|
|
|
|
text_jump UnknownText_0x1bc6c7
|
|
|
|
db "@"
|
|
|
|
; 0xfd1cf
|
|
|
|
|
2018-01-02 04:24:05 -08:00
|
|
|
db 0 ; unused
|
2015-11-19 15:07:20 -08:00
|
|
|
|
2018-01-02 06:05:14 -08:00
|
|
|
DummyPredef3A: ; fd1d0
|
2015-11-19 15:07:20 -08:00
|
|
|
ret
|
|
|
|
; fd1d1
|
|
|
|
|
2018-01-02 04:24:05 -08:00
|
|
|
ret ; unused
|