diff --git a/tetris/components/grid.lua b/tetris/components/grid.lua index 9f61a61..0605bb3 100644 --- a/tetris/components/grid.lua +++ b/tetris/components/grid.lua @@ -310,7 +310,9 @@ function Grid:draw() end end -function Grid:drawInvisible(opacity_function, garbage_opacity_function) +function Grid:drawInvisible(opacity_function, garbage_opacity_function, lock_flash, brightness) + lock_flash = lock_flash == nil and true or lock_flash + brightness = brightness == nil and 0.5 or brightness for y = 5, 24 do for x = 1, 10 do if self.grid[y][x] ~= empty then @@ -321,22 +323,24 @@ function Grid:drawInvisible(opacity_function, garbage_opacity_function) else opacity = opacity_function(self.grid_age[y][x]) end - love.graphics.setColor(0.5, 0.5, 0.5, opacity) + love.graphics.setColor(brightness, brightness, brightness, opacity) love.graphics.draw(blocks[self.grid[y][x].skin][self.grid[y][x].colour], 48+x*16, y*16) - if opacity > 0 and self.grid[y][x].colour ~= "X" then - love.graphics.setColor(0.64, 0.64, 0.64) - love.graphics.setLineWidth(1) - if y > 1 and self.grid[y-1][x] == empty then - love.graphics.line(48.0+x*16, -0.5+y*16, 64.0+x*16, -0.5+y*16) - end - if y < 24 and self.grid[y+1][x] == empty then - love.graphics.line(48.0+x*16, 16.5+y*16, 64.0+x*16, 16.5+y*16) - end - if x > 1 and self.grid[y][x-1] == empty then - love.graphics.line(47.5+x*16, -0.0+y*16, 47.5+x*16, 16.0+y*16) - end - if x < 10 and self.grid[y][x+1] == empty then - love.graphics.line(64.5+x*16, -0.0+y*16, 64.5+x*16, 16.0+y*16) + if lock_flash then + if opacity > 0 and self.grid[y][x].colour ~= "X" then + love.graphics.setColor(0.64, 0.64, 0.64) + love.graphics.setLineWidth(1) + if y > 1 and self.grid[y-1][x] == empty then + love.graphics.line(48.0+x*16, -0.5+y*16, 64.0+x*16, -0.5+y*16) + end + if y < 24 and self.grid[y+1][x] == empty then + love.graphics.line(48.0+x*16, 16.5+y*16, 64.0+x*16, 16.5+y*16) + end + if x > 1 and self.grid[y][x-1] == empty then + love.graphics.line(47.5+x*16, -0.0+y*16, 47.5+x*16, 16.0+y*16) + end + if x < 10 and self.grid[y][x+1] == empty then + love.graphics.line(64.5+x*16, -0.0+y*16, 64.5+x*16, 16.0+y*16) + end end end end diff --git a/tetris/modes/big_a2.lua b/tetris/modes/big_a2.lua index dfea465..3fe3e8f 100755 --- a/tetris/modes/big_a2.lua +++ b/tetris/modes/big_a2.lua @@ -250,7 +250,7 @@ end function MarathonA2Game:drawGrid(ruleset) if self.clear and not (self.completed or self.game_over) then - self.grid:drawInvisible(self.rollOpacityFunction) + self.grid:drawInvisible(self.rollOpacityFunction, nil, false) else self.grid:draw() if self.piece ~= nil and self.level < 100 then diff --git a/tetris/modes/marathon_a2.lua b/tetris/modes/marathon_a2.lua index 120ed67..e0847fa 100644 --- a/tetris/modes/marathon_a2.lua +++ b/tetris/modes/marathon_a2.lua @@ -305,10 +305,17 @@ MarathonA2Game.rollOpacityFunction = function(age) else return 1 - (age - 240) / 60 end end -function MarathonA2Game:drawGrid(ruleset) +MarathonA2Game.mRollOpacityFunction = function(age) + if age > 4 then return 0 + else return 1 - age / 4 end +end + +function MarathonA2Game:drawGrid() if self.clear and not (self.completed or self.game_over) then - if not self:qualifiesForMRoll() then - self.grid:drawInvisible(self.rollOpacityFunction) + if self:qualifiesForMRoll() then + self.grid:drawInvisible(self.mRollOpacityFunction, nil, false) + else + self.grid:drawInvisible(self.rollOpacityFunction, nil, false) end else self.grid:draw() diff --git a/tetris/modes/marathon_a3.lua b/tetris/modes/marathon_a3.lua index a0b475c..b263927 100644 --- a/tetris/modes/marathon_a3.lua +++ b/tetris/modes/marathon_a3.lua @@ -231,8 +231,8 @@ function MarathonA3Game:updateSectionTimes(old_level, new_level) end function MarathonA3Game:updateScore(level, drop_bonus, cleared_lines) - if not self.clear then - self:updateGrade(cleared_lines) + self:updateGrade(cleared_lines) + if not self.clear then if cleared_lines > 0 then self.combo = self.combo + (cleared_lines - 1) * 2 self.score = self.score + ( diff --git a/tetris/modes/phantom_mania.lua b/tetris/modes/phantom_mania.lua index 3ae9f39..e024f9a 100644 --- a/tetris/modes/phantom_mania.lua +++ b/tetris/modes/phantom_mania.lua @@ -139,7 +139,7 @@ end function PhantomManiaGame:drawGrid() if not (self.game_over or self.clear) then - self.grid:drawInvisible(self.rollOpacityFunction) + self.grid:drawInvisible(self.rollOpacityFunction, nil, false) else self.grid:draw() end diff --git a/tetris/modes/phantom_mania_n.lua b/tetris/modes/phantom_mania_n.lua new file mode 100644 index 0000000..e39d03d --- /dev/null +++ b/tetris/modes/phantom_mania_n.lua @@ -0,0 +1,22 @@ +local PhantomManiaGame = require 'tetris.modes.phantom_mania' + +local PhantomManiaNGame = PhantomManiaGame:extend() + +PhantomManiaNGame.name = "Phantom Mania N" +PhantomManiaNGame.hash = "PhantomManiaN" +PhantomManiaNGame.tagline = "The old mode from Nullpomino, for Ti-ARS and SRS support." + +function PhantomManiaNGame:new() + PhantomManiaNGame.super:new() + + self.SGnames = { + "M1", "M2", "M3", "M4", "M5", "M6", "M7", "M8", "M9", + "M10", "M11", "M12", "M13", "M14", "M15", "M16", "M17", "M18", + "GM" + } + + self.next_queue_length = 3 + self.enable_hold = true +end + +return PhantomManiaNGame