mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 19:19:02 -06:00
Classic lock (GB/NES-like) added as a gamemode var
This commit is contained in:
parent
acb05918c1
commit
af02cd3467
@ -45,6 +45,7 @@ function GameMode:new(secret_inputs)
|
|||||||
self.enable_hard_drop = true
|
self.enable_hard_drop = true
|
||||||
self.next_queue_length = 1
|
self.next_queue_length = 1
|
||||||
self.additive_gravity = true
|
self.additive_gravity = true
|
||||||
|
self.classic_lock = false
|
||||||
self.draw_section_times = false
|
self.draw_section_times = false
|
||||||
self.draw_secondary_section_times = false
|
self.draw_secondary_section_times = false
|
||||||
self.big_mode = false
|
self.big_mode = false
|
||||||
@ -194,7 +195,7 @@ function GameMode:update(inputs, ruleset)
|
|||||||
inputs, self.piece, self.grid, self:getGravity(), self.prev_inputs,
|
inputs, self.piece, self.grid, self:getGravity(), self.prev_inputs,
|
||||||
self.move, self:getLockDelay(), self:getDropSpeed(),
|
self.move, self:getLockDelay(), self:getDropSpeed(),
|
||||||
self.drop_locked, self.hard_drop_locked,
|
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
|
local piece_dy = self.piece.position.y - piece_y
|
||||||
@ -578,7 +579,7 @@ function GameMode:drawLineClearAnimation()
|
|||||||
-- TGM1 pop-out
|
-- TGM1 pop-out
|
||||||
--[[
|
--[[
|
||||||
function animation(x, y, skin, colour)
|
function animation(x, y, skin, colour)
|
||||||
local p = 0.48
|
local p = 0.5
|
||||||
local l = (
|
local l = (
|
||||||
(self:getLineClearDelay() - self.lcd) / self:getLineClearDelay()
|
(self:getLineClearDelay() - self.lcd) / self:getLineClearDelay()
|
||||||
)
|
)
|
||||||
@ -609,12 +610,15 @@ end
|
|||||||
|
|
||||||
function GameMode:drawPiece()
|
function GameMode:drawPiece()
|
||||||
if self.piece ~= nil then
|
if self.piece ~= nil then
|
||||||
self.piece:draw(
|
local b = (
|
||||||
1,
|
self.classic_lock and
|
||||||
self:getLockDelay() == 0 and 1 or
|
(
|
||||||
(0.25 + 0.75 * math.max(1 - self.piece.gravity, 1 - (self.piece.lock_delay / self:getLockDelay()))),
|
self.piece:isDropBlocked(self.grid) and
|
||||||
self.grid
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -209,8 +209,11 @@ function Ruleset:dropPiece(
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Ruleset:lockPiece(piece, grid, lock_delay)
|
function Ruleset:lockPiece(piece, grid, lock_delay, classic_lock)
|
||||||
if piece:isDropBlocked(grid) and piece.gravity >= 1 and piece.lock_delay >= lock_delay then
|
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
|
piece.locked = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -286,7 +289,7 @@ function Ruleset:processPiece(
|
|||||||
inputs, piece, grid, gravity, prev_inputs,
|
inputs, piece, grid, gravity, prev_inputs,
|
||||||
move, lock_delay, drop_speed,
|
move, lock_delay, drop_speed,
|
||||||
drop_locked, hard_drop_locked,
|
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]
|
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,
|
inputs, piece, grid, gravity, drop_speed, drop_locked, hard_drop_locked,
|
||||||
hard_drop_enabled, additive_gravity
|
hard_drop_enabled, additive_gravity
|
||||||
)
|
)
|
||||||
self:lockPiece(piece, grid, lock_delay)
|
self:lockPiece(piece, grid, lock_delay, classic_lock)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Ruleset:onPieceMove(piece) end
|
function Ruleset:onPieceMove(piece) end
|
||||||
|
Loading…
Reference in New Issue
Block a user