整理代码

This commit is contained in:
MrZ626
2021-07-25 02:19:18 +08:00
parent 27cede0fad
commit 61946fe52e
4 changed files with 57 additions and 45 deletions

View File

@@ -488,17 +488,17 @@ do
list[i][12]=a;list[i][21]=b;list[i][32]=b;list[i][23]=a
end
BRS=TABLE.new(function(P,d,ifpre)
local cur=P.cur
local idir=(cur.dir+d)%4
local kickList=list[cur.id][cur.dir*10+idir]
local icb=BLOCKS[cur.id][idir]
local isc=SCS[cur.id][idir]
local ix,iy=P.curX+cur.sc[2]-isc[2],P.curY+cur.sc[1]-isc[1]
local C=P.cur
local idir=(C.dir+d)%4
local kickList=list[C.id][C.dir*10+idir]
local icb=BLOCKS[C.id][idir]
local isc=SCS[C.id][idir]
local ix,iy=P.curX+C.sc[2]-isc[2],P.curY+C.sc[1]-isc[1]
local dx,dy=0,0 do
local pressing=P.keyPressing
if pressing[1]and P:ifoverlap(cur.bk,P.curX-1,P.curY)then dx=dx-1 end
if pressing[2]and P:ifoverlap(cur.bk,P.curX+1,P.curY)then dx=dx+1 end
if pressing[7]and P:ifoverlap(cur.bk,P.curX,P.curY-1)then dy=-1 end
if pressing[1]and P:ifoverlap(C.bk,P.curX-1,P.curY)then dx=dx-1 end
if pressing[2]and P:ifoverlap(C.bk,P.curX+1,P.curY)then dx=dx+1 end
if pressing[7]and P:ifoverlap(C.bk,P.curX,P.curY-1)then dy=-1 end
end
while true do
for test=1,#kickList do
@@ -514,8 +514,8 @@ do
if P.gameEnv.moveFX and P.gameEnv.block then
P:createMoveFX()
end
P.curX,P.curY,cur.dir=x,y,idir
cur.sc,cur.bk=isc,icb
P.curX,P.curY,C.dir=x,y,idir
C.sc,C.bk=isc,icb
P.spinLast=test==2 and 0 or 1
local t=P.freshTime

View File

@@ -547,8 +547,9 @@ function draw.drawNext_norm(P)
gc_push('transform')
gc_translate(62,40)
gc_setShader(shader_blockSatur)
while N<=ENV.nextCount and P.nextQueue[N]do
local bk,sprite=P.nextQueue[N].bk,texture[P.nextQueue[N].color]
local queue=P.nextQueue
while N<=ENV.nextCount and queue[N]do
local bk,sprite=queue[N].bk,texture[queue[N].color]
local k=#bk>2 and 2.2/#bk or 1
gc_scale(k)
for i=1,#bk do for j=1,#bk[1]do
@@ -678,18 +679,19 @@ function draw.norm(P)
--Draw current block
if P.cur and P.waiting==-1 then
local curColor=P.cur.color
local C=P.cur
local curColor=C.color
local trans=P.lockDelay/ENV.lock
local centerX=30*(P.curX+P.cur.sc[2])-15
local centerX=30*(P.curX+C.sc[2])-15
--Draw ghost & rotation center
local centerDisp=ENV.center and P.RS.centerDisp[P.cur.id]
local centerDisp=ENV.center and P.RS.centerDisp[C.id]
if ENV.ghost then
drawGhost[ENV.ghostType](P,curColor,ENV.ghost)
if centerDisp then
gc_setColor(1,1,1,ENV.center)
gc_draw(spinCenterImg,centerX,-30*(P.ghoY+P.cur.sc[1])+15,nil,nil,nil,4,4)
gc_draw(spinCenterImg,centerX,-30*(P.ghoY+C.sc[1])+15,nil,nil,nil,4,4)
end
elseif GAME.replaying then
drawGhost.gray(P,nil,.15)
@@ -703,7 +705,7 @@ function draw.norm(P)
drawBlock(P,curColor)
if centerDisp then
gc_setColor(1,1,1,ENV.center)
gc_draw(spinCenterImg,centerX,-30*(P.curY+P.cur.sc[1])+15,nil,nil,nil,4,4)
gc_draw(spinCenterImg,centerX,-30*(P.curY+C.sc[1])+15,nil,nil,nil,4,4)
end
elseif GAME.replaying then
drawBlockShade(P,trans*.3)

View File

@@ -58,6 +58,8 @@ return STRING.split([=[
代码:
重构WS模块,可能解决部分联网游戏中的概率thread error问题
升级BGM/IMG/SKIN模块,资源不再需要启动时加载好,提升加载速度节约资源占用
优化游戏场景性能,移除回放按钮hideF函数
主循环略微优化
修复:
只有屏幕宽度异常时自动刷新窗口尺寸 #120
20G不会禁用各种软降n格键
@@ -70,7 +72,7 @@ return STRING.split([=[
触屏设置在窗口非默认长宽比时边缘网格缺失
有屏幕滚动的场景鼠标拖动时控件失焦
导入设置(包括剪切板和云存档)时部分设置不生效
小程序cubefield的碰撞判定移出draw解决低绘制帧率导致漏判定的问题 #138
小程序cubefield的碰撞判定移出draw,解决低绘制帧率导致漏判定的问题 #138
序列和任务超长导致渲染开销太大卡死 #137
0.15.6: 强化装甲 Reinforced Armor