Compare commits

..

No commits in common. "0fe3b1699f3ce2cf3ca6f5466fa8f9930563dda0" and "10948ce4a5342ee6a4a0e8ea9942e90f7be9c073" have entirely different histories.

View File

@ -438,9 +438,7 @@ function level:spawn_exit()
if (self:_mget(x,y)!=18) return
for nx=x-1,x+1 do
for ny=y-1,y+1 do
-- next check: is at least one of
-- nx or ny out of range [0, 15]?
if (nx | ny) & 0xFFF0 ~= 0 then
if nx<0 or ny<0 or nx>15 or ny>15 then
self._wins[_mix(nx,ny)]=true
end
end
@ -480,18 +478,16 @@ function _mix(mx,my)
return mx..","..my
end
-- crate spec:
-- "up" == 1
-- "right" == 2
-- "down" == 4
-- "left" == 8
--
-- +1+
-- 8 2
-- +4+
function level:_get_cratedef(s)
if (s<64 or s>=80) return
return s & 0x000F
if (s<64 or s>=80) return nil
local s2=s-64
return {
up=s2&1!=0,
right=s2&2!=0,
down=s2&4!=0,
left=s2&8!=0
}
end
function level:get_latch(dx,dy,px,py)
@ -502,11 +498,12 @@ 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.up and dy>0) or
(crate.def.down and dy<0) or
(crate.def.left and dx>0) or
(crate.def.right and dx<0)
then
return {
el="crate",
dx=dx1,dy=dy1,