diff options
Diffstat (limited to 'main.asm')
-rw-r--r-- | main.asm | 747 |
1 files changed, 32 insertions, 715 deletions
@@ -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 |