forked from pyrex/chameleonic
Fix crate math.
I forgot that -1 & 1 = 1 rather than 0 so all the bit math didn't work. But I can fix it with polynomial algebra! this is much better.
This commit is contained in:
parent
0fe3b1699f
commit
9d93f30426
@ -502,11 +502,7 @@ function level:get_latch(dx,dy,px,py)
|
||||
local dx1,dy1=-sgn0(dx),-sgn0(dy)
|
||||
|
||||
if crate then
|
||||
if crate.def & (
|
||||
dy1 >>> 15 |
|
||||
(dy1 & 0x1) << 2 |
|
||||
(dx1 & 0x8000) >>> 12 |
|
||||
(dx1 & 0x1) << 1) ~= 0 then
|
||||
if crate.def & dy1*dy1*(2.5+1.5*dy1)+dx1*dx1*(5-3*dx1) ~= 0 then
|
||||
return {
|
||||
el="crate",
|
||||
dx=dx1,dy=dy1,
|
||||
|
Loading…
Reference in New Issue
Block a user