Remove mom saving/spending coins (#1); add coins gained from a trainer battle to wCurLevelCoins (#30)

This commit is contained in:
xCrystal 2024-03-18 18:17:35 +01:00
parent 659dfb085a
commit 5f0cdcaa85
17 changed files with 10 additions and 954 deletions

View File

@ -11,9 +11,6 @@
const ENGINE_DAY_CARE_MAN_HAS_MON const ENGINE_DAY_CARE_MAN_HAS_MON
; wDayCareLady ; wDayCareLady
const ENGINE_DAY_CARE_LADY_HAS_MON const ENGINE_DAY_CARE_LADY_HAS_MON
; wMomSavingCoins
const ENGINE_MOM_SAVING_COINS
const ENGINE_MOM_ACTIVE
; wStatusFlags ; wStatusFlags
const ENGINE_POKEDEX const ENGINE_POKEDEX
const ENGINE_UNOWN_DEX const ENGINE_UNOWN_DEX

View File

@ -36,7 +36,6 @@ DEF MAX_DAYS EQU 36 * 7 ; 252
; significant coins values ; significant coins values
DEF START_COINS EQU 100 DEF START_COINS EQU 100
DEF MOM_COINS EQU 2300
DEF MAX_COINS EQU 999999 DEF MAX_COINS EQU 999999
DEF MAX_LEVEL_COINS EQU 99999 DEF MAX_LEVEL_COINS EQU 99999
DEF MAX_DELTA_COINS_DIGITS EQU 5 DEF MAX_DELTA_COINS_DIGITS EQU 5

View File

@ -15,7 +15,6 @@ DEF STRING_BUFFER_LENGTH EQU 19
const_def const_def
const YOUR_COINS ; 0 const YOUR_COINS ; 0
const CUR_LEVEL_COINS ; 1 const CUR_LEVEL_COINS ; 1
const MOMS_COINS ; 2
; checkcoins/checkchips return values ; checkcoins/checkchips return values
const_def const_def

View File

@ -218,14 +218,6 @@ DEF SCRIPT_RUNNING EQU 2
const STATUSFLAGS2_REACHED_GOLDENROD_F ; 6 const STATUSFLAGS2_REACHED_GOLDENROD_F ; 6
const STATUSFLAGS2_ROCKETS_IN_MAHOGANY_F ; 7 const STATUSFLAGS2_ROCKETS_IN_MAHOGANY_F ; 7
; wMomSavingCoins::
DEF MOM_SAVING_SOME_COINS_F EQU 0
DEF MOM_SAVING_HALF_COINS_F EQU 1
DEF MOM_SAVING_ALL_COINS_F EQU 2
DEF MOM_ACTIVE_F EQU 7
DEF MOM_SAVING_COINS_MASK EQU (1 << MOM_SAVING_SOME_COINS_F) | (1 << MOM_SAVING_HALF_COINS_F) | (1 << MOM_SAVING_ALL_COINS_F)
; wJohtoBadges:: ; wJohtoBadges::
const_def const_def
const ZEPHYRBADGE const ZEPHYRBADGE

View File

@ -20,9 +20,6 @@ EngineFlags:
engine_flag wDayCareMan, DAYCAREMAN_HAS_MON_F engine_flag wDayCareMan, DAYCAREMAN_HAS_MON_F
engine_flag wDayCareLady, DAYCARELADY_HAS_MON_F engine_flag wDayCareLady, DAYCARELADY_HAS_MON_F
engine_flag wMomSavingCoins, MOM_SAVING_SOME_COINS_F
engine_flag wMomSavingCoins, MOM_ACTIVE_F
engine_flag wStatusFlags, STATUSFLAGS_POKEDEX_F engine_flag wStatusFlags, STATUSFLAGS_POKEDEX_F
engine_flag wStatusFlags, STATUSFLAGS_UNOWN_DEX_F engine_flag wStatusFlags, STATUSFLAGS_UNOWN_DEX_F
engine_flag wStatusFlags, STATUSFLAGS_CAUGHT_POKERUS_F engine_flag wStatusFlags, STATUSFLAGS_CAUGHT_POKERUS_F

View File

@ -42,7 +42,6 @@ SpecialsPointers::
add_special DayCareLady add_special DayCareLady
add_special DayCareManOutside add_special DayCareManOutside
add_special MoveDeletion add_special MoveDeletion
add_special BankOfMom
add_special MagnetTrain add_special MagnetTrain
add_special NameRival add_special NameRival
add_special OverworldTownMap add_special OverworldTownMap

View File

@ -1,29 +0,0 @@
MACRO momitem
; coins to trigger, cost, kind, item
dt \1
dt \2
db \3, \4
ENDM
MomItems_1:
momitem 0, 600, MOM_ITEM, SUPER_POTION
momitem 0, 90, MOM_ITEM, ANTIDOTE
momitem 0, 180, MOM_ITEM, POKE_BALL
momitem 0, 450, MOM_ITEM, ESCAPE_ROPE
momitem 0, 500, MOM_ITEM, GREAT_BALL
.End
MomItems_2:
momitem 900, 600, MOM_ITEM, SUPER_POTION
momitem 4000, 270, MOM_ITEM, REPEL
momitem 7000, 600, MOM_ITEM, SUPER_POTION
momitem 10000, 1800, MOM_DOLL, DECO_CHARMANDER_DOLL
momitem 15000, 3000, MOM_ITEM, MOON_STONE
momitem 19000, 600, MOM_ITEM, SUPER_POTION
momitem 30000, 4800, MOM_DOLL, DECO_CLEFAIRY_DOLL
momitem 40000, 900, MOM_ITEM, HYPER_POTION
momitem 50000, 8000, MOM_DOLL, DECO_PIKACHU_DOLL
momitem 100000, 22800, MOM_DOLL, DECO_BIG_SNORLAX_DOLL
.End
dt 0 ; unused

View File

@ -64,7 +64,6 @@ PredefPointers::
add_predef PlayBattleAnim add_predef PlayBattleAnim
add_predef DummyPredef38 add_predef DummyPredef38
add_predef DummyPredef39 add_predef DummyPredef39
add_predef DummyPredef3A
add_predef PartyMonItemName add_predef PartyMonItemName
add_predef GetMonFrontpic add_predef GetMonFrontpic
add_predef GetMonBackpic add_predef GetMonBackpic

View File

@ -183,28 +183,6 @@ TiedAgainstText:
line "<ENEMY>!" line "<ENEMY>!"
prompt prompt
SentSomeToMomText:
text "<PLAYER> got <COIN>@"
text_decimal wBattleReward, 3, 6
text_start
line "for winning!"
cont "Sent some to MOM!"
prompt
SentHalfToMomText:
text "Sent half to MOM!"
prompt
SentAllToMomText:
text "Sent all to MOM!"
prompt
UnusedRivalLossText: ; unreferenced
text "<RIVAL>: Huh? I"
line "should've chosen"
cont "your #MON!"
prompt
BattleText_MonFainted: BattleText_MonFainted:
text_ram wBattleMonNickname text_ram wBattleMonNickname
text_start text_start
@ -215,12 +193,6 @@ BattleText_UseNextMon:
text "Use next #MON?" text "Use next #MON?"
done done
UnusedRivalWinText: ; unreferenced
text "<RIVAL>: Yes!"
line "I guess I chose a"
cont "good #MON!"
prompt
LostAgainstText: LostAgainstText:
text "Lost against" text "Lost against"
line "<ENEMY>!" line "<ENEMY>!"

View File

@ -2332,27 +2332,7 @@ WinTrainerBattle:
ld a, [wAmuletCoin] ld a, [wAmuletCoin]
and a and a
call nz, .DoubleReward call nz, .DoubleReward
call .CheckMaxedOutMomCoins
push af
ld a, FALSE
jr nc, .okay
ld a, [wMomSavingCoins]
and MOM_SAVING_COINS_MASK
cp (1 << MOM_SAVING_SOME_COINS_F) | (1 << MOM_SAVING_HALF_COINS_F)
jr nz, .okay
inc a ; TRUE
.okay
ld b, a
ld c, 4 ld c, 4
.loop
ld a, b
and a
jr z, .loop2
call .AddCoinsToMom
dec c
dec b
jr .loop
.loop2 .loop2
ld a, c ld a, c
@ -2365,38 +2345,13 @@ WinTrainerBattle:
.done .done
call .DoubleReward call .DoubleReward
call .DoubleReward call .DoubleReward
pop af
jr nc, .KeepItAll
ld a, [wMomSavingCoins]
and MOM_SAVING_COINS_MASK
jr z, .KeepItAll
ld hl, .SentToMomTexts
dec a
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
jp StdBattleTextbox
.KeepItAll:
ld hl, GotCoinsForWinningText ld hl, GotCoinsForWinningText
jp StdBattleTextbox jp StdBattleTextbox
.AddCoinsToMom:
push bc
ld hl, wBattleReward + 2
ld de, wMomsCoins + 2
call AddBattleCoinsToAccount
pop bc
ret
.AddCoinsToWallet: .AddCoinsToWallet:
push bc push bc
ld hl, wBattleReward + 2 ld hl, wBattleReward + 2
ld de, wCoins + 2 ld de, wCurLevelCoins + 2
call AddBattleCoinsToAccount call AddBattleCoinsToAccount
pop bc pop bc
ret ret
@ -2415,22 +2370,6 @@ WinTrainerBattle:
ld [hl], a ld [hl], a
ret ret
.SentToMomTexts:
; entries correspond to MOM_SAVING_* constants
dw SentSomeToMomText
dw SentHalfToMomText
dw SentAllToMomText
.CheckMaxedOutMomCoins:
ld hl, wMomsCoins + 2
ld a, [hld]
cp LOW(MAX_COINS)
ld a, [hld]
sbc HIGH(MAX_COINS) ; mid
ld a, [hl]
sbc HIGH(MAX_COINS >> 8)
ret
AddBattleCoinsToAccount: AddBattleCoinsToAccount:
ld c, 3 ld c, 3
and a and a
@ -2451,17 +2390,17 @@ AddBattleCoinsToAccount:
jr nz, .loop jr nz, .loop
pop hl pop hl
ld a, [hld] ld a, [hld]
cp LOW(MAX_COINS) cp LOW(MAX_LEVEL_COINS)
ld a, [hld] ld a, [hld]
sbc HIGH(MAX_COINS) ; mid sbc HIGH(MAX_LEVEL_COINS) ; mid
ld a, [hl] ld a, [hl]
sbc HIGH(MAX_COINS >> 8) sbc HIGH(MAX_LEVEL_COINS >> 8)
ret c ret c
ld [hl], HIGH(MAX_COINS >> 8) ld [hl], HIGH(MAX_LEVEL_COINS >> 8)
inc hl inc hl
ld [hl], HIGH(MAX_COINS) ; mid ld [hl], HIGH(MAX_LEVEL_COINS) ; mid
inc hl inc hl
ld [hl], LOW(MAX_COINS) ld [hl], LOW(MAX_LEVEL_COINS)
ret ret
PlayVictoryMusic: PlayVictoryMusic:
@ -8166,7 +8105,7 @@ CheckPayDay:
.okay .okay
ld hl, wPayDayCoins + 2 ld hl, wPayDayCoins + 2
ld de, wCoins + 2 ld de, wCurLevelCoins + 2
call AddBattleCoinsToAccount call AddBattleCoinsToAccount
ld hl, BattleText_PlayerPickedUpPayDayCoins ld hl, BattleText_PlayerPickedUpPayDayCoins
call StdBattleTextbox call StdBattleTextbox

View File

@ -27,7 +27,7 @@ LoadMaxCoins_bc:
cp HIGH(wCurLevelCoins) cp HIGH(wCurLevelCoins)
ld bc, MaxCurLevelCoins ; CUR_LEVEL_COINS ld bc, MaxCurLevelCoins ; CUR_LEVEL_COINS
ret z ret z
ld bc, MaxCoins ; YOUR_COINS or MOMS_COINS ld bc, MaxCoins ; YOUR_COINS
ret ret
LoadMaxCoins_hl: LoadMaxCoins_hl:

View File

@ -1,541 +0,0 @@
BankOfMom:
ldh a, [hInMenu]
push af
ld a, $1
ldh [hInMenu], a
xor a
ld [wJumptableIndex], a
.loop
ld a, [wJumptableIndex]
bit 7, a
jr nz, .done
call .RunJumptable
jr .loop
.done
pop af
ldh [hInMenu], a
ret
.RunJumptable:
jumptable .dw, wJumptableIndex
.dw
dw .CheckIfBankInitialized
dw .InitializeBank
dw .IsThisAboutYourCoins
dw .AccessBankOfMom
dw .StoreCoins
dw .TakeCoins
dw .StopOrStartSavingCoins
dw .JustDoWhatYouCan
dw .AskDST
.CheckIfBankInitialized:
ld a, [wMomSavingCoins]
bit MOM_ACTIVE_F, a
jr nz, .savingcoinsalready
set MOM_ACTIVE_F, a
ld [wMomSavingCoins], a
ld a, $1
jr .done_0
.savingcoinsalready
ld a, $2
.done_0
ld [wJumptableIndex], a
ret
.InitializeBank:
ld hl, MomLeavingText1
call PrintText1bpp
call YesNoBox
jr c, .DontSaveCoins
ld hl, MomLeavingText2
call PrintText1bpp
ld a, (1 << MOM_ACTIVE_F) | (1 << MOM_SAVING_SOME_COINS_F)
jr .done_1
.DontSaveCoins:
ld a, 1 << MOM_ACTIVE_F
.done_1
ld [wMomSavingCoins], a
ld hl, MomLeavingText3
call PrintText1bpp
ld a, $8
ld [wJumptableIndex], a
ret
.IsThisAboutYourCoins:
ld hl, MomIsThisAboutYourCoinsText
call PrintText1bpp
call YesNoBox
jr c, .nope
ld a, $3
jr .done_2
.nope
ld a, $7
.done_2
ld [wJumptableIndex], a
ret
.AccessBankOfMom:
ld hl, MomBankWhatDoYouWantToDoText
call PrintText1bpp
call LoadStandardMenuHeader
ld hl, BankOfMom_MenuHeader
call CopyMenuHeader
call VerticalMenu
call CloseWindow
jr c, .cancel
ld a, [wMenuCursorY]
cp $1
jr z, .withdraw
cp $2
jr z, .deposit
cp $3
jr z, .stopsaving
.cancel
ld a, $7
jr .done_3
.withdraw
ld a, $5
jr .done_3
.deposit
ld a, $4
jr .done_3
.stopsaving
ld a, $6
.done_3
ld [wJumptableIndex], a
ret
.StoreCoins:
ld hl, MomStoreCoinsText
call PrintText1bpp
xor a
ld hl, wStringBuffer2
ld [hli], a
ld [hli], a
ld [hl], a
ld a, 5
ld [wMomBankDigitCursorPosition], a
call LoadStandardMenuHeader
call Mom_SetUpDepositMenu
call Mom_Wait10Frames
call Mom_WithdrawDepositMenuJoypad
call CloseWindow
jr c, .CancelDeposit
ld hl, wStringBuffer2
ld a, [hli]
or [hl]
inc hl
or [hl]
jr z, .CancelDeposit
ld de, wCoins
ld bc, wStringBuffer2
farcall CompareCoins
jr c, .InsufficientFundsInWallet
ld hl, wStringBuffer2
ld de, wStringBuffer2 + 3
ld bc, 3
call CopyBytes
ld bc, wMomsCoins
ld de, wStringBuffer2
farcall GiveCoins
jr c, .NotEnoughRoomInBank
ld bc, wStringBuffer2 + 3
ld de, wCoins
farcall TakeCoins
ld hl, wStringBuffer2
ld de, wMomsCoins
ld bc, 3
call CopyBytes
ld de, SFX_TRANSACTION
call PlaySFX
call WaitSFX
ld hl, MomStoredCoinsText
call PrintText1bpp
ld a, $8
jr .done_4
.InsufficientFundsInWallet:
ld hl, MomInsufficientFundsInWalletText
call PrintText1bpp
ret
.NotEnoughRoomInBank:
ld hl, MomNotEnoughRoomInBankText
call PrintText1bpp
ret
.CancelDeposit:
ld a, $7
.done_4
ld [wJumptableIndex], a
ret
.TakeCoins:
ld hl, MomTakeCoinsText
call PrintText1bpp
xor a
ld hl, wStringBuffer2
ld [hli], a
ld [hli], a
ld [hl], a
ld a, 5
ld [wMomBankDigitCursorPosition], a
call LoadStandardMenuHeader
call Mom_SetUpWithdrawMenu
call Mom_Wait10Frames
call Mom_WithdrawDepositMenuJoypad
call CloseWindow
jr c, .CancelWithdraw
ld hl, wStringBuffer2
ld a, [hli]
or [hl]
inc hl
or [hl]
jr z, .CancelWithdraw
ld hl, wStringBuffer2
ld de, wStringBuffer2 + 3
ld bc, 3
call CopyBytes
ld de, wMomsCoins
ld bc, wStringBuffer2
farcall CompareCoins
jr c, .InsufficientFundsInBank
ld bc, wCoins
ld de, wStringBuffer2
farcall GiveCoins
jr c, .NotEnoughRoomInWallet
ld bc, wStringBuffer2 + 3
ld de, wMomsCoins
farcall TakeCoins
ld hl, wStringBuffer2
ld de, wCoins
ld bc, 3
call CopyBytes
ld de, SFX_TRANSACTION
call PlaySFX
call WaitSFX
ld hl, MomTakenCoinsText
call PrintText1bpp
ld a, $8
jr .done_5
.InsufficientFundsInBank:
ld hl, MomHaventSavedThatMuchText
call PrintText1bpp
ret
.NotEnoughRoomInWallet:
ld hl, MomNotEnoughRoomInWalletText
call PrintText1bpp
ret
.CancelWithdraw:
ld a, $7
.done_5
ld [wJumptableIndex], a
ret
.StopOrStartSavingCoins:
ld hl, MomSaveCoinsText
call PrintText1bpp
call YesNoBox
jr c, .StopSavingCoins
ld a, (1 << MOM_ACTIVE_F) | (1 << MOM_SAVING_SOME_COINS_F)
ld [wMomSavingCoins], a
ld hl, MomStartSavingCoinsText
call PrintText1bpp
ld a, $8
ld [wJumptableIndex], a
ret
.StopSavingCoins:
ld a, 1 << MOM_ACTIVE_F
ld [wMomSavingCoins], a
ld a, $7
ld [wJumptableIndex], a
ret
.JustDoWhatYouCan:
ld hl, MomJustDoWhatYouCanText
call PrintText1bpp
.AskDST:
ld hl, wJumptableIndex
set 7, [hl]
ret
Mom_SetUpWithdrawMenu:
ld de, Mon_WithdrawString
jr Mom_ContinueMenuSetup
Mom_SetUpDepositMenu:
ld de, Mom_DepositString
Mom_ContinueMenuSetup:
push de
xor a
ldh [hBGMapMode], a
hlcoord 0, 0
lb bc, 6, 18
call Textbox1bpp
hlcoord 1, 2
ld de, Mom_SavedString
call PlaceString
hlcoord 12, 2
ld de, wMomsCoins
lb bc, PRINTNUM_COINS | 3, 6
call PrintNum
hlcoord 1, 4
ld de, Mom_HeldString
call PlaceString
hlcoord 12, 4
ld de, wCoins
lb bc, PRINTNUM_COINS | 3, 6
call PrintNum
hlcoord 1, 6
pop de
call PlaceString
hlcoord 12, 6
ld de, wStringBuffer2
lb bc, PRINTNUM_COINS | PRINTNUM_LEADINGZEROS | 3, 6
call PrintNum
call UpdateSprites
call CopyTilemapAtOnce
ret
Mom_Wait10Frames:
ld c, 10
call DelayFrames
ret
Mom_WithdrawDepositMenuJoypad:
.loop
call JoyTextDelay
ld hl, hJoyPressed
ld a, [hl]
and B_BUTTON
jr nz, .pressedB
ld a, [hl]
and A_BUTTON
jr nz, .pressedA
call .dpadaction
xor a
ldh [hBGMapMode], a
hlcoord 12, 6
ld bc, 7
ld a, " "
call ByteFill
hlcoord 12, 6
ld de, wStringBuffer2
lb bc, PRINTNUM_COINS | PRINTNUM_LEADINGZEROS | 3, 6
call PrintNum
ldh a, [hVBlankCounter]
and $10
jr nz, .skip
hlcoord 13, 6
ld a, [wMomBankDigitCursorPosition]
ld c, a
ld b, 0
add hl, bc
ld [hl], " "
.skip
call WaitBGMap
jr .loop
.pressedB
scf
ret
.pressedA
and a
ret
.dpadaction
ld hl, hJoyLast
ld a, [hl]
and D_UP
jr nz, .incrementdigit
ld a, [hl]
and D_DOWN
jr nz, .decrementdigit
ld a, [hl]
and D_LEFT
jr nz, .movecursorleft
ld a, [hl]
and D_RIGHT
jr nz, .movecursorright
and a
ret
.movecursorleft
ld hl, wMomBankDigitCursorPosition
ld a, [hl]
and a
ret z
dec [hl]
ret
.movecursorright
ld hl, wMomBankDigitCursorPosition
ld a, [hl]
cp 5
ret nc
inc [hl]
ret
.incrementdigit
ld hl, .DigitQuantities
call .getdigitquantity
ld c, l
ld b, h
ld de, wStringBuffer2
farcall GiveCoins
ret
.decrementdigit
ld hl, .DigitQuantities
call .getdigitquantity
ld c, l
ld b, h
ld de, wStringBuffer2
farcall TakeCoins
ret
.getdigitquantity
ld a, [wMomBankDigitCursorPosition]
push de
ld e, a
ld d, 0
add hl, de
add hl, de
add hl, de
pop de
ret
.DigitQuantities:
dt 100000
dt 10000
dt 1000
dt 100
dt 10
dt 1
dt 100000
dt 10000
dt 1000
dt 100
dt 10
dt 1
dt 900000
dt 90000
dt 9000
dt 900
dt 90
dt 9
MomLeavingText1:
text_far _MomLeavingText1
text_end
MomLeavingText2:
text_far _MomLeavingText2
text_end
MomLeavingText3:
text_far _MomLeavingText3
text_end
MomIsThisAboutYourCoinsText:
text_far _MomIsThisAboutYourCoinsText
text_end
MomBankWhatDoYouWantToDoText:
text_far _MomBankWhatDoYouWantToDoText
text_end
MomStoreCoinsText:
text_far _MomStoreCoinsText
text_end
MomTakeCoinsText:
text_far _MomTakeCoinsText
text_end
MomSaveCoinsText:
text_far _MomSaveCoinsText
text_end
MomHaventSavedThatMuchText:
text_far _MomHaventSavedThatMuchText
text_end
MomNotEnoughRoomInWalletText:
text_far _MomNotEnoughRoomInWalletText
text_end
MomInsufficientFundsInWalletText:
text_far _MomInsufficientFundsInWalletText
text_end
MomNotEnoughRoomInBankText:
text_far _MomNotEnoughRoomInBankText
text_end
MomStartSavingCoinsText:
text_far _MomStartSavingCoinsText
text_end
MomStoredCoinsText:
text_far _MomStoredCoinsText
text_end
MomTakenCoinsText:
text_far _MomTakenCoinsText
text_end
MomJustDoWhatYouCanText:
text_far _MomJustDoWhatYouCanText
text_end
Mom_SavedString:
db "SAVED@"
Mon_WithdrawString:
db "WITHDRAW@"
Mom_DepositString:
db "DEPOSIT@"
Mom_HeldString:
db "HELD@"
BankOfMom_MenuHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 0, 0, 10, 10
dw .MenuData
db 1 ; default option
.MenuData:
db STATICMENU_CURSOR ; flags
db 4 ; items
db "GET@"
db "SAVE@"
db "CHANGE@"
db "CANCEL@"

View File

@ -1,239 +0,0 @@
DEF NUM_MOM_ITEMS_1 EQUS "((MomItems_1.End - MomItems_1) / 8)"
DEF NUM_MOM_ITEMS_2 EQUS "((MomItems_2.End - MomItems_2) / 8)"
const_def 1
const MOM_ITEM
const MOM_DOLL
MomTriesToBuySomething::
ld a, [wMapReentryScriptQueueFlag]
and a
ret nz
call GetMapPhoneService
and a
ret nz
xor a
ld [wWhichMomItemSet], a
call CheckBalance_MomItem2
ret nc
call Mom_GiveItemOrDoll
ret nc
ld b, BANK(.Script)
ld de, .Script
farcall LoadMemScript
scf
ret
.Script:
callasm .ASMFunction
farsjump Script_ReceivePhoneCall
.ASMFunction:
call MomBuysItem_DeductFunds
call Mom_GetScriptPointer
ld a, [wWhichMomItemSet]
and a
jr nz, .ok
ld hl, wWhichMomItem
inc [hl]
.ok
ld a, PHONE_MOM
ld [wCurCaller], a
ld bc, wCallerContact
ld hl, PHONE_CONTACT_TRAINER_CLASS
add hl, bc
ld [hl], TRAINER_NONE
inc hl
ld [hl], PHONE_MOM
ld hl, PHONE_CONTACT_SCRIPT2_BANK
add hl, bc
ld a, BANK(Mom_GetScriptPointer)
ld [hli], a
ld a, e
ld [hli], a
ld a, d
ld [hl], a
ret
CheckBalance_MomItem2:
ld a, [wWhichMomItem]
cp NUM_MOM_ITEMS_2
jr nc, .nope
call GetItemFromMom
ld a, [hli]
ldh [hCoinsTemp], a
ld a, [hli]
ldh [hCoinsTemp + 1], a
ld a, [hli]
ldh [hCoinsTemp + 2], a
ld de, wMomsCoins
ld bc, hCoinsTemp
farcall CompareCoins
jr nc, .have_enough_coins
.nope
jr .check_have_2300
.have_enough_coins
scf
ret
.check_have_2300
ld hl, hCoinsTemp
ld [hl], HIGH(MOM_COINS >> 8)
inc hl
ld [hl], HIGH(MOM_COINS) ; mid
inc hl
ld [hl], LOW(MOM_COINS)
.loop
ld de, wMomItemTriggerBalance
ld bc, wMomsCoins
farcall CompareCoins
jr z, .exact
jr nc, .less_than
call .AddCoins
jr .loop
.less_than
xor a
ret
.exact
call .AddCoins
ld a, NUM_MOM_ITEMS_1
call RandomRange
inc a
ld [wWhichMomItemSet], a
scf
ret
.AddCoins:
ld de, wMomItemTriggerBalance
ld bc, hCoinsTemp
farcall AddCoins
ret
MomBuysItem_DeductFunds:
call GetItemFromMom
ld de, 3 ; cost
add hl, de
ld a, [hli]
ldh [hCoinsTemp], a
ld a, [hli]
ldh [hCoinsTemp + 1], a
ld a, [hli]
ldh [hCoinsTemp + 2], a
ld de, wMomsCoins
ld bc, hCoinsTemp
farcall TakeCoins
ret
Mom_GiveItemOrDoll:
call GetItemFromMom
ld de, 6 ; item type
add hl, de
ld a, [hli]
cp MOM_ITEM
jr z, .not_doll
ld a, [hl]
ld c, a
ld b, 1
farcall DecorationFlagAction_c
scf
ret
.not_doll
ld a, [hl]
ld [wCurItem], a
ld a, 1
ld [wItemQuantityChange], a
ld hl, wNumPCItems
call ReceiveItem
ret
Mom_GetScriptPointer:
call GetItemFromMom
ld de, 6 ; item type
add hl, de
ld a, [hli]
ld de, .ItemScript
cp MOM_ITEM
ret z
ld de, .DollScript
ret
.ItemScript:
writetext MomHiHowAreYouText
writetext MomFoundAnItemText
writetext MomBoughtWithYourCoinsText
writetext MomItsInPCText
end
.DollScript:
writetext MomHiHowAreYouText
writetext MomFoundADollText
writetext MomBoughtWithYourCoinsText
writetext MomItsInYourRoomText
end
GetItemFromMom:
ld a, [wWhichMomItemSet]
and a
jr z, .zero
dec a
ld de, MomItems_1
jr .GetFromList1
.zero
ld a, [wWhichMomItem]
cp NUM_MOM_ITEMS_2
jr c, .ok
xor a
.ok
ld de, MomItems_2
.GetFromList1:
ld l, a
ld h, 0
rept 3 ; multiply hl by 8
add hl, hl
endr
add hl, de
ret
INCLUDE "data/items/mom_phone.asm"
MomHiHowAreYouText:
text_far _MomHiHowAreYouText
text_end
MomFoundAnItemText:
text_far _MomFoundAnItemText
text_end
MomBoughtWithYourCoinsText:
text_far _MomBoughtWithYourCoinsText
text_end
MomItsInPCText:
text_far _MomItsInPCText
text_end
MomFoundADollText:
text_far _MomFoundADollText
text_end
MomItsInYourRoomText:
text_far _MomItsInYourRoomText
text_end
DummyPredef3A_DummyData: ; unreferenced
db 0
DummyPredef3A:
ret
DummyPredef3A_DummyFunction: ; unreferenced
ret

View File

@ -127,16 +127,6 @@ endc
ld a, LOW(START_COINS) ld a, LOW(START_COINS)
ld [wCoins + 2], a ld [wCoins + 2], a
xor a
ld [wWhichMomItem], a
ld hl, wMomItemTriggerBalance
ld [hl], HIGH(MOM_COINS >> 8)
inc hl
ld [hl], HIGH(MOM_COINS) ; mid
inc hl
ld [hl], LOW(MOM_COINS)
call InitializeNPCNames call InitializeNPCNames
farcall InitDecorations farcall InitDecorations

View File

@ -1205,7 +1205,6 @@ Script_reloadmapafterbattle:
.notblackedout .notblackedout
bit 0, d bit 0, d
jr z, .was_wild jr z, .was_wild
farcall MomTriesToBuySomething
jr .next jr .next
.was_wild .was_wild
@ -1223,6 +1222,7 @@ Script_reloadmapafterbattle:
farcall LoadBoardMenuDieNumbersGFX farcall LoadBoardMenuDieNumbersGFX
ld hl, wDisplaySecondarySprites ld hl, wDisplaySecondarySprites
set SECONDARYSPRITES_SPACES_LEFT_F, [hl] set SECONDARYSPRITES_SPACES_LEFT_F, [hl]
call ConstructOverworldHUDTilemap ; refresh coins just won
.done .done
jp Script_reloadmap jp Script_reloadmap
@ -1874,10 +1874,7 @@ GetCoinsAccount:
and a and a
ld de, wCoins ; YOUR_COINS ld de, wCoins ; YOUR_COINS
ret z ret z
dec a
ld de, wCurLevelCoins ; CUR_LEVEL_COINS ld de, wCurLevelCoins ; CUR_LEVEL_COINS
ret z
ld de, wMomsCoins ; MOMS_COINS
ret ret
LoadCoinsAmountToMem: LoadCoinsAmountToMem:

View File

@ -82,7 +82,6 @@ INCLUDE "engine/events/pokecenter_pc.asm"
INCLUDE "engine/items/mart.asm" INCLUDE "engine/items/mart.asm"
INCLUDE "engine/events/coins.asm" INCLUDE "engine/events/coins.asm"
INCLUDE "data/items/marts.asm" INCLUDE "data/items/marts.asm"
INCLUDE "engine/events/mom.asm"
INCLUDE "engine/events/daycare.asm" INCLUDE "engine/events/daycare.asm"
INCLUDE "engine/events/print_unown.asm" INCLUDE "engine/events/print_unown.asm"
INCLUDE "engine/events/print_photo.asm" INCLUDE "engine/events/print_photo.asm"
@ -394,7 +393,6 @@ SECTION "bank3F", ROMX
INCLUDE "engine/tilesets/tileset_anims.asm" INCLUDE "engine/tilesets/tileset_anims.asm"
INCLUDE "engine/events/npc_trade.asm" INCLUDE "engine/events/npc_trade.asm"
INCLUDE "engine/events/mom_phone.asm"
SECTION "bank41", ROMX SECTION "bank41", ROMX

View File

@ -2396,14 +2396,6 @@ wStatusFlags2::
db db
wCoins:: ds 3 wCoins:: ds 3
wMomsCoins:: ds 3
wMomSavingCoins::
; bit 0: saving some coins
; bit 1: saving half coins (unused)
; bit 2: saving all coins (unused)
; bit 7: active
db
wChips:: dw wChips:: dw
@ -2503,11 +2495,6 @@ wDecoLeftOrnament:: db
wDecoRightOrnament:: db wDecoRightOrnament:: db
wDecoBigDoll:: db wDecoBigDoll:: db
; Items bought from Mom
wWhichMomItem:: db
wWhichMomItemSet:: db
wMomItemTriggerBalance:: ds 3
wDailyResetTimer:: dw wDailyResetTimer:: dw
wDailyFlags1:: db wDailyFlags1:: db
wDailyFlags2:: db wDailyFlags2:: db