diff --git a/main.lua b/main.lua index 31e5759..94720ca 100644 --- a/main.lua +++ b/main.lua @@ -52,6 +52,9 @@ local colors={ g.line(0.3,0.5, 0.7,0.5) end, } +function pairs(t) + return next,t,nil +end local gobjs={} local cgobjs={} local lgobjs={} @@ -62,12 +65,12 @@ for k,v in ipairs(colors) do lgobjs[k]={c=k,super="lines"} mgobjs[k]={c=k,super="color"} end -local ltest=os.time() +local ltest=0 debug.sethook(function() - local lt=os.time() - if lt-ltest>4 then + ltest=ltest+1 + if ltest>=10000 then print("!! we are in a freezer !!",debug.traceback()) - ltest=lt + ltest=0 end end,"",1000) local cc=3 @@ -694,15 +697,14 @@ function love.mousemoved() end function love.update(dt) - ltest=os.time() + ltest=0 dt=math.min(dt,0.2)*(speeds[slow]) - accumdt=math.min(1,accumdt+dt) + accumdt=math.min(0.6,accumdt+dt) local fcc=0 while accumdt>1/tps do fcc=fcc+1 local dt=1/tps accumdt=accumdt-dt - if fcc>10 then return end if running and playdbg then local gc=0 local tc=0 @@ -711,7 +713,7 @@ function love.update(dt) gc=gc+(board[x][y] and 1 or 0) tc=tc+1 end end - if gc/tc>0.8 then + if gc/tc>0.4 then local goods={} for _=1,1000 do local ix,iy=math.random(1,bw),math.random(1,bh) @@ -856,11 +858,7 @@ function love.update(dt) toplchi=plchint end local oam,obm,rm={},{},{} - local tt=os.clock() - local itc=0 for k,v in pairs(tk) do - itc=itc+1 - if os.clock()-tt>2 then error("too long "..itc.."; #"..#tk) end local x,y=unpack(v) check(x,y,rm,oam,obm) end @@ -942,6 +940,8 @@ function love.keypressed(k) bat=bat*2 elseif k=="f10" then playdbg=not playdbg + elseif k=="f11" then + love.window.setFullscreen(not love.window.getFullscreen()) end end