Keep documentation in sync with new WRAM labels

This commit is contained in:
Rangi 2018-02-03 20:40:21 -05:00
parent 32ed487a47
commit 271aa20b73
11 changed files with 557 additions and 285 deletions

View File

@ -164,12 +164,12 @@ BattleCommand_BellyDrum: ; 37c1a
; before checking that it has enough HP to use the move. ; before checking that it has enough HP to use the move.
; Swap the order of these two blocks to fix. ; Swap the order of these two blocks to fix.
call BattleCommand_AttackUp2 call BattleCommand_AttackUp2
ld a, [AttackMissed] ld a, [wAttackMissed]
and a and a
jr nz, .failed jr nz, .failed
callab GetHalfMaxHP callfar GetHalfMaxHP
callab CheckUserHasEnoughHP callfar CheckUserHasEnoughHP
jr nc, .failed jr nc, .failed
``` ```
@ -178,12 +178,12 @@ BattleCommand_BellyDrum: ; 37c1a
```asm ```asm
BattleCommand_BellyDrum: ; 37c1a BattleCommand_BellyDrum: ; 37c1a
; bellydrum ; bellydrum
callab GetHalfMaxHP callfar GetHalfMaxHP
callab CheckUserHasEnoughHP callfar CheckUserHasEnoughHP
jr nc, .failed jr nc, .failed
call BattleCommand_AttackUp2 call BattleCommand_AttackUp2
ld a, [AttackMissed] ld a, [wAttackMissed]
and a and a
jr nz, .failed jr nz, .failed
``` ```
@ -256,8 +256,7 @@ This is a bug with `CheckPlayerHasUsableMoves` in [engine/battle/core.asm](/engi
```asm ```asm
.done .done
; Bug: this will result in a move with PP Up confusing the game. ; Bug: this will result in a move with PP Up confusing the game.
; Replace with "and $3f" to fix. and a ; should be "and PP_MASK"
and a
ret nz ret nz
.force_struggle .force_struggle
@ -269,7 +268,7 @@ This is a bug with `CheckPlayerHasUsableMoves` in [engine/battle/core.asm](/engi
ret ret
``` ```
**Fix:** Change `and a` to `and $3f`. **Fix:** Change `and a` to `and PP_MASK`.
## A Pokémon that fainted from Pursuit will have its old status condition when revived ## A Pokémon that fainted from Pursuit will have its old status condition when revived
@ -312,7 +311,7 @@ This is a bug with `BattleCommand_BeatUp` in [engine/battle/move_effects/beat_up
```asm ```asm
.got_mon .got_mon
ld a, [wd002] ld a, [wd002]
ld hl, PartyMonNicknames ld hl, wPartyMonNicknames
call GetNick call GetNick
ld a, MON_HP ld a, MON_HP
call GetBeatupMonLocation call GetBeatupMonLocation
@ -321,11 +320,11 @@ This is a bug with `BattleCommand_BeatUp` in [engine/battle/move_effects/beat_up
jp z, .beatup_fail ; fainted jp z, .beatup_fail ; fainted
ld a, [wd002] ld a, [wd002]
ld c, a ld c, a
ld a, [CurBattleMon] ld a, [wCurBattleMon]
; BUG: this can desynchronize link battles ; BUG: this can desynchronize link battles
; Change "cp [hl]" to "cp c" to fix ; Change "cp [hl]" to "cp c" to fix
cp [hl] cp [hl]
ld hl, BattleMonStatus ld hl, wBattleMonStatus
jr z, .active_mon jr z, .active_mon
ld a, MON_STATUS ld a, MON_STATUS
call GetBeatupMonLocation call GetBeatupMonLocation
@ -391,13 +390,13 @@ This is a bug with `AI_Smart_MeanLook` in [engine/battle/ai/scoring.asm](/engine
```asm ```asm
; 80% chance to greatly encourage this move if the enemy is badly poisoned (buggy). ; 80% chance to greatly encourage this move if the enemy is badly poisoned (buggy).
; Should check PlayerSubStatus5 instead. ; Should check wPlayerSubStatus5 instead.
ld a, [EnemySubStatus5] ld a, [wEnemySubStatus5]
bit SUBSTATUS_TOXIC, a bit SUBSTATUS_TOXIC, a
jr nz, .asm_38e26 jr nz, .asm_38e26
``` ```
**Fix:** Change `EnemySubStatus5` to `PlayerSubStatus5`. **Fix:** Change `wEnemySubStatus5` to `wPlayerSubStatus5`.
## AI makes a false assumption about `CheckTypeMatchup` ## AI makes a false assumption about `CheckTypeMatchup`
@ -406,11 +405,11 @@ In [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
```asm ```asm
BattleCheckTypeMatchup: ; 347c8 BattleCheckTypeMatchup: ; 347c8
ld hl, EnemyMonType1 ld hl, wEnemyMonType1
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, CheckTypeMatchup jr z, CheckTypeMatchup
ld hl, BattleMonType1 ld hl, wBattleMonType1
CheckTypeMatchup: ; 347d3 CheckTypeMatchup: ; 347d3
; There is an incorrect assumption about this function made in the AI related code: when ; There is an incorrect assumption about this function made in the AI related code: when
; the AI calls CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing the ; the AI calls CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing the
@ -437,24 +436,24 @@ This is a bug with `AI_HealStatus` in [engine/battle/ai/items.asm](/engine/battl
```asm ```asm
AI_HealStatus: ; 384e0 AI_HealStatus: ; 384e0
ld a, [CurOTMon] ld a, [wCurOTMon]
ld hl, OTPartyMon1Status ld hl, wOTPartyMon1Status
ld bc, PARTYMON_STRUCT_LENGTH ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes call AddNTimes
xor a xor a
ld [hl], a ld [hl], a
ld [EnemyMonStatus], a ld [wEnemyMonStatus], a
; Bug: this should reset SUBSTATUS_NIGHTMARE too ; Bug: this should reset SUBSTATUS_NIGHTMARE too
; Uncomment the lines below to fix ; Uncomment the lines below to fix
; ld hl, EnemySubStatus1 ; ld hl, wEnemySubStatus1
; res SUBSTATUS_NIGHTMARE, [hl] ; res SUBSTATUS_NIGHTMARE, [hl]
ld hl, EnemySubStatus5 ld hl, wEnemySubStatus5
res SUBSTATUS_TOXIC, [hl] res SUBSTATUS_TOXIC, [hl]
ret ret
; 384f7 ; 384f7
``` ```
**Fix:** Uncomment `ld hl, EnemySubStatus1` and `res SUBSTATUS_NIGHTMARE, [hl]`. **Fix:** Uncomment `ld hl, wEnemySubStatus1` and `res SUBSTATUS_NIGHTMARE, [hl]`.
## HP bar animation is slow for high HP ## HP bar animation is slow for high HP
@ -493,11 +492,12 @@ This is a bug with `ShortHPBar_CalcPixelFrame` in [engine/anim_hp_bar.asm](/engi
```asm ```asm
ld b, 0 ld b, 0
; This routine is buggy. If [wCurHPAnimMaxHP] * [wCurHPBarPixels] is divisible ; This routine is buggy. If [wCurHPAnimMaxHP] * [wCurHPBarPixels] is
; by 48, the loop runs one extra time. To fix, uncomment the line below. ; divisible by HP_BAR_LENGTH_PX, the loop runs one extra time.
; To fix, uncomment the line below.
.loop .loop
ld a, l ld a, l
sub 6 * 8 sub HP_BAR_LENGTH_PX
ld l, a ld l, a
ld a, h ld a, h
sbc $0 sbc $0
@ -517,12 +517,12 @@ This is a bug with `ShortHPBar_CalcPixelFrame` in [engine/anim_hp_bar.asm](/engi
This can bring Pokémon straight from level 1 to 100 by gaining just a few experience points. This can bring Pokémon straight from level 1 to 100 by gaining just a few experience points.
This is a bug with `CalcExpAtLevel` in [main.asm](/main.asm): This is a bug with `CalcExpAtLevel` in [engine/experience.asm](/engine/experience.asm):
```asm ```asm
CalcExpAtLevel: ; 50e47 CalcExpAtLevel: ; 50e47
; (a/b)*n**3 + c*n**2 + d*n - e ; (a/b)*n**3 + c*n**2 + d*n - e
ld a, [BaseGrowthRate] ld a, [wBaseGrowthRate]
add a add a
add a add a
ld c, a ld c, a
@ -549,7 +549,7 @@ CalcExpAtLevel: ; 50e47
ret ret
.UseExpFormula .UseExpFormula
ld a, [BaseGrowthRate] ld a, [wBaseGrowthRate]
add a add a
add a add a
ld c, a ld c, a
@ -563,45 +563,44 @@ CalcExpAtLevel: ; 50e47
([Video](https://www.youtube.com/watch?v=o54VjpAEoO8)) ([Video](https://www.youtube.com/watch?v=o54VjpAEoO8))
This is a bug with `Text_ABoostedStringBuffer2ExpPoints` and `Text_StringBuffer2ExpPoints` in [text/common_2.asm](/text/common_2.asm): This is a bug with `Text_ABoostedStringBuffer2ExpPoints` and `Text_StringBuffer2ExpPoints` in [data/text/common_2.asm](/data/text/common_2.asm):
```asm ```asm
Text_ABoostedStringBuffer2ExpPoints:: Text_ABoostedStringBuffer2ExpPoints::
text_start text_start
line "a boosted" line "a boosted"
cont "@" cont "@"
deciram StringBuffer2, 2, 4 deciram wStringBuffer2, 2, 4
text " EXP. Points!" text " EXP. Points!"
prompt prompt
Text_StringBuffer2ExpPoints:: Text_StringBuffer2ExpPoints::
text_start text_start
line "@" line "@"
deciram StringBuffer2, 2, 4 deciram wStringBuffer2, 2, 4
text " EXP. Points!" text " EXP. Points!"
prompt prompt
``` ```
**Fix:** Change both `deciram StringBuffer2, 2, 4` to `deciram StringBuffer2, 2, 5`. **Fix:** Change both `deciram wStringBuffer2, 2, 4` to `deciram wStringBuffer2, 2, 5`.
## BRN/PSN/PAR do not affect catch rate ## BRN/PSN/PAR do not affect catch rate
This is a bug with `PokeBall` in [items/item_effects.asm](/items/item_effects.asm): This is a bug with `PokeBall` in [engine/item_effects.asm](/engine/item_effects.asm):
```asm ```asm
.statuscheck
; This routine is buggy. It was intended that SLP and FRZ provide a higher ; This routine is buggy. It was intended that SLP and FRZ provide a higher
; catch rate than BRN/PSN/PAR, which in turn provide a higher catch rate than ; catch rate than BRN/PSN/PAR, which in turn provide a higher catch rate than
; no status effect at all. But instead, it makes BRN/PSN/PAR provide no ; no status effect at all. But instead, it makes BRN/PSN/PAR provide no
; benefit. ; benefit.
; Uncomment the line below to fix this. ; Uncomment the line below to fix this.
ld b, a ld b, a
ld a, [EnemyMonStatus] ld a, [wEnemyMonStatus]
and 1 << FRZ | SLP and 1 << FRZ | SLP
ld c, 10 ld c, 10
jr nz, .addstatus jr nz, .addstatus
; ld a, [EnemyMonStatus] ; ld a, [wEnemyMonStatus]
and a and a
ld c, 5 ld c, 5
jr nz, .addstatus jr nz, .addstatus
@ -614,7 +613,7 @@ This is a bug with `PokeBall` in [items/item_effects.asm](/items/item_effects.as
.max_1 .max_1
``` ```
**Fix:** Uncomment `ld a, [EnemyMonStatus]`. **Fix:** Uncomment `ld a, [wEnemyMonStatus]`.
## Moon Ball does not boost catch rate ## Moon Ball does not boost catch rate
@ -695,7 +694,7 @@ FastBallMultiplier:
*Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.* *Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.*
This is a bug with `ItemAttributes` in [items/attributes.asm](/items/attributes.asm): This is a bug with `ItemAttributes` in [data/items/attributes.asm](/data/items/attributes.asm):
```asm ```asm
; DRAGON FANG ; DRAGON FANG
@ -733,7 +732,7 @@ This is a bug with `HaircutOrGrooming` in [engine/events/special.asm](/engine/ev
.ok .ok
inc hl inc hl
ld a, [hli] ld a, [hli]
ld [ScriptVar], a ld [wScriptVar], a
ld c, [hl] ld c, [hl]
call ChangeHappiness call ChangeHappiness
ret ret
@ -743,8 +742,8 @@ This is a bug with `HaircutOrGrooming` in [engine/events/special.asm](/engine/ev
INCLUDE "data/events/happiness_chances.asm" INCLUDE "data/events/happiness_chances.asm"
CopyPokemonName_Buffer1_Buffer3: ; 746e CopyPokemonName_Buffer1_Buffer3: ; 746e
ld hl, StringBuffer1 ld hl, wStringBuffer1
ld de, StringBuffer3 ld de, wStringBuffer3
ld bc, MON_NAME_LENGTH ld bc, MON_NAME_LENGTH
jp CopyBytes jp CopyBytes
``` ```
@ -771,19 +770,23 @@ This is a bug with `LoadEnemyMon.CheckMagikarpArea` in [engine/battle/core.asm](
```asm ```asm
.CheckMagikarpArea: .CheckMagikarpArea:
; The z checks are supposed to be nz ; The "jr z" checks are supposed to be "jr nz".
; Instead, all maps in GROUP_LAKE_OF_RAGE (mahogany area)
; and routes 20 and 44 are treated as Lake of Rage ; Instead, all maps in GROUP_LAKE_OF_RAGE (Mahogany area)
; and Routes 20 and 44 are treated as Lake of Rage.
; This also means Lake of Rage Magikarp can be smaller than ones ; This also means Lake of Rage Magikarp can be smaller than ones
; caught elsewhere rather than the other way around ; caught elsewhere rather than the other way around.
; Intended behavior enforces a minimum size at Lake of Rage ; Intended behavior enforces a minimum size at Lake of Rage.
; The real behavior prevents size flooring in the Lake of Rage area ; The real behavior prevents a minimum size in the Lake of Rage area.
ld a, [MapGroup]
; Moreover, due to the check not being translated to feet+inches, all Magikarp
; smaller than 4'0" may be caught by the filter, a lot more than intended.
ld a, [wMapGroup]
cp GROUP_LAKE_OF_RAGE cp GROUP_LAKE_OF_RAGE
jr z, .Happiness jr z, .Happiness
ld a, [MapNumber] ld a, [wMapNumber]
cp MAP_LAKE_OF_RAGE cp MAP_LAKE_OF_RAGE
jr z, .Happiness jr z, .Happiness
``` ```
@ -797,31 +800,31 @@ This is a bug with `LoadEnemyMon.CheckMagikarpArea` in [engine/battle/core.asm](
```asm ```asm
; Get Magikarp's length ; Get Magikarp's length
ld de, EnemyMonDVs ld de, wEnemyMonDVs
ld bc, PlayerID ld bc, wPlayerID
callfar CalcMagikarpLength callfar CalcMagikarpLength
; No reason to keep going if length > 1536 (i.e. if length / 256 != 6) ; No reason to keep going if length > 1536 mm (i.e. if HIGH(length) > 6 feet)
ld a, [wMagikarpLength] ld a, [wMagikarpLength]
cp HIGH(1536) ; this compares to 6'0'', should be cp 5 cp HIGH(1536) ; should be "cp 5", since 1536 mm = 5'0", but HIGH(1536) = 6
jr nz, .CheckMagikarpArea jr nz, .CheckMagikarpArea
; 5% chance of skipping both size checks ; 5% chance of skipping both size checks
call Random call Random
cp 5 percent cp 5 percent
jr c, .CheckMagikarpArea jr c, .CheckMagikarpArea
; Try again if length > 1615 ; Try again if length >= 1616 mm (i.e. if LOW(length) >= 3 inches)
ld a, [wMagikarpLength + 1] ld a, [wMagikarpLength + 1]
cp LOW(1616) ; this compares to 6'80'', should be cp 3 cp LOW(1616) ; should be "cp 3", since 1616 mm = 5'3", but LOW(1616) = 80
jr nc, .GenerateDVs jr nc, .GenerateDVs
; 20% chance of skipping this check ; 20% chance of skipping this check
call Random call Random
cp 20 percent - 1 cp 20 percent - 1
jr c, .CheckMagikarpArea jr c, .CheckMagikarpArea
; Try again if length > 1599 ; Try again if length >= 1600 mm (i.e. if LOW(length) >= 2 inches)
ld a, [wMagikarpLength + 1] ld a, [wMagikarpLength + 1]
cp LOW(1600) ; this compares to 6'64'', should be cp 2 cp LOW(1600) ; should be "cp 2", since 1600 mm = 5'2", but LOW(1600) = 64
jr nc, .GenerateDVs jr nc, .GenerateDVs
``` ```
@ -853,18 +856,18 @@ This is a bug with `CalcMagikarpLength.BCLessThanDE` in [engine/events/magikarp.
([Video](https://www.youtube.com/watch?v=eij_1060SMc)) ([Video](https://www.youtube.com/watch?v=eij_1060SMc))
This is a bug with `StartTrainerBattle_DetermineWhichAnimation` in [engine/battle_start.asm](/engine/battle_start.asm): This is a bug with `StartTrainerBattle_DetermineWhichAnimation` in [engine/battle/battle_transition.asm](/engine/battle/battle_transition.asm):
```asm ```asm
StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365) StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365)
; The screen flashes a different number of times depending on the level of ; The screen flashes a different number of times depending on the level of
; your lead Pokemon relative to the opponent's. ; your lead Pokemon relative to the opponent's.
; BUG: BattleMonLevel and EnemyMonLevel are not set at this point, so whatever ; BUG: wBattleMonLevel and wEnemyMonLevel are not set at this point, so whatever
; values happen to be there will determine the animation. ; values happen to be there will determine the animation.
ld de, 0 ld de, 0
ld a, [BattleMonLevel] ld a, [wBattleMonLevel]
add 3 add 3
ld hl, EnemyMonLevel ld hl, wEnemyMonLevel
cp [hl] cp [hl]
jr nc, .okay jr nc, .okay
set 0, e set 0, e
@ -905,7 +908,7 @@ This is a bug with `Slots_PayoutAnim` in [engine/slot_machine.asm](/engine/slot_
ld [hl], e ld [hl], e
dec hl dec hl
ld [hl], d ld [hl], d
ld a, [wcf64] ld a, [wSlotsDelay]
and $7 and $7
ret z ; ret nz would be more appropriate ret z ; ret nz would be more appropriate
ld de, SFX_GET_COIN_FROM_SLOTS ld de, SFX_GET_COIN_FROM_SLOTS
@ -918,10 +921,10 @@ This is a bug with `Slots_PayoutAnim` in [engine/slot_machine.asm](/engine/slot_
## Team Rocket battle music is not used for Executives or Scientists ## Team Rocket battle music is not used for Executives or Scientists
This is a bug with `PlayBattleMusic` in [main.asm](/main.asm): This is a bug with `PlayBattleMusic` in [engine/battle/start_battle.asm](/engine/battle/start_battle.asm):
```asm ```asm
; really, they should have included admins and scientists here too... ; They should have included EXECUTIVEM, EXECUTIVEF, and SCIENTIST too...
ld de, MUSIC_ROCKET_BATTLE ld de, MUSIC_ROCKET_BATTLE
cp GRUNTM cp GRUNTM
jr z, .done jr z, .done
@ -956,20 +959,20 @@ This is a bug with `DoPlayerMovement.CheckWarp` in [engine/player_movement.asm](
; This causes wd041 to be nonzero when standing on tile $3e, ; This causes wd041 to be nonzero when standing on tile $3e,
; making bumps silent. ; making bumps silent.
ld a, [WalkingDirection] ld a, [wWalkingDirection]
; cp STANDING ; cp STANDING
; jr z, .not_warp ; jr z, .not_warp
ld e, a ld e, a
ld d, 0 ld d, 0
ld hl, .EdgeWarps ld hl, .EdgeWarps
add hl, de add hl, de
ld a, [PlayerStandingTile] ld a, [wPlayerStandingTile]
cp [hl] cp [hl]
jr nz, .not_warp jr nz, .not_warp
ld a, 1 ld a, 1
ld [wd041], a ld [wd041], a
ld a, [WalkingDirection] ld a, [wWalkingDirection]
; This is in the wrong place. ; This is in the wrong place.
cp STANDING cp STANDING
jr z, .not_warp jr z, .not_warp
@ -978,20 +981,20 @@ This is a bug with `DoPlayerMovement.CheckWarp` in [engine/player_movement.asm](
**Fix:** **Fix:**
```asm ```asm
ld a, [WalkingDirection] ld a, [wWalkingDirection]
cp STANDING cp STANDING
jr z, .not_warp jr z, .not_warp
ld e, a ld e, a
ld d, 0 ld d, 0
ld hl, .EdgeWarps ld hl, .EdgeWarps
add hl, de add hl, de
ld a, [PlayerStandingTile] ld a, [wPlayerStandingTile]
cp [hl] cp [hl]
jr nz, .not_warp jr nz, .not_warp
ld a, 1 ld a, 1
ld [wd041], a ld [wd041], a
ld a, [WalkingDirection] ld a, [wWalkingDirection]
``` ```
@ -1051,7 +1054,7 @@ This bug prevents you from using blocksets with more than 128 blocks.
In [home/map.asm](/home/map.asm): In [home/map.asm](/home/map.asm):
```asm ```asm
; Set hl to the address of the current metatile data ([TilesetBlocksAddress] + (a) tiles). ; Set hl to the address of the current metatile data ([wTilesetBlocksAddress] + (a) tiles).
; This is buggy; it wraps around past 128 blocks. ; This is buggy; it wraps around past 128 blocks.
; To fix, uncomment the line below. ; To fix, uncomment the line below.
add a ; Comment or delete this line to fix the above bug. add a ; Comment or delete this line to fix the above bug.
@ -1061,10 +1064,10 @@ In [home/map.asm](/home/map.asm):
add hl, hl add hl, hl
add hl, hl add hl, hl
add hl, hl add hl, hl
ld a, [TilesetBlocksAddress] ld a, [wTilesetBlocksAddress]
add l add l
ld l, a ld l, a
ld a, [TilesetBlocksAddress + 1] ld a, [wTilesetBlocksAddress + 1]
adc h adc h
ld h, a ld h, a
``` ```
@ -1081,7 +1084,7 @@ In [home/map.asm](/home/map.asm):
## `Function6ec1` does not correctly limit object movement ## `Function6ec1` does not correctly limit object movement
This bug is why the Lapras in Union Cave, which uses `SPRITEMOVEDATA_SWIM_WANDER`, is not restricted by its `1, 1` movement radius. This bug is why the Lapras in [maps/UnionCaveB2F.asm](/maps/UnionCaveB2F.asm), which uses `SPRITEMOVEDATA_SWIM_WANDER`, is not restricted by its `1, 1` movement radius.
In [engine/npc_movement.asm](/engine/npc_movement.asm): In [engine/npc_movement.asm](/engine/npc_movement.asm):
@ -1108,7 +1111,7 @@ In [engine/search.asm](/engine/search.asm):
; This only checks five characters, which is fine for the Japanese version, ; This only checks five characters, which is fine for the Japanese version,
; but in the English version the player name is 7 characters, so this is wrong. ; but in the English version the player name is 7 characters, so this is wrong.
ld hl, PlayerName ld hl, wPlayerName
rept NAME_LENGTH_JAPANESE + -2 ; should be PLAYER_NAME_LENGTH + -2 rept NAME_LENGTH_JAPANESE + -2 ; should be PLAYER_NAME_LENGTH + -2
ld a, [de] ld a, [de]
@ -1123,13 +1126,6 @@ endr
ld a, [de] ld a, [de]
cp [hl] cp [hl]
jr z, .found jr z, .found
.notfound
pop de
pop hl
pop bc
and a
ret
``` ```
**Fix:** Change `rept NAME_LENGTH_JAPANESE + -2` to `rept PLAYER_NAME_LENGTH + -2`. **Fix:** Change `rept NAME_LENGTH_JAPANESE + -2` to `rept PLAYER_NAME_LENGTH + -2`.
@ -1139,49 +1135,49 @@ endr
This bug can affect Mew or Pokémon other than Ditto that used Transform via Mirror Move or Sketch. This bug can affect Mew or Pokémon other than Ditto that used Transform via Mirror Move or Sketch.
This is a bug with `PokeBall` in [items/item_effects.asm](/items/item_effects.asm): This is a bug with `PokeBall` in [engine/item_effects.asm](/engine/item_effects.asm):
```asm ```asm
ld hl, EnemySubStatus5 ld hl, wEnemySubStatus5
ld a, [hl] ld a, [hl]
push af push af
set SUBSTATUS_TRANSFORMED, [hl] set SUBSTATUS_TRANSFORMED, [hl]
; This code is buggy. Any wild Pokémon that has Transformed will be ; This code is buggy. Any wild Pokémon that has Transformed will be
; caught as a Ditto, even if it was something else like Mew. ; caught as a Ditto, even if it was something else like Mew.
; To fix, do not set [TempEnemyMonSpecies] to DITTO. ; To fix, do not set [wTempEnemyMonSpecies] to DITTO.
bit SUBSTATUS_TRANSFORMED, a bit SUBSTATUS_TRANSFORMED, a
jr nz, .ditto jr nz, .ditto
jr .not_ditto jr .not_ditto
.ditto .ditto
ld a, DITTO ld a, DITTO
ld [TempEnemyMonSpecies], a ld [wTempEnemyMonSpecies], a
jr .load_data jr .load_data
.not_ditto .not_ditto
set SUBSTATUS_TRANSFORMED, [hl] set SUBSTATUS_TRANSFORMED, [hl]
ld hl, wEnemyBackupDVs ld hl, wEnemyBackupDVs
ld a, [EnemyMonDVs] ld a, [wEnemyMonDVs]
ld [hli], a ld [hli], a
ld a, [EnemyMonDVs + 1] ld a, [wEnemyMonDVs + 1]
ld [hl], a ld [hl], a
.load_data .load_data
ld a, [TempEnemyMonSpecies] ld a, [wTempEnemyMonSpecies]
ld [CurPartySpecies], a ld [wCurPartySpecies], a
ld a, [EnemyMonLevel] ld a, [wEnemyMonLevel]
ld [CurPartyLevel], a ld [wCurPartyLevel], a
callba LoadEnemyMon farcall LoadEnemyMon
pop af pop af
ld [EnemySubStatus5], a ld [wEnemySubStatus5], a
``` ```
**Fix:** **Fix:**
```asm ```asm
ld hl, EnemySubStatus5 ld hl, wEnemySubStatus5
ld a, [hl] ld a, [hl]
push af push af
set SUBSTATUS_TRANSFORMED, [hl] set SUBSTATUS_TRANSFORMED, [hl]
@ -1190,20 +1186,20 @@ This is a bug with `PokeBall` in [items/item_effects.asm](/items/item_effects.as
jr nz, .load_data jr nz, .load_data
ld hl, wEnemyBackupDVs ld hl, wEnemyBackupDVs
ld a, [EnemyMonDVs] ld a, [wEnemyMonDVs]
ld [hli], a ld [hli], a
ld a, [EnemyMonDVs + 1] ld a, [wEnemyMonDVs + 1]
ld [hl], a ld [hl], a
.load_data .load_data
ld a, [TempEnemyMonSpecies] ld a, [wTempEnemyMonSpecies]
ld [CurPartySpecies], a ld [wCurPartySpecies], a
ld a, [EnemyMonLevel] ld a, [wEnemyMonLevel]
ld [CurPartyLevel], a ld [wCurPartyLevel], a
callba LoadEnemyMon farcall LoadEnemyMon
pop af pop af
ld [EnemySubStatus5], a ld [wEnemySubStatus5], a
``` ```
@ -1211,13 +1207,13 @@ This is a bug with `PokeBall` in [items/item_effects.asm](/items/item_effects.as
([Video](https://www.youtube.com/watch?v=v1ErZdLCIyU)) ([Video](https://www.youtube.com/watch?v=v1ErZdLCIyU))
This is a bug with `ParkBall` in [items/item_effects.asm](/items/item_effects.asm): This is a bug with `ParkBall` in [engine/item_effects.asm](/engine/item_effects.asm):
```asm ```asm
.room_in_party .room_in_party
xor a xor a
ld [wWildMon], a ld [wWildMon], a
ld a, [CurItem] ld a, [wCurItem]
cp PARK_BALL cp PARK_BALL
call nz, ReturnToBattle_UseBall call nz, ReturnToBattle_UseBall
``` ```
@ -1228,7 +1224,7 @@ This is a bug with `ParkBall` in [items/item_effects.asm](/items/item_effects.as
.room_in_party .room_in_party
xor a xor a
ld [wWildMon], a ld [wWildMon], a
ld a, [BattleType] ld a, [wBattleType]
cp BATTLETYPE_CONTEST cp BATTLETYPE_CONTEST
call nz, ReturnToBattle_UseBall call nz, ReturnToBattle_UseBall
``` ```
@ -1236,23 +1232,26 @@ This is a bug with `ParkBall` in [items/item_effects.asm](/items/item_effects.as
## `HELD_CATCH_CHANCE` has no effect ## `HELD_CATCH_CHANCE` has no effect
This is a bug with `PokeBall` in [items/item_effects.asm](/items/item_effects.asm): This is a bug with `PokeBall` in [engine/item_effects.asm](/engine/item_effects.asm):
```asm ```asm
; BUG: callba overwrites a, ; BUG: farcall overwrites a, and GetItemHeldEffect takes b anyway.
; and GetItemHeldEffect takes b anyway. ; This is probably the reason the HELD_CATCH_CHANCE effect is never used.
; This is probably the reason
; the HELD_CATCH_CHANCE effect
; is never used.
; Uncomment the line below to fix. ; Uncomment the line below to fix.
ld d, a
ld a, [BattleMonItem] push de
; ld b, a ld a, [wBattleMonItem]
callba GetItemHeldEffect ; ld b, a
farcall GetItemHeldEffect
ld a, b ld a, b
cp HELD_CATCH_CHANCE cp HELD_CATCH_CHANCE
pop de
ld a, d
jr nz, .max_2
add c
jr nc, .max_2
ld a, $ff
.max_2
``` ```
**Fix:** Uncomment `ld b, a`. **Fix:** Uncomment `ld b, a`.
@ -1264,21 +1263,21 @@ This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` i
```asm ```asm
.DetermineCompatibility: ; 50268 .DetermineCompatibility: ; 50268
ld de, StringBuffer1 ld de, wStringBuffer1
ld a, BANK(EvosAttacksPointers) ld a, BANK(EvosAttacksPointers)
ld bc, 2 ld bc, 2
call FarCopyBytes call FarCopyBytes
ld hl, StringBuffer1 ld hl, wStringBuffer1
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
ld de, StringBuffer1 ld de, wStringBuffer1
ld a, BANK(EvosAttacks) ld a, BANK(EvosAttacks)
ld bc, 10 ld bc, 10
call FarCopyBytes call FarCopyBytes
``` ```
**Fix:** Change `ld bc, 10` to `ld bc, StringBuffer2 - StringBuffer1` to support up to six Stone entries. **Fix:** Change `ld bc, 10` to `ld bc, wStringBuffer2 - wStringBuffer1` to support up to six Stone entries.
## `ScriptCall` can overflow `wScriptStack` and crash ## `ScriptCall` can overflow `wScriptStack` and crash
@ -1290,7 +1289,7 @@ ScriptCall:
; Bug: The script stack has a capacity of 5 scripts, yet there is ; Bug: The script stack has a capacity of 5 scripts, yet there is
; nothing to stop you from pushing a sixth script. The high part ; nothing to stop you from pushing a sixth script. The high part
; of the script address can then be overwritten by modifications ; of the script address can then be overwritten by modifications
; to ScriptDelay, causing the script to return to the rst/interrupt ; to wScriptDelay, causing the script to return to the rst/interrupt
; space. ; space.
push de push de
@ -1303,18 +1302,18 @@ ScriptCall:
add hl, de add hl, de
add hl, de add hl, de
pop de pop de
ld a, [ScriptBank] ld a, [wScriptBank]
ld [hli], a ld [hli], a
ld a, [ScriptPos] ld a, [wScriptPos]
ld [hli], a ld [hli], a
ld a, [ScriptPos + 1] ld a, [wScriptPos + 1]
ld [hl], a ld [hl], a
ld a, b ld a, b
ld [ScriptBank], a ld [wScriptBank], a
ld a, e ld a, e
ld [ScriptPos], a ld [wScriptPos], a
ld a, d ld a, d
ld [ScriptPos + 1], a ld [wScriptPos + 1], a
ret ret
``` ```
@ -1330,7 +1329,7 @@ LoadSpriteGFX: ; 14306
; Bug: b is not preserved, so it's useless as a next count. ; Bug: b is not preserved, so it's useless as a next count.
; Uncomment the lines below to fix. ; Uncomment the lines below to fix.
ld hl, UsedSprites ld hl, wUsedSprites
ld b, SPRITE_GFX_LIST_CAPACITY ld b, SPRITE_GFX_LIST_CAPACITY
.loop .loop
ld a, [hli] ld a, [hli]
@ -1365,9 +1364,8 @@ In [engine/wildmons.asm](/engine/wildmons.asm):
```asm ```asm
ChooseWildEncounter: ; 2a14f ChooseWildEncounter: ; 2a14f
... ...
ld a, b ld a, b
ld [CurPartyLevel], a ld [wCurPartyLevel], a
ld b, [hl] ld b, [hl]
; ld a, b ; ld a, b
call ValidateTempWildMonSpecies call ValidateTempWildMonSpecies
@ -1387,7 +1385,7 @@ ValidateTempWildMonSpecies: ; 2a4a0
```asm ```asm
ld a, b ld a, b
ld [CurPartyLevel], a ld [wCurPartyLevel], a
ld b, [hl] ld b, [hl]
ld a, b ld a, b
call ValidateTempWildMonSpecies call ValidateTempWildMonSpecies

View File

@ -8,8 +8,9 @@ These are parts of the code that do not work *incorrectly*, like [bugs and glitc
- [Pic banks are offset by `PICS_FIX`](#pic-banks-are-offset-by-pics_fix) - [Pic banks are offset by `PICS_FIX`](#pic-banks-are-offset-by-pics_fix)
- [`PokemonPicPointers` and `UnownPicPointers` are assumed to start at the same address](#pokemonpicpointers-and-unownpicpointers-are-assumed-to-start-at-the-same-address) - [`PokemonPicPointers` and `UnownPicPointers` are assumed to start at the same address](#pokemonpicpointers-and-unownpicpointers-are-assumed-to-start-at-the-same-address)
- [Footprints are split into top and bottom halves](#footprints-are-split-into-top-and-bottom-halves) - [Footprints are split into top and bottom halves](#footprints-are-split-into-top-and-bottom-halves)
- [Pokédex entry banks are derived from their species IDs](#pokédex-entry-banks-are-derived-from-their-species-ids)
- [`ITEM_C3` and `ITEM_DC` break up the continuous sequence of TM items](#item_c3-and-item_dc-break-up-the-continuous-sequence-of-tm-items) - [`ITEM_C3` and `ITEM_DC` break up the continuous sequence of TM items](#item_c3-and-item_dc-break-up-the-continuous-sequence-of-tm-items)
- [Pokédex entry banks are derived from their species IDs](#pokédex-entry-banks-are-derived-from-their-species-ids)
- [Identical sine wave code and data is repeated five times](#identical-sine-wave-code-and-data-is-repeated-five-times)
- [`GetForestTreeFrame` works, but it's still bad](#getforesttreeframe-works-but-its-still-bad) - [`GetForestTreeFrame` works, but it's still bad](#getforesttreeframe-works-but-its-still-bad)
@ -109,15 +110,15 @@ ROMX $49
Two routines in [engine/load_pics.asm](/engine/load_pics.asm) make this assumption; `GetFrontpicPointer`: Two routines in [engine/load_pics.asm](/engine/load_pics.asm) make this assumption; `GetFrontpicPointer`:
```asm ```asm
ld a, [CurPartySpecies] ld a, [wCurPartySpecies]
cp UNOWN cp UNOWN
jr z, .unown jr z, .unown
ld a, [CurPartySpecies] ld a, [wCurPartySpecies]
ld d, BANK(PokemonPicPointers) ld d, BANK(PokemonPicPointers)
jr .ok jr .ok
.unown .unown
ld a, [UnownLetter] ld a, [wUnownLetter]
ld d, BANK(UnownPicPointers) ld d, BANK(UnownPicPointers)
.ok .ok
@ -130,9 +131,7 @@ Two routines in [engine/load_pics.asm](/engine/load_pics.asm) make this assumpti
And `GetMonBackpic`: And `GetMonBackpic`:
```asm ```asm
; These are assumed to be at the same ; These are assumed to be at the same address in their respective banks.
; address in their respective banks.
GLOBAL PokemonPicPointers, UnownPicPointers
ld hl, PokemonPicPointers ; UnownPicPointers ld hl, PokemonPicPointers ; UnownPicPointers
ld a, b ld a, b
ld d, BANK(PokemonPicPointers) ld d, BANK(PokemonPicPointers)
@ -153,16 +152,16 @@ Don't enforce `org $4000` in pokecrystal.link.
Modify `GetFrontpicPointer`: Modify `GetFrontpicPointer`:
```asm ```asm
ld a, [CurPartySpecies] ld a, [wCurPartySpecies]
cp UNOWN cp UNOWN
jr z, .unown jr z, .unown
ld a, [CurPartySpecies] ld a, [wCurPartySpecies]
ld hl, PokemonPicPointers ld hl, PokemonPicPointers
ld d, BANK(PokemonPicPointers) ld d, BANK(PokemonPicPointers)
jr .ok jr .ok
.unown .unown
ld a, [UnownLetter] ld a, [wUnownLetter]
ld hl, UnownPicPointers ld hl, UnownPicPointers
ld d, BANK(UnownPicPointers) ld d, BANK(UnownPicPointers)
@ -175,7 +174,6 @@ Modify `GetFrontpicPointer`:
And `GetMonBackpic`: And `GetMonBackpic`:
```asm ```asm
GLOBAL PokemonPicPointers, UnownPicPointers
ld a, b ld a, b
ld hl, PokemonPicPointers ld hl, PokemonPicPointers
ld d, BANK(PokemonPicPointers) ld d, BANK(PokemonPicPointers)
@ -234,7 +232,7 @@ INCBIN "gfx/footprints/wartortle.1bpp", footprint_bottom
push hl push hl
ld e, l ld e, l
ld d, h ld d, h
ld hl, VTiles2 tile $62 ld hl, vTiles2 tile $62
lb bc, BANK(Footprints), 2 lb bc, BANK(Footprints), 2
call Request1bpp call Request1bpp
pop hl pop hl
@ -246,7 +244,7 @@ INCBIN "gfx/footprints/wartortle.1bpp", footprint_bottom
ld e, l ld e, l
ld d, h ld d, h
ld hl, VTiles2 tile $64 ld hl, vTiles2 tile $64
lb bc, BANK(Footprints), 2 lb bc, BANK(Footprints), 2
call Request1bpp call Request1bpp
``` ```
@ -272,136 +270,28 @@ Modify `Pokedex_LoadAnyFootprint`:
```asm ```asm
ld e, l ld e, l
ld d, h ld d, h
ld hl, VTiles2 tile $62 ld hl, vTiles2 tile $62
lb bc, BANK(Footprints), 4 lb bc, BANK(Footprints), 4
call Request1bpp call Request1bpp
``` ```
## Pokédex entry banks are derived from their species IDs
`PokedexDataPointerTable` in [data/pokemon/dex_entry_pointers.asm](/data/pokemon/dex_entry_pointers.asm) is a table of `dw`, not `dba`, yet there are four banks used for Pokédex entries. The correct bank is derived from the species ID at the beginning of each Pokémon's base stats. (This is the only use the base stat species ID has.)
Three separate routines do the same derivation; `GetDexEntryPointer` in [engine/pokedex/pokedex_2.asm](/engine/pokedex/pokedex_2.asm):
```asm
GetDexEntryPointer: ; 44333
; return dex entry pointer b:de
push hl
ld hl, PokedexDataPointerTable
ld a, b
dec a
ld d, 0
ld e, a
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
push de
rlca
rlca
and $3
ld hl, .PokedexEntryBanks
ld d, 0
ld e, a
add hl, de
ld b, [hl]
pop de
pop hl
ret
.PokedexEntryBanks: ; 44351
GLOBAL PokedexEntries1
GLOBAL PokedexEntries2
GLOBAL PokedexEntries3
GLOBAL PokedexEntries4
db BANK(PokedexEntries1)
db BANK(PokedexEntries2)
db BANK(PokedexEntries3)
db BANK(PokedexEntries4)
```
`GetPokedexEntryBank` in [engine/item_effects.asm](/engine/item_effects.asm):
```asm
GetPokedexEntryBank:
push hl
push de
ld a, [EnemyMonSpecies]
rlca
rlca
and 3
ld hl, .PokedexEntryBanks
ld d, 0
ld e, a
add hl, de
ld a, [hl]
pop de
pop hl
ret
.PokedexEntryBanks:
GLOBAL PokedexEntries1
GLOBAL PokedexEntries2
GLOBAL PokedexEntries3
GLOBAL PokedexEntries4
db BANK(PokedexEntries1)
db BANK(PokedexEntries2)
db BANK(PokedexEntries3)
db BANK(PokedexEntries4)
```
And `PokedexShow_GetDexEntryBank` in [engine/radio.asm](/engine/radio.asm):
```asm
PokedexShow_GetDexEntryBank:
push hl
push de
ld a, [CurPartySpecies]
dec a
rlca
rlca
and 3
ld hl, .pokedexbanks
ld d, 0
ld e, a
add hl, de
ld a, [hl]
pop de
pop hl
ret
.pokedexbanks
db BANK(PokedexEntries1)
db BANK(PokedexEntries2)
db BANK(PokedexEntries3)
db BANK(PokedexEntries4)
```
**Fix:** Use `dba` instead of `dw` in `PokedexDataPointerTable`, and modify the code that accesses it to match.
## `ITEM_C3` and `ITEM_DC` break up the continuous sequence of TM items ## `ITEM_C3` and `ITEM_DC` break up the continuous sequence of TM items
[constants/item_constants.asm](/constants/item_constants.asm) defined the 50 TMs in order with `add_tm`, but `ITEM_C3` and `ITEM_DC` break up that sequence. [constants/item_constants.asm](/constants/item_constants.asm) defined the 50 TMs in order with `add_tm`, but `ITEM_C3` and `ITEM_DC` break up that sequence.
```asm ```asm
add_tm DYNAMICPUNCH ; $BF add_tm DYNAMICPUNCH ; bf
... ...
add_tm ROLLOUT ; $C2 add_tm ROLLOUT ; c2
const ITEM_C3 ; $C3 const ITEM_C3 ; c3
add_tm ROAR ; $C4 add_tm ROAR ; c4
... ...
add_tm DIG ; $DB add_tm DIG ; db
const ITEM_DC ; $DC const ITEM_DC ; dc
add_tm PSYCHIC_M ; $DD add_tm PSYCHIC_M ; dd
... ...
add_tm NIGHTMARE ; $F2 add_tm NIGHTMARE ; f2
NUM_TMS = const_value - TM01 - 2 ; discount ITEM_C3 and ITEM_DC NUM_TMS = const_value - TM01 - 2 ; discount ITEM_C3 and ITEM_DC
``` ```
@ -469,6 +359,360 @@ GetNumberedTMHM: ; d417
``` ```
## Pokédex entry banks are derived from their species IDs
`PokedexDataPointerTable` in [data/pokemon/dex_entry_pointers.asm](/data/pokemon/dex_entry_pointers.asm) is a table of `dw`, not `dba`, yet there are four banks used for Pokédex entries. The correct bank is derived from the species ID at the beginning of each Pokémon's base stats. (This is the only use the base stat species ID has.)
Three separate routines do the same derivation; `GetDexEntryPointer` in [engine/pokedex/pokedex_2.asm](/engine/pokedex/pokedex_2.asm):
```asm
GetDexEntryPointer: ; 44333
; return dex entry pointer b:de
push hl
ld hl, PokedexDataPointerTable
ld a, b
dec a
ld d, 0
ld e, a
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
push de
rlca
rlca
maskbits NUM_DEX_ENTRY_BANKS
ld hl, .PokedexEntryBanks
ld d, 0
ld e, a
add hl, de
ld b, [hl]
pop de
pop hl
ret
.PokedexEntryBanks:
db BANK(PokedexEntries1)
db BANK(PokedexEntries2)
db BANK(PokedexEntries3)
db BANK(PokedexEntries4)
```
`GetPokedexEntryBank` in [engine/item_effects.asm](/engine/item_effects.asm):
```asm
GetPokedexEntryBank:
push hl
push de
ld a, [wEnemyMonSpecies]
rlca
rlca
maskbits NUM_DEX_ENTRY_BANKS
ld hl, .PokedexEntryBanks
ld d, 0
ld e, a
add hl, de
ld a, [hl]
pop de
pop hl
ret
.PokedexEntryBanks:
db BANK(PokedexEntries1)
db BANK(PokedexEntries2)
db BANK(PokedexEntries3)
db BANK(PokedexEntries4)
```
And `PokedexShow_GetDexEntryBank` in [engine/radio.asm](/engine/radio.asm):
```asm
PokedexShow_GetDexEntryBank:
push hl
push de
ld a, [wCurPartySpecies]
dec a
rlca
rlca
maskbits NUM_DEX_ENTRY_BANKS
ld hl, .PokedexEntryBanks
ld d, 0
ld e, a
add hl, de
ld a, [hl]
pop de
pop hl
ret
.PokedexEntryBanks:
db BANK(PokedexEntries1)
db BANK(PokedexEntries2)
db BANK(PokedexEntries3)
db BANK(PokedexEntries4)
```
**Fix:** Use `dba` instead of `dw` in `PokedexDataPointerTable`, and modify the code that accesses it to match.
## Identical sine wave code and data is repeated five times
`_Sine` in [engine/routines/sine.asm](/engine/routines/sine.asm):
```asm
_Sine:: ; 84d9
; A simple sine function.
; Return d * sin(e) in hl.
; e is a signed 6-bit value.
ld a, e
and %111111
cp %100000
jr nc, .negative
call .ApplySineWave
ld a, h
ret
.negative
and %011111
call .ApplySineWave
ld a, h
xor $ff
inc a
ret
.ApplySineWave: ; 84ef
ld e, a
ld a, d
ld d, 0
ld hl, .sinewave
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
ld hl, 0
; Factor amplitude
.multiply
srl a
jr nc, .even
add hl, de
.even
sla e
rl d
and a
jr nz, .multiply
ret
.sinewave ; 850b
; A 32-word table representing a sine wave.
; sin(90 degrees) is index $10 with an amplitude of $100.
sine_wave 32
```
`Sprites_Cosine` and `Sprites_Sine` in [engine/sprites.asm](/engine/sprites.asm):
```asm
Sprites_Cosine: ; 8e72a
; a = d * cos(a * pi/32)
add %010000
Sprites_Sine: ; 8e72c
; a = d * sin(a * pi/32)
and %111111
cp %100000
jr nc, .negative
call .ApplySineWave
ld a, h
ret
.negative
and %011111
call .ApplySineWave
ld a, h
xor $ff
inc a
ret
; 8e741
.ApplySineWave: ; 8e741
ld e, a
ld a, d
ld d, 0
ld hl, .sinewave
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
ld hl, 0
.multiply
srl a
jr nc, .even
add hl, de
.even
sla e
rl d
and a
jr nz, .multiply
ret
; 8e75d
.sinewave ; 8e75d
sine_wave 32
```
`BattleAnim_Cosine` and `BattleAnim_Sine` in [engine/battle_anims/functions.asm](/engine/battle_anims/functions.asm):
```asm
BattleAnim_Cosine: ; ce732 (33:6732)
; a = d * cos(a * pi/32)
add %010000
BattleAnim_Sine: ; ce734 (33:6734)
; a = d * sin(a * pi/32)
and %111111
cp %100000
jr nc, .negative
call .ApplySineWave
ld a, h
ret
.negative
and %011111
call .ApplySineWave
ld a, h
xor $ff
inc a
ret
.ApplySineWave:
ld e, a
ld a, d
ld d, 0
ld hl, BattleAnimSineWave
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
ld hl, 0
.multiply
srl a
jr nc, .even
add hl, de
.even
sla e
rl d
and a
jr nz, .multiply
ret
...
BattleAnimSineWave: ; ce77f
sine_wave 32
; ce7bf
```
`StartTrainerBattle_DrawSineWave` in [engine/battle/battle_transition.asm](/engine/battle/battle_transition.asm):
```asm
StartTrainerBattle_DrawSineWave: ; 8c6f7 (23:46f7)
; a = d * sin(a * pi/32)
and %111111
cp %100000
jr nc, .negative
call .ApplySineWave
ld a, h
ret
.negative
and %011111
call .ApplySineWave
ld a, h
xor $ff
inc a
ret
.ApplySineWave: ; 8c70c (23:470c)
ld e, a
ld a, d
ld d, 0
ld hl, .sinewave
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
ld hl, 0
.multiply
srl a
jr nc, .even
add hl, de
.even
sla e
rl d
and a
jr nz, .multiply
ret
; 8c728 (23:4728)
.sinewave ; 8c728
sine_wave 32
; 8c768
```
And `CelebiEvent_Cosine` in [engine/events/celebi.asm](/engine/events/celebi.asm):
```asm
CelebiEvent_Cosine: ; 49b3b (12:5b3b)
; a = d * cos(a * pi/32)
add %010000
and %111111
cp %100000
jr nc, .negative
call .ApplySineWave
ld a, h
ret
.negative
and %011111
call .ApplySineWave
ld a, h
xor $ff
inc a
ret
.ApplySineWave: ; 49b52 (12:5b52)
ld e, a
ld a, d
ld d, 0
ld hl, .sinewave
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
ld hl, 0
.multiply
srl a
jr nc, .even
add hl, de
.even
sla e
rl d
and a
jr nz, .multiply
ret
; 49b6e (12:5b6e)
.sinewave ; 49b6e
sine_wave 32
; 49bae
```
**Fix:** Call a single shared copy of the (co)sine code in bank 0.
## `GetForestTreeFrame` works, but it's still bad ## `GetForestTreeFrame` works, but it's still bad
In [engine/tileset_anims.asm](/engine/tileset_anims.asm): In [engine/tileset_anims.asm](/engine/tileset_anims.asm):

View File

@ -384,8 +384,9 @@ ShortHPBar_CalcPixelFrame: ; d839
call AddNTimes call AddNTimes
ld b, 0 ld b, 0
; This routine is buggy. If [wCurHPAnimMaxHP] * [wCurHPBarPixels] is divisible ; This routine is buggy. If [wCurHPAnimMaxHP] * [wCurHPBarPixels] is
; by 48, the loop runs one extra time. To fix, uncomment the line below. ; divisible by HP_BAR_LENGTH_PX, the loop runs one extra time.
; To fix, uncomment the line below.
.loop .loop
ld a, l ld a, l
sub HP_BAR_LENGTH_PX sub HP_BAR_LENGTH_PX

View File

@ -1504,8 +1504,8 @@ BattleCheckTypeMatchup: ; 347c8
ld hl, wBattleMonType1 ld hl, wBattleMonType1
CheckTypeMatchup: ; 347d3 CheckTypeMatchup: ; 347d3
; There is an incorrect assumption about this function made in the AI related code: when ; There is an incorrect assumption about this function made in the AI related code: when
; the AI calls CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing ; the AI calls CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing the
; the offensive type in a will make this function do the right thing. Since a is overwritten, ; offensive type in a will make this function do the right thing. Since a is overwritten,
; this assumption is incorrect. A simple fix would be to load the move type for the ; this assumption is incorrect. A simple fix would be to load the move type for the
; current move into a in BattleCheckTypeMatchup, before falling through, which is ; current move into a in BattleCheckTypeMatchup, before falling through, which is
; consistent with how the rest of the code assumes this code works like. ; consistent with how the rest of the code assumes this code works like.

View File

@ -1219,6 +1219,7 @@ BattleAnimFunction_0E: ; cd6e3 (33:56e3)
.anon_dw .anon_dw
dw Functioncd6ea dw Functioncd6ea
dw Functioncd6f7 dw Functioncd6f7
Functioncd6ea: ; cd6ea (33:56ea) Functioncd6ea: ; cd6ea (33:56ea)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B ld hl, BATTLEANIMSTRUCT_0B
@ -1226,6 +1227,7 @@ Functioncd6ea: ; cd6ea (33:56ea)
ld a, BATTLEANIMFRAMESET_24 ld a, BATTLEANIMFRAMESET_24
add [hl] ; offset add [hl] ; offset
call ReinitBattleAnimFrameset call ReinitBattleAnimFrameset
Functioncd6f7: ; cd6f7 (33:56f7) Functioncd6f7: ; cd6f7 (33:56f7)
ld hl, BATTLEANIMSTRUCT_XCOORD ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc add hl, bc
@ -1256,6 +1258,7 @@ BattleAnimFunction_0F: ; cd71a (33:571a)
dw Functioncd728 dw Functioncd728
dw Functioncd763 dw Functioncd763
dw Functioncd776 dw Functioncd776
Functioncd725: ; cd725 (33:5725) Functioncd725: ; cd725 (33:5725)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
Functioncd728: ; cd728 (33:5728) Functioncd728: ; cd728 (33:5728)
@ -1345,6 +1348,7 @@ BattleAnimFunction_14: ; cd7a4 (33:57a4)
.anon_dw .anon_dw
dw Functioncd7ab dw Functioncd7ab
dw Functioncd7d2 dw Functioncd7d2
Functioncd7ab: ; cd7ab (33:57ab) Functioncd7ab: ; cd7ab (33:57ab)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B ld hl, BATTLEANIMSTRUCT_0B
@ -1414,6 +1418,7 @@ BattleAnimFunction_15: ; cd80c (33:580c)
dw Functioncd817 dw Functioncd817
dw Functioncd81f dw Functioncd81f
dw Functioncd820 dw Functioncd820
Functioncd817: ; cd817 (33:5817) Functioncd817: ; cd817 (33:5817)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld a, BATTLEANIMFRAMESET_35 ld a, BATTLEANIMFRAMESET_35
@ -1435,6 +1440,7 @@ BattleAnimFunction_16: ; cd824 (33:5824)
dw Functioncd88f dw Functioncd88f
dw Functioncd88f dw Functioncd88f
dw Functioncd893 dw Functioncd893
Functioncd835: ; cd835 (33:5835) Functioncd835: ; cd835 (33:5835)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
@ -1513,6 +1519,7 @@ BattleAnimFunction_17: ; cd89a (33:589a)
dw Functioncd8f5 dw Functioncd8f5
dw Functioncd8f5 dw Functioncd8f5
dw Functioncd8f9 dw Functioncd8f9
Functioncd8ab: ; cd8ab (33:58ab) Functioncd8ab: ; cd8ab (33:58ab)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B ld hl, BATTLEANIMSTRUCT_0B
@ -1534,6 +1541,7 @@ Functioncd8ab: ; cd8ab (33:58ab)
ld a, [hl] ld a, [hl]
and $7f and $7f
ld [hl], a ld [hl], a
Functioncd8cc: ; cd8cc (33:58cc) Functioncd8cc: ; cd8cc (33:58cc)
ld hl, BATTLEANIMSTRUCT_0F ld hl, BATTLEANIMSTRUCT_0F
add hl, bc add hl, bc
@ -1561,6 +1569,7 @@ Functioncd8cc: ; cd8cc (33:58cc)
ld a, [hl] ld a, [hl]
and $1f and $1f
ret nz ret nz
Functioncd8f5: ; cd8f5 (33:58f5) Functioncd8f5: ; cd8f5 (33:58f5)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ret ret
@ -1576,6 +1585,7 @@ BattleAnimFunction_18: ; cd900 (33:5900)
.anon_dw .anon_dw
dw Functioncd907 dw Functioncd907
dw Functioncd913 dw Functioncd913
Functioncd907: ; cd907 (33:5907) Functioncd907: ; cd907 (33:5907)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F ld hl, BATTLEANIMSTRUCT_0F
@ -1635,6 +1645,7 @@ BattleAnimFunction_19: ; cd954 (33:5954)
dw Functioncd96e dw Functioncd96e
dw Functioncd96a dw Functioncd96a
dw Functioncd97b dw Functioncd97b
Functioncd961: ; cd961 (33:5961) Functioncd961: ; cd961 (33:5961)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B ld hl, BATTLEANIMSTRUCT_0B
@ -1785,6 +1796,7 @@ BattleAnimFunction_1F: ; cda31 (33:5a31)
dw Functioncda4c dw Functioncda4c
dw Functioncda3a dw Functioncda3a
dw Functioncda4c dw Functioncda4c
Functioncda3a: ; cda3a (33:5a3a) Functioncda3a: ; cda3a (33:5a3a)
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
add hl, bc add hl, bc
@ -1898,6 +1910,7 @@ BattleAnimFunction_3F: ; cdad6 (33:5ad6)
dw Functioncdadf dw Functioncdadf
dw Functioncdae9 dw Functioncdae9
dw Functioncdaf9 dw Functioncdaf9
Functioncdadf: ; cdadf (33:5adf) Functioncdadf: ; cdadf (33:5adf)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_10 ld hl, BATTLEANIMSTRUCT_10
@ -1936,6 +1949,7 @@ BattleAnimFunction_1B: ; cdb06 (33:5b06)
dw Functioncdb28 dw Functioncdb28
dw Functioncdb50 dw Functioncdb50
dw Functioncdb65 dw Functioncdb65
Functioncdb13: ; cdb13 (33:5b13) Functioncdb13: ; cdb13 (33:5b13)
ret ret
@ -2027,6 +2041,7 @@ BattleAnimFunction_1D: ; cdb80 (33:5b80)
dw Functioncdc48 dw Functioncdc48
dw Functioncdc57 dw Functioncdc57
dw Functioncdc74 dw Functioncdc74
Functioncdb9f: ; cdb9f (33:5b9f) Functioncdb9f: ; cdb9f (33:5b9f)
ld hl, BATTLEANIMSTRUCT_0F ld hl, BATTLEANIMSTRUCT_0F
add hl, bc add hl, bc
@ -2239,6 +2254,7 @@ BattleAnimFunction_21: ; cdcc3 (33:5cc3)
.anon_dw .anon_dw
dw Functioncdcca dw Functioncdcca
dw Functioncdced dw Functioncdced
Functioncdcca: ; cdcca (33:5cca) Functioncdcca: ; cdcca (33:5cca)
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
@ -2313,6 +2329,7 @@ BattleAnimFunction_22: ; cdd2a (33:5d2a)
.anon_dw .anon_dw
dw Functioncdd31 dw Functioncdd31
dw Functioncdd4f dw Functioncdd4f
Functioncdd31: ; cdd31 (33:5d31) Functioncdd31: ; cdd31 (33:5d31)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B ld hl, BATTLEANIMSTRUCT_0B
@ -2380,6 +2397,7 @@ BattleAnimFunction_23: ; cdd90 (33:5d90)
.anon_dw .anon_dw
dw Functioncdd97 dw Functioncdd97
dw Functioncddbc dw Functioncddbc
Functioncdd97: ; cdd97 (33:5d97) Functioncdd97: ; cdd97 (33:5d97)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
@ -2449,6 +2467,7 @@ BattleAnimFunction_24: ; cddf9 (33:5df9)
dw Functioncde02 dw Functioncde02
dw Functioncde20 dw Functioncde20
dw Functioncde21 dw Functioncde21
Functioncde02: ; cde02 (33:5e02) Functioncde02: ; cde02 (33:5e02)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B ld hl, BATTLEANIMSTRUCT_0B
@ -2528,6 +2547,7 @@ BattleAnimFunction_27: ; cde6b (33:5e6b)
.anon_dw .anon_dw
dw Functioncde72 dw Functioncde72
dw Functioncde88 dw Functioncde88
Functioncde72: ; cde72 (33:5e72) Functioncde72: ; cde72 (33:5e72)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B ld hl, BATTLEANIMSTRUCT_0B
@ -2549,6 +2569,7 @@ BattleAnimFunction_28: ; cde89 (33:5e89)
.anon_dw .anon_dw
dw Functioncde90 dw Functioncde90
dw Functioncdebf dw Functioncdebf
Functioncde90: ; cde90 (33:5e90) Functioncde90: ; cde90 (33:5e90)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F ld hl, BATTLEANIMSTRUCT_0F
@ -2692,6 +2713,7 @@ BattleAnimFunction_PoisonGas: ; cdf59 (33:5f59)
.anon_dw .anon_dw
dw Functioncdf60 dw Functioncdf60
dw BattleAnimFunction_SpiralDescent dw BattleAnimFunction_SpiralDescent
Functioncdf60: ; cdf60 (33:5f60) Functioncdf60: ; cdf60 (33:5f60)
ld hl, BATTLEANIMSTRUCT_XCOORD ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc add hl, bc
@ -2813,6 +2835,7 @@ BattleAnimFunction_35: ; ce00b (33:600b)
dw Functionce014 dw Functionce014
dw Functionce023 dw Functionce023
dw Functionce05f dw Functionce05f
Functionce014: ; ce014 (33:6014) Functionce014: ; ce014 (33:6014)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F ld hl, BATTLEANIMSTRUCT_0F
@ -2936,6 +2959,7 @@ BattleAnimFunction_2C: ; ce0c5 (33:60c5)
dw Functionce0ce dw Functionce0ce
dw Functionce0f8 dw Functionce0f8
dw Functionce0dd dw Functionce0dd
Functionce0ce: ; ce0ce (33:60ce) Functionce0ce: ; ce0ce (33:60ce)
ld hl, BATTLEANIMSTRUCT_0B ld hl, BATTLEANIMSTRUCT_0B
add hl, bc add hl, bc
@ -2985,6 +3009,7 @@ BattleAnimFunction_2E: ; ce10e (33:610e)
.anon_dw .anon_dw
dw Functionce115 dw Functionce115
dw Functionce12a dw Functionce12a
Functionce115: ; ce115 (33:6115) Functionce115: ; ce115 (33:6115)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F ld hl, BATTLEANIMSTRUCT_0F
@ -3133,6 +3158,7 @@ BattleAnimFunction_30: ; ce1e7 (33:61e7)
.anon_dw .anon_dw
dw Functionce1ee dw Functionce1ee
dw Functionce1fb dw Functionce1fb
Functionce1ee: ; ce1ee (33:61ee) Functionce1ee: ; ce1ee (33:61ee)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_YCOORD ld hl, BATTLEANIMSTRUCT_YCOORD
@ -3172,6 +3198,7 @@ BattleAnimFunction_31: ; ce226 (33:6226)
.anon_dw .anon_dw
dw Functionce22d dw Functionce22d
dw Functionce254 dw Functionce254
Functionce22d: ; ce22d (33:622d) Functionce22d: ; ce22d (33:622d)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B ld hl, BATTLEANIMSTRUCT_0B
@ -3203,6 +3230,7 @@ BattleAnimFunction_32: ; ce255 (33:6255)
dw Functionce274 dw Functionce274
dw Functionce278 dw Functionce278
dw Functionce289 dw Functionce289
Functionce260: ; ce260 (33:6260) Functionce260: ; ce260 (33:6260)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld a, [hBattleTurn] ld a, [hBattleTurn]
@ -3318,6 +3346,7 @@ BattleAnimFunction_36: ; ce2fd (33:62fd)
dw Functionce306 dw Functionce306
dw Functionce330 dw Functionce330
dw Functionce34c dw Functionce34c
Functionce306: ; ce306 (33:6306) Functionce306: ; ce306 (33:6306)
ld hl, BATTLEANIMSTRUCT_YOFFSET ld hl, BATTLEANIMSTRUCT_YOFFSET
add hl, bc add hl, bc
@ -3389,6 +3418,7 @@ BattleAnimFunction_37: ; ce35f (33:635f)
.anon_dw .anon_dw
dw Functionce366 dw Functionce366
dw Functionce375 dw Functionce375
Functionce366: ; ce366 (33:6366) Functionce366: ; ce366 (33:6366)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B ld hl, BATTLEANIMSTRUCT_0B
@ -3419,6 +3449,7 @@ BattleAnimFunction_38: ; ce389 (33:6389)
dw Functionce392 dw Functionce392
dw Functionce39c dw Functionce39c
dw Functionce3ae dw Functionce3ae
Functionce392: ; ce392 (33:6392) Functionce392: ; ce392 (33:6392)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F ld hl, BATTLEANIMSTRUCT_0F
@ -3500,6 +3531,7 @@ BattleAnimFunction_3B: ; ce3ff (33:63ff)
.anon_dw .anon_dw
dw Functionce406 dw Functionce406
dw Functionce412 dw Functionce412
Functionce406: ; ce406 (33:6406) Functionce406: ; ce406 (33:6406)
ld hl, BATTLEANIMSTRUCT_0B ld hl, BATTLEANIMSTRUCT_0B
add hl, bc add hl, bc
@ -3544,6 +3576,7 @@ BattleAnimFunction_3E: ; ce43a (33:643a)
dw Functionce443 dw Functionce443
dw Functionce465 dw Functionce465
dw Functionce490 dw Functionce490
Functionce443: ; ce443 (33:6443) Functionce443: ; ce443 (33:6443)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0F ld hl, BATTLEANIMSTRUCT_0F
@ -3607,6 +3640,7 @@ BattleAnimFunction_40: ; ce49c (33:649c)
.anon_dw .anon_dw
dw Functionce4a3 dw Functionce4a3
dw Functionce4b0 dw Functionce4b0
Functionce4a3: ; ce4a3 (33:64a3) Functionce4a3: ; ce4a3 (33:64a3)
call BattleAnim_IncAnonJumptableIndex call BattleAnim_IncAnonJumptableIndex
ld hl, BATTLEANIMSTRUCT_0B ld hl, BATTLEANIMSTRUCT_0B
@ -3739,6 +3773,7 @@ BattleAnimFunction_45: ; ce55b (33:655b)
dw Functionce564 dw Functionce564
dw Functionce56e dw Functionce56e
dw Functionce577 dw Functionce577
Functionce564: ; ce564 (33:6564) Functionce564: ; ce564 (33:6564)
ld d, $18 ld d, $18
ld hl, BATTLEANIMSTRUCT_0B ld hl, BATTLEANIMSTRUCT_0B
@ -3779,6 +3814,7 @@ BattleAnimFunction_46: ; ce593 (33:6593)
.anon_dw .anon_dw
dw Functionce5b3 dw Functionce5b3
dw Functionce59a dw Functionce59a
Functionce59a: ; ce59a (33:659a) Functionce59a: ; ce59a (33:659a)
ld hl, BATTLEANIMSTRUCT_XCOORD ld hl, BATTLEANIMSTRUCT_XCOORD
add hl, bc add hl, bc
@ -3850,6 +3886,7 @@ BattleAnimFunction_49: ; ce5ee (33:65ee)
dw Functionce60a dw Functionce60a
dw Functionce622 dw Functionce622
dw Functionce618 dw Functionce618
Functionce5f9: ; ce5f9 (33:65f9) Functionce5f9: ; ce5f9 (33:65f9)
ld hl, BATTLEANIMSTRUCT_0B ld hl, BATTLEANIMSTRUCT_0B
add hl, bc add hl, bc
@ -3898,6 +3935,7 @@ BattleAnimFunction_4A: ; ce62f (33:662f)
dw Functionce648 dw Functionce648
dw Functionce65c dw Functionce65c
dw Functionce672 dw Functionce672
Functionce63a: ; ce63a (33:663a) Functionce63a: ; ce63a (33:663a)
ld hl, BATTLEANIMSTRUCT_0B ld hl, BATTLEANIMSTRUCT_0B
add hl, bc add hl, bc
@ -4138,24 +4176,24 @@ BattleAnim_Cosine_e: ; ce76b (33:676b)
call BattleAnim_Cosine call BattleAnim_Cosine
ld e, a ld e, a
ret ret
; ce771 (33:6771) ; ce771 (33:6771)
BattleAnim_AbsSinePrecise: ; ce771 BattleAnim_AbsSinePrecise: ; ce771
ld a, e ld a, e
call BattleAnim_Sine call BattleAnim_Sine
ld e, l ld e, l
ld d, h ld d, h
ret ret
; ce778 ; ce778
BattleAnim_AbsCosinePrecise: ; ce778 BattleAnim_AbsCosinePrecise: ; ce778
ld a, e ld a, e
call BattleAnim_Cosine call BattleAnim_Cosine
ld e, l ld e, l
ld d, h ld d, h
ret ret
; ce77f ; ce77f
BattleAnimSineWave: ; ce77f BattleAnimSineWave: ; ce77f
sine_wave 32 sine_wave 32
; ce7bf ; ce7bf

View File

@ -434,8 +434,6 @@ InitEggMoves: ; 170bf
; 170e4 ; 170e4
GetEggMove: ; 170e4 GetEggMove: ; 170e4
GLOBAL EggMoves
push bc push bc
ld a, [wEggMonSpecies] ld a, [wEggMonSpecies]
dec a dec a

View File

@ -361,7 +361,7 @@ ParkBall: ; e8a2
ld d, a ld d, a
push de push de
ld a, [wBattleMonItem] ld a, [wBattleMonItem]
; ld b, a ; ld b, a
farcall GetItemHeldEffect farcall GetItemHeldEffect
ld a, b ld a, b
cp HELD_CATCH_CHANCE cp HELD_CATCH_CHANCE
@ -905,10 +905,6 @@ MoonBallMultiplier:
; This function is buggy. ; This function is buggy.
; Intent: multiply catch rate by 4 if mon evolves with moon stone ; Intent: multiply catch rate by 4 if mon evolves with moon stone
; Reality: no boost ; Reality: no boost
GLOBAL EvosAttacks
GLOBAL EvosAttacksPointers
push bc push bc
ld a, [wTempEnemyMonSpecies] ld a, [wTempEnemyMonSpecies]
dec a dec a

View File

@ -103,8 +103,6 @@ _GetFrontpic: ; 510a5
ret ret
GetFrontpicPointer: ; 510d7 GetFrontpicPointer: ; 510d7
GLOBAL PokemonPicPointers, UnownPicPointers
ld a, [wCurPartySpecies] ld a, [wCurPartySpecies]
cp UNOWN cp UNOWN
jr z, .unown jr z, .unown
@ -211,7 +209,6 @@ GetMonBackpic: ; 5116c
push de push de
; These are assumed to be at the same address in their respective banks. ; These are assumed to be at the same address in their respective banks.
GLOBAL PokemonPicPointers, UnownPicPointers
ld hl, PokemonPicPointers ; UnownPicPointers ld hl, PokemonPicPointers ; UnownPicPointers
ld a, b ld a, b
ld d, BANK(PokemonPicPointers) ld d, BANK(PokemonPicPointers)

View File

@ -240,7 +240,7 @@ GetDexEntryPointer: ; 44333
pop hl pop hl
ret ret
.PokedexEntryBanks: ; 44351 .PokedexEntryBanks:
db BANK(PokedexEntries1) db BANK(PokedexEntries1)
db BANK(PokedexEntries2) db BANK(PokedexEntries2)
db BANK(PokedexEntries3) db BANK(PokedexEntries3)

View File

@ -702,7 +702,7 @@ PokedexShow_GetDexEntryBank:
pop hl pop hl
ret ret
.PokedexEntryBanks .PokedexEntryBanks:
db BANK(PokedexEntries1) db BANK(PokedexEntries1)
db BANK(PokedexEntries2) db BANK(PokedexEntries2)
db BANK(PokedexEntries3) db BANK(PokedexEntries3)

View File

@ -43,6 +43,6 @@ _Sine:: ; 84d9
ret ret
.sinewave ; 850b .sinewave ; 850b
; A $20-word table representing a sine wave. ; A 32-word table representing a sine wave.
; 90 degrees is index $10 at a base amplitude of $100. ; sin(90 degrees) is index $10 with an amplitude of $100.
sine_wave 32 sine_wave 32