More (modest) optimizations to level rebuild

This commit is contained in:
Pyrex 2023-01-02 21:08:40 -08:00
parent 2c29327db2
commit 2a2d5edc98

View File

@ -416,8 +416,9 @@ end
function level:recollide_reanchor() function level:recollide_reanchor()
self._coll={} self._coll={}
for mx=0,15 do for mx=0,15 do
local kmx=mx..","
for my=0,15 do for my=0,15 do
local mxy=_mix{mx,my} local mxy=kmx..my
self._coll[mxy]= self._coll[mxy]=
fget(self:_mget(mx,my),7) or fget(self:_mget(mx,my),7) or
self._crates[mxy] self._crates[mxy]
@ -430,18 +431,19 @@ function level:recollide_reanchor()
-1`1 -1`1
1`1]]) do 1`1]]) do
local dx,dy=unpack(dxy) local dx,dy=unpack(dxy)
assert(dx!=0 and dy!=0) local c=self._coll
for mx0=0,15 do for mx0=0,15 do
local mx1=mx0+dx
local kmx0,kmx1=mx0..",",mx1..","
for my0=0,15 do for my0=0,15 do
local mx1,my1=mx0+dx,my0+dy local my1=my0+dy
-- bypass mcoll for MEGA SPEED -- bypass mcoll for MEGA SPEED
local c=self._coll
if ( if (
c[mx0..","..my0] and not self:get_crate(mx0,my0) and c[kmx0..my0] and not self:get_crate(mx0,my0) and
not c[mx0..","..my1] and not c[kmx0..my1] and
not c[mx1..","..my0] and not c[kmx1..my0] and
not c[mx1..","..my1] not c[kmx1..my1]
) then ) then
local key=_mix{"GEOM",mx0,my0,dx,dy} local key=_mix{"GEOM",mx0,my0,dx,dy}
anch_new[key]= { anch_new[key]= {