TwitchPlaysPokemon / pokerbg

Pokemon Red, Green, and Blue (Green based on JP Blue) with a sequence breaks, major glitches, and softlocks patched.
5 stars 1 forks source link

Fix 99 Item Stack Glitch #13

Closed m4-used-rollout closed 3 years ago

m4-used-rollout commented 3 years ago

Glitch City

Apparently, getting more of an item you have a stack of 99 of at the end of the bag/PC can result in the game reading beyond the end of the bag/PC to find another stack to add to, causing possible save corruption. Apparently, it skips over the terminator at the end of the items list. This may be caused by an off-by-one error.

Either way, if the entire bag and item PC (or just the last slot) were initialized with $FF, this glitch would not happen. Yellow may also have a fix.

m4-used-rollout commented 3 years ago

When the game found the item it was trying to stack, it would skip over the check for the terminator in the next slot. Yellow fixed this by having it jump back to the terminator check instead of the top of the loop.

m4-used-rollout commented 3 years ago

Testing save: Test Item Stack Glitch.zip

There is already a stack of 14 Pokeballs followed by a stack of 99 Pokeballs at the end of the bag. Enter the Mart and buy 99 Pokeballs.

Vanilla: Bag ends up with 2 stacks of 99 Pokeballs. 14 Pokeballs overflow and set another value in memory, freezing the player in place and causing map glitches. Fixed: Bag ends up with 2 stacks of 99 Pokeballs followed by one more stack of 14 Pokeballs. Player can move around normally and map is unaffected.