Fixed colour scheme issues for non-standard piece sets

This commit is contained in:
Ishaan Bhardwaj 2021-03-10 13:58:08 -05:00
parent 2189e3a7b8
commit 116284f31c
2 changed files with 15 additions and 3 deletions

View File

@ -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

View File

@ -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)