ID:2429244
 
Resolved
KEEP_TOGETHER groups could be rendered in an incorrect position in certain unusual cases.
BYOND Version:512
Operating System:Windows 10 Pro 64-bit
Web Browser:Chrome 72.0.3626.109
Applies to:Dream Seeker
Status: Resolved (512.1465)

This issue has been resolved.
Descriptive Problem Summary:
If the client's screen size is changed by adding an atom to it with a screen_loc that is out of bounds, atoms with the appearance_flags KEEP_TOGETHER are displayed incorrectly when the game window is too small to display the entire map.
Resizing the window to display the entire map will display the icon correctly. Does not occur with icons stretching to fit.

Numbered Steps to Reproduce Problem:
1. Create mob atom with appearance_flags set to KEEP_TOGETHER
2. Add an overlay to the mob
3. Add an object with screen_loc set to "0,0" to the client's screen.
4. Set Icons to 32x32 in the game window
5. Resize the game window to be smaller than the map

Code Snippet (if applicable) to Reproduce Problem:
mob
icon='icon.dmi'

appearance_flags=KEEP_TOGETHER

verb/overit()

src.overlays+='overlay.dmi'

var/obj/O=new/obj
O.screen_loc="0,0"

src.client.screen+=O//remove this line (or the appearance flag) and the mob will display as expected.


Expected Results:
Atom is displayed and scaled relative to icon sizing in the map
Actual Results:
Atom scaling is affected by the size of the game window
Does the problem occur:
Every time? Or how often? 100% with these steps and settings.
In other games? Yes
In other user accounts? Yes
On other computers? Yes

When does the problem NOT occur?
When the map display is set to stretch to fit.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.) Untested in other versions.

Workarounds:
None.

Can you get me a small test project for this?
This link should work. Pretty basic. Just run the verb after getting into the game and you should see it.

https://ufile.io/alwjb
Apologies for not getting to this sooner, but I've just checked this out and it appears the project is missing some files. It can't find overlay.dmi, for one.
That's my fault, I did leave out just the overlay.dmi but it can be any icon or object. If you replace 'overlay.dmi' with 'icon.dmi' you should get the same result.
Bovine buddy is still active? My god.
I came back to this project after filling in overlay.dmi as just a 32x32 white icon, and... I'm not seeing any issue whatsoever.

Your demo didn't give me any clues as to what might be wrong since your verb changes two things at once and doesn't allow for toggling things, so I split the verb into two: one to toggle the overlay, one to toggle a screen object at 0,0.

The overlay appeared in the correct position on my mob whether there was a screen object at 0,0 or not, every time. This makes perfect sense, since ultimately the screen scaling would have zero influence on overlay placement. So whatever you saw had to be from a very different case than what you put in your demo project, because the demo project absolutely does not show the problem.
Lummox JR changed status to 'Unverified'
Did you make sure to follow step 5? You won't see it otherwise.

Here is an image of what I am seeing in the demo project: https://ibb.co/rZz1hkQ



I split the verb into the two parts you mentioned and here is how that played out (along with the modified code):
https://ibb.co/CMHYrpf


turf
icon='turf.dmi'

mob
icon='icon.dmi'

appearance_flags=KEEP_TOGETHER

verb/step1()

var/obj/O=new/obj
O.screen_loc="0,0"
src.client.screen+=O

verb/step2()

src.overlays+='overlay.dmi'
Lummox JR resolved issue with message:
KEEP_TOGETHER groups could be rendered in an incorrect position in certain unusual cases.
I was indeed missing step 5. Doh!

This appears to be caused by color matrix mode turning on incorrectly and then setting up the projection settings wrong, which is all nine kinds of wrong. Oddly, once I fixed the issue I tried it with a color matrix, suspecting there was still a bug there, but an intentional color matrix did not trigger anything.