fix cringe mouse handling

This commit is contained in:
Kimapr 2023-03-29 15:19:08 +05:00
parent 00b0f9361d
commit dbe5287272

View file

@ -661,45 +661,7 @@ local speeds={1,0.05,10}
local plchint=1
local toplchi=plchint
function love.update(dt)
dt=math.min(dt,0.2)*(speeds[slow])
accumdt=math.min(1,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
for _=1,10 do
local ix,iy=math.random(1,bw),math.random(1,bh)
local px,py=0,0
while px<1 or py<1 or px>bw or py>bh do
local ox,oy=unpack(({{1,0},{-1,0},{0,1},{0,-1}})[math.random(1,4)])
px,py=ix+ox,iy+oy
end
board[ix][iy],board[px][py]=
board[px][py],board[ix][iy]
local kills=check(ix,iy,check(px,py))
if kills and board[ix][iy] and board[px][py] then
megascan(ix,iy,board[ix][iy],megascan(px,py,board[px][py],kills))
killall(kills)
break
else
board[ix][iy],board[px][py]=
board[px][py],board[ix][iy]
end
end
end
if running then
bat=math.max(0,bat-dt*0.015*(math.max(bat,0.0625)^0.5))
batd=interp(batd,bat,dt)
scored=interp(scored,score,dt)
end
if bat==0 and not dying then
dying=true
dropall(0,true)
end
function love.mousemoved()
if grabbed then
local x,y,ox,oy,px,py=unpack(grabbed)
local mx,my=love.mouse.getPosition()
@ -721,6 +683,46 @@ function love.update(dt)
smtar(x,y,mx,my)
end
end
end
function love.update(dt)
dt=math.min(dt,0.2)*(speeds[slow])
accumdt=math.min(1,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
for _=1,100 do
local ix,iy=math.random(1,bw),math.random(1,bh)
local px,py=0,0
while px<1 or py<1 or px>bw or py>bh do
local ox,oy=unpack(({{1,0},{-1,0},{0,1},{0,-1}})[math.random(1,4)])
px,py=ix+ox,iy+oy
end
board[ix][iy],board[px][py]=
board[px][py],board[ix][iy]
local kills=check(ix,iy,check(px,py))
if kills and board[ix][iy] and board[px][py] then
megascan(ix,iy,board[ix][iy],megascan(px,py,board[px][py],kills))
killall(kills)
else
board[ix][iy],board[px][py]=
board[px][py],board[ix][iy]
end
end
end
if running then
bat=math.max(0,bat-dt*0.015*(math.max(bat,0.0625)^0.5))
batd=interp(batd,bat,dt)
scored=interp(scored,score,dt)
end
if bat==0 and not dying then
dying=true
dropall(0,true)
end
animc=0
entc=0
boomc=0