diff options
-rw-r--r-- | battle/ai/items.asm | 13 | ||||
-rw-r--r-- | battle/ai/scoring.asm | 8 | ||||
-rw-r--r-- | battle/core.asm | 360 | ||||
-rw-r--r-- | battle/effect_command_pointers.asm | 6 | ||||
-rw-r--r-- | battle/effect_commands.asm | 38 | ||||
-rw-r--r-- | engine/credits.asm | 4 | ||||
-rw-r--r-- | engine/diploma.asm | 2 | ||||
-rw-r--r-- | engine/events.asm | 6 | ||||
-rw-r--r-- | engine/events_2.asm | 2 | ||||
-rw-r--r-- | engine/pack.asm | 6 | ||||
-rw-r--r-- | engine/predef.asm | 2 | ||||
-rw-r--r-- | home.asm | 30 | ||||
-rw-r--r-- | home/joypad.asm | 2 | ||||
-rw-r--r-- | home/map.asm | 4 | ||||
-rw-r--r-- | home/menu.asm | 2 | ||||
-rw-r--r-- | home/serial.asm | 6 | ||||
-rw-r--r-- | hram.asm | 2 | ||||
-rw-r--r-- | items/item_effects.asm | 19 | ||||
-rw-r--r-- | main.asm | 241 | ||||
-rw-r--r-- | misc/crystal_misc.asm | 2 | ||||
-rw-r--r-- | misc/mobile_40.asm | 11 | ||||
-rw-r--r-- | misc/mobile_45.asm | 30 | ||||
-rw-r--r-- | misc/mobile_5f.asm | 10 | ||||
-rw-r--r-- | text/battle.asm | 32 | ||||
-rw-r--r-- | text/common_3.asm | 16 | ||||
-rw-r--r-- | text/common_4.asm | 4 | ||||
-rw-r--r-- | wram.asm | 46 |
27 files changed, 471 insertions, 433 deletions
diff --git a/battle/ai/items.asm b/battle/ai/items.asm index 46f04bf65..42bc3deb6 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 @@ -787,17 +788,17 @@ Function38511: ; 38511 ; 3851e Function3851e: ; 3851e - ld [hMultiplier], a + ld [hDivisor], a ld hl, EnemyMonMaxHP ld a, [hli] - ld [hProduct], a + ld [hDividend + 0], a ld a, [hl] - ld [hMultiplicand], a + ld [hDividend + 1], a ld b, $2 call Divide - ld a, [$ffb6] + ld a, [hQuotient + 2] ld c, a - ld a, [$ffb5] + ld a, [hQuotient + 1] ld b, a ld hl, EnemyMonHP + 1 ld a, [hld] diff --git a/battle/ai/scoring.asm b/battle/ai/scoring.asm index 101d4e188..27bc417e9 100644 --- a/battle/ai/scoring.asm +++ b/battle/ai/scoring.asm @@ -1783,8 +1783,8 @@ AI_Smart_PriorityHit: ; 38d5a ld [hBattleTurn], a push hl callab EnemyAttackDamage - callab BattleCommand62 - callab BattleCommand07 + callab BattleCommand62_DamageCalcWithStats + callab BattleCommand07_CalcDamageTypeMultiplier pop hl ld a, [CurDamage + 1] ld c, a @@ -3380,8 +3380,8 @@ AIDamageCalc: ; 393e7 .asm_39400 callab EnemyAttackDamage - callab BattleCommand62 - callab BattleCommand07 + callab BattleCommand62_DamageCalcWithStats + callab BattleCommand07_CalcDamageTypeMultiplier ret .ConstantDamageEffects diff --git a/battle/core.asm b/battle/core.asm index 30d53c7d5..1db6793af 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, [InLinkBattle] @@ -122,7 +122,7 @@ Function3c000: ; 3c000 WildFled_EnemyFled_LinkBattleCanceled: ; 3c0e5 - call Function30b4 + call Call_LoadTempTileMapToTileMap ld a, [wd0ee] and $c0 add $2 @@ -306,7 +306,7 @@ Function3c1d6: ; 3c1d6 call Function3de97 call Function3dcf9 call UpdateBattleMonInParty - call Function309d + call LoadTileMapToTempTileMap jp Function3c4df ; 3c23c @@ -321,7 +321,7 @@ Function3c23c: ; 3c23c .asm_3c24a call HasEnemyFainted jr nz, .asm_3c258 - call Function3cd55 + call Handle_EnemyPkmnFainted ld a, [BattleEnded] and a jr nz, .asm_3c25a @@ -338,7 +338,7 @@ Function3c23c: ; 3c23c Function3c25c: ; 3c25c call HasEnemyFainted jr nz, .asm_3c26a - call Function3cd55 + call Handle_EnemyPkmnFainted ld a, [BattleEnded] and a jr nz, .asm_3c27a @@ -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 @@ -647,7 +647,7 @@ Function3c434: ; 3c434 ld [FXAnimIDLo], a call Function3e4bc 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 @@ -954,12 +954,12 @@ Function3c5fe: ; 3c5fe call HasPlayerFainted jp z, Function3d14e call HasEnemyFainted - jp z, Function3cd55 + jp z, Handle_EnemyPkmnFainted .asm_3c62f call SetEnemyTurn call ResidualDamage - jp z, Function3cd55 + jp z, Handle_EnemyPkmnFainted call RefreshBattleHuds call Function3c6cf call Function3d2e0 @@ -968,7 +968,7 @@ Function3c5fe: ; 3c5fe and a ret nz call HasEnemyFainted - jp z, Function3cd55 + jp z, Handle_EnemyPkmnFainted call HasPlayerFainted jp z, Function3d14e call SetPlayerTurn @@ -994,7 +994,7 @@ Function3c664: ; 3c664 call Function3d2e0 ret c call HasEnemyFainted - jp z, Function3cd55 + jp z, Handle_EnemyPkmnFainted call HasPlayerFainted jp z, Function3d14e push bc @@ -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 @@ -1018,12 +1018,12 @@ Function3c664: ; 3c664 call HasPlayerFainted jp z, Function3d14e call HasEnemyFainted - jp z, Function3cd55 + jp z, Handle_EnemyPkmnFainted .asm_3c6be call SetEnemyTurn call ResidualDamage - jp z, Function3cd55 + jp z, Handle_EnemyPkmnFainted call RefreshBattleHuds xor a ld [wd0ec], a @@ -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] @@ -2095,16 +2097,16 @@ Function3cd3c: ; 3cd3c ret ; 3cd55 -Function3cd55: ; 3cd55 - call Function3cf14 +Handle_EnemyPkmnFainted: ; 3cd55 + call EnemyPkmnFainted_TextSFX ld hl, BattleMonHP ld a, [hli] or [hl] - call z, Function3cef1 + call z, PlayerPkmnFainted_TextSFX xor a ld [wc6f7], a call Function3ce01 - call Function3d873 + call CheckPlayerPartyForFitPkmn ld a, d and a jp z, LostBattle @@ -2128,8 +2130,8 @@ Function3cd55: ; 3cd55 ret .asm_3cd8c - call Function3cf35 - jp z, Function3cfa4 + call CheckIfOTPartyHasPkmnToBattleWith + jp z, HandlePlayerWonBattle ld hl, BattleMonHP ld a, [hli] @@ -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, [IsInBattle] dec a - call z, Function3d0ea + call z, PlayVictoryMusic call EmptyBattleTextBox - call Function309d + call LoadTileMapToTempTileMap ld a, [wd0ee] and $c0 ld [wd0ee], 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 @@ -2348,7 +2350,7 @@ Function3ceec: ; 3ceec ret ; 3cef1 -Function3cef1: ; 3cef1 +PlayerPkmnFainted_TextSFX: ; 3cef1 call Function3ceec call WaitSFX ld a, $f0 @@ -2363,7 +2365,7 @@ Function3cef1: ; 3cef1 jp StdBattleTextBox ; 3cf14 -Function3cf14: ; 3cf14 +EnemyPkmnFainted_TextSFX: ; 3cf14 call WaitSFX ld de, SFX_KINESIS call PlaySFX @@ -2377,7 +2379,7 @@ Function3cf14: ; 3cf14 jp StdBattleTextBox ; 3cf35 -Function3cf35: ; 3cf35 +CheckIfOTPartyHasPkmnToBattleWith: ; 3cf35 ld a, [OTPartyCount] ld b, a xor a @@ -2401,14 +2403,17 @@ Function3cf4a: ; 3cf4a call Function3e12e call WaitBGMap callba Function2c012 + ld a, [InLinkBattle] 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 @@ -2430,6 +2435,7 @@ EnemyPartyMonEntrance: ; 3cf78 pop af and a jr nz, .asm_3cf8f + call Function3d4e1 jr .asm_3cf92 @@ -2447,7 +2453,8 @@ EnemyPartyMonEntrance: ; 3cf78 ret ; 3cfa4 -Function3cfa4: ; 3cfa4 +HandlePlayerWonBattle: ; 3cfa4 +; Player won the battle call Function3ceec ld a, $1 ld [wc6fd], a @@ -2455,12 +2462,14 @@ Function3cfa4: ; 3cfa4 ld a, [InLinkBattle] 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, [InLinkBattle] and a ret nz @@ -2658,7 +2667,7 @@ Function3d0be: ; 3d0be ret ; 3d0ea -Function3d0ea: ; 3d0ea +PlayVictoryMusic: ; 3d0ea push de ld de, MUSIC_NONE call PlayMusic @@ -2668,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 @@ -2751,15 +2760,15 @@ KantoGymLeaders: Function3d14e: ; 3d14e - call Function3cef1 + call PlayerPkmnFainted_TextSFX ld hl, EnemyMonHP ld a, [hli] or [hl] - call z, Function3cf14 + call z, EnemyPkmnFainted_TextSFX ld a, $1 ld [wc6f7], a call Function3d1aa - call Function3d873 + call CheckPlayerPartyForFitPkmn ld a, d and a jp z, LostBattle @@ -2776,8 +2785,8 @@ Function3d14e: ; 3d14e ret .asm_3d17f - call Function3cf35 - jp z, Function3cfa4 + call CheckIfOTPartyHasPkmnToBattleWith + jp z, HandlePlayerWonBattle .asm_3d185 call Function3d1f8 @@ -2840,7 +2849,7 @@ Function3d1aa: ; 3d1aa Function3d1f8: ; 3d1f8 call EmptyBattleTextBox - call Function309d + call LoadTileMapToTempTileMap ld a, [IsInBattle] and a dec a @@ -2861,7 +2870,7 @@ Function3d1f8: ; 3d1f8 jr z, .asm_3d20a ld hl, PartyMon1Speed ld de, EnemyMonSpeed - jp Function3d8b3 + jp TryToRunAwayFromBattle ; 3d227 Function3d227: ; 3d227 @@ -2891,10 +2900,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 @@ -2913,13 +2922,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 @@ -2941,7 +2950,7 @@ Function3d2b3: ; 3d2b3 call BreakAttraction call Function3db5f call EmptyBattleTextBox - call Function309d + call LoadTileMapToTempTileMap call SetPlayerTurn jp SpikesDamage ; 3d2e0 @@ -2985,7 +2994,7 @@ Function3d313: ; 3d313 callba WritePartyMenuTilemap callba PrintPartyMenuText call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame ret ; 3d329 @@ -3020,7 +3029,7 @@ SwitchMonAlreadyOut: ; 3d34f cp [hl] jr nz, .notout - ld hl, BattleText_0x80c0d + ld hl, BattleText_PkmnIsAlreadyOut call StdBattleTextBox scf ret @@ -3125,12 +3134,12 @@ LostBattle: ; 3d38e ; Greyscale ld b, 0 call GetSGBLayout - call Function32f9 + call SetPalettes jr .end .LostLinkBattle call UpdateEnemyMonInParty - call Function3cf35 + call CheckIfOTPartyHasPkmnToBattleWith jr nz, .asm_3d40a ld hl, TiedAgainstText ld a, [wd0ee] @@ -3317,7 +3326,7 @@ Function3d4e1: ; 3d4e1 ld [wd0ec], a inc a ld [wEnemyIsSwitching], a - call Function309d + call LoadTileMapToTempTileMap jp Function3e3ad ; 3d517 @@ -3603,6 +3612,7 @@ Function3d6ca: ; 3d6ca ld [TempEnemyMonSpecies], a ld [CurPartySpecies], a call LoadEnemyMon + ld a, [CurPartySpecies] cp UNOWN jr nz, .asm_3d708 @@ -3614,6 +3624,7 @@ Function3d6ca: ; 3d6ca ld a, [UnownLetter] ld [wdef4], a .asm_3d708 + ld hl, EnemyMonHP ld a, [hli] ld [wc6ea], a @@ -3727,14 +3738,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 @@ -3796,7 +3807,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 @@ -3846,9 +3858,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 @@ -3891,7 +3904,7 @@ Function3d8b3: ; 3d8b3 call SetPlayerTurn call GetItemName - ld hl, BattleText_0x80b89 + ld hl, BattleText_UserFledUsingAStringBuffer1 call StdBattleTextBox jp .asm_3d9a2 @@ -3908,7 +3921,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 @@ -3973,7 +3986,7 @@ Function3d8b3: ; 3d8b3 call StdBattleTextBox ld a, $1 ld [wd266], a - call Function309d + call LoadTileMapToTempTileMap and a ret @@ -3982,7 +3995,7 @@ Function3d8b3: ; 3d8b3 and a ld a, $2 jr z, .asm_3d9cf - call Function309d + call LoadTileMapToTempTileMap xor a ld [wd0ec], a ld a, $f @@ -3990,7 +4003,7 @@ Function3d8b3: ; 3d8b3 xor a ld [CurPlayerMove], a call Function3e8e4 - call Function30b4 + call Call_LoadTempTileMapToTileMap call Function3d2e0 jr c, .asm_3d9f5 @@ -4015,7 +4028,7 @@ Function3d8b3: ; 3d8b3 ld hl, BattleText_GotAwaySafely call StdBattleTextBox call WaitSFX - call Function309d + call LoadTileMapToTempTileMap scf ret @@ -4029,7 +4042,7 @@ Function3d8b3: ; 3d8b3 .asm_3da05 call WaitSFX - call Function309d + call LoadTileMapToTempTileMap scf ret ; 3da0d @@ -4193,7 +4206,7 @@ Function3db32: ; 3db32 call BreakAttraction call Function3db5f call EmptyBattleTextBox - call Function309d + call LoadTileMapToTempTileMap ld hl, EnemyMonHP ld a, [hli] or [hl] @@ -4230,13 +4243,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 @@ -4320,7 +4333,7 @@ SpikesDamage: ; 3dc23 push bc - ld hl, BattleText_0x80bae ; "hurt by SPIKES!" + ld hl, BattleText_UserHurtBySpikes ; "hurt by SPIKES!" call StdBattleTextBox call GetEighthMaxHP @@ -4422,7 +4435,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 @@ -4732,7 +4745,7 @@ endr ld [bc], a ld [de], a call GetItemName - ld hl, BattleText_0x80bde + ld hl, BattleText_UsersStringBuffer1Activated call StdBattleTextBox callab BattleCommand8c ret @@ -5101,17 +5114,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 @@ -5126,7 +5139,7 @@ BattleMenu: ; 3e139 ld a, [InputType] or a jr z, .asm_3e171 - callba Function1de294 + callba Start_DudeAutoInput_DownA .asm_3e171 call LoadBattleMenu2 @@ -5150,7 +5163,7 @@ BattleMenu: ; 3e139 BattleMenu_Fight: ; 3e192 xor a ld [wd267], a - call Function30b4 + call Call_LoadTempTileMapToTileMap and a ret ; 3e19b @@ -5229,12 +5242,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 @@ -5266,7 +5279,7 @@ Function3e234: ; 3e234 call ExitMenu call Function3df2c call WaitBGMap - call Function309d + call LoadTileMapToTempTileMap call Function1fbf call Function3ee27 and a @@ -5279,7 +5292,7 @@ Function3e234: ; 3e234 and $c0 ld [wd0ee], a call Function1fbf - call Function32f9 + call SetPalettes scf ret ; 3e28d @@ -5328,9 +5341,9 @@ Function3e299: call DelayFrame call Function3eda6 call WriteBackup - call Function309d + call LoadTileMapToTempTileMap call ClearSGB - call Function32f9 + call SetPalettes jp BattleMenu ; 3e2f5 @@ -5382,7 +5395,7 @@ Function3e358: ; 3e358 ld a, [CurPartyMon] cp d jr nz, .asm_3e36b - ld hl, BattleText_0x80c0d + ld hl, BattleText_PkmnIsAlreadyOut call StdBattleTextBox jp Function3e299 @@ -5395,7 +5408,7 @@ Function3e358: ; 3e358 jr z, .asm_3e381 .asm_3e378 - ld hl, BattleText_0x80c22 + ld hl, BattleText_PkmnCantBeRecalled call StdBattleTextBox jp Function3e299 @@ -5412,7 +5425,7 @@ Function3e358: ; 3e358 call Function3eda6 call WriteBackup call ClearSGB - call Function32f9 + call SetPalettes ld a, [CurPartyMon] ld [CurBattleMon], a ; fallthrough @@ -5475,7 +5488,7 @@ Function3e3ff: ; 3e3ff ; 3e40b BattleMonEntrance: ; 3e40b - call Function3f2f4 + call BattleMonNickComma_TextBox ld c, 50 call DelayFrames @@ -5503,7 +5516,7 @@ BattleMonEntrance: ; 3e40b call BreakAttraction call Function3db5f call EmptyBattleTextBox - call Function309d + call LoadTileMapToTempTileMap call SetPlayerTurn call SpikesDamage ld a, $2 @@ -5525,22 +5538,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 @@ -5754,15 +5767,15 @@ 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 + call Call_LoadTempTileMapToTileMap jp Function3e4bc ; 3e61c @@ -6019,7 +6032,7 @@ Function3e786: ; 3e786 ret nz .asm_3e7b4 - ld hl, BattleText_0x80c72 + ld hl, BattleText_PkmnHasNoMovesLeft call StdBattleTextBox ld c, 60 call DelayFrames @@ -6037,18 +6050,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] @@ -6076,8 +6089,8 @@ Function3e7c1: ; 3e7c1 jp .asm_3e87f .asm_3e824 - call Function3e8d1 - jp nz, Function3e8c1 + call CheckSubstatus_RechargeChargedRampageBideRollout + jp nz, ResetVarsForSubstatusRage jr .asm_3e830 .asm_3e82c @@ -6142,7 +6155,7 @@ Function3e7c1: ; 3e7c1 .asm_3e882 call SetEnemyTurn callab UpdateMoveData - call Function3e8d1 + call CheckSubstatus_RechargeChargedRampageBideRollout jr nz, .asm_3e894 xor a ld [wc733], a @@ -6178,7 +6191,7 @@ Function3e7c1: ; 3e7c1 jr .asm_3e87f ; 3e8c1 -Function3e8c1: ; 3e8c1 +ResetVarsForSubstatusRage: ; 3e8c1 xor a ld [EnemyFuryCutterCount], a ld [EnemyProtectCount], a @@ -6188,14 +6201,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 @@ -6987,10 +7002,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 @@ -6998,7 +7014,7 @@ Function3ecab: ; 3ecab ret ; 3ecb7 -Function3ecb7: ; 3ecb7 +ApplyStatLevelMultiplier: ; 3ecb7 push bc push bc ld a, [wd265] @@ -7309,7 +7325,7 @@ Function3ee0f: ; 3ee0f ret nz ; 3ee17 -Function3ee17: ; 3ee17 +Call_PlayBattleAnim: ; 3ee17 ld a, e ld [FXAnimIDLo], a ld a, d @@ -7325,7 +7341,7 @@ Function3ee27: ; 3ee27 push hl ld b, $1 call GetSGBLayout - call Function32f9 + call SetPalettes call DelayFrame pop hl pop de @@ -7335,7 +7351,7 @@ Function3ee27: ; 3ee27 ; 3ee3b -Function3ee3b: ; 3ee3b +GiveExperiencePoints: ; 3ee3b ; Give experience. ld a, [InLinkBattle] and a @@ -7467,7 +7483,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 @@ -7476,7 +7492,7 @@ endr pop bc call Function3f136 push bc - call Function309d + call LoadTileMapToTempTileMap pop bc ld hl, $000a add hl, bc @@ -7623,12 +7639,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 @@ -7642,9 +7658,9 @@ 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 @@ -7660,7 +7676,7 @@ endr ld c, $1e call DelayFrames call Functiona80 - call Function30b4 + call Call_LoadTempTileMapToTileMap xor a ld [MonType], a ld a, [CurSpecies] @@ -7728,14 +7744,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 @@ -7759,30 +7775,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 @@ -7887,7 +7903,7 @@ endr call PlaySFX callba Function8e79d call WaitSFX - ld hl, BattleText_0x80c9c + ld hl, BattleText_StringBuffer1GrewToLevel call StdBattleTextBox pop de inc e @@ -8068,17 +8084,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 @@ -8110,41 +8128,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 @@ -8155,7 +8177,7 @@ Function3f360: ; 3f360 and a jr z, .asm_3f36d dec [hl] - ld hl, BattleText_0x80cba + ld hl, BattleText_WildPkmnIsEating jr .asm_3f388 .asm_3f36d @@ -8164,7 +8186,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] @@ -8176,7 +8198,7 @@ Function3f360: ; 3f360 .asm_3f388 push hl - call Function30b4 + call Call_LoadTempTileMapToTileMap pop hl jp StdBattleTextBox ; 3f390 @@ -8727,7 +8749,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 @@ -8847,7 +8869,7 @@ Function3f836: ; 3f836 call Function3200 ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes ld c, $8 call DelayFrames call Functiona80 @@ -9349,7 +9371,7 @@ Function3fb6c: ; 3fb6c call HideSprites ld b, $1 call GetSGBLayout - call Function32f9 + call SetPalettes ld a, $90 ld [hWY], a xor a @@ -9504,7 +9526,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 073fe406e..56fa0c5a3 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 BattleCommand07_CalcDamageTypeMultiplier ; 346d2 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 BattleCommand62_DamageCalcWithStats ; 35612 dw BattleCommand63 ; 3790e dw BattleCommand64 ; 37939 dw BattleCommand65 ; 37972 @@ -170,7 +170,7 @@ BattleCommandPointers: ; 3fd28 dw BattleCommanda6 ; 365af dw BattleCommanda7 ; 365c3 dw BattleCommanda8 ; 355b5 - dw BattleCommanda9 ; 355d5 + dw BattleCommanda9_IfAttackMissedResetDamage ; 355d5 dw BattleCommandaa ; 37e80 dw BattleCommandab ; 34f57 dw BattleCommandac ; 3658f diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index fd35756ee..1892717ce 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -539,7 +539,7 @@ CheckEnemyTurn: ; 3421f ld hl, HurtItselfText call StdBattleTextBox call Function355dd - call BattleCommand62 + call BattleCommand62_DamageCalcWithStats call BattleCommand0a xor a ld [wcfca], a @@ -652,7 +652,7 @@ HitConfusion: ; 343a5 ld [CriticalHit], a call Function355dd - call BattleCommand62 + call BattleCommand62_DamageCalcWithStats call BattleCommand0a xor a @@ -1336,8 +1336,8 @@ BattleCommand4f: ; 346cd ; 346d2 -BattleCommand07: ; 346d2 -; stab +BattleCommand07_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] @@ -3932,6 +3932,7 @@ BattleCommanda8: ; 355b5 ld a, [wc72d] and a ret nz + jp PrintButItFailed ; 355bd @@ -3955,11 +3956,12 @@ Function355bd: ; 355bd ; 355d5 -BattleCommanda9: ; 355d5 +BattleCommanda9_IfAttackMissedResetDamage: ; 355d5 ; clearmissdamage ld a, [AttackMissed] and a ret z + jp ResetDamage ; 355dd @@ -4002,7 +4004,7 @@ endr ; 35612 -BattleCommand62: ; 35612 +BattleCommand62_DamageCalcWithStats: ; 35612 ; damagecalc ; Return a damage value for move power d, player level e, enemy defense c and player attack b. @@ -4136,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 @@ -4395,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 BattleCommand62_DamageCalcWithStats pop hl ld [hl], 1 ret @@ -7200,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 @@ -9498,7 +9500,7 @@ BattleCommand61: ; 37874 push de .asm_3787d - call BattleCommand07 + call BattleCommand07_CalcDamageTypeMultiplier ld a, [InLinkBattle] cp $3 @@ -9746,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 @@ -9787,7 +9789,7 @@ BattleCommand67: ; 379c9 call CallBattleCore ld a, 1 ld [wd265], a - ld hl, Function3ecab + ld hl, ApplyStatLevelMultiplierOnAllStats call CallBattleCore ld hl, SpikesDamage diff --git a/engine/credits.asm b/engine/credits.asm index 449fc0ac0..524b97fb2 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 420bff7f1..f14ac383d 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 ae28e0c38..881f81af2 100644 --- a/engine/events.asm +++ b/engine/events.asm @@ -1021,12 +1021,14 @@ Function96bd3: ; 96bd3 ; 96bd7 Function96bd7: ; 96bd7 - ld a, [wdca1] + ld a, [RepelStepsLeft] and a ret z + dec a - ld [wdca1], a + ld [RepelStepsLeft], a ret nz + ld a, BANK(RepelWoreOffScript) ld hl, RepelWoreOffScript call CallScript diff --git a/engine/events_2.asm b/engine/events_2.asm index 019894298..ea4dff31e 100644 --- a/engine/events_2.asm +++ b/engine/events_2.asm @@ -278,7 +278,7 @@ Function97db5: ; 97db5 call GetMapHeaderPhoneServiceNybble and a jr nz, .NoCall - ld hl, wdca1 + 1 + ld hl, wdca2 ld a, [hli] ld d, a ld e, [hl] diff --git a/engine/pack.asm b/engine/pack.asm index 84413e1cb..f09e7d715 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -594,7 +594,7 @@ Function103fd: ; 103fd callba WritePartyMenuTilemap callba PrintPartyMenuText call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame callba PartyMenuSelect jr c, .asm_10475 @@ -1112,7 +1112,7 @@ Function107bb: ; 107bb ld a, [InputType] or a jr z, .asm_107ca - callba Function1de28f + callba Start_DudeAutoInput_RightA .asm_107ca call Function107d7 @@ -1507,7 +1507,7 @@ Function10a40: ; 10a40 call WaitBGMap ld b, $14 call GetSGBLayout - call Function32f9 + call SetPalettes call DelayFrame ret ; 10a4f diff --git a/engine/predef.asm b/engine/predef.asm index 9ee46bf47..3e6e807c9 100644 --- a/engine/predef.asm +++ b/engine/predef.asm @@ -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 @@ -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) @@ -676,11 +679,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 @@ -688,7 +692,7 @@ Function32f9:: ; 32f9 ld [rOBP1], a ret -.asm_3309 +.SetPalettesForGameBoyColor push de ld a, $e4 call DmgToCgbBGPals @@ -959,10 +963,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 @@ -1159,7 +1163,7 @@ Function3524:: ; 3524 ld hl, VramState bit 0, [hl] jp nz, UpdateTimePals - jp Function32f9 + jp SetPalettes ; 352f Function352f:: ; 352f @@ -1760,7 +1764,7 @@ Function383d:: ; 383d Function3842:: ; 3842 ld [wd265], a ld de, wd265 - ld b, 1 << 6 + 1 + ld b, 1 << 6 + 1 ; 65 jp PrintNum ; 384d diff --git a/home/joypad.asm b/home/joypad.asm index 78a1ac143..89ef3df26 100644 --- a/home/joypad.asm +++ b/home/joypad.asm @@ -410,7 +410,7 @@ Functionac6:: ; ac6 ld a, [InputType] or a jr z, .asm_ad9 - callba Function1de28a + callba Start_DudeAutoInput_A .asm_ad9 call Functionaf5 call Functiona57 diff --git a/home/map.asm b/home/map.asm index 8dccf51a0..b9e77dddb 100644 --- a/home/map.asm +++ b/home/map.asm @@ -1967,14 +1967,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 82bac3b99..3f21e2c61 100644 --- a/home/menu.asm +++ b/home/menu.asm @@ -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 302630cc7..8b848bbe2 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 @@ -73,7 +73,7 @@ hRandom EQU $ffe1 hRandomAdd EQU $ffe1 hRandomSub EQU $ffe2 -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 6ad0d8947..72bfcf617 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 @@ -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 @@ -2254,18 +2254,19 @@ Repel: ; f46a ; f46c Function_0xf46c: ; f46c - ld a, [wdca1] + ld a, [RepelStepsLeft] and a - ld hl, UnknownText_0xf47d + ld hl, TextJump_RepelUsedEarlierIsStillInEffect jp nz, PrintText + ld a, b - ld [wdca1], a + ld [RepelStepsLeft], 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 @@ -1579,7 +1579,7 @@ Function64db: ; 64db ; 6508 LearnMove: ; 6508 - call Function309d + call LoadTileMapToTempTileMap ld a, [CurPartyMon] ld hl, PartyMonNicknames call GetNick @@ -1741,7 +1741,7 @@ ForgetMove: ; 65d3 ld [wcfa7], a call Function1bc9 push af - call Function30b4 + call Call_LoadTempTileMapToTileMap pop af pop hl bit 1, a @@ -3177,7 +3177,7 @@ Function8000: ; 8000 ld a, $7 call ByteFill call Function3200 - call Function32f9 + call SetPalettes ret ; 8029 @@ -9726,7 +9726,7 @@ Functione443: ; e443 (3:6443) ld a, $1 .asm_e44b ld [wcf88], a - call Function32f9 + call SetPalettes xor a ld [wcf76], a ld [hBGMapMode], a ; $ff00+$d4 @@ -9946,7 +9946,7 @@ ClearPCItemScreen: ; e58b ld bc, $0412 call TextBox call Function3200 - call Function32f9 ; load regular palettes? + call SetPalettes ; load regular palettes? ret ; 0xe5bb @@ -10918,7 +10918,7 @@ Function116f8: ; 116f8 call Function1171d call WaitBGMap call WaitTop - call Function32f9 + call SetPalettes call Function11be0 ret ; 1171d @@ -12693,7 +12693,7 @@ Function124fa: ; 124fa Function1250a: ; 1250a ld b, $0 call GetSGBLayout - call Function32f9 + call SetPalettes ret ; 12513 @@ -13004,7 +13004,7 @@ endr .Clear ; 126b7 call WhiteBGMap - call Function1d7d + call Call_ExitMenu call Function2bae call .DrawMenuAccount_ call MenuFunc_1e7f @@ -13403,7 +13403,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 @@ -13625,7 +13625,7 @@ SwitchPartyMons: ; 12aec call AddNTimes ld [hl], "▷" call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame callba PartyMenuSelect @@ -14082,7 +14082,7 @@ OpenPartyStats: ; 12e00 call LowVolume predef StatsScreenInit call MaxVolume - call Function1d7d + call Call_ExitMenu ld a, 0 ret ; 12e1b @@ -14253,19 +14253,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 @@ -14665,7 +14665,7 @@ Function131ef: ; 131ef hlcoord 10, 4 predef Function50c50 call WaitBGMap - call Function32f9 + call SetPalettes ld a, [wd0eb] inc a ld [wcfa3], a @@ -21684,7 +21684,7 @@ Function16be4: ; 16be4 ld b, $1c call GetSGBLayout - call Function32f9 + call SetPalettes .asm_16c6b call Functiona57 @@ -22592,7 +22592,7 @@ Function17254: ; 17254 (5:7254) predef FillBox pop af call Function17363 - call Function32f9 + call SetPalettes jp WaitBGMap Function1727f: ; 1727f (5:727f) @@ -26001,7 +26001,7 @@ Function2513b: ; 2513b (9:513b) call WaitBGMap ld b, $15 call GetSGBLayout - call Function32f9 + call SetPalettes call WaitBGMap ld hl, wcf63 xor a @@ -28283,7 +28283,7 @@ Function2715c: ; 2715c call WriteBackup call Function1d6e call WaitBGMap - jp Function32f9 + jp SetPalettes ; 27192 Function27192: ; 27192 @@ -29743,7 +29743,7 @@ Function2891c: ; 2891c ; 28926 Function28926: ; 28926 - call Function309d + call LoadTileMapToTempTileMap ld a, [wcfa9] push af hlcoord 0, 15 @@ -29784,7 +29784,7 @@ Function28926: ; 28926 .asm_28983 pop af ld [wcfa9], a - call Function30b4 + call Call_LoadTempTileMapToTileMap jp Function2888b .asm_2898d @@ -29822,7 +29822,7 @@ Function28926: ; 28926 ld [wd263], a callab Function50db9 callba Function4d319 - call Function30b4 + call Call_LoadTempTileMapToTileMap hlcoord 6, 1 ld bc, $0601 ld a, $7f @@ -30091,7 +30091,7 @@ Function28b87: ; 28b87 callba Function4d354 call Function1bd3 push af - call Function1d7d + call Call_ExitMenu call Function3200 pop af bit 1, a @@ -30404,7 +30404,7 @@ Function28ef8: ; 28ef8 Function28eff: ; 28eff callba Function16d6a7 - call Function32f9 + call SetPalettes ret ; 28f09 @@ -32894,7 +32894,7 @@ endr CheckRepelEffect:: ; 2a1df ; If there is no active Repel, there's no need to be here. - ld a, [wdca1] + ld a, [RepelStepsLeft] and a jr z, .encounter ; Get the first Pokemon in your party that isn't fainted. @@ -33663,13 +33663,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] @@ -33677,13 +33677,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 @@ -34020,7 +34020,7 @@ Function2c1b2: ; 2c1b2 callba Function2c10d ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes ld a, $e4 ld [rOBP0], a ret @@ -34559,7 +34559,7 @@ Function2c80a: ; 2c80a callba WritePartyMenuTilemap callba PrintPartyMenuText call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame callba PartyMenuSelect push af @@ -36764,7 +36764,7 @@ AIChooseMove: ; 440ce ret nz ; No use picking a move if there's no choice. - callba Function3e8d1 + callba CheckSubstatus_RechargeChargedRampageBideRollout ret nz @@ -37768,7 +37768,7 @@ Function4484a: ; 0x4484a callba WritePartyMenuTilemap callba PrintPartyMenuText call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame callba PartyMenuSelect jr c, .asm_44939 @@ -37987,7 +37987,7 @@ Function4802f: ; 4802f (12:402f) call PlaceString call Function48187 call Function3200 - call Function32f9 + call SetPalettes call Function1bc9 ld hl, wcfa9 ld b, [hl] @@ -39673,11 +39673,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 @@ -39707,7 +39707,7 @@ Function48dcb: ; 48dcb (12:4dcb) call Function48e47 call Function48e64 call Function3200 - call Function32f9 + call SetPalettes ld hl, UnknownText_0x48e0f call PrintText ld hl, MenuDataHeader_0x48dfc @@ -40921,7 +40921,7 @@ MainMenu: ; 49cdc call Function49ed0 ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes ld hl, GameTimerPause res 0, [hl] call Function49da4 @@ -41302,7 +41302,7 @@ Function49f16: ; 49f16 hlcoord 1, 14 call PlaceString call Function3200 - call Function32f9 + call SetPalettes call Function1bc9 ld hl, wcfa9 ld b, [hl] @@ -41449,7 +41449,7 @@ Function4a098: ; 4a098 (12:6098) call WaitBGMap call Function1d6e callba Function89de0 - call Function1d7d + call Call_ExitMenu call Function49351 call Function4a485 pop bc @@ -41558,7 +41558,7 @@ Function4a149: ; 4a149 (12:6149) hlcoord 1, 14 call PlaceString callba Function104148 - call Function32f9 + call SetPalettes call Function1bc9 ld hl, wcfa9 ld b, [hl] @@ -41696,7 +41696,7 @@ Function4a28a: ; 4a28a (12:628a) .asm_4a2df callba Function11765d call WhiteBGMap - call Function1d7d + call Call_ExitMenu call Functione5f scf ret @@ -41730,7 +41730,7 @@ Function4a28a: ; 4a28a (12:628a) .asm_4a338 call ExitMenu .asm_4a33b - call Function1d7d + call Call_ExitMenu callba Function104148 xor a ret @@ -41807,7 +41807,7 @@ Function4a39a: ; 4a39a call Function4a485 call Function4a492 call Function4a3aa - call Function32f9 + call SetPalettes ret ; 4a3a7 @@ -41987,7 +41987,7 @@ Function4a4c4: ; 4a4c4 (12:64c4) hlcoord 1, 16 call PlaceString call Function3200 - call Function32f9 + call SetPalettes call Function1bc9 ld hl, wcfa9 ld b, [hl] @@ -42631,7 +42631,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 @@ -42762,7 +42762,7 @@ Function4aa34: ; 4aa34 callba PrintPartyMenuText call Function4aab6 call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame call Function4ab1a jr z, .asm_4aa66 @@ -45652,7 +45652,7 @@ Function4dfb6: ; 4dfb6 (13:5fb6) ld hl, wcf64 bit 4, [hl] jr nz, .asm_4dfd6 - call Function32f9 + call SetPalettes ret .asm_4dfd6 call Function4e226 @@ -45965,14 +45965,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 @@ -46156,7 +46156,7 @@ EggStatsScreen: ; 4e33a call PlaceString ld hl, wcf64 set 5, [hl] - call Function32f9 ; pals + call SetPalettes ; pals call DelayFrame hlcoord 0, 0 call Function3786 @@ -46799,7 +46799,7 @@ Function4e881: ; 4e881 ld hl, UnknownText_0x4e8bd call PrintText call Function3200 - call Function32f9 + call SetPalettes ret ; 4e8bd @@ -46839,7 +46839,7 @@ Function4e8c2: ; 4e8c2 ld [hSCX], a call EnableLCD call Function3200 - call Function32f9 + call SetPalettes ret ; 4e906 @@ -47157,7 +47157,7 @@ SelectMonFromParty: ; 50000 call WhiteBGMap call Function5003f call WaitBGMap - call Function32f9 + call SetPalettes call DelayFrame call PartyMenuSelect call Function2b74 @@ -47174,7 +47174,7 @@ Function5001d: ; 5001d call WaitBGMap ld b, $a call GetSGBLayout - call Function32f9 + call SetPalettes call DelayFrame call PartyMenuSelect call Function2b74 @@ -48230,7 +48230,7 @@ Function5067b: ; 5067b ld a, [PartyCount] cp [hl] jr nz, .asm_50682 - predef Function3d873 + predef CheckPlayerPartyForFitPkmn ld a, d ld [ScriptVar], a ret @@ -49385,15 +49385,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 @@ -53774,11 +53774,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 @@ -53806,7 +53806,7 @@ Function84560: ; 84560 pop af ld [hVBlank], a call Function84411 - call Function30b4 + call Call_LoadTempTileMapToTileMap xor a ld [rIF], a pop af @@ -53939,13 +53939,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 @@ -54716,7 +54716,7 @@ endr ld [hBGMapMode], a ld b, $1a call GetSGBLayout - call Function32f9 + call SetPalettes call Function86635 xor a ld [wc2c6], a @@ -54854,7 +54854,7 @@ Function86692: ; 86692 call WaitBGMap ld b, $1a call GetSGBLayout - call Function32f9 + call SetPalettes decoord 6, 5 ld c, $6 predef Functiond066e @@ -55015,7 +55015,7 @@ Function86810: ; 86810 ld [CurPartySpecies], a ld b, $1a call GetSGBLayout - call Function32f9 + call SetPalettes call Function86635 xor a ld [wc2c6], a @@ -55135,7 +55135,7 @@ Function88018: ; 88018 call Function88161 .asm_88051 - call Function1d7d + call Call_ExitMenu ret ; 88055 @@ -56433,7 +56433,7 @@ Function894ca: ; 894ca (22:54ca) call Function895c7 call Function8949c call Function8a60d - call Function32f9 + call SetPalettes pop bc ret @@ -57085,7 +57085,7 @@ Function89844: ; 89844 call Function897af push bc call Function3200 - call Function32f9 + call SetPalettes pop bc ret ; 89856 @@ -57594,9 +57594,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) @@ -57945,7 +57945,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 @@ -58151,7 +58151,7 @@ Function89e6f: ; 89e6f (22:5e6f) hlcoord 10, 4, AttrMap call Function8a5a3 call Function891ab - call Function32f9 + call SetPalettes jp Function89e36 Function89e9a: ; 89e9a (22:5e9a) @@ -58188,7 +58188,7 @@ Function89eb9: ; 89eb9 (22:5eb9) hlcoord 10, 4, AttrMap call Function8a5a3 call Function891ab - call Function32f9 + call SetPalettes jp Function89e36 Function89ee1: ; 89ee1 (22:5ee1) @@ -58369,7 +58369,7 @@ Function89fce: ; 89fce (22:5fce) hlcoord 10, 4, AttrMap call Function8a5a3 call Function89448 - call Function32f9 + call SetPalettes call Function891ab jp Function89e36 @@ -58716,7 +58716,7 @@ Function8a241: ; 8a241 (22:6241) .asm_8a254 call Function891de call WhiteBGMap - call Function1d7d + call Call_ExitMenu call Function891de and a ret @@ -58743,7 +58743,7 @@ Function8a262: ; 8a262 (22:6262) call Function8b36c call Function8b493 call Function891ab - call Function32f9 + call SetPalettes call Function8b5e7 ret @@ -58841,7 +58841,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 @@ -61780,7 +61780,7 @@ Function8b677: ; 8b677 call Function8b6ed call EnableLCD call Function891ab - call Function32f9 + call SetPalettes ret ; 8b690 @@ -69325,7 +69325,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 @@ -69337,7 +69337,7 @@ endr ret ; 909f2 -Unknown_909f2: ; 909f2 +WeekdaysStrings: ; 909f2 dw Sunday dw Monday dw Tuesday @@ -69397,13 +69397,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 @@ -69655,7 +69655,7 @@ Function90bea: ; 90bea (24:4bea) call Function90da8 ld b, $2 call GetSGBLayout - call Function32f9 + call SetPalettes ld a, [hCGB] and a ret z @@ -71442,7 +71442,7 @@ Function9191c: ; 9191c ld [wd005], a ld b, $2 call GetSGBLayout - call Function32f9 + call SetPalettes ld a, [hCGB] and a jr z, .asm_9198b @@ -71696,7 +71696,7 @@ _FlyMap: ; 91af3 call Function91c8f ld b, $2 call GetSGBLayout - call Function32f9 + call SetPalettes .loop call Functiona57 ld hl, hJoyPressed @@ -72118,7 +72118,7 @@ Function91d11: ; 91d11 call TownMapBGUpdate ld b, $2 call GetSGBLayout - call Function32f9 + call SetPalettes xor a ld [hBGMapMode], a xor a @@ -72628,7 +72628,7 @@ Function92311: ; 92311 ld [wd004], a ld b, $2 call GetSGBLayout - call Function32f9 + call SetPalettes .loop call Functiona57 ld hl, hJoyPressed @@ -75771,7 +75771,7 @@ Functionb9237: ; b9237 ld a, [wd1ec] ld e, a callba Function8cb4 - call Function32f9 + call SetPalettes xor a ld [hJoyPressed], a call Functionb929a @@ -76979,7 +76979,7 @@ Functioncc000: ; cc000 call WaitBGMap ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes ret ; cc0a7 @@ -83069,7 +83069,7 @@ _OptionsMenu: ; e41d0 call WaitBGMap ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes .asm_e4217 call Functiona57 ld a, [hJoyPressed] @@ -83636,7 +83636,7 @@ Functione4579: ; e4579 call WaitBGMap ld b, $19 call GetSGBLayout - call Function32f9 + call SetPalettes ld c, 10 call DelayFrames callab Copyright @@ -86753,7 +86753,7 @@ Functionfb8c8: ; fb8c8 ld [TempMonDVs + 1], a ld b, $1c call GetSGBLayout - call Function32f9 + call SetPalettes ret ; fb8f1 @@ -89503,7 +89503,7 @@ DoMysteryGift: ; 1048ba (41:48ba) call WaitBGMap ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes pop de hlcoord 2, 8 ld a, d @@ -90803,7 +90803,7 @@ Function105153: ; 105153 (41:5153) call WaitBGMap ld b, $1d call GetSGBLayout - call Function32f9 + call SetPalettes ret Function10522e: ; 10522e (41:522e) @@ -90981,7 +90981,7 @@ Function105777: ; 105777 (41:5777) call WaitBGMap ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes ret Function10578c: ; 10578c (41:578c) @@ -91106,7 +91106,7 @@ Function1057d7: ; 1057d7 (41:57d7) call WaitBGMap ld b, $2 callba Function4930f - jp Function32f9 + jp SetPalettes Function1058c6: ; 1058c6 (41:58c6) ld b, $6 @@ -92241,10 +92241,11 @@ endr ld [$ffbb], a ret -Function1062f7 +Function1062f7: ld a, [$ffbc] bit 7, a ret z + ld [hl], $f6 ret ; 1062ff @@ -92950,7 +92951,7 @@ Function1dc381: ; 1dc381 call WaitBGMap ld b, $3 call GetSGBLayout - call Function32f9 + call SetPalettes ret ; 1dc47b @@ -93002,7 +93003,7 @@ Function1dc47b: ; 1dc47b call WaitBGMap ld b, $3 call GetSGBLayout - call Function32f9 + call SetPalettes ret ; 1dc507 @@ -93144,18 +93145,18 @@ Function1dd6bb: ; 1dd6bb (77:56bb) ld bc, $8102 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 @@ -93333,22 +93334,22 @@ Function1de27f: ; 1de27f -Function1de28a:: ; 1de28a +Start_DudeAutoInput_A:: ; 1de28a ld hl, DudeAutoInput_A - jr Function1de299 + jr CallStartAutoInput ; 1de28f -Function1de28f: ; 1de28f +Start_DudeAutoInput_RightA: ; 1de28f ld hl, DudeAutoInput_RightA - jr Function1de299 + jr CallStartAutoInput ; 1de294 -Function1de294: ; 1de294 +Start_DudeAutoInput_DownA: ; 1de294 ld hl, DudeAutoInput_DownA - jr Function1de299 + jr CallStartAutoInput ; 1de299 -Function1de299: ; 1de299 +CallStartAutoInput: ; 1de299 ld a, BANK(DudeAutoInputs) call StartAutoInput ret diff --git a/misc/crystal_misc.asm b/misc/crystal_misc.asm index 67bef18bc..3c6ded567 100644 --- a/misc/crystal_misc.asm +++ b/misc/crystal_misc.asm @@ -50,7 +50,7 @@ Function17a6a8: ; 17a6a8 (5e:66a8) call Function17abcf callba Function49409 callba Function49420 - call Function32f9 + call SetPalettes call DelayFrame ret diff --git a/misc/mobile_40.asm b/misc/mobile_40.asm index fa3490f82..79d982cea 100644 --- a/misc/mobile_40.asm +++ b/misc/mobile_40.asm @@ -1615,6 +1615,7 @@ Function100a09: ; 100a09 ld a, [InLinkBattle] 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 @@ -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 7ae4f8327..1b0732f10 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 @@ -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 @@ -22185,10 +22185,10 @@ Function16d43b: ; 16d43b callba Function16d42e ld b, $8 call GetSGBLayout - call Function32f9 + call SetPalettes call WaitBGMap call Functiona36 - call Function1d7d + call Call_ExitMenu ret ; 16d465 @@ -22330,7 +22330,7 @@ Function16d6ce: ; 16d6ce call Function1d6e call Function16d6e1 callba Function87d - call Function1d7d + call Call_ExitMenu call Function3200 ret ; 16d6e1 @@ -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 9c38fbb27..d581467ff 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] @@ -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 55d8418b6..9cfc34b06 100644 --- a/text/battle.asm +++ b/text/battle.asm @@ -1,4 +1,4 @@ -BattleText_0x80730: ; 0x80730 +BattleText_PlayerPickuedUpPayDayMoney: ; 0x80730 text "<PLAYER> picked up" line "¥@" deciram wPayDayMoney, $36 @@ -307,7 +307,7 @@ BattleText_GotAwaySafely: ; 0x80b77 text "Got away safely!" prompt -BattleText_0x80b89: ; 0x80b89 +BattleText_UserFledUsingAStringBuffer1: ; 0x80b89 text "<USER>" line "fled using a" cont "@" @@ -321,7 +321,7 @@ BattleText_CantEscape: ; 0x80ba0 prompt ; 0x80bae -BattleText_0x80bae: ; 0x80bae +BattleText_UserHurtBySpikes: ; 0x80bae text "<USER>'s" line "hurt by SPIKES!" prompt @@ -336,7 +336,7 @@ RecoveredUsingText: ; 0x80bc2 prompt ; 0x80bde -BattleText_0x80bde: ; 0x80bde +BattleText_UsersStringBuffer1Activated: ; 0x80bde text "<USER>'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 "<TARGET>'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 "<USER>'s" line "hurt by" cont "@" @@ -504,7 +504,7 @@ BattleText_0x80de2: ; 0x80de2 prompt ; 0x80df5 -BattleText_0x80df5: ; 0x80df5 +BattleText_UserWasReleasedFromStringBuffer1: ; 0x80df5 text "<USER>" line "was released from" cont "@" diff --git a/text/common_3.asm b/text/common_3.asm index 02adfea43..81e916994 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, $24 @@ -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 diff --git a/text/common_4.asm b/text/common_4.asm index c96d032f8..6167dd185 100644 --- a/text/common_4.asm +++ b/text/common_4.asm @@ -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." @@ -1674,7 +1674,7 @@ UnknownText_0x1c5fd1: ; 0x1c5fd1 prompt ; 0x1c5fde -UnknownText_0x1c5fde: ; 0x1c5fde +Text_DSTIsThatOK: ; 0x1c5fde text " DST," line "is that OK?" done @@ -819,13 +819,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 @@ -887,17 +887,17 @@ wc7e8:: ds 24 RSSET 0 ; Offsets for wBT_OTTempCopy:: @ $c608 -wBT_OTTempCopy_0 RB $A ; $c608 -wBT_OTTempCopy_TrainerClass RB $1 ; $c608 + $a = $c612 -wBT_OTTempCopy_Pkmn1 RB $30 ; $c608 + $b = $c613 -wBT_OTTempCopy_Pkmn1Name RB $A ; $c608 + $3b = $c643 -wBT_OTTempCopy_45 RB $1 ; $c608 + $45 = $c64d -wBT_OTTempCopy_Pkmn2 RB $30 ; $c608 + $46 = $c64e -wBT_OTTempCopy_Pkmn2Name RB $A ; $c608 + $76 = $c67e -wBT_OTTempCopy_80 RB $1 ; $c608 + $80 = $c688 -wBT_OTTempCopy_Pkmn3 RB $30 ; $c608 + $81 = $c689 -wBT_OTTempCopy_Pkmn3Name RB $A ; $c608 + $b1 = $c6b9 -wBT_OTTempCopy_BB RB $1 ; $c608 + $bb = $c6c3 +wBT_OTTempCopy_0 RB $A ; $c608 +wBT_OTTempCopy_TrainerClass RB $1 ; $c608 + $a = $c612 +wBT_OTTempCopy_Pkmn1 RB $30 ; $c608 + $b = $c613 +wBT_OTTempCopy_Pkmn1Name RB $A ; $c608 + $3b = $c643 +wBT_OTTempCopy_45 RB $1 ; $c608 + $45 = $c64d +wBT_OTTempCopy_Pkmn2 RB $30 ; $c608 + $46 = $c64e +wBT_OTTempCopy_Pkmn2Name RB $A ; $c608 + $76 = $c67e +wBT_OTTempCopy_80 RB $1 ; $c608 + $80 = $c688 +wBT_OTTempCopy_Pkmn3 RB $30 ; $c608 + $81 = $c689 +wBT_OTTempCopy_Pkmn3Name RB $A ; $c608 + $b1 = $c6b9 +wBT_OTTempCopy_BB RB $1 ; $c608 + $bb = $c6c3 GLOBAL wBT_OTTempCopy_TrainerClass, wBT_OTTempCopy_Pkmn1, wBT_OTTempCopy_Pkmn1Name, wBT_OTTempCopy_45, wBT_OTTempCopy_Pkmn2, wBT_OTTempCopy_Pkmn2Name, wBT_OTTempCopy_80, wBT_OTTempCopy_Pkmn3, wBT_OTTempCopy_Pkmn3Name, wBT_OTTempCopy_BB @@ -1758,17 +1758,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 @@ -2421,7 +2421,9 @@ wdc7c:: ds 33 wdc9d:: ds 2 wdc9f:: ds 1 wdca0:: ds 1 -wdca1:: ds 3 +RepelStepsLeft:: ; If a Repel is in use, it contains the nr of steps it's still active + ds 1 +wdca2:: ds 2 wdca4:: ds 1 wPlayerDataEnd:: @@ -2586,7 +2588,9 @@ wPokemonDataEnd:: 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 |