diff --git a/battle/ai/items.asm b/battle/ai/items.asm index 95997a67e..547d213df 100644 --- a/battle/ai/items.asm +++ b/battle/ai/items.asm @@ -9,7 +9,7 @@ AI_SwitchOrTryItem: ; 38000 and a ret nz - callba Function3e8d1 + callba CheckSubstatus_RechargeChargedRampageBideRollout ret nz ld a, [PlayerSubStatus5] @@ -24,6 +24,7 @@ AI_SwitchOrTryItem: ; 38000 ld a, [InBattleTowerBattle] ; Load always the first TrainerClass for BattleTower-Trainers and a jr nz, .ok + ld a, [TrainerClass] dec a ld bc, 7 diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm index 101d4e188..258ee2e16 100644 --- a/battle/ai/scoring.asm +++ b/battle/ai/scoring.asm @@ -176,7 +176,7 @@ AI_Types: ; 38635 push de ld a, 1 ld [hBattleTurn], a - callab Function347c8 + callab HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn pop de pop bc pop hl @@ -431,7 +431,7 @@ AI_Smart_LeechHit: ; 387f7 push hl ld a, 1 ld [hBattleTurn], a - callab Function347c8 + callab HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn pop hl ; 60% chance to discourage this move if not very effective. @@ -512,7 +512,7 @@ AI_Smart_LockOn: ; 3881d push hl push bc - callba Function347c8 + callba HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn ld a, [wd265] cp $a pop bc @@ -1384,7 +1384,7 @@ AI_Smart_Mimic: ; 38ba8 ld a, $1 ld [hBattleTurn], a - callab Function347c8 + callab HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn ld a, [wd265] cp $a @@ -1783,8 +1783,8 @@ AI_Smart_PriorityHit: ; 38d5a ld [hBattleTurn], a push hl callab EnemyAttackDamage - callab BattleCommand62 - callab BattleCommand07 + callab BattleCommand_DamageCalcWithStats + callab BattleCommand_CalcDamageTypeMultiplier pop hl ld a, [CurDamage + 1] ld c, a @@ -1830,7 +1830,7 @@ AI_Smart_Conversion2: ; 38d98 xor a ld [hBattleTurn], a - callab Function347c8 + callab HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn ld a, [wd265] cp $a @@ -2496,7 +2496,7 @@ AI_Smart_HiddenPower: ; 3909e ; Calculate Hidden Power's type and base power based on enemy's DVs. callab HiddenPowerDamage - callab Function347c8 + callab HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn pop hl ; Discourage Hidden Power if not very effective. @@ -3380,8 +3380,8 @@ AIDamageCalc: ; 393e7 .asm_39400 callab EnemyAttackDamage - callab BattleCommand62 - callab BattleCommand07 + callab BattleCommand_DamageCalcWithStats + callab BattleCommand_CalcDamageTypeMultiplier ret .ConstantDamageEffects @@ -3498,7 +3498,7 @@ AI_Status: ; 39453 push de ld a, 1 ld [hBattleTurn], a - callab Function347c8 + callab HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn pop de pop bc pop hl diff --git a/battle/core.asm b/battle/core.asm index 2aacc2783..02ad67fa4 100644 --- a/battle/core.asm +++ b/battle/core.asm @@ -49,14 +49,14 @@ Function3c000: ; 3c000 call DelayFrames .asm_3c04c - call Function309d - call Function3d873 + call LoadTileMapToTempTileMap + call CheckPlayerPartyForFitPkmn ld a, d and a jp z, LostBattle - call Function30b4 + call Call_LoadTempTileMapToTileMap ld a, [BattleType] - cp $2 + cp BATTLETYPE_DEBUG jp z, .asm_3c0e2 cp BATTLETYPE_TUTORIAL jp z, .asm_3c0e2 @@ -85,7 +85,7 @@ Function3c000: ; 3c000 hlcoord 1, 5 ld a, $9 call Function3d490 - call Function309d + call LoadTileMapToTempTileMap call Function3d57a call Function3da0d call ResetPlayerStatLevels @@ -94,7 +94,7 @@ Function3c000: ; 3c000 call BreakAttraction call Function3db5f call EmptyBattleTextBox - call Function309d + call LoadTileMapToTempTileMap call SetPlayerTurn call SpikesDamage ld a, [wLinkMode] @@ -122,7 +122,7 @@ Function3c000: ; 3c000 WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5 - call Function30b4 + call Call_LoadTempTileMapToTileMap ld a, [wBattleResult] and $c0 add $2 @@ -306,7 +306,7 @@ Function3c1d6: ; 3c1d6 call Function3de97 call Function3dcf9 call UpdateBattleMonInParty - call Function309d + call LoadTileMapToTempTileMap jp Function3c4df ; 3c23c @@ -422,7 +422,7 @@ Function3c27c: ; 3c27c pop hl ld [hl], a call GetItemName - ld hl, BattleText_0x80bde + ld hl, BattleText_UsersStringBuffer1Activated call StdBattleTextBox callab BattleCommand8c pop af @@ -645,9 +645,9 @@ Function3c434: ; 3c434 ld [wd235], a inc a ; POUND ld [FXAnimIDLo], a - call Function3e4bc + call MoveSelectionScreen push af - call Function30b4 + call Call_LoadTempTileMapToTileMap call UpdateBattleHuds ld a, [CurPlayerMove] cp STRUGGLE @@ -748,7 +748,7 @@ Function3c4df: ; 3c4df ld hl, PlayerSubStatus5 res SUBSTATUS_ENCORED, [hl] call SetEnemyTurn - ld hl, BattleText_0x80c8a + ld hl, BattleText_TargetsEncoreEnded jp StdBattleTextBox .asm_3c518 @@ -772,7 +772,7 @@ Function3c4df: ; 3c4df ld hl, EnemySubStatus5 res SUBSTATUS_ENCORED, [hl] call SetPlayerTurn - ld hl, BattleText_0x80c8a + ld hl, BattleText_TargetsEncoreEnded jp StdBattleTextBox ; 3c543 @@ -937,7 +937,7 @@ GetMoveEffect: ; 3c5ec Function3c5fe: ; 3c5fe - call Function309d + call LoadTileMapToTempTileMap call Function3c543 jp c, WildFled_EnemyFled_LinkBattleCanceled call SetEnemyTurn @@ -1006,7 +1006,7 @@ Function3c664: ; 3c664 call RefreshBattleHuds pop af jr c, .asm_3c6be - call Function309d + call LoadTileMapToTempTileMap call Function3c543 jp c, WildFled_EnemyFled_LinkBattleCanceled call Function3c6de @@ -1068,12 +1068,12 @@ HasUserFainted: ; 3c706 jr z, HasPlayerFainted HasEnemyFainted: ; 3c70b ld hl, EnemyMonHP - jr Function3c713 + jr CheckIfHPIsZero HasPlayerFainted: ; 3c710 ld hl, BattleMonHP -Function3c713: ; 3c713 +CheckIfHPIsZero: ; 3c713 ld a, [hli] or [hl] ret @@ -1334,11 +1334,11 @@ Function3c874: ; 3c874 .asm_3c8d3 call GetSixteenthMaxHP call Function3cc3f - ld hl, BattleText_0x80de2 + ld hl, BattleText_UsersHurtByStringBuffer1 jr .asm_3c8e1 .asm_3c8de - ld hl, BattleText_0x80df5 + ld hl, BattleText_UserWasReleasedFromStringBuffer1 .asm_3c8e1 jp StdBattleTextBox @@ -1823,7 +1823,7 @@ HandleWeather: ; 3cb9e xor a ld [wcfca], a ld de, ANIM_IN_SANDSTORM - call Function3ee17 + call Call_PlayBattleAnim call SwitchTurnCore call GetEighthMaxHP call Function3cc3f @@ -1868,6 +1868,7 @@ Function3cc39: ; 3cc39 ; 3cc3f Function3cc3f: ; 3cc3f +; Subtract HP from Pkmn call Function3cc45 jp Function3cd36 ; 3cc45 @@ -1892,6 +1893,7 @@ Function3cc45: ; 3cc45 ld [hl], a ld [wd1ef], a ret nc + ld a, [wd1ec] ld c, a ld a, [wd1ed] @@ -2104,7 +2106,7 @@ HandleEnemyMonFaint: ; 3cd55 xor a ld [wc6f7], a call Function3ce01 - call Function3d873 + call CheckPlayerPartyForFitPkmn ld a, d and a jp z, LostBattle @@ -2183,7 +2185,7 @@ Function3cdca: ; 3cdca ld a, $1 call EnemyPartyMonEntrance call ClearSprites - call Function309d + call LoadTileMapToTempTileMap pop af ld [CurPartyMon], a call Function3d2b3 @@ -2236,19 +2238,19 @@ Function3ce01: ; 3ce01 call Function3d1aa .asm_3ce47 - call Function3d873 + call CheckPlayerPartyForFitPkmn ld a, d and a ret z ld a, [wBattleMode] dec a - call z, Function3d0ea + call z, PlayVictoryMusic call EmptyBattleTextBox - call Function309d + call LoadTileMapToTempTileMap ld a, [wBattleResult] and $c0 ld [wBattleResult], a - call Function3ceaa + call ShareExperiencePoints jr z, .asm_3ce72 ld hl, EnemyMonBaseStats ld b, $7 @@ -2265,8 +2267,8 @@ Function3ce01: ; 3ce01 call CopyBytes xor a ld [wc71f], a - call Function3ee3b - call Function3ceaa + call GiveExperiencePoints + call ShareExperiencePoints ret z ld a, [wc664] push af @@ -2278,13 +2280,13 @@ Function3ce01: ; 3ce01 call CopyBytes ld a, $1 ld [wc71f], a - call Function3ee3b + call GiveExperiencePoints pop af ld [wc664], a ret ; 3ceaa -Function3ceaa: ; 3ceaa +ShareExperiencePoints: ; 3ceaa ld a, [PartyCount] ld b, a ld hl, PartyMon1 @@ -2406,11 +2408,13 @@ Function3cf4a: ; 3cf4a ld a, [wLinkMode] and a jr z, .asm_3cf6d + call Function3e8e4 ld a, [wBattleAction] cp $f ret z - call Function30b4 + + call Call_LoadTempTileMapToTileMap .asm_3cf6d ld hl, BattleMonHP @@ -2432,6 +2436,7 @@ EnemyPartyMonEntrance: ; 3cf78 pop af and a jr nz, .asm_3cf8f + call Function3d4e1 jr .asm_3cf92 @@ -2450,6 +2455,7 @@ EnemyPartyMonEntrance: ; 3cf78 ; 3cfa4 WinTrainerBattle: ; 3cfa4 +; Player won the battle call StopDangerSound ld a, $1 ld [wc6fd], a @@ -2457,10 +2463,11 @@ WinTrainerBattle: ; 3cfa4 ld a, [wLinkMode] and a ld a, b - call z, Function3d0ea + call z, PlayVictoryMusic callab Battle_GetTrainerName ld hl, BattleText_EnemyWasDefeated call StdBattleTextBox + call IsMobileBattle jr z, .asm_3cff5 ld a, [wLinkMode] @@ -2660,7 +2667,7 @@ Function3d0be: ; 3d0be ret ; 3d0ea -Function3d0ea: ; 3d0ea +PlayVictoryMusic: ; 3d0ea push de ld de, MUSIC_NONE call PlayMusic @@ -2670,7 +2677,7 @@ Function3d0ea: ; 3d0ea dec a jr nz, .asm_3d113 push de - call Function3ceaa + call ShareExperiencePoints pop de jr nz, .asm_3d11e ld hl, wPayDayMoney @@ -2761,7 +2768,7 @@ HandlePlayerMonFaint: ; 3d14e ld a, $1 ld [wc6f7], a call Function3d1aa - call Function3d873 + call CheckPlayerPartyForFitPkmn ld a, d and a jp z, LostBattle @@ -2843,7 +2850,7 @@ Function3d1aa: ; 3d1aa Function3d1f8: ; 3d1f8 call EmptyBattleTextBox - call Function309d + call LoadTileMapToTempTileMap ld a, [wBattleMode] and a dec a @@ -2864,12 +2871,12 @@ Function3d1f8: ; 3d1f8 jr z, .asm_3d20a ld hl, PartyMon1Speed ld de, EnemyMonSpeed - jp Function3d8b3 + jp TryToRunAwayFromBattle ; 3d227 Function3d227: ; 3d227 call EmptyBattleTextBox - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Function3d2f7 call ForcePickPartyMonInBattle ld a, [wLinkMode] @@ -2894,10 +2901,10 @@ Function3d227: ; 3d227 call WhiteBGMap call Function3eda6 call ExitMenu - call Function309d + call LoadTileMapToTempTileMap call WaitBGMap call ClearSGB - call Function32f9 + call SetPalettes xor a ld c, a ret @@ -2916,13 +2923,13 @@ Function3d227: ; 3d227 call Function3eda6 call WriteBackup call ClearSGB - call Function32f9 + call SetPalettes call SendOutPkmnText call NewBattleMonStatus call BreakAttraction call Function3db5f call EmptyBattleTextBox - call Function309d + call LoadTileMapToTempTileMap call SetPlayerTurn call SpikesDamage ld a, $1 @@ -2944,7 +2951,7 @@ Function3d2b3: ; 3d2b3 call BreakAttraction call Function3db5f call EmptyBattleTextBox - call Function309d + call LoadTileMapToTempTileMap call SetPlayerTurn jp SpikesDamage ; 3d2e0 @@ -2988,7 +2995,7 @@ Function3d313: ; 3d313 callba WritePartyMenuTilemap callba PrintPartyMenuText call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame ret ; 3d329 @@ -3023,7 +3030,7 @@ SwitchMonAlreadyOut: ; 3d34f cp [hl] jr nz, .notout - ld hl, BattleText_0x80c0d + ld hl, BattleText_PkmnIsAlreadyOut call StdBattleTextBox scf ret @@ -3128,7 +3135,7 @@ LostBattle: ; 3d38e ; Greyscale ld b, 0 call GetSGBLayout - call Function32f9 + call SetPalettes jr .end .LostLinkBattle @@ -3287,11 +3294,11 @@ Function3d4ae: ; 3d4ae Function3d4c3: ; 3d4c3 - call Function3d557 + call ResetEnemyBattleVars ld a, [wc718] dec a ld b, a - call Function3d6ca + call LoadEnemyPkmnToSwitchTo call Function3d7a0 call NewEnemyMonStatus call ResetEnemyStatLevels @@ -3305,12 +3312,12 @@ Function3d4c3: ; 3d4c3 Function3d4e1: ; 3d4e1 call Function3d714 jr nc, Function3d517 - call Function3d557 + call ResetEnemyBattleVars call Function3d533 jr c, .asm_3d4f1 - call Function3d599 + call FindPkmnInOTPartyToSwitchIntoBattle .asm_3d4f1 - call Function3d6ca + call LoadEnemyPkmnToSwitchTo call Function3d74b push af call Function3d7a0 @@ -3324,17 +3331,18 @@ Function3d4e1: ; 3d4e1 ld [wd0ec], a inc a ld [wEnemyIsSwitching], a - call Function309d + call LoadTileMapToTempTileMap jp Function3e3ad ; 3d517 Function3d517: ; 3d517 - call Function3d557 + call ResetEnemyBattleVars call Function3d533 jr c, .asm_3d522 - call Function3d599 + call FindPkmnInOTPartyToSwitchIntoBattle .asm_3d522 - call Function3d6ca + ; 'b' contains the PartyNr of the Pkmn the AI will switch to + call LoadEnemyPkmnToSwitchTo ld a, 1 ld [wEnemyIsSwitching], a call Function3d7a0 @@ -3343,6 +3351,7 @@ Function3d517: ; 3d517 ; 3d533 Function3d533: ; 3d533 +; returns carry if: ??? ld a, [wLinkMode] and a jr z, .asm_3d541 @@ -3356,6 +3365,7 @@ Function3d533: ; 3d533 ld a, [wc718] and a jr z, .asm_3d54b + dec a ld b, a jr .asm_3d555 @@ -3365,6 +3375,7 @@ Function3d533: ; 3d533 and a ld b, $0 jr nz, .asm_3d555 + and a ret @@ -3373,7 +3384,8 @@ Function3d533: ; 3d533 ret ; 3d557 -Function3d557: ; 3d557 +ResetEnemyBattleVars: ; 3d557 +; and draw empty TextBox xor a ld [LastEnemyCounterMove], a ld [LastPlayerCounterMove], a @@ -3387,7 +3399,7 @@ Function3d557: ; 3d557 ld a, $8 call Function3d490 call EmptyBattleTextBox - jp Function1d6e + jp LoadMenuDataHeader_0x1d75 ; 3d57a Function3d57a: ; 3d57a @@ -3406,7 +3418,7 @@ Function3d581: ; 3d581 predef_jump FlagPredef ; 3d599 -Function3d599: ; 3d599 +FindPkmnInOTPartyToSwitchIntoBattle: ; 3d599 ld b, $ff ld a, $1 ld [Buffer1], a @@ -3433,8 +3445,8 @@ Function3d599: ; 3d599 or c pop bc jr z, .asm_3d5d0 - call Function3d5d7 - call Function3d618 + call LookUpTheEffectivenessOfEveryMove + call IsThePlayerPkmnTypesEffectiveAgainstOTPkmn jr .asm_3d5a3 .asm_3d5d0 @@ -3443,7 +3455,7 @@ Function3d599: ; 3d599 jr .asm_3d5a3 ; 3d5d7 -Function3d5d7: ; 3d5d7 +LookUpTheEffectivenessOfEveryMove: ; 3d5d7 push bc ld hl, OTPartyMon1Moves ld a, b @@ -3467,11 +3479,11 @@ Function3d5d7: ; 3d5d7 ld a, BANK(Moves) call FarCopyBytes call SetEnemyTurn - callab Function347c8 + callab HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn pop bc pop de pop hl - ld a, [wd265] + ld a, [wd265] ; Get The Effectiveness Modifier cp 10 + 1 ; 1.0 + 0.1 jr c, .loop ld hl, Buffer1 @@ -3481,7 +3493,9 @@ Function3d5d7: ; 3d5d7 ret ; 3d618 -Function3d618: ; 3d618 +IsThePlayerPkmnTypesEffectiveAgainstOTPkmn: ; 3d618 +; Calculates the effectiveness of the types of the PlayerPkmn +; against the OTPkmn push bc ld hl, OTPartyCount ld a, b @@ -3501,13 +3515,13 @@ Function3d618: ; 3d618 ld a, [BattleMonType1] ld [wPlayerMoveStruct + MOVE_TYPE], a call SetPlayerTurn - callab Function347c8 + callab HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn ld a, [wd265] cp 10 + 1 ; 1.0 + 0.1 jr nc, .asm_3d663 ld a, [BattleMonType2] ld [wPlayerMoveStruct + MOVE_TYPE], a - callab Function347c8 + callab HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn ld a, [wd265] cp 10 + 1 ; 1.0 + 0.1 jr nc, .asm_3d663 @@ -3593,7 +3607,8 @@ Function3d672: ; 3d672 ret ; 3d6ca -Function3d6ca: ; 3d6ca +LoadEnemyPkmnToSwitchTo: ; 3d6ca + ; 'b' contains the PartyNr of the Pkmn the AI will switch to ld a, b ld [CurPartyMon], a ld hl, OTPartyMon1Level @@ -3610,6 +3625,7 @@ Function3d6ca: ; 3d6ca ld [TempEnemyMonSpecies], a ld [CurPartySpecies], a call LoadEnemyMon + ld a, [CurPartySpecies] cp UNOWN jr nz, .asm_3d708 @@ -3621,6 +3637,7 @@ Function3d6ca: ; 3d6ca ld a, [UnownLetter] ld [wdef4], a .asm_3d708 + ld hl, EnemyMonHP ld a, [hli] ld [wc6ea], a @@ -3726,7 +3743,7 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 call GetBaseData ld a, OTPARTYMON ld [MonType], a - predef Function5084a + predef CopyPkmnToTempMon call Function3f47c xor a @@ -3734,14 +3751,14 @@ Function_SetEnemyPkmnAndSendOutAnimation: ; 3d7c7 ld [wc689], a call SetEnemyTurn ld de, ANIM_SEND_OUT_MON - call Function3ee17 + call Call_PlayBattleAnim call Function3da79 jr nc, .asm_3d800 ld a, 1 ; shiny anim ld [wc689], a ld de, ANIM_SEND_OUT_MON - call Function3ee17 + call Call_PlayBattleAnim .asm_3d800 ld bc, TempMonSpecies @@ -3803,7 +3820,8 @@ ResetEnemyStatLevels: ; 3d867 ret ; 3d873 -Function3d873: ; 3d873 +CheckPlayerPartyForFitPkmn: ; 3d873 +; Has the player any Pkmn in his Party that can fight? ld a, [PartyCount] ld e, a xor a @@ -3853,9 +3871,10 @@ CheckIfPartyHasPkmnToBattleWith: ; 3d887 ; 3d8b3 -Function3d8b3: ; 3d8b3 +TryToRunAwayFromBattle: ; 3d8b3 +; Run away from battle, with or without item ld a, [BattleType] - cp $2 + cp BATTLETYPE_DEBUG jp z, .asm_3d9a2 cp BATTLETYPE_CONTEST jp z, .asm_3d9a2 @@ -3898,7 +3917,7 @@ Function3d8b3: ; 3d8b3 call SetPlayerTurn call GetItemName - ld hl, BattleText_0x80b89 + ld hl, BattleText_UserFledUsingAStringBuffer1 call StdBattleTextBox jp .asm_3d9a2 @@ -3915,7 +3934,7 @@ Function3d8b3: ; 3d8b3 ld [hStringCmpString1 + 0], a ld a, [de] ld [hStringCmpString1 + 1], a - call Function30b4 + call Call_LoadTempTileMapToTileMap ld de, hStringCmpString2 ld hl, hStringCmpString1 ld c, $2 @@ -3980,7 +3999,7 @@ Function3d8b3: ; 3d8b3 call StdBattleTextBox ld a, $1 ld [wd266], a - call Function309d + call LoadTileMapToTempTileMap and a ret @@ -3989,7 +4008,7 @@ Function3d8b3: ; 3d8b3 and a ld a, $2 jr z, .asm_3d9cf - call Function309d + call LoadTileMapToTempTileMap xor a ld [wd0ec], a ld a, $f @@ -3997,7 +4016,7 @@ Function3d8b3: ; 3d8b3 xor a ld [CurPlayerMove], a call Function3e8e4 - call Function30b4 + call Call_LoadTempTileMapToTileMap call Function3d2e0 jr c, .asm_3d9f5 @@ -4022,7 +4041,7 @@ Function3d8b3: ; 3d8b3 ld hl, BattleText_GotAwaySafely call StdBattleTextBox call WaitSFX - call Function309d + call LoadTileMapToTempTileMap scf ret @@ -4036,7 +4055,7 @@ Function3d8b3: ; 3d8b3 .asm_3da05 call WaitSFX - call Function309d + call LoadTileMapToTempTileMap scf ret ; 3da0d @@ -4200,7 +4219,7 @@ Function3db32: ; 3db32 call BreakAttraction call Function3db5f call EmptyBattleTextBox - call Function309d + call LoadTileMapToTempTileMap ld hl, EnemyMonHP ld a, [hli] or [hl] @@ -4237,13 +4256,13 @@ Function3db5f: ; 3db5f ld [wcfca], a ld [wc689], a ld de, ANIM_SEND_OUT_MON - call Function3ee17 + call Call_PlayBattleAnim call Function3da74 jr nc, .asm_3dbbc ld a, $1 ld [wc689], a ld de, ANIM_SEND_OUT_MON - call Function3ee17 + call Call_PlayBattleAnim .asm_3dbbc ld a, PartyMon1Species - PartyMon1 @@ -4327,7 +4346,7 @@ SpikesDamage: ; 3dc23 push bc - ld hl, BattleText_0x80bae ; "hurt by SPIKES!" + ld hl, BattleText_UserHurtBySpikes ; "hurt by SPIKES!" call StdBattleTextBox call GetEighthMaxHP @@ -4429,7 +4448,7 @@ Function3dce6: ; 3dce6 ld [hBattleTurn], a ld [wcfca], a ld de, ANIM_RETURN_MON - call Function3ee17 + call Call_PlayBattleAnim pop af ld [hBattleTurn], a ret @@ -4739,7 +4758,7 @@ endr ld [bc], a ld [de], a call GetItemName - ld hl, BattleText_0x80bde + ld hl, BattleText_UsersStringBuffer1Activated call StdBattleTextBox callab BattleCommand8c ret @@ -5108,17 +5127,17 @@ Function3e138: ; 3e138 BattleMenu: ; 3e139 xor a ld [hBGMapMode], a - call Function30bf + call LoadTempTileMapToTileMap ld a, [BattleType] - cp $2 + cp BATTLETYPE_DEBUG jr z, .ok cp BATTLETYPE_TUTORIAL jr z, .ok call EmptyBattleTextBox call UpdateBattleHuds call EmptyBattleTextBox - call Function309d + call LoadTileMapToTempTileMap .ok .loop @@ -5157,7 +5176,7 @@ BattleMenu: ; 3e139 BattleMenu_Fight: ; 3e192 xor a ld [wd267], a - call Function30b4 + call Call_LoadTempTileMapToTileMap and a ret ; 3e19b @@ -5197,7 +5216,7 @@ BattleMenu_Pack: ; 3e1c7 and a jp nz, ItemsCantBeUsed - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld a, [BattleType] cp BATTLETYPE_TUTORIAL @@ -5236,12 +5255,12 @@ BattleMenu_Pack: ; 3e1c7 call ExitMenu call WaitBGMap call Function3ee27 - call Function309d + call LoadTileMapToTempTileMap jp BattleMenu ; 3e22b ItemsCantBeUsed: ; 3e22b - ld hl, BattleText_0x80bf3 + ld hl, BattleText_ItemsCantBeUsedHere call StdBattleTextBox jp BattleMenu ; 3e234 @@ -5273,7 +5292,7 @@ Function3e234: ; 3e234 call ExitMenu call Function3df2c call WaitBGMap - call Function309d + call LoadTileMapToTempTileMap call ResetTextRelatedRAM call Function3ee27 and a @@ -5286,16 +5305,16 @@ Function3e234: ; 3e234 and $c0 ld [wBattleResult], a call ResetTextRelatedRAM - call Function32f9 + call SetPalettes scf ret ; 3e28d BattleMenu_PKMN: ; 3e28d - call Function1d6e + call LoadMenuDataHeader_0x1d75 Function3e290: call ExitMenu - call Function1d6e + call LoadMenuDataHeader_0x1d75 call WhiteBGMap Function3e299: call Function3d2fa @@ -5335,9 +5354,9 @@ Function3e299: call DelayFrame call Function3eda6 call WriteBackup - call Function309d + call LoadTileMapToTempTileMap call ClearSGB - call Function32f9 + call SetPalettes jp BattleMenu ; 3e2f5 @@ -5389,7 +5408,7 @@ Function3e358: ; 3e358 ld a, [CurPartyMon] cp d jr nz, .asm_3e36b - ld hl, BattleText_0x80c0d + ld hl, BattleText_PkmnIsAlreadyOut call StdBattleTextBox jp Function3e299 @@ -5402,7 +5421,7 @@ Function3e358: ; 3e358 jr z, .asm_3e381 .asm_3e378 - ld hl, BattleText_0x80c22 + ld hl, BattleText_PkmnCantBeRecalled call StdBattleTextBox jp Function3e299 @@ -5419,7 +5438,7 @@ Function3e358: ; 3e358 call Function3eda6 call WriteBackup call ClearSGB - call Function32f9 + call SetPalettes ld a, [CurPartyMon] ld [CurBattleMon], a ; fallthrough @@ -5431,7 +5450,7 @@ Function3e3ad: ; 3e3ad ld a, [wLinkMode] and a jr z, .asm_3e3c1 - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Function3e8e4 call WriteBackup @@ -5482,7 +5501,7 @@ Function3e3ff: ; 3e3ff ; 3e40b BattleMonEntrance: ; 3e40b - call Function3f2f4 + call BattleMonNickComma_TextBox ld c, 50 call DelayFrames @@ -5510,7 +5529,7 @@ BattleMonEntrance: ; 3e40b call BreakAttraction call Function3db5f call EmptyBattleTextBox - call Function309d + call LoadTileMapToTempTileMap call SetPlayerTurn call SpikesDamage ld a, $2 @@ -5532,22 +5551,22 @@ PassedBattleMonEntrance: ; 3e459 call Function3da0d xor a ld [wd265], a - call Function3ecab + call ApplyStatLevelMultiplierOnAllStats call Function3db5f call EmptyBattleTextBox - call Function309d + call LoadTileMapToTempTileMap call SetPlayerTurn jp SpikesDamage ; 3e489 BattleMenu_Run: ; 3e489 - call Function30b4 + call Call_LoadTempTileMapToTileMap ld a, $3 ld [wcfa9], a ld hl, BattleMonSpeed ld de, EnemyMonSpeed - call Function3d8b3 + call TryToRunAwayFromBattle ld a, $0 ld [wd266], a ret c @@ -5570,7 +5589,7 @@ CheckAmuletCoin: ; 3e4a8 ret ; 3e4bc -Function3e4bc: ; 3e4bc +MoveSelectionScreen: ; 3e4bc call IsMobileBattle jr nz, .asm_3e4c8 callba Function100b9f @@ -5761,16 +5780,16 @@ Function3e4bc: ; 3e4bc ret .asm_3e60b - ld hl, BattleText_0x80c5b + ld hl, BattleText_TheMoveIsDisabled jr .asm_3e613 .asm_3e610 - ld hl, BattleText_0x80c39 + ld hl, BattleText_TheresNoPPLeftForThisMove .asm_3e613 call StdBattleTextBox - call Function30b4 - jp Function3e4bc + call Call_LoadTempTileMapToTileMap + jp MoveSelectionScreen ; 3e61c .string_3e61c ; 3e61c @@ -5855,7 +5874,7 @@ endr .asm_3e69e xor a ld [wd0e3], a - jp Function3e4bc + jp MoveSelectionScreen .asm_3e6a5 push hl @@ -5882,7 +5901,7 @@ endr .asm_3e6bf ld a, [wcfa9] ld [wd0e3], a - jp Function3e4bc + jp MoveSelectionScreen ; 3e6c8 MoveInfoBox: ; 3e6c8 @@ -6026,7 +6045,7 @@ Function3e786: ; 3e786 ret nz .asm_3e7b4 - ld hl, BattleText_0x80c72 + ld hl, BattleText_PkmnHasNoMovesLeft call StdBattleTextBox ld c, 60 call DelayFrames @@ -6044,18 +6063,18 @@ Function3e7c1: ; 3e7c1 and a jr z, .asm_3e817 call EmptyBattleTextBox - call Function309d + call LoadTileMapToTempTileMap ld a, [wd0ec] and a call z, Function3e8e4 - call Function30b4 + call Call_LoadTempTileMapToTileMap ld a, [wBattleAction] cp $e jp z, .asm_3e8bd cp $d jp z, .asm_3e82c cp NUM_MOVES - jp nc, Function3e8c1 + jp nc, ResetVarsForSubstatusRage ld [CurEnemyMoveNum], a ld c, a ld a, [EnemySubStatus1] @@ -6083,8 +6102,8 @@ Function3e7c1: ; 3e7c1 jp .asm_3e87f .asm_3e824 - call Function3e8d1 - jp nz, Function3e8c1 + call CheckSubstatus_RechargeChargedRampageBideRollout + jp nz, ResetVarsForSubstatusRage jr .asm_3e830 .asm_3e82c @@ -6149,7 +6168,7 @@ Function3e7c1: ; 3e7c1 .asm_3e882 call SetEnemyTurn callab UpdateMoveData - call Function3e8d1 + call CheckSubstatus_RechargeChargedRampageBideRollout jr nz, .asm_3e894 xor a ld [wc733], a @@ -6185,7 +6204,7 @@ Function3e7c1: ; 3e7c1 jr .asm_3e87f ; 3e8c1 -Function3e8c1: ; 3e8c1 +ResetVarsForSubstatusRage: ; 3e8c1 xor a ld [EnemyFuryCutterCount], a ld [EnemyProtectCount], a @@ -6195,14 +6214,16 @@ Function3e8c1: ; 3e8c1 ret ; 3e8d1 -Function3e8d1: ; 3e8d1 +CheckSubstatus_RechargeChargedRampageBideRollout: ; 3e8d1 ld a, [EnemySubStatus4] and 1 << SUBSTATUS_RECHARGE ret nz + ld hl, EnemySubStatus3 ld a, [hl] and 1 << SUBSTATUS_CHARGED | 1 << SUBSTATUS_RAMPAGE | 1 << SUBSTATUS_BIDE ret nz + ld hl, EnemySubStatus1 bit SUBSTATUS_ROLLOUT, [hl] ret @@ -6498,7 +6519,7 @@ LoadEnemyMon: ; 3e8eb ld de, EnemyMonMaxHP ld b, $00 ld hl, LinkBattleRNs + 7 ; ? - predef Functione167 + predef CalcPkmnStats ; If we're in a trainer battle, ; get the rest of the parameters from the party struct @@ -6999,10 +7020,11 @@ Function3ec76: ; 3ec76 ret ; 3ecab -Function3ecab: ; 3ecab +ApplyStatLevelMultiplierOnAllStats: ; 3ecab +; Apply StatLevelMultipliers on all 5 Stats ld c, 0 .asm_3ecad - call Function3ecb7 + call ApplyStatLevelMultiplier inc c ld a, c cp 5 @@ -7010,7 +7032,7 @@ Function3ecab: ; 3ecab ret ; 3ecb7 -Function3ecb7: ; 3ecb7 +ApplyStatLevelMultiplier: ; 3ecb7 push bc push bc ld a, [wd265] @@ -7321,7 +7343,7 @@ Function3ee0f: ; 3ee0f ret nz ; 3ee17 -Function3ee17: ; 3ee17 +Call_PlayBattleAnim: ; 3ee17 ld a, e ld [FXAnimIDLo], a ld a, d @@ -7337,7 +7359,7 @@ Function3ee27: ; 3ee27 push hl ld b, $1 call GetSGBLayout - call Function32f9 + call SetPalettes call DelayFrame pop hl pop de @@ -7347,7 +7369,7 @@ Function3ee27: ; 3ee27 ; 3ee3b -Function3ee3b: ; 3ee3b +GiveExperiencePoints: ; 3ee3b ; Give experience. ld a, [wLinkMode] and a @@ -7479,7 +7501,7 @@ endr ld a, [CurPartyMon] ld hl, PartyMonNicknames call GetNick - ld hl, UnknownText_0x3f11b + ld hl, Text_PkmnGainedExpPoint call BattleTextBox ld a, [StringBuffer2 + 1] ld [$ffb6], a @@ -7488,7 +7510,7 @@ endr pop bc call Function3f136 push bc - call Function309d + call LoadTileMapToTempTileMap pop bc ld hl, $000a add hl, bc @@ -7549,7 +7571,7 @@ endr .asm_3ef74 xor a ; PARTYMON ld [MonType], a - predef Function5084a + predef CopyPkmnToTempMon callab Function50e1b pop bc ld hl, PartyMon1Level - PartyMon1 @@ -7585,7 +7607,7 @@ endr add hl, bc push bc ld b, $1 - predef Functione167 + predef CalcPkmnStats pop bc pop de ld hl, $0025 @@ -7635,12 +7657,12 @@ endr .asm_3f012 xor a ld [wd265], a - call Function3ecab + call ApplyStatLevelMultiplierOnAllStats callab Function3ec2c callab BadgeStatBoosts callab UpdatePlayerHUD call EmptyBattleTextBox - call Function309d + call LoadTileMapToTempTileMap ld a, $1 ld [hBGMapMode], a @@ -7654,14 +7676,14 @@ endr ld de, SFX_HIT_END_OF_EXP_BAR call PlaySFX call WaitSFX - ld hl, BattleText_0x80c9c + ld hl, BattleText_StringBuffer1GrewToLevel call StdBattleTextBox - call Function309d + call LoadTileMapToTempTileMap .asm_3f057 xor a ; PARTYMON ld [MonType], a - predef Function5084a + predef CopyPkmnToTempMon hlcoord 9, 0 ld b, $a ld c, $9 @@ -7672,7 +7694,7 @@ endr ld c, $1e call DelayFrames call Functiona80 - call Function30b4 + call Call_LoadTempTileMapToTileMap xor a ; PARTYMON ld [MonType], a ld a, [CurSpecies] @@ -7740,14 +7762,14 @@ Function3f0d4: ; 3f0d4 ld c, $7 .asm_3f0ef xor a - ld [hProduct], a + ld [hDividend + 0], a ld a, [hl] - ld [hMultiplicand], a + ld [hDividend + 1], a ld a, [wd265] - ld [hMultiplier], a + ld [hDivisor], a ld b, $2 call Divide - ld a, [$ffb6] + ld a, [hQuotient + 2] ld [hli], a dec c jr nz, .asm_3f0ef @@ -7771,30 +7793,30 @@ DoubleExp: ; 3f106 ret ; 3f11b -UnknownText_0x3f11b: ; 3f11b - text_jump UnknownText_0x1c029c +Text_PkmnGainedExpPoint: ; 3f11b + text_jump Text_Gained start_asm - ld hl, UnknownText_0x3f131 + ld hl, TextJump_StringBuffer2ExpPoints ld a, [StringBuffer2 + 2] ; IsTradedMon and a ret z - ld hl, UnknownText_0x3f12c + + ld hl, TextJump_ABoostedStringBuffer2ExpPoints ret ; 3f12c -UnknownText_0x3f12c: ; 3f12c - text_jump UnknownText_0x1c02a9 +TextJump_ABoostedStringBuffer2ExpPoints: ; 3f12c + text_jump Text_ABoostedStringBuffer2ExpPoints db "@" ; 3f131 -UnknownText_0x3f131: ; 3f131 - text_jump UnknownText_0x1c02c9 +TextJump_StringBuffer2ExpPoints: ; 3f131 + text_jump Text_StringBuffer2ExpPoints db "@" ; 3f136 Function3f136: ; 3f136 - push bc ld hl, CurPartyMon @@ -7816,7 +7838,7 @@ Function3f136: ; 3f136 ld [DefaultFlypoint], a xor a ; PARTYMON ld [MonType], a - predef Function5084a + predef CopyPkmnToTempMon ld a, [TempMonLevel] ld b, a ld e, a @@ -7899,7 +7921,7 @@ endr call PlaySFX callba Function8e79d call WaitSFX - ld hl, BattleText_0x80c9c + ld hl, BattleText_StringBuffer1GrewToLevel call StdBattleTextBox pop de inc e @@ -8080,17 +8102,19 @@ TextJump_BattleMonNick01: ; 3f2ef ; 3f2f4 -Function3f2f4: ; 3f2f4 - ld hl, UnknownText_0x3f2fa +BattleMonNickComma_TextBox: ; 3f2f4 + ld hl, TextJump_BattleMonNickComma jp BattleTextBox ; 3f2fa -UnknownText_0x3f2fa: ; 3f2fa - text_jump UnknownText_0x1c031d +TextJump_BattleMonNickComma: ; 3f2fa + text_jump Text_BattleMonNickComma start_asm ; 3f2ff Function3f2ff: ; 3f2ff +; Print text to withdraw Pkmn +; depending on HP the message is different push de push bc ld hl, EnemyMonHP + 1 @@ -8122,41 +8146,45 @@ Function3f2ff: ; 3f2ff pop bc pop de ld a, [hQuotient + 2] - ld hl, UnknownText_0x3f348 + ld hl, TextJump_ThatsEnoughComeBack and a ret z - ld hl, UnknownText_0x3f35b + + ld hl, TextJump_ComeBack cp $1e ret c - ld hl, UnknownText_0x3f34d + + ld hl, TextJump_OKComeBack cp $46 ret c - ld hl, UnknownText_0x3f352 + + ld hl, TextJump_GoodComeBack ret ; 3f348 -UnknownText_0x3f348: ; 3f348 - text_jump UnknownText_0x1c0324 +TextJump_ThatsEnoughComeBack: ; 3f348 + text_jump Text_ThatsEnoughComeBack db "@" ; 3f34d -UnknownText_0x3f34d: ; 3f34d - text_jump UnknownText_0x1c0340 +TextJump_OKComeBack: ; 3f34d + text_jump Text_OKComeBack db "@" ; 3f352 -UnknownText_0x3f352: ; 3f352 - text_jump UnknownText_0x1c0352 +TextJump_GoodComeBack: ; 3f352 + text_jump Text_GoodComeBack db "@" ; 3f357 -Function3f357: ; 3f357 - ld hl, UnknownText_0x3f35b +Function_TextJump_ComeBack: ; 3f357 +; this function doesn't seem to be used + ld hl, TextJump_ComeBack ret ; 3f35b -UnknownText_0x3f35b: ; 3f35b - text_jump UnknownText_0x1c0366 +TextJump_ComeBack: ; 3f35b + text_jump Text_ComeBack db "@" ; 3f360 @@ -8167,7 +8195,7 @@ Function3f360: ; 3f360 and a jr z, .asm_3f36d dec [hl] - ld hl, BattleText_0x80cba + ld hl, BattleText_WildPkmnIsEating jr .asm_3f388 .asm_3f36d @@ -8176,7 +8204,7 @@ Function3f360: ; 3f360 and a ret z dec [hl] - ld hl, BattleText_0x80cd1 + ld hl, BattleText_WildPkmnIsAngry jr nz, .asm_3f388 push hl ld a, [EnemyMonSpecies] @@ -8188,7 +8216,7 @@ Function3f360: ; 3f360 .asm_3f388 push hl - call Function30b4 + call Call_LoadTempTileMapToTileMap pop hl jp StdBattleTextBox ; 3f390 @@ -8743,7 +8771,7 @@ endr ld hl, wPayDayMoney + 2 ld de, Money + 2 call Function3d0be - ld hl, BattleText_0x80730 + ld hl, BattleText_PlayerPickuedUpPayDayMoney call StdBattleTextBox ld a, [InBattleTowerBattle] bit 0, a @@ -8863,7 +8891,7 @@ Function3f836: ; 3f836 call Function3200 ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes ld c, $8 call DelayFrames call Functiona80 @@ -9365,7 +9393,7 @@ Function3fb6c: ; 3fb6c call HideSprites ld b, $1 call GetSGBLayout - call Function32f9 + call SetPalettes ld a, $90 ld [hWY], a xor a @@ -9520,7 +9548,7 @@ BattleStartMessage: ; 3fc8b ld a, 1 ld [wc689], a ld de, ANIM_SEND_OUT_MON - call Function3ee17 + call Call_PlayBattleAnim .asm_3fcc2 callba CheckSleepingTreeMon diff --git a/battle/effect_command_pointers.asm b/battle/effect_command_pointers.asm index 8248955a8..23beebc16 100644 --- a/battle/effect_command_pointers.asm +++ b/battle/effect_command_pointers.asm @@ -8,7 +8,7 @@ BattleCommandPointers: ; 3fd28 dw BattleCommand04 ; 34555 dw BattleCommand05 ; 34631 dw BattleCommand06 ; 352dc - dw BattleCommand07 ; 346d2 + dw BattleCommand_CalcDamageTypeMultiplier ; 346d2 - 07 dw BattleCommand08 ; 34cfd dw BattleCommand09 ; 34d32 dw BattleCommand0a ; 34eee @@ -99,7 +99,7 @@ BattleCommandPointers: ; 3fd28 dw BattleCommand5f ; 377ce dw BattleCommand60 ; 3784b dw BattleCommand61 ; 37874 - dw BattleCommand62 ; 35612 + dw BattleCommand_DamageCalcWithStats ; 35612 - 62 dw BattleCommand63 ; 3790e dw BattleCommand64 ; 37939 dw BattleCommand65 ; 37972 @@ -148,7 +148,7 @@ BattleCommandPointers: ; 3fd28 dw BattleCommand90 ; 34ecc dw BattleCommand91 ; 34fdb dw BattleCommand92 ; 34fd1 - dw BattleCommand93 ; 34ffd + dw BattleCommand_SwitchTurn ; 34ffd - 93 dw BattleCommand94 ; 36a82 dw BattleCommand95 ; 37c1a dw BattleCommand96 ; 37c55 @@ -170,7 +170,7 @@ BattleCommandPointers: ; 3fd28 dw BattleCommanda6 ; 365af dw BattleCommanda7 ; 365c3 dw BattleCommanda8 ; 355b5 - dw BattleCommanda9 ; 355d5 + dw BattleCommand_IfAttackMissedResetDamage ; 355d5 - a9 dw BattleCommandaa ; 37e80 dw BattleCommandab ; 34f57 dw BattleCommandac ; 3658f diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index bd4e060f1..94f68d1ac 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -385,9 +385,9 @@ CantMove: ; 341f0 Function34216: ; 34216 - call SwitchTurn + call BattleCommand_SwitchTurn call CantMove - jp SwitchTurn + jp BattleCommand_SwitchTurn ; 3421f @@ -539,7 +539,7 @@ CheckEnemyTurn: ; 3421f ld hl, HurtItselfText call StdBattleTextBox call Function355dd - call BattleCommand62 + call BattleCommand_DamageCalcWithStats call BattleCommand0a xor a ld [wcfca], a @@ -652,7 +652,7 @@ HitConfusion: ; 343a5 ld [CriticalHit], a call Function355dd - call BattleCommand62 + call BattleCommand_DamageCalcWithStats call BattleCommand0a xor a @@ -1336,8 +1336,8 @@ BattleCommand4f: ; 346cd ; 346d2 -BattleCommand07: ; 346d2 -; stab +BattleCommand_CalcDamageTypeMultiplier: ; 346d2 +; STAB = Same Type Attack Bonus ld a, BATTLE_VARS_MOVE_ANIM call GetBattleVar cp STRUGGLE @@ -1354,7 +1354,7 @@ BattleCommand07: ; 346d2 ld a, [hBattleTurn] and a - jr z, .go + jr z, .go ; Who Attacks and who Defends ld hl, EnemyMonType1 ld a, [hli] @@ -1512,7 +1512,7 @@ endr jr .TypesLoop .end - call Function347c8 + call HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn ld a, [wd265] ld b, a ld a, [TypeModifier] @@ -1523,7 +1523,7 @@ endr ; 347c8 -Function347c8: ; 347c8 +HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn: ; 347c8 ld hl, EnemyMonType1 ld a, [hBattleTurn] and a @@ -1601,7 +1601,7 @@ Function347d3: ; 347d3 BattleCommanda3: ; 34833 - call Function347c8 + call HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn ld a, [wd265] and a ld a, 10 ; 1.0 @@ -2874,8 +2874,7 @@ BattleCommand91_92: ; 34feb ; 34ffd -SwitchTurn: ; 34ffd -BattleCommand93: ; 34ffd +BattleCommand_SwitchTurn: ; 34ffd ; switchturn ld a, [hBattleTurn] @@ -3248,7 +3247,7 @@ BattleCommand11: ; 351c0 predef Functionc6e0 call RefreshBattleHuds - call SwitchTurn + call BattleCommand_SwitchTurn xor a ld [wcfca], a ld [FXAnimIDHi], a @@ -3256,7 +3255,7 @@ BattleCommand11: ; 351c0 ld [wc689], a ld a, $c2 call Function37e44 - call SwitchTurn + call BattleCommand_SwitchTurn jr .asm_3524d ; 3522f $1c @@ -3307,10 +3306,10 @@ BattleCommand12: ; 35250 ret z ld [de], a - call SwitchTurn + call BattleCommand_SwitchTurn ld hl, RageBuildingText call StdBattleTextBox - jp SwitchTurn + jp BattleCommand_SwitchTurn ; 3527b @@ -3934,6 +3933,7 @@ BattleCommanda8: ; 355b5 ld a, [wc72d] and a ret nz + jp PrintButItFailed ; 355bd @@ -3954,14 +3954,14 @@ Function355bd: ; 355bd call GetPartyLocation pop bc ret -; 355d5 -BattleCommanda9: ; 355d5 +BattleCommand_IfAttackMissedResetDamage: ; 355d5 ; clearmissdamage ld a, [AttackMissed] and a ret z + jp ResetDamage ; 355dd @@ -4004,7 +4004,7 @@ endr ; 35612 -BattleCommand62: ; 35612 +BattleCommand_DamageCalcWithStats: ; 35612 ; damagecalc ; Return a damage value for move power d, player level e, enemy defense c and player attack b. @@ -4138,12 +4138,12 @@ endr ; Update CurDamage (capped at 997). ld hl, CurDamage ld b, [hl] - ld a, [$ffb6] + ld a, [hQuotient + 2] add b ld [$ffb6], a jr nc, .asm_356a5 - ld a, [$ffb5] + ld a, [hQuotient + 1] inc a ld [$ffb5], a and a @@ -4397,22 +4397,22 @@ BattleCommand3f: ; 35726 ld a, [hBattleTurn] and a ld a, [hl] - jr nz, .asm_357f8 + jr nz, .notPlayersTurn ld hl, wPlayerMoveStruct + MOVE_POWER ld [hl], a push hl call PlayerAttackDamage - jr .asm_35800 + jr .notEnemysTurn -.asm_357f8 +.notPlayersTurn ld hl, wEnemyMoveStruct + MOVE_POWER ld [hl], a push hl call EnemyAttackDamage -.asm_35800 - call BattleCommand62 +.notEnemysTurn + call BattleCommand_DamageCalcWithStats pop hl ld [hl], 1 ret @@ -4754,7 +4754,7 @@ BattleCommand44: ; 359e6 cp CURSE_T jr z, .asm_35a50 call AnimateCurrentMove - call SwitchTurn + call BattleCommand_SwitchTurn .asm_35a13 call BattleRandom @@ -4775,7 +4775,7 @@ BattleCommand44: ; 359e6 push hl ld a, d ld [hl], a - call Function347c8 + call HowEffectiveIsTheMovetypeAgainstTheEnemyPkmn pop hl pop af ld [hl], a @@ -4783,7 +4783,7 @@ BattleCommand44: ; 359e6 ld a, [wd265] cp $a jr nc, .asm_35a13 - call SwitchTurn + call BattleCommand_SwitchTurn ld a, [hl] ld [wd265], a @@ -5457,13 +5457,13 @@ Function35de0: ; 35de0 ld hl, SubFadedText call StdBattleTextBox - call SwitchTurn + call BattleCommand_SwitchTurn call BattleCommanda7 ld a, BATTLE_VARS_SUBSTATUS3 call GetBattleVar and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND call z, Function37ec7 - call SwitchTurn + call BattleCommand_SwitchTurn ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVarAddr @@ -6539,15 +6539,15 @@ Function3641a: ; 3641a and a jr z, .Player - call SwitchTurn + call BattleCommand_SwitchTurn call Function365d7 - call SwitchTurn + call BattleCommand_SwitchTurn jr .end .Player - call SwitchTurn + call BattleCommand_SwitchTurn call Function365fd - call SwitchTurn + call BattleCommand_SwitchTurn .end ld a, 1 and a @@ -6828,7 +6828,7 @@ Function365d7: ; 365d7 ld hl, BadgeStatBoosts call CallBattleCore - call SwitchTurn + call BattleCommand_SwitchTurn ld hl, Function3ec39 call CallBattleCore @@ -6836,7 +6836,7 @@ Function365d7: ; 365d7 ld hl, Function3ec76 call CallBattleCore - jp SwitchTurn + jp BattleCommand_SwitchTurn ; 365fd @@ -6848,7 +6848,7 @@ Function365fd: ; 365fd ld a, $5 call Function3661d - call SwitchTurn + call BattleCommand_SwitchTurn ld hl, Function3ec39 call CallBattleCore @@ -6856,7 +6856,7 @@ Function365fd: ; 365fd ld hl, Function3ec76 call CallBattleCore - jp SwitchTurn + jp BattleCommand_SwitchTurn ; 3661d @@ -7056,10 +7056,10 @@ BattleCommand3e: ; 3671a ld [de], a jr nz, .asm_3674c ; 36730 $1a res 1, [hl] - call SwitchTurn + call BattleCommand_SwitchTurn call Function37962 push af - call SwitchTurn + call BattleCommand_SwitchTurn pop af jr nz, .asm_3674c ; 3673f $b set 7, [hl] @@ -7202,7 +7202,7 @@ BattleCommand23: ; 3680f ld a, [BattleType] cp BATTLETYPE_SHINY jp z, .asm_36969 - cp $9 + cp BATTLETYPE_TRAP jp z, .asm_36969 cp BATTLETYPE_CELEBI jp z, .asm_36969 @@ -8823,10 +8823,10 @@ BattleCommand2c: ; 3713e call CallBattleCore .asm_371a9 call AnimateCurrentMove - call SwitchTurn + call BattleCommand_SwitchTurn ld hl, Function3ccef call CallBattleCore - call SwitchTurn + call BattleCommand_SwitchTurn call UpdateUserInParty call RefreshBattleHuds ld hl, RegainedHealthText @@ -9500,7 +9500,7 @@ BattleCommand61: ; 37874 push de .asm_3787d - call BattleCommand07 + call BattleCommand_CalcDamageTypeMultiplier ld a, [wLinkMode] cp $3 @@ -9544,7 +9544,7 @@ BattleCommand61: ; 37874 ld a, $3 ld [wc689], a call AnimateCurrentMove - call SwitchTurn + call BattleCommand_SwitchTurn ld hl, AICheckPlayerMaxHP ld a, [hBattleTurn] and a @@ -9557,18 +9557,18 @@ BattleCommand61: ; 37874 ld hl, GetQuarterMaxHP call CallBattleCore - call SwitchTurn + call BattleCommand_SwitchTurn ld hl, Function3ccef call CallBattleCore - call SwitchTurn + call BattleCommand_SwitchTurn ld hl, RegainedHealthText call StdBattleTextBox - call SwitchTurn + call BattleCommand_SwitchTurn call UpdateOpponentInParty jr .asm_37904 ; 378f1 $11 .asm_378f3 - call SwitchTurn + call BattleCommand_SwitchTurn call Function37ed5 jr nc, .asm_37904 ; 378f9 $9 call AnimateFailedMove @@ -9733,7 +9733,7 @@ BattleCommand67: ; 379c9 call DelayFrames ; Transition into switchmon menu - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba Function3d2f7 callba ForcePickSwitchMonInBattle @@ -9748,7 +9748,7 @@ BattleCommand67: ; 379c9 call ClearBox ld b, 1 call GetSGBLayout - call Function32f9 + call SetPalettes call BatonPass_LinkPlayerSwitch ; Mobile link battles handle entrances differently @@ -9789,7 +9789,7 @@ BattleCommand67: ; 379c9 call CallBattleCore ld a, 1 ld [wd265], a - ld hl, Function3ecab + ld hl, ApplyStatLevelMultiplierOnAllStats call CallBattleCore ld hl, SpikesDamage @@ -9807,7 +9807,7 @@ BatonPass_LinkPlayerSwitch: ; 37a67 ld a, 1 ld [wd0ec], a - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, Function3e8e4 call CallBattleCore call WriteBackup @@ -9823,7 +9823,7 @@ BatonPass_LinkEnemySwitch: ; 37a82 and a ret z - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, Function3e8e4 call CallBattleCore @@ -10094,11 +10094,11 @@ endr rst FarCall call AnimateCurrentMove - call SwitchTurn + call BattleCommand_SwitchTurn callab Function3ccef - call SwitchTurn + call BattleCommand_SwitchTurn call UpdateUserInParty ; 'regained health!' @@ -10596,11 +10596,11 @@ Function37e54: ; 37e54 push hl push de push bc - call SwitchTurn + call BattleCommand_SwitchTurn callab PlayBattleAnim - call SwitchTurn + call BattleCommand_SwitchTurn pop bc pop de pop hl diff --git a/battle/effects/curse.asm b/battle/effects/curse.asm index 65376a4aa..06706aba1 100644 --- a/battle/effects/curse.asm +++ b/battle/effects/curse.asm @@ -44,10 +44,10 @@ BattleCommand54: ; 37588 call AnimateCurrentMove ld a, $2 call Function36532 - call SwitchTurn + call BattleCommand_SwitchTurn call BattleCommand8d call ResetMiss - call SwitchTurn + call BattleCommand_SwitchTurn call BattleCommand70 call BattleCommand8c call ResetMiss diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index 3b7ffb139..d333a5114 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -6,9 +6,6 @@ MAX_BALLS EQU 12 MAX_KEY_ITEMS EQU 25 MAX_PC_ITEMS EQU 50 -LO_NYBBLE EQU $0f -HI_NYBBLE EQU $f0 - ; strings PLAYER_NAME_LENGTH EQU 8 PKMN_NAME_LENGTH EQU 11 diff --git a/engine/credits.asm b/engine/credits.asm index 5c0013e17..793891dd2 100644 --- a/engine/credits.asm +++ b/engine/credits.asm @@ -187,7 +187,7 @@ Function109847:: ; 109847 ld [hLCDStatCustom], a call GetCreditsPalette - call Function32f9 + call SetPalettes ld a, [hVBlank] push af ld a, $5 @@ -447,7 +447,7 @@ endr xor a ld [wcf64], a ; frame call GetCreditsPalette - call Function32f9 ; update hw pal registers + call SetPalettes ; update hw pal registers jr .loop .clear diff --git a/engine/diploma.asm b/engine/diploma.asm index f56e4ec00..eff2ff5f1 100644 --- a/engine/diploma.asm +++ b/engine/diploma.asm @@ -33,7 +33,7 @@ Function1dd709: ; 1dd709 call WaitBGMap ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes call DelayFrame ret ; 1dd760 diff --git a/engine/events.asm b/engine/events.asm index 1b937dcf0..5e64b62fd 100644 --- a/engine/events.asm +++ b/engine/events.asm @@ -1034,9 +1034,11 @@ DoRepelStep: ; 96bd7 ld a, [wRepelEffect] and a ret z + dec a ld [wRepelEffect], a ret nz + ld a, BANK(RepelWoreOffScript) ld hl, RepelWoreOffScript call CallScript diff --git a/engine/pack.asm b/engine/pack.asm index 0365dcfc7..c9168789d 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -164,7 +164,7 @@ MenuData2_0x1012c: ; 0x1012c Jumptable_10137: ; 10137 dw Function10159 - dw Function10492 + dw Function10492_ret ; 1013b MenuDataHeader_0x1013b: ; 0x1013b @@ -186,7 +186,7 @@ MenuData2_0x10143: ; 0x10143 Jumptable_10153: ; 10153 dw Function10159 dw Function103fd - dw Function10492 + dw Function10492_ret ; 10159 Function10159: ; 10159 @@ -330,7 +330,7 @@ Jumptable_1026a: ; 1026a dw Function103fd dw Function10364 dw Function103c2 - dw Function10492 + dw Function10492_ret ; 10274 MenuDataHeader_0x10274: ; 0x10274 @@ -354,7 +354,7 @@ Jumptable_10291: ; 10291 dw Function10311 dw Function103fd dw Function10364 - dw Function10492 + dw Function10492_ret ; 10299 MenuDataHeader_0x10299: ; 0x10299 @@ -374,7 +374,7 @@ MenuData2_0x102a1: ; 0x102a1 Jumptable_102ac: ; 102ac dw Function10311 - dw Function10492 + dw Function10492_ret ; 102b0 MenuDataHeader_0x102b0: ; 0x102b0 @@ -396,7 +396,7 @@ MenuData2_0x102b8: ; 0x102b8 Jumptable_102c7: ; 102c7 dw Function10311 dw Function103c2 - dw Function10492 + dw Function10492_ret ; 102cd MenuDataHeader_0x102cd: ; 0x102cd @@ -420,7 +420,7 @@ Jumptable_102ea: ; 102ea dw Function103fd dw Function10364 dw Function103c2 - dw Function10492 + dw Function10492_ret ; 102f2 MenuDataHeader_0x102f2: ; 0x102f2 @@ -442,7 +442,7 @@ MenuData2_0x102fa: ; 0x102fa Jumptable_1030b: ; 1030b dw Function103fd dw Function10364 - dw Function10492 + dw Function10492_ret ; 10311 Function10311: ; 10311 @@ -484,7 +484,7 @@ Function10311: ; 10311 call Function10a40 ret .NoPokemon - ld hl, UnknownText_0x10af8 + ld hl, TextJump_YouDontHaveAPkmn call Function10889 ret @@ -602,16 +602,19 @@ Function103fd: ; 103fd callba WritePartyMenuTilemap callba PrintPartyMenuText call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame callba PartyMenuSelect jr c, .asm_10475 + ld a, [CurPartySpecies] cp EGG jr nz, .asm_10453 - ld hl, UnknownText_0x1048d + + ld hl, TextJump_AnEGGCantHoldAnItem call PrintText jr .asm_10427 + .asm_10453 ld a, [wJumptableIndex] push af @@ -638,18 +641,18 @@ Function103fd: ; 103fd ret Function10486: ; 10486 (4:4486) - ld hl, UnknownText_0x10af8 + ld hl, TextJump_YouDontHaveAPkmn call Function10889 ret ; 1048d (4:448d) -UnknownText_0x1048d: ; 0x1048d +TextJump_AnEGGCantHoldAnItem: ; 0x1048d ; An EGG can't hold an item. - text_jump UnknownText_0x1c0b7f + text_jump Text_AnEGGCantHoldAnItem db "@" ; 0x10492 -Function10492: ; 10492 +Function10492_ret: ; 10492 ret ; 10493 @@ -1517,7 +1520,7 @@ Function10a40: ; 10a40 call WaitBGMap ld b, SCREEN_WIDTH call GetSGBLayout - call Function32f9 + call SetPalettes call DelayFrame ret ; 10a4f @@ -1660,9 +1663,9 @@ UnknownText_0x10af3: ; 0x10af3 db "@" ; 0x10af8 -UnknownText_0x10af8: ; 0x10af8 +TextJump_YouDontHaveAPkmn: ; 0x10af8 ; You don't have a #MON! - text_jump UnknownText_0x1c0c17 + text_jump Text_YouDontHaveAPkmn db "@" ; 0x10afd @@ -1690,9 +1693,10 @@ UnknownText_0x10b0c: ; 0x10b0c db "@" ; 0x10b11 -UnknownText_0x10b11: ; 0x10b11 - ; You can't use it in a battle. - text_jump UnknownText_0x1c0c85 +TextJump_YouCantUseItInABattle: ; 0x10b11 + ; Doesn't seem to be used anywhere + ; "You can't use it in a battle." + text_jump Text_YouCantUseItInABattle db "@" ; 0x10b16 diff --git a/engine/predef.asm b/engine/predef.asm index 748d14c49..9fa26875a 100644 --- a/engine/predef.asm +++ b/engine/predef.asm @@ -38,11 +38,11 @@ PredefPointers:: ; 856b add_predef FillPP add_predef TryAddMonToParty add_predef Functionda96 - add_predef Functiondb3f ; $8 + add_predef SentGetPkmnIntoFromBox add_predef SentPkmnIntoBox add_predef GiveEgg add_predef Functionc6e0 - add_predef Functione167 + add_predef CalcPkmnStats add_predef Functione17b add_predef CanLearnTMHMMove add_predef GetTMHMMove @@ -50,7 +50,7 @@ PredefPointers:: ; 856b add_predef PrintMoveDesc add_predef UpdatePlayerHUD add_predef FillBox - add_predef Function3d873 + add_predef CheckPlayerPartyForFitPkmn add_predef UpdateEnemyHUD add_predef StartBattle add_predef FillInExpBar @@ -61,7 +61,7 @@ PredefPointers:: ; 856b add_predef Function421e6 add_predef Function28f63 add_predef Function28f24 - add_predef Function5084a + add_predef CopyPkmnToTempMon add_predef ListMoves ; $20 add_predef Function50d2e add_predef Function50cdb diff --git a/engine/save.asm b/engine/save.asm index 549991207..fa9aeda12 100644 --- a/engine/save.asm +++ b/engine/save.asm @@ -1,5 +1,5 @@ Function14a1a: ; 14a1a - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba Function5e9a call SpeechTextBox call UpdateSprites diff --git a/event/kurt.asm b/event/kurt.asm index 6ed629d23..78dbd5aef 100644 --- a/event/kurt.asm +++ b/event/kurt.asm @@ -23,7 +23,7 @@ UnknownText_0x88013: ; 0x88013 ; 0x88018 Special_SelectApricornForKurt: ; 88018 - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld c, $1 xor a ld [wd0e4], a @@ -52,7 +52,7 @@ Special_SelectApricornForKurt: ; 88018 call Kurt_GiveUpSelectedQuantityOfSelectedApricorn .done - call Function1d7d + call Call_ExitMenu ret ; 88055 diff --git a/event/mom.asm b/event/mom.asm index 161b338ac..c6bf0da52 100644 --- a/event/mom.asm +++ b/event/mom.asm @@ -103,7 +103,7 @@ endr .AccessBankOfMom: ; 162a8 ld hl, UnknownText_0x1665d call PrintText - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, MenuDataHeader_0x166b5 call CopyMenuDataHeader call InterpretMenu2 @@ -148,7 +148,7 @@ endr ld [hl], a ld a, $5 ld [wcf64], a - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Function16517 call Function1656b call Function16571 @@ -216,7 +216,7 @@ endr ld [hl], a ld a, $5 ld [wcf64], a - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Function16512 call Function1656b call Function16571 diff --git a/event/move_deleter.asm b/event/move_deleter.asm index 40456f31a..88dd234af 100644 --- a/event/move_deleter.asm +++ b/event/move_deleter.asm @@ -19,7 +19,7 @@ MoveDeletion: jr z, .asm_2c5ca ld hl, UnknownText_0x2c5ea call PrintText - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba Function12f5b push af call Function2b74 diff --git a/home.asm b/home.asm index fca23f9f7..7aec18652 100644 --- a/home.asm +++ b/home.asm @@ -70,6 +70,7 @@ Function2ebb:: ; 2ebb ld a, [wc2cc] bit 1, a ret z + ld a, [hJoyDown] bit 1, a ; B_BUTTON ret @@ -212,7 +213,8 @@ HideSprites:: ; 3016 INCLUDE "home/copy2.asm" -Function309d:: ; 309d +LoadTileMapToTempTileMap:: ; 309d +; Load TileMap into TempTileMap ld a, [rSVBK] push af ld a, BANK(w2_d000) @@ -226,16 +228,17 @@ Function309d:: ; 309d ret ; 30b4 -Function30b4:: ; 30b4 +Call_LoadTempTileMapToTileMap:: ; 30b4 xor a ld [hBGMapMode], a - call Function30bf + call LoadTempTileMapToTileMap ld a, 1 ld [hBGMapMode], a ret ; 30bf -Function30bf:: ; 30bf +LoadTempTileMapToTileMap:: ; 30bf +; Load TempTileMap into TileMap ld a, [rSVBK] push af ld a, BANK(w2_d000) @@ -682,11 +685,12 @@ endr ; 32f9 - -Function32f9:: ; 32f9 +SetPalettes:: ; 32f9 +; Inits the Palettes +; depending on the system the monochromes palettes or color palettes ld a, [hCGB] and a - jr nz, .asm_3309 + jr nz, .SetPalettesForGameBoyColor ld a, $e4 ld [rBGP], a ld a, $d0 @@ -694,7 +698,7 @@ Function32f9:: ; 32f9 ld [rOBP1], a ret -.asm_3309 +.SetPalettesForGameBoyColor push de ld a, $e4 call DmgToCgbBGPals @@ -965,10 +969,10 @@ GetPokemonName:: ; 343b ld h, 0 ld l, a rept 2 - add hl, hl + add hl, hl ; hl = hl * 4 endr - add hl, de - add hl, hl + add hl, de ; hl = (hl*4) + de + add hl, hl ; hl = (5*hl) + (5*hl) ld de, PokemonNames add hl, de @@ -1165,7 +1169,7 @@ Function3524:: ; 3524 ld hl, VramState bit 0, [hl] jp nz, UpdateTimePals - jp Function32f9 + jp SetPalettes ; 352f Function352f:: ; 352f diff --git a/home/map.asm b/home/map.asm index 9ddb2f88e..07f6b468b 100644 --- a/home/map.asm +++ b/home/map.asm @@ -1957,7 +1957,7 @@ CheckStandingOnXYTrigger:: ; 2ae7 FadeToMenu:: ; 2b29 xor a ld [hBGMapMode], a - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba FadeBlackBGMap call ClearSprites call DisableSpriteUpdates @@ -1969,14 +1969,14 @@ Function2b3c:: ; 2b3c call WhiteBGMap call Function2bae call UpdateSprites - call Function1d7d + call Call_ExitMenu call Functiond90 jr Function2b5c ; 2b4d Function2b4d:: ; 2b4d call WhiteBGMap - call Function1d7d + call Call_ExitMenu call Function2bae call UpdateSprites call Functiond90 diff --git a/home/menu.asm b/home/menu.asm index c5aca06fe..a88545713 100644 --- a/home/menu.asm +++ b/home/menu.asm @@ -52,7 +52,7 @@ MenuTextBoxBackup:: ; 1d67 ret ; 1d6e -Function1d6e:: ; 1d6e +LoadMenuDataHeader_0x1d75:: ; 1d6e ld hl, MenuDataHeader_0x1d75 call LoadMenuDataHeader ret @@ -66,7 +66,7 @@ MenuDataHeader_0x1d75:: ; 1d75 db 1 ; default option ; 1d7d -Function1d7d:: ; 1d7d +Call_ExitMenu:: ; 1d7d call ExitMenu ret ; 1d81 diff --git a/home/serial.asm b/home/serial.asm index d5df52a23..1ebf00389 100644 --- a/home/serial.asm +++ b/home/serial.asm @@ -273,15 +273,15 @@ Function83b:: ; 83b ; 862 Function862:: ; 862 - call Function309d + call LoadTileMapToTempTileMap callab Function4000 call Function87d - jp Function30b4 + jp Call_LoadTempTileMapToTileMap ; 871 Function871:: ; 871 - call Function309d + call LoadTileMapToTempTileMap callab Function4000 jp Function87d ; 87d diff --git a/hram.asm b/hram.asm index 49e6864a3..150bffce4 100644 --- a/hram.asm +++ b/hram.asm @@ -89,7 +89,7 @@ hRandom EQU $ffe1 hRandomAdd EQU $ffe1 hRandomSub EQU $ffe2 hSecondsBackup EQU $ffe3 -hBattleTurn EQU $ffe4 +hBattleTurn EQU $ffe4 ; Which trainers turn is it? 0: Player, 1: Opponent Trainer hCGBPalUpdate EQU $ffe5 hCGB EQU $ffe6 hSGB EQU $ffe7 diff --git a/items/item_effects.asm b/items/item_effects.asm index 7503eeb2b..f7eeffce5 100644 --- a/items/item_effects.asm +++ b/items/item_effects.asm @@ -705,7 +705,7 @@ endr ld a, [BattleType] cp BATTLETYPE_TUTORIAL ret z - cp 2 + cp BATTLETYPE_DEBUG ret z cp BATTLETYPE_CONTEST jr z, .used_park_ball @@ -1143,13 +1143,13 @@ Functionedce: ; edce ld de, MUSIC_CAPTURE call PlayMusic pop bc - ld hl, UnknownText_0xede6 + ld hl, TextJump_Waitbutton ret ; ede6 -UnknownText_0xede6: ; 0xede6 +TextJump_Waitbutton: ; 0xede6 ; @ - text_jump UnknownText_0x1c5b35 + text_jump Text_Waitbutton_2 db "@" ; 0xedeb @@ -1262,7 +1262,7 @@ Calcium: ; ee3d ld bc, ITEM_NAME_LENGTH call CopyBytes - call Functionf780 + call Play_SFX_FULL_HEAL ld hl, UnknownText_0xeea6 call PrintText @@ -1288,7 +1288,7 @@ Functionee8c: ; ee8c ld a, PartyMon1HPExp - 1 - PartyMon1 call GetPartyParamLocation ld b, $1 - predef_jump Functione167 + predef_jump CalcPkmnStats ; ee9f Functionee9f: ; ee9f @@ -1427,7 +1427,7 @@ RareCandy: ; ef14 xor a ; PARTYMON ld [MonType], a - predef Function5084a + predef CopyPkmnToTempMon hlcoord 9, 0 ld b, 10 @@ -1518,7 +1518,7 @@ Functionefda: ; efda (3:6fda) ld a, b ld [PartyMenuActionText], a call Functionf030 - call Functionf780 + call Play_SFX_FULL_HEAL call Functionf279 call Functionf795 ld a, $0 @@ -1880,7 +1880,7 @@ Functionf21c: ; f21c (3:721c) callba WritePartyMenuTilemap callba PrintPartyMenuText call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame callba PartyMenuSelect ret @@ -1897,7 +1897,7 @@ Functionf24a: ; f24a (3:724a) callba WritePartyMenuTilemap callba Function50566 call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame pop bc pop de @@ -2256,16 +2256,17 @@ Repel: ; f46a Function_0xf46c: ; f46c ld a, [wRepelEffect] and a - ld hl, UnknownText_0xf47d + ld hl, TextJump_RepelUsedEarlierIsStillInEffect jp nz, PrintText + ld a, b ld [wRepelEffect], a jp Functionf789 -; f47d -UnknownText_0xf47d: ; 0xf47d + +TextJump_RepelUsedEarlierIsStillInEffect: ; 0xf47d ; The REPEL used earlier is still in effect. - text_jump UnknownText_0x1c5bcd + text_jump Text_RepelUsedEarlierIsStillInEffect db "@" ; 0xf482 @@ -2520,6 +2521,7 @@ Mysteryberry: ; f5bf ld [MiscBuffer2], a .loop + ; Party Screen opens to choose on which Pkmn to use the Item ld b, $1 call Functionf1f9 jp c, Functionf6e0 @@ -2531,11 +2533,11 @@ Mysteryberry: ; f5bf cp ELIXER jp z, Elixer_RestorePPofAllMoves - ld hl, UnknownText_0xf725 + ld hl, TextJump_RaiseThePPOfWhichMove ld a, [MiscBuffer2] cp PP_UP jr z, .ppup - ld hl, UnknownText_0xf72a + ld hl, TextJump_RestoreThePPOfWhichMove .ppup call PrintText @@ -2546,9 +2548,9 @@ Mysteryberry: ; f5bf ld [CurMoveNum], a ld a, $2 ld [wd235], a - callba Function3e4bc - + callba MoveSelectionScreen pop bc + ld a, b ld [CurMoveNum], a jr nz, .loop @@ -2561,8 +2563,8 @@ Mysteryberry: ; f5bf ld [wd265], a call GetMoveName call CopyName1 - pop hl + ld a, [MiscBuffer2] cp PP_UP jp nz, Functionf6a7 @@ -2574,24 +2576,25 @@ Mysteryberry: ; f5bf ld bc, $0015 add hl, bc ld a, [hl] - cp 3 << 6 + cp 3 << 6 ; have 3 PP Ups already been used? jr c, .do_ppup .CantUsePPUpOnSketch - ld hl, UnknownText_0xf72f +.pp_is_maxed_out + ld hl, TextJump_PPIsMaxedOut call PrintText jr .loop2 .do_ppup ld a, [hl] - add 1 << 6 + add 1 << 6 ; increase PP Up count by 1 ld [hl], a ld a, $1 ld [wd265], a call Functionf84c - call Functionf780 + call Play_SFX_FULL_HEAL - ld hl, UnknownText_0xf734 + ld hl, TextJump_PPsIncreased call PrintText Functionf64c: ; f64c @@ -2614,7 +2617,7 @@ Functionf652: ; f652 call .asm_f677 .asm_f66c - call Functionf780 + call Play_SFX_FULL_HEAL ld hl, UnknownText_0xf739 call PrintText jr Functionf64c @@ -2748,27 +2751,27 @@ RestorePP: ; f6e8 ret ; f725 -UnknownText_0xf725: ; 0xf725 +TextJump_RaiseThePPOfWhichMove: ; 0xf725 ; Raise the PP of which move? - text_jump UnknownText_0x1c5c8a + text_jump Text_RaiseThePPOfWhichMove db "@" ; 0xf72a -UnknownText_0xf72a: ; 0xf72a +TextJump_RestoreThePPOfWhichMove: ; 0xf72a ; Restore the PP of which move? - text_jump UnknownText_0x1c5ca7 + text_jump Text_RestoreThePPOfWhichMove db "@" ; 0xf72f -UnknownText_0xf72f: ; 0xf72f +TextJump_PPIsMaxedOut: ; 0xf72f ; 's PP is maxed out. - text_jump UnknownText_0x1c5cc6 + text_jump Text_PPIsMaxedOut db "@" ; 0xf734 -UnknownText_0xf734: ; 0xf734 +TextJump_PPsIncreased: ; 0xf734 ; 's PP increased. - text_jump UnknownText_0x1c5cdd + text_jump Text_PPsIncreased db "@" ; 0xf739 @@ -2925,7 +2928,7 @@ ItemB3: ; f77d ; f780 -Functionf780: ; f780 +Play_SFX_FULL_HEAL: ; f780 push de ld de, SFX_FULL_HEAL call WaitPlaySFX @@ -2936,7 +2939,7 @@ Functionf780: ; f780 Functionf789: ; f789 ld hl, UsedItemText call PrintText - call Functionf780 + call Play_SFX_FULL_HEAL call Functiona80 ; fallthrough ; f795 diff --git a/main.asm b/main.asm index ca7fbb04d..f45b61f9b 100644 --- a/main.asm +++ b/main.asm @@ -132,7 +132,7 @@ NewGame: ; 5b6b ld [wc2cc], a call ResetWRAM call Function5b44 - call Function5b8f + call AreYouABoyOrAreYouAGirl call OakSpeech call InitializeWorld ld a, 1 @@ -146,8 +146,8 @@ NewGame: ; 5b6b jp FinishContinueFunction ; 5b8f -Function5b8f: ; 5b8f - callba Function10632f +AreYouABoyOrAreYouAGirl: ; 5b8f + callba Function10632f ; some mobile stuff jr c, .ok callba InitGender ret @@ -415,7 +415,7 @@ Continue: ; 5d65 callba TryLoadSaveFile jr c, .FailToLoad callba Function150b9 - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Function5e85 ld a, $1 ld [hBGMapMode], a @@ -1587,7 +1587,7 @@ Function64db: ; 64db ; 6508 LearnMove: ; 6508 - call Function309d + call LoadTileMapToTempTileMap ld a, [CurPartyMon] ld hl, PartyMonNicknames call GetNick @@ -1749,7 +1749,7 @@ ForgetMove: ; 65d3 ld [wcfa7], a call Function1bc9 push af - call Function30b4 + call Call_LoadTempTileMapToTileMap pop af pop hl bit 1, a @@ -3192,7 +3192,7 @@ Function8000: ; 8000 ld a, $7 call ByteFill call Function3200 - call Function32f9 + call SetPalettes ret ; 8029 @@ -5197,7 +5197,7 @@ FlyFunction: ; ca3b .outdoors xor a ld [$ffde], a - call Function1d6e + call LoadMenuDataHeader_0x1d75 call ClearSprites callba _FlyMap ld a, e @@ -7931,6 +7931,7 @@ Functiond839: ; d839 TryAddMonToParty: ; d88c +; Check if to copy wild Pkmn or generate new Pkmn ; Whose is it? ld de, PartyCount ld a, [MonType] @@ -8198,12 +8199,15 @@ endr ld [de], a inc de ld hl, EnemyMonStatus + ; Copy EnemyMonStatus ld a, [hli] ld [de], a inc de + ; Copy EnemyMonUnused ld a, [hli] ld [de], a inc de + ; Copy EnemyMonHP ld a, [hli] ld [de], a inc de @@ -8216,17 +8220,18 @@ endr dec a jr nz, .generatestats ld hl, EnemyMonMaxHP - ld bc, 12 + ld bc, 2*6 ; MaxHP + 5 Stats call CopyBytes pop hl jr .next3 .generatestats pop hl - ld bc, $000a + ld bc, 2*5 ; 5 Stats add hl, bc - ld b, $0 - call Functione167 + ld b, $0 ; if b = 1, then the Stats of the Pkmn are calculated + ; only the current HP aren't set to MaxHP after this + call CalcPkmnStats .next3 ld a, [MonType] @@ -8248,6 +8253,7 @@ endr ret ; da6d + FillPP: ; da6d push bc ld b, NUM_MOVES @@ -8285,6 +8291,7 @@ Functionda96: ; da96 cp PARTY_LENGTH scf ret z + inc a ld [hl], a ld c, a @@ -8358,30 +8365,37 @@ Functionda96: ; da96 and a ret -; db3f -Functiondb3f: ; db3f + +SentGetPkmnIntoFromBox: ; db3f +; Sents/Gets Pkmn into/from Box depending on Parameter +; wd10b == 0: get Pkmn into Party +; wd10b == 1: sent Pkmn into Box + ld a, BANK(sBoxCount) call GetSRAMBank ld a, [wd10b] and a - jr z, .asm_db60 + jr z, .check_IfPartyIsFull cp $2 - jr z, .asm_db60 + jr z, .check_IfPartyIsFull cp $3 ld hl, wBreedMon1Species jr z, .asm_db9b + + ; we want to sent a Pkmn into the Box + ; so check if there's enough space ld hl, sBoxCount ld a, [hl] cp MONS_PER_BOX jr nz, .asm_db69 - jp Functiondcb1 + jp CloseSRAM_And_SetCFlag -.asm_db60 +.check_IfPartyIsFull ld hl, PartyCount ld a, [hl] cp PARTY_LENGTH - jp z, Functiondcb1 + jp z, CloseSRAM_And_SetCFlag .asm_db69 inc a @@ -8409,7 +8423,7 @@ Functiondb3f: ; db3f ld a, [sBoxCount] .asm_db97 - dec a + dec a ; PartyCount - 1 call AddNTimes .asm_db9b @@ -8512,7 +8526,7 @@ Functiondb3f: ; db3f srl a add $2 ld [MonType], a - predef Function5084a + predef CopyPkmnToTempMon callab Function50e1b ld a, d ld [CurPartyLevel], a @@ -8530,7 +8544,7 @@ Functiondb3f: ; db3f add hl, bc push bc ld b, $1 - call Functione167 + call CalcPkmnStats pop bc ld a, [wd10b] and a @@ -8575,7 +8589,7 @@ endr ret ; dcb1 -Functiondcb1: ; dcb1 +CloseSRAM_And_SetCFlag: ; dcb1 call CloseSRAM scf ret @@ -8583,7 +8597,6 @@ Functiondcb1: ; dcb1 Functiondcb6: ; dcb6 - ld a, b ld hl, sBoxMons ld bc, sBoxMon1End - sBoxMon1 @@ -8747,7 +8760,7 @@ Functiondd64: ; dd64 add hl, bc push bc ld b, $1 - call Functione167 + call CalcPkmnStats ld hl, PartyMon1Moves ld a, [PartyCount] dec a @@ -8891,8 +8904,9 @@ SentPkmnIntoBox: ; de6e ld [de], a inc de + ; Set all 5 Experience Values to 0 xor a - ld b, $a + ld b, 2*5 .asm_dee5 ld [de], a inc de @@ -8935,10 +8949,12 @@ SentPkmnIntoBox: ; de6e ld de, TempMonMoves ld bc, NUM_MOVES call CopyBytes + ld hl, sBoxMon1PP ld de, TempMonPP ld bc, NUM_MOVES call CopyBytes + ld b, 0 call Functiondcb6 @@ -8947,6 +8963,7 @@ SentPkmnIntoBox: ; de6e ret ; df42 + Functiondf42: ; df42 call CloseSRAM and a @@ -9061,7 +9078,7 @@ GiveEgg:: ; df8c dec a ld hl, PartyMonNicknames call SkipNames - ld de, Stringe035 + ld de, String_Egg call CopyName2 ld a, [PartyCount] dec a @@ -9088,12 +9105,11 @@ GiveEgg:: ; df8c ret ; e035 -Stringe035: ; e035 +String_Egg: ; e035 db "EGG@" ; e039 Functione039: ; e039 - ld hl, PartyCount ld a, [wd10b] @@ -9261,7 +9277,7 @@ Functione134: ; e134 ld a, PartyMon1Exp + 2 - PartyMon1 call GetPartyParamLocation ld b, $1 - call Functione167 + call CalcPkmnStats pop de ld a, PartyMon1HP - PartyMon1 call GetPartyParamLocation @@ -9273,7 +9289,12 @@ Functione134: ; e134 ret ; e167 -Functione167: ; e167 +CalcPkmnStats: ; e167 +; Calculates all 6 Stats of a Pkmn +; b = 0 or 1 +; 'c' counts from 1-6 and points with 'BaseStats' to the base value +; results in $ffb5 and $ffb6 are saved in [de] + ld c, $0 .asm_e169 inc c @@ -9291,14 +9312,16 @@ Functione167: ; e167 ; e17b Functione17b: ; e17b +; 'c' is 1-6 and points to the BaseStat + push hl push de push bc ld a, b ld d, a push hl - ld hl, BaseHP - dec hl + ld hl, BaseStats + dec hl ; has to be decreased, because 'c' begins with 1 ld b, $0 add hl, bc ld a, [hl] @@ -9669,6 +9692,7 @@ Functione3d4: ; e3d4 ret ; e3d9 + TextJump_WasSentToBillsPC: ; 0xe3d9 ; was sent to BILL's PC. text_jump Text_WasSentToBillsPC @@ -9677,7 +9701,7 @@ TextJump_WasSentToBillsPC: ; 0xe3d9 Functione3de: ; e3de push de - call Function1d6e + call LoadMenuDataHeader_0x1d75 call DisableSpriteUpdates pop de push de @@ -9718,7 +9742,7 @@ UnknownText_0xe417: ; 0xe417 Functione41c: ; e41c (3:641c) xor a ld [hBGMapMode], a ; $ff00+$d4 - call Function1d6e + call LoadMenuDataHeader_0x1d75 call ClearPCItemScreen ld hl, Options ld a, [hl] @@ -9748,7 +9772,7 @@ Functione443: ; e443 (3:6443) ld a, $1 .asm_e44b ld [wMenuCursorBuffer], a - call Function32f9 + call SetPalettes xor a ld [wcf76], a ld [hBGMapMode], a ; $ff00+$d4 @@ -9814,7 +9838,7 @@ Functione4cb: ; e4cb ; e4cd Functione4cd: ; e4cd - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba Function44781 jr nc, .asm_e4e0 ld hl, UnknownText_0xe4f9 @@ -9841,7 +9865,7 @@ UnknownText_0xe4f9: ; 0xe4f9 ; 0xe4fe Functione4fe: ; e4fe (3:64fe) - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba Functione2391 call Function222a call ClearPCItemScreen @@ -9917,7 +9941,7 @@ CheckCurPartyMonFainted: ; e538 Functione559: ; e559 (3:6559) - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba Functione2583 call Function222a call ClearPCItemScreen @@ -9968,7 +9992,7 @@ ClearPCItemScreen: ; e58b ld bc, $0412 call TextBox call Function3200 - call Function32f9 ; load regular palettes? + call SetPalettes ; load regular palettes? ret ; 0xe5bb @@ -10476,7 +10500,7 @@ Function116f8: ; 116f8 call Function1171d call WaitBGMap call WaitTop - call Function32f9 + call SetPalettes call Function11be0 ret ; 1171d @@ -12252,7 +12276,7 @@ Function124fa: ; 124fa Function1250a: ; 1250a ld b, $0 call GetSGBLayout - call Function32f9 + call SetPalettes ret ; 12513 @@ -12563,7 +12587,7 @@ endr .Clear ; 126b7 call WhiteBGMap - call Function1d7d + call Call_ExitMenu call Function2bae call .DrawMenuAccount_ call MenuFunc_1e7f @@ -12963,7 +12987,7 @@ StartMenu_Pokemon: ; 12976 callba WritePartyMenuTilemap callba PrintPartyMenuText call WaitBGMap - call Function32f9 ; load regular palettes? + call SetPalettes ; load regular palettes? call DelayFrame callba PartyMenuSelect jr c, .return ; if cancelled or pressed B @@ -13185,7 +13209,7 @@ SwitchPartyMons: ; 12aec call AddNTimes ld [hl], "▷" call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame callba PartyMenuSelect @@ -13234,7 +13258,7 @@ GiveTakePartyMonItem: ; 12b60 cp 1 jr nz, .asm_12ba0 - call Function1d6e + call LoadMenuDataHeader_0x1d75 call ClearPalettes call Function12ba9 call ClearPalettes @@ -13647,7 +13671,7 @@ MonMailAction: ; 12d45 OpenPartyStats: ; 12e00 - call Function1d6e + call LoadMenuDataHeader_0x1d75 call ClearSprites ; PartyMon xor a @@ -13655,7 +13679,7 @@ OpenPartyStats: ; 12e00 call LowVolume predef StatsScreenInit call MaxVolume - call Function1d7d + call Call_ExitMenu ld a, 0 ret ; 12e1b @@ -13826,19 +13850,19 @@ Function12f05: ; 12f05 ld a, PartyMon1MaxHP - PartyMon1 call GetPartyParamLocation ld a, [hli] - ld [hProduct], a + ld [hDividend + 0], a ld a, [hl] - ld [hMultiplicand], a + ld [hDividend + 1], a ld a, $5 - ld [hMultiplier], a + ld [hDivisor], a ld b, $2 call Divide ld a, PartyMon1HP + 1 - PartyMon1 call GetPartyParamLocation - ld a, [$ffb6] + ld a, [hQuotient + 2] sub [hl] dec hl - ld a, [$ffb5] + ld a, [hQuotient + 1] sbc [hl] ret ; 12f26 @@ -14209,7 +14233,7 @@ Function13172: ; 13172 hlcoord 5, 1 call PlaceString push bc - callba Function5084a + callba CopyPkmnToTempMon pop hl call PrintLevel ld hl, PlayerHPPal @@ -14226,7 +14250,7 @@ Function131ef: ; 131ef ld [hBGMapMode], a ld [wd0e3], a ld [MonType], a - predef Function5084a + predef CopyPkmnToTempMon ld hl, TempMonMoves ld de, wListMoves_MoveIndicesBuffer ld bc, NUM_MOVES @@ -14238,7 +14262,7 @@ Function131ef: ; 131ef hlcoord 10, 4 predef Function50c50 call WaitBGMap - call Function32f9 + call SetPalettes ld a, [wd0eb] inc a ld [wcfa3], a @@ -14707,7 +14731,7 @@ Function134c0: ; 134c0 ; 134dd Function134dd: ; 134dd - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, Elevator_WhichFloorText call PrintText call Elevator_GetCurrentFloorText @@ -15760,7 +15784,7 @@ Function13a47: ; unreferenced ld hl, PartyMon1Exp + 2 - PartyMon1 add hl, bc ld b, $1 - predef Functione167 + predef CalcPkmnStats pop hl ld bc, PartyMon2 - PartyMon1 add hl, bc @@ -18092,7 +18116,7 @@ UnknownText_0x157cc: ; 0x157cc ; 0x157d1 KrisWithdrawItemMenu: ; 0x157d1 - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba ClearPCItemScreen .asm_157da call Function15985 @@ -18171,7 +18195,7 @@ Function157e9: ; 0x157e9 KrisTossItemMenu: ; 0x1585f - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba ClearPCItemScreen .asm_15868 call Function15985 @@ -18208,7 +18232,7 @@ KrisDepositItemMenu: ; 0x1588b call Function158b8 jr c, .asm_158b6 call DisableSpriteUpdates - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba Function106a5 .asm_1589c callba Function106be @@ -18513,7 +18537,7 @@ MartDialog: ; 15a61 HerbShop: ; 15a6e call ReadMart - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, UnknownText_0x15e4a call Function15fcd call Function15c62 @@ -18527,7 +18551,7 @@ BargainShop: ; 15a84 ld de, BargainShopData call LoadMartPointer call Function15c25 - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, UnknownText_0x15e6d call Function15fcd call Function15c62 @@ -18546,7 +18570,7 @@ BargainShop: ; 15a84 Pharmacist: ; 15aae call ReadMart - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, UnknownText_0x15e90 call Function15fcd call Function15c62 @@ -18567,7 +18591,7 @@ RooftopSale: ; 15ac4 .ok call LoadMartPointer call Function15c25 - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, UnknownText_0x15f83 call Function15fcd call Function15c62 @@ -18652,7 +18676,7 @@ Function15b47: ; 15b47 ; 15b62 Function15b62: ; 15b62 - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, UnknownText_0x15f83 call PrintText ld a, $1 @@ -18705,7 +18729,7 @@ Function15ba3: ; 15ba3 ; 15baf Function15baf: ; 15baf - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, UnknownText_0x15fb9 call PrintText ld a, $1 @@ -20223,7 +20247,7 @@ Function169ac: ; 169ac pop hl push bc ld b, $0 - predef Functione167 + predef CalcPkmnStats pop bc ld hl, PartyMon1HP - PartyMon1 add hl, bc @@ -20513,7 +20537,7 @@ Function16be4: ; 16be4 ld b, $1c call GetSGBLayout - call Function32f9 + call SetPalettes .asm_16c6b call JoyTextDelay @@ -20940,7 +20964,7 @@ DoEggStep:: ; 16f3e OverworldHatchEgg:: ; 16f5e call ResetWindow - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Function16f70 call Function2b4d call RestartMapMusic @@ -21027,7 +21051,7 @@ Function16f7a: ; 16f7a (5:6f7a) ld bc, PartyMon1Exp + 2 - PartyMon1 add hl, bc ld b, $0 - predef Functione167 + predef CalcPkmnStats pop bc ld hl, PartyMon1MaxHP - PartyMon1 add hl, bc @@ -21421,7 +21445,7 @@ Function17254: ; 17254 (5:7254) predef FillBox pop af call Function17363 - call Function32f9 + call SetPalettes jp WaitBGMap Function1727f: ; 1727f (5:727f) @@ -21782,7 +21806,7 @@ Function20021: ; 20021 (8:4021) ld a, [hl] push af set 4, [hl] - call Function1d6e + call LoadMenuDataHeader_0x1d75 call ClearTileMap ld hl, UnknownText_0x2004c call PrintText @@ -24845,7 +24869,7 @@ Function2513b: ; 2513b (9:513b) call WaitBGMap ld b, $15 call GetSGBLayout - call Function32f9 + call SetPalettes call WaitBGMap ld hl, wJumptableIndex xor a @@ -26028,7 +26052,7 @@ Function2695b: ; 2695b ld d, 0 add hl, de ld [hl], -1 - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, MenuDataHeader_0x269c5 call CopyMenuDataHeader xor a @@ -27125,9 +27149,9 @@ Function2715c: ; 2715c callba Function3ed9f call ClearSGB call WriteBackup - call Function1d6e + call LoadMenuDataHeader_0x1d75 call WaitBGMap - jp Function32f9 + jp SetPalettes ; 27192 Function27192: ; 27192 @@ -28587,7 +28611,7 @@ Function2891c: ; 2891c ; 28926 Function28926: ; 28926 - call Function309d + call LoadTileMapToTempTileMap ld a, [wcfa9] push af hlcoord 0, 15 @@ -28628,7 +28652,7 @@ Function28926: ; 28926 .asm_28983 pop af ld [wcfa9], a - call Function30b4 + call Call_LoadTempTileMapToTileMap jp Function2888b .asm_2898d @@ -28666,7 +28690,7 @@ Function28926: ; 28926 ld [wd263], a callab Function50db9 callba Function4d319 - call Function30b4 + call Call_LoadTempTileMapToTileMap hlcoord 6, 1 ld bc, $0601 ld a, $7f @@ -28906,7 +28930,7 @@ Function28b87: ; 28b87 ld hl, UnknownText_0x28eb8 bccoord 1, 14 call PlaceWholeStringInBoxAtOnce - call Function1d6e + call LoadMenuDataHeader_0x1d75 hlcoord 10, 7 ld b, $3 ld c, $7 @@ -28935,7 +28959,7 @@ Function28b87: ; 28b87 callba Function4d354 call Function1bd3 push af - call Function1d7d + call Call_ExitMenu call Function3200 pop af bit 1, a @@ -29248,7 +29272,7 @@ Function28ef8: ; 28ef8 Function28eff: ; 28eff callba Function16d6a7 - call Function32f9 + call SetPalettes ret ; 28f09 @@ -32507,13 +32531,13 @@ Function2b9a6: ; 2b9a6 jr z, .asm_2b9d7 dec hl xor a - ld [hProduct], a + ld [hDividend + 0], a ld a, [hli] - ld [hMultiplicand], a + ld [hDividend + 1], a ld a, [hli] - ld [$ffb5], a + ld [hDividend + 2], a xor a - ld [$ffb6], a + ld [hDividend + 3], a ld a, [hli] ld b, a ld a, [hld] @@ -32521,13 +32545,13 @@ Function2b9a6: ; 2b9a6 rr a srl b rr a - ld [hMultiplier], a + ld [hDivisor], a ld b, $4 call Divide - ld a, [$ffb6] + ld a, [hQuotient + 2] add e ld e, a - ld a, [$ffb5] + ld a, [hQuotient + 1] adc d ld d, a dec hl @@ -32864,7 +32888,7 @@ _ShowLinkBattleParticipants: ; 2c1b2 callba Function2c10d ; no need to callba ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes ld a, $e4 ld [rOBP0], a ret @@ -33465,7 +33489,7 @@ Function2c80a: ; 2c80a callba WritePartyMenuTilemap callba PrintPartyMenuText call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame callba PartyMenuSelect push af @@ -35033,7 +35057,7 @@ endr push hl xor a ld [MonType], a - predef Function5084a + predef CopyPkmnToTempMon pop hl .asm_42230 @@ -35243,7 +35267,7 @@ endr ld hl, TempMonExp + 2 ld de, TempMonMaxHP ld b, $1 - predef Functione167 + predef CalcPkmnStats ld a, [CurPartyMon] ld hl, PartyMons @@ -35677,7 +35701,7 @@ AIChooseMove: ; 440ce ret nz ; No use picking a move if there's no choice. - callba Function3e8d1 + callba CheckSubstatus_RechargeChargedRampageBideRollout ret nz @@ -36487,7 +36511,7 @@ Function44781: ; 44781 _KrisMailBoxMenu: ; 0x447a0 call InitMail jr z, .nomail - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Function44806 jp WriteBackup @@ -36681,7 +36705,7 @@ Function4484a: ; 0x4484a callba WritePartyMenuTilemap callba PrintPartyMenuText call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame callba PartyMenuSelect jr c, .asm_44939 @@ -36901,7 +36925,7 @@ Function4802f: ; 4802f (12:402f) call PlaceString call Function48187 call Function3200 - call Function32f9 + call SetPalettes call Function1bc9 ld hl, wcfa9 ld b, [hl] @@ -38587,11 +38611,11 @@ Function48d4a: ; 48d4a (12:4d4a) Function48d94: ; 48d94 (12:4d94) xor a ld [hDividend + 0], a - ld [hQuotient], a ; $ff00+$b4 (aliases: hMultiplicand) + ld [hDividend + 1], a ; $ff00+$b4 (aliases: hMultiplicand) ld a, [hli] ld [hDividend + 0], a ld a, [hl] - ld [hQuotient], a ; $ff00+$b4 (aliases: hMultiplicand) + ld [hDividend + 1], a ; $ff00+$b4 (aliases: hMultiplicand) ld a, 100 ld [hDivisor], a ; $ff00+$b7 (aliases: hMultiplier) ld b, 2 @@ -38621,8 +38645,8 @@ InitGender: ; 48dcb (12:4dcb) call Function48e47 call Function48e64 call Function3200 - call Function32f9 - ld hl, UnknownText_0x48e0f + call SetPalettes + ld hl, TextJump_AreYouABoyOrAreYouAGirl call PrintText ld hl, .MenuDataHeader call LoadMenuDataHeader @@ -38652,9 +38676,9 @@ InitGender: ; 48dcb (12:4dcb) db "Girl@" ; 0x48e0f -UnknownText_0x48e0f: ; 0x48e0f +TextJump_AreYouABoyOrAreYouAGirl: ; 0x48e0f ; Are you a boy? Or are you a girl? - text_jump UnknownText_0x1c0ca3 + text_jump Text_AreYouABoyOrAreYouAGirl db "@" ; 0x48e14 @@ -39835,7 +39859,7 @@ MainMenu: ; 49cdc call Function49ed0 ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes ld hl, GameTimerPause res 0, [hl] call Function49da4 @@ -40216,7 +40240,7 @@ Function49f16: ; 49f16 hlcoord 1, 14 call PlaceString call Function3200 - call Function32f9 + call SetPalettes call Function1bc9 ld hl, wcfa9 ld b, [hl] @@ -40361,9 +40385,9 @@ Function4a098: ; 4a098 (12:6098) call Function1ff8 call Function1bee call WaitBGMap - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba Function89de0 - call Function1d7d + call Call_ExitMenu call Function49351 call Function4a485 pop bc @@ -40472,7 +40496,7 @@ Function4a149: ; 4a149 (12:6149) hlcoord 1, 14 call PlaceString callba Function104148 - call Function32f9 + call SetPalettes call Function1bc9 ld hl, wcfa9 ld b, [hl] @@ -40580,7 +40604,7 @@ Function4a28a: ; 4a28a (12:628a) call Function4a6d8 call Function1bee call WaitBGMap - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld a, $5 call GetSRAMBank ld a, [$aa4b] @@ -40610,7 +40634,7 @@ Function4a28a: ; 4a28a (12:628a) .asm_4a2df callba Function11765d call WhiteBGMap - call Function1d7d + call Call_ExitMenu call Functione5f scf ret @@ -40644,7 +40668,7 @@ Function4a28a: ; 4a28a (12:628a) .asm_4a338 call ExitMenu .asm_4a33b - call Function1d7d + call Call_ExitMenu callba Function104148 xor a ret @@ -40721,7 +40745,7 @@ Function4a39a: ; 4a39a call Function4a485 call Function4a492 call Function4a3aa - call Function32f9 + call SetPalettes ret ; 4a3a7 @@ -40901,7 +40925,7 @@ Function4a4c4: ; 4a4c4 (12:64c4) hlcoord 1, 16 call PlaceString call Function3200 - call Function32f9 + call SetPalettes call Function1bc9 ld hl, wcfa9 ld b, [hl] @@ -41545,7 +41569,7 @@ Function4a94e: ; 4a94e ld [wd019], a ld b, $14 call GetSGBLayout - call Function32f9 + call SetPalettes call Function4aa22 jr c, .asm_4a985 jr z, .asm_4a9a1 @@ -41676,7 +41700,7 @@ Function4aa34: ; 4aa34 callba PrintPartyMenuText call Function4aab6 call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame call Function4ab1a jr z, .asm_4aa66 @@ -44172,7 +44196,7 @@ Function4ddf2: ; 4ddf2 (13:5df2) call CopyBytes jr .asm_4de2a .asm_4de10 - callba Function5084a + callba CopyPkmnToTempMon ld a, [CurPartySpecies] cp EGG jr z, .asm_4de2a @@ -44426,7 +44450,7 @@ Function4dfb6: ; 4dfb6 (13:5fb6) ld hl, wcf64 bit 4, [hl] jr nz, .asm_4dfd6 - call Function32f9 + call SetPalettes ret .asm_4dfd6 call Function4e226 @@ -44739,14 +44763,14 @@ Function4e226: ; 4e226 (13:6226) jr .asm_4e246 .asm_4e238 call Function4e271 - call Function32f9 + call SetPalettes ret .asm_4e23f call Function4e253 - call Function32f9 + call SetPalettes ret .asm_4e246 - call Function32f9 + call SetPalettes call Function4e253 ld a, [CurPartySpecies] call PlayCry2 @@ -44930,7 +44954,7 @@ EggStatsScreen: ; 4e33a call PlaceString ld hl, wcf64 set 5, [hl] - call Function32f9 ; pals + call SetPalettes ; pals call DelayFrame hlcoord 0, 0 call Function3786 @@ -45573,7 +45597,7 @@ Function4e881: ; 4e881 ld hl, UnknownText_0x4e8bd call PrintText call Function3200 - call Function32f9 + call SetPalettes ret ; 4e8bd @@ -45613,7 +45637,7 @@ Function4e8c2: ; 4e8c2 ld [hSCX], a call EnableLCD call Function3200 - call Function32f9 + call SetPalettes ret ; 4e906 @@ -45931,7 +45955,7 @@ SelectMonFromParty: ; 50000 call WhiteBGMap call Function5003f call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame call PartyMenuSelect call Function2b74 @@ -45948,7 +45972,7 @@ Function5001d: ; 5001d call WaitBGMap ld b, $a call GetSGBLayout - call Function32f9 + call SetPalettes call DelayFrame call PartyMenuSelect call Function2b74 @@ -47004,7 +47028,7 @@ Function5067b: ; 5067b ld a, [PartyCount] cp [hl] jr nz, .asm_50682 - predef Function3d873 + predef CheckPlayerPartyForFitPkmn ld a, d ld [ScriptVar], a ret @@ -47302,10 +47326,13 @@ UnknownText_0x50845: ; 0x50845 db "@" ; 0x5084a -Function5084a: ; 5084a +CopyPkmnToTempMon: ; 5084a +; gets the BaseData of a Pkmn +; and copys the PkmnStructure to TempMon + ld a, [CurPartyMon] ld e, a - call Function508d5 + call GetPkmnSpecies ld a, [CurPartySpecies] ld [CurSpecies], a call GetBaseData @@ -47326,7 +47353,7 @@ Function5084a: ; 5084a .copywholestruct ld a, [CurPartyMon] call AddNTimes - ld de, TempMonSpecies + ld de, TempMon ld bc, PartyMon2 - PartyMon1 call CopyBytes @@ -47358,7 +47385,7 @@ Function50893: ; 50893 add hl, bc push bc ld b, $1 - predef Functione167 + predef CalcPkmnStats pop bc ld hl, TempMonHP - TempMon add hl, bc @@ -47390,7 +47417,10 @@ Function50893: ; 50893 ret ; 508d5 -Function508d5: ; 508d5 +GetPkmnSpecies: ; 508d5 +; [MonType] has the type of the Pkmn +; e = Nr. of Pkmn (i.e. [CurPartyMon]) + ld a, [MonType] and a ; PARTYMON jr z, .partymon @@ -47893,7 +47923,7 @@ Function50cdb: ; 50cdb call GetNick pop hl call PlaceString - call Function5084a + call CopyPkmnToTempMon pop hl ld a, [CurPartySpecies] cp EGG @@ -48114,15 +48144,15 @@ Function50e1b: ; 50e1b call Function50e47 push hl ld hl, TempMonExp + 2 - ld a, [$ffb6] + ld a, [hMultiplicand + 2] ld c, a ld a, [hld] sub c - ld a, [$ffb5] + ld a, [hMultiplicand + 1] ld c, a ld a, [hld] sbc c - ld a, [hMultiplicand] + ld a, [hMultiplicand + 0] ld c, a ld a, [hl] sbc c @@ -48159,15 +48189,15 @@ endr ld a, [hli] and $f - ld [hMultiplier], a + ld [hDivisor], a ld b, $4 call Divide - ld a, [hMultiplicand + 0] + ld a, [hQuotient + 0] push af - ld a, [hMultiplicand + 1] + ld a, [hQuotient + 1] push af - ld a, [hMultiplicand + 2] + ld a, [hQuotient + 2] push af call Function50eed @@ -48368,12 +48398,12 @@ Function50f62: ; 50f62 (14:4f62) ld bc, $30 call CopyBytes ld a, [Buffer2] ; wd1eb (aliases: MovementType) - ld hl, PartyMonOT ; wddff (aliases: PartyMonOT) + ld hl, PartyMonOT call SkipNames push hl call Function51036 ld a, [wd1ec] - ld hl, PartyMonOT ; wddff (aliases: PartyMonOT) + ld hl, PartyMonOT call SkipNames pop de push hl @@ -52550,11 +52580,11 @@ Function84560: ; 84560 ld [hl], $4 xor a ld [hBGMapMode], a - call Function309d + call LoadTileMapToTempTileMap callba Function16dac ld a, $0 call Function84419 - call Function30b4 + call Call_LoadTempTileMapToTileMap call Function84742 ld a, $9 ld [wcf65], a @@ -52582,7 +52612,7 @@ Function84560: ; 84560 pop af ld [hVBlank], a call Function84411 - call Function30b4 + call Call_LoadTempTileMapToTileMap xor a ld [rIF], a pop af @@ -52715,13 +52745,13 @@ Function84688: ; 84688 call Function84411 ld c, $c call DelayFrames - call Function309d + call LoadTileMapToTempTileMap xor a ld [hBGMapMode], a callba Function1dd7ae ld a, $3 call Function84419 - call Function30b4 + call Call_LoadTempTileMapToTileMap call Function84742 ld a, $9 ld [wcf65], a @@ -53492,7 +53522,7 @@ endr ld [hBGMapMode], a ld b, $1a call GetSGBLayout - call Function32f9 + call SetPalettes call Function86635 xor a ld [wc2c6], a @@ -53630,7 +53660,7 @@ Function86692: ; 86692 call WaitBGMap ld b, $1a call GetSGBLayout - call Function32f9 + call SetPalettes decoord 6, 5 ld c, $6 predef Functiond066e @@ -53791,7 +53821,7 @@ Function86810: ; 86810 ld [CurPartySpecies], a ld b, $1a call GetSGBLayout - call Function32f9 + call SetPalettes call Function86635 xor a ld [wc2c6], a @@ -58966,7 +58996,7 @@ Special_SetDayOfWeek: ; 90913 hlcoord 0, 12 lb bc, 4, 18 call TextBox - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld hl, UnknownText_0x90a3f call PrintText hlcoord 9, 3 @@ -59062,7 +59092,7 @@ Function909de: ; 909de ld a, [wd002] ld e, a ld d, 0 - ld hl, Unknown_909f2 + ld hl, WeekdaysStrings rept 2 add hl, de endr @@ -59074,7 +59104,7 @@ endr ret ; 909f2 -Unknown_909f2: ; 909f2 +WeekdaysStrings: ; 909f2 dw Sunday dw Monday dw Tuesday @@ -59134,13 +59164,13 @@ UnknownText_0x90a6c: ; 90a6c ld c, a decoord 1, 14 callba Function1dd6bb - ld hl, UnknownText_0x90a83 + ld hl, TextJump_DSTIsThatOK ret ; 90a83 (24:4a83) -UnknownText_0x90a83: ; 0x90a83 +TextJump_DSTIsThatOK: ; 0x90a83 ; DST, is that OK? - text_jump UnknownText_0x1c5fde + text_jump Text_DSTIsThatOK db "@" ; 0x90a88 @@ -59393,7 +59423,7 @@ Function90bea: ; 90bea (24:4bea) call Function90da8 ld b, $2 call GetSGBLayout - call Function32f9 + call SetPalettes ld a, [hCGB] and a ret z @@ -60777,7 +60807,7 @@ Function9191c: ; 9191c ld [wd005], a ld b, $2 call GetSGBLayout - call Function32f9 + call SetPalettes ld a, [hCGB] and a jr z, .asm_9198b @@ -61031,7 +61061,7 @@ _FlyMap: ; 91af3 call Function91c8f ld b, $2 call GetSGBLayout - call Function32f9 + call SetPalettes .loop call JoyTextDelay ld hl, hJoyPressed @@ -61453,7 +61483,7 @@ Function91d11: ; 91d11 call TownMapBGUpdate ld b, $2 call GetSGBLayout - call Function32f9 + call SetPalettes xor a ld [hBGMapMode], a xor a @@ -61963,7 +61993,7 @@ Function92311: ; 92311 ld [wd004], a ld b, $2 call GetSGBLayout - call Function32f9 + call SetPalettes .loop call JoyTextDelay ld hl, hJoyPressed @@ -65109,7 +65139,7 @@ ReadAnyMail: ; b9237 ld a, [wd1ec] ld e, a callba Function8cb4 - call Function32f9 + call SetPalettes xor a ld [hJoyPressed], a call Functionb929a @@ -66317,7 +66347,7 @@ DisplayCaughtContestMonStats: ; cc000 call WaitBGMap ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes ret ; cc0a7 @@ -69887,7 +69917,7 @@ BillsPCDepositFuncDeposit: ; e24a9 (38:64a9) ret BillsPCDepositFuncStats: ; e24c8 (38:64c8) - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Functione2f7e call ExitMenu call PCMonInfo @@ -69906,7 +69936,7 @@ BillsPCDepositFuncRelease: ; e24e0 (38:64e0) push af ld de, PCString_ReleasePKMN call Functione2a6e - call Function1d6e + call LoadMenuDataHeader_0x1d75 lb bc, 14, 11 call PlaceYesNoBox ld a, [wcfa9] @@ -70152,7 +70182,7 @@ endr ret .stats: ; e26c0 (38:66c0) - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Functione2f7e call ExitMenu call PCMonInfo @@ -70169,7 +70199,7 @@ endr jr c, .FailedRelease ld de, PCString_ReleasePKMN call Functione2a6e - call Function1d6e + call LoadMenuDataHeader_0x1d75 lb bc, 14, 11 call PlaceYesNoBox ld a, [wcfa9] @@ -70412,7 +70442,7 @@ Functione2887: ; e2887 ; e28a5 Functione28a5: ; e28a5 - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Functione2f7e call ExitMenu call PCMonInfo @@ -71528,7 +71558,7 @@ Functione2fd6: ; e2fd6 (38:6fd6) call Functione3357 ld hl, PartyMonNicknames call Functione3363 - ld hl, PartyMonOT ; wddff (aliases: PartyMonOT) + ld hl, PartyMonOT call Functione3376 ld hl, PartyMons ; wdcdf (aliases: PartyMon1, PartyMon1Species) ld bc, $30 @@ -71575,8 +71605,8 @@ Functione307c: ; e307c (38:707c) call GetNick ld a, $1 ld [wd10b], a - predef Functiondb3f - jr c, .asm_e30e4 + predef SentGetPkmnIntoFromBox + jr c, .asm_boxisfull xor a ld [wd10b], a callba Functione039 @@ -71605,7 +71635,8 @@ Functione307c: ; e307c (38:707c) call DelayFrames and a ret -.asm_e30e4 + +.asm_boxisfull ld de, PCString_BoxFull call Functione2a6e ld de, SFX_WRONG @@ -71629,7 +71660,7 @@ TryWithdrawPokemon: ; e30fa (38:70fa) call CloseSRAM xor a ld [wd10b], a - predef Functiondb3f + predef SentGetPkmnIntoFromBox jr c, .PartyFull ld a, $1 ld [wd10b], a @@ -71659,6 +71690,7 @@ TryWithdrawPokemon: ; e30fa (38:70fa) call DelayFrames and a ret + .PartyFull ld de, PCString_PartyFull call Functione2a6e @@ -71670,6 +71702,7 @@ TryWithdrawPokemon: ; e30fa (38:70fa) scf ret + Functione3180: ; e3180 (38:7180) hlcoord 0, 0 lb bc, 15, 8 @@ -72047,7 +72080,7 @@ PCString_NoReleasingEGGS: db "No releasing EGGS!@" ; e35aa Functione35aa: ; e35aa (38:75aa) - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Functione35e2 .loop xor a @@ -72409,7 +72442,7 @@ _OptionsMenu: ; e41d0 call WaitBGMap ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes .asm_e4217 call JoyTextDelay ld a, [hJoyPressed] @@ -72976,7 +73009,7 @@ Functione4579: ; e4579 call WaitBGMap ld b, $19 call GetSGBLayout - call Function32f9 + call SetPalettes ld c, 10 call DelayFrames callab Copyright @@ -76093,7 +76126,7 @@ Functionfb8c8: ; fb8c8 ld [TempMonDVs + 1], a ld b, $1c call GetSGBLayout - call Function32f9 + call SetPalettes ret ; fb8f1 @@ -78492,7 +78525,7 @@ DoMysteryGift: ; 1048ba (41:48ba) call WaitBGMap ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes pop de hlcoord 2, 8 ld a, d @@ -79793,7 +79826,7 @@ Function105153: ; 105153 (41:5153) call WaitBGMap ld b, $1d call GetSGBLayout - call Function32f9 + call SetPalettes ret Function10522e: ; 10522e (41:522e) @@ -79971,7 +80004,7 @@ Function105777: ; 105777 (41:5777) call WaitBGMap ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes ret Function10578c: ; 10578c (41:578c) @@ -80096,7 +80129,7 @@ Function1057d7: ; 1057d7 (41:57d7) call WaitBGMap ld b, $2 callba Function4930f - jp Function32f9 + jp SetPalettes Function1058c6: ; 1058c6 (41:58c6) ld b, $6 @@ -81231,10 +81264,11 @@ endr ld [$ffbb], a ret -Function1062f7 +Function1062f7: ld a, [$ffbc] bit 7, a ret z + ld [hl], $f6 ret ; 1062ff @@ -81869,7 +81903,7 @@ Function1dc381: ; 1dc381 xor a ld [MonType], a - callba Function5084a + callba CopyPkmnToTempMon hlcoord 0, 7 ld b, $9 ld c, $12 @@ -81940,7 +81974,7 @@ Function1dc381: ; 1dc381 call WaitBGMap ld b, $3 call GetSGBLayout - call Function32f9 + call SetPalettes ret ; 1dc47b @@ -81953,7 +81987,7 @@ Function1dc47b: ; 1dc47b call LoadFontsBattleExtra xor a ld [MonType], a - callba Function5084a + callba CopyPkmnToTempMon hlcoord 0, 0 ld b, 15 ld c, 18 @@ -81992,7 +82026,7 @@ Function1dc47b: ; 1dc47b call WaitBGMap ld b, $3 call GetSGBLayout - call Function32f9 + call SetPalettes ret ; 1dc507 @@ -82134,18 +82168,18 @@ Function1dd6bb: ; 1dd6bb (77:56bb) lb bc, PRINTNUM_LEADINGZEROS | 1, 2 call PrintNum pop bc - ld de, String_1dd6fc + ld de, String_AM pop af jr c, .asm_1dd6f7 - ld de, String_1dd6ff + ld de, String_PM .asm_1dd6f7 inc hl call PlaceString ret ; 1dd6fc (77:56fc) -String_1dd6fc: db "AM@" -String_1dd6ff: db "PM@" +String_AM: db "AM@" ; 1dd6fc +String_PM: db "PM@" ; 1dd6ff ; 1dd702 diff --git a/misc/crystal_misc.asm b/misc/crystal_misc.asm index 0c833295b..cb152cefd 100644 --- a/misc/crystal_misc.asm +++ b/misc/crystal_misc.asm @@ -51,7 +51,7 @@ Function17a6a8: ; 17a6a8 (5e:66a8) call Function17abcf callba Function49409 callba Function49420 - call Function32f9 + call SetPalettes call DelayFrame ret @@ -430,7 +430,7 @@ Function17a91e: ; 17a91e (5e:691e) ret .asm_17a92c - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Function17a99e ld hl, $d088 set 7, [hl] diff --git a/misc/mobile_22.asm b/misc/mobile_22.asm index 796fd9d6f..716ad50a3 100644 --- a/misc/mobile_22.asm +++ b/misc/mobile_22.asm @@ -655,7 +655,7 @@ Function894ca: ; 894ca (22:54ca) call Function895c7 call Function8949c call Function8a60d - call Function32f9 + call SetPalettes pop bc ret @@ -1307,7 +1307,7 @@ Function89844: ; 89844 call Function897af push bc call Function3200 - call Function32f9 + call SetPalettes pop bc ret ; 89856 @@ -1816,9 +1816,9 @@ Function89b28: ; 89b28 (22:5b28) call Function891de call WhiteBGMap call Function893e2 - call Function1d7d + call Call_ExitMenu call Function891ab - call Function32f9 + call SetPalettes ret Function89b3b: ; 89b3b (22:5b3b) @@ -2167,7 +2167,7 @@ Function89d0d: ; 89d0d (22:5d0d) call CopyBytes pop af ld [rSVBK], a ; $ff00+$70 - call Function32f9 + call SetPalettes callba Function845db call Function89240 ld c, $18 @@ -2373,7 +2373,7 @@ Function89e6f: ; 89e6f (22:5e6f) hlcoord 10, 4, AttrMap call Function8a5a3 call Function891ab - call Function32f9 + call SetPalettes jp Function89e36 Function89e9a: ; 89e9a (22:5e9a) @@ -2410,7 +2410,7 @@ Function89eb9: ; 89eb9 (22:5eb9) hlcoord 10, 4, AttrMap call Function8a5a3 call Function891ab - call Function32f9 + call SetPalettes jp Function89e36 Function89ee1: ; 89ee1 (22:5ee1) @@ -2591,7 +2591,7 @@ Function89fce: ; 89fce (22:5fce) hlcoord 10, 4, AttrMap call Function8a5a3 call Function89448 - call Function32f9 + call SetPalettes call Function891ab jp Function89e36 @@ -2927,7 +2927,7 @@ UnknownText_0x8a23c: ; 0x8a23c ; 0x8a241 Function8a241: ; 8a241 (22:6241) - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Function891fe call Function8a262 jr nc, .asm_8a254 @@ -2938,7 +2938,7 @@ Function8a241: ; 8a241 (22:6241) .asm_8a254 call Function891de call WhiteBGMap - call Function1d7d + call Call_ExitMenu call Function891de and a ret @@ -2965,7 +2965,7 @@ Function8a262: ; 8a262 (22:6262) call Function8b36c call Function8b493 call Function891ab - call Function32f9 + call SetPalettes call Function8b5e7 ret @@ -3063,7 +3063,7 @@ Function8a31c: ; 8a31c (22:631c) call Function8a4d3 call Function8a4fc call Function891ab - call Function32f9 + call SetPalettes call Function8a383 jr c, .asm_8a370 jr z, .asm_8a34e @@ -3455,7 +3455,7 @@ Palette_8a624: ; 8a624 ; 8a62c Function8a62c: ; 8a62c (22:662c) - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Function891fe xor a call Function8b94a @@ -3885,7 +3885,7 @@ Function8a999: ; 8a999 (22:6999) jr c, .asm_8a9bb push bc push de - call Function1d6e + call LoadMenuDataHeader_0x1d75 pop de dec e ld a, e @@ -4141,7 +4141,7 @@ Function8ab77: ; 8ab77 (22:6b77) Function8ab93: ; 8ab93 (22:6b93) call WhiteBGMap - call Function1d6e + call LoadMenuDataHeader_0x1d75 callba Function105688 call ClearSprites call Function891fe diff --git a/misc/mobile_22_2.asm b/misc/mobile_22_2.asm index 685de8af3..d8e60e6a6 100644 --- a/misc/mobile_22_2.asm +++ b/misc/mobile_22_2.asm @@ -581,7 +581,7 @@ Function8b677: ; 8b677 call Function8b6ed call EnableLCD call Function891ab - call Function32f9 + call SetPalettes ret ; 8b690 diff --git a/misc/mobile_40.asm b/misc/mobile_40.asm index 8e9c9481e..ed0dc48d7 100644 --- a/misc/mobile_40.asm +++ b/misc/mobile_40.asm @@ -1615,6 +1615,7 @@ Function100a09: ; 100a09 ld a, [wLinkMode] cp $4 jr nz, .asm_100a2a + call Function100a87 call Function100da5 callba Function3ee27 @@ -1941,15 +1942,15 @@ endr ret .asm_100c63 - ld hl, BattleText_0x80c5b + ld hl, BattleText_TheMoveIsDisabled jr .asm_100c6b .asm_100c68 - ld hl, BattleText_0x80c39 + ld hl, BattleText_TheresNoPPLeftForThisMove .asm_100c6b call StdBattleTextBox - call Function30b4 + call Call_LoadTempTileMapToTileMap jp Function100bc2 ; 100c74 @@ -3015,7 +3016,7 @@ Function10138b: ; 10138b Function1013aa: ; 1013aa call WhiteBGMap - call Function1d7d + call Call_ExitMenu call Function2bae callba Function106464 call UpdateSprites @@ -4482,7 +4483,7 @@ Unknown_101d8d: ; 101d8d Function101d95: ; 101d95 call Function101ee2 - call Function1d6e + call LoadMenuDataHeader_0x1d75 ld e, $e call Function101ee4 ld hl, wcd29 @@ -6255,7 +6256,7 @@ Jumptable_1029cb: ; 1029cb ; 1029cf Function1029cf: ; 1029cf - call Function1d6e + call LoadMenuDataHeader_0x1d75 hlcoord 10, 7 ld b, $3 ld c, $8 @@ -6793,7 +6794,7 @@ Function102dec: ; 102dec ld a, $5 call FarCopyWRAM callba Function49742 - call Function32f9 + call SetPalettes call DelayFrame ret ; 102e07 diff --git a/misc/mobile_45.asm b/misc/mobile_45.asm index 8ea7bdc72..2d54431d3 100644 --- a/misc/mobile_45.asm +++ b/misc/mobile_45.asm @@ -5789,7 +5789,7 @@ Function116294: ; 116294 ld de, Unkn1Pals + 8 * 7 ld bc, $0008 call CopyBytes - call Function32f9 + call SetPalettes pop af ld [rSVBK], a ld a, $30 @@ -5810,7 +5810,7 @@ Function1162cb: ; 1162cb ld de, wd050 ld bc, $0030 call CopyBytes - call Function32f9 + call SetPalettes pop af ld [rSVBK], a ret @@ -5917,7 +5917,7 @@ Function11636e: ; 11636e call CopyBytes pop af ld [rSVBK], a - call Function32f9 + call SetPalettes ld a, [rSVBK] push af ld a, $1 @@ -5967,7 +5967,7 @@ Function1163c0: ; 1163c0 call CopyBytes pop af ld [rSVBK], a - call Function32f9 + call SetPalettes call DelayFrame ld a, $90 ld [hWY], a @@ -14155,7 +14155,7 @@ Function11a9c0: ; 11a9c0 Function11a9ce: ; 11a9ce call WhiteBGMap call Function2bae - call Function1d7d + call Call_ExitMenu callba Function106462 callba Function106464 call Functiond90 @@ -14937,7 +14937,7 @@ Function11b082: ; 11b082 call Function11b099 call Function11b295 call Function11b275 - call Function32f9 + call SetPalettes jp Function11ad8a ; 11b099 @@ -15686,7 +15686,7 @@ Function11b483: ; 11b483 pop de push de ld b, $1 - predef Functione167 + predef CalcPkmnStats pop de ld h, d ld l, e @@ -16102,7 +16102,7 @@ Function11b6b4: ; 11b6b4 ld hl, $c616 + 1 ld de, $c62c + 5 ld b, $1 - predef Functione167 + predef CalcPkmnStats ld de, $c62c + 5 ld hl, $c62c + 3 ld a, [de] @@ -16875,7 +16875,7 @@ Function11c1ca: ; 11c1ca call ClearSprites call ClearScreen call Function11d323 - call Function32f9 + call SetPalettes call DisableLCD ld hl, GFX_11d67e ld de, VTiles2 @@ -21659,7 +21659,7 @@ endr cp $8 jr nz, .asm_16c969 callba Function96a4 - call Function32f9 + call SetPalettes ld a, [rSVBK] push af ld a, $1 @@ -21762,7 +21762,7 @@ endr cp $8 jr nz, .asm_16ca28 callba Function96a4 - call Function32f9 + call SetPalettes ld a, [rSVBK] push af ld a, $1 @@ -22177,7 +22177,7 @@ Function16d42e: ; 16d42e ; 16d43b Function16d43b: ; 16d43b - call Function1d6e + call LoadMenuDataHeader_0x1d75 call WhiteBGMap call ClearTileMap call ClearSprites @@ -22185,10 +22185,10 @@ Function16d43b: ; 16d43b callba Function16d42e ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes call WaitBGMap call JoyWaitAorB - call Function1d7d + call Call_ExitMenu ret ; 16d465 @@ -22327,10 +22327,10 @@ Function16d6ca: ; 16d6ca ; 16d6ce Function16d6ce: ; 16d6ce - call Function1d6e + call LoadMenuDataHeader_0x1d75 call Function16d6e1 callba Function87d - call Function1d7d + call Call_ExitMenu call Function3200 ret ; 16d6e1 @@ -23076,7 +23076,7 @@ endr ld hl, $000a add hl, bc ld b, $1 - predef Functione167 + predef CalcPkmnStats pop de pop hl rept 2 @@ -23293,7 +23293,7 @@ Function170525: ; 170525 Function170571: - call Function32f9 + call SetPalettes call Function1705b2 @@ -24906,7 +24906,7 @@ Function171ccd: ; 171ccd (5c:5ccd) ld [hli], a ld a, $7f ld [hl], a - call Function32f9 + call SetPalettes pop af ld [rSVBK], a ; $ff00+$70 ret @@ -25068,7 +25068,7 @@ Function172eb9: ld de, BGPals ld bc, $40 call CopyBytes - call Function32f9 + call SetPalettes pop af ld [rSVBK], a ; $ff00+$70 ret diff --git a/misc/mobile_5f.asm b/misc/mobile_5f.asm index 82091ab7a..66d696729 100644 --- a/misc/mobile_5f.asm +++ b/misc/mobile_5f.asm @@ -706,7 +706,7 @@ Function17d405: ld de, Unkn1Pals ld bc, $0040 call CopyBytes - call Function32f9 + call SetPalettes pop af ld [rSVBK], a ret @@ -938,7 +938,7 @@ endr ; 17d5be Function17d5be: ; 17d5be - call Function32f9 + call SetPalettes call Function17e438 Function17d5c4: @@ -1508,7 +1508,7 @@ Function17d93a: ; 17d93a ld a, [wc70c] ld e, a callba Function8bc6 - call Function32f9 + call SetPalettes ld a, [wc708] ld l, a ld a, [wc709] @@ -1544,7 +1544,7 @@ Function17d98b: ; 17d98b ld a, [wc70b] ld e, a callba Function8bbd - call Function32f9 + call SetPalettes ld a, [wc708] ld e, a ld a, [wc709] @@ -2465,7 +2465,7 @@ endr ld e, l push hl ld b, $0 - callba Functione167 + callba CalcPkmnStats ld a, [PartyCount] dec a ld hl, PartyMon1HP @@ -4764,7 +4764,7 @@ Function17f5c3: ; 17f5c3 Function17f5d2: ; 17f5d2 call Function17f5e4 callba Function104000 - call Function32f9 + call SetPalettes ld a, $1 ld [wc303], a ret diff --git a/text/battle.asm b/text/battle.asm index 381e0bdb8..6dc3d830f 100644 --- a/text/battle.asm +++ b/text/battle.asm @@ -1,4 +1,4 @@ -BattleText_0x80730: ; 0x80730 +BattleText_PlayerPickuedUpPayDayMoney: ; 0x80730 text " picked up" line "¥@" deciram wPayDayMoney, 3, 6 @@ -307,7 +307,7 @@ BattleText_GotAwaySafely: ; 0x80b77 text "Got away safely!" prompt -BattleText_0x80b89: ; 0x80b89 +BattleText_UserFledUsingAStringBuffer1: ; 0x80b89 text "" line "fled using a" cont "@" @@ -321,7 +321,7 @@ BattleText_CantEscape: ; 0x80ba0 prompt ; 0x80bae -BattleText_0x80bae: ; 0x80bae +BattleText_UserHurtBySpikes: ; 0x80bae text "'s" line "hurt by SPIKES!" prompt @@ -336,7 +336,7 @@ RecoveredUsingText: ; 0x80bc2 prompt ; 0x80bde -BattleText_0x80bde: ; 0x80bde +BattleText_UsersStringBuffer1Activated: ; 0x80bde text "'s" line "@" text_from_ram StringBuffer1 @@ -345,52 +345,52 @@ BattleText_0x80bde: ; 0x80bde prompt ; 0x80bf3 -BattleText_0x80bf3: ; 0x80bf3 +BattleText_ItemsCantBeUsedHere: ; 0x80bf3 text "Items can't be" line "used here." prompt ; 0x80c0d -BattleText_0x80c0d: ; 0x80c0d +BattleText_PkmnIsAlreadyOut: ; 0x80c0d text_from_ram BattleMonNick text "" line "is already out." prompt ; 0x80c22 -BattleText_0x80c22: ; 0x80c22 +BattleText_PkmnCantBeRecalled: ; 0x80c22 text_from_ram BattleMonNick text "" line "can't be recalled!" prompt ; 0x80c39 -BattleText_0x80c39: ; 0x80c39 +BattleText_TheresNoPPLeftForThisMove: ; 0x80c39 text "There's no PP left" line "for this move!" prompt ; 0x80c5b -BattleText_0x80c5b: ; 0x80c5b +BattleText_TheMoveIsDisabled: ; 0x80c5b text "The move is" line "DISABLED!" prompt ; 0x80c72 -BattleText_0x80c72: ; 0x80c72 +BattleText_PkmnHasNoMovesLeft: ; 0x80c72 text_from_ram BattleMonNick text "" line "has no moves left!" done ; 0x80c8a -BattleText_0x80c8a: ; 0x80c8a +BattleText_TargetsEncoreEnded: ; 0x80c8a text "'s" line "ENCORE ended!" prompt ; 0x80c9c -BattleText_0x80c9c: ; 0x80c9c +BattleText_StringBuffer1GrewToLevel: ; 0x80c9c text_from_ram StringBuffer1 text " grew to" line "level @" @@ -404,7 +404,7 @@ BattleText_0x80cb9: ; 0x80cb9 db "@" ; 0x80cba -BattleText_0x80cba: ; 0x80cba +BattleText_WildPkmnIsEating: ; 0x80cba text "Wild @" text_from_ram EnemyMonNick text "" @@ -412,7 +412,7 @@ BattleText_0x80cba: ; 0x80cba prompt ; 0x80cd1 -BattleText_0x80cd1: ; 0x80cd1 +BattleText_WildPkmnIsAngry: ; 0x80cd1 text "Wild @" text_from_ram EnemyMonNick text "" @@ -495,7 +495,7 @@ AlreadyConfusedText: ; 0x80dcc prompt ; 0x80de2 -BattleText_0x80de2: ; 0x80de2 +BattleText_UsersHurtByStringBuffer1: ; 0x80de2 text "'s" line "hurt by" cont "@" @@ -504,7 +504,7 @@ BattleText_0x80de2: ; 0x80de2 prompt ; 0x80df5 -BattleText_0x80df5: ; 0x80df5 +BattleText_UserWasReleasedFromStringBuffer1: ; 0x80df5 text "" line "was released from" cont "@" diff --git a/text/common_3.asm b/text/common_3.asm index f91877a68..bcd010970 100644 --- a/text/common_3.asm +++ b/text/common_3.asm @@ -106,13 +106,13 @@ UnknownText_0x1c0272: ; 1c0272 prompt ; 1c029c -UnknownText_0x1c029c: ; 1c029c +Text_Gained: ; 1c029c text_from_ram StringBuffer1 text " gained@" db "@" ; 1c02a9 -UnknownText_0x1c02a9: ; 1c02a9 +Text_ABoostedStringBuffer2ExpPoints: ; 1c02a9 text "" line "a boosted" cont "@" @@ -121,7 +121,7 @@ UnknownText_0x1c02a9: ; 1c02a9 prompt ; 1c02c9 -UnknownText_0x1c02c9: ; 1c02c9 +Text_StringBuffer2ExpPoints: ; 1c02c9 text "" line "@" deciram StringBuffer2, 2, 4 @@ -157,31 +157,31 @@ Text_BattleMonNick01: ; 1c0317 done ; 1c031d -UnknownText_0x1c031d: ; 1c031d +Text_BattleMonNickComma: ; 1c031d text_from_ram BattleMonNick text ",@" db "@" ; 1c0324 -UnknownText_0x1c0324: ; 1c0324 +Text_ThatsEnoughComeBack: ; 1c0324 text " that's" line "enough! Come back!@" db "@" ; 1c0340 -UnknownText_0x1c0340: ; 1c0340 +Text_OKComeBack: ; 1c0340 text " OK!" line "Come back!@" db "@" ; 1c0352 -UnknownText_0x1c0352: ; 1c0352 +Text_GoodComeBack: ; 1c0352 text " good!" line "Come back!@" db "@" ; 1c0366 -UnknownText_0x1c0366: ; 1c0366 +Text_ComeBack: ; 1c0366 text " come" line "back!" done @@ -689,7 +689,7 @@ UnknownText_0x1c0b65: ; 1c0b65 done ; 1c0b7f -UnknownText_0x1c0b7f: ; 1c0b7f +Text_AnEGGCantHoldAnItem: ; 1c0b7f text "An EGG can't hold" line "an item." prompt @@ -731,7 +731,7 @@ UnknownText_0x1c0bee: ; 1c0bee prompt ; 1c0c17 -UnknownText_0x1c0c17: ; 1c0c17 +Text_YouDontHaveAPkmn: ; 1c0c17 text "You don't have a" line "#MON!" prompt @@ -762,13 +762,13 @@ UnknownText_0x1c0c83: ; 1c0c83 done ; 1c0c85 -UnknownText_0x1c0c85: ; 1c0c85 +Text_YouCantUseItInABattle: ; 1c0c85 text "You can't use it" line "in a battle." prompt ; 1c0ca3 -UnknownText_0x1c0ca3: ; 1c0ca3 +Text_AreYouABoyOrAreYouAGirl: ; 1c0ca3 text "Are you a boy?" line "Or are you a girl?" done diff --git a/text/common_4.asm b/text/common_4.asm index 8788bf24f..33cbe6d59 100644 --- a/text/common_4.asm +++ b/text/common_4.asm @@ -1375,7 +1375,7 @@ UnknownText_0x1c5b34: ; 0x1c5b34 db "@" ; 0x1c5b35 -UnknownText_0x1c5b35: ; 0x1c5b35 +Text_Waitbutton_2: ; 0x1c5b35 text_waitbutton db "@" ; 0x1c5b37 @@ -1428,7 +1428,7 @@ UnknownText_0x1c5bac: ; 0x1c5bac prompt ; 0x1c5bcd -UnknownText_0x1c5bcd: ; 0x1c5bcd +Text_RepelUsedEarlierIsStillInEffect: ; 0x1c5bcd text "The REPEL used" line "earlier is still" cont "in effect." @@ -1480,26 +1480,26 @@ UnknownText_0x1c5c89: ; 0x1c5c89 db "@" ; 0x1c5c8a -UnknownText_0x1c5c8a: ; 0x1c5c8a +Text_RaiseThePPOfWhichMove: ; 0x1c5c8a text "Raise the PP of" line "which move?" done ; 0x1c5ca7 -UnknownText_0x1c5ca7: ; 0x1c5ca7 +Text_RestoreThePPOfWhichMove: ; 0x1c5ca7 text "Restore the PP of" line "which move?" done ; 0x1c5cc6 -UnknownText_0x1c5cc6: ; 0x1c5cc6 +Text_PPIsMaxedOut: ; 0x1c5cc6 text_from_ram StringBuffer2 text "'s PP" line "is maxed out." prompt ; 0x1c5cdd -UnknownText_0x1c5cdd: ; 0x1c5cdd +Text_PPsIncreased: ; 0x1c5cdd text_from_ram StringBuffer2 text "'s PP" line "increased." @@ -1674,7 +1674,7 @@ UnknownText_0x1c5fd1: ; 0x1c5fd1 prompt ; 0x1c5fde -UnknownText_0x1c5fde: ; 0x1c5fde +Text_DSTIsThatOK: ; 0x1c5fde text " DST," line "is that OK?" done diff --git a/wram.asm b/wram.asm index 38a3a9ea6..74eb9999d 100644 --- a/wram.asm +++ b/wram.asm @@ -817,13 +817,13 @@ LastEnemyMove:: ; c71c wc71d:: ds 1 wc71e:: ds 1 wc71f:: ds 1 -wc720:: ds 4 +wc720:: ds 4 ; copy from/to EnemyMonBaseStats, length=7 wc724:: ds 3 wc727:: ds 2 wc729:: ds 2 wc72b:: ds 1 wc72c:: ds 1 -wc72d:: ds 1 +wc72d:: ds 1 ; if 0 then PrintButItFailed wc72e:: ds 1 wc72f:: ds 1 wc730:: ds 1 @@ -1796,17 +1796,17 @@ OtherTrainerClass:: ; d22f BattleType:: ; d230 ; $00 normal -; $01 -; $02 -; $03 dude +; $01 can lose +; $02 debug +; $03 dude/tutorial ; $04 fishing ; $05 roaming -; $06 +; $06 contest ; $07 shiny ; $08 headbutt/rock smash -; $09 +; $09 trap ; $0a force Item1 -; $0b +; $0b celebi ; $0c suicune ds 1 @@ -2461,9 +2461,9 @@ wdc79:: ds 1 wdc7a:: ds 2 wPhoneList:: ds CONTACT_LIST_SIZE ds 23 -wLuckyNumberShowFlag:: ds 2 -wLuckyIDNumber:: ds 2 -wRepelEffect:: ds 1 +wLuckyNumberShowFlag:: ds 2 ; dc9d +wLuckyIDNumber:: ds 2 ; dc9f +wRepelEffect:: ds 1 ; If a Repel is in use, it contains the nr of steps it's still active wBikeStep:: ds 2 wKurtApricornQuantity:: ds 1 @@ -2624,7 +2624,9 @@ wGameDataEnd:: SECTION "Pic Animations", WRAMX, BANK [2] -w2_d000:: ds $168 +w2_d000:: +; 20x18 grid of 8x8 tiles + ds SCREEN_WIDTH * SCREEN_HEIGHT ; $168 = 360 w2_d168:: ds 1 w2_d169:: ds 1