Cleaned up TAP M-roll

pull/13/head
Ishaan Bhardwaj 2020-11-14 09:35:16 -05:00
parent b9b71e90bb
commit 721acefea0
6 changed files with 56 additions and 23 deletions

View File

@ -310,7 +310,9 @@ function Grid:draw()
end end
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 y = 5, 24 do
for x = 1, 10 do for x = 1, 10 do
if self.grid[y][x] ~= empty then if self.grid[y][x] ~= empty then
@ -321,22 +323,24 @@ function Grid:drawInvisible(opacity_function, garbage_opacity_function)
else else
opacity = opacity_function(self.grid_age[y][x]) opacity = opacity_function(self.grid_age[y][x])
end 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) 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 if lock_flash then
love.graphics.setColor(0.64, 0.64, 0.64) if opacity > 0 and self.grid[y][x].colour ~= "X" then
love.graphics.setLineWidth(1) love.graphics.setColor(0.64, 0.64, 0.64)
if y > 1 and self.grid[y-1][x] == empty then love.graphics.setLineWidth(1)
love.graphics.line(48.0+x*16, -0.5+y*16, 64.0+x*16, -0.5+y*16) if y > 1 and self.grid[y-1][x] == empty then
end love.graphics.line(48.0+x*16, -0.5+y*16, 64.0+x*16, -0.5+y*16)
if y < 24 and self.grid[y+1][x] == empty then end
love.graphics.line(48.0+x*16, 16.5+y*16, 64.0+x*16, 16.5+y*16) if y < 24 and self.grid[y+1][x] == empty then
end love.graphics.line(48.0+x*16, 16.5+y*16, 64.0+x*16, 16.5+y*16)
if x > 1 and self.grid[y][x-1] == empty then end
love.graphics.line(47.5+x*16, -0.0+y*16, 47.5+x*16, 16.0+y*16) if x > 1 and self.grid[y][x-1] == empty then
end love.graphics.line(47.5+x*16, -0.0+y*16, 47.5+x*16, 16.0+y*16)
if x < 10 and self.grid[y][x+1] == empty then end
love.graphics.line(64.5+x*16, -0.0+y*16, 64.5+x*16, 16.0+y*16) 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 end
end end

View File

@ -250,7 +250,7 @@ end
function MarathonA2Game:drawGrid(ruleset) function MarathonA2Game:drawGrid(ruleset)
if self.clear and not (self.completed or self.game_over) then 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 else
self.grid:draw() self.grid:draw()
if self.piece ~= nil and self.level < 100 then if self.piece ~= nil and self.level < 100 then

View File

@ -305,10 +305,17 @@ MarathonA2Game.rollOpacityFunction = function(age)
else return 1 - (age - 240) / 60 end else return 1 - (age - 240) / 60 end
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 self.clear and not (self.completed or self.game_over) then
if not self:qualifiesForMRoll() then if self:qualifiesForMRoll() then
self.grid:drawInvisible(self.rollOpacityFunction) self.grid:drawInvisible(self.mRollOpacityFunction, nil, false)
else
self.grid:drawInvisible(self.rollOpacityFunction, nil, false)
end end
else else
self.grid:draw() self.grid:draw()

View File

@ -231,8 +231,8 @@ function MarathonA3Game:updateSectionTimes(old_level, new_level)
end end
function MarathonA3Game:updateScore(level, drop_bonus, cleared_lines) function MarathonA3Game:updateScore(level, drop_bonus, cleared_lines)
self:updateGrade(cleared_lines)
if not self.clear then if not self.clear then
self:updateGrade(cleared_lines)
if cleared_lines > 0 then if cleared_lines > 0 then
self.combo = self.combo + (cleared_lines - 1) * 2 self.combo = self.combo + (cleared_lines - 1) * 2
self.score = self.score + ( self.score = self.score + (

View File

@ -139,7 +139,7 @@ end
function PhantomManiaGame:drawGrid() function PhantomManiaGame:drawGrid()
if not (self.game_over or self.clear) then if not (self.game_over or self.clear) then
self.grid:drawInvisible(self.rollOpacityFunction) self.grid:drawInvisible(self.rollOpacityFunction, nil, false)
else else
self.grid:draw() self.grid:draw()
end end

View File

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