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:

File diff suppressed because it is too large Load Diff

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