From d3b63569dc2f19c2e970db0c6f48726697c1e4fa Mon Sep 17 00:00:00 2001 From: SweetSea <106439598+SweetSea-ButImNotSweet@users.noreply.github.com> Date: Sun, 27 Oct 2024 14:45:27 +0700 Subject: [PATCH] Fix rotation kicks and hope it works --- game/grid.lua | 1 + game/rotation_big.lua | 60 ++++++++++++++++++++++--------------------- scene/title2.lua | 2 +- scene/training.lua | 2 +- 4 files changed, 34 insertions(+), 31 deletions(-) diff --git a/game/grid.lua b/game/grid.lua index 7b08fdc..43ec1c4 100644 --- a/game/grid.lua +++ b/game/grid.lua @@ -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 diff --git a/game/rotation_big.lua b/game/rotation_big.lua index 302d1e5..cf878fc 100644 --- a/game/rotation_big.lua +++ b/game/rotation_big.lua @@ -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 diff --git a/scene/title2.lua b/scene/title2.lua index 9ec6b8d..aec8adf 100644 --- a/scene/title2.lua +++ b/scene/title2.lua @@ -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 diff --git a/scene/training.lua b/scene/training.lua index ab389bc..d244d1d 100644 --- a/scene/training.lua +++ b/scene/training.lua @@ -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