Closed Mord5 closed 12 months ago
Verified that this is a Gamefreak original.
I tracked down the cause. There is a bug in TrainerEngage.linedUpX, let me explain.
Sprites are offset by 4 pixels towards the top of the screen for perspective.
Top of the player's hat is always Y=$3C pixels from the top of the screen.
Vertical distance is always calculated between the top of the player's head and the top of the NPC's head.
When the NPC is 4 spaces above the player, the top of its head is off of the screen. The top of the screen is Y=0, so this means the top of the NPC's head underflows by 4 pixels to Y=$FC.
This results in the distance being calculated wrong: $3C - $FC = $C0 instead of the expected $40.
This bug affects TrainerWalkUpToPlayer.facingDown as well.
See 78368126 for the fix. Easiest solution is to undo the 4-pixel offset under conditions that are affected by the underflow.
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/43b63b6f6eb93674af1580741b3686096a868e10
What is the problem you encountered? Any trainer with a defined view range of 4 cells that faces downwards actually only has a view range of 3 cells. Can be seen with the southernmost Biker on Route 14: