From 116284f31ca3730261f9a86706d0a59097e367c1 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Wed, 10 Mar 2021 13:58:08 -0500 Subject: [PATCH] Fixed colour scheme issues for non-standard piece sets --- tetris/modes/gamemode.lua | 8 +++++++- tetris/rulesets/ruleset.lua | 10 ++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/tetris/modes/gamemode.lua b/tetris/modes/gamemode.lua index 0765782..fda4e61 100644 --- a/tetris/modes/gamemode.lua +++ b/tetris/modes/gamemode.lua @@ -676,11 +676,17 @@ function GameMode:drawGhostPiece(ruleset) end function GameMode:drawNextQueue(ruleset) - local colourscheme = ({ruleset.colourscheme, ColourSchemes.Arika, ColourSchemes.TTC})[config.gamesettings.piece_colour] + local colourscheme + if ruleset.pieces == 7 then + colourscheme = ({ruleset.colourscheme, ColourSchemes.Arika, ColourSchemes.TTC})[config.gamesettings.piece_colour] + else + colourscheme = ruleset.colourscheme + end function drawPiece(piece, skin, offsets, pos_x, pos_y) for index, offset in pairs(offsets) do local x = offset.x + ruleset:getDrawOffset(piece, rotation).x + ruleset.spawn_positions[piece].x local y = offset.y + ruleset:getDrawOffset(piece, rotation).y + 4.7 + print(piece, colourscheme[piece]) love.graphics.draw(blocks[skin][colourscheme[piece]], pos_x+x*16, pos_y+y*16) end end diff --git a/tetris/rulesets/ruleset.lua b/tetris/rulesets/ruleset.lua index d36882c..e5cff03 100644 --- a/tetris/rulesets/ruleset.lua +++ b/tetris/rulesets/ruleset.lua @@ -249,7 +249,13 @@ function Ruleset:initializePiece( else spawn_positions = self.spawn_positions end - local colours = ({self.colourscheme, ColourSchemes.Arika, ColourSchemes.TTC})[config.gamesettings.piece_colour] + + local colours + if self.pieces == 7 then + colours = ({self.colourscheme, ColourSchemes.Arika, ColourSchemes.TTC})[config.gamesettings.piece_colour] + else + colours = self.colourscheme + end local spawn_x if (grid.width ~= 10) then @@ -276,7 +282,7 @@ function Ruleset:initializePiece( end local piece = Piece(data.shape, data.orientation - 1, { - x = spawn_x and spawn_x or spawn_positions[data.shape].x, + x = spawn_x or spawn_positions[data.shape].x, y = spawn_positions[data.shape].y - spawn_dy }, self.block_offsets, 0, 0, data.skin, colours[data.shape], big)