Fix rotation kicks and hope it works

This commit is contained in:
SweetSea
2024-10-27 14:45:27 +07:00
parent af659a69fe
commit d3b63569dc
4 changed files with 34 additions and 31 deletions

View File

@@ -81,6 +81,7 @@ function Grid:getClearedRowCount()
table.insert(cleared_row_table, row)
end
end
if BIG_MODE or PENTO_MODE then count = count * 0.5 end
return count, cleared_row_table
end

View File

@@ -23,16 +23,16 @@ Rotation.colourscheme = {
T = "C",
}
local a = {
{x=0, y=0}, {x=1, y=0}, {x=2, y=0}, {x=3, y=0}, {x=4, y=0}, {x=5, y=0}, {x=6, y=0}, {x=7, y=0},
{x=0, y=1}, {x=1, y=1}, {x=2, y=1}, {x=3, y=1}, {x=4, y=1}, {x=5, y=1}, {x=6, y=1}, {x=7, y=1},
{x=0, y=2}, {x=1, y=2}, {x=2, y=2}, {x=3, y=2}, {x=4, y=2}, {x=5, y=2}, {x=6, y=2}, {x=7, y=2},
{x=0, y=3}, {x=1, y=3}, {x=2, y=3}, {x=3, y=3}, {x=4, y=3}, {x=5, y=3}, {x=6, y=3}, {x=7, y=3},
{x=0, y=4}, {x=1, y=4}, {x=2, y=4}, {x=3, y=4}, {x=4, y=4}, {x=5, y=4}, {x=6, y=4}, {x=7, y=4},
{x=0, y=5}, {x=1, y=5}, {x=2, y=5}, {x=3, y=5}, {x=4, y=5}, {x=5, y=5}, {x=6, y=5}, {x=7, y=5},
{x=0, y=6}, {x=1, y=6}, {x=2, y=6}, {x=3, y=6}, {x=4, y=6}, {x=5, y=6}, {x=6, y=6}, {x=7, y=6},
{x=0, y=7}, {x=1, y=7}, {x=2, y=7}, {x=3, y=7}, {x=4, y=7}, {x=5, y=7}, {x=6, y=7}, {x=7, y=7},
}
-- local a = {
-- {x=0, y=0}, {x=1, y=0}, {x=2, y=0}, {x=3, y=0}, {x=4, y=0}, {x=5, y=0}, {x=6, y=0}, {x=7, y=0},
-- {x=0, y=1}, {x=1, y=1}, {x=2, y=1}, {x=3, y=1}, {x=4, y=1}, {x=5, y=1}, {x=6, y=1}, {x=7, y=1},
-- {x=0, y=2}, {x=1, y=2}, {x=2, y=2}, {x=3, y=2}, {x=4, y=2}, {x=5, y=2}, {x=6, y=2}, {x=7, y=2},
-- {x=0, y=3}, {x=1, y=3}, {x=2, y=3}, {x=3, y=3}, {x=4, y=3}, {x=5, y=3}, {x=6, y=3}, {x=7, y=3},
-- {x=0, y=4}, {x=1, y=4}, {x=2, y=4}, {x=3, y=4}, {x=4, y=4}, {x=5, y=4}, {x=6, y=4}, {x=7, y=4},
-- {x=0, y=5}, {x=1, y=5}, {x=2, y=5}, {x=3, y=5}, {x=4, y=5}, {x=5, y=5}, {x=6, y=5}, {x=7, y=5},
-- {x=0, y=6}, {x=1, y=6}, {x=2, y=6}, {x=3, y=6}, {x=4, y=6}, {x=5, y=6}, {x=6, y=6}, {x=7, y=6},
-- {x=0, y=7}, {x=1, y=7}, {x=2, y=7}, {x=3, y=7}, {x=4, y=7}, {x=5, y=7}, {x=6, y=7}, {x=7, y=7},
-- }
Rotation.block_offsets = {
I={
@@ -311,31 +311,33 @@ function Rotation:attemptWallkicks(piece, new_piece, rot_dir, grid, lastdir)
local x = piece.position.x + offset.x
local y = piece.position.y + offset.y
if offset.x == 0 then left_exists = true end
if offset.x == 2 or offset.x == 3 then right_exists = true end
if offset.x >= 4 and offset.x <= 7 then right_exists = true end
-- Read rotation.lua line 141 for original implementation
-- As where everything here are double-sized so the position is shifted
if grid:isOccupied(x,y) then
if offset.y == 0 then sides.top = true end
if offset.y == 3 then sides.bottom = true end
if offset.y == 1 and offset.x == 0 then sides.uleft = true end
if offset.y == 2 and offset.x == 0 then sides.lleft = true end
if offset.y == 1 and (offset.x == 2 or offset.x == 3) then sides.uright = true end
if offset.y == 2 and (offset.x == 2 or offset.x == 3) then sides.lright = true end
if offset.x == 1 then sides.center = true end
if (offset.y == 0 or offset.y == 1) then sides.top = true end
if (offset.y == 6 or offset.y == 7) then sides.bottom = true end
if (offset.y == 2 or offset.y == 3) and (offset.x == 0 or offset.x == 1) then sides.uleft = true end
if (offset.y == 4 or offset.y == 5) and (offset.x == 0 or offset.x == 1) then sides.lleft = true end
if (offset.y == 2 or offset.y == 3) and (offset.x >= 4 and offset.x <= 7) then sides.uright = true end
if (offset.y == 4 or offset.y == 5) and (offset.x >= 4 and offset.x <= 7) then sides.lright = true end
if (offset.x == 2 or offset.x == 3) then sides.center = true end
end
end
if sides.top then kick = {x=0,y=1}
elseif (sides.uleft and sides.lright) or (sides.uright and sides.lleft) or (sides.uright and sides.uleft) then kick = {x=0,y=1}
elseif (sides.lleft and sides.lright) then kick = {x=0,y=-1}
elseif (sides.lleft or sides.uleft) then kick = {x=1,y=0}
elseif (sides.lright or sides.uright) then kick = {x=-1,y=0}
elseif sides.center and left_exists then kick = {x=1,y=0}
elseif sides.center and right_exists then kick = {x=-1,y=0}
elseif sides.bottom then kick = {x=0,y=-1}
if sides.top then kick = {x=0,y=2}
elseif (sides.uleft and sides.lright) or (sides.uright and sides.lleft) or (sides.uright and sides.uleft) then kick = {x=0,y=2}
elseif (sides.lleft and sides.lright) then kick = {x=0,y=-2}
elseif (sides.lleft or sides.uleft) then kick = {x=2,y=0}
elseif (sides.lright or sides.uright) then kick = {x=-2,y=0}
elseif sides.center and left_exists then kick = {x=2,y=0}
elseif sides.center and right_exists then kick = {x=-2,y=0}
elseif sides.bottom then kick = {x=0,y=-2}
end
-- Attempt to push the piece 2 blocks away since it is in double size
local kick_double = {x=kick[x]*2,kick[y]*2}
local kick_double = {x=kick.x*2, y=kick.y*2}
if grid:canPlacePiece(new_piece:withOffset({x=0,y=0})) then
self:onPieceRotate(piece, grid)
@@ -344,8 +346,8 @@ function Rotation:attemptWallkicks(piece, new_piece, rot_dir, grid, lastdir)
self:onPieceRotate(piece, grid)
piece:setRelativeRotation(rot_dir):setOffset(kick)
elseif grid:canPlacePiece(new_piece:withOffset(kick_double)) then
self:onPieceRotate(piece, grid)
piece:setRelativeRotation(rot_dir):setOffset(kick_double)
-- self:onPieceRotate(piece, grid)
-- piece:setRelativeRotation(rot_dir):setOffset(kick_double)
end
end

View File

@@ -52,7 +52,7 @@ function Title2Scene:new()
love.audio.stop()
end
self.main_menu_state = 1
PENTO_MODE = false
PENTO_MODE = true
input_code = {0,0,0,0,0,0,0,0}
end

View File

@@ -13,7 +13,7 @@ function TrainingScene:new()
game_mode = require 'game.gamemode'
if PENTO_MODE then
ruleset = require 'game.rotation_pent'
ruleset = require 'game.rotation_big'
else
ruleset = require 'game.rotation'
end