Classic lock (GB/NES-like) added as a gamemode var

This commit is contained in:
Ishaan Bhardwaj 2021-02-11 15:46:56 -05:00
parent acb05918c1
commit af02cd3467
2 changed files with 18 additions and 11 deletions

View File

@ -45,6 +45,7 @@ function GameMode:new(secret_inputs)
self.enable_hard_drop = true
self.next_queue_length = 1
self.additive_gravity = true
self.classic_lock = false
self.draw_section_times = false
self.draw_secondary_section_times = false
self.big_mode = false
@ -194,7 +195,7 @@ function GameMode:update(inputs, ruleset)
inputs, self.piece, self.grid, self:getGravity(), self.prev_inputs,
self.move, self:getLockDelay(), self:getDropSpeed(),
self.drop_locked, self.hard_drop_locked,
self.enable_hard_drop, self.additive_gravity
self.enable_hard_drop, self.additive_gravity, self.classic_lock
)
local piece_dy = self.piece.position.y - piece_y
@ -578,7 +579,7 @@ function GameMode:drawLineClearAnimation()
-- TGM1 pop-out
--[[
function animation(x, y, skin, colour)
local p = 0.48
local p = 0.5
local l = (
(self:getLineClearDelay() - self.lcd) / self:getLineClearDelay()
)
@ -609,12 +610,15 @@ end
function GameMode:drawPiece()
if self.piece ~= nil then
self.piece:draw(
1,
self:getLockDelay() == 0 and 1 or
(0.25 + 0.75 * math.max(1 - self.piece.gravity, 1 - (self.piece.lock_delay / self:getLockDelay()))),
self.grid
local b = (
self.classic_lock and
(
self.piece:isDropBlocked(self.grid) and
1 - self.piece.gravity or 1
) or
1 - (self.piece.lock_delay / self:getLockDelay())
)
self.piece:draw(1, 0.25 + 0.75 * b, self.grid)
end
end

View File

@ -209,8 +209,11 @@ function Ruleset:dropPiece(
end
end
function Ruleset:lockPiece(piece, grid, lock_delay)
if piece:isDropBlocked(grid) and piece.gravity >= 1 and piece.lock_delay >= lock_delay then
function Ruleset:lockPiece(piece, grid, lock_delay, classic_lock)
if piece:isDropBlocked(grid) and (
(classic_lock and piece.gravity >= 1) or
(not classic_lock and piece.lock_delay >= lock_delay)
) then
piece.locked = true
end
end
@ -286,7 +289,7 @@ function Ruleset:processPiece(
inputs, piece, grid, gravity, prev_inputs,
move, lock_delay, drop_speed,
drop_locked, hard_drop_locked,
hard_drop_enabled, additive_gravity
hard_drop_enabled, additive_gravity, classic_lock
)
local synchroes_allowed = ({not self.world, true, false})[config.gamesettings.synchroes_allowed]
@ -302,7 +305,7 @@ function Ruleset:processPiece(
inputs, piece, grid, gravity, drop_speed, drop_locked, hard_drop_locked,
hard_drop_enabled, additive_gravity
)
self:lockPiece(piece, grid, lock_delay)
self:lockPiece(piece, grid, lock_delay, classic_lock)
end
function Ruleset:onPieceMove(piece) end