Remove Mobile, Battle Tower, Mystery Gift, and Odd Egg (#1)

This commit is contained in:
xCrystal
2023-07-24 21:13:11 +02:00
parent 74b8214272
commit fc7f2d4e0e
201 changed files with 101 additions and 73760 deletions

View File

@@ -65,20 +65,11 @@ DoBattleTransition:
ret
.InitGFX:
ld a, [wLinkMode]
cp LINK_MOBILE
jr z, .mobile
farcall ReanchorBGMap_NoOAMUpdate
call UpdateSprites
call DelayFrame
call .NonMobile_LoadPokeballTiles
call .LoadPokeballTiles
call BattleStart_CopyTilemapAtOnce
jr .resume
.mobile
call LoadTrainerBattlePokeballTiles
.resume
ld a, SCREEN_HEIGHT_PX
ldh [hWY], a
call DelayFrame
@@ -92,7 +83,7 @@ DoBattleTransition:
call WipeLYOverrides
ret
.NonMobile_LoadPokeballTiles:
.LoadPokeballTiles:
call LoadTrainerBattlePokeballTiles
hlbgcoord 0, 0
call ConvertTrainerBattlePokeballTilesTo2bpp

View File

@@ -1,12 +1,5 @@
CheckBattleScene:
; Return carry if battle scene is turned off.
ld a, BANK(wLinkMode)
ld hl, wLinkMode
call GetFarWRAMByte
cp LINK_MOBILE
jr z, .mobile
ld a, [wOptions]
bit BATTLE_SCENE, a
jr nz, .off
@@ -14,34 +7,6 @@ CheckBattleScene:
and a
ret
.mobile
ld a, [wcd2f]
and a
jr nz, .from_wram
ld a, BANK(s4_a60c) ; MBC30 bank used by JP Crystal; inaccessible by MBC3
call OpenSRAM
ld a, [s4_a60c]
ld c, a
call CloseSRAM
ld a, c
bit 0, c
jr z, .off
and a
ret
.from_wram
ld a, BANK(w5_dc00)
ld hl, w5_dc00
call GetFarWRAMByte
bit 0, a
jr z, .off
and a
ret
.off
scf
ret

File diff suppressed because it is too large Load Diff

View File

@@ -32,10 +32,6 @@ BattleCommand_BatonPass:
call SetPalettes
call BatonPass_LinkPlayerSwitch
; Mobile link battles handle entrances differently
farcall CheckMobileBattleError
jp c, EndMoveEffect
ld hl, PassedBattleMonEntrance
call CallBattleCore
@@ -55,10 +51,6 @@ BattleCommand_BatonPass:
call AnimateCurrentMove
call BatonPass_LinkEnemySwitch
; Mobile link battles handle entrances differently
farcall CheckMobileBattleError
jp c, EndMoveEffect
; Passed enemy PartyMon entrance
xor a
ld [wEnemySwitchMonIndex], a

View File

@@ -1,5 +1,4 @@
BattleCommand_Selfdestruct:
farcall StubbedTrainerRankings_Selfdestruct
ld a, BATTLEANIM_PLAYER_DAMAGE
ld [wNumHits], a
ld c, 3

View File

@@ -1,4 +1,3 @@
BattleCommand_Splash:
call AnimateCurrentMove
farcall StubbedTrainerRankings_Splash
jp PrintNothingHappened

View File

@@ -1,8 +1,4 @@
ReadTrainerParty:
ld a, [wInBattleTowerBattle]
bit 0, a
ret nz
ld a, [wLinkMode]
and a
ret nz
@@ -19,14 +15,6 @@ ReadTrainerParty:
call ByteFill
ld a, [wOtherTrainerClass]
cp CAL
jr nz, .not_cal2
ld a, [wOtherTrainerID]
cp CAL2
jr z, .cal2
ld a, [wOtherTrainerClass]
.not_cal2
dec a
ld c, a
ld b, 0
@@ -72,14 +60,6 @@ ReadTrainerParty:
.done
jp ComputeTrainerReward
.cal2
ld a, BANK(sMysteryGiftTrainer)
call OpenSRAM
ld de, sMysteryGiftTrainer
call TrainerType2
call CloseSRAM
jr .done
TrainerTypes:
; entries correspond to TRAINERTYPE_* constants
dw TrainerType1 ; level, species
@@ -333,24 +313,6 @@ Battle_GetTrainerName::
ld c, a
GetTrainerName::
ld a, c
cp CAL
jr nz, .not_cal2
ld a, BANK(sMysteryGiftTrainerHouseFlag)
call OpenSRAM
ld a, [sMysteryGiftTrainerHouseFlag]
and a
call CloseSRAM
jr z, .not_cal2
ld a, BANK(sMysteryGiftPartnerName)
call OpenSRAM
ld hl, sMysteryGiftPartnerName
call CopyTrainerName
jp CloseSRAM
.not_cal2
dec c
push bc
ld b, 0

File diff suppressed because it is too large Load Diff

View File

@@ -1,46 +0,0 @@
GetMobileOTTrainerClass: ; mobile function
ld h, b
ld l, c
call .GetMobileOTTrainerClass
ld c, a
ret
.GetMobileOTTrainerClass:
ld a, [hli]
xor [hl]
ld c, a
jr z, .skip_male_trainers
srl c
srl c
.male_trainer_loop
srl c
ld a, c
cp MaleTrainers.End - MaleTrainers - 1
jr nc, .male_trainer_loop
inc c
.skip_male_trainers
ld a, [de]
cp FEMALE
ld hl, MaleTrainers
jr nz, .finished
ld hl, FemaleTrainers
ld a, c
and a
jr z, .finished
.female_trainer_loop
srl c
ld a, c
cp FemaleTrainers.End - FemaleTrainers - 1
jr nc, .female_trainer_loop
inc c
.finished
ld b, $0
add hl, bc
ld a, [hl]
ret
INCLUDE "data/trainers/gendered_trainers.asm"

View File

@@ -1,212 +0,0 @@
LoadOpponentTrainerAndPokemon:
ldh a, [rSVBK]
push af
ld a, BANK(wBT_OTTrainer)
ldh [rSVBK], a
; Fill wBT_OTTrainer with zeros
xor a
ld hl, wBT_OTTrainer
ld bc, BATTLE_TOWER_STRUCT_LENGTH
call ByteFill
; Write $ff into the Item-Slots
ld a, $ff
ld [wBT_OTMon1Item], a
ld [wBT_OTMon2Item], a
ld [wBT_OTMon3Item], a
; Set wBT_OTTrainer as start address to write the following data to
ld de, wBT_OTTrainer
ldh a, [hRandomAdd]
ld b, a
.resample ; loop to find a random trainer
call Random
ldh a, [hRandomAdd]
add b
ld b, a ; b contains the nr of the trainer
if DEF(_CRYSTAL11)
maskbits BATTLETOWER_NUM_UNIQUE_TRAINERS
cp BATTLETOWER_NUM_UNIQUE_TRAINERS
else
; BUG: Crystal 1.0 used the wrong constant here, so only the first
; 21 trainers in BattleTowerTrainers can be sampled.
maskbits BATTLETOWER_NUM_UNIQUE_MON
cp BATTLETOWER_NUM_UNIQUE_MON
endc
jr nc, .resample
ld b, a
ld a, BANK(sBTTrainers)
call OpenSRAM
ld c, BATTLETOWER_STREAK_LENGTH
ld hl, sBTTrainers
.next_trainer
ld a, [hli]
cp b
jr z, .resample
dec c
jr nz, .next_trainer ; c <= 7 initialise all 7 trainers?
ld hl, sBTTrainers
ld a, [sNrOfBeatenBattleTowerTrainers]
ld c, a
ld a, b
ld b, 0
add hl, bc
ld [hl], a
call CloseSRAM
push af
; Copy name (10 bytes) and class (1 byte) of trainer
ld hl, BattleTowerTrainers
ld bc, NAME_LENGTH
call AddNTimes
ld bc, NAME_LENGTH
call CopyBytes
call LoadRandomBattleTowerMon
pop af
ld hl, BattleTowerTrainerData
ld bc, BATTLETOWER_TRAINERDATALENGTH
call AddNTimes
ld bc, BATTLETOWER_TRAINERDATALENGTH
.copy_bt_trainer_data_loop
ld a, BANK(BattleTowerTrainerData)
call GetFarByte
ld [de], a
inc hl
inc de
dec bc
ld a, b
or c
jr nz, .copy_bt_trainer_data_loop
pop af
ldh [rSVBK], a
ret
LoadRandomBattleTowerMon:
ld c, BATTLETOWER_PARTY_LENGTH
.loop
push bc
ld a, BANK(sBTMonOfTrainers)
call OpenSRAM
.FindARandomBattleTowerMon:
; From Which LevelGroup are the mon loaded
; a = 1..10
ld a, [wBTChoiceOfLvlGroup]
dec a
ld hl, BattleTowerMons
ld bc, BATTLETOWER_NUM_UNIQUE_MON * NICKNAMED_MON_STRUCT_LENGTH
call AddNTimes
ldh a, [hRandomAdd]
ld b, a
.resample
call Random
ldh a, [hRandomAdd]
add b
ld b, a
maskbits BATTLETOWER_NUM_UNIQUE_MON
cp BATTLETOWER_NUM_UNIQUE_MON
jr nc, .resample
; in register 'a' is the chosen mon of the LevelGroup
; Check if mon was already loaded before
; Check current and the 2 previous teams
; includes check if item is double at the current team
ld bc, NICKNAMED_MON_STRUCT_LENGTH
call AddNTimes
ld a, [hli]
ld b, a
ld a, [hld]
ld c, a
ld a, [wBT_OTMon1]
cp b
jr z, .FindARandomBattleTowerMon
ld a, [wBT_OTMon1Item]
cp c
jr z, .FindARandomBattleTowerMon
ld a, [wBT_OTMon2]
cp b
jr z, .FindARandomBattleTowerMon
ld a, [wBT_OTMon2Item]
cp c
jr z, .FindARandomBattleTowerMon
ld a, [wBT_OTMon3]
cp b
jr z, .FindARandomBattleTowerMon
ld a, [wBT_OTMon3Item]
cp c
jr z, .FindARandomBattleTowerMon
ld a, [sBTMonPrevTrainer1]
cp b
jr z, .FindARandomBattleTowerMon
ld a, [sBTMonPrevTrainer2]
cp b
jr z, .FindARandomBattleTowerMon
ld a, [sBTMonPrevTrainer3]
cp b
jr z, .FindARandomBattleTowerMon
ld a, [sBTMonPrevPrevTrainer1]
cp b
jr z, .FindARandomBattleTowerMon
ld a, [sBTMonPrevPrevTrainer2]
cp b
jr z, .FindARandomBattleTowerMon
ld a, [sBTMonPrevPrevTrainer3]
cp b
jr z, .FindARandomBattleTowerMon
ld bc, NICKNAMED_MON_STRUCT_LENGTH
call CopyBytes
ld a, [wNamedObjectIndex]
push af
push de
ld hl, -NICKNAMED_MON_STRUCT_LENGTH
add hl, de
ld a, [hl]
ld [wNamedObjectIndex], a
ld bc, PARTYMON_STRUCT_LENGTH
add hl, bc
push hl
call GetPokemonName
ld h, d
ld l, e
pop de
ld bc, MON_NAME_LENGTH
call CopyBytes
pop de
pop af
ld [wNamedObjectIndex], a
pop bc
dec c
jp nz, .loop
ld a, [sBTMonPrevTrainer1]
ld [sBTMonPrevPrevTrainer1], a
ld a, [sBTMonPrevTrainer2]
ld [sBTMonPrevPrevTrainer2], a
ld a, [sBTMonPrevTrainer3]
ld [sBTMonPrevPrevTrainer3], a
ld a, [wBT_OTMon1]
ld [sBTMonPrevTrainer1], a
ld a, [wBT_OTMon2]
ld [sBTMonPrevTrainer2], a
ld a, [wBT_OTMon3]
ld [sBTMonPrevTrainer3], a
call CloseSRAM
ret
INCLUDE "data/battle_tower/classes.asm"
INCLUDE "data/battle_tower/parties.asm"

View File

@@ -1,299 +0,0 @@
CheckForMobileBattleRules:
ld de, .PointerTables
call BattleTower_ExecuteJumptable
ret z
call BattleTower_PleaseReturnWhenReady
scf
ret
.PointerTables:
db 2
dw .Functions
dw .TextPointers
.Functions:
dw BattleTower_CheckPartyLengthIs3
dw BattleTower_CheckPartyHasThreeMonsThatAreNotEggs
.TextPointers:
dw .BTExcuseMeText
dw NeedAtLeastThreeMonText
dw EggDoesNotQualifyText
.BTExcuseMeText:
text_far _BTExcuseMeText
text_end
_CheckForBattleTowerRules:
ld hl, wStringBuffer2
ld [hl], "3"
inc hl
ld [hl], "@"
ld de, .PointerTables
call BattleTower_ExecuteJumptable
ret z
call BattleTower_PleaseReturnWhenReady
scf
ret
.PointerTables:
db 4
dw .Functions
dw .TextPointers
.Functions:
dw CheckBTRule_PartyCountEq3
dw CheckBTRule_PartySpeciesAreUnique
dw CheckBTRule_PartyItemsAreUnique
dw CheckBTRule_HasPartyAnEgg
.TextPointers:
dw ExcuseMeYoureNotReadyText
dw OnlyThreeMonMayBeEnteredText
dw TheMonMustAllBeDifferentKindsText
dw TheMonMustNotHoldTheSameItemsText
dw YouCantTakeAnEggText
ExcuseMeYoureNotReadyText:
text_far _ExcuseMeYoureNotReadyText
text_end
BattleTower_PleaseReturnWhenReady:
ld hl, .BattleTowerReturnWhenReadyText
call PrintText
ret
.BattleTowerReturnWhenReadyText:
text_far _BattleTowerReturnWhenReadyText
text_end
NeedAtLeastThreeMonText:
text_far _NeedAtLeastThreeMonText
text_end
EggDoesNotQualifyText:
text_far _EggDoesNotQualifyText
text_end
OnlyThreeMonMayBeEnteredText:
text_far _OnlyThreeMonMayBeEnteredText
text_end
TheMonMustAllBeDifferentKindsText:
text_far _TheMonMustAllBeDifferentKindsText
text_end
TheMonMustNotHoldTheSameItemsText:
text_far _TheMonMustNotHoldTheSameItemsText
text_end
YouCantTakeAnEggText:
text_far _YouCantTakeAnEggText
text_end
BattleTower_ExecuteJumptable:
ld bc, 0
.loop
call .DoJumptableFunction
call c, .PrintFailureText
call .Next_CheckReachedEnd
jr nz, .loop
ld a, b
and a
ret
.DoJumptableFunction:
push de
push bc
call .GetFunctionPointer
ld a, c
rst JumpTable
pop bc
pop de
ret
.Next_CheckReachedEnd:
inc c
ld a, [de]
cp c
ret
.GetFunctionPointer:
inc de
ld a, [de]
ld l, a
inc de
ld a, [de]
ld h, a
ret
.GetTextPointers:
inc de
inc de
inc de
ld a, [de]
ld l, a
inc de
ld a, [de]
ld h, a
ret
.LoadTextPointer:
ld a, [hli]
ld h, [hl]
ld l, a
ret
.PrintFailureText:
push de
push bc
ld a, b
and a
call z, .PrintFirstText
pop bc
call .PrintNthText
ld b, 1
pop de
ret
.PrintFirstText:
push de
call .GetTextPointers
call .LoadTextPointer
call PrintText
pop de
ret
.PrintNthText:
push bc
call .GetTextPointers
inc hl
inc hl
ld b, 0
add hl, bc
add hl, bc
call .LoadTextPointer
call PrintText
pop bc
ret
BattleTower_CheckPartyLengthIs3:
ld a, [wPartyCount]
cp BATTLETOWER_PARTY_LENGTH
ret
BattleTower_CheckPartyHasThreeMonsThatAreNotEggs:
ld hl, wPartyCount
ld a, [hli]
ld b, 0
ld c, a
.loop
ld a, [hli]
cp EGG
jr z, .egg
inc b
.egg
dec c
jr nz, .loop
ld a, [wPartyCount]
cp b
ret z
ld a, b
cp BATTLETOWER_PARTY_LENGTH
ret
CheckBTRule_PartyCountEq3:
ld a, [wPartyCount]
cp BATTLETOWER_PARTY_LENGTH
ret z
scf
ret
CheckBTRule_PartySpeciesAreUnique:
ld hl, wPartyMon1Species
call CheckPartyValueIsUnique
ret
CheckPartyValueIsUnique:
ld de, wPartyCount
ld a, [de]
inc de
dec a
jr z, .done
ld b, a
.loop
push hl
push de
ld c, b
call .isegg
jr z, .next
ld a, [hl]
and a
jr z, .next
.loop2
call .nextmon
call .isegg
jr z, .next2
cp [hl]
jr z, .gotcha
.next2
dec c
jr nz, .loop2
.next
pop de
pop hl
call .nextmon
dec b
jr nz, .loop
.done
and a
ret
.gotcha
pop de
pop hl
scf
ret
.nextmon
push bc
ld bc, PARTYMON_STRUCT_LENGTH
add hl, bc
inc de
pop bc
ret
.isegg
push bc
ld b, a
ld a, [de]
cp EGG
ld a, b
pop bc
ret
CheckBTRule_PartyItemsAreUnique:
ld hl, wPartyMon1Item
call CheckPartyValueIsUnique
ret
CheckBTRule_HasPartyAnEgg:
ld hl, wPartyCount
ld a, [hli]
ld c, a
.loop
ld a, [hli]
cp EGG
jr z, .found
dec c
jr nz, .loop
and a
ret
.found
scf
ret

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,5 @@
_BugContestJudging:
call ContestScore
farcall StubbedTrainerRankings_BugContestScore
call BugContest_JudgeContestants
ld a, [wBugContestThirdPlaceWinnerID]
call LoadContestantName

View File

@@ -54,7 +54,6 @@ CheckFruitTree:
ret
PickedFruitTree:
farcall StubbedTrainerRankings_FruitPicked
ld b, 1
jp GetFruitTreeFlag

View File

@@ -104,7 +104,6 @@ CheckForLuckyNumberWinners:
and a
ret z ; found nothing
farcall StubbedTrainerRankings_LuckyNumberShow
ld a, [wTempByteValue]
and a
push af

View File

@@ -28,7 +28,6 @@ CheckMagikarpLength:
ld c, l
call CalcMagikarpLength
call PrintMagikarpLength
farcall StubbedTrainerRankings_MagikarpLength
ld hl, .MagikarpGuruMeasureText
call PrintText

View File

@@ -1,96 +0,0 @@
_GiveOddEgg:
; Figure out which egg to give.
; Compare a random word to probabilities out of $ffff.
call Random
ld hl, OddEggProbabilities
ld c, 0
ld b, c
.loop
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
; Break on $ffff.
ld a, d
cp HIGH($ffff)
jr nz, .not_done
ld a, e
cp LOW($ffff)
jr z, .done
.not_done
; Break when the random word <= the next probability in de.
ldh a, [hRandomSub]
cp d
jr c, .done
jr z, .ok
jr .next
.ok
ldh a, [hRandomAdd]
cp e
jr c, .done
jr z, .done
.next
inc bc
jr .loop
.done
ld hl, OddEggs
ld a, NICKNAMED_MON_STRUCT_LENGTH
call AddNTimes
; Writes to wOddEgg, wOddEggName, and wOddEggOT,
; even though OddEggs does not have data for wOddEggOT
ld de, wOddEgg
ld bc, NICKNAMED_MON_STRUCT_LENGTH + NAME_LENGTH
call CopyBytes
ld a, EGG_TICKET
ld [wCurItem], a
ld a, 1
ld [wItemQuantityChange], a
ld a, -1
ld [wCurItemQuantity], a
ld hl, wNumItems
call TossItem
; load species in wMobileMonSpecies
ld a, EGG
ld [wMobileMonMiscSpecies], a
; load pointer to (wMobileMonSpecies - 1) in wMobileMonSpeciesPointer
ld a, LOW(wMobileMonMiscSpecies - 1)
ld [wMobileMonSpeciesPointer], a
ld a, HIGH(wMobileMonMiscSpecies - 1)
ld [wMobileMonSpeciesPointer + 1], a
; load pointer to wOddEgg in wMobileMonStructPointer
ld a, LOW(wOddEgg)
ld [wMobileMonStructPointer], a
ld a, HIGH(wOddEgg)
ld [wMobileMonStructPointer + 1], a
; load Odd Egg Name in wTempOddEggNickname
ld hl, .Odd
ld de, wTempOddEggNickname
ld bc, MON_NAME_LENGTH
call CopyBytes
; load pointer to wTempOddEggNickname in wMobileMonOTPointer
ld a, LOW(wTempOddEggNickname)
ld [wMobileMonOTPointer], a
ld a, HIGH(wTempOddEggNickname)
ld [wMobileMonOTPointer + 1], a
; load pointer to wOddEggName in wMobileMonNicknamePointer
ld a, LOW(wOddEggName)
ld [wMobileMonNicknamePointer], a
ld a, HIGH(wOddEggName)
ld [wMobileMonNicknamePointer + 1], a
farcall AddMobileMonToParty
ret
.Odd:
db "ODD@@@@@@@@@"
INCLUDE "data/events/odd_eggs.asm"

View File

@@ -405,8 +405,6 @@ UsedSurfScript:
waitbutton
closetext
callasm .stubbed_fn
readmem wSurfingPlayerState
writevar VAR_MOVEMENT
@@ -417,10 +415,6 @@ UsedSurfScript:
applymovement PLAYER, wMovementBuffer
end
.stubbed_fn
farcall StubbedTrainerRankings_Surf
ret
UsedSurfText:
text_far _UsedSurfText
text_end
@@ -689,7 +683,6 @@ Script_UsedWaterfall:
ld a, [wPlayerTile]
call CheckWaterfallTile
ret z
farcall StubbedTrainerRankings_Waterfall
ld a, $1
ld [wScriptVar], a
ret

View File

@@ -125,51 +125,6 @@ PlayersHousePC:
ld [wScriptVar], a
ret
CheckMysteryGift:
ld a, BANK(sMysteryGiftItem)
call OpenSRAM
ld a, [sMysteryGiftItem]
and a
jr z, .no
inc a
.no
ld [wScriptVar], a
call CloseSRAM
ret
GetMysteryGiftItem:
ld a, BANK(sMysteryGiftItem)
call OpenSRAM
ld a, [sMysteryGiftItem]
ld [wCurItem], a
ld a, 1
ld [wItemQuantityChange], a
ld hl, wNumItems
call ReceiveItem
jr nc, .no_room
xor a
ld [sMysteryGiftItem], a
call CloseSRAM
ld a, [wCurItem]
ld [wNamedObjectIndex], a
call GetItemName
ld hl, .ReceiveItemText
call PrintText
ld a, TRUE
ld [wScriptVar], a
ret
.no_room
call CloseSRAM
xor a
ld [wScriptVar], a
ret
.ReceiveItemText:
text_far _ReceiveItemText
text_end
BugContestJudging:
farcall _BugContestJudging
ld a, b
@@ -415,11 +370,4 @@ PrintDiploma:
call FadeToMenu
farcall _PrintDiploma
call ExitAllMenus
ret
TrainerHouse:
ld a, BANK(sMysteryGiftTrainerHouseFlag)
call OpenSRAM
ld a, [sMysteryGiftTrainerHouseFlag]
ld [wScriptVar], a
jp CloseSRAM
ret

View File

@@ -112,7 +112,6 @@ PokecenterNurseScript:
farwritetext NurseTakePokemonText
pause 20
special StubbedTrainerRankings_Healings
turnobject LAST_TALKED, LEFT
pause 10
special HealParty

Some files were not shown because too many files have changed in this diff Show More