Descriptive Problem Summary:
Clicks on transformed objects behave weirdly
Numbered Steps to Reproduce Problem:
1. Produce or otherwise procure a square icon of size 32x32 that contains a triangle with one normal angle.
2. Make any atom with that triangle icon as it's icon_state
3. Run make_triangle with any coordinates you want.
Code Snippet (if applicable) to Reproduce Problem:
atom/proc/make_triangle(var/x1,var/y1,var/x2,var/y2,var/x3,var/y3)
var/x11 = -16
var/x12 = -16
var/x21 = 16
var/x22 = -16
var/x31 = 16
var/x32 = 16
var/y11 = x1;
var/y12 = y1;
var/y21 = x2;
var/y22 = y2;
var/y31 = x3;
var/y32 = y3;
var/a1 = ((y11-y21)*(x12-x32)-(y11-y31)*(x12-x22))/((x11-x21)*(x12-x32)-(x11-x31)*(x12-x22));
var/a2 = ((y11-y21)*(x11-x31)-(y11-y31)*(x11-x21))/((x12-x22)*(x11-x31)-(x12-x32)*(x11-x21));
var/a3 = y11-a1*x11-a2*x12;
var/a4 = ((y12-y22)*(x12-x32)-(y12-y32)*(x12-x22))/((x11-x21)*(x12-x32)-(x11-x31)*(x12-x22));
var/a5 = ((y12-y22)*(x11-x31)-(y12-y32)*(x11-x21))/((x12-x22)*(x11-x31)-(x12-x32)*(x11-x21));
var/a6 = y12-a4*x11-a5*x12;
src.transform = matrix(a1,a2,a3,a4,a5,a6)
Expected Results:
To be able to click on any part of the triangle.
Actual Results:
Weirdly shaped quadratic mask that may not even be a part of the triangle at all is detected instead.
Does the problem occur:
Every time? Or how often?
Pretty often. Probably anytime a shear transformation occurs.
In other games?
Untested
In other user accounts?
Untested
On other computers?
Untested
When does the problem NOT occur?
According to atleast one russian in #coderbus, it works fine on rotations and such.
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.)
Dunno.
Workarounds:
:^)
(Real Talk: this will probably get a Won't Fix because it requires oddly specific pixel stretching calculations)
Theoretically any affine transformation should be possible to handle properly.