summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/bugs_and_glitches.md79
-rw-r--r--docs/design_flaws.md116
-rw-r--r--docs/menu.md8
3 files changed, 96 insertions, 107 deletions
diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md
index 941b4bbac..875a2ac77 100644
--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -44,12 +44,12 @@ These are known bugs and glitches in the original Pokémon Crystal game: code th
- [Two tiles in the `port` tileset are drawn incorrectly](#two-tiles-in-the-port-tileset-are-drawn-incorrectly)
- [`LoadMetatiles` wraps around past 128 blocks](#loadmetatiles-wraps-around-past-128-blocks)
- [Surfing directly across a map connection does not load the new map](#surfing-directly-across-a-map-connection-does-not-load-the-new-map)
-- [`Function6ec1` does not correctly limit object movement](#function6ec1-does-not-correctly-limit-object-movement)
+- [Swimming NPCs aren't limited by their movement radius](#swimming-npcs-arent-limited-by-their-movement-radius)
- [`CheckOwnMon` only checks the first five letters of OT names](#checkownmon-only-checks-the-first-five-letters-of-ot-names)
- [Catching a Transformed Pokémon always catches a Ditto](#catching-a-transformed-pokémon-always-catches-a-ditto)
- [Using a Park Ball in normal battles has a corrupt animation](#using-a-park-ball-in-normal-battles-has-a-corrupt-animation)
- [`HELD_CATCH_CHANCE` has no effect](#held_catch_chance-has-no-effect)
-- [Only the first three `EvosAttacks` evolution entries can have Stone compatibility reported correctly](#only-the-first-three-evosattacks-evolution-entries-can-have-stone-compatibility-reported-correctly)
+- [Only the first three evolution entries can have Stone compatibility reported correctly](#only-the-first-three-evolution-entries-can-have-stone-compatibility-reported-correctly)
- [`EVOLVE_STAT` can break Stone compatibility reporting](#evolve_stat-can-break-stone-compatibility-reporting)
- [`ScriptCall` can overflow `wScriptStack` and crash](#scriptcall-can-overflow-wscriptstack-and-crash)
- [`LoadSpriteGFX` does not limit the capacity of `UsedSprites`](#loadspritegfx-does-not-limit-the-capacity-of-usedsprites)
@@ -162,7 +162,7 @@ This is a bug with `DittoMetalPowder` in [engine/battle/effect_commands.asm](/en
This is a bug with `BattleCommand_BellyDrum` in [engine/battle/move_effects/belly_drum.asm](/engine/battle/move_effects/belly_drum.asm):
```asm
-BattleCommand_BellyDrum: ; 37c1a
+BattleCommand_BellyDrum:
; bellydrum
; This command is buggy because it raises the user's attack
; before checking that it has enough HP to use the move.
@@ -180,7 +180,7 @@ BattleCommand_BellyDrum: ; 37c1a
**Fix:**
```asm
-BattleCommand_BellyDrum: ; 37c1a
+BattleCommand_BellyDrum:
; bellydrum
callfar GetHalfMaxHP
callfar CheckUserHasEnoughHP
@@ -321,7 +321,7 @@ This bug affects Attract, Curse, Foresight, Mean Look, Mimic, Nightmare, Spider
This is a bug with `CheckHiddenOpponent` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
```asm
-CheckHiddenOpponent: ; 37daa
+CheckHiddenOpponent:
; BUG: This routine should account for Lock-On and Mind Reader.
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
@@ -418,7 +418,7 @@ This is a bug in how `wAttackMissed` is never set by BeatUp, even when none of t
This bug can be fixed in a plethora of ways, but the most straight-forward would be in `BattleCommand_BeatUpFailText` in [engine/battle/move_effects/beat_up.asm](/engine/battle/move_effects/beat_up.asm), as that's always ran before the king's rock effect.
```asm
-BattleCommand_BeatUpFailText: ; 355b5
+BattleCommand_BeatUpFailText:
; beatupfailtext
ld a, [wBeatUpHitAtLeastOnce]
@@ -431,7 +431,7 @@ BattleCommand_BeatUpFailText: ; 355b5
**Fix:**
```asm
-BattleCommand_BeatUpFailText: ; 355b5
+BattleCommand_BeatUpFailText:
; beatupfailtext
ld a, [wBeatUpHitAtLeastOnce]
@@ -456,7 +456,7 @@ This bug existed for all battles in Gold and Silver, and was only fixed for sing
This is a bug with `BattleCommand_Present` in [engine/battle/move_effects/present.asm](/engine/battle/move_effects/present.asm):
```asm
-BattleCommand_Present: ; 37874
+BattleCommand_Present:
; present
ld a, [wLinkMode]
@@ -479,7 +479,7 @@ BattleCommand_Present: ; 37874
**Fix:**
```asm
-BattleCommand_Present: ; 37874
+BattleCommand_Present:
; present
push bc
@@ -512,13 +512,13 @@ This is a bug with `AI_Smart_MeanLook` in [engine/battle/ai/scoring.asm](/engine
In [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
```asm
-BattleCheckTypeMatchup: ; 347c8
+BattleCheckTypeMatchup:
ld hl, wEnemyMonType1
ld a, [hBattleTurn]
and a
jr z, CheckTypeMatchup
ld hl, wBattleMonType1
-CheckTypeMatchup: ; 347d3
+CheckTypeMatchup:
; 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
; offensive type in a will make this function do the right thing. Since a is overwritten,
@@ -543,7 +543,7 @@ CheckTypeMatchup: ; 347d3
This is a bug with `AI_HealStatus` in [engine/battle/ai/items.asm](/engine/battle/ai/items.asm):
```asm
-AI_HealStatus: ; 384e0
+AI_HealStatus:
ld a, [wCurOTMon]
ld hl, wOTPartyMon1Status
ld bc, PARTYMON_STRUCT_LENGTH
@@ -558,7 +558,6 @@ AI_HealStatus: ; 384e0
ld hl, wEnemySubStatus5
res SUBSTATUS_TOXIC, [hl]
ret
-; 384f7
```
**Fix:** Uncomment `ld hl, wEnemySubStatus1` and `res SUBSTATUS_NIGHTMARE, [hl]`.
@@ -628,7 +627,7 @@ This can bring Pokémon straight from level 1 to 100 by gaining just a few exper
This is a bug with `CalcExpAtLevel` in [engine/pokemon/experience.asm](/engine/pokemon/experience.asm):
```asm
-CalcExpAtLevel: ; 50e47
+CalcExpAtLevel:
; (a/b)*n**3 + c*n**2 + d*n - e
ld a, [wBaseGrowthRate]
add a
@@ -642,7 +641,7 @@ CalcExpAtLevel: ; 50e47
**Fix:**
```asm
-CalcExpAtLevel: ; 50e47
+CalcExpAtLevel:
; (a/b)*n**3 + c*n**2 + d*n - e
ld a, d
cp 1
@@ -740,7 +739,7 @@ MoonBallMultiplier:
; No Pokémon evolve with Burn Heal,
; so Moon Balls always have a catch rate of 1×.
push bc
- ld a, BANK(EvosAttacks)
+ ld a, BANK("Evolutions and Attacks")
call GetFarByte
cp MOON_STONE_RED ; BURN_HEAL
pop bc
@@ -849,7 +848,7 @@ This is a bug with `HaircutOrGrooming` in [engine/events/haircut.asm](/engine/ev
INCLUDE "data/events/happiness_probabilities.asm"
-CopyPokemonName_Buffer1_Buffer3: ; 746e
+CopyPokemonName_Buffer1_Buffer3:
ld hl, wStringBuffer1
ld de, wStringBuffer3
ld bc, MON_NAME_LENGTH
@@ -859,14 +858,14 @@ CopyPokemonName_Buffer1_Buffer3: ; 746e
In [data/events/happiness_probabilities.asm](/data/events/happiness_probabilities.asm):
```asm
-HappinessData_DaisysGrooming: ; 746b
+HappinessData_DaisysGrooming:
db $ff, 2, HAPPINESS_GROOMING ; 99.6% chance
```
**Fix:**
```asm
-HappinessData_DaisysGrooming: ; 746b
+HappinessData_DaisysGrooming:
db $80, 2, HAPPINESS_GROOMING ; 50% chance
db $ff, 2, HAPPINESS_GROOMING ; 50% chance
```
@@ -944,7 +943,7 @@ This is a bug with `LoadEnemyMon.CheckMagikarpArea` in [engine/battle/core.asm](
This is a bug with `CalcMagikarpLength.BCLessThanDE` in [engine/events/magikarp.asm](/engine/events/magikarp.asm):
```asm
-.BCLessThanDE: ; fbc9a
+.BCLessThanDE:
; Intention: Return bc < de.
; Reality: Return b < d.
ld a, b
@@ -954,7 +953,6 @@ This is a bug with `CalcMagikarpLength.BCLessThanDE` in [engine/events/magikarp.
ld a, c
cp e
ret
-; fbca1
```
**Fix:** Delete `ret nc`.
@@ -967,7 +965,7 @@ This is a bug with `CalcMagikarpLength.BCLessThanDE` in [engine/events/magikarp.
This is a bug with `StartTrainerBattle_DetermineWhichAnimation` in [engine/battle/battle_transition.asm](/engine/battle/battle_transition.asm):
```asm
-StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365)
+StartTrainerBattle_DetermineWhichAnimation:
; The screen flashes a different number of times depending on the level of
; your lead Pokemon relative to the opponent's.
; BUG: wBattleMonLevel and wEnemyMonLevel are not set at this point, so whatever
@@ -994,15 +992,13 @@ StartTrainerBattle_DetermineWhichAnimation: ; 8c365 (23:4365)
ld a, [hl]
ld [wJumptableIndex], a
ret
-; 8c38f (23:438f)
-.StartingPoints: ; 8c38f
+.StartingPoints:
; entries correspond to TRANS_* constants
db BATTLETRANSITION_CAVE
db BATTLETRANSITION_CAVE_STRONGER
db BATTLETRANSITION_NO_CAVE
db BATTLETRANSITION_NO_CAVE_STRONGER
-; 8c393
```
*To do:* Fix this bug.
@@ -1136,7 +1132,7 @@ This is a bug with `DoPlayerMovement.CheckWarp` in [engine/overworld/player_move
The exact cause is unknown, but a workaround exists for `DexEntryScreen_MenuActionJumptable.Cry` in [engine/pokedex/pokedex.asm](/engine/pokedex/pokedex.asm):
```asm
-.Cry: ; 40340
+.Cry:
call Pokedex_GetSelectedMon
ld a, [wd265]
call GetCryIndex
@@ -1149,7 +1145,7 @@ The exact cause is unknown, but a workaround exists for `DexEntryScreen_MenuActi
**Workaround:**
```asm
-.Cry: ; 40340
+.Cry:
ld a, [wCurPartySpecies]
call PlayMonCry
ret
@@ -1213,20 +1209,20 @@ In [home/map.asm](/home/map.asm):
*To do:* Identify specific code causing this bug and fix it.
-## `Function6ec1` does not correctly limit object movement
+## Swimming NPCs aren't limited by their 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/overworld/npc_movement.asm](/engine/overworld/npc_movement.asm):
+This is a bug with `CanObjectMoveInDirection` in [engine/overworld/npc_movement.asm](/engine/overworld/npc_movement.asm):
```asm
ld hl, OBJECT_FLAGS1
add hl, bc
- bit 4, [hl] ; lost, uncomment next line to fix
-; jr nz, .resume
+ bit NOCLIP_TILES_F, [hl] ; lost, uncomment next line to fix
+ ; jr nz, .noclip_tiles
```
-**Fix:** Uncomment `jr nz, .resume`.
+**Fix:** Uncomment `jr nz, .noclip_tiles`.
## `CheckOwnMon` only checks the first five letters of OT names
@@ -1388,12 +1384,12 @@ This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/i
**Fix:** Uncomment `ld b, a`.
-## Only the first three `EvosAttacks` evolution entries can have Stone compatibility reported correctly
+## Only the first three evolution entries can have Stone compatibility reported correctly
This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/pokemon/party_menu.asm](/engine/pokemon/party_menu.asm):
```asm
-.DetermineCompatibility: ; 50268
+.DetermineCompatibility:
ld de, wStringBuffer1
ld a, BANK(EvosAttacksPointers)
ld bc, 2
@@ -1403,7 +1399,7 @@ This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` i
ld h, [hl]
ld l, a
ld de, wStringBuffer1
- ld a, BANK(EvosAttacks)
+ ld a, BANK("Evolutions and Attacks")
ld bc, 10
call FarCopyBytes
```
@@ -1489,7 +1485,7 @@ ScriptCall:
In [engine/overworld/overworld.asm](/engine/overworld/overworld.asm):
```asm
-LoadSpriteGFX: ; 14306
+LoadSpriteGFX:
; Bug: b is not preserved, so it's useless as a next count.
; Uncomment the lines below to fix.
@@ -1515,7 +1511,6 @@ LoadSpriteGFX: ; 14306
; pop bc
ld a, l
ret
-; 1431e
```
**Fix:** Uncomment `push bc` and `pop bc`.
@@ -1526,7 +1521,7 @@ LoadSpriteGFX: ; 14306
In [engine/overworld/wildmons.asm](/engine/overworld/wildmons.asm):
```asm
-ChooseWildEncounter: ; 2a14f
+ChooseWildEncounter:
...
ld a, b
ld [wCurPartyLevel], a
@@ -1541,7 +1536,7 @@ ChooseWildEncounter: ; 2a14f
...
-ValidateTempWildMonSpecies: ; 2a4a0
+ValidateTempWildMonSpecies:
; Due to a development oversight, this function is called with the wild Pokemon's level, not its species, in a.
```
@@ -1592,7 +1587,7 @@ In [engine/overworld/events.asm](/engine/overworld/events.asm):
In [engine/events/bug_contest/contest_2.asm](/engine/events/bug_contest/contest_2.asm):
```asm
-CheckBugContestContestantFlag: ; 139ed
+CheckBugContestContestantFlag:
; Checks the flag of the Bug Catching Contestant whose index is loaded in a.
; Bug: If a >= NUM_BUG_CONTESTANTS when this is called,
@@ -1609,7 +1604,6 @@ CheckBugContestContestantFlag: ; 139ed
ld b, CHECK_FLAG
call EventFlagAction
ret
-; 139fe
INCLUDE "data/events/bug_contest_flags.asm"
```
@@ -1622,7 +1616,7 @@ However, `a < NUM_BUG_CONTESTANTS` should always be true, so in practice this is
In [home/init.asm](/home/init.asm):
```asm
-ClearWRAM:: ; 25a
+ClearWRAM::
; Wipe swappable WRAM banks (1-7)
; Assumes CGB or AGB
@@ -1639,7 +1633,6 @@ ClearWRAM:: ; 25a
cp 8
jr nc, .bank_loop ; Should be jr c
ret
-; 270
```
**Fix:** Change `jr nc, .bank_loop` to `jr c, .bank_loop`.
diff --git a/docs/design_flaws.md b/docs/design_flaws.md
index e4a81123b..4b24a0cc3 100644
--- a/docs/design_flaws.md
+++ b/docs/design_flaws.md
@@ -28,7 +28,7 @@ ENDM
The offset is translated into a correct bank by `FixPicBank` in [engine/gfx/load_pics.asm](/engine/gfx/load_pics.asm):
```asm
-FixPicBank: ; 511c5
+FixPicBank:
; This is a thing for some reason.
PICS_FIX EQU $36
@@ -36,7 +36,7 @@ GLOBAL PICS_FIX
push hl
push bc
- sub BANK(Pics_1) - PICS_FIX
+ sub BANK("Pics 1") - PICS_FIX
ld c, a
ld b, 0
ld hl, .PicsBanks
@@ -46,34 +46,34 @@ GLOBAL PICS_FIX
pop hl
ret
-.PicsBanks: ; 511d4
- db BANK(Pics_1) + 0
- db BANK(Pics_1) + 1
- db BANK(Pics_1) + 2
- db BANK(Pics_1) + 3
- db BANK(Pics_1) + 4
- db BANK(Pics_1) + 5
- db BANK(Pics_1) + 6
- db BANK(Pics_1) + 7
- db BANK(Pics_1) + 8
- db BANK(Pics_1) + 9
- db BANK(Pics_1) + 10
- db BANK(Pics_1) + 11
- db BANK(Pics_1) + 12
- db BANK(Pics_1) + 13
- db BANK(Pics_1) + 14
- db BANK(Pics_1) + 15
- db BANK(Pics_1) + 16
- db BANK(Pics_1) + 17
- db BANK(Pics_1) + 18
- db BANK(Pics_1) + 19
- db BANK(Pics_1) + 20
- db BANK(Pics_1) + 21
- db BANK(Pics_1) + 22
- db BANK(Pics_1) + 23
+.PicsBanks:
+ db BANK("Pics 1") ; BANK("Pics 1") + 0
+ db BANK("Pics 2") ; BANK("Pics 1") + 1
+ db BANK("Pics 3") ; BANK("Pics 1") + 2
+ db BANK("Pics 4") ; BANK("Pics 1") + 3
+ db BANK("Pics 5") ; BANK("Pics 1") + 4
+ db BANK("Pics 6") ; BANK("Pics 1") + 5
+ db BANK("Pics 7") ; BANK("Pics 1") + 6
+ db BANK("Pics 8") ; BANK("Pics 1") + 7
+ db BANK("Pics 9") ; BANK("Pics 1") + 8
+ db BANK("Pics 10") ; BANK("Pics 1") + 9
+ db BANK("Pics 11") ; BANK("Pics 1") + 10
+ db BANK("Pics 12") ; BANK("Pics 1") + 11
+ db BANK("Pics 13") ; BANK("Pics 1") + 12
+ db BANK("Pics 14") ; BANK("Pics 1") + 13
+ db BANK("Pics 15") ; BANK("Pics 1") + 14
+ db BANK("Pics 16") ; BANK("Pics 1") + 15
+ db BANK("Pics 17") ; BANK("Pics 1") + 16
+ db BANK("Pics 18") ; BANK("Pics 1") + 17
+ db BANK("Pics 19") ; BANK("Pics 1") + 18
+ db BANK("Pics 20") ; BANK("Pics 1") + 19
+ db BANK("Pics 21") ; BANK("Pics 1") + 20
+ db BANK("Pics 22") ; BANK("Pics 1") + 21
+ db BANK("Pics 23") ; BANK("Pics 1") + 22
+ db BANK("Pics 24") ; BANK("Pics 1") + 23
```
-**Fix:** Use `dba` instead of `dba_pic`, and don't call `FixPicBank` to modify `a`.
+**Fix:** Use `dba` instead of `dba_pic`, delete `FixPicBank`, and remove all four calls to `FixPicBank`.
## `PokemonPicPointers` and `UnownPicPointers` are assumed to start at the same address
@@ -84,6 +84,7 @@ In [gfx/pics.asm](/gfx/pics.asm):
; PokemonPicPointers and UnownPicPointers are assumed to start at the same
; address, but in different banks. This is enforced in pokecrystal.link.
+
SECTION "Pic Pointers", ROMX
INCLUDE "data/pokemon/pic_pointers.asm"
@@ -298,7 +299,7 @@ NUM_TMS = const_value - TM01 - 2 ; discount ITEM_C3 and ITEM_DC
`GetTMHMNumber` and `GetNumberedTMHM` in [engine/items/items.asm](/engine/items/items.asm) have to compensate for this:
```asm
-GetTMHMNumber:: ; d407
+GetTMHMNumber::
; Return the number of a TM/HM by item id c.
ld a, c
; Skip any dummy items.
@@ -315,7 +316,7 @@ GetTMHMNumber:: ; d407
ld c, a
ret
-GetNumberedTMHM: ; d417
+GetNumberedTMHM:
; Return the item id of a TM/HM by number c.
ld a, c
; Skip any gaps.
@@ -341,7 +342,7 @@ Move `ITEM_C3` and `ITEM_DC` above all the TMs in every table of item data.
Modify engine/items/items.asm:
```asm
-GetTMHMNumber:: ; d407
+GetTMHMNumber::
; Return the number of a TM/HM by item id c.
ld a, c
sub TM01
@@ -349,7 +350,7 @@ GetTMHMNumber:: ; d407
ld c, a
ret
-GetNumberedTMHM: ; d417
+GetNumberedTMHM:
; Return the item id of a TM/HM by number c.
ld a, c
add TM01
@@ -366,7 +367,7 @@ GetNumberedTMHM: ; d417
Three separate routines do the same derivation; `GetDexEntryPointer` in [engine/pokedex/pokedex_2.asm](/engine/pokedex/pokedex_2.asm):
```asm
-GetDexEntryPointer: ; 44333
+GetDexEntryPointer:
; return dex entry pointer b:de
push hl
ld hl, PokedexDataPointerTable
@@ -393,10 +394,10 @@ GetDexEntryPointer: ; 44333
ret
.PokedexEntryBanks:
- db BANK(PokedexEntries1)
- db BANK(PokedexEntries2)
- db BANK(PokedexEntries3)
- db BANK(PokedexEntries4)
+ db BANK("Pokedex Entries 001-064")
+ db BANK("Pokedex Entries 065-128")
+ db BANK("Pokedex Entries 129-192")
+ db BANK("Pokedex Entries 193-251")
```
`GetPokedexEntryBank` in [engine/items/item_effects.asm](/engine/items/item_effects.asm):
@@ -419,10 +420,10 @@ GetPokedexEntryBank:
ret
.PokedexEntryBanks:
- db BANK(PokedexEntries1)
- db BANK(PokedexEntries2)
- db BANK(PokedexEntries3)
- db BANK(PokedexEntries4)
+ db BANK("Pokedex Entries 001-064")
+ db BANK("Pokedex Entries 065-128")
+ db BANK("Pokedex Entries 129-192")
+ db BANK("Pokedex Entries 193-251")
```
And `PokedexShow_GetDexEntryBank` in [engine/pokegear/radio.asm](/engine/pokegear/radio.asm):
@@ -446,10 +447,10 @@ PokedexShow_GetDexEntryBank:
ret
.PokedexEntryBanks:
- db BANK(PokedexEntries1)
- db BANK(PokedexEntries2)
- db BANK(PokedexEntries3)
- db BANK(PokedexEntries4)
+ db BANK("Pokedex Entries 001-064")
+ db BANK("Pokedex Entries 065-128")
+ db BANK("Pokedex Entries 129-192")
+ db BANK("Pokedex Entries 193-251")
```
**Fix:** Use `dba` instead of `dw` in `PokedexDataPointerTable`, and modify the code that accesses it to match.
@@ -460,7 +461,7 @@ PokedexShow_GetDexEntryBank:
`_Sine` in [engine/math/sine.asm](/engine/math/sine.asm):
```asm
-_Sine:: ; 84d9
+_Sine::
; a = d * sin(e * pi/32)
ld a, e
calc_sine_wave
@@ -469,11 +470,11 @@ _Sine:: ; 84d9
`Sprites_Cosine` and `Sprites_Sine` in [engine/gfx/sprites.asm](/engine/gfx/sprites.asm):
```asm
-Sprites_Cosine: ; 8e72a
+Sprites_Cosine:
; a = d * cos(a * pi/32)
add %010000 ; cos(x) = sin(x + pi/2)
; fallthrough
-Sprites_Sine: ; 8e72c
+Sprites_Sine:
; a = d * sin(a * pi/32)
calc_sine_wave
```
@@ -481,37 +482,34 @@ Sprites_Sine: ; 8e72c
`BattleAnim_Cosine` and `BattleAnim_Sine` in [engine/battle_anims/functions.asm](/engine/battle_anims/functions.asm):
```asm
-BattleAnim_Cosine: ; ce732 (33:6732)
+BattleAnim_Cosine:
; a = d * cos(a * pi/32)
add %010000 ; cos(x) = sin(x + pi/2)
; fallthrough
-BattleAnim_Sine: ; ce734 (33:6734)
+BattleAnim_Sine:
; a = d * sin(a * pi/32)
calc_sine_wave BattleAnimSineWave
...
-BattleAnimSineWave: ; ce77f
+BattleAnimSineWave:
sine_table 32
-; ce7bf
```
`StartTrainerBattle_DrawSineWave` in [engine/battle/battle_transition.asm](/engine/battle/battle_transition.asm):
```asm
-StartTrainerBattle_DrawSineWave: ; 8c6f7 (23:46f7)
+StartTrainerBattle_DrawSineWave:
calc_sine_wave
-; 8c768
```
And `CelebiEvent_Cosine` in [engine/events/celebi.asm](/engine/events/celebi.asm):
```asm
-CelebiEvent_Cosine: ; 49b3b (12:5b3b)
+CelebiEvent_Cosine:
; a = d * cos(a * pi/32)
add %010000 ; cos(x) = sin(x + pi/2)
calc_sine_wave
-; 49bae
```
They all rely on `calc_sine_wave` in [macros/code.asm](/macros/code.asm):
@@ -586,7 +584,7 @@ ENDM
In [engine/tilesets/tileset_anims.asm](/engine/tilesets/tileset_anims.asm):
```asm
-GetForestTreeFrame: ; fc54c
+GetForestTreeFrame:
; Return 0 if a is even, or 2 if odd.
and a
jr z, .even
@@ -609,16 +607,14 @@ GetForestTreeFrame: ; fc54c
.even
xor a
ret
-; fc56d
```
**Fix:**
```asm
-GetForestTreeFrame: ; fc54c
+GetForestTreeFrame:
; Return 0 if a is even, or 2 if odd.
and 1
add a
ret
-; fc56d
```
diff --git a/docs/menu.md b/docs/menu.md
index 80d64ada1..67403bf15 100644
--- a/docs/menu.md
+++ b/docs/menu.md
@@ -54,8 +54,8 @@ Call state for functions in `MenuData` of `ScrollingMenu`:
```
All of them:
-[MenuSelection] = Current item. -1 is the CANCEL item.
-[MenuSelectionQuantity] = Quantity of the current item.
+[wMenuSelection] = Current item. -1 is the CANCEL item.
+[wMenuSelectionQuantity] = Quantity of the current item.
Function1: Called to display a menu entry.
de = Cursor position in TileMap
@@ -90,7 +90,7 @@ db -1 ; cancel
...
```
-In case it's 1, `[MenuSelectionQuantity]` will simply contain the next entry.
+In case it's 1, `[wMenuSelectionQuantity]` will simply contain the next entry.
## `_2DMenu`
@@ -208,7 +208,7 @@ StringPointers:
Call state for `DisplayFunction`:
```
-[MenuSelection] = Current item. -1 is the CANCEL item.
+[wMenuSelection] = Current item. -1 is the CANCEL item.
de = Cursor position in TileMap
```