From 9b04e1438825021d8f33afa1437c95e2a81597de Mon Sep 17 00:00:00 2001 From: Joe Zeng Date: Fri, 6 Nov 2020 19:17:32 -0500 Subject: [PATCH] Added "Always reverse" option for rotation reversal. --- scene/game_config.lua | 6 +++--- tetris/rulesets/arika.lua | 9 ++++++++- tetris/rulesets/arika_ace.lua | 9 ++++++++- tetris/rulesets/arika_ace2.lua | 9 ++++++++- tetris/rulesets/arika_srs.lua | 9 ++++++++- tetris/rulesets/arika_ti.lua | 9 ++++++++- tetris/rulesets/crap.lua | 2 +- tetris/rulesets/ruleset.lua | 2 +- tetris/rulesets/ti_srs.lua | 9 ++++++++- tetris/rulesets/unrefactored_rulesets/tengen.lua | 9 ++++++++- 10 files changed, 61 insertions(+), 12 deletions(-) diff --git a/scene/game_config.lua b/scene/game_config.lua index f1edd74..d2eafe6 100644 --- a/scene/game_config.lua +++ b/scene/game_config.lua @@ -6,9 +6,9 @@ require 'load.save' ConfigScene.options = { -- this serves as reference to what the options' values mean i guess? - {"manlock", "Manual locking", {"Per ruleset","Per gamemode","Harddrop", "Softdrop"}}, - {"piece_colour", "Piece Colours", {"Per ruleset", "Arika", "TTC"}}, - {"world_reverse", "World Reverse", {"No", "Yes"}}, + {"manlock", "Manual locking",{"Per ruleset","Per gamemode","Harddrop", "Softdrop"}}, + {"piece_colour", "Piece Colours", {"Per ruleset","Arika" ,"TTC"}}, + {"world_reverse","World Reverse", {"No" ,"SRS only" ,"Always"}}, } local optioncount = #ConfigScene.options diff --git a/tetris/rulesets/arika.lua b/tetris/rulesets/arika.lua index 89fa6d8..ea4f64d 100644 --- a/tetris/rulesets/arika.lua +++ b/tetris/rulesets/arika.lua @@ -110,7 +110,14 @@ function ARS:onPieceDrop(piece, grid) piece.lock_delay = 0 -- step reset end -function ARS:get180RotationValue() return 3 end +function ARS:get180RotationValue() + if config.gamesettings.world_reverse == 3 then + return 3 + else + return 1 + end +end + function ARS:getDefaultOrientation() return 3 end -- downward facing pieces by default return ARS diff --git a/tetris/rulesets/arika_ace.lua b/tetris/rulesets/arika_ace.lua index 76f095d..a42af0c 100755 --- a/tetris/rulesets/arika_ace.lua +++ b/tetris/rulesets/arika_ace.lua @@ -185,7 +185,14 @@ function ARS:onPieceRotate(piece, grid) end end -function ARS:get180RotationValue() return 3 end +function ARS:get180RotationValue() + if config.gamesettings.world_reverse == 3 then + return 3 + else + return 1 + end +end + function ARS:getDefaultOrientation() return 3 end -- downward facing pieces by default return ARS diff --git a/tetris/rulesets/arika_ace2.lua b/tetris/rulesets/arika_ace2.lua index 2d90b48..0bc5156 100644 --- a/tetris/rulesets/arika_ace2.lua +++ b/tetris/rulesets/arika_ace2.lua @@ -172,7 +172,14 @@ function ARS:onPieceRotate(piece, grid) end end -function ARS:get180RotationValue() return 3 end +function ARS:get180RotationValue() + if config.gamesettings.world_reverse == 3 then + return 3 + else + return 1 + end +end + function ARS:getDefaultOrientation() return 3 end -- downward facing pieces by default return ARS diff --git a/tetris/rulesets/arika_srs.lua b/tetris/rulesets/arika_srs.lua index d4cef13..6d32566 100755 --- a/tetris/rulesets/arika_srs.lua +++ b/tetris/rulesets/arika_srs.lua @@ -184,5 +184,12 @@ function SRS:onPieceRotate(piece, grid) end end -function SRS:get180RotationValue() return 3 end +function SRS:get180RotationValue() + if config.gamesettings.world_reverse == 1 then + return 1 + else + return 3 + end +end + return SRS diff --git a/tetris/rulesets/arika_ti.lua b/tetris/rulesets/arika_ti.lua index eec3320..8afdff9 100644 --- a/tetris/rulesets/arika_ti.lua +++ b/tetris/rulesets/arika_ti.lua @@ -151,7 +151,14 @@ function ARS:onPieceDrop(piece, grid) piece.lock_delay = 0 -- step reset end -function ARS:get180RotationValue() return 3 end +function ARS:get180RotationValue() + if config.gamesettings.world_reverse == 3 then + return 3 + else + return 1 + end +end + function ARS:getDefaultOrientation() return 3 end -- downward facing pieces by default return ARS diff --git a/tetris/rulesets/crap.lua b/tetris/rulesets/crap.lua index 339c5db..7450f1d 100644 --- a/tetris/rulesets/crap.lua +++ b/tetris/rulesets/crap.lua @@ -100,7 +100,7 @@ function CRAP:attemptRotate(new_inputs, piece, grid, initial) end if rot_dir == 0 then return end - if self.world and config.gamesettings.world_reverse == 2 then + if config.gamesettings.world_reverse == 3 or (self.world and config.gamesettings.world_reverse == 2) then rot_dir = 4 - rot_dir end diff --git a/tetris/rulesets/ruleset.lua b/tetris/rulesets/ruleset.lua index 6cf0c3d..c9cdc42 100644 --- a/tetris/rulesets/ruleset.lua +++ b/tetris/rulesets/ruleset.lua @@ -76,7 +76,7 @@ function Ruleset:attemptRotate(new_inputs, piece, grid, initial) end if rot_dir == 0 then return end - if self.world and config.gamesettings.world_reverse == 2 then + if config.gamesettings.world_reverse == 3 or (self.world and config.gamesettings.world_reverse == 2) then rot_dir = 4 - rot_dir end diff --git a/tetris/rulesets/ti_srs.lua b/tetris/rulesets/ti_srs.lua index d7d51e6..7d9c8e1 100644 --- a/tetris/rulesets/ti_srs.lua +++ b/tetris/rulesets/ti_srs.lua @@ -185,5 +185,12 @@ function SRS:onPieceRotate(piece, grid) end end -function SRS:get180RotationValue() return 3 end +function SRS:get180RotationValue() + if config.gamesettings.world_reverse == 1 then + return 1 + else + return 3 + end +end + return SRS diff --git a/tetris/rulesets/unrefactored_rulesets/tengen.lua b/tetris/rulesets/unrefactored_rulesets/tengen.lua index 9b6ccfd..723826f 100644 --- a/tetris/rulesets/unrefactored_rulesets/tengen.lua +++ b/tetris/rulesets/unrefactored_rulesets/tengen.lua @@ -127,7 +127,14 @@ function Tengen:onPieceDrop(piece, grid) piece.lock_delay = 0 -- step reset end -function Tengen:get180RotationValue() return config["reverse_rotate"] and 1 or 3 end +function Tengen:get180RotationValue() + if config.gamesettings.world_reverse == 3 then + return 1 + else + return 3 + end +end + function Tengen:getDefaultOrientation() return 3 end -- downward facing pieces by default return Tengen