2022-06-06 14:25:42 -07:00
|
|
|
DEF NUM_MOM_ITEMS_1 EQUS "((MomItems_1.End - MomItems_1) / 8)"
|
|
|
|
DEF NUM_MOM_ITEMS_2 EQUS "((MomItems_2.End - MomItems_2) / 8)"
|
2017-12-22 21:31:04 -08:00
|
|
|
|
2019-01-15 04:06:16 -08:00
|
|
|
const_def 1
|
2017-12-08 21:50:59 -08:00
|
|
|
const MOM_ITEM
|
|
|
|
const MOM_DOLL
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
MomTriesToBuySomething::
|
2015-11-19 15:07:20 -08:00
|
|
|
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
|
2023-09-15 11:04:16 -07:00
|
|
|
farcall LoadMemScript
|
2015-11-19 15:07:20 -08:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
.Script:
|
2015-12-18 17:07:09 -08:00
|
|
|
callasm .ASMFunction
|
2019-03-10 13:39:31 -07:00
|
|
|
farsjump Script_ReceivePhoneCall
|
2015-11-19 15:07:20 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.ASMFunction:
|
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
|
2018-09-09 12:09:51 -07:00
|
|
|
ld [wCurCaller], a
|
2019-04-08 15:50:10 -07:00
|
|
|
ld bc, wCallerContact
|
|
|
|
ld hl, PHONE_CONTACT_TRAINER_CLASS
|
2015-11-19 15:07:20 -08:00
|
|
|
add hl, bc
|
2019-04-08 15:50:10 -07:00
|
|
|
ld [hl], TRAINER_NONE
|
2015-11-19 15:07:20 -08:00
|
|
|
inc hl
|
2019-04-08 15:50:10 -07:00
|
|
|
ld [hl], PHONE_MOM
|
|
|
|
ld hl, PHONE_CONTACT_SCRIPT2_BANK
|
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
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CheckBalance_MomItem2:
|
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]
|
2023-09-02 14:16:35 -07:00
|
|
|
ldh [hCoinsTemp], a
|
2015-11-19 15:07:20 -08:00
|
|
|
ld a, [hli]
|
2023-09-02 14:16:35 -07:00
|
|
|
ldh [hCoinsTemp + 1], a
|
2015-11-19 15:07:20 -08:00
|
|
|
ld a, [hli]
|
2023-09-02 14:16:35 -07:00
|
|
|
ldh [hCoinsTemp + 2], a
|
|
|
|
ld de, wMomsCoins
|
|
|
|
ld bc, hCoinsTemp
|
|
|
|
farcall CompareCoins
|
|
|
|
jr nc, .have_enough_coins
|
2015-11-19 15:07:20 -08:00
|
|
|
|
|
|
|
.nope
|
|
|
|
jr .check_have_2300
|
|
|
|
|
2023-09-02 14:16:35 -07:00
|
|
|
.have_enough_coins
|
2015-11-19 15:07:20 -08:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
|
|
|
.check_have_2300
|
2023-09-02 14:16:35 -07:00
|
|
|
ld hl, hCoinsTemp
|
|
|
|
ld [hl], HIGH(MOM_COINS >> 8)
|
2015-11-19 15:07:20 -08:00
|
|
|
inc hl
|
2023-09-02 14:16:35 -07:00
|
|
|
ld [hl], HIGH(MOM_COINS) ; mid
|
2015-11-19 15:07:20 -08:00
|
|
|
inc hl
|
2023-09-02 14:16:35 -07:00
|
|
|
ld [hl], LOW(MOM_COINS)
|
2015-11-19 15:07:20 -08:00
|
|
|
.loop
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wMomItemTriggerBalance
|
2023-09-02 14:16:35 -07:00
|
|
|
ld bc, wMomsCoins
|
|
|
|
farcall CompareCoins
|
2015-11-19 15:07:20 -08:00
|
|
|
jr z, .exact
|
|
|
|
jr nc, .less_than
|
2023-09-02 14:16:35 -07:00
|
|
|
call .AddCoins
|
2015-11-19 15:07:20 -08:00
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.less_than
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.exact
|
2023-09-02 14:16:35 -07:00
|
|
|
call .AddCoins
|
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
|
|
|
|
|
2023-09-02 14:16:35 -07:00
|
|
|
.AddCoins:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wMomItemTriggerBalance
|
2023-09-02 14:16:35 -07:00
|
|
|
ld bc, hCoinsTemp
|
|
|
|
farcall AddCoins
|
2015-11-19 15:07:20 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
MomBuysItem_DeductFunds:
|
2015-11-19 15:07:20 -08:00
|
|
|
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]
|
2023-09-02 14:16:35 -07:00
|
|
|
ldh [hCoinsTemp], a
|
2015-11-19 15:07:20 -08:00
|
|
|
ld a, [hli]
|
2023-09-02 14:16:35 -07:00
|
|
|
ldh [hCoinsTemp + 1], a
|
2015-11-19 15:07:20 -08:00
|
|
|
ld a, [hli]
|
2023-09-02 14:16:35 -07:00
|
|
|
ldh [hCoinsTemp + 2], a
|
|
|
|
ld de, wMomsCoins
|
|
|
|
ld bc, hCoinsTemp
|
|
|
|
farcall TakeCoins
|
2015-11-19 15:07:20 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Mom_GiveItemOrDoll:
|
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
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wItemQuantityChange], a
|
2019-03-18 08:43:58 -07:00
|
|
|
ld hl, wNumPCItems
|
2015-11-19 15:07:20 -08:00
|
|
|
call ReceiveItem
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Mom_GetScriptPointer:
|
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
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
.ItemScript:
|
2019-10-20 15:24:17 -07:00
|
|
|
writetext MomHiHowAreYouText
|
|
|
|
writetext MomFoundAnItemText
|
2023-09-02 14:16:35 -07:00
|
|
|
writetext MomBoughtWithYourCoinsText
|
2019-10-20 15:24:17 -07:00
|
|
|
writetext MomItsInPCText
|
2015-11-19 15:07:20 -08:00
|
|
|
end
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
.DollScript:
|
2019-10-20 15:24:17 -07:00
|
|
|
writetext MomHiHowAreYouText
|
|
|
|
writetext MomFoundADollText
|
2023-09-02 14:16:35 -07:00
|
|
|
writetext MomBoughtWithYourCoinsText
|
2019-10-20 15:24:17 -07:00
|
|
|
writetext MomItsInYourRoomText
|
2015-11-19 15:07:20 -08:00
|
|
|
end
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetItemFromMom:
|
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
|
|
|
|
|
2017-12-15 14:22:52 -08:00
|
|
|
INCLUDE "data/items/mom_phone.asm"
|
2015-11-19 15:07:20 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
MomHiHowAreYouText:
|
|
|
|
text_far _MomHiHowAreYouText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-19 15:07:20 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
MomFoundAnItemText:
|
|
|
|
text_far _MomFoundAnItemText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-19 15:07:20 -08:00
|
|
|
|
2023-09-02 14:16:35 -07:00
|
|
|
MomBoughtWithYourCoinsText:
|
|
|
|
text_far _MomBoughtWithYourCoinsText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-19 15:07:20 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
MomItsInPCText:
|
|
|
|
text_far _MomItsInPCText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-19 15:07:20 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
MomFoundADollText:
|
|
|
|
text_far _MomFoundADollText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-19 15:07:20 -08:00
|
|
|
|
2019-10-20 15:24:17 -07:00
|
|
|
MomItsInYourRoomText:
|
|
|
|
text_far _MomItsInYourRoomText
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-19 15:07:20 -08:00
|
|
|
|
2020-10-28 07:21:10 -07:00
|
|
|
|
|
|
|
DummyPredef3A_DummyData: ; unreferenced
|
|
|
|
db 0
|
2015-11-19 15:07:20 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
DummyPredef3A:
|
2015-11-19 15:07:20 -08:00
|
|
|
ret
|
|
|
|
|
2020-10-28 07:21:10 -07:00
|
|
|
DummyPredef3A_DummyFunction: ; unreferenced
|
|
|
|
ret
|