jojobear13 / shinpokered

Mostly-vanilla hack of Pokémon Red/Blue focused on bugfixes and trainer ai
209 stars 42 forks source link

Bug: Poke Flute inconsistency #274

Closed Mord5 closed 12 months ago

Mord5 commented 1 year ago

What emulator and/or hardware are you are using? bgb 1.5.9.w64

What version of this project are you using? built from source master_dev commit https://github.com/jojobear13/shinpokered/commit/783681261a853c8a33d7b607b38166467e1c6c18

What is the problem you encountered? If you use the Poke Flute immediately after putting an enemy mon to sleep, it will give the "Now that's a catchy tune!" message. If you wait a turn, it will give the "All sleeping Pokemon woke up." message.

https://github.com/jojobear13/shinpokered/assets/52078365/c9e0be64-6f5b-4700-b402-b56554c17cdd

(NB: The same thing happens if your mon goes second.)

jojobear13 commented 1 year ago

Confirmed to be reproducible in the vanilla games.

jojobear13 commented 1 year ago

Fixed via 178936fa. This bug is caused by an oversight in the pokeflute function. The message displayed is determined by the value of wWereAnyMonsAsleep, and this byte only gets set by the function WakeUpEntireParty. But the WakeUpEntireParty function only gets run for the player's party and an enemy trainer party; never for a wild pokemon. This can cause some mismatches under various conditions.