Glitch Pokédex flag: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
>Torchickens
No edit summary
>Torchickens
Line 21: Line 21:
Now, imagine we caught a Rattata (Pokédex ID 19). The game starts at address D2F7 ([https://github.com/pret/pokered/blob/46a94c63fc287e7290502776d02648476bc44171/wram.asm#L2339 wPokedexOwned]), and advances (18 / 8 :) 2 bytes forward. Then it sets bit (18 % 8 :) 2, because we have captured it.
Now, imagine we caught a Rattata (Pokédex ID 19). The game starts at address D2F7 ([https://github.com/pret/pokered/blob/46a94c63fc287e7290502776d02648476bc44171/wram.asm#L2339 wPokedexOwned]), and advances (18 / 8 :) 2 bytes forward. Then it sets bit (18 % 8 :) 2, because we have captured it.


Now, this method works fine for all IDs up to 151. But what would happen with higher IDs? You guessed it, the game will go beyond the end of the Pokédex flags table. (The exception being Pokédex flag 152, which is still in-bounds, and has its own unused bit)
Now, this method works fine for all IDs up to 151. But what would happen with higher IDs? You guessed it, the game will go beyond the end of the Pokédex flags table. (The exception being Pokédex flag 152, which is still in-bounds, and has its own unused bit), and will affect the player's inventory.


The more complicated case is Pokémon with ID 0 (like [[Missingno]] or [[GlitchDex/RB:000|'M (R/B)]]), because upon subtracting 1 (Pokédex ID - 1, remember?), the 0 underflows to 255.
The more complicated case is Pokémon with ID 0 (like [[Missingno]] or [[GlitchDex/RB:000|'M (R/B)]]), because upon subtracting 1 (Pokédex ID - 1, remember?), the 0 underflows to 255.