旋转系统模块重构,支持无旋转中心 close #168
This commit is contained in:
@@ -602,7 +602,7 @@ function love.run()
|
||||
local R=int((time+1)/2)%7+1
|
||||
_=minoColor[SETTING.skin[R]]
|
||||
gc_setColor(_[1],_[2],_[3],min(abs(1-time%2),.3))
|
||||
_=SCS[R][0]
|
||||
_=DSCP[R][0]
|
||||
gc_draw(TEXTURE.miniBlock[R],mx,my,time%3.14159265359*4,16,16,_[2]+.5,#BLOCKS[R][0]-_[1]-.5)
|
||||
gc_setColor(1,1,1)
|
||||
gc_draw(ms.isDown(1)and cursor_holdImg or cursorImg,mx,my,nil,nil,nil,8,8)
|
||||
|
||||
1
main.lua
1
main.lua
@@ -78,6 +78,7 @@ NET= require'parts.net'
|
||||
VK= require'parts.virtualKey'
|
||||
AIFUNC= require'parts.ai'
|
||||
AIBUILDER= require'parts.AITemplate'
|
||||
RSlist= require'parts.RSlist'DSCP=RSlist.TRS.centerPos
|
||||
PLY= require'parts.player'
|
||||
netPLY= require'parts.netPlayer'
|
||||
MODES= require'parts.modes'
|
||||
|
||||
709
parts/RSlist.lua
Normal file
709
parts/RSlist.lua
Normal file
@@ -0,0 +1,709 @@
|
||||
local defaultCenterPos={
|
||||
--Tetromino
|
||||
{[0]={0,1},{1,0},{1,1},{1,1}},--Z
|
||||
{[0]={0,1},{1,0},{1,1},{1,1}},--S
|
||||
{[0]={0,1},{1,0},{1,1},{1,1}},--L
|
||||
{[0]={0,1},{1,0},{1,1},{1,1}},--J
|
||||
{[0]={0,1},{1,0},{1,1},{1,1}},--T
|
||||
{[0]={.5,.5},{.5,.5},{.5,.5},{.5,.5}},--O
|
||||
{[0]={-.5,1.5},{1.5,-.5},{.5,1.5},{1.5,.5}},--I
|
||||
|
||||
--Pentomino
|
||||
{[0]={1,1},{1,1},{1,1},{1,1}},--Z5
|
||||
{[0]={1,1},{1,1},{1,1},{1,1}},--S5
|
||||
{[0]={0,1},{1,0},{1,1},{1,1}},--P
|
||||
{[0]={0,1},{1,0},{1,1},{1,1}},--Q
|
||||
{[0]={1,1},{1,1},{1,1},{1,1}},--F
|
||||
{[0]={1,1},{1,1},{1,1},{1,1}},--E
|
||||
{[0]={1,1},{1,1},{1,1},{1,1}},--T5
|
||||
{[0]={0,1},{1,0},{1,1},{1,1}},--U
|
||||
{[0]={.5,1.5},{.5,.5},{1.5,.5},{1.5,1.5}},--V
|
||||
{[0]={1,1},{1,1},{1,1},{1,1}},--W
|
||||
{[0]={1,1},{1,1},{1,1},{1,1}},--X
|
||||
{[0]={.5,1.5},{1.5,.5},{.5,1.5},{1.5,.5}},--J5
|
||||
{[0]={.5,1.5},{1.5,.5},{.5,1.5},{1.5,.5}},--L5
|
||||
{[0]={.5,1.5},{1.5,.5},{.5,1.5},{1.5,.5}},--R
|
||||
{[0]={.5,1.5},{1.5,.5},{.5,1.5},{1.5,.5}},--Y
|
||||
{[0]={.5,1.5},{1.5,.5},{.5,1.5},{1.5,.5}},--N
|
||||
{[0]={.5,1.5},{1.5,.5},{.5,1.5},{1.5,.5}},--H
|
||||
{[0]={0,2},{2,0},{0,2},{2,0}},--I5
|
||||
|
||||
--Trimino
|
||||
{[0]={0,1},{1,0},{0,1},{1,0}},--I3
|
||||
{[0]={.5,.5},{.5,.5},{.5,.5},{.5,.5}},--C
|
||||
|
||||
--Domino
|
||||
{[0]={-.5,.5},{.5,-.5},{.5,.5},{.5,.5}},--I2
|
||||
|
||||
--Dot
|
||||
{[0]={0,0},{0,0},{0,0},{0,0}},--O1
|
||||
}
|
||||
|
||||
local map={}for x=-4,4 do map[x]={}for y=-4,4 do map[x][y]={x,y}end end
|
||||
|
||||
local noKickSet,noKickSet_180,pushZero do
|
||||
local Zero={map[0][0]}
|
||||
noKickSet={[01]=Zero,[10]=Zero,[03]=Zero,[30]=Zero,[12]=Zero,[21]=Zero,[32]=Zero,[23]=Zero}
|
||||
noKickSet_180={[01]=Zero,[10]=Zero,[03]=Zero,[30]=Zero,[12]=Zero,[21]=Zero,[32]=Zero,[23]=Zero,[02]=Zero,[20]=Zero,[13]=Zero,[31]=Zero}
|
||||
function pushZero(t)
|
||||
for _,set in next,t do
|
||||
if type(set)=='table'then
|
||||
for _,R in next,set do
|
||||
if not R[1]or type(R[1])=='string'and R[1]~='+0+0'then
|
||||
table.insert(R,1,'+0+0')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Use this if the block is centrosymmetry, *PTR!!!
|
||||
local function centroSymSet(L)
|
||||
L[23]=L[01]L[32]=L[10]
|
||||
L[21]=L[03]L[12]=L[30]
|
||||
L[20]=L[02]L[31]=L[13]
|
||||
end
|
||||
|
||||
--Use this to copy a symmetry set
|
||||
local function flipList(O)
|
||||
if not O then return end
|
||||
local L={}
|
||||
for i,s in next,O do
|
||||
L[i]=string.char(88-s:byte())..s:sub(2)
|
||||
end
|
||||
return L
|
||||
end
|
||||
|
||||
local function reflect(a)
|
||||
return{
|
||||
[03]=flipList(a[01]),
|
||||
[01]=flipList(a[03]),
|
||||
[30]=flipList(a[10]),
|
||||
[32]=flipList(a[12]),
|
||||
[23]=flipList(a[21]),
|
||||
[21]=flipList(a[23]),
|
||||
[10]=flipList(a[30]),
|
||||
[12]=flipList(a[32]),
|
||||
[02]=flipList(a[02]),
|
||||
[20]=flipList(a[20]),
|
||||
[31]=flipList(a[13]),
|
||||
[13]=flipList(a[31]),
|
||||
}
|
||||
end
|
||||
|
||||
local TRS
|
||||
do
|
||||
local OspinList={
|
||||
{111,5,2, 0,-1,0},{111,5,2,-1,-1,0},{111,5,0,-1, 0,0},--T
|
||||
{333,5,2,-1,-1,0},{333,5,2, 0,-1,0},{333,5,0, 0, 0,0},--T
|
||||
{313,1,2,-1, 0,0},{313,1,2, 0,-1,0},{313,1,2, 0, 0,0},--Z
|
||||
{131,2,2, 0, 0,0},{131,2,2,-1,-1,0},{131,2,2,-1, 0,0},--S
|
||||
{131,1,2,-1, 0,0},{131,1,2, 0,-1,0},{131,1,2, 0, 0,0},--Z(misOrder)
|
||||
{313,2,2, 0, 0,0},{313,2,2,-1,-1,0},{313,2,2,-1, 0,0},--S(misOrder)
|
||||
{331,3,2, 0,-1,0},--J(farDown)
|
||||
{113,4,2,-1,-1,0},--L(farDown)
|
||||
{113,3,2,-1,-1,0},{113,3,0, 0, 0,0},--J
|
||||
{331,4,2, 0,-1,0},{331,4,0,-1, 0,0},--L
|
||||
{222,7,2,-1, 0,2},{222,7,2,-2, 0,2},{222,7,2, 0, 0,2},--I
|
||||
{222,7,0,-1, 1,1},{222,7,0,-2, 1,1},{222,7,0, 0, 1,1},--I(high)
|
||||
{121,6,0, 1,-1,2},{112,6,0, 2,-1,2},{122,6,0, 1,-2,2},--O
|
||||
{323,6,0,-1,-1,2},{332,6,0,-2,-1,2},{322,6,0,-1,-2,2},--O
|
||||
}--{keys, ID, dir, dx, dy, freeLevel (0=immovable, 1=U/D-immovable, 2=free)}
|
||||
local XspinList={
|
||||
{{ 1,-1},{ 1, 0},{ 1, 1},{ 1,-2},{ 1, 2}},
|
||||
{{ 0,-1},{ 0,-2},{ 0, 1},{ 0,-2},{ 0, 2}},
|
||||
{{-1,-1},{-1, 0},{-1, 1},{-1,-2},{-1, 2}},
|
||||
}
|
||||
TRS={
|
||||
centerDisp=TABLE.new(true,29),
|
||||
kickTable={
|
||||
{
|
||||
[01]={'-1+0','-1+1','+0-2','-1+2','+0+1'},
|
||||
[10]={'+1+0','+1-1','+0+2','+1-2','+1-2'},
|
||||
[03]={'+1+0','+1+1','+0-2','+1-1','+1-2'},
|
||||
[30]={'-1+0','-1-1','+0+2','-1+2','+0-1'},
|
||||
[12]={'+1+0','+1-1','+0+2','+1+2'},
|
||||
[21]={'-1+0','-1+1','+0-2','-1-2'},
|
||||
[32]={'-1+0','-1-1','+0+2','-1+2'},
|
||||
[23]={'+1+0','+1+1','+0-2','+1-2'},
|
||||
[02]={'+1+0','-1+0','+0-1','+0+1'},
|
||||
[20]={'-1+0','+1+0','+0+1','+0-1'},
|
||||
[13]={'+0-1','+0+1','+0-2'},
|
||||
[31]={'+0+1','+0-1','+0+2'},
|
||||
},--Z
|
||||
false,--S
|
||||
{
|
||||
[01]={'-1+0','-1+1','+1+0','+0-2','+1+1'},
|
||||
[10]={'+1+0','+1-1','-1+0','+0+2','+1+2'},
|
||||
[03]={'+1+0','+1+1','+0-2','+1-2','+1-1','+0+1'},
|
||||
[30]={'-1+0','-1-1','+0+2','-1+2','+0-1','-1+1'},
|
||||
[12]={'+1+0','+1-1','+1+1','-1+0','+0-1','+0+2','+1+2'},
|
||||
[21]={'-1+0','-1+1','-1-1','+1+0','+0+1','+0-2','-1-2'},
|
||||
[32]={'-1+0','-1-1','+1+0','+0+2','-1+2','-1+1'},
|
||||
[23]={'+1+0','+1-1','-1+0','+1+1','+0-2','+1-2'},
|
||||
[02]={'-1+0','+1+0','+0-1','+0+1'},
|
||||
[20]={'+1+0','-1+0','+0+1','+0-1'},
|
||||
[13]={'+0-1','+0+1','+1+0'},
|
||||
[31]={'+0+1','+0-1','-1+0'},
|
||||
},--J
|
||||
false,--L
|
||||
{
|
||||
[01]={'-1+0','-1+1','+0-2','-1-2','+0+1'},
|
||||
[10]={'+1+0','+1-1','+0+2','+1+2','+0-1'},
|
||||
[03]={'+1+0','+1+1','+0-2','+1-2','+0+1'},
|
||||
[30]={'-1+0','-1-1','+0+2','-1+2','+0-1'},
|
||||
[12]={'+1+0','+1-1','+0-1','-1-1','+0+2','+1+2','+1+1'},
|
||||
[21]={'-1+0','+0-2','-1-2','-1-1','+1+1'},
|
||||
[32]={'-1+0','-1-1','+0-1','+1-1','+0+2','-1+2','-1+1'},
|
||||
[23]={'+1+0','+0-2','+1-2','+1-1','-1+1'},
|
||||
[02]={'-1+0','+1+0','+0+1'},
|
||||
[20]={'+1+0','-1+0','+0-1'},
|
||||
[13]={'+0-1','+0+1','+1+0','+0-2','+0+2'},
|
||||
[31]={'+0-1','+0+1','-1+0','+0-2','+0+2'},
|
||||
},--T
|
||||
function(P,d)
|
||||
if P.gameEnv.easyFresh then
|
||||
P:freshBlock('fresh')
|
||||
end
|
||||
if P.gameEnv.ospin then
|
||||
local x,y=P.curX,P.curY
|
||||
if y==P.ghoY and((P:solid(x-1,y)or P:solid(x-1,y+1)))and(P:solid(x+2,y)or P:solid(x+2,y+1))then
|
||||
if P.sound then SFX.play('rotatekick',nil,P:getCenterX()*.15)end
|
||||
P.spinSeq=P.spinSeq%100*10+d
|
||||
if P.spinSeq<100 then return end
|
||||
for i=1,#OspinList do
|
||||
local L=OspinList[i]
|
||||
if P.spinSeq==L[1]then
|
||||
local id,dir=L[2],L[3]
|
||||
local bk=BLOCKS[id][dir]
|
||||
x,y=P.curX+L[4],P.curY+L[5]
|
||||
if
|
||||
not P:ifoverlap(bk,x,y)and(
|
||||
L[6]>0 or(P:ifoverlap(bk,x-1,y)and P:ifoverlap(bk,x+1,y))
|
||||
)and(
|
||||
L[6]==2 or(P:ifoverlap(bk,x,y-1)and P:ifoverlap(bk,x,y+1))
|
||||
)
|
||||
then
|
||||
local C=P.cur
|
||||
C.id=id
|
||||
C.bk=bk
|
||||
P.curX,P.curY=x,y
|
||||
P.cur.dir,P.cur.sc=dir,defaultCenterPos[id][dir]
|
||||
P.spinLast=2
|
||||
P.stat.rotate=P.stat.rotate+1
|
||||
P:freshBlock('move')
|
||||
P.spinSeq=0
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if P.sound then SFX.play('rotate',nil,P:getCenterX()*.15)end
|
||||
P.spinSeq=0
|
||||
end
|
||||
else
|
||||
if P.sound then SFX.play('rotate',nil,P:getCenterX()*.15)end
|
||||
end
|
||||
end,--O
|
||||
{
|
||||
[01]={'+0+1','+1+0','-2+0','-2-1','+1+2'},
|
||||
[10]={'+2+0','-1+0','-1-2','+2+1','+0+1'},
|
||||
[03]={'+0+1','-1+0','+2+0','+2-1','-1+2'},
|
||||
[30]={'-2+0','+1+0','+1-2','-2+1','+0+1'},
|
||||
[12]={'-1+0','+2+0','+2-1','+0-1','-1+2'},
|
||||
[21]={'-2+0','+1+0','+1-2','-2+1','+0+1'},
|
||||
[32]={'+1+0','-2+0','-2-1','+0-1','+1+2'},
|
||||
[23]={'+2+0','-1+0','-1-2','+2+1','+0+1'},
|
||||
[02]={'-1+0','+1+0','+0-1','+0+1'},
|
||||
[20]={'+1+0','-1+0','+0+1','+0-1'},
|
||||
[13]={'+0-1','-1+0','+1+0','+0+1'},
|
||||
[31]={'+0-1','+1+0','-1+0','+0+1'},
|
||||
},--I
|
||||
{
|
||||
[01]={'+0+1','+1+1','-1+0','+0-3','+0+2','+0-2','+0+3','-1+2'},
|
||||
[10]={'+0-1','-1-1','+1+0','+0-3','+0+2','+0-2','+0+3','+1-2'},
|
||||
[03]={'+1+0','+0-3','+0+1','+0+2','+0+3','+1+2'},
|
||||
[30]={'-1+0','+0+1','+0-2','+0-3','+0+3','-1-2'},
|
||||
},--Z5
|
||||
false,--S5
|
||||
{
|
||||
[01]={'-1+0','-1+1','+0-2','-1-2','-1-1','+0+1'},
|
||||
[10]={'+1+0','+1-1','+0+2','+1+2','+0-1','+1+1'},
|
||||
[03]={'+1+0','+1+1','+0-2','+1-2'},
|
||||
[30]={'-1+0','-1-1','+0+2','-1+2'},
|
||||
[12]={'+1+0','+1-1','+0+2','+1+2','+1+1'},
|
||||
[21]={'-1+0','-1-1','-1+1','+0-2','-1-2','-1-1'},
|
||||
[32]={'-1+0','-1-1','-1+1','+0-1','+0+2','-1+2'},
|
||||
[23]={'+1+0','+1+1','-1+0','+0-2','+1-2'},
|
||||
[02]={'-1+0','+0-1','+0+1'},
|
||||
[20]={'+1+0','+0+1','+0-1'},
|
||||
[13]={'+1+0','+0+1','-1+0'},
|
||||
[31]={'-1+0','+0-1','+1+0'},
|
||||
},--P
|
||||
false,--Q
|
||||
{
|
||||
[01]={'-1+0','+1+0','-1+1','+0-2','+0-3'},
|
||||
[10]={'+1+0','+1-1','-1+0','+0+2','+0+3'},
|
||||
[03]={'+1+0','+1-1','+0+1','+0-2','+0-3'},
|
||||
[30]={'-1+1','+1+0','+0-1','+0+2','+0+3'},
|
||||
[12]={'+1+0','+0-1','-1+0','+0+2'},
|
||||
[21]={'-1+0','+0+1','+1+0','+0-2'},
|
||||
[32]={'-1+0','+0+1','-1+1','+1+0','+0+2','-2+0'},
|
||||
[23]={'+1+0','+1-1','+0-1','-1+0','+0-2','+2+0'},
|
||||
[02]={'+1+0','-1+0','-1-1'},
|
||||
[20]={'-1+0','+1+0','+1+1'},
|
||||
[13]={'+0-1','-1+1','+0+1'},
|
||||
[31]={'+0-1','+1-1','+0+1'},
|
||||
},--F
|
||||
false,--E
|
||||
{
|
||||
[01]={'+0-1','-1-1','+1+0','+1+1','+0-3','-1+0','+0+2','-1+2'},
|
||||
[10]={'+1+0','+0-1','-1-1','+0-2','-1+1','+0-3','+1-2','+0+1'},
|
||||
[03]={'+0-1','+1-1','-1+0','-1+1','+0-3','+1+0','+0+2','+1+2'},
|
||||
[30]={'-1+0','+0-1','+1-1','+0-2','+1+1','+0-3','-1-2','+0+1'},
|
||||
[12]={'+1+0','-1+0','+0-2','+0-3','+0+1','-1+1'},
|
||||
[21]={'+1-1','-1+0','+1+0','+0-1','+0+2','+0+3'},
|
||||
[32]={'-1+0','+1+0','+0-2','+0-3','+0+1','+1+1'},
|
||||
[23]={'-1-1','+1+0','-1+0','+0-1','+0+2','+0+3'},
|
||||
[02]={'+0-1','+0+1','+0+2'},
|
||||
[20]={'+0-1','+0+1','+0-2'},
|
||||
[13]={'+1+0','-1+1','-2+0'},
|
||||
[31]={'-1+0','+1+1','+2+0'},
|
||||
},--T5
|
||||
{
|
||||
[01]={'-1+0','-1+1','+0-2','-1-2'},
|
||||
[10]={'+1+0','+1-1','+0+2','+1+2'},
|
||||
[03]={'+1+0','+1+1','+0-2','+1-2'},
|
||||
[30]={'-1+0','-1-1','+0-2','-1+2'},
|
||||
[12]={'+1+0','+1-1','+1+1'},
|
||||
[21]={'-1-1','-1+1','-1-1'},
|
||||
[32]={'-1+0','-1-1','-1+1'},
|
||||
[23]={'+1-1','+1+1','+1-1'},
|
||||
[02]={'+0+1'},
|
||||
[20]={'+0-1'},
|
||||
[13]={'+0-1','+0+1','+1+0'},
|
||||
[31]={'+0-1','+0+1','-1+0'},
|
||||
},--U
|
||||
{
|
||||
[01]={'+0+1','-1+0','+0-2','-1-2'},
|
||||
[10]={'+0+1','+1+0','+0-2','+1-2'},
|
||||
[03]={'+0-1','+0+1','+0+2'},
|
||||
[30]={'+0-1','+0+1','+0-2'},
|
||||
[12]={'+0-1','+0+1'},
|
||||
[21]={'+0-1','+0-2'},
|
||||
[32]={'+1+0','-1+0'},
|
||||
[23]={'-1+0','+1+0'},
|
||||
[02]={'-1+1','+1-1'},
|
||||
[20]={'+1-1','-1+1'},
|
||||
[13]={'+1+1','-1-1'},
|
||||
[31]={'-1-1','+1+1'},
|
||||
},--V
|
||||
{
|
||||
[01]={'+0-1','-1+0','+1+0','+1-1','+0+2'},
|
||||
[10]={'+0-1','-1-1','+0+1','+0-2','+1-2','+0+2'},
|
||||
[03]={'+1+0','+1+1','+0-1','+0-2','+0-3','+1-1','+0+1','+0+2','+0+3'},
|
||||
[30]={'-1+0','-1+1','+0-1','+0-2','+0-3','-1-1','+0+1','+0+2','+0+3'},
|
||||
[12]={'+1+0','+0-1','-2+0','+1+1','-1+0','+0+1','-1-1'},
|
||||
[21]={'-1+0','+0-1','+2+0','-1+1','+1+0','+0+1','+1-1'},
|
||||
[32]={'+0-1','+1+0','+0+1','-1+0','-1-1','+0+2'},
|
||||
[23]={'+0-1','+1-1','+0+1','+0-2','-1-2','+0+2'},
|
||||
[02]={'+0-1','-1+0'},
|
||||
[20]={'+0+1','+1+0'},
|
||||
[13]={'+0+1','-1+0'},
|
||||
[31]={'+0-1','+1+0'},
|
||||
},--W
|
||||
function(P,d)
|
||||
if P.type=='human'then SFX.play('rotate',nil,P:getCenterX()*.15)end
|
||||
local kickData=XspinList[d]
|
||||
for test=1,#kickData do
|
||||
local x,y=P.curX+kickData[test][1],P.curY+kickData[test][2]
|
||||
if not P:ifoverlap(P.cur.bk,x,y)then
|
||||
P.curX,P.curY=x,y
|
||||
P.spinLast=1
|
||||
P:freshBlock('move')
|
||||
P.stat.rotate=P.stat.rotate+1
|
||||
return
|
||||
end
|
||||
end
|
||||
P:freshBlock('fresh')
|
||||
end,--X
|
||||
{
|
||||
[01]={'-1+0','-1+1','+0-3','-1+1','-1+2','+0+1'},
|
||||
[10]={'-1+0','+1-1','+0+3','+1-1','+1-2','+0+1'},
|
||||
[03]={'+0-1','+1-1','-1+0','+1+1','+0-2','+1-2','+0-3','+1-3','-1+1'},
|
||||
[30]={'+0+1','-1+1','+1+0','-1-1','+0+2','-1+2','+0+3','-1+3','+1-1'},
|
||||
[12]={'+1+0','+1-1','+0-1','+1-2','+0-2','+1+1','-1+0','+0+2','+1+2'},
|
||||
[21]={'-1+0','-1+1','+0+1','-1+2','+0+2','-1-1','+1+0','+0-2','-1-2'},
|
||||
[32]={'-1+0','-1+1','-1-1','+1+0','+0+2','-1+2','+0-2'},
|
||||
[23]={'+1+0','+1-1','+1+1','-1+0','+0-2','+1-2','+0+2'},
|
||||
[02]={'+0-1','+1-1','-1+0','+2-1'},
|
||||
[20]={'+0+1','-1+1','+1+0','-2+1'},
|
||||
[13]={'-1+0','-1-1','+0+1','-1-2'},
|
||||
[31]={'+1+0','+1+1','+0-1','+1+2'},
|
||||
},--J5
|
||||
false,--L5
|
||||
{
|
||||
[01]={'-1+0','-1+0','-1+1','+1+0','-1+2','-1-1','+0-3','+0+1'},
|
||||
[10]={'-1+0','+1+0','+1-1','+1+0','+1-2','+1+1','+0+3','+0+1'},
|
||||
[03]={'+0-1','+0+1','+1+0','+1-1','-1+0','+1+1','+0-2','+1-2','+0-3','+1-3','-1+1'},
|
||||
[30]={'+0-1','+0+1','-1+0','-1+1','+1+0','-1-1','+0+2','-1+2','+0+3','-1+3','+1-1'},
|
||||
[12]={'+1+0','+1-1','+0-1','+1-2','+0-2','+1+1','-1+0','+0+2','+1+2'},
|
||||
[21]={'-1+0','-1+1','+0+1','-1+2','+0+2','-1-1','+1+0','+0-2','-1-2'},
|
||||
[32]={'+0-1','-1+0','-1+1','-1-1','+1+0','+0+2','-1+2','+0-2'},
|
||||
[23]={'+0+1','+1+0','+1-1','+1+1','-1+0','+0-2','+1-2','+0+2'},
|
||||
[02]={'+0-1','+1-1','-1+0','+2-1','+0+1'},
|
||||
[20]={'+0+1','-1+1','+1+0','-2+1','+0-1'},
|
||||
[13]={'-1+0','-1-1','+0+1','-1-2'},
|
||||
[31]={'+1+0','+1+1','+0-1','+1+2'},
|
||||
},--R
|
||||
false,--Y
|
||||
{
|
||||
[01]={'-1+0','-1+1','+0+1','+1+0','-1+2','-2+0','+0-2'},
|
||||
[10]={'+1+0','-1+0','+0-1','+1-1','+1-2','+2+0','+0+2'},
|
||||
[03]={'-1+0','+1-1','+0-2','+0-3','+1+0','+1-2','+1-3','+0+1','-1+1'},
|
||||
[30]={'-1+0','+1-1','+1-2','+1+0','+0-2','+1-3','-1+2','+0+3','-1+3'},
|
||||
[12]={'-1+0','+1-1','-1-1','+1-2','+1+0','+0-2','+1-3','-1+2','+0+3','-1+3'},
|
||||
[21]={'-1+0','+1-1','+1+1','+0-2','+0-3','+1+0','+1-2','+1-3','+0+1','-1+1'},
|
||||
[32]={'-1+0','+0-1','-1-2','+1-1','+1+0','+1+1','+0+2','+0+3'},
|
||||
[23]={'+0-2','+0-3','+1+2','+1+0','+0+1','-1+1','+0-1','+0+2'},
|
||||
[02]={'-1+0','+0+2','+0-1'},
|
||||
[20]={'+1+0','+0-2','+0+1'},
|
||||
[13]={'-1+0','-1-1','+0+1','+1+2'},
|
||||
[31]={'+1+0','+1+1','+0-1','-1-2'},
|
||||
},--N
|
||||
false,--H
|
||||
{
|
||||
[01]={'+1-1','+1+0','+1+1','+0+1','-1+1','-1+0','-1-1','+0-1','+0-2','-2-1','-2-2','+2+0','+2-1','+2-2','+1+2','+2+2','-1+2','-2+2'},
|
||||
[10]={'-1+0','-1-1','+0-1','+1-1','-2-2','-2-1','-2+0','-1-2','+0-2','+1-2','+2-2','-1+1','-2+1','-2+2','+1+0','+2+0','+2-1','+0+1','+1-1','+2-2'},
|
||||
[03]={'-1-1','-1+0','-1+1','-0+1','+1+1','+1+0','+1-1','-0-1','-0-2','+2-1','+2-2','-2+0','-2-1','-2-2','-1+2','-2+2','+1+2','+2+2'},
|
||||
[30]={'+1+0','+1-1','-0-1','-1-1','+2-2','+2-1','+2+0','+1-2','-0-2','-1-2','-2-2','+1+1','+2+1','+2+2','-1+0','-2+0','-2-1','+0+1','-1-1','-2-2'},
|
||||
},--I5
|
||||
{
|
||||
[01]={'-1+0','-1-1','+1+1','-1+1'},
|
||||
[10]={'-1+0','+1+0','-1-1','+1+1'},
|
||||
[03]={'+1+0','+1-1','-1+1','+1+1'},
|
||||
[30]={'+1+0','-1+0','+1-1','-1+1'},
|
||||
},--I3
|
||||
{
|
||||
[01]={'-1+0','+1+0'},
|
||||
[10]={'+1+0','-1+0'},
|
||||
[03]={'+0+1','+0-1'},
|
||||
[30]={'+0-1','+0+1'},
|
||||
[12]={'+0+1','+0-1'},
|
||||
[21]={'+0-1','+0+1'},
|
||||
[32]={'-1+0','+1+0'},
|
||||
[23]={'+1+0','-1+0'},
|
||||
[02]={'+0-1','+1-1','-1-1'},
|
||||
[20]={'+0+1','-1+1','+1+1'},
|
||||
[13]={'+0-1','-1-1','+1-1'},
|
||||
[31]={'+0+1','+1+1','-1+1'},
|
||||
},--C
|
||||
{
|
||||
[01]={'-1+0','+0+1'},
|
||||
[10]={'+1+0','+0+1'},
|
||||
[03]={'+1+0','+0+1'},
|
||||
[30]={'-1+0','+0+1'},
|
||||
[12]={'+1+0','+0+2'},
|
||||
[21]={'+0-1','-1+0'},
|
||||
[32]={'-1+0','+0+2'},
|
||||
[23]={'+0-1','-1+0'},
|
||||
[02]={'+0-1','+0+1'},
|
||||
[20]={'+0+1','+0-1'},
|
||||
[13]={'-1+0','+1+0'},
|
||||
[31]={'+1+0','-1+0'},
|
||||
},--I2
|
||||
nil,--O1
|
||||
}
|
||||
}
|
||||
TRS.centerDisp[6]=false
|
||||
TRS.centerDisp[18]=false
|
||||
TRS.kickTable[2]= reflect(TRS.kickTable[1])--SZ
|
||||
TRS.kickTable[4]= reflect(TRS.kickTable[3])--LJ
|
||||
TRS.kickTable[9]= reflect(TRS.kickTable[8])--S5Z5
|
||||
TRS.kickTable[11]=reflect(TRS.kickTable[10])--PQ
|
||||
TRS.kickTable[13]=reflect(TRS.kickTable[12])--FE
|
||||
TRS.kickTable[20]=reflect(TRS.kickTable[19])--L5J5
|
||||
TRS.kickTable[22]=reflect(TRS.kickTable[21])--RY
|
||||
TRS.kickTable[24]=reflect(TRS.kickTable[23])--NH
|
||||
centroSymSet(TRS.kickTable[8])centroSymSet(TRS.kickTable[9])--S5Z5
|
||||
centroSymSet(TRS.kickTable[25])centroSymSet(TRS.kickTable[26])--I5I3
|
||||
pushZero(TRS.kickTable)
|
||||
end
|
||||
|
||||
local SRS
|
||||
do
|
||||
SRS={
|
||||
kickTable={
|
||||
{
|
||||
[01]={'-1+0','-1+1','+0-2','-1-2'},
|
||||
[10]={'+1+0','+1-1','+0+2','+1+2'},
|
||||
[03]={'+1+0','+1+1','+0-2','+1-2'},
|
||||
[30]={'-1+0','-1-1','+0+2','-1+2'},
|
||||
[12]={'+1+0','+1-1','+0+2','+1+2'},
|
||||
[21]={'-1+0','-1+1','+0-2','-1-2'},
|
||||
[32]={'-1+0','-1-1','+0+2','-1+2'},
|
||||
[23]={'+1+0','+1+1','+0-2','+1-2'},
|
||||
[02]={},[20]={},[13]={},[31]={},
|
||||
},--Z
|
||||
false,--S
|
||||
false,--J
|
||||
false,--L
|
||||
false,--T
|
||||
noKickSet,--O
|
||||
{
|
||||
[01]={'-2+0','+1+0','-2-1','+1+2'},
|
||||
[10]={'+2+0','-1+0','+2+1','-1-2'},
|
||||
[12]={'-1+0','+2+0','-1+2','+2-1'},
|
||||
[21]={'+1+0','-2+0','+1-2','-2+1'},
|
||||
[23]={'+2+0','-1+0','+2+1','-1-2'},
|
||||
[32]={'-2+0','+1+0','-2-1','+1+2'},
|
||||
[30]={'+1+0','-2+0','+1-2','-2+1'},
|
||||
[03]={'-1+0','+2+0','-1+2','+2-1'},
|
||||
[02]={},[20]={},[13]={},[31]={},
|
||||
}--I
|
||||
}
|
||||
}
|
||||
pushZero(SRS.kickTable)
|
||||
for i=2,5 do SRS.kickTable[i]=SRS.kickTable[1]end
|
||||
for i=8,29 do SRS.kickTable[i]=SRS.kickTable[1]end
|
||||
end
|
||||
|
||||
local BiRS
|
||||
do
|
||||
local R={'+0+0','-1+0','-1-1','+0-1','-1+1','+1-1','+1+0','+0+1','+1+1','+0+2','-1+2','+1+2','-2+0','+2+0'}
|
||||
local L={'+0+0','+1+0','+1-1','+0-1','+1+1','-1-1','-1+0','+0+1','-1+1','+0+2','+1+2','-1+2','+2+0','-2+0'}
|
||||
local F={'+0+0','+0-1','+0+1','+0+2'}
|
||||
local list={
|
||||
{[02]=L,[20]=R,[13]=R,[31]=L},--Z
|
||||
{[02]=R,[20]=L,[13]=L,[31]=R},--S
|
||||
{[02]=L,[20]=R,[13]=L,[31]=R},--J
|
||||
{[02]=R,[20]=L,[13]=L,[31]=R},--L
|
||||
{[02]=F,[20]=F,[13]=L,[31]=R},--T
|
||||
{[02]=F,[20]=F,[13]=F,[31]=F},--O
|
||||
{[02]=F,[20]=F,[13]=R,[31]=L},--I
|
||||
|
||||
{[02]=L,[20]=L,[13]=R,[31]=R},--Z5
|
||||
{[02]=R,[20]=R,[13]=L,[31]=L},--S5
|
||||
{[02]=L,[20]=R,[13]=L,[31]=R},--P
|
||||
{[02]=R,[20]=L,[13]=R,[31]=L},--Q
|
||||
{[02]=R,[20]=L,[13]=L,[31]=R},--F
|
||||
{[02]=L,[20]=R,[13]=R,[31]=L},--E
|
||||
{[02]=F,[20]=F,[13]=L,[31]=R},--T5
|
||||
{[02]=F,[20]=F,[13]=L,[31]=R},--U
|
||||
{[02]=R,[20]=L,[13]=L,[31]=R},--V
|
||||
{[02]=R,[20]=L,[13]=L,[31]=R},--W
|
||||
{[02]=F,[20]=F,[13]=F,[31]=F},--X
|
||||
{[02]=L,[20]=R,[13]=R,[31]=L},--J5
|
||||
{[02]=R,[20]=L,[13]=L,[31]=R},--L5
|
||||
{[02]=L,[20]=R,[13]=R,[31]=L},--R
|
||||
{[02]=R,[20]=L,[13]=L,[31]=R},--Y
|
||||
{[02]=L,[20]=R,[13]=R,[31]=L},--N
|
||||
{[02]=R,[20]=L,[13]=L,[31]=R},--H
|
||||
{[02]=F,[20]=F,[13]=F,[31]=F},--I5
|
||||
|
||||
{[02]=F,[20]=F,[13]=F,[31]=F},--I3
|
||||
{[02]=R,[20]=L,[13]=L,[31]=R},--C
|
||||
{[02]=F,[20]=F,[13]=R,[31]=L},--I2
|
||||
{[02]=F,[20]=F,[13]=F,[31]=F},--O1
|
||||
}
|
||||
for i=1,29 do
|
||||
local a,b=R,L
|
||||
if i==6 or i==18 then a,b=b,a end
|
||||
list[i][01]=a;list[i][10]=b;list[i][03]=b;list[i][30]=a
|
||||
list[i][12]=a;list[i][21]=b;list[i][32]=b;list[i][23]=a
|
||||
end
|
||||
BiRS={}
|
||||
BiRS.kickTable=TABLE.new(function(P,d,ifpre)
|
||||
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=defaultCenterPos[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(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
|
||||
local fdx,fdy=kickList[test][1]+dx,kickList[test][2]+dy
|
||||
if
|
||||
dx*fdx>=0 and
|
||||
fdx^2+fdy^2<=5 and
|
||||
(P.freshTime>0 or fdy<=0)
|
||||
then
|
||||
local x,y=ix+fdx,iy+fdy
|
||||
if not P:ifoverlap(icb,x,y)then
|
||||
if P.gameEnv.moveFX and P.gameEnv.block then
|
||||
P:createMoveFX()
|
||||
end
|
||||
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
|
||||
if not ifpre then
|
||||
P:freshBlock('move')
|
||||
end
|
||||
if fdy>0 and P.freshTime==t and P.curY~=P.imgY then
|
||||
P.freshTime=P.freshTime-1
|
||||
end
|
||||
|
||||
if P.sound then
|
||||
local sfx
|
||||
if ifpre then
|
||||
sfx='prerotate'
|
||||
elseif P:ifoverlap(icb,x,y+1)and P:ifoverlap(icb,x-1,y)and P:ifoverlap(icb,x+1,y)then
|
||||
sfx='rotatekick'
|
||||
if P.gameEnv.shakeFX then
|
||||
if d==1 or d==3 then
|
||||
P.fieldOff.va=P.fieldOff.va+(2-d)*P.gameEnv.shakeFX*6e-3
|
||||
else
|
||||
P.fieldOff.va=P.fieldOff.va+P:getCenterX()*P.gameEnv.shakeFX*3e-3
|
||||
end
|
||||
end
|
||||
else
|
||||
sfx='rotate'
|
||||
end
|
||||
SFX.play(sfx,nil,P:getCenterX()*.15)
|
||||
end
|
||||
P.stat.rotate=P.stat.rotate+1
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Try release left/right, then softdrop, failed to rotate otherwise
|
||||
if dx~=0 then
|
||||
dx=0
|
||||
elseif dy~=0 then
|
||||
dy=0
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
end,29)
|
||||
end
|
||||
|
||||
local ASC
|
||||
do
|
||||
local L={'+0+0','+1+0','+0-1','+1-1','+0-2','+1-2','+2+0','+2-1','+2-2','-1+0','-1-1','+0+1','+1+1','+2+1','-1-2','-2+0','+0+2','+1+2','+2+2','-2-1','-2-2'}
|
||||
local R=flipList(L)
|
||||
local F={'+0+0'}
|
||||
local centerPos=TABLE.shift(defaultCenterPos,0)
|
||||
centerPos[6]={[0]={0,0},{1,0},{1,1},{0,1}}
|
||||
centerPos[7]={[0]={0,1},{2,0},{0,2},{1,0}}
|
||||
ASC={
|
||||
centerPos=centerPos,
|
||||
kickTable=TABLE.new({
|
||||
[01]=R,[10]=L,[03]=L,[30]=R,
|
||||
[12]=R,[21]=L,[32]=L,[23]=R,
|
||||
[02]=F,[20]=F,[13]=F,[31]=F,
|
||||
},29)
|
||||
}
|
||||
end
|
||||
|
||||
local ASC_plus
|
||||
do
|
||||
local L={'+0+0','+1+0','+0-1','+1-1','+0-2','+1-2','+2+0','+2-1','+2-2','-1+0','-1-1','+0+1','+1+1','+2+1','-1-2','-2+0','+0+2','+1+2','+2+2','-2-1','-2-2'}
|
||||
local R=flipList(L)
|
||||
local F={'+0+0','-1+0','+1+0','+0-1','-1-1','+1-1','+0-2','-1-2','+1-2','-2+0','+2+0','-2-1','+2-1','-2+1','+2+1','+0+2','-1+2','+1+2'}
|
||||
local centerPos=TABLE.shift(defaultCenterPos,0)
|
||||
centerPos[6]={[0]={0,0},{1,0},{1,1},{0,1}}
|
||||
centerPos[7]={[0]={0,1},{2,0},{0,2},{1,0}}
|
||||
ASC_plus={
|
||||
centerPos=centerPos,
|
||||
kickTable=TABLE.new({
|
||||
[01]=R,[12]=R,[23]=R,[30]=R,
|
||||
[10]=L,[21]=L,[32]=L,[03]=L,
|
||||
[02]=F,[20]=F,[13]=F,[31]=F,
|
||||
},29)
|
||||
}
|
||||
end
|
||||
|
||||
local C2
|
||||
do
|
||||
local L={'+0+0','-1+0','+1+0','+0-1','-1-1','+1-1','-2+0','+2+0'}
|
||||
C2={
|
||||
kickTable=TABLE.new({
|
||||
[01]=L,[10]=L,[12]=L,[21]=L,
|
||||
[23]=L,[32]=L,[30]=L,[03]=L,
|
||||
[02]=L,[20]=L,[13]=L,[31]=L,
|
||||
},29)
|
||||
}
|
||||
end
|
||||
|
||||
local C2_sym
|
||||
do
|
||||
local L={'+0+0','-1+0','+1+0','+0-1','-1-1','+1-1','-2+0','+2+0'}
|
||||
local R={'+0+0','+1+0','-1+0','+0-1','+1-1','-1-1','+2+0','-2+0'}
|
||||
|
||||
local Z={
|
||||
[01]=R,[10]=L,[03]=L,[30]=R,
|
||||
[12]=R,[21]=L,[32]=L,[23]=R,
|
||||
[02]=R,[20]=L,[13]=L,[31]=R,
|
||||
}
|
||||
local S=reflect(Z)
|
||||
|
||||
C2_sym={
|
||||
kickTable={
|
||||
Z,S,--Z,S
|
||||
Z,S,--J,L
|
||||
Z,--T
|
||||
noKickSet,--O
|
||||
Z,--I
|
||||
|
||||
Z,S,--Z5,S5
|
||||
Z,S,--P,Q
|
||||
Z,S,--F,E
|
||||
Z,Z,Z,Z,--T5,U,V,W
|
||||
noKickSet,--X
|
||||
Z,S,--J5,L5
|
||||
Z,S,--R,Y
|
||||
Z,S,--N,H
|
||||
Z,--I5
|
||||
|
||||
Z,Z,--I3,C
|
||||
Z,Z,--I2,O1
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
local None={kickTable=TABLE.new(noKickSet_180,29)}
|
||||
|
||||
local None_plus={kickTable=TABLE.new(noKickSet,29)}
|
||||
|
||||
local RSlist={
|
||||
TRS=TRS,
|
||||
SRS=SRS,
|
||||
BiRS=BiRS,
|
||||
ASC=ASC,
|
||||
ASC_plus=ASC_plus,
|
||||
C2=C2,
|
||||
C2_sym=C2_sym,
|
||||
None=None,
|
||||
None_plus=None_plus,
|
||||
}
|
||||
|
||||
for _,rs in next,RSlist do
|
||||
if not rs.centerDisp then rs.centerDisp=TABLE.new(true,29)end
|
||||
if not rs.centerPos then rs.centerPos=defaultCenterPos end
|
||||
|
||||
--Make all string vec to the same table vec
|
||||
for _,set in next,rs.kickTable do
|
||||
if type(set)=='table'then
|
||||
for _,list in next,set do
|
||||
if type(list[1])=='string'then
|
||||
for i,vecStr in next,list do
|
||||
list[i]=map[tonumber(vecStr:sub(1,2))][tonumber(vecStr:sub(3,4))]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return RSlist
|
||||
@@ -10,7 +10,7 @@ local scs
|
||||
function back.init()
|
||||
colorLib=minoColor
|
||||
blocks=BLOCKS
|
||||
scs=SCS
|
||||
scs=DSCP
|
||||
t=rnd()*2600
|
||||
end
|
||||
function back.update(dt)
|
||||
|
||||
@@ -1,671 +0,0 @@
|
||||
local map={}for x=-4,4 do map[x]={}for y=-4,4 do map[x][y]={x,y}end end
|
||||
|
||||
local noKickSet,noKickSet_180,pushZero do
|
||||
local Zero={map[0][0]}
|
||||
noKickSet={[01]=Zero,[10]=Zero,[03]=Zero,[30]=Zero,[12]=Zero,[21]=Zero,[32]=Zero,[23]=Zero}
|
||||
noKickSet_180={[01]=Zero,[10]=Zero,[03]=Zero,[30]=Zero,[12]=Zero,[21]=Zero,[32]=Zero,[23]=Zero,[02]=Zero,[20]=Zero,[13]=Zero,[31]=Zero}
|
||||
function pushZero(t)
|
||||
for id,set in next,t do
|
||||
if type(id)=='number'and type(set)=='table'then
|
||||
for _,R in next,set do
|
||||
if not R[1]or R[1][1]~=0 or R[1][2]~=0 then
|
||||
table.insert(R,1,map[0][0])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Convert vector string to table
|
||||
local function vecStrConv(list)
|
||||
for k,vecStr in next,list do
|
||||
list[k]=map[tonumber(vecStr:sub(1,2))][tonumber(vecStr:sub(3,4))]
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
--Make all vec point to the same vec
|
||||
local function collectSet(set)
|
||||
if type(set)~='table'then return end
|
||||
for _,list in next,set do
|
||||
if type(list[1])=='string'then
|
||||
vecStrConv(list)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Use this if the block is centrosymmetry, *PTR!!!
|
||||
local function centroSymSet(L)
|
||||
L[23]=L[01]L[32]=L[10]
|
||||
L[21]=L[03]L[12]=L[30]
|
||||
L[20]=L[02]L[31]=L[13]
|
||||
end
|
||||
|
||||
--Use this to copy a symmetry set
|
||||
local function flipList(O)
|
||||
if not O then return end
|
||||
local L={}
|
||||
for i,s in next,O do
|
||||
L[i]=string.char(88-s:byte())..s:sub(2)
|
||||
end
|
||||
return L
|
||||
end
|
||||
|
||||
local function reflect(a)
|
||||
return{
|
||||
[03]=flipList(a[01]),
|
||||
[01]=flipList(a[03]),
|
||||
[30]=flipList(a[10]),
|
||||
[32]=flipList(a[12]),
|
||||
[23]=flipList(a[21]),
|
||||
[21]=flipList(a[23]),
|
||||
[10]=flipList(a[30]),
|
||||
[12]=flipList(a[32]),
|
||||
[02]=flipList(a[02]),
|
||||
[20]=flipList(a[20]),
|
||||
[31]=flipList(a[13]),
|
||||
[13]=flipList(a[31]),
|
||||
}
|
||||
end
|
||||
|
||||
local TRS
|
||||
do
|
||||
local OspinList={
|
||||
{111,5,2, 0,-1,0},{111,5,2,-1,-1,0},{111,5,0,-1, 0,0},--T
|
||||
{333,5,2,-1,-1,0},{333,5,2, 0,-1,0},{333,5,0, 0, 0,0},--T
|
||||
{313,1,2,-1, 0,0},{313,1,2, 0,-1,0},{313,1,2, 0, 0,0},--Z
|
||||
{131,2,2, 0, 0,0},{131,2,2,-1,-1,0},{131,2,2,-1, 0,0},--S
|
||||
{131,1,2,-1, 0,0},{131,1,2, 0,-1,0},{131,1,2, 0, 0,0},--Z(misOrder)
|
||||
{313,2,2, 0, 0,0},{313,2,2,-1,-1,0},{313,2,2,-1, 0,0},--S(misOrder)
|
||||
{331,3,2, 0,-1,0},--J(farDown)
|
||||
{113,4,2,-1,-1,0},--L(farDown)
|
||||
{113,3,2,-1,-1,0},{113,3,0, 0, 0,0},--J
|
||||
{331,4,2, 0,-1,0},{331,4,0,-1, 0,0},--L
|
||||
{222,7,2,-1, 0,2},{222,7,2,-2, 0,2},{222,7,2, 0, 0,2},--I
|
||||
{222,7,0,-1, 1,1},{222,7,0,-2, 1,1},{222,7,0, 0, 1,1},--I(high)
|
||||
{121,6,0, 1,-1,2},{112,6,0, 2,-1,2},{122,6,0, 1,-2,2},--O
|
||||
{323,6,0,-1,-1,2},{332,6,0,-2,-1,2},{322,6,0,-1,-2,2},--O
|
||||
}--{keys, ID, dir, dx, dy, freeLevel (0=immovable, 1=U/D-immovable, 2=free)}
|
||||
local XspinList={
|
||||
{{ 1,-1},{ 1, 0},{ 1, 1},{ 1,-2},{ 1, 2}},
|
||||
{{ 0,-1},{ 0,-2},{ 0, 1},{ 0,-2},{ 0, 2}},
|
||||
{{-1,-1},{-1, 0},{-1, 1},{-1,-2},{-1, 2}},
|
||||
}
|
||||
TRS={
|
||||
centerDisp=TABLE.new(true,29),
|
||||
{
|
||||
[01]={'-1+0','-1+1','+0-2','-1+2','+0+1'},
|
||||
[10]={'+1+0','+1-1','+0+2','+1-2','+1-2'},
|
||||
[03]={'+1+0','+1+1','+0-2','+1-1','+1-2'},
|
||||
[30]={'-1+0','-1-1','+0+2','-1+2','+0-1'},
|
||||
[12]={'+1+0','+1-1','+0+2','+1+2'},
|
||||
[21]={'-1+0','-1+1','+0-2','-1-2'},
|
||||
[32]={'-1+0','-1-1','+0+2','-1+2'},
|
||||
[23]={'+1+0','+1+1','+0-2','+1-2'},
|
||||
[02]={'+1+0','-1+0','+0-1','+0+1'},
|
||||
[20]={'-1+0','+1+0','+0+1','+0-1'},
|
||||
[13]={'+0-1','+0+1','+0-2'},
|
||||
[31]={'+0+1','+0-1','+0+2'},
|
||||
},--Z
|
||||
false,--S
|
||||
{
|
||||
[01]={'-1+0','-1+1','+1+0','+0-2','+1+1'},
|
||||
[10]={'+1+0','+1-1','-1+0','+0+2','+1+2'},
|
||||
[03]={'+1+0','+1+1','+0-2','+1-2','+1-1','+0+1'},
|
||||
[30]={'-1+0','-1-1','+0+2','-1+2','+0-1','-1+1'},
|
||||
[12]={'+1+0','+1-1','+1+1','-1+0','+0-1','+0+2','+1+2'},
|
||||
[21]={'-1+0','-1+1','-1-1','+1+0','+0+1','+0-2','-1-2'},
|
||||
[32]={'-1+0','-1-1','+1+0','+0+2','-1+2','-1+1'},
|
||||
[23]={'+1+0','+1-1','-1+0','+1+1','+0-2','+1-2'},
|
||||
[02]={'-1+0','+1+0','+0-1','+0+1'},
|
||||
[20]={'+1+0','-1+0','+0+1','+0-1'},
|
||||
[13]={'+0-1','+0+1','+1+0'},
|
||||
[31]={'+0+1','+0-1','-1+0'},
|
||||
},--J
|
||||
false,--L
|
||||
{
|
||||
[01]={'-1+0','-1+1','+0-2','-1-2','+0+1'},
|
||||
[10]={'+1+0','+1-1','+0+2','+1+2','+0-1'},
|
||||
[03]={'+1+0','+1+1','+0-2','+1-2','+0+1'},
|
||||
[30]={'-1+0','-1-1','+0+2','-1+2','+0-1'},
|
||||
[12]={'+1+0','+1-1','+0-1','-1-1','+0+2','+1+2','+1+1'},
|
||||
[21]={'-1+0','+0-2','-1-2','-1-1','+1+1'},
|
||||
[32]={'-1+0','-1-1','+0-1','+1-1','+0+2','-1+2','-1+1'},
|
||||
[23]={'+1+0','+0-2','+1-2','+1-1','-1+1'},
|
||||
[02]={'-1+0','+1+0','+0+1'},
|
||||
[20]={'+1+0','-1+0','+0-1'},
|
||||
[13]={'+0-1','+0+1','+1+0','+0-2','+0+2'},
|
||||
[31]={'+0-1','+0+1','-1+0','+0-2','+0+2'},
|
||||
},--T
|
||||
function(P,d)
|
||||
if P.gameEnv.easyFresh then
|
||||
P:freshBlock('fresh')
|
||||
end
|
||||
if P.gameEnv.ospin then
|
||||
local x,y=P.curX,P.curY
|
||||
if y==P.ghoY and((P:solid(x-1,y)or P:solid(x-1,y+1)))and(P:solid(x+2,y)or P:solid(x+2,y+1))then
|
||||
if P.sound then SFX.play('rotatekick',nil,P:getCenterX()*.15)end
|
||||
P.spinSeq=P.spinSeq%100*10+d
|
||||
if P.spinSeq<100 then return end
|
||||
for i=1,#OspinList do
|
||||
local L=OspinList[i]
|
||||
if P.spinSeq==L[1]then
|
||||
local id,dir=L[2],L[3]
|
||||
local bk=BLOCKS[id][dir]
|
||||
x,y=P.curX+L[4],P.curY+L[5]
|
||||
if
|
||||
not P:ifoverlap(bk,x,y)and(
|
||||
L[6]>0 or(P:ifoverlap(bk,x-1,y)and P:ifoverlap(bk,x+1,y))
|
||||
)and(
|
||||
L[6]==2 or(P:ifoverlap(bk,x,y-1)and P:ifoverlap(bk,x,y+1))
|
||||
)
|
||||
then
|
||||
local C=P.cur
|
||||
C.id=id
|
||||
C.bk=bk
|
||||
P.curX,P.curY=x,y
|
||||
P.cur.dir,P.cur.sc=dir,SCS[id][dir]
|
||||
P.spinLast=2
|
||||
P.stat.rotate=P.stat.rotate+1
|
||||
P:freshBlock('move')
|
||||
P.spinSeq=0
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if P.sound then SFX.play('rotate',nil,P:getCenterX()*.15)end
|
||||
P.spinSeq=0
|
||||
end
|
||||
else
|
||||
if P.sound then SFX.play('rotate',nil,P:getCenterX()*.15)end
|
||||
end
|
||||
end,--O
|
||||
{
|
||||
[01]={'+0+1','+1+0','-2+0','-2-1','+1+2'},
|
||||
[10]={'+2+0','-1+0','-1-2','+2+1','+0+1'},
|
||||
[03]={'+0+1','-1+0','+2+0','+2-1','-1+2'},
|
||||
[30]={'-2+0','+1+0','+1-2','-2+1','+0+1'},
|
||||
[12]={'-1+0','+2+0','+2-1','+0-1','-1+2'},
|
||||
[21]={'-2+0','+1+0','+1-2','-2+1','+0+1'},
|
||||
[32]={'+1+0','-2+0','-2-1','+0-1','+1+2'},
|
||||
[23]={'+2+0','-1+0','-1-2','+2+1','+0+1'},
|
||||
[02]={'-1+0','+1+0','+0-1','+0+1'},
|
||||
[20]={'+1+0','-1+0','+0+1','+0-1'},
|
||||
[13]={'+0-1','-1+0','+1+0','+0+1'},
|
||||
[31]={'+0-1','+1+0','-1+0','+0+1'},
|
||||
},--I
|
||||
{
|
||||
[01]={'+0+1','+1+1','-1+0','+0-3','+0+2','+0-2','+0+3','-1+2'},
|
||||
[10]={'+0-1','-1-1','+1+0','+0-3','+0+2','+0-2','+0+3','+1-2'},
|
||||
[03]={'+1+0','+0-3','+0+1','+0+2','+0+3','+1+2'},
|
||||
[30]={'-1+0','+0+1','+0-2','+0-3','+0+3','-1-2'},
|
||||
},--Z5
|
||||
false,--S5
|
||||
{
|
||||
[01]={'-1+0','-1+1','+0-2','-1-2','-1-1','+0+1'},
|
||||
[10]={'+1+0','+1-1','+0+2','+1+2','+0-1','+1+1'},
|
||||
[03]={'+1+0','+1+1','+0-2','+1-2'},
|
||||
[30]={'-1+0','-1-1','+0+2','-1+2'},
|
||||
[12]={'+1+0','+1-1','+0+2','+1+2','+1+1'},
|
||||
[21]={'-1+0','-1-1','-1+1','+0-2','-1-2','-1-1'},
|
||||
[32]={'-1+0','-1-1','-1+1','+0-1','+0+2','-1+2'},
|
||||
[23]={'+1+0','+1+1','-1+0','+0-2','+1-2'},
|
||||
[02]={'-1+0','+0-1','+0+1'},
|
||||
[20]={'+1+0','+0+1','+0-1'},
|
||||
[13]={'+1+0','+0+1','-1+0'},
|
||||
[31]={'-1+0','+0-1','+1+0'},
|
||||
},--P
|
||||
false,--Q
|
||||
{
|
||||
[01]={'-1+0','+1+0','-1+1','+0-2','+0-3'},
|
||||
[10]={'+1+0','+1-1','-1+0','+0+2','+0+3'},
|
||||
[03]={'+1+0','+1-1','+0+1','+0-2','+0-3'},
|
||||
[30]={'-1+1','+1+0','+0-1','+0+2','+0+3'},
|
||||
[12]={'+1+0','+0-1','-1+0','+0+2'},
|
||||
[21]={'-1+0','+0+1','+1+0','+0-2'},
|
||||
[32]={'-1+0','+0+1','-1+1','+1+0','+0+2','-2+0'},
|
||||
[23]={'+1+0','+1-1','+0-1','-1+0','+0-2','+2+0'},
|
||||
[02]={'+1+0','-1+0','-1-1'},
|
||||
[20]={'-1+0','+1+0','+1+1'},
|
||||
[13]={'+0-1','-1+1','+0+1'},
|
||||
[31]={'+0-1','+1-1','+0+1'},
|
||||
},--F
|
||||
false,--E
|
||||
{
|
||||
[01]={'+0-1','-1-1','+1+0','+1+1','+0-3','-1+0','+0+2','-1+2'},
|
||||
[10]={'+1+0','+0-1','-1-1','+0-2','-1+1','+0-3','+1-2','+0+1'},
|
||||
[03]={'+0-1','+1-1','-1+0','-1+1','+0-3','+1+0','+0+2','+1+2'},
|
||||
[30]={'-1+0','+0-1','+1-1','+0-2','+1+1','+0-3','-1-2','+0+1'},
|
||||
[12]={'+1+0','-1+0','+0-2','+0-3','+0+1','-1+1'},
|
||||
[21]={'+1-1','-1+0','+1+0','+0-1','+0+2','+0+3'},
|
||||
[32]={'-1+0','+1+0','+0-2','+0-3','+0+1','+1+1'},
|
||||
[23]={'-1-1','+1+0','-1+0','+0-1','+0+2','+0+3'},
|
||||
[02]={'+0-1','+0+1','+0+2'},
|
||||
[20]={'+0-1','+0+1','+0-2'},
|
||||
[13]={'+1+0','-1+1','-2+0'},
|
||||
[31]={'-1+0','+1+1','+2+0'},
|
||||
},--T5
|
||||
{
|
||||
[01]={'-1+0','-1+1','+0-2','-1-2'},
|
||||
[10]={'+1+0','+1-1','+0+2','+1+2'},
|
||||
[03]={'+1+0','+1+1','+0-2','+1-2'},
|
||||
[30]={'-1+0','-1-1','+0-2','-1+2'},
|
||||
[12]={'+1+0','+1-1','+1+1'},
|
||||
[21]={'-1-1','-1+1','-1-1'},
|
||||
[32]={'-1+0','-1-1','-1+1'},
|
||||
[23]={'+1-1','+1+1','+1-1'},
|
||||
[02]={'+0+1'},
|
||||
[20]={'+0-1'},
|
||||
[13]={'+0-1','+0+1','+1+0'},
|
||||
[31]={'+0-1','+0+1','-1+0'},
|
||||
},--U
|
||||
{
|
||||
[01]={'+0+1','-1+0','+0-2','-1-2'},
|
||||
[10]={'+0+1','+1+0','+0-2','+1-2'},
|
||||
[03]={'+0-1','+0+1','+0+2'},
|
||||
[30]={'+0-1','+0+1','+0-2'},
|
||||
[12]={'+0-1','+0+1'},
|
||||
[21]={'+0-1','+0-2'},
|
||||
[32]={'+1+0','-1+0'},
|
||||
[23]={'-1+0','+1+0'},
|
||||
[02]={'-1+1','+1-1'},
|
||||
[20]={'+1-1','-1+1'},
|
||||
[13]={'+1+1','-1-1'},
|
||||
[31]={'-1-1','+1+1'},
|
||||
},--V
|
||||
{
|
||||
[01]={'+0-1','-1+0','+1+0','+1-1','+0+2'},
|
||||
[10]={'+0-1','-1-1','+0+1','+0-2','+1-2','+0+2'},
|
||||
[03]={'+1+0','+1+1','+0-1','+0-2','+0-3','+1-1','+0+1','+0+2','+0+3'},
|
||||
[30]={'-1+0','-1+1','+0-1','+0-2','+0-3','-1-1','+0+1','+0+2','+0+3'},
|
||||
[12]={'+1+0','+0-1','-2+0','+1+1','-1+0','+0+1','-1-1'},
|
||||
[21]={'-1+0','+0-1','+2+0','-1+1','+1+0','+0+1','+1-1'},
|
||||
[32]={'+0-1','+1+0','+0+1','-1+0','-1-1','+0+2'},
|
||||
[23]={'+0-1','+1-1','+0+1','+0-2','-1-2','+0+2'},
|
||||
[02]={'+0-1','-1+0'},
|
||||
[20]={'+0+1','+1+0'},
|
||||
[13]={'+0+1','-1+0'},
|
||||
[31]={'+0-1','+1+0'},
|
||||
},--W
|
||||
function(P,d)
|
||||
if P.type=='human'then SFX.play('rotate',nil,P:getCenterX()*.15)end
|
||||
local kickData=XspinList[d]
|
||||
for test=1,#kickData do
|
||||
local x,y=P.curX+kickData[test][1],P.curY+kickData[test][2]
|
||||
if not P:ifoverlap(P.cur.bk,x,y)then
|
||||
P.curX,P.curY=x,y
|
||||
P.spinLast=1
|
||||
P:freshBlock('move')
|
||||
P.stat.rotate=P.stat.rotate+1
|
||||
return
|
||||
end
|
||||
end
|
||||
P:freshBlock('fresh')
|
||||
end,--X
|
||||
{
|
||||
[01]={'-1+0','-1+1','+0-3','-1+1','-1+2','+0+1'},
|
||||
[10]={'-1+0','+1-1','+0+3','+1-1','+1-2','+0+1'},
|
||||
[03]={'+0-1','+1-1','-1+0','+1+1','+0-2','+1-2','+0-3','+1-3','-1+1'},
|
||||
[30]={'+0+1','-1+1','+1+0','-1-1','+0+2','-1+2','+0+3','-1+3','+1-1'},
|
||||
[12]={'+1+0','+1-1','+0-1','+1-2','+0-2','+1+1','-1+0','+0+2','+1+2'},
|
||||
[21]={'-1+0','-1+1','+0+1','-1+2','+0+2','-1-1','+1+0','+0-2','-1-2'},
|
||||
[32]={'-1+0','-1+1','-1-1','+1+0','+0+2','-1+2','+0-2'},
|
||||
[23]={'+1+0','+1-1','+1+1','-1+0','+0-2','+1-2','+0+2'},
|
||||
[02]={'+0-1','+1-1','-1+0','+2-1'},
|
||||
[20]={'+0+1','-1+1','+1+0','-2+1'},
|
||||
[13]={'-1+0','-1-1','+0+1','-1-2'},
|
||||
[31]={'+1+0','+1+1','+0-1','+1+2'},
|
||||
},--J5
|
||||
false,--L5
|
||||
{
|
||||
[01]={'-1+0','-1+0','-1+1','+1+0','-1+2','-1-1','+0-3','+0+1'},
|
||||
[10]={'-1+0','+1+0','+1-1','+1+0','+1-2','+1+1','+0+3','+0+1'},
|
||||
[03]={'+0-1','+0+1','+1+0','+1-1','-1+0','+1+1','+0-2','+1-2','+0-3','+1-3','-1+1'},
|
||||
[30]={'+0-1','+0+1','-1+0','-1+1','+1+0','-1-1','+0+2','-1+2','+0+3','-1+3','+1-1'},
|
||||
[12]={'+1+0','+1-1','+0-1','+1-2','+0-2','+1+1','-1+0','+0+2','+1+2'},
|
||||
[21]={'-1+0','-1+1','+0+1','-1+2','+0+2','-1-1','+1+0','+0-2','-1-2'},
|
||||
[32]={'+0-1','-1+0','-1+1','-1-1','+1+0','+0+2','-1+2','+0-2'},
|
||||
[23]={'+0+1','+1+0','+1-1','+1+1','-1+0','+0-2','+1-2','+0+2'},
|
||||
[02]={'+0-1','+1-1','-1+0','+2-1','+0+1'},
|
||||
[20]={'+0+1','-1+1','+1+0','-2+1','+0-1'},
|
||||
[13]={'-1+0','-1-1','+0+1','-1-2'},
|
||||
[31]={'+1+0','+1+1','+0-1','+1+2'},
|
||||
},--R
|
||||
false,--Y
|
||||
{
|
||||
[01]={'-1+0','-1+1','+0+1','+1+0','-1+2','-2+0','+0-2'},
|
||||
[10]={'+1+0','-1+0','+0-1','+1-1','+1-2','+2+0','+0+2'},
|
||||
[03]={'-1+0','+1-1','+0-2','+0-3','+1+0','+1-2','+1-3','+0+1','-1+1'},
|
||||
[30]={'-1+0','+1-1','+1-2','+1+0','+0-2','+1-3','-1+2','+0+3','-1+3'},
|
||||
[12]={'-1+0','+1-1','-1-1','+1-2','+1+0','+0-2','+1-3','-1+2','+0+3','-1+3'},
|
||||
[21]={'-1+0','+1-1','+1+1','+0-2','+0-3','+1+0','+1-2','+1-3','+0+1','-1+1'},
|
||||
[32]={'-1+0','+0-1','-1-2','+1-1','+1+0','+1+1','+0+2','+0+3'},
|
||||
[23]={'+0-2','+0-3','+1+2','+1+0','+0+1','-1+1','+0-1','+0+2'},
|
||||
[02]={'-1+0','+0+2','+0-1'},
|
||||
[20]={'+1+0','+0-2','+0+1'},
|
||||
[13]={'-1+0','-1-1','+0+1','+1+2'},
|
||||
[31]={'+1+0','+1+1','+0-1','-1-2'},
|
||||
},--N
|
||||
false,--H
|
||||
{
|
||||
[01]={'+1-1','+1+0','+1+1','+0+1','-1+1','-1+0','-1-1','+0-1','+0-2','-2-1','-2-2','+2+0','+2-1','+2-2','+1+2','+2+2','-1+2','-2+2'},
|
||||
[10]={'-1+0','-1-1','+0-1','+1-1','-2-2','-2-1','-2+0','-1-2','+0-2','+1-2','+2-2','-1+1','-2+1','-2+2','+1+0','+2+0','+2-1','+0+1','+1-1','+2-2'},
|
||||
[03]={'-1-1','-1+0','-1+1','-0+1','+1+1','+1+0','+1-1','-0-1','-0-2','+2-1','+2-2','-2+0','-2-1','-2-2','-1+2','-2+2','+1+2','+2+2'},
|
||||
[30]={'+1+0','+1-1','-0-1','-1-1','+2-2','+2-1','+2+0','+1-2','-0-2','-1-2','-2-2','+1+1','+2+1','+2+2','-1+0','-2+0','-2-1','+0+1','-1-1','-2-2'},
|
||||
},--I5
|
||||
{
|
||||
[01]={'-1+0','-1-1','+1+1','-1+1'},
|
||||
[10]={'-1+0','+1+0','-1-1','+1+1'},
|
||||
[03]={'+1+0','+1-1','-1+1','+1+1'},
|
||||
[30]={'+1+0','-1+0','+1-1','-1+1'},
|
||||
},--I3
|
||||
{
|
||||
[01]={'-1+0','+1+0'},
|
||||
[10]={'+1+0','-1+0'},
|
||||
[03]={'+0+1','+0-1'},
|
||||
[30]={'+0-1','+0+1'},
|
||||
[12]={'+0+1','+0-1'},
|
||||
[21]={'+0-1','+0+1'},
|
||||
[32]={'-1+0','+1+0'},
|
||||
[23]={'+1+0','-1+0'},
|
||||
[02]={'+0-1','+1-1','-1-1'},
|
||||
[20]={'+0+1','-1+1','+1+1'},
|
||||
[13]={'+0-1','-1-1','+1-1'},
|
||||
[31]={'+0+1','+1+1','-1+1'},
|
||||
},--C
|
||||
{
|
||||
[01]={'-1+0','+0+1'},
|
||||
[10]={'+1+0','+0+1'},
|
||||
[03]={'+1+0','+0+1'},
|
||||
[30]={'-1+0','+0+1'},
|
||||
[12]={'+1+0','+0+2'},
|
||||
[21]={'+0-1','-1+0'},
|
||||
[32]={'-1+0','+0+2'},
|
||||
[23]={'+0-1','-1+0'},
|
||||
[02]={'+0-1','+0+1'},
|
||||
[20]={'+0+1','+0-1'},
|
||||
[13]={'-1+0','+1+0'},
|
||||
[31]={'+1+0','-1+0'},
|
||||
},--I2
|
||||
nil,--O1
|
||||
}
|
||||
TRS.centerDisp[6]=false
|
||||
TRS.centerDisp[18]=false
|
||||
TRS[2]= reflect(TRS[1])--SZ
|
||||
TRS[4]= reflect(TRS[3])--LJ
|
||||
TRS[9]= reflect(TRS[8])--S5Z5
|
||||
TRS[11]=reflect(TRS[10])--PQ
|
||||
TRS[13]=reflect(TRS[12])--FE
|
||||
TRS[20]=reflect(TRS[19])--L5J5
|
||||
TRS[22]=reflect(TRS[21])--RY
|
||||
TRS[24]=reflect(TRS[23])--NH
|
||||
centroSymSet(TRS[8])centroSymSet(TRS[9])--S5Z5
|
||||
centroSymSet(TRS[25])centroSymSet(TRS[26])--I5I3
|
||||
for i=1,29 do collectSet(TRS[i])end
|
||||
pushZero(TRS)
|
||||
end
|
||||
|
||||
local SRS
|
||||
do
|
||||
SRS={
|
||||
{
|
||||
[01]={'-1+0','-1+1','+0-2','-1-2'},
|
||||
[10]={'+1+0','+1-1','+0+2','+1+2'},
|
||||
[03]={'+1+0','+1+1','+0-2','+1-2'},
|
||||
[30]={'-1+0','-1-1','+0+2','-1+2'},
|
||||
[12]={'+1+0','+1-1','+0+2','+1+2'},
|
||||
[21]={'-1+0','-1+1','+0-2','-1-2'},
|
||||
[32]={'-1+0','-1-1','+0+2','-1+2'},
|
||||
[23]={'+1+0','+1+1','+0-2','+1-2'},
|
||||
[02]={},[20]={},[13]={},[31]={},
|
||||
},--Z
|
||||
false,--S
|
||||
false,--J
|
||||
false,--L
|
||||
false,--T
|
||||
noKickSet,--O
|
||||
{
|
||||
[01]={'-2+0','+1+0','-2-1','+1+2'},
|
||||
[10]={'+2+0','-1+0','+2+1','-1-2'},
|
||||
[12]={'-1+0','+2+0','-1+2','+2-1'},
|
||||
[21]={'+1+0','-2+0','+1-2','-2+1'},
|
||||
[23]={'+2+0','-1+0','+2+1','-1-2'},
|
||||
[32]={'-2+0','+1+0','-2-1','+1+2'},
|
||||
[30]={'+1+0','-2+0','+1-2','-2+1'},
|
||||
[03]={'-1+0','+2+0','-1+2','+2-1'},
|
||||
[02]={},[20]={},[13]={},[31]={},
|
||||
}--I
|
||||
}
|
||||
collectSet(SRS[1])
|
||||
collectSet(SRS[7])
|
||||
pushZero(SRS)
|
||||
for i=2,5 do SRS[i]=SRS[1]end
|
||||
for i=8,29 do SRS[i]=SRS[1]end
|
||||
end
|
||||
|
||||
local BiRS
|
||||
do
|
||||
local R=vecStrConv{'+0+0','-1+0','-1-1','+0-1','-1+1','+1-1','+1+0','+0+1','+1+1','+0+2','-1+2','+1+2','-2+0','+2+0'}
|
||||
local L=vecStrConv{'+0+0','+1+0','+1-1','+0-1','+1+1','-1-1','-1+0','+0+1','-1+1','+0+2','+1+2','-1+2','+2+0','-2+0'}
|
||||
local F=vecStrConv{'+0+0','+0-1','+0+1','+0+2'}
|
||||
local list={
|
||||
{[02]=L,[20]=R,[13]=R,[31]=L},--Z
|
||||
{[02]=R,[20]=L,[13]=L,[31]=R},--S
|
||||
{[02]=L,[20]=R,[13]=L,[31]=R},--J
|
||||
{[02]=R,[20]=L,[13]=L,[31]=R},--L
|
||||
{[02]=F,[20]=F,[13]=L,[31]=R},--T
|
||||
{[02]=F,[20]=F,[13]=F,[31]=F},--O
|
||||
{[02]=F,[20]=F,[13]=R,[31]=L},--I
|
||||
|
||||
{[02]=L,[20]=L,[13]=R,[31]=R},--Z5
|
||||
{[02]=R,[20]=R,[13]=L,[31]=L},--S5
|
||||
{[02]=L,[20]=R,[13]=L,[31]=R},--P
|
||||
{[02]=R,[20]=L,[13]=R,[31]=L},--Q
|
||||
{[02]=R,[20]=L,[13]=L,[31]=R},--F
|
||||
{[02]=L,[20]=R,[13]=R,[31]=L},--E
|
||||
{[02]=F,[20]=F,[13]=L,[31]=R},--T5
|
||||
{[02]=F,[20]=F,[13]=L,[31]=R},--U
|
||||
{[02]=R,[20]=L,[13]=L,[31]=R},--V
|
||||
{[02]=R,[20]=L,[13]=L,[31]=R},--W
|
||||
{[02]=F,[20]=F,[13]=F,[31]=F},--X
|
||||
{[02]=L,[20]=R,[13]=R,[31]=L},--J5
|
||||
{[02]=R,[20]=L,[13]=L,[31]=R},--L5
|
||||
{[02]=L,[20]=R,[13]=R,[31]=L},--R
|
||||
{[02]=R,[20]=L,[13]=L,[31]=R},--Y
|
||||
{[02]=L,[20]=R,[13]=R,[31]=L},--N
|
||||
{[02]=R,[20]=L,[13]=L,[31]=R},--H
|
||||
{[02]=F,[20]=F,[13]=F,[31]=F},--I5
|
||||
|
||||
{[02]=F,[20]=F,[13]=F,[31]=F},--I3
|
||||
{[02]=R,[20]=L,[13]=L,[31]=R},--C
|
||||
{[02]=F,[20]=F,[13]=R,[31]=L},--I2
|
||||
{[02]=F,[20]=F,[13]=F,[31]=F},--O1
|
||||
}
|
||||
for i=1,29 do
|
||||
local a,b=R,L
|
||||
if i==6 or i==18 then a,b=b,a end
|
||||
list[i][01]=a;list[i][10]=b;list[i][03]=b;list[i][30]=a
|
||||
list[i][12]=a;list[i][21]=b;list[i][32]=b;list[i][23]=a
|
||||
end
|
||||
BiRS=TABLE.new(function(P,d,ifpre)
|
||||
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(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
|
||||
local fdx,fdy=kickList[test][1]+dx,kickList[test][2]+dy
|
||||
if
|
||||
dx*fdx>=0 and
|
||||
fdx^2+fdy^2<=5 and
|
||||
(P.freshTime>0 or fdy<=0)
|
||||
then
|
||||
local x,y=ix+fdx,iy+fdy
|
||||
if not P:ifoverlap(icb,x,y)then
|
||||
if P.gameEnv.moveFX and P.gameEnv.block then
|
||||
P:createMoveFX()
|
||||
end
|
||||
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
|
||||
if not ifpre then
|
||||
P:freshBlock('move')
|
||||
end
|
||||
if fdy>0 and P.freshTime==t and P.curY~=P.imgY then
|
||||
P.freshTime=P.freshTime-1
|
||||
end
|
||||
|
||||
if P.sound then
|
||||
local sfx
|
||||
if ifpre then
|
||||
sfx='prerotate'
|
||||
elseif P:ifoverlap(icb,x,y+1)and P:ifoverlap(icb,x-1,y)and P:ifoverlap(icb,x+1,y)then
|
||||
sfx='rotatekick'
|
||||
if P.gameEnv.shakeFX then
|
||||
if d==1 or d==3 then
|
||||
P.fieldOff.va=P.fieldOff.va+(2-d)*P.gameEnv.shakeFX*6e-3
|
||||
else
|
||||
P.fieldOff.va=P.fieldOff.va+P:getCenterX()*P.gameEnv.shakeFX*3e-3
|
||||
end
|
||||
end
|
||||
else
|
||||
sfx='rotate'
|
||||
end
|
||||
SFX.play(sfx,nil,P:getCenterX()*.15)
|
||||
end
|
||||
P.stat.rotate=P.stat.rotate+1
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Try release left/right, then softdrop, failed to rotate otherwise
|
||||
if dx~=0 then
|
||||
dx=0
|
||||
elseif dy~=0 then
|
||||
dy=0
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
end,29)
|
||||
end
|
||||
|
||||
local ASC
|
||||
do
|
||||
local L={"+0+0","+1+0","+0-1","+1-1","+0-2","+1-2","+2+0","+2-1","+2-2","-1+0","-1-1","+0+1","+1+1","+2+1","-1-2","-2+0","+0+2","+1+2","+2+2","-2-1","-2-2"}
|
||||
local R=flipList(L)
|
||||
local F={"+0+0"}
|
||||
vecStrConv(L)vecStrConv(R)vecStrConv(F)
|
||||
ASC={
|
||||
{
|
||||
[01]=R,[10]=L,[03]=L,[30]=R,
|
||||
[12]=R,[21]=L,[32]=L,[23]=R,
|
||||
[02]=F,[20]=F,[13]=F,[31]=F,
|
||||
}
|
||||
}
|
||||
for i=2,29 do ASC[i]=ASC[1]end
|
||||
end
|
||||
|
||||
local ASC_plus
|
||||
do
|
||||
local L={"+0+0","+1+0","+0-1","+1-1","+0-2","+1-2","+2+0","+2-1","+2-2","-1+0","-1-1","+0+1","+1+1","+2+1","-1-2","-2+0","+0+2","+1+2","+2+2","-2-1","-2-2"}
|
||||
local R=flipList(L)
|
||||
local F={"+0+0","-1+0","+1+0","+0-1","-1-1","+1-1","+0-2","-1-2","+1-2","-2+0","+2+0","-2-1","+2-1","-2+1","+2+1","+0+2","-1+2","+1+2"}
|
||||
vecStrConv(L)vecStrConv(R)vecStrConv(F)
|
||||
ASC_plus={
|
||||
{
|
||||
[01]=R,[12]=R,[23]=R,[30]=R,
|
||||
[10]=L,[21]=L,[32]=L,[03]=L,
|
||||
[02]=F,[20]=F,[13]=F,[31]=F,
|
||||
}
|
||||
}
|
||||
for i=2,29 do ASC_plus[i]=ASC_plus[1]end
|
||||
end
|
||||
|
||||
local C2
|
||||
do
|
||||
local L=vecStrConv{'+0+0','-1+0','+1+0','+0-1','-1-1','+1-1','-2+0','+2+0'}
|
||||
C2={
|
||||
{
|
||||
[01]=L,[10]=L,[12]=L,[21]=L,
|
||||
[23]=L,[32]=L,[30]=L,[03]=L,
|
||||
[02]=L,[20]=L,[13]=L,[31]=L,
|
||||
}
|
||||
}
|
||||
for i=2,29 do C2[i]=C2[1]end
|
||||
end
|
||||
|
||||
local C2_sym
|
||||
do
|
||||
local L={'+0+0','-1+0','+1+0','+0-1','-1-1','+1-1','-2+0','+2+0'}
|
||||
local R={'+0+0','+1+0','-1+0','+0-1','+1-1','-1-1','+2+0','-2+0'}
|
||||
|
||||
local Z={
|
||||
[01]=R,[10]=L,[03]=L,[30]=R,
|
||||
[12]=R,[21]=L,[32]=L,[23]=R,
|
||||
[02]=R,[20]=L,[13]=L,[31]=R,
|
||||
}
|
||||
local S=reflect(Z)
|
||||
collectSet(Z)
|
||||
collectSet(S)
|
||||
|
||||
C2_sym={
|
||||
Z,S,--Z,S
|
||||
Z,S,--J,L
|
||||
Z,--T
|
||||
noKickSet,--O
|
||||
Z,--I
|
||||
|
||||
Z,S,--Z5,S5
|
||||
Z,S,--P,Q
|
||||
Z,S,--F,E
|
||||
Z,Z,Z,Z,--T5,U,V,W
|
||||
noKickSet,--X
|
||||
Z,S,--J5,L5
|
||||
Z,S,--R,Y
|
||||
Z,S,--N,H
|
||||
Z,--I5
|
||||
|
||||
Z,Z,--I3,C
|
||||
Z,Z,--I2,O1
|
||||
}
|
||||
end
|
||||
|
||||
local None={}
|
||||
for i=1,29 do None[i]=noKickSet_180 end
|
||||
|
||||
local None_plus={}
|
||||
for i=1,29 do None_plus[i]=noKickSet end
|
||||
|
||||
local RS={
|
||||
TRS=TRS,
|
||||
SRS=SRS,
|
||||
BiRS=BiRS,
|
||||
ASC=ASC,
|
||||
ASC_plus=ASC_plus,
|
||||
C2=C2,
|
||||
C2_sym=C2_sym,
|
||||
None=None,
|
||||
None_plus=None_plus,
|
||||
}
|
||||
|
||||
for _,v in next,RS do
|
||||
if not v.centerDisp then
|
||||
v.centerDisp=TABLE.new(true,29)
|
||||
end
|
||||
end
|
||||
|
||||
return RS
|
||||
@@ -177,7 +177,7 @@ end
|
||||
do--BLOCKS
|
||||
local O,_=true,false
|
||||
BLOCKS={
|
||||
--Tetramino
|
||||
--Tetromino
|
||||
{{_,O,O},{O,O,_}}, --Z
|
||||
{{O,O,_},{_,O,O}}, --S
|
||||
{{O,O,O},{O,_,_}}, --J
|
||||
@@ -236,54 +236,6 @@ do--BLOCKS
|
||||
end
|
||||
end
|
||||
end
|
||||
do--SCS(spinCenters)
|
||||
local N1,N2,N3,N4={0,1},{1,0},{1,1},{.5,.5}
|
||||
local I1,I2,I3,I4={-.5,1.5},{1.5,-.5},{.5,1.5},{1.5,.5}
|
||||
local V4={1.5,1.5}
|
||||
local L1,L2={0,2},{2,0}
|
||||
local S1,S2={-.5,.5},{.5,-.5}
|
||||
local D={0,0}
|
||||
SCS={
|
||||
--Tetramino
|
||||
{[0]=N1,N2,N3,N3},--Z
|
||||
{[0]=N1,N2,N3,N3},--S
|
||||
{[0]=N1,N2,N3,N3},--L
|
||||
{[0]=N1,N2,N3,N3},--J
|
||||
{[0]=N1,N2,N3,N3},--T
|
||||
{[0]=N4,N4,N4,N4},--O
|
||||
{[0]=I1,I2,I3,I4},--I
|
||||
|
||||
--Pentomino
|
||||
{[0]=N3,N3,N3,N3},--Z5
|
||||
{[0]=N3,N3,N3,N3},--S5
|
||||
{[0]=N1,N2,N3,N3},--P
|
||||
{[0]=N1,N2,N3,N3},--Q
|
||||
{[0]=N3,N3,N3,N3},--F
|
||||
{[0]=N3,N3,N3,N3},--E
|
||||
{[0]=N3,N3,N3,N3},--T5
|
||||
{[0]=N1,N2,N3,N3},--U
|
||||
{[0]=I3,N4,I4,V4},--V
|
||||
{[0]=N3,N3,N3,N3},--W
|
||||
{[0]=N3,N3,N3,N3},--X
|
||||
{[0]=I3,I4,I3,I4},--J5
|
||||
{[0]=I3,I4,I3,I4},--L5
|
||||
{[0]=I3,I4,I3,I4},--R
|
||||
{[0]=I3,I4,I3,I4},--Y
|
||||
{[0]=I3,I4,I3,I4},--N
|
||||
{[0]=I3,I4,I3,I4},--H
|
||||
{[0]=L1,L2,L1,L2},--I5
|
||||
|
||||
--Trimino
|
||||
{[0]=N1,N2,N1,N2},--I3
|
||||
{[0]=N4,N4,N4,N4},--C
|
||||
|
||||
--Domino
|
||||
{[0]=S1,S2,N4,N4},--I2
|
||||
|
||||
--Dot
|
||||
{[0]=D,D,D,D},--O1
|
||||
}
|
||||
end
|
||||
oldModeNameTable={
|
||||
attacker_hard="attacker_h",
|
||||
attacker_ultimate="attacker_u",
|
||||
|
||||
@@ -12,7 +12,6 @@ local SFX,BGM,VOC,VIB,SYSFX=SFX,BGM,VOC,VIB,SYSFX
|
||||
local FREEROW,TABLE,TEXT,NET,TASK=FREEROW,TABLE,TEXT,NET,TASK
|
||||
local PLAYERS,PLY_ALIVE,GAME=PLAYERS,PLY_ALIVE,GAME
|
||||
|
||||
local kickList=require"parts.kickList"
|
||||
local ply_draw=require"parts.player.draw"
|
||||
local ply_update=require"parts.player.update"
|
||||
|
||||
@@ -229,7 +228,7 @@ function Player:setInvisible(time)--Time in frames
|
||||
end
|
||||
end
|
||||
function Player:setRS(RSname)
|
||||
self.RS=kickList[RSname]or kickList.TRS
|
||||
self.RS=RSlist[RSname]or RSlist.TRS
|
||||
end
|
||||
|
||||
function Player:getHolePos()--Get a good garbage-line hole position
|
||||
@@ -668,7 +667,7 @@ end
|
||||
|
||||
function Player:spin(d,ifpre)
|
||||
local cur=self.cur
|
||||
local kickData=self.RS[cur.id]
|
||||
local kickData=self.RS.kickTable[cur.id]
|
||||
if type(kickData)=='table'then
|
||||
local idir=(cur.dir+d)%4
|
||||
kickData=kickData[cur.dir*10+idir]
|
||||
@@ -678,7 +677,7 @@ function Player:spin(d,ifpre)
|
||||
return
|
||||
end
|
||||
local icb=BLOCKS[cur.id][idir]
|
||||
local isc=SCS[cur.id][idir]
|
||||
local isc=self.RS.centerPos[cur.id][idir]
|
||||
local ix,iy=self.curX+cur.sc[2]-isc[2],self.curY+cur.sc[1]-isc[1]
|
||||
for test=1,#kickData do
|
||||
local x,y=ix+kickData[test][1],iy+kickData[test][2]
|
||||
@@ -831,7 +830,7 @@ function Player:getBlock(id,name,color)--Get a block(id=n) object
|
||||
id=id,
|
||||
dir=dir,
|
||||
bk=BLOCKS[id][dir],
|
||||
sc=SCS[id][dir],
|
||||
sc=self.RS.centerPos[id][dir],
|
||||
name=name or id,
|
||||
color=E.bone and 17 or color or E.skin[id],
|
||||
}
|
||||
@@ -842,7 +841,7 @@ function Player:getNext(n)--Push a block(id=n) to nextQueue
|
||||
ins(self.nextQueue,{
|
||||
id=n,
|
||||
bk=BLOCKS[n][dir],
|
||||
sc=SCS[n][dir],
|
||||
sc=self.RS.centerPos[n][dir],
|
||||
dir=dir,
|
||||
name=n,
|
||||
color=E.bone and 17 or E.skin[n],
|
||||
|
||||
@@ -175,7 +175,7 @@ function scene.draw()
|
||||
local r=TIME()*2
|
||||
local R=int(r)%7+1
|
||||
gc.setColor(1,1,1,1-abs(r%1*2-1))
|
||||
gc.draw(TEXTURE.miniBlock[R],785,140,TIME()*10%6.2832,15,15,SCS[R][0][2]+.5,#BLOCKS[R][0]-SCS[R][0][1]-.5)
|
||||
gc.draw(TEXTURE.miniBlock[R],785,140,TIME()*10%6.2832,15,15,DSCP[R][0][2]+.5,#BLOCKS[R][0]-DSCP[R][0][1]-.5)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ function scene.draw()
|
||||
gc.rotate(minoRot[n]+sin(t*3-n*.5)*.08)
|
||||
local color=SETTING.skin[n]
|
||||
local B=BLOCKS[n][0]
|
||||
local x,y=-45-SCS[n][0][2]*30,15+SCS[n][0][1]*30
|
||||
local x,y=-45-DSCP[n][0][2]*30,15+DSCP[n][0][1]*30
|
||||
local col=#B[1]
|
||||
for i=1,#B do for j=1,col do
|
||||
if B[i][j]then
|
||||
|
||||
@@ -97,8 +97,8 @@ function scene.draw()
|
||||
local r=t*2
|
||||
local R=int(r)%7+1
|
||||
gc_setColor(1,1,1,1-abs(r%1*2-1))
|
||||
gc_draw(TEXTURE.miniBlock[R],680,50,t*10%6.2832,15,15,SCS[R][0][2]+.5,#BLOCKS[R][0]-SCS[R][0][1]-.5)
|
||||
gc_draw(TEXTURE.miniBlock[R],680,300,0,15,15,SCS[R][0][2]+.5,#BLOCKS[R][0]-SCS[R][0][1]-.5)
|
||||
gc_draw(TEXTURE.miniBlock[R],680,50,t*10%6.2832,15,15,DSCP[R][0][2]+.5,#BLOCKS[R][0]-DSCP[R][0][1]-.5)
|
||||
gc_draw(TEXTURE.miniBlock[R],680,300,0,15,15,DSCP[R][0][2]+.5,#BLOCKS[R][0]-DSCP[R][0][1]-.5)
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
|
||||
Reference in New Issue
Block a user