diff --git a/tetris/components/grid.lua b/tetris/components/grid.lua index bed526e..fa89d23 100644 --- a/tetris/components/grid.lua +++ b/tetris/components/grid.lua @@ -394,7 +394,8 @@ end function Grid:draw() for y = 5, self.height do for x = 1, self.width do - if self.grid[y][x] ~= empty then + if blocks[self.grid[y][x].skin] and + blocks[self.grid[y][x].skin][self.grid[y][x].colour] then if self.grid_age[y][x] < 2 then love.graphics.setColor(1, 1, 1, 1) love.graphics.draw(blocks[self.grid[y][x].skin]["F"], 48+x*16, y*16) diff --git a/tetris/modes/gamemode.lua b/tetris/modes/gamemode.lua index c6a4c50..ff76f16 100644 --- a/tetris/modes/gamemode.lua +++ b/tetris/modes/gamemode.lua @@ -264,6 +264,7 @@ function GameMode:update(inputs, ruleset) ) if self.lcd == 0 then self.grid:clearClearedRows() + self:afterLineClear(cleared_row_count) if self.are == 0 then self:initializeOrHold(inputs, ruleset) end @@ -300,6 +301,7 @@ function GameMode:onPieceLock(piece, cleared_row_count) end function GameMode:onLineClear(cleared_row_count) end +function GameMode:afterLineClear(cleared_row_count) end function GameMode:onPieceEnter() end function GameMode:onHold() end @@ -431,7 +433,9 @@ function GameMode:processDelays(inputs, ruleset, drop_speed) self.lcd = self.lcd - 1 self:areCancel(inputs, ruleset) if self.lcd == 0 then + local cleared_row_count = self.grid:getClearedRowCount() self.grid:clearClearedRows() + self:afterLineClear(cleared_row_count) playSE("fall") if self.are == 0 then self:initializeOrHold(inputs, ruleset) @@ -759,7 +763,9 @@ function GameMode:drawSectionTimesWithSecondary(current_section, section_limit) end end -function GameMode:drawSectionTimesWithSplits(current_section) +function GameMode:drawSectionTimesWithSplits(current_section, section_limit) + section_limit = section_limit or math.huge + local section_x = 440 local split_x = 530 @@ -773,8 +779,11 @@ function GameMode:drawSectionTimesWithSplits(current_section) end end - love.graphics.printf(formatTime(self.frames - self.section_start_time), section_x, 40 + 20 * current_section, 90, "left") - love.graphics.printf(formatTime(self.frames), split_x, 40 + 20 * current_section, 90, "left") + if (current_section <= section_limit) then + love.graphics.setColor(self:sectionColourFunction(current_section)) + love.graphics.printf(formatTime(self.frames - self.section_start_time), section_x, 40 + 20 * current_section, 90, "left") + love.graphics.printf(formatTime(self.frames), split_x, 40 + 20 * current_section, 90, "left") + end end function GameMode:drawCustom() end