2018-01-22 18:00:35 +00: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-23 05:31:04 +00:00
|
|
|
|
2019-01-15 12:06:16 +00:00
|
|
|
const_def 1
|
2017-12-09 05:50:59 +00:00
|
|
|
const MOM_ITEM
|
|
|
|
const MOM_DOLL
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
MomTriesToBuySomething::
|
2015-11-19 23:07:20 +00:00
|
|
|
ld a, [wMapReentryScriptQueueFlag]
|
|
|
|
and a
|
|
|
|
ret nz
|
2018-01-17 03:57:19 +00:00
|
|
|
call GetMapPhoneService
|
2015-11-19 23:07:20 +00:00
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
xor a
|
2015-12-26 23:11:55 +00:00
|
|
|
ld [wWhichMomItemSet], a
|
2015-11-19 23:07:20 +00:00
|
|
|
call CheckBalance_MomItem2
|
|
|
|
ret nc
|
2015-12-19 01:07:09 +00:00
|
|
|
call Mom_GiveItemOrDoll
|
2015-11-19 23:07:20 +00:00
|
|
|
ret nc
|
2015-12-19 01:07:09 +00:00
|
|
|
ld b, BANK(.Script)
|
|
|
|
ld de, .Script
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall LoadScriptBDE
|
2015-11-19 23:07:20 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.Script:
|
2015-12-19 01:07:09 +00:00
|
|
|
callasm .ASMFunction
|
2019-03-10 20:39:31 +00:00
|
|
|
farsjump Script_ReceivePhoneCall
|
2015-11-19 23:07:20 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.ASMFunction:
|
2015-11-19 23:07:20 +00:00
|
|
|
call MomBuysItem_DeductFunds
|
2015-12-19 01:07:09 +00:00
|
|
|
call Mom_GetScriptPointer
|
2015-12-26 23:11:55 +00:00
|
|
|
ld a, [wWhichMomItemSet]
|
2015-11-19 23:07:20 +00:00
|
|
|
and a
|
|
|
|
jr nz, .ok
|
2015-12-26 23:11:55 +00:00
|
|
|
ld hl, wWhichMomItem
|
2015-11-19 23:07:20 +00:00
|
|
|
inc [hl]
|
|
|
|
.ok
|
2015-12-19 01:07:09 +00:00
|
|
|
ld a, PHONE_MOM
|
2018-09-09 19:09:51 +00:00
|
|
|
ld [wCurCaller], a
|
2019-04-08 22:50:10 +00:00
|
|
|
ld bc, wCallerContact
|
|
|
|
ld hl, PHONE_CONTACT_TRAINER_CLASS
|
2015-11-19 23:07:20 +00:00
|
|
|
add hl, bc
|
2019-04-08 22:50:10 +00:00
|
|
|
ld [hl], TRAINER_NONE
|
2015-11-19 23:07:20 +00:00
|
|
|
inc hl
|
2019-04-08 22:50:10 +00:00
|
|
|
ld [hl], PHONE_MOM
|
|
|
|
ld hl, PHONE_CONTACT_SCRIPT2_BANK
|
2015-11-19 23:07:20 +00:00
|
|
|
add hl, bc
|
2015-12-19 01:07:09 +00:00
|
|
|
ld a, BANK(Mom_GetScriptPointer)
|
2015-11-19 23:07:20 +00:00
|
|
|
ld [hli], a
|
|
|
|
ld a, e
|
|
|
|
ld [hli], a
|
|
|
|
ld a, d
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CheckBalance_MomItem2:
|
2015-12-26 23:11:55 +00:00
|
|
|
ld a, [wWhichMomItem]
|
2017-12-23 05:31:04 +00:00
|
|
|
cp NUM_MOM_ITEMS_2
|
2015-11-19 23:07:20 +00:00
|
|
|
jr nc, .nope
|
|
|
|
call GetItemFromMom
|
|
|
|
ld a, [hli]
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hMoneyTemp], a
|
2015-11-19 23:07:20 +00:00
|
|
|
ld a, [hli]
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hMoneyTemp + 1], a
|
2015-11-19 23:07:20 +00:00
|
|
|
ld a, [hli]
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hMoneyTemp + 2], a
|
2015-11-19 23:07:20 +00:00
|
|
|
ld de, wMomsMoney
|
|
|
|
ld bc, hMoneyTemp
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall CompareMoney
|
2015-11-19 23:07:20 +00: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 18:40:10 +00:00
|
|
|
ld [hl], HIGH(MOM_MONEY >> 8)
|
2015-11-19 23:07:20 +00:00
|
|
|
inc hl
|
2017-12-25 18:40:10 +00:00
|
|
|
ld [hl], HIGH(MOM_MONEY) ; mid
|
2015-11-19 23:07:20 +00:00
|
|
|
inc hl
|
2017-12-25 18:40:10 +00:00
|
|
|
ld [hl], LOW(MOM_MONEY)
|
2015-11-19 23:07:20 +00:00
|
|
|
.loop
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wMomItemTriggerBalance
|
2015-11-19 23:07:20 +00:00
|
|
|
ld bc, wMomsMoney
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall CompareMoney
|
2015-11-19 23:07:20 +00:00
|
|
|
jr z, .exact
|
|
|
|
jr nc, .less_than
|
2015-12-26 23:11:55 +00:00
|
|
|
call .AddMoney
|
2015-11-19 23:07:20 +00:00
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.less_than
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.exact
|
2015-12-26 23:11:55 +00:00
|
|
|
call .AddMoney
|
2017-12-23 05:31:04 +00:00
|
|
|
ld a, NUM_MOM_ITEMS_1
|
2015-11-19 23:07:20 +00:00
|
|
|
call RandomRange
|
|
|
|
inc a
|
2015-12-26 23:11:55 +00:00
|
|
|
ld [wWhichMomItemSet], a
|
2015-11-19 23:07:20 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.AddMoney:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wMomItemTriggerBalance
|
2015-11-19 23:07:20 +00:00
|
|
|
ld bc, hMoneyTemp
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall AddMoney
|
2015-11-19 23:07:20 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
MomBuysItem_DeductFunds:
|
2015-11-19 23:07:20 +00:00
|
|
|
call GetItemFromMom
|
2015-12-19 01:07:09 +00:00
|
|
|
ld de, 3 ; cost
|
2015-11-19 23:07:20 +00:00
|
|
|
add hl, de
|
|
|
|
ld a, [hli]
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hMoneyTemp], a
|
2015-11-19 23:07:20 +00:00
|
|
|
ld a, [hli]
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hMoneyTemp + 1], a
|
2015-11-19 23:07:20 +00:00
|
|
|
ld a, [hli]
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hMoneyTemp + 2], a
|
2015-11-19 23:07:20 +00:00
|
|
|
ld de, wMomsMoney
|
|
|
|
ld bc, hMoneyTemp
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall TakeMoney
|
2015-11-19 23:07:20 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Mom_GiveItemOrDoll:
|
2015-11-19 23:07:20 +00:00
|
|
|
call GetItemFromMom
|
2015-12-19 01:07:09 +00:00
|
|
|
ld de, 6 ; item type
|
2015-11-19 23:07:20 +00:00
|
|
|
add hl, de
|
|
|
|
ld a, [hli]
|
2015-12-19 01:07:09 +00:00
|
|
|
cp MOM_ITEM
|
2015-11-19 23:07:20 +00:00
|
|
|
jr z, .not_doll
|
|
|
|
ld a, [hl]
|
|
|
|
ld c, a
|
|
|
|
ld b, 1
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall DecorationFlagAction_c
|
2015-11-19 23:07:20 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.not_doll
|
|
|
|
ld a, [hl]
|
2018-01-23 22:39:09 +00:00
|
|
|
ld [wCurItem], a
|
2015-12-19 01:07:09 +00:00
|
|
|
ld a, 1
|
2015-11-19 23:07:20 +00:00
|
|
|
ld [wItemQuantityChangeBuffer], a
|
2019-03-18 15:43:58 +00:00
|
|
|
ld hl, wNumPCItems
|
2015-11-19 23:07:20 +00:00
|
|
|
call ReceiveItem
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Mom_GetScriptPointer:
|
2015-11-19 23:07:20 +00:00
|
|
|
call GetItemFromMom
|
2015-12-19 01:07:09 +00:00
|
|
|
ld de, 6 ; item type
|
2015-11-19 23:07:20 +00:00
|
|
|
add hl, de
|
|
|
|
ld a, [hli]
|
2015-12-19 01:07:09 +00:00
|
|
|
ld de, .ItemScript
|
|
|
|
cp MOM_ITEM
|
2015-11-19 23:07:20 +00:00
|
|
|
ret z
|
2015-12-19 01:07:09 +00:00
|
|
|
ld de, .DollScript
|
2015-11-19 23:07:20 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.ItemScript:
|
2015-11-19 23:07:20 +00:00
|
|
|
writetext _MomText_HiHowAreYou
|
|
|
|
writetext _MomText_FoundAnItem
|
|
|
|
writetext _MomText_BoughtWithYourMoney
|
|
|
|
writetext _MomText_ItsInPC
|
|
|
|
end
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
.DollScript:
|
2015-11-19 23:07:20 +00:00
|
|
|
writetext _MomText_HiHowAreYou
|
|
|
|
writetext _MomText_FoundADoll
|
|
|
|
writetext _MomText_BoughtWithYourMoney
|
|
|
|
writetext _MomText_ItsInRoom
|
|
|
|
end
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
GetItemFromMom:
|
2015-12-26 23:11:55 +00:00
|
|
|
ld a, [wWhichMomItemSet]
|
2015-11-19 23:07:20 +00:00
|
|
|
and a
|
|
|
|
jr z, .zero
|
|
|
|
dec a
|
|
|
|
ld de, MomItems_1
|
2015-12-19 01:07:09 +00:00
|
|
|
jr .GetFromList1
|
2015-11-19 23:07:20 +00:00
|
|
|
|
|
|
|
.zero
|
2015-12-26 23:11:55 +00:00
|
|
|
ld a, [wWhichMomItem]
|
2017-12-23 05:31:04 +00:00
|
|
|
cp NUM_MOM_ITEMS_2
|
2015-11-19 23:07:20 +00:00
|
|
|
jr c, .ok
|
|
|
|
xor a
|
|
|
|
|
|
|
|
.ok
|
|
|
|
ld de, MomItems_2
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.GetFromList1:
|
2015-11-19 23:07:20 +00:00
|
|
|
ld l, a
|
|
|
|
ld h, 0
|
|
|
|
rept 3 ; multiply hl by 8
|
|
|
|
add hl, hl
|
|
|
|
endr
|
|
|
|
add hl, de
|
|
|
|
ret
|
|
|
|
|
2017-12-15 22:22:52 +00:00
|
|
|
INCLUDE "data/items/mom_phone.asm"
|
2015-11-19 23:07:20 +00:00
|
|
|
|
2018-01-02 12:24:05 +00:00
|
|
|
db 0, 0, 0 ; unused
|
2015-11-19 23:07:20 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
_MomText_HiHowAreYou:
|
2015-11-19 23:07:20 +00:00
|
|
|
; Hi, ! How are you?
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _MomShoppingText1
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
_MomText_FoundAnItem:
|
2015-11-19 23:07:20 +00:00
|
|
|
; I found a useful item shopping, so
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _MomShoppingText2
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
_MomText_BoughtWithYourMoney:
|
2015-11-19 23:07:20 +00:00
|
|
|
; I bought it with your money. Sorry!
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _MomShoppingText3
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
_MomText_ItsInPC:
|
2015-11-19 23:07:20 +00:00
|
|
|
; It's in your PC. You'll like it!
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _MomShoppingText4
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
_MomText_FoundADoll:
|
2015-11-19 23:07:20 +00:00
|
|
|
; While shopping today, I saw this adorable doll, so
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _MomShoppingText5
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
_MomText_ItsInRoom:
|
2015-11-19 23:07:20 +00:00
|
|
|
; It's in your room. You'll love it!
|
2019-03-11 00:43:34 +00:00
|
|
|
text_far _MomShoppingText6
|
2018-11-17 18:33:03 +00:00
|
|
|
text_end
|
2015-11-19 23:07:20 +00:00
|
|
|
|
2018-01-02 12:24:05 +00:00
|
|
|
db 0 ; unused
|
2015-11-19 23:07:20 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DummyPredef3A:
|
2015-11-19 23:07:20 +00:00
|
|
|
ret
|
|
|
|
|
2018-01-02 12:24:05 +00:00
|
|
|
ret ; unused
|