Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Giant pieces #1128

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Zframework/file.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function FILE.load(name,args)
error('unknown mode')
end
elseif not STRING.sArg(args,'-canskip') then
error('no file')
--error('no file')
end
end
function FILE.save(data,name,args)
Expand Down
5 changes: 5 additions & 0 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
-- Var leak check
-- setmetatable(_G,{__newindex=function(self,k,v) print('>>'..k..string.rep(" ",26-#k),debug.traceback():match("\n.-\n\t(.-): "))rawset(self,k,v) end})

-- Local Lua Debugger VS Code Debug
if os.getenv("LOCAL_LUA_DEBUGGER_VSCODE") == "1" then
require("lldebugger").start()
end

-- System Global Vars Declaration
local fs=love.filesystem
VERSION=require"version"
Expand Down
122 changes: 116 additions & 6 deletions parts/RSlist.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ local defaultCenterPos={-- For SRS-like RSs
{[0]={0,0},{0,0},{0,0},{0,0}},-- O1
}

local function _bigRotationCenter(centerList)
local bigCenterList = {}
for i, list in next, centerList do
-- Deduce the distance from bottom-left of the piece. Bottom-left is at (-0.5,-0.5)
local distX = list[1]+0.5
local distY = list[2]+0.5
bigCenterList[i]={distX * 2 - 0.5, distY * 2 - 0.5}
end
return bigCenterList
end

for i = 30,58 do
defaultCenterPos[i]=_bigRotationCenter(defaultCenterPos[i-29])
end

local noKickSet,noKickSet_180 do
local Zero={{0,0}}
noKickSet={[01]=Zero,[10]=Zero,[03]=Zero,[30]=Zero,[12]=Zero,[21]=Zero,[32]=Zero,[23]=Zero}
Expand Down Expand Up @@ -71,6 +86,18 @@ local function _flipList(O)
return L
end

-- Use this to create a giant piece kick set out of the existing kick table
local function _bigList(O)
if not O or type(O[1])~='string' then
return
end
local L={}
for i,s in next,O do
L[i]=s:sub(1,1)..tostring(tonumber(s:sub(2,2))*2)..s:sub(3,3)..tostring(tonumber(s:sub(4,4))*2)
end
return L
end

local function _reflect(a)
return {
[03]=_flipList(a[01]),
Expand All @@ -88,6 +115,24 @@ local function _reflect(a)
}
end


local function _big(a)
return {
[03]=_bigList(a[03]),
[01]=_bigList(a[01]),
[30]=_bigList(a[30]),
[32]=_bigList(a[32]),
[23]=_bigList(a[23]),
[21]=_bigList(a[21]),
[10]=_bigList(a[10]),
[12]=_bigList(a[12]),
[02]=_bigList(a[02]),
[20]=_bigList(a[20]),
[31]=_bigList(a[31]),
[13]=_bigList(a[13]),
}
end

local TRS
do
local OspinList={
Expand Down Expand Up @@ -122,7 +167,7 @@ do
{'setCL',1,1,1},
{'fRect',4,4,2,2},
},
centerDisp=TABLE.new(true,29),
centerDisp=TABLE.new(true,58),
kickTable={
{
[01]={'+0+0','-1+0','-1+1','+0-2','-1+2','+0+1'},
Expand Down Expand Up @@ -442,6 +487,16 @@ do
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

for i = 30, 34 do
TRS.kickTable[i]=_big(TRS.kickTable[i-29])
end
for i = 36, 46 do
TRS.kickTable[i]=_big(TRS.kickTable[i-29])
end
for i = 48, 57 do
TRS.kickTable[i]=_big(TRS.kickTable[i-29])
end
end

local SRS -- Pentos are treated as 3*3 piece
Expand Down Expand Up @@ -487,6 +542,10 @@ do
}
for i=2,5 do SRS.kickTable[i]=SRS.kickTable[1] end
for i=8,29 do SRS.kickTable[i]=SRS.kickTable[1] end
for i = 30, 59 do
SRS.kickTable[i]=_big(SRS.kickTable[i-29])
end

end

local SRS_plus -- Basic 180 kicks and symmetry I piece kick table
Expand Down Expand Up @@ -540,6 +599,9 @@ do
}
for i=2,5 do SRS_plus.kickTable[i]=SRS_plus.kickTable[1] end
for i=8,29 do SRS_plus.kickTable[i]=SRS_plus.kickTable[1] end
for i = 30, 59 do
SRS_plus.kickTable[i]=_big(SRS_plus.kickTable[i-29])
end
end

local SRS_X -- Basic 180 kicks and TRS for non-SZJLT
Expand Down Expand Up @@ -580,9 +642,13 @@ do
for i=7,29 do SRS_X.kickTable[i]=TRS.kickTable[i] end
SRS_X.kickTable[10]=SRS_X.kickTable[1]-- P
SRS_X.kickTable[11]=SRS_X.kickTable[1]-- Q
for i = 30, 57 do -- TRS does not have kicks for O1
SRS_X.kickTable[i]=_big(SRS_X.kickTable[i-29])
end
end

local BiRS
-- TODO: Big piece behavior for BiRS
do
local R=_strToVec{'+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=_strToVec{'+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'}
Expand Down Expand Up @@ -752,6 +818,10 @@ do
centerPos[26]={[0]={0,1},{0,0},{0,1},{0,0}}-- I3
centerPos[28]={[0]={0,1},{0,0},{0,1},{0,0}}-- I2

for i = 30,58 do
centerPos[i]=_bigRotationCenter(centerPos[i-29])
end

ARS_Z={
centerTex=GC.DO{10,10,
{'setLW',2},
Expand All @@ -764,6 +834,9 @@ do
kickTable=TABLE.new(set3,29),
}
ARS_Z.kickTable[7],ARS_Z.kickTable[25]=set4,set4-- I,I5
for i = 30, 58 do
ARS_Z.kickTable[i]=_big(ARS_Z.kickTable[i-29])
end
end

local DRS_weak
Expand All @@ -788,6 +861,10 @@ do
centerPos[26]={[0]={0,1},{0,0},{0,1},{0,0}}-- I3
centerPos[28]={[0]={0,1},{0,0},{0,1},{0,0}}-- I2

for i = 30,58 do
centerPos[i]=_bigRotationCenter(centerPos[i-29])
end

local L={'+0+0','-1+0','+1+0','+0-1','-1-1','+1-1'}
local R={'+0+0','+1+0','-1+0','+0-1','+1-1','-1-1'}

Expand Down Expand Up @@ -826,6 +903,9 @@ do
Z,Z,-- I2,O1
}
}
for i = 30, 58 do
DRS_weak.kickTable[i]=_big(DRS_weak.kickTable[i-29])
end
end

local ASC
Expand All @@ -847,6 +927,10 @@ do
centerPos[27]={[0]={0,1},{0,0},{1,0},{1,1}}-- C
centerPos[28]={[0]={0,1},{0,0},{0,0},{1,0}}-- I2

for i = 30,58 do
centerPos[i]=_bigRotationCenter(centerPos[i-29])
end

ASC={
centerTex=GC.DO{10,10,
{'setLW',2},
Expand All @@ -865,6 +949,9 @@ do
[02]=F,[20]=F,[13]=F,[31]=F,
},29)
}
for i = 30, 58 do
ASC.kickTable[i]=_big(ASC.kickTable[i-29])
end
end

local ASC_plus
Expand Down Expand Up @@ -894,6 +981,9 @@ do
[02]=F,[20]=F,[13]=F,[31]=F,
},29)
}
for i = 30, 58 do
ASC_plus.kickTable[i]=_big(ASC_plus.kickTable[i-29])
end
end

local C2
Expand All @@ -910,6 +1000,9 @@ do
[02]=L,[20]=L,[13]=L,[31]=L,
},29)
}
for i = 30, 58 do
C2.kickTable[i]=_big(C2.kickTable[i-29])
end
end

local C2_sym
Expand Down Expand Up @@ -951,6 +1044,9 @@ do
Z,Z,-- I2,O1
}
}
for i = 30, 58 do
C2_sym.kickTable[i]=_big(C2_sym.kickTable[i-29])
end
end

local N64
Expand All @@ -967,6 +1063,9 @@ do
[23]=R,[32]=L,[30]=R,[03]=L,
},29)
}
for i = 30, 58 do
N64.kickTable[i]=_big(N64.kickTable[i-29])
end
end

local N64_plus
Expand All @@ -985,13 +1084,20 @@ do
[02]=F,[20]=F,[13]=F,[31]=F,
},29)
}
for i = 30, 58 do
N64_plus.kickTable[i]=_big(N64_plus.kickTable[i-29])
end
end

local Classic do
local centerPos=TABLE.copy(defaultCenterPos)
centerPos[1]={[0]={1,1},{1,0},{1,1},{1,0}}
centerPos[2]={[0]={1,1},{1,0},{1,1},{1,0}}
centerPos[7]={[0]={0,2},{1,0},{0,2},{1,0}}
for i = 30,31 do
centerPos[i]=_bigRotationCenter(centerPos[i-29])
end
centerPos[36]=_bigRotationCenter(centerPos[7])
Classic={
centerTex=GC.DO{10,10,
{'setLW',2},
Expand All @@ -1001,7 +1107,7 @@ local Classic do
{'line',7,8,2,8,2,2,7,2},
},
centerPos=centerPos,
kickTable=TABLE.new(noKickSet,29)
kickTable=TABLE.new(noKickSet,58)
}
end

Expand All @@ -1010,6 +1116,10 @@ local Classic_plus do
centerPos[1]={[0]={1,1},{1,0},{1,1},{1,0}}
centerPos[2]={[0]={1,1},{1,0},{1,1},{1,0}}
centerPos[7]={[0]={0,2},{1,0},{0,2},{1,0}}
for i = 30,31 do
centerPos[i]=_bigRotationCenter(centerPos[i-29])
end
centerPos[36]=_bigRotationCenter(centerPos[7])
Classic_plus={
centerTex=GC.DO{10,10,
{'setLW',2},
Expand All @@ -1018,7 +1128,7 @@ local Classic_plus do
{'fRect',3,3,4,4},
},
centerPos=centerPos,
kickTable=TABLE.new(noKickSet_180,29)
kickTable=TABLE.new(noKickSet_180,58)
}
end

Expand All @@ -1027,7 +1137,7 @@ local None={
{'setLW',2},
{'line',2,2,6,6},
},
kickTable=TABLE.new(noKickSet,29)
kickTable=TABLE.new(noKickSet,58)
}

local None_plus={
Expand All @@ -1036,7 +1146,7 @@ local None_plus={
{'line',1,1,7,7},
{'fRect',2,2,4,4},
},
kickTable=TABLE.new(noKickSet_180,29)
kickTable=TABLE.new(noKickSet_180,58)
}

local RSlist={
Expand All @@ -1061,7 +1171,7 @@ local RSlist={

for name,rs in next,RSlist do
rs.name=name
if not rs.centerDisp then rs.centerDisp=TABLE.new(true,29) end
if not rs.centerDisp then rs.centerDisp=TABLE.new(true,58) end
if not rs.centerPos then rs.centerPos=defaultCenterPos end
if not rs.centerTex then rs.centerTex=defaultCenterTex end

Expand Down
22 changes: 22 additions & 0 deletions parts/gameTables.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
-- Static data tables
BLOCK_NAMES={
'Z','S','J','L','T','O','I',
'Z5','S5','P','Q','F','E',
'T5','U','V','W','X',
'J5','L5','R','Y','N','H','I5',
'I3','C','I2','O1',
-- Might want to add the indication that those pieces are big, or change the logic altogether.
'Z','S','J','L','T','O','I',
'Z5','S5','P','Q','F','E',
'T5','U','V','W','X',
Expand Down Expand Up @@ -241,6 +247,22 @@ do-- BLOCKS
-- Dot
{{O}},-- O1
}
local function _createBigPiece(piece)
local bigPiece = {}
local rows, columns = #piece, #piece[1]
for row = 1, rows * 2 do
bigPiece[row] = {}
for column = 1, columns * 2 do
bigPiece[row][column]=piece[math.ceil(row/2)][math.ceil(column/2)]
end
end
return bigPiece
end

for i = 30, 58 do
BLOCKS[i]=_createBigPiece(BLOCKS[i-29])
end

local function _RotCW(B)
local N={}
local r,c=#B,#B[1]-- row,col
Expand Down
7 changes: 7 additions & 0 deletions parts/player/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ local function _getNewStatTable()
T.clears[i]=0
T.spins[i]=0
end
-- Big pieces - Undecacrashes are possible, so need more entries
for i=30,58 do
T.clear[i]={0,0,0,0,0,0,0,0,0,0,0}
T.spin[i]={0,0,0,0,0,0,0,0,0,0,0,0}
T.clears[i]=0
T.spins[i]=0
end
return T
end
local function _newEmptyPlayer(id,mini)
Expand Down
Loading
Loading