From 91f749101724a17398363745d8ac95cd4feeb1c1 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 18 Nov 2015 18:35:44 -0500 Subject: [PATCH] items/item_effects.asm; engine/evolution.asm --- battle/core.asm | 2 +- engine/breeding/egg.asm | 2 +- engine/evolve.asm | 682 ++++++++++++++++++++++++++++++++++++ engine/link.asm | 2 +- engine/party_menu.asm | 52 +-- engine/pokegear.asm | 5 +- engine/predef.asm | 4 +- engine/specials.asm | 2 +- engine/startmenu.asm | 97 +++--- engine/town_map.asm | 2 +- home/menu.asm | 2 +- home/text.asm | 2 +- items/item_effects.asm | 576 +++++++++++++++---------------- main.asm | 747 ++-------------------------------------- misc/mobile_40.asm | 4 +- misc/mobile_46.asm | 2 +- misc/mobile_5f.asm | 12 +- wram.asm | 1 + 18 files changed, 1096 insertions(+), 1100 deletions(-) create mode 100755 engine/evolve.asm diff --git a/battle/core.asm b/battle/core.asm index d3393b4ff..e800c3fa1 100644 --- a/battle/core.asm +++ b/battle/core.asm @@ -8745,7 +8745,7 @@ Function3f6a5: ; 3f6a5 call CheckPayDay xor a ld [wd1e9], a - predef Function421e6 + predef EvolveAfterBattle callba Function2ed44 ret ; 3f6d0 diff --git a/engine/breeding/egg.asm b/engine/breeding/egg.asm index f007fde6a..ea365d8b5 100755 --- a/engine/breeding/egg.asm +++ b/engine/breeding/egg.asm @@ -219,7 +219,7 @@ Function16f7a: ; 16f7a (5:6f7a) push de - callba Function4dbb8 + callba SetEggMonCaughtData callba MobileFn_10608d ld a, [CurPartyMon] ld hl, PartyMons ; wdcdf (aliases: PartyMon1, PartyMon1Species) diff --git a/engine/evolve.asm b/engine/evolve.asm new file mode 100755 index 000000000..940b033b1 --- /dev/null +++ b/engine/evolve.asm @@ -0,0 +1,682 @@ +EvolvePokemon: ; 421d8 + ld hl, EvolvableFlags + xor a + ld [hl], a + ld a, [CurPartyMon] + ld c, a + ld b, SET_FLAG + call EvoFlagAction + +EvolveAfterBattle: ; 421e6 + xor a + ld [wd268], a + dec a + ld [CurPartyMon], a + push hl + push bc + push de + ld hl, PartyCount + + push hl + +CheckForEvolvablePokemon: ; 421f5 + ld hl, CurPartyMon + inc [hl] + + pop hl + + inc hl + ld a, [hl] + cp $ff + jp z, Evolution_ReturnToMap + + ld [Buffer1], a + + push hl + ld a, [CurPartyMon] + ld c, a + ld hl, EvolvableFlags + ld b, CHECK_FLAG + call EvoFlagAction + ld a, c + and a + jp z, CheckForEvolvablePokemon + + ld a, [Buffer1] + dec a + ld b, 0 + ld c, a + ld hl, EvosAttacksPointers +rept 2 + add hl, bc +endr + ld a, [hli] + ld h, [hl] + ld l, a + + push hl + xor a + ld [MonType], a + predef CopyPkmnToTempMon + pop hl + +.loop + ld a, [hli] + and a + jr z, CheckForEvolvablePokemon + + ld b, a + + cp EVOLVE_TRADE + jr z, .trade + + ld a, [wLinkMode] + and a + jp nz, .dont_evolve_2 + + ld a, b + cp EVOLVE_ITEM + jp z, .item + + ld a, [wd1e9] + and a + jp nz, .dont_evolve_2 + + ld a, b + cp EVOLVE_LEVEL + jp z, .level + + cp EVOLVE_HAPPINESS + jr z, .happiness + + +; EVOLVE_STAT + ld a, [TempMonLevel] + cp [hl] + jp c, .dont_evolve_1 + + call IsMonHoldingEverstone + jp z, .dont_evolve_1 + + push hl + ld de, TempMonAttack + ld hl, TempMonDefense + ld c, 2 + call StringCmp + ld a, ATK_EQ_DEF + jr z, .got_tyrogue_evo + ld a, ATK_LT_DEF + jr c, .got_tyrogue_evo + ld a, ATK_GT_DEF +.got_tyrogue_evo + pop hl + + inc hl + cp [hl] + jp nz, .dont_evolve_2 + + inc hl + jr .proceed + + +.happiness + ld a, [TempMonHappiness] + cp 220 + jp c, .dont_evolve_2 + + call IsMonHoldingEverstone + jp z, .dont_evolve_2 + + ld a, [hli] + cp TR_ANYTIME + jr z, .proceed + cp TR_MORNDAY + jr z, .happiness_daylight + +; TR_NITE + ld a, [TimeOfDay] + cp NITE + jp nz, .dont_evolve_3 + jr .proceed + +.happiness_daylight + ld a, [TimeOfDay] + cp NITE + jp z, .dont_evolve_3 + jr .proceed + + +.trade + ld a, [wLinkMode] + and a + jp z, .dont_evolve_2 + + call IsMonHoldingEverstone + jp z, .dont_evolve_2 + + ld a, [hli] + ld b, a + inc a + jr z, .proceed + + ld a, [wLinkMode] + cp LINK_TIMECAPSULE + jp z, .dont_evolve_3 + + ld a, [TempMonItem] + cp b + jp nz, .dont_evolve_3 + + xor a + ld [TempMonItem], a + jr .proceed + + +.item + ld a, [hli] + ld b, a + ld a, [CurItem] + cp b + jp nz, .dont_evolve_3 + + ld a, [wd1e9] + and a + jp z, .dont_evolve_3 + ld a, [wLinkMode] + and a + jp nz, .dont_evolve_3 + jr .proceed + + +.level + ld a, [hli] + ld b, a + ld a, [TempMonLevel] + cp b + jp c, .dont_evolve_3 + call IsMonHoldingEverstone + jp z, .dont_evolve_3 + +.proceed + ld a, [TempMonLevel] + ld [CurPartyLevel], a + ld a, $1 + ld [wd268], a + + push hl + + ld a, [hl] + ld [Buffer2], a + ld a, [CurPartyMon] + ld hl, PartyMonNicknames + call GetNick + call CopyName1 + ld hl, Text_WhatEvolving + call PrintText + + ld c, 50 + call DelayFrames + + xor a + ld [hBGMapMode], a + hlcoord 0, 0 + lb bc, 12, 20 + call ClearBox + + ld a, $1 + ld [hBGMapMode], a + call ClearSprites + + callba EvolutionAnimation + + push af + call ClearSprites + pop af + jp c, CancelEvolution + + ld hl, Text_CongratulationsYourPokemon + call PrintText + + pop hl + + ld a, [hl] + ld [CurSpecies], a + ld [TempMonSpecies], a + ld [Buffer2], a + ld [wd265], a + call GetPokemonName + + push hl + ld hl, Text_EvolvedIntoPKMN + call PrintTextBoxText + callba MobileFn_106094 + + ld de, MUSIC_NONE + call PlayMusic + ld de, SFX_CAUGHT_MON + call PlaySFX + call WaitSFX + + ld c, 40 + call DelayFrames + + call ClearTileMap + call UpdateSpeciesNameIfNotNicknamed + call GetBaseData + + ld hl, TempMonExp + 2 + ld de, TempMonMaxHP + ld b, $1 + predef CalcPkmnStats + + ld a, [CurPartyMon] + ld hl, PartyMons + ld bc, PARTYMON_STRUCT_LENGTH + call AddNTimes + ld e, l + ld d, h + ld bc, MON_MAXHP + add hl, bc + ld a, [hli] + ld b, a + ld c, [hl] + ld hl, TempMonMaxHP + 1 + ld a, [hld] + sub c + ld c, a + ld a, [hl] + sbc b + ld b, a + ld hl, TempMonHP + 1 + ld a, [hl] + add c + ld [hld], a + ld a, [hl] + adc b + ld [hl], a + + ld hl, TempMonSpecies + ld bc, PARTYMON_STRUCT_LENGTH + call CopyBytes + + ld a, [CurSpecies] + ld [wd265], a + xor a + ld [MonType], a + call LearnLevelMoves + ld a, [wd265] + dec a + call SetSeenAndCaughtMon + + ld a, [wd265] + cp UNOWN + jr nz, .skip_unown + + ld hl, TempMonDVs + predef GetUnownLetter + callab UpdateUnownDex + +.skip_unown + pop de + pop hl + ld a, [TempMonSpecies] + ld [hl], a + push hl + ld l, e + ld h, d + jp CheckForEvolvablePokemon +; 423f8 + +.dont_evolve_1 + inc hl +.dont_evolve_2 + inc hl +.dont_evolve_3 + inc hl + jp .loop +; 423fe + +; dummy pop + pop hl + +Evolution_ReturnToMap: ; 423ff + pop de + pop bc + pop hl + ld a, [wLinkMode] + and a + ret nz + ld a, [wBattleMode] + and a + ret nz + ld a, [wd268] + and a + call nz, RestartMapMusic + ret +; 42414 + +UpdateSpeciesNameIfNotNicknamed: ; 42414 + ld a, [CurSpecies] + push af + ld a, [BaseDexNo] + ld [wd265], a + call GetPokemonName + pop af + ld [CurSpecies], a + ld hl, StringBuffer1 + ld de, StringBuffer2 +.loop + ld a, [de] + inc de + cp [hl] + inc hl + ret nz + cp "@" + jr nz, .loop + + ld a, [CurPartyMon] + ld bc, PKMN_NAME_LENGTH + ld hl, PartyMonNicknames + call AddNTimes + push hl + ld a, [CurSpecies] + ld [wd265], a + call GetPokemonName + ld hl, StringBuffer1 + pop de + ld bc, PKMN_NAME_LENGTH + jp CopyBytes +; 42454 + +CancelEvolution: ; 42454 + ld hl, Text_StoppedEvolving + call PrintText + call ClearTileMap + pop hl + jp CheckForEvolvablePokemon +; 42461 + +IsMonHoldingEverstone: ; 42461 + push hl + ld a, [CurPartyMon] + ld hl, PartyMon1Item + ld bc, PARTYMON_STRUCT_LENGTH + call AddNTimes + ld a, [hl] + cp EVERSTONE + pop hl + ret +; 42473 + +Text_CongratulationsYourPokemon: ; 0x42473 + ; Congratulations! Your @ @ + text_jump UnknownText_0x1c4b92 + db "@" +; 0x42478 + +Text_EvolvedIntoPKMN: ; 0x42478 + ; evolved into @ ! + text_jump UnknownText_0x1c4baf + db "@" +; 0x4247d + +Text_StoppedEvolving: ; 0x4247d + ; Huh? @ stopped evolving! + text_jump UnknownText_0x1c4bc5 + db "@" +; 0x42482 + +Text_WhatEvolving: ; 0x42482 + ; What? @ is evolving! + text_jump UnknownText_0x1c4be3 + db "@" +; 0x42487 + + +LearnLevelMoves: ; 42487 + ld a, [wd265] + ld [CurPartySpecies], a + dec a + ld b, 0 + ld c, a + ld hl, EvosAttacksPointers +rept 2 + add hl, bc +endr + ld a, [hli] + ld h, [hl] + ld l, a + +.skip_evos + ld a, [hli] + and a + jr nz, .skip_evos + +.find_move + ld a, [hli] + and a + jr z, .done + + ld b, a + ld a, [CurPartyLevel] + cp b + ld a, [hli] + jr nz, .find_move + + push hl + ld d, a + ld hl, PartyMon1Moves + ld a, [CurPartyMon] + ld bc, PARTYMON_STRUCT_LENGTH + call AddNTimes + + ld b, NUM_MOVES +.check_move + ld a, [hli] + cp d + jr z, .has_move + dec b + jr nz, .check_move + jr .learn +.has_move + + pop hl + jr .find_move + +.learn + ld a, d + ld [wd262], a + ld [wd265], a + call GetMoveName + call CopyName1 + predef LearnMove + pop hl + jr .find_move + +.done + ld a, [CurPartySpecies] + ld [wd265], a + ret +; 424e1 + + +FillMoves: ; 424e1 +; Fill in moves at de for CurPartySpecies at CurPartyLevel + + push hl + push de + push bc + ld hl, EvosAttacksPointers + ld b, 0 + ld a, [CurPartySpecies] + dec a + add a + rl b + ld c, a + add hl, bc + ld a, [hli] + ld h, [hl] + ld l, a +.GoToAttacks + ld a, [hli] + and a + jr nz, .GoToAttacks + jr .GetLevel + +.NextMove + pop de +.GetMove + inc hl +.GetLevel + ld a, [hli] + and a + jp z, .done + ld b, a + ld a, [CurPartyLevel] + cp b + jp c, .done + ld a, [Buffer1] + and a + jr z, .CheckMove + ld a, [wd002] + cp b + jr nc, .GetMove + +.CheckMove + push de + ld c, NUM_MOVES +.CheckRepeat + ld a, [de] + inc de + cp [hl] + jr z, .NextMove + dec c + jr nz, .CheckRepeat + pop de + push de + ld c, NUM_MOVES +.CheckSlot + ld a, [de] + and a + jr z, .LearnMove + inc de + dec c + jr nz, .CheckSlot + pop de + push de + push hl + ld h, d + ld l, e + call ShiftMoves + ld a, [Buffer1] + and a + jr z, .ShiftedMove + push de + ld bc, PartyMon1PP - (PartyMon1Moves + NUM_MOVES - 1) + add hl, bc + ld d, h + ld e, l + call ShiftMoves + pop de + +.ShiftedMove + pop hl + +.LearnMove + ld a, [hl] + ld [de], a + ld a, [Buffer1] + and a + jr z, .NextMove + push hl + ld a, [hl] + ld hl, MON_PP - MON_MOVES + add hl, de + push hl + dec a + ld hl, Moves + MOVE_PP + ld bc, MOVE_LENGTH + call AddNTimes + ld a, BANK(Moves) + call GetFarByte + pop hl + ld [hl], a + pop hl + jr .NextMove + +.done + pop bc + pop de + pop hl + ret +; 4256e + +ShiftMoves: ; 4256e + ld c, NUM_MOVES - 1 +.loop + inc de + ld a, [de] + ld [hli], a + dec c + jr nz, .loop + ret +; 42577 + + +EvoFlagAction: ; 42577 + push de + ld d, $0 + predef FlagPredef + pop de + ret +; 42581 + +GetPreEvolution: ; 42581 +; Find the first mon to evolve into CurPartySpecies. + +; Return carry and the new species in CurPartySpecies +; if a pre-evolution is found. + + ld c, 0 +.loop ; For each Pokemon... + ld hl, EvosAttacksPointers + ld b, 0 +rept 2 + add hl, bc +endr + ld a, [hli] + ld h, [hl] + ld l, a +.loop2 ; For each evolution... + ld a, [hli] + and a + jr z, .no_evolve ; If we jump, this Pokemon does not evolve into CurPartySpecies. + cp EVOLVE_STAT ; This evolution type has the extra parameter of stat comparison. + jr nz, .not_tyrogue + inc hl + +.not_tyrogue + inc hl + ld a, [CurPartySpecies] + cp [hl] + jr z, .found_preevo + inc hl + ld a, [hl] + and a + jr nz, .loop2 + +.no_evolve + inc c + ld a, c + cp NUM_POKEMON + jr c, .loop + and a + ret + +.found_preevo + inc c + ld a, c + ld [CurPartySpecies], a + scf + ret +; 425b1 diff --git a/engine/link.asm b/engine/link.asm index afc4f2d2e..afdbd218a 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -1920,7 +1920,7 @@ Function28b87: ; 28b87 ld a, [PartyCount] dec a ld [CurPartyMon], a - callab Function421d8 + callab EvolvePokemon call ClearScreen call Function28ef8 call Function28eff diff --git a/engine/party_menu.asm b/engine/party_menu.asm index 4d50ee8e4..6b50ca620 100644 --- a/engine/party_menu.asm +++ b/engine/party_menu.asm @@ -839,92 +839,92 @@ YouHaveNoPKMNString: ; 0x50556 db "You have no !@" -Function50566: ; 50566 +PrintPartyMenuActionText: ; 50566 ld a, [CurPartyMon] ld hl, PartyMonNicknames call GetNick ld a, [PartyMenuActionText] and $f - ld hl, Unknown_5057b - call Function505c1 + ld hl, .MenuActionTexts + call .PrintText ret ; 5057b -Unknown_5057b: ; 5057b - dw UnknownText_0x50594 - dw UnknownText_0x5059e - dw UnknownText_0x505a3 - dw UnknownText_0x505a8 - dw UnknownText_0x50599 - dw UnknownText_0x5058f - dw UnknownText_0x505ad - dw UnknownText_0x505b2 - dw UnknownText_0x505b7 - dw UnknownText_0x505bc +.MenuActionTexts: ; 5057b + dw .Text_CuredOfPoison + dw .Text_BurnWasHealed + dw .Text_Defrosted + dw .Text_WokeUp + dw .Text_RidOfParalysis + dw .Text_RecoveredSomeHP + dw .Text_HealthReturned + dw .Text_Revitalized + dw .Text_GrewToLevel + dw .Text_CameToItsSenses ; 5058f -UnknownText_0x5058f: ; 0x5058f +.Text_RecoveredSomeHP: ; 0x5058f ; recovered @ HP! text_jump UnknownText_0x1bc0a2 db "@" ; 0x50594 -UnknownText_0x50594: ; 0x50594 +.Text_CuredOfPoison: ; 0x50594 ; 's cured of poison. text_jump UnknownText_0x1bc0bb db "@" ; 0x50599 -UnknownText_0x50599: ; 0x50599 +.Text_RidOfParalysis: ; 0x50599 ; 's rid of paralysis. text_jump UnknownText_0x1bc0d2 db "@" ; 0x5059e -UnknownText_0x5059e: ; 0x5059e +.Text_BurnWasHealed: ; 0x5059e ; 's burn was healed. text_jump UnknownText_0x1bc0ea db "@" ; 0x505a3 -UnknownText_0x505a3: ; 0x505a3 +.Text_Defrosted: ; 0x505a3 ; was defrosted. text_jump UnknownText_0x1bc101 db "@" ; 0x505a8 -UnknownText_0x505a8: ; 0x505a8 +.Text_WokeUp: ; 0x505a8 ; woke up. text_jump UnknownText_0x1bc115 db "@" ; 0x505ad -UnknownText_0x505ad: ; 0x505ad +.Text_HealthReturned: ; 0x505ad ; 's health returned. text_jump UnknownText_0x1bc123 db "@" ; 0x505b2 -UnknownText_0x505b2: ; 0x505b2 +.Text_Revitalized: ; 0x505b2 ; is revitalized. text_jump UnknownText_0x1bc13a db "@" ; 0x505b7 -UnknownText_0x505b7: ; 0x505b7 +.Text_GrewToLevel: ; 0x505b7 ; grew to level @ !@ @ text_jump UnknownText_0x1bc14f db "@" ; 0x505bc -UnknownText_0x505bc: ; 0x505bc +.Text_CameToItsSenses: ; 0x505bc ; came to its senses. text_jump UnknownText_0x1bc16e db "@" ; 0x505c1 -Function505c1: ; 505c1 +.PrintText: ; 505c1 ld e, a ld d, 0 rept 2 @@ -935,7 +935,7 @@ endr ld l, a ld a, [Options] push af - set 4, a + set NO_TEXT_SCROLL, a ld [Options], a call PrintText pop af diff --git a/engine/pokegear.asm b/engine/pokegear.asm index 424669b20..3954f5384 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -330,7 +330,7 @@ Function90e3f: ; 90e3f .kanto ld e, 1 .ok - callba Function91ae1 + callba PokegearMap ld a, $7 ld bc, $12 hlcoord 1, 2 @@ -1919,7 +1919,8 @@ endr .kanto jp LoadStation_PlacesAndPeople ; 91ae1 -Function91ae1: ; 91ae1 + +PokegearMap: ; 91ae1 ld a, e and a jr nz, .kanto diff --git a/engine/predef.asm b/engine/predef.asm index cb72f9202..213cfc352 100644 --- a/engine/predef.asm +++ b/engine/predef.asm @@ -58,7 +58,7 @@ PredefPointers:: ; 856b add_predef GetMonFrontpic add_predef LearnLevelMoves add_predef FillMoves - add_predef Function421e6 + add_predef EvolveAfterBattle add_predef Function28f63 add_predef Function28f24 add_predef CopyPkmnToTempMon @@ -97,7 +97,7 @@ PredefPointers:: ; 856b add_predef DecompressPredef ; $40 add_predef CheckTypeMatchup add_predef ConvertMon_1to2 - add_predef Functionfb877 + add_predef NewPokedexEntry add_predef AnimateMon_Slow_Normal add_predef PlaceStatusString add_predef LoadMonAnimation diff --git a/engine/specials.asm b/engine/specials.asm index 68ad47aa4..29c4da492 100644 --- a/engine/specials.asm +++ b/engine/specials.asm @@ -215,7 +215,7 @@ Special_GameCornerPrizeMonCheckDex: ; c230 call FadeToMenu ld a, [ScriptVar] ld [wd265], a - callba Functionfb877 + callba NewPokedexEntry call ExitAllMenus ret ; c252 diff --git a/engine/startmenu.asm b/engine/startmenu.asm index 41c79478f..290e6d6ea 100755 --- a/engine/startmenu.asm +++ b/engine/startmenu.asm @@ -664,7 +664,7 @@ UnknownText_0x12a5b: ; 0x12a5b CantUseItem: ; 12a60 ld hl, CantUseItemText - call Function2012 + call MenuTextBoxWaitButton ret ; 12a67 @@ -1241,14 +1241,14 @@ OpenPartyStats: ; 12e00 MonMenu_Cut: ; 12e1b callba CutFunction - ld a, [wd0ec] + ld a, [wFieldMoveSucceeded] cp $1 - jr nz, .asm_12e2d + jr nz, .Fail ld b, $4 ld a, $2 ret -.asm_12e2d +.Fail ld a, $3 ret ; 12e30 @@ -1256,160 +1256,161 @@ MonMenu_Cut: ; 12e1b MonMenu_Fly: ; 12e30 callba FlyFunction - ld a, [wd0ec] + ld a, [wFieldMoveSucceeded] cp $2 - jr z, .asm_12e4c + jr z, .Fail cp $0 - jr z, .asm_12e4f + jr z, .Error callba MobileFn_1060b5 ld b, $4 ld a, $2 ret -.asm_12e4c +.Fail ld a, $3 ret -.asm_12e4f +.Error ld a, $0 ret -.asm_12e52 +.Unused ld a, $1 ret ; 12e55 MonMenu_Flash: ; 12e55 callba Functionc8ac - ld a, [wd0ec] + ld a, [wFieldMoveSucceeded] cp $1 - jr nz, .asm_12e67 + jr nz, .Fail ld b, $4 ld a, $2 ret -.asm_12e67 +.Fail ld a, $3 ret ; 12e6a MonMenu_Strength: ; 12e6a callba StrengthFunction - ld a, [wd0ec] + ld a, [wFieldMoveSucceeded] cp $1 - jr nz, .asm_12e7c + jr nz, .Fail ld b, $4 ld a, $2 ret -.asm_12e7c +.Fail ld a, $3 ret ; 12e7f MonMenu_Whirlpool: ; 12e7f callba WhirlpoolFunction - ld a, [wd0ec] + ld a, [wFieldMoveSucceeded] cp $1 - jr nz, .asm_12e91 + jr nz, .Fail ld b, $4 ld a, $2 ret -.asm_12e91 +.Fail ld a, $3 ret ; 12e94 MonMenu_Waterfall: ; 12e94 callba Functioncade - ld a, [wd0ec] + ld a, [wFieldMoveSucceeded] cp $1 - jr nz, .asm_12ea6 + jr nz, .Fail ld b, $4 ld a, $2 ret -.asm_12ea6 +.Fail ld a, $3 ret ; 12ea9 MonMenu_Teleport: ; 12ea9 callba TeleportFunction - ld a, [wd0ec] + ld a, [wFieldMoveSucceeded] and a - jr z, .asm_12eba + jr z, .Fail ld b, $4 ld a, $2 ret -.asm_12eba +.Fail ld a, $3 ret ; 12ebd MonMenu_Surf: ; 12ebd callba SurfFunction - ld a, [wd0ec] + ld a, [wFieldMoveSucceeded] and a - jr z, .asm_12ece + jr z, .Fail ld b, $4 ld a, $2 ret -.asm_12ece +.Fail ld a, $3 ret ; 12ed1 MonMenu_Dig: ; 12ed1 callba DigFunction - ld a, [wd0ec] + ld a, [wFieldMoveSucceeded] cp $1 - jr nz, .asm_12ee3 + jr nz, .Fail ld b, $4 ld a, $2 ret -.asm_12ee3 +.Fail ld a, $3 ret ; 12ee6 MonMenu_Softboiled_MilkDrink: ; 12ee6 - call Function12f05 - jr nc, .asm_12ef3 - callba Functionf3df - jr .asm_12ef9 + call .CheckMonHasEnoughHP + jr nc, .NotEnoughHP + callba Softboiled_MilkDrinkFunction + jr .finish -.asm_12ef3 - ld hl, UnknownText_0x12f00 +.NotEnoughHP + ld hl, .Text_NotEnoughHP call PrintText -.asm_12ef9 +.finish xor a ld [PartyMenuActionText], a ld a, $3 ret ; 12f00 -UnknownText_0x12f00: ; 0x12f00 +.Text_NotEnoughHP: ; 0x12f00 ; Not enough HP! text_jump UnknownText_0x1c1ce3 db "@" ; 0x12f05 -Function12f05: ; 12f05 +.CheckMonHasEnoughHP: ; 12f05 +; Need to have at least (MaxHP / 5) HP left. ld a, MON_MAXHP call GetPartyParamLocation ld a, [hli] ld [hDividend + 0], a ld a, [hl] ld [hDividend + 1], a - ld a, $5 + ld a, 5 ld [hDivisor], a - ld b, $2 + ld b, 2 call Divide ld a, MON_HP + 1 call GetPartyParamLocation @@ -1423,28 +1424,28 @@ Function12f05: ; 12f05 MonMenu_Headbutt: ; 12f26 callba HeadbuttFunction - ld a, [wd0ec] + ld a, [wFieldMoveSucceeded] cp $1 - jr nz, .asm_12f38 + jr nz, .Fail ld b, $4 ld a, $2 ret -.asm_12f38 +.Fail ld a, $3 ret ; 12f3b MonMenu_RockSmash: ; 12f3b callba RockSmashFunction - ld a, [wd0ec] + ld a, [wFieldMoveSucceeded] cp $1 - jr nz, .asm_12f4d + jr nz, .Fail ld b, $4 ld a, $2 ret -.asm_12f4d +.Fail ld a, $3 ret ; 12f50 diff --git a/engine/town_map.asm b/engine/town_map.asm index a2f93119a..c821e793a 100755 --- a/engine/town_map.asm +++ b/engine/town_map.asm @@ -147,7 +147,7 @@ Function91a04: ; 91a04 ld e, $1 .okay - callba Function91ae1 + callba PokegearMap ld a, $7 ld bc, 6 hlcoord 1, 0 diff --git a/home/menu.asm b/home/menu.asm index bf6427151..64f7e4d8c 100644 --- a/home/menu.asm +++ b/home/menu.asm @@ -546,7 +546,7 @@ PlayClickSFX:: ; 2009 ret ; 0x2012 -Function2012:: ; 2012 +MenuTextBoxWaitButton:: ; 2012 call MenuTextBox call CloseText call ExitMenu diff --git a/home/text.asm b/home/text.asm index d400ddd66..dffe686c4 100644 --- a/home/text.asm +++ b/home/text.asm @@ -714,7 +714,7 @@ FarString:: ; 13d4 ret ; 13e0 -Function13e0:: ; 13e0 +PokeFluteTerminatorCharacter:: ; 13e0 ld hl, .stop ret diff --git a/items/item_effects.asm b/items/item_effects.asm index 2b12b587e..9fc3c844f 100644 --- a/items/item_effects.asm +++ b/items/item_effects.asm @@ -228,7 +228,7 @@ ParkBall: ; e8a2 ld [wWildMon], a ld a, [CurItem] cp PARK_BALL - call nz, Functionedfa + call nz, ReturnToBattle_UseBall ld hl, Options res NO_TEXT_SCROLL, [hl] @@ -421,16 +421,16 @@ endr jr nz, .caught ld a, [Buffer2] cp $1 - ld hl, UnknownText_0xedb5 + ld hl, Text_NoShake jp z, .shake_and_break_free cp $2 - ld hl, UnknownText_0xedba + ld hl, Text_OneShake jp z, .shake_and_break_free cp $3 - ld hl, UnknownText_0xedbf + ld hl, Text_TwoShakes jp z, .shake_and_break_free cp $4 - ld hl, UnknownText_0xedc4 + ld hl, Text_ThreeShakes jp z, .shake_and_break_free .caught @@ -535,14 +535,14 @@ endr call CheckReceivedDex jr z, .skip_pokedex - ld hl, UnknownText_0xedf0 + ld hl, Text_AddedToPokedex call PrintText call ClearSprites ld a, [EnemyMonSpecies] ld [wd265], a - predef Functionfb877 + predef NewPokedexEntry .skip_pokedex ld a, [BattleType] @@ -564,7 +564,7 @@ endr predef TryAddMonToParty - callba Function4db49 + callba SetCaughtData ld a, [CurItem] cp FRIEND_BALL @@ -580,7 +580,7 @@ endr ld [hl], a .SkipPartyMonFriendBall - ld hl, UnknownText_0xedf5 + ld hl, Text_AskNicknameNewlyCaughtMon call PrintText ld a, [CurPartySpecies] @@ -620,7 +620,7 @@ endr predef SentPkmnIntoBox - callba Function4db83 + callba SetBoxMonCaughtData ld a, BANK(sBoxCount) call GetSRAMBank @@ -640,7 +640,7 @@ endr .SkipBoxMonFriendBall call CloseSRAM - ld hl, UnknownText_0xedf5 + ld hl, Text_AskNicknameNewlyCaughtMon call PrintText ld a, [CurPartySpecies] @@ -683,7 +683,7 @@ endr call CloseSRAM - ld hl, UnknownText_0xedeb + ld hl, Text_SentToBillsPC call PrintText call FadeToWhite @@ -1092,37 +1092,40 @@ LevelBallMultiplier: ld b, $ff ret -UnknownText_0xedab: ; 0xedab +; These two texts were carried over from gen 1. +; They are not used in gen 2, and are dummied out. + +Text_RBY_CatchMarowak: ; 0xedab ; It dodged the thrown BALL! This #MON can't be caught! text_jump UnknownText_0x1c5a5a db "@" ; 0xedb0 -UnknownText_0xedb0: ; 0xedb0 +Text_RBY_NoShake: ; 0xedb0 ; You missed the #MON! text_jump UnknownText_0x1c5a90 db "@" ; 0xedb5 -UnknownText_0xedb5: ; 0xedb5 +Text_NoShake: ; 0xedb5 ; Oh no! The #MON broke free! text_jump UnknownText_0x1c5aa6 db "@" ; 0xedba -UnknownText_0xedba: ; 0xedba +Text_OneShake: ; 0xedba ; Aww! It appeared to be caught! text_jump UnknownText_0x1c5ac3 db "@" ; 0xedbf -UnknownText_0xedbf: ; 0xedbf +Text_TwoShakes: ; 0xedbf ; Aargh! Almost had it! text_jump UnknownText_0x1c5ae3 db "@" ; 0xedc4 -UnknownText_0xedc4: ; 0xedc4 +Text_ThreeShakes: ; 0xedc4 ; Shoot! It was so close too! text_jump UnknownText_0x1c5afa db "@" @@ -1132,9 +1135,6 @@ Text_GotchaMonWasCaught: ; 0xedc9 ; Gotcha! @ was caught!@ @ text_jump UnknownText_0x1c5b17 start_asm -; 0xedce - -Functionedce: ; edce call WaitSFX push bc ld de, MUSIC_NONE @@ -1153,30 +1153,30 @@ TextJump_Waitbutton: ; 0xede6 db "@" ; 0xedeb -UnknownText_0xedeb: ; 0xedeb +Text_SentToBillsPC: ; 0xedeb ; was sent to BILL's PC. text_jump UnknownText_0x1c5b38 db "@" ; 0xedf0 -UnknownText_0xedf0: ; 0xedf0 +Text_AddedToPokedex: ; 0xedf0 ; 's data was newly added to the #DEX.@ @ text_jump UnknownText_0x1c5b53 db "@" ; 0xedf5 -UnknownText_0xedf5: ; 0xedf5 +Text_AskNicknameNewlyCaughtMon: ; 0xedf5 ; Give a nickname to @ ? text_jump UnknownText_0x1c5b7f db "@" ; 0xedfa -Functionedfa: ; edfa (3:6dfa) - callba Function2715c +ReturnToBattle_UseBall: ; edfa (3:6dfa) + callba _ReturnToBattle_UseBall ret TownMap: ; ee01 - callba Function91ae1 + callba PokegearMap ret ; ee08 @@ -1196,29 +1196,29 @@ SunStone: ; ee0f ld b, PARTYMENUACTION_EVO_STONE call UseItem_SelectMon - jp c, .asm_ee38 + jp c, .DecidedNotToUse ld a, MON_ITEM call GetPartyParamLocation ld a, [hl] cp EVERSTONE - jr z, .asm_ee35 + jr z, .NoEffect ld a, $1 ld [wd1e9], a - callba Function421d8 + callba EvolvePokemon ld a, [wd268] and a - jr z, .asm_ee35 + jr z, .NoEffect jp UseDisposableItem -.asm_ee35 +.NoEffect call WontHaveAnyEffectMessage -.asm_ee38 +.DecidedNotToUse xor a ld [wd0ec], a ret @@ -1233,11 +1233,11 @@ Calcium: ; ee3d ld b, PARTYMENUACTION_HEALING_ITEM call UseItem_SelectMon - jp c, Functionee9f + jp c, RareCandy_StatBooster_ExitMenu - call Functioneef5 + call RareCandy_StatBooster_GetParameters - call Functioneed9 + call GetStatExpRelativePointer ld a, MON_STAT_EXP call GetPartyParamLocation @@ -1245,15 +1245,15 @@ Calcium: ; ee3d add hl, bc ld a, [hl] cp 100 - jr nc, Functionee83 + jr nc, NoEffectMessage add 10 ld [hl], a - call Functionee8c + call UpdateStatsAfterItem - call Functioneed9 + call GetStatExpRelativePointer - ld hl, Strings_eeab + ld hl, StatStrings add hl, bc ld a, [hli] ld h, [hl] @@ -1264,7 +1264,7 @@ Calcium: ; ee3d call Play_SFX_FULL_HEAL - ld hl, UnknownText_0xeea6 + ld hl, Text_StatRose call PrintText ld c, HAPPINESS_USEDITEM @@ -1273,14 +1273,14 @@ Calcium: ; ee3d jp UseDisposableItem -Functionee83: ; ee83 +NoEffectMessage: ; ee83 ld hl, WontHaveAnyEffectText call PrintText jp ClearPalettes ; ee8c -Functionee8c: ; ee8c +UpdateStatsAfterItem: ; ee8c ld a, MON_MAXHP call GetPartyParamLocation ld d, h @@ -1291,21 +1291,21 @@ Functionee8c: ; ee8c predef_jump CalcPkmnStats ; ee9f -Functionee9f: ; ee9f +RareCandy_StatBooster_ExitMenu: ; ee9f xor a ld [wd0ec], a jp ClearPalettes ; eea6 -UnknownText_0xeea6: ; 0xeea6 +Text_StatRose: ; 0xeea6 ; 's @ rose. text_jump UnknownText_0x1c5b9a db "@" ; 0xeeab -Strings_eeab: ; eeab +StatStrings: ; eeab dw .health dw .attack dw .defense @@ -1320,17 +1320,17 @@ Strings_eeab: ; eeab ; eed9 -Functioneed9: ; eed9 +GetStatExpRelativePointer: ; eed9 ld a, [CurItem] ld hl, Table_eeeb .next cp [hl] inc hl - jr z, .asm_eee6 + jr z, .got_it inc hl jr .next -.asm_eee6 +.got_it ld a, [hl] ld c, a ld b, 0 @@ -1346,7 +1346,7 @@ Table_eeeb: ; eeeb ; eef5 -Functioneef5: ; eef5 +RareCandy_StatBooster_GetParameters: ; eef5 ld a, [CurPartySpecies] ld [CurSpecies], a ld [wd265], a @@ -1366,16 +1366,16 @@ RareCandy: ; ef14 ld b, PARTYMENUACTION_HEALING_ITEM call UseItem_SelectMon - jp c, Functionee9f + jp c, RareCandy_StatBooster_ExitMenu - call Functioneef5 + call RareCandy_StatBooster_GetParameters ld a, MON_LEVEL call GetPartyParamLocation ld a, [hl] cp MAX_LEVEL - jp nc, Functionee83 + jp nc, NoEffectMessage inc a ld [hl], a @@ -1390,9 +1390,9 @@ RareCandy: ; ef14 ld a, [hMultiplicand] ld [hli], a - ld a, [$ffb5] + ld a, [hMultiplicand + 1] ld [hli], a - ld a, [$ffb6] + ld a, [hMultiplicand + 2] ld [hl], a ld a, MON_MAXHP @@ -1401,7 +1401,7 @@ RareCandy: ; ef14 ld b, a ld c, [hl] push bc - call Functionee8c + call UpdateStatsAfterItem ld a, MON_MAXHP + 1 call GetPartyParamLocation @@ -1423,7 +1423,7 @@ RareCandy: ; ef14 callba LevelUpHappinessMod ld a, PARTYMENUTEXT_LEVEL_UP - call Functionf24a + call ItemActionText xor a ; PARTYMON ld [MonType], a @@ -1448,7 +1448,7 @@ RareCandy: ; ef14 xor a ld [wd1e9], a - callba Function421d8 + callba EvolvePokemon jp UseDisposableItem ; efad @@ -1458,9 +1458,9 @@ HealPowder: ; efad ld b, PARTYMENUACTION_HEALING_ITEM call UseItem_SelectMon - jp c, Functionf29e + jp c, StatusHealer_ExitMenu - call Functionefda + call UseStatusHealer cp $0 jr nz, .asm_efc9 @@ -1472,7 +1472,7 @@ HealPowder: ; efad ld a, $0 .asm_efc9 - jp Functionf09e + jp StatusHealer_Jumptable ; efcc @@ -1490,16 +1490,16 @@ MintBerry: Miracleberry: ; efcc ld b, PARTYMENUACTION_HEALING_ITEM call UseItem_SelectMon - jp c, Functionf29e + jp c, StatusHealer_ExitMenu -Functionefd4: ; efd4 - call Functionefda - jp Functionf09e +FullyHealStatus: ; efd4 + call UseStatusHealer + jp StatusHealer_Jumptable ; efda -Functionefda: ; efda (3:6fda) - call Functionf30d +UseStatusHealer: ; efda (3:6fda) + call IsMonFainted ld a, $1 ret z call GetItemHealingAction @@ -1508,7 +1508,7 @@ Functionefda: ; efda (3:6fda) ld a, [hl] and c jr nz, .good - call Functionf009 + call IsItemUsedOnConfusedMon ld a, $1 ret nc ld b, PARTYMENUTEXT_HEAL_CONFUSION @@ -1519,13 +1519,13 @@ Functionefda: ; efda (3:6fda) ld [PartyMenuActionText], a call HealStatus call Play_SFX_FULL_HEAL - call Functionf279 + call ItemActionTextWaitButton call UseDisposableItem ld a, $0 ret -Functionf009: ; f009 (3:7009) - call Functionf2a6 +IsItemUsedOnConfusedMon: ; f009 (3:7009) + call IsItemUsedOnBattleMon jr nc, .nope ld a, [PlayerSubStatus3] bit SUBSTATUS_CONFUSED, a @@ -1535,12 +1535,13 @@ Functionf009: ; f009 (3:7009) jr nz, .nope scf ret + .nope and a ret -Functionf01e: ; f01e (3:701e) - call Functionf2a6 +BattlemonRestoreHealth: ; f01e (3:701e) + call IsItemUsedOnBattleMon ret nc ld a, MON_HP call GetPartyParamLocation @@ -1551,7 +1552,7 @@ Functionf01e: ; f01e (3:701e) ret HealStatus: ; f030 (3:7030) - call Functionf2a6 + call IsItemUsedOnBattleMon ret nc xor a ld [BattleMonStatus], a @@ -1612,23 +1613,23 @@ GetItemHealingAction: ; f058 (3:7058) db -1, 0, 0 ; f09e -Functionf09e: ; f09e (3:709e) +StatusHealer_Jumptable: ; f09e (3:709e) ld hl, .jumptable rst JumpTable ret .jumptable: ; f0a3 (3:70a3) - dw Functionf2a2 - dw Functionf299 - dw Functionf29e + dw StatusHealer_ClearPalettes + dw StatusHealer_NoEffect + dw StatusHealer_ExitMenu RevivalHerb: ; f0a9 ld b, PARTYMENUACTION_HEALING_ITEM call UseItem_SelectMon - jp c, Functionf29e + jp c, StatusHealer_ExitMenu - call Functionf0d6 + call RevivePokemon cp 0 jr nz, .asm_f0c5 @@ -1638,7 +1639,7 @@ RevivalHerb: ; f0a9 ld a, 0 .asm_f0c5 - jp Functionf09e + jp StatusHealer_Jumptable ; f0c8 @@ -1646,20 +1647,20 @@ Revive: MaxRevive: ; f0c8 ld b, PARTYMENUACTION_HEALING_ITEM call UseItem_SelectMon - jp c, Functionf29e + jp c, StatusHealer_ExitMenu - call Functionf0d6 - jp Functionf09e + call RevivePokemon + jp StatusHealer_Jumptable ; f0d6 -Functionf0d6: ; f0d6 - call Functionf30d +RevivePokemon: ; f0d6 + call IsMonFainted ld a, 1 ret nz ld a, [wBattleMode] and a - jr z, .asm_f104 + jr z, .skip_to_revive ld a, [CurPartyMon] ld c, a @@ -1669,7 +1670,7 @@ Functionf0d6: ; f0d6 predef FlagPredef ld a, c and a - jr z, .asm_f104 + jr z, .skip_to_revive ld a, [CurPartyMon] ld c, a @@ -1677,24 +1678,24 @@ Functionf0d6: ; f0d6 ld b, SET_FLAG predef FlagPredef -.asm_f104 +.skip_to_revive xor a ld [Danger], a ld a, [CurItem] cp REVIVE - jr z, .asm_f114 + jr z, .revive_half_hp - call Functionf2c3 - jr .asm_f117 + call ReviveFullHP + jr .finish_revive -.asm_f114 - call Functionf2ba +.revive_half_hp + call ReviveHalfHP -.asm_f117 - call Functionf1db +.finish_revive + call HealHP_SFX_GFX ld a, PARTYMENUTEXT_REVIVE ld [PartyMenuActionText], a - call Functionf279 + call ItemActionTextWaitButton call UseDisposableItem ld a, 0 ret @@ -1704,37 +1705,37 @@ Functionf0d6: ; f0d6 FullRestore: ; f128 ld b, PARTYMENUACTION_HEALING_ITEM call UseItem_SelectMon - jp c, Functionf29e + jp c, StatusHealer_ExitMenu - call Functionf30d - jp z, Functionf299 + call IsMonFainted + jp z, StatusHealer_NoEffect - call Functionf31b - jr c, .asm_f13e + call IsMonAtFullHealth + jr c, .NotAtFullHealth - jp Functionefd4 + jp FullyHealStatus -.asm_f13e - call Functionf144 - jp Functionf09e +.NotAtFullHealth + call .FullRestore + jp StatusHealer_Jumptable ; f144 -Functionf144: ; f144 +.FullRestore: ; f144 xor a ld [Danger], a - call Functionf2c3 + call ReviveFullHP ld a, MON_STATUS call GetPartyParamLocation xor a ld [hli], a ld [hl], a call HealStatus - call Functionf01e - call Functionf1db + call BattlemonRestoreHealth + call HealHP_SFX_GFX ld a, PARTYMENUTEXT_HEAL_HP ld [PartyMenuActionText], a - call Functionf279 + call ItemActionTextWaitButton call UseDisposableItem ld a, 0 ret @@ -1750,7 +1751,7 @@ BitterBerry: ; f16a res SUBSTATUS_CONFUSED, [hl] xor a ld [hBattleTurn], a - call Functionf789 + call UseItemText ld hl, ConfusedNoMoreText call StdBattleTextBox @@ -1758,7 +1759,7 @@ BitterBerry: ; f16a ld a, 0 .done - jp Functionf09e + jp StatusHealer_Jumptable ; f186 @@ -1774,64 +1775,64 @@ Ragecandybar: BerryJuice: Berry: GoldBerry: ; f186 - call Functionf1a9 - jp Functionf09e + call ItemRestoreHP + jp StatusHealer_Jumptable ; f18c Energypowder: ; f18c ld c, HAPPINESS_BITTERPOWDER - jr Functionf192 + jr EnergypowderEnergyRootCommon ; f190 EnergyRoot: ; f190 ld c, HAPPINESS_ENERGYROOT ; f192 -Functionf192: ; f192 +EnergypowderEnergyRootCommon: ; f192 push bc - call Functionf1a9 + call ItemRestoreHP pop bc cp 0 - jr nz, .asm_f1a6 + jr nz, .skip_happiness callba ChangeHappiness call LooksBitterMessage ld a, 0 -.asm_f1a6 - jp Functionf09e +.skip_happiness + jp StatusHealer_Jumptable ; f1a9 -Functionf1a9: ; f1a9 (3:71a9) +ItemRestoreHP: ; f1a9 (3:71a9) ld b, PARTYMENUACTION_HEALING_ITEM call UseItem_SelectMon ld a, 2 ret c - call Functionf30d + call IsMonFainted ld a, 1 ret z - call Functionf31b + call IsMonAtFullHealth ld a, 1 ret nc xor a ld [Danger], a - call Functionf395 - call Functionf2d1 - call Functionf01e - call Functionf1db + call GetHealingItemAmount + call RestoreHealth + call BattlemonRestoreHealth + call HealHP_SFX_GFX ld a, PARTYMENUTEXT_HEAL_HP ld [PartyMenuActionText], a - call Functionf279 + call ItemActionTextWaitButton call UseDisposableItem ld a, 0 ret -Functionf1db: ; f1db (3:71db) +HealHP_SFX_GFX: ; f1db (3:71db) push de ld de, SFX_POTION call WaitPlaySFX @@ -1867,13 +1868,13 @@ UseItem_SelectMon: ; f1f9 (3:71f9) push de push bc call ClearBGPalettes - call Functionf21c + call ChoosePkmnToUseItemOn pop bc pop de pop hl ret -Functionf21c: ; f21c (3:721c) +ChoosePkmnToUseItemOn: ; f21c (3:721c) callba Function5004f callba Function50405 callba Function503e0 @@ -1885,7 +1886,7 @@ Functionf21c: ; f21c (3:721c) callba PartyMenuSelect ret -Functionf24a: ; f24a (3:724a) +ItemActionText: ; f24a (3:724a) ld [PartyMenuActionText], a ld a, [CurPartySpecies] push af @@ -1895,7 +1896,7 @@ Functionf24a: ; f24a (3:724a) push de push bc callba WritePartyMenuTilemap - callba Function50566 + callba PrintPartyMenuActionText call WaitBGMap call SetPalettes call DelayFrame @@ -1908,7 +1909,7 @@ Functionf24a: ; f24a (3:724a) ld [CurPartySpecies], a ret -Functionf279: ; f279 (3:7279) +ItemActionTextWaitButton: ; f279 (3:7279) xor a ld [hBGMapMode], a hlcoord 0, 0 @@ -1916,26 +1917,25 @@ Functionf279: ; f279 (3:7279) ld a, " " call ByteFill ld a, [PartyMenuActionText] - call Functionf24a + call ItemActionText ld a, $1 ld [hBGMapMode], a - ld c, $32 + ld c, 50 call DelayFrames jp WaitPressAorB_BlinkCursor -Functionf299: ; f299 (3:7299) +StatusHealer_NoEffect: ; f299 (3:7299) call WontHaveAnyEffectMessage - jr Functionf2a2 + jr StatusHealer_ClearPalettes -Functionf29e: ; f29e (3:729e) +StatusHealer_ExitMenu: ; f29e (3:729e) xor a ld [wd0ec], a - -Functionf2a2: ; f2a2 (3:72a2) +StatusHealer_ClearPalettes: ; f2a2 (3:72a2) call ClearPalettes ret -Functionf2a6: ; f2a6 (3:72a6) +IsItemUsedOnBattleMon: ; f2a6 (3:72a6) ld a, [wBattleMode] and a ret z @@ -1944,30 +1944,31 @@ Functionf2a6: ; f2a6 (3:72a6) ld hl, CurBattleMon cp [hl] pop hl - jr nz, .asm_f2b8 + jr nz, .nope scf ret -.asm_f2b8 + +.nope xor a ret -Functionf2ba: ; f2ba (3:72ba) - call Functionf36f +ReviveHalfHP: ; f2ba (3:72ba) + call LoadHPFromBuffer1 srl d rr e - jr asm_f2c6 + jr ContinueRevive -Functionf2c3: ; f2c3 (3:72c3) - call Functionf36f -asm_f2c6: ; f2c6 (3:72c6) +ReviveFullHP: ; f2c3 (3:72c3) + call LoadHPFromBuffer1 +ContinueRevive: ; f2c6 (3:72c6) ld a, MON_HP call GetPartyParamLocation ld [hl], d inc hl ld [hl], e - jp Functionf328 + jp LoadCurHPIntoBuffer5 -Functionf2d1: ; f2d1 (3:72d1) +RestoreHealth: ; f2d1 (3:72d1) ld a, MON_HP + 1 call GetPartyParamLocation ld a, [hl] @@ -1976,8 +1977,8 @@ Functionf2d1: ; f2d1 (3:72d1) ld a, [hl] adc d ld [hl], a - jr c, .asm_f2f5 - call Functionf328 + jr c, .full_hp + call LoadCurHPIntoBuffer5 ld a, MON_HP + 1 call GetPartyParamLocation ld d, h @@ -1990,13 +1991,13 @@ Functionf2d1: ; f2d1 (3:72d1) dec hl ld a, [de] sbc [hl] - jr c, .asm_f2f8 -.asm_f2f5 - call Functionf2c3 -.asm_f2f8 + jr c, .finish +.full_hp + call ReviveFullHP +.finish ret -Functionf2f9: ; f2f9 (3:72f9) +RemoveHP: ; f2f9 (3:72f9) ld a, MON_HP + 1 call GetPartyParamLocation ld a, [hl] @@ -2005,78 +2006,78 @@ Functionf2f9: ; f2f9 (3:72f9) ld a, [hl] sbc d ld [hl], a - jr nc, .asm_f309 + jr nc, .okay xor a ld [hld], a ld [hl], a -.asm_f309 - call Functionf328 +.okay + call LoadCurHPIntoBuffer5 ret -Functionf30d: ; f30d (3:730d) +IsMonFainted: ; f30d (3:730d) push de - call Functionf35f - call Functionf348 - call Functionf356 + call LoadMaxHPToBuffer1 + call LoadCurHPToBuffer3 + call LoadHPFromBuffer3 ld a, d or e pop de ret -Functionf31b: ; f31b (3:731b) - call Functionf356 +IsMonAtFullHealth: ; f31b (3:731b) + call LoadHPFromBuffer3 ld h, d ld l, e - call Functionf36f + call LoadHPFromBuffer1 ld a, l sub e ld a, h sbc d ret -Functionf328: ; f328 (3:7328) +LoadCurHPIntoBuffer5: ; f328 (3:7328) ld a, MON_HP call GetPartyParamLocation ld a, [hli] - ld [wd1ef], a + ld [Buffer6], a ld a, [hl] - ld [wd1ee], a + ld [Buffer5], a ret ; f336 (3:7336) -Functionf336: ; f336 +LoadHPIntoBuffer5: ; f336 ld a, d - ld [wd1ef], a + ld [Buffer6], a ld a, e - ld [wd1ee], a + ld [Buffer5], a ret ; f33f -Functionf33f: ; f33f - ld a, [wd1ef] +LoadHPFromBuffer5: ; f33f + ld a, [Buffer6] ld d, a - ld a, [wd1ee] + ld a, [Buffer5] ld e, a ret ; f348 -Functionf348: ; f348 (3:7348) +LoadCurHPToBuffer3: ; f348 (3:7348) ld a, MON_HP call GetPartyParamLocation ld a, [hli] - ld [wd1ed], a + ld [Buffer4], a ld a, [hl] - ld [wd1ec], a + ld [Buffer3], a ret -Functionf356: ; f356 (3:7356) - ld a, [wd1ed] +LoadHPFromBuffer3: ; f356 (3:7356) + ld a, [Buffer4] ld d, a - ld a, [wd1ec] + ld a, [Buffer3] ld e, a ret -Functionf35f: ; f35f (3:735f) +LoadMaxHPToBuffer1: ; f35f (3:735f) push hl ld a, MON_MAXHP call GetPartyParamLocation @@ -2087,14 +2088,14 @@ Functionf35f: ; f35f (3:735f) pop hl ret -Functionf36f: ; f36f (3:736f) +LoadHPFromBuffer1: ; f36f (3:736f) ld a, [Buffer2] ld d, a ld a, [Buffer1] ld e, a ret -Functionf378: ; f378 (3:7378) +GetOneFifthMaxHP: ; f378 (3:7378) push bc ld a, MON_MAXHP call GetPartyParamLocation @@ -2113,15 +2114,15 @@ Functionf378: ; f378 (3:7378) pop bc ret -Functionf395: ; f395 (3:7395) +GetHealingItemAmount: ; f395 (3:7395) push hl ld a, [CurItem] - ld hl, Tablef3af + ld hl, .Healing ld d, a .next ld a, [hli] cp -1 - jr z, .asm_f3a9 + jr z, .NotFound cp d jr z, .done rept 2 @@ -2129,7 +2130,7 @@ rept 2 endr jr .next -.asm_f3a9 +.NotFound scf .done ld e, [hl] @@ -2139,7 +2140,7 @@ endr ret ; f3af (3:73af) -Tablef3af: ; f3af +.Healing: ; f3af dbw FRESH_WATER, 50 dbw SODA_POP, 60 dbw LEMONADE, 80 @@ -2158,42 +2159,42 @@ Tablef3af: ; f3af dbw -1, 0 ; f3df -Functionf3df: ; f3df (3:73df) +Softboiled_MilkDrinkFunction: ; f3df (3:73df) ; Softboiled/Milk Drink in the field ld a, [wd0d8] dec a ld b, a - call Functionf419 - jr c, .asm_f413 + call .SelectMilkDrinkRecipient ; select pokemon + jr c, .skip ld a, b ld [CurPartyMon], a - call Functionf30d - call Functionf378 - call Functionf2f9 + call IsMonFainted + call GetOneFifthMaxHP + call RemoveHP push bc - call Functionf1db + call HealHP_SFX_GFX pop bc - call Functionf378 + call GetOneFifthMaxHP ld a, c ld [CurPartyMon], a - call Functionf30d - call Functionf2d1 - call Functionf1db + call IsMonFainted + call RestoreHealth + call HealHP_SFX_GFX ld a, PARTYMENUTEXT_HEAL_HP - call Functionf24a + call ItemActionText call JoyWaitAorB -.asm_f413 +.skip ld a, b inc a ld [wd0d8], a ret -Functionf419: ; f419 (3:7419) +.SelectMilkDrinkRecipient: ; f419 (3:7419) .loop push bc ld a, PARTYMENUACTION_HEALING_ITEM ld [PartyMenuActionText], a - call Functionf21c + call ChoosePkmnToUseItemOn pop bc jr c, .set_carry ld a, [wd0d8] @@ -2201,13 +2202,13 @@ Functionf419: ; f419 (3:7419) ld c, a ld a, b cp c - jr z, .loopback + jr z, .cant_use ; chose the same mon as user ld a, c ld [CurPartyMon], a - call Functionf30d - jr z, .loopback - call Functionf31b - jr nc, .loopback + call IsMonFainted + jr z, .cant_use + call IsMonAtFullHealth + jr nc, .cant_use xor a ret @@ -2215,15 +2216,15 @@ Functionf419: ; f419 (3:7419) scf ret -.loopback +.cant_use push bc - ld hl, UnknownText_0xf44a + ld hl, .Text_CantBeUsed call MenuTextBoxBackup pop bc jr .loop ; f44a (3:744a) -UnknownText_0xf44a: ; 0xf44a +.Text_CantBeUsed: ; 0xf44a ; That can't be used on this #MON. text_jump UnknownText_0x1c5bac db "@" @@ -2244,19 +2245,19 @@ EscapeRope: ; f44f SuperRepel: ; f462 ld b, 200 - jr Function_0xf46c + jr UseRepel ; f466 MaxRepel: ; f466 ld b, 250 - jr Function_0xf46c + jr UseRepel ; f466 Repel: ; f46a ld b, 100 ; f46c -Function_0xf46c: ; f46c +UseRepel: ; f46c ld a, [wRepelEffect] and a ld hl, TextJump_RepelUsedEarlierIsStillInEffect @@ -2264,7 +2265,7 @@ Function_0xf46c: ; f46c ld a, b ld [wRepelEffect], a - jp Functionf789 + jp UseItemText TextJump_RepelUsedEarlierIsStillInEffect: ; 0xf47d @@ -2279,7 +2280,7 @@ XAccuracy: ; f482 bit SUBSTATUS_X_ACCURACY, [hl] jp nz, WontHaveAnyEffect_NotUsedMessage set SUBSTATUS_X_ACCURACY, [hl] - jp Functionf789 + jp UseItemText ; f48f @@ -2293,7 +2294,7 @@ PokeDoll: ; f48f and 3 << 6 or $2 ld [wBattleResult], a - jp Functionf789 + jp UseItemText .asm_f4a6 xor a @@ -2307,7 +2308,7 @@ GuardSpec: ; f4ab bit SUBSTATUS_MIST, [hl] jp nz, WontHaveAnyEffect_NotUsedMessage set SUBSTATUS_MIST, [hl] - jp Functionf789 + jp UseItemText ; f4b8 @@ -2316,7 +2317,7 @@ DireHit: ; f4b8 bit SUBSTATUS_FOCUS_ENERGY, [hl] jp nz, WontHaveAnyEffect_NotUsedMessage set SUBSTATUS_FOCUS_ENERGY, [hl] - jp Functionf789 + jp UseItemText ; f4c5 @@ -2324,7 +2325,7 @@ XAttack: XDefend: XSpeed: XSpecial: ; f4c5 - call Functionf789 + call UseItemText ld a, [CurItem] ld hl, .x_item_table @@ -2368,8 +2369,8 @@ endr PokeFlute: ; f50c ld a, [wBattleMode] and a - jr nz, .asm_f512 -.asm_f512 + jr nz, .dummy +.dummy xor a ld [wd002], a @@ -2377,14 +2378,14 @@ PokeFlute: ; f50c ld b, $ff ^ SLP ld hl, PartyMon1Status - call .Functionf554 + call .CureSleep ld a, [wBattleMode] cp WILD_BATTLE - jr z, .asm_f52b + jr z, .skip_otrainer ld hl, OTPartyMon1Status - call .Functionf554 -.asm_f52b + call .CureSleep +.skip_otrainer ld hl, BattleMonStatus ld a, [hl] @@ -2397,20 +2398,20 @@ PokeFlute: ; f50c ld a, [wd002] and a - ld hl, UnknownText_0xf56c + ld hl, .CatchyTune jp z, PrintText - ld hl, UnknownText_0xf576 + ld hl, .PlayedTheFlute call PrintText ld a, [Danger] and $80 - jr nz, .asm_f54e -.asm_f54e - ld hl, UnknownText_0xf571 + jr nz, .dummy2 +.dummy2 + ld hl, .AllSleepingMonWokeUp jp PrintText -.Functionf554 +.CureSleep ld de, PARTYMON_STRUCT_LENGTH ld c, PARTY_LENGTH @@ -2418,10 +2419,10 @@ PokeFlute: ; f50c ld a, [hl] push af and SLP - jr z, .asm_f564 + jr z, .not_asleep ld a, 1 ld [wd002], a -.asm_f564 +.not_asleep pop af and b ld [hl], a @@ -2432,29 +2433,25 @@ PokeFlute: ; f50c ; f56c -UnknownText_0xf56c: ; 0xf56c +.CatchyTune: ; 0xf56c ; Played the # FLUTE. Now, that's a catchy tune! text_jump UnknownText_0x1c5bf9 db "@" ; 0xf571 -UnknownText_0xf571: ; 0xf571 +.AllSleepingMonWokeUp: ; 0xf571 ; All sleeping #MON woke up. text_jump UnknownText_0x1c5c28 db "@" ; 0xf576 -UnknownText_0xf576: ; 0xf576 +.PlayedTheFlute: ; 0xf576 ; played the # FLUTE.@ @ text_jump UnknownText_0x1c5c44 start_asm -; 0xf57b - - -Function_0xf57b: ; f57b ld a, [wBattleMode] and a - jr nz, .asm_f58c + jr nz, .battle push de ld de, SFX_POKEFLUTE @@ -2462,14 +2459,14 @@ Function_0xf57b: ; f57b call WaitSFX pop de -.asm_f58c - jp Function13e0 +.battle + jp PokeFluteTerminatorCharacter ; f58f BlueCard: ; f58f ld hl, .bluecardtext - jp Function2012 + jp MenuTextBoxWaitButton .bluecardtext text_jump UnknownText_0x1c5c5e @@ -2479,7 +2476,7 @@ BlueCard: ; f58f CoinCase: ; f59a ld hl, .coincasetext - jp Function2012 + jp MenuTextBoxWaitButton .coincasetext text_jump UnknownText_0x1c5c7b @@ -2527,7 +2524,7 @@ Mysteryberry: ; f5bf ; Party Screen opens to choose on which Pkmn to use the Item ld b, PARTYMENUACTION_HEALING_ITEM call UseItem_SelectMon - jp c, Functionf6e0 + jp c, PPRestoreItem_Cancel .loop2 ld a, [wd002] @@ -2570,7 +2567,7 @@ Mysteryberry: ; f5bf ld a, [wd002] cp PP_UP - jp nz, Functionf6a7 + jp nz, Not_PP_Up ld a, [hl] cp SKETCH @@ -2594,50 +2591,50 @@ Mysteryberry: ; f5bf ld [hl], a ld a, $1 ld [wd265], a - call Functionf84c + call ApplyPPUp call Play_SFX_FULL_HEAL ld hl, TextJump_PPsIncreased call PrintText -Functionf64c: ; f64c +FinishPPRestore: ; f64c call ClearPalettes jp UseDisposableItem ; f652 -Functionf652: ; f652 +BattleRestorePP: ; f652 ld a, [wBattleMode] and a - jr z, .asm_f66c + jr z, .not_in_battle ld a, [CurPartyMon] ld b, a ld a, [CurBattleMon] cp b - jr nz, .asm_f66c + jr nz, .not_in_battle ld a, [PlayerSubStatus5] bit SUBSTATUS_TRANSFORMED, a - jr nz, .asm_f66c - call .asm_f677 + jr nz, .not_in_battle + call .UpdateBattleMonPP -.asm_f66c +.not_in_battle call Play_SFX_FULL_HEAL ld hl, UnknownText_0xf739 call PrintText - jr Functionf64c + jr FinishPPRestore -.asm_f677 +.UpdateBattleMonPP ld a, [CurPartyMon] ld hl, PartyMon1Moves ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes ld de, BattleMonMoves ld b, NUM_MOVES -.asm_f688 +.loop ld a, [de] and a - jr z, .asm_f6a6 + jr z, .done cp [hl] - jr nz, .asm_f6a1 + jr nz, .next push hl push de push bc @@ -2652,20 +2649,20 @@ Functionf652: ; f652 pop de pop hl -.asm_f6a1 +.next inc hl inc de dec b - jr nz, .asm_f688 + jr nz, .loop -.asm_f6a6 +.done ret ; f6a7 -Functionf6a7: ; f6a7 +Not_PP_Up: ; f6a7 call RestorePP - jr nz, Functionf652 - jp Functionf6dd + jr nz, BattleRestorePP + jp PPRestoreItem_NoEffect ; f6af Elixer_RestorePPofAllMoves: ; f6af @@ -2681,14 +2678,14 @@ Elixer_RestorePPofAllMoves: ; f6af call GetMthMoveOfNthPartymon ld a, [hl] and a - jr z, .cant_restore_pp + jr z, .next call RestorePP - jr z, .cant_restore_pp + jr z, .next ld hl, wcfaa inc [hl] -.cant_restore_pp +.next ld hl, MenuSelection2 inc [hl] pop bc @@ -2696,12 +2693,12 @@ Elixer_RestorePPofAllMoves: ; f6af jr nz, .moveLoop ld a, [wcfaa] and a - jp nz, Functionf652 + jp nz, BattleRestorePP -Functionf6dd: ; f6dd +PPRestoreItem_NoEffect: ; f6dd call WontHaveAnyEffectMessage -Functionf6e0: ; f6e0 +PPRestoreItem_Cancel: ; f6e0 call ClearPalettes xor a ld [wd0ec], a @@ -2939,14 +2936,11 @@ Play_SFX_FULL_HEAL: ; f780 ret ; f789 -Functionf789: ; f789 +UseItemText ; f789 ld hl, UsedItemText call PrintText call Play_SFX_FULL_HEAL call WaitPressAorB_BlinkCursor - ; fallthrough -; f795 - UseDisposableItem: ; f795 ld hl, NumItems ld a, 1 @@ -2955,7 +2949,7 @@ UseDisposableItem: ; f795 ; f7a0 UseBallInTrainerBattle: ; f7a0 - call Functionedfa + call ReturnToBattle_UseBall ld de, ANIM_THROW_POKE_BALL ld a, e ld [FXAnimIDLo], a @@ -3107,7 +3101,7 @@ GotOffTheItemText: ; 0xf847 ; 0xf84c -Functionf84c: ; f84c +ApplyPPUp: ; f84c ld a, MON_MOVES call GetPartyParamLocation push hl @@ -3118,29 +3112,29 @@ Functionf84c: ; f84c add hl, bc ld de, Buffer1 ld b, 0 -.asm_f864 +.loop inc b ld a, b cp NUM_MOVES + 1 ret z ld a, [wd265] dec a - jr nz, .asm_f876 + jr nz, .use ld a, [MenuSelection2] inc a cp b - jr nz, .asm_f87d + jr nz, .skip -.asm_f876 +.use ld a, [hl] and 3 << 6 ld a, [de] ; wasted cycle call nz, ComputeMaxPP -.asm_f87d +.skip inc hl inc de - jr .asm_f864 + jr .loop ; f881 @@ -3195,7 +3189,7 @@ ComputeMaxPP: ; f881 ret ; f8b9 -Functionf8b9: ; f8b9 +RestoreAllPP: ; f8b9 ld a, MON_PP call GetPartyParamLocation push hl diff --git a/main.asm b/main.asm index 940c7e03d..e759b4931 100644 --- a/main.asm +++ b/main.asm @@ -2957,7 +2957,7 @@ SpecialGiveShuckle: ; 7305 ; Caught data. ld b, 0 - callba SetPartymonCaughtData + callba SetGiftPartyMonCaughtData ; Holding a Berry. ld bc, PARTYMON_STRUCT_LENGTH @@ -4530,7 +4530,7 @@ endr ld a, [hl] ld [bc], a - callba Functionf8b9 + callba RestoreAllPP ret ; c699 @@ -8308,7 +8308,7 @@ endr ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes predef GetUnownLetter - callab Functionfba18 + callab UpdateUnownDex .done scf ; When this function returns, the carry flag indicates success vs failure. @@ -8420,7 +8420,7 @@ AddTempmonToParty: ; da96 ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes predef GetUnownLetter - callab Functionfba18 + callab UpdateUnownDex ld a, [wdef4] and a jr nz, .done @@ -9014,7 +9014,7 @@ SentPkmnIntoBox: ; de6e jr nz, .asm_df20 ld hl, sBoxMon1DVs predef GetUnownLetter - callab Functionfba18 + callab UpdateUnownDex .asm_df20 ld hl, sBoxMon1Moves @@ -9697,7 +9697,7 @@ endr ld [hli], a ld [hl], 01001 % $100 pop bc - callba SetPartymonCaughtData + callba SetGiftPartyMonCaughtData jr .skip_nickname .asm_e35e @@ -9721,7 +9721,7 @@ endr call Random ld [hl], a call CloseSRAM - callba SetBoxMonCaughtData + callba SetGiftBoxMonCaughtData jr .skip_nickname .asm_e390 @@ -9732,11 +9732,11 @@ endr ld a, b and a jr z, .asm_e3a0 - callba Function4db83 + callba SetBoxMonCaughtData jr .asm_e3a6 .asm_e3a0 - callba Function4db49 + callba SetCaughtData .asm_e3a6 callba GiveANickname_YesNo @@ -13569,7 +13569,7 @@ LevelUpHappinessMod: ; 2709e INCLUDE "trainers/dvs.asm" -Function2715c: ; 2715c +_ReturnToBattle_UseBall: ; 2715c call ClearBGPalettes call ClearTileMap ld a, [BattleType] @@ -16258,690 +16258,7 @@ Function41af7: ; 41af7 INCLUDE "battle/moves/moves.asm" - -Function421d8: ; 421d8 - ld hl, EvolvableFlags - xor a - ld [hl], a - ld a, [CurPartyMon] - ld c, a - ld b, $1 - call Function42577 - -Function421e6: ; 421e6 - xor a - ld [wd268], a - dec a - ld [CurPartyMon], a - push hl - push bc - push de - ld hl, PartyCount - - push hl - -Function421f5: ; 421f5 - ld hl, CurPartyMon - inc [hl] - - pop hl - - inc hl - ld a, [hl] - cp $ff - jp z, Function423ff - - ld [Buffer1], a - - push hl - ld a, [CurPartyMon] - ld c, a - ld hl, EvolvableFlags - ld b, 2 - call Function42577 - ld a, c - and a - jp z, Function421f5 - - ld a, [Buffer1] - dec a - ld b, 0 - ld c, a - ld hl, EvosAttacksPointers -rept 2 - add hl, bc -endr - ld a, [hli] - ld h, [hl] - ld l, a - - push hl - xor a - ld [MonType], a - predef CopyPkmnToTempMon - pop hl - -.asm_42230 - ld a, [hli] - and a - jr z, Function421f5 - - ld b, a - - cp EVOLVE_TRADE - jr z, .trade - - ld a, [wLinkMode] - and a - jp nz, .asm_423f9 - - ld a, b - cp EVOLVE_ITEM - jp z, .item - - ld a, [wd1e9] - and a - jp nz, .asm_423f9 - - ld a, b - cp EVOLVE_LEVEL - jp z, .level - - cp EVOLVE_HAPPINESS - jr z, .happiness - - -; EVOLVE_STAT - ld a, [TempMonLevel] - cp [hl] - jp c, .asm_423f8 - - call Function42461 - jp z, .asm_423f8 - - push hl - ld de, TempMonAttack - ld hl, TempMonDefense - ld c, 2 - call StringCmp - ld a, ATK_EQ_DEF - jr z, .asm_4227a - ld a, ATK_LT_DEF - jr c, .asm_4227a - ld a, ATK_GT_DEF -.asm_4227a - pop hl - - inc hl - cp [hl] - jp nz, .asm_423f9 - - inc hl - jr .asm_422fd - - -.happiness - ld a, [TempMonHappiness] - cp 220 - jp c, .asm_423f9 - - call Function42461 - jp z, .asm_423f9 - - ld a, [hli] - cp TR_ANYTIME - jr z, .asm_422fd - cp TR_MORNDAY - jr z, .asm_422a4 - -; TR_NITE - ld a, [TimeOfDay] - cp NITE - jp nz, .asm_423fa - jr .asm_422fd - -.asm_422a4 - ld a, [TimeOfDay] - cp NITE - jp z, .asm_423fa - jr .asm_422fd - - -.trade - ld a, [wLinkMode] - and a - jp z, .asm_423f9 - - call Function42461 - jp z, .asm_423f9 - - ld a, [hli] - ld b, a - inc a - jr z, .asm_422fd - - ld a, [wLinkMode] - cp LINK_TIMECAPSULE - jp z, .asm_423fa - - ld a, [TempMonItem] - cp b - jp nz, .asm_423fa - - xor a - ld [TempMonItem], a - jr .asm_422fd - - -.item - ld a, [hli] - ld b, a - ld a, [CurItem] - cp b - jp nz, .asm_423fa - - ld a, [wd1e9] - and a - jp z, .asm_423fa - ld a, [wLinkMode] - and a - jp nz, .asm_423fa - jr .asm_422fd - - -.level - ld a, [hli] - ld b, a - ld a, [TempMonLevel] - cp b - jp c, .asm_423fa - call Function42461 - jp z, .asm_423fa - -.asm_422fd - ld a, [TempMonLevel] - ld [CurPartyLevel], a - ld a, $1 - ld [wd268], a - - push hl - - ld a, [hl] - ld [Buffer2], a - ld a, [CurPartyMon] - ld hl, PartyMonNicknames - call GetNick - call CopyName1 - ld hl, UnknownText_0x42482 - call PrintText - - ld c, 50 - call DelayFrames - - xor a - ld [hBGMapMode], a - hlcoord 0, 0 - lb bc, 12, 20 - call ClearBox - - ld a, $1 - ld [hBGMapMode], a - call ClearSprites - - callba EvolutionAnimation - - push af - call ClearSprites - pop af - jp c, Function42454 - - ld hl, UnknownText_0x42473 - call PrintText - - pop hl - - ld a, [hl] - ld [CurSpecies], a - ld [TempMonSpecies], a - ld [Buffer2], a - ld [wd265], a - call GetPokemonName - - push hl - ld hl, UnknownText_0x42478 - call PrintTextBoxText - callba MobileFn_106094 - - ld de, MUSIC_NONE - call PlayMusic - ld de, SFX_CAUGHT_MON - call PlaySFX - call WaitSFX - - ld c, 40 - call DelayFrames - - call ClearTileMap - call Function42414 - call GetBaseData - - ld hl, TempMonExp + 2 - ld de, TempMonMaxHP - ld b, $1 - predef CalcPkmnStats - - ld a, [CurPartyMon] - ld hl, PartyMons - ld bc, PARTYMON_STRUCT_LENGTH - call AddNTimes - ld e, l - ld d, h - ld bc, MON_MAXHP - add hl, bc - ld a, [hli] - ld b, a - ld c, [hl] - ld hl, TempMonMaxHP + 1 - ld a, [hld] - sub c - ld c, a - ld a, [hl] - sbc b - ld b, a - ld hl, TempMonHP + 1 - ld a, [hl] - add c - ld [hld], a - ld a, [hl] - adc b - ld [hl], a - - ld hl, TempMonSpecies - ld bc, PARTYMON_STRUCT_LENGTH - call CopyBytes - - ld a, [CurSpecies] - ld [wd265], a - xor a - ld [MonType], a - call LearnLevelMoves - ld a, [wd265] - dec a - call SetSeenAndCaughtMon - - ld a, [wd265] - cp UNOWN - jr nz, .asm_423ec - - ld hl, TempMonDVs - predef GetUnownLetter - callab Functionfba18 - -.asm_423ec - pop de - pop hl - ld a, [TempMonSpecies] - ld [hl], a - push hl - ld l, e - ld h, d - jp Function421f5 -; 423f8 - -.asm_423f8 - inc hl -.asm_423f9 - inc hl -.asm_423fa - inc hl - jp .asm_42230 -; 423fe - -Function423fe: ; 423fe - pop hl - -Function423ff: ; 423ff - pop de - pop bc - pop hl - ld a, [wLinkMode] - and a - ret nz - ld a, [wBattleMode] - and a - ret nz - ld a, [wd268] - and a - call nz, RestartMapMusic - ret -; 42414 - -Function42414: ; 42414 - ld a, [CurSpecies] - push af - ld a, [BaseDexNo] - ld [wd265], a - call GetPokemonName - pop af - ld [CurSpecies], a - ld hl, StringBuffer1 - ld de, StringBuffer2 -.asm_4242b - ld a, [de] - inc de - cp [hl] - inc hl - ret nz - cp "@" - jr nz, .asm_4242b - ld a, [CurPartyMon] - ld bc, PKMN_NAME_LENGTH - ld hl, PartyMonNicknames - call AddNTimes - push hl - ld a, [CurSpecies] - ld [wd265], a - call GetPokemonName - ld hl, StringBuffer1 - pop de - ld bc, PKMN_NAME_LENGTH - jp CopyBytes -; 42454 - -Function42454: ; 42454 - ld hl, UnknownText_0x4247d - call PrintText - call ClearTileMap - pop hl - jp Function421f5 -; 42461 - -Function42461: ; 42461 - push hl - ld a, [CurPartyMon] - ld hl, PartyMon1Item - ld bc, PARTYMON_STRUCT_LENGTH - call AddNTimes - ld a, [hl] - cp EVERSTONE - pop hl - ret -; 42473 - -UnknownText_0x42473: ; 0x42473 - ; Congratulations! Your @ @ - text_jump UnknownText_0x1c4b92 - db "@" -; 0x42478 - -UnknownText_0x42478: ; 0x42478 - ; evolved into @ ! - text_jump UnknownText_0x1c4baf - db "@" -; 0x4247d - -UnknownText_0x4247d: ; 0x4247d - ; Huh? @ stopped evolving! - text_jump UnknownText_0x1c4bc5 - db "@" -; 0x42482 - -UnknownText_0x42482: ; 0x42482 - ; What? @ is evolving! - text_jump UnknownText_0x1c4be3 - db "@" -; 0x42487 - - -LearnLevelMoves: ; 42487 - ld a, [wd265] - ld [CurPartySpecies], a - dec a - ld b, 0 - ld c, a - ld hl, EvosAttacksPointers -rept 2 - add hl, bc -endr - ld a, [hli] - ld h, [hl] - ld l, a - -.skip_evos - ld a, [hli] - and a - jr nz, .skip_evos - -.find_move - ld a, [hli] - and a - jr z, .done - - ld b, a - ld a, [CurPartyLevel] - cp b - ld a, [hli] - jr nz, .find_move - - push hl - ld d, a - ld hl, PartyMon1Moves - ld a, [CurPartyMon] - ld bc, PARTYMON_STRUCT_LENGTH - call AddNTimes - - ld b, NUM_MOVES -.check_move - ld a, [hli] - cp d - jr z, .has_move - dec b - jr nz, .check_move - jr .learn -.has_move - - pop hl - jr .find_move - -.learn - ld a, d - ld [wd262], a - ld [wd265], a - call GetMoveName - call CopyName1 - predef LearnMove - pop hl - jr .find_move - -.done - ld a, [CurPartySpecies] - ld [wd265], a - ret -; 424e1 - - -FillMoves: ; 424e1 -; Fill in moves at de for CurPartySpecies at CurPartyLevel - - push hl - push de - push bc - ld hl, EvosAttacksPointers - ld b, 0 - ld a, [CurPartySpecies] - dec a - add a - rl b - ld c, a - add hl, bc - ld a, [hli] - ld h, [hl] - ld l, a -.GoToAttacks - ld a, [hli] - and a - jr nz, .GoToAttacks - jr .GetLevel - -.NextMove - pop de -.GetMove - inc hl -.GetLevel - ld a, [hli] - and a - jp z, .done - ld b, a - ld a, [CurPartyLevel] - cp b - jp c, .done - ld a, [Buffer1] - and a - jr z, .CheckMove - ld a, [wd002] - cp b - jr nc, .GetMove - -.CheckMove - push de - ld c, NUM_MOVES -.CheckRepeat - ld a, [de] - inc de - cp [hl] - jr z, .NextMove - dec c - jr nz, .CheckRepeat - pop de - push de - ld c, NUM_MOVES -.CheckSlot - ld a, [de] - and a - jr z, .LearnMove - inc de - dec c - jr nz, .CheckSlot - pop de - push de - push hl - ld h, d - ld l, e - call ShiftMoves - ld a, [Buffer1] - and a - jr z, .ShiftedMove - push de - ld bc, PartyMon1PP - (PartyMon1Moves + NUM_MOVES - 1) - add hl, bc - ld d, h - ld e, l - call ShiftMoves - pop de - -.ShiftedMove - pop hl - -.LearnMove - ld a, [hl] - ld [de], a - ld a, [Buffer1] - and a - jr z, .NextMove - push hl - ld a, [hl] - ld hl, MON_PP - MON_MOVES - add hl, de - push hl - dec a - ld hl, Moves + MOVE_PP - ld bc, MOVE_LENGTH - call AddNTimes - ld a, BANK(Moves) - call GetFarByte - pop hl - ld [hl], a - pop hl - jr .NextMove - -.done - pop bc - pop de - pop hl - ret -; 4256e - -ShiftMoves: ; 4256e - ld c, NUM_MOVES - 1 -.loop - inc de - ld a, [de] - ld [hli], a - dec c - jr nz, .loop - ret -; 42577 - - -Function42577: ; 42577 - push de - ld d, $0 - predef FlagPredef - pop de - ret -; 42581 - -GetPreEvolution: ; 42581 -; Find the first mon to evolve into CurPartySpecies. - -; Return carry and the new species in CurPartySpecies -; if a pre-evolution is found. - - ld c, 0 -.loop ; For each Pokemon... - ld hl, EvosAttacksPointers - ld b, 0 -rept 2 - add hl, bc -endr - ld a, [hli] - ld h, [hl] - ld l, a -.loop2 ; For each evolution... - ld a, [hli] - and a - jr z, .no_evolve ; If we jump, this Pokemon does not evolve into CurPartySpecies. - cp EVOLVE_STAT ; This evolution type has the extra parameter of stat comparison. - jr nz, .not_tyrogue - inc hl - -.not_tyrogue - inc hl - ld a, [CurPartySpecies] - cp [hl] - jr z, .found_preevo - inc hl - ld a, [hl] - and a - jr nz, .loop2 - -.no_evolve - inc c - ld a, c - cp NUM_POKEMON - jr c, .loop - and a - ret - -.found_preevo - inc c - ld a, c - ld [CurPartySpecies], a - scf - ret -; 425b1 - - +INCLUDE "engine/evolve.asm" SECTION "bank11", ROMX, BANK[$11] @@ -20888,7 +20205,7 @@ CheckPartyFullAfterContest: ; 4d9e5 call GetPartyLocation ld a, [hl] ld [CurPartyLevel], a - call Function4db49 + call SetCaughtData ld a, [PartyCount] dec a ld hl, PartyMon1CaughtLocation @@ -20950,7 +20267,7 @@ CheckPartyFullAfterContest: ; 4d9e5 ld a, [sBoxMon1Level] ld [CurPartyLevel], a call CloseSRAM - call Function4db83 + call SetBoxMonCaughtData ld a, BANK(sBoxMon1CaughtLocation) call GetSRAMBank ld hl, sBoxMon1CaughtLocation @@ -20987,12 +20304,12 @@ TextJump_GiveANickname: ; 0x4db44 ; 0x4db49 -Function4db49: ; 4db49 +SetCaughtData: ; 4db49 ld a, [PartyCount] dec a ld hl, PartyMon1CaughtLevel call GetPartyLocation -Function4db53: ; 4db53 +SetBoxmonOrEggmonCaughtData: ; 4db53 ld a, [TimeOfDay] inc a rrca @@ -21026,34 +20343,34 @@ Function4db53: ; 4db53 ret ; 4db83 -Function4db83: ; 4db83 +SetBoxMonCaughtData: ; 4db83 ld a, BANK(sBoxMon1CaughtLevel) call GetSRAMBank ld hl, sBoxMon1CaughtLevel - call Function4db53 + call SetBoxmonOrEggmonCaughtData call CloseSRAM ret ; 4db92 -SetBoxMonCaughtData: ; 4db92 +SetGiftBoxMonCaughtData: ; 4db92 push bc ld a, BANK(sBoxMon1CaughtLevel) call GetSRAMBank ld hl, sBoxMon1CaughtLevel pop bc - call SetPkmnCaughtData + call SetGiftMonCaughtData call CloseSRAM ret ; 4dba3 -SetPartymonCaughtData: ; 4dba3 +SetGiftPartyMonCaughtData: ; 4dba3 ld a, [PartyCount] dec a ld hl, PartyMon1CaughtLevel push bc call GetPartyLocation pop bc -SetPkmnCaughtData: ; 4dbaf +SetGiftMonCaughtData: ; 4dbaf xor a ld [hli], a ld a, $7e @@ -21064,7 +20381,7 @@ SetPkmnCaughtData: ; 4dbaf ; 4dbb8 -Function4dbb8: ; 4dbb8 (13:5bb8) +SetEggMonCaughtData: ; 4dbb8 (13:5bb8) ld a, [CurPartyMon] ld hl, PartyMon1CaughtLevel call GetPartyLocation @@ -21072,7 +20389,7 @@ Function4dbb8: ; 4dbb8 (13:5bb8) push af ld a, $1 ld [CurPartyLevel], a - call Function4db53 + call SetBoxmonOrEggmonCaughtData pop af ld [CurPartyLevel], a ret @@ -34954,7 +34271,7 @@ PlaySlowCry: ; fb841 ret ; fb877 -Functionfb877: ; fb877 +NewPokedexEntry: ; fb877 ld a, [hMapAnims] push af xor a @@ -35300,22 +34617,22 @@ Pokered_MonIndices: ; fb91c ; fba18 -Functionfba18: ; fba18 +UpdateUnownDex: ; fba18 ld a, [UnownLetter] ld c, a ld b, 26 ld hl, UnownDex -.asm_fba21 +.loop ld a, [hli] and a - jr z, .asm_fba2b + jr z, .done cp c ret z dec b - jr nz, .asm_fba21 + jr nz, .loop ret -.asm_fba2b +.done dec hl ld [hl], c ret @@ -35324,8 +34641,8 @@ Functionfba18: ; fba18 Functionfba2e: ; fba2e (3e:7a2e) hlcoord 4, 15 - ld bc, $c - ld a, $7f + ld bc, 12 + ld a, " " call ByteFill ld a, [wc7dd] ld e, a @@ -35650,7 +34967,7 @@ Functionfcc63: ; fcc63 jr c, .asm_fcd1c ld b, 1 .asm_fcd1c - callba SetPartymonCaughtData + callba SetGiftPartyMonCaughtData ld e, TRADE_NICK call GetTradeAttribute diff --git a/misc/mobile_40.asm b/misc/mobile_40.asm index ba26f1b2d..d0a0c72e3 100644 --- a/misc/mobile_40.asm +++ b/misc/mobile_40.asm @@ -6465,7 +6465,7 @@ Function102b32: ; 102b32 ld [CurPartyMon], a ld a, $1 ld [wd1e9], a - callba Function421d8 + callba EvolvePokemon call Function102d9a call Function102dd3 call Function102dec @@ -6769,7 +6769,7 @@ Function102d48: ; 102d48 ld hl, PartyMon1DVs call AddNTimes predef GetUnownLetter - callba Functionfba18 + callba UpdateUnownDex ld a, [wdef4] and a jr nz, .asm_102d98 diff --git a/misc/mobile_46.asm b/misc/mobile_46.asm index 931cda0ac..b07164f6f 100755 --- a/misc/mobile_46.asm +++ b/misc/mobile_46.asm @@ -7676,7 +7676,7 @@ Function11b7e5: ; 11b7e5 ld [wd1e9], a ld a, $2 ld [wLinkMode], a - callba Function421d8 + callba EvolvePokemon xor a ld [wLinkMode], a callba Function14a58 diff --git a/misc/mobile_5f.asm b/misc/mobile_5f.asm index e9dbc799d..b1f609298 100644 --- a/misc/mobile_5f.asm +++ b/misc/mobile_5f.asm @@ -303,7 +303,7 @@ Function17d0f3: ; 17d0f3 ld [wd1e9], a ld a, $2 ld [wLinkMode], a - callba Function421d8 + callba EvolvePokemon xor a ld [wLinkMode], a callba Function14a58 @@ -415,7 +415,7 @@ Function17d1f1: ; 17d1f1 ld bc, PARTYMON_STRUCT_LENGTH call AddNTimes predef GetUnownLetter - callab Functionfba18 + callab UpdateUnownDex ld a, [wdef4] and a jr nz, .asm_17d223 @@ -2362,7 +2362,7 @@ Function17ded9: ; 17ded9 push hl push bc predef TryAddMonToParty - callba Function4db49 + callba SetCaughtData pop bc pop hl bit 1, b @@ -2400,7 +2400,7 @@ Function17ded9: ; 17ded9 ld a, [hli] ld b, a push hl - callba SetPartymonCaughtData + callba SetGiftPartyMonCaughtData pop hl pop bc jr .asm_17df5e @@ -2558,7 +2558,7 @@ Function17e026: ; 17e026 push hl callba LoadEnemyMon callba SentPkmnIntoBox - callba Function4db83 + callba SetBoxMonCaughtData pop hl pop bc ld a, BANK(sBoxMonNicknames) @@ -2587,7 +2587,7 @@ Function17e026: ; 17e026 ld b, a push hl call CloseSRAM - callba SetBoxMonCaughtData + callba SetGiftBoxMonCaughtData ld a, $1 call GetSRAMBank pop hl diff --git a/wram.asm b/wram.asm index cc16e9527..a9d1f0b2d 100644 --- a/wram.asm +++ b/wram.asm @@ -1664,6 +1664,7 @@ wd0e4:: ds 4 wQueuedScriptBank:: ds 1 wQueuedScriptAddr:: ds 2 wd0eb:: ds 1 +wFieldMoveSucceeded:: wd0ec:: ds 1 VramState:: ; d0ed