Pathoschild / SMAPI

The modding API for Stardew Valley.
https://smapi.io/
GNU Lesser General Public License v3.0
1.71k stars 258 forks source link

Drawing to the world is offset when zoom == 100 and UI scale != 100 #936

Open yuri-moens opened 3 months ago

yuri-moens commented 3 months ago

Describe the bug When drawing to the world on zoom 100% and UI scale anything except 100% the draws don't appear in the correct location. They seem to appear in the correct location for every other zoom/UI combination except zoom == 100 and UI != 100. I've never seen this issue before so I believe it must be new with 1.6/4.0.0. I wrote a simple test mod to better illustrate the issue, see below. Apologies if this is the wrong channel to report this, I've tried Discord a couple of times but no luck, the messages tend to get lost quickly due to activity.

To Reproduce

  1. Build test mod: https://github.com/yuri-moens/TestMod
  2. Warp to the mines (world_setminelevel 2)
  3. Enjoy pretty white rectangles covering all stones
  4. In options, set zoom to 100% and UI scale to anything except 100%
  5. The rectangles are no longer covering the stones

Screenshots Using 100% Zoom and 100% UI scale https://i.imgur.com/e7ROIf2.png

Using 100% Zoom and 110% UI scale https://i.imgur.com/cIuV1cf.png

urbanyeti commented 3 months ago

I can confirm this issue. Experienced this in the latest version of my mod which draws thought bubbles above farm animal heads: https://www.nexusmods.com/stardewvalley/mods/859?tab=files

I am hooking into OnRenderedWorld and drawing from there so was not expecting the the elements to be rendered in the UI mode (even confirmed that they shouldn't be because Game1.uiMode is false), but the new elements scale when the UI scale adjuster is changed.

I see the expected behavior (the rendered elements not being affected by the UI scale slider) when zoom is set to anything other that 100%, so I think there's a bug here.

I've uploaded a quick demo here: https://imgur.com/a/EGj7Fc9

jltaylor-us commented 3 months ago

Can confirm the same behavior in Range Highlight, specifically in this draw call during the RenderedWorld event https://github.com/jltaylor-us/StardewRangeHighlight/blob/e7b3b71db64795a6ef21c2e1a972a46165daab23/RangeHighlight/RangeHighlighter.cs#L88-L110 I don't think that particular bit of code has anything SMAPI-specific in it, so maybe a game bug?