mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-25 12:19:03 -06:00
Refined and cleaned up buffer drop input functionality
This commit is contained in:
parent
c5c4c4d95c
commit
9fbfbd5cda
@ -17,7 +17,7 @@ ConfigScene.options = {
|
|||||||
{"smooth_movement", "Smooth Piece Drop", false, {"On", "Off"}},
|
{"smooth_movement", "Smooth Piece Drop", false, {"On", "Off"}},
|
||||||
{"synchroes_allowed", "Synchroes", false, {"Per ruleset", "On", "Off"}},
|
{"synchroes_allowed", "Synchroes", false, {"Per ruleset", "On", "Off"}},
|
||||||
{"diagonal_input", "Diagonal Input", false, {"On", "Off"}},
|
{"diagonal_input", "Diagonal Input", false, {"On", "Off"}},
|
||||||
{"buffer_lock", "Buffer Lock Type", false, {"Off", "Hold", "Tap"}},
|
{"buffer_lock", "Buffer Drop Type", false, {"Off", "Hold", "Tap"}},
|
||||||
{"sfx_volume", "SFX", true, "sfxSlider"},
|
{"sfx_volume", "SFX", true, "sfxSlider"},
|
||||||
{"bgm_volume", "BGM", true, "bgmSlider"},
|
{"bgm_volume", "BGM", true, "bgmSlider"},
|
||||||
}
|
}
|
||||||
|
@ -437,20 +437,12 @@ function GameMode:checkBufferedInputs(inputs)
|
|||||||
self.enable_hard_drop
|
self.enable_hard_drop
|
||||||
) then
|
) then
|
||||||
self.buffer_hard_drop = true
|
self.buffer_hard_drop = true
|
||||||
elseif (
|
|
||||||
config.gamesettings.buffer_lock == 2 and not inputs["up"]
|
|
||||||
) then
|
|
||||||
self.buffer_hard_drop = false
|
|
||||||
end
|
end
|
||||||
if (
|
if (
|
||||||
config.gamesettings.buffer_lock ~= 1 and
|
config.gamesettings.buffer_lock ~= 1 and
|
||||||
not self.prev_inputs["down"] and inputs["down"]
|
not self.prev_inputs["down"] and inputs["down"]
|
||||||
) then
|
) then
|
||||||
self.buffer_soft_drop = true
|
self.buffer_soft_drop = true
|
||||||
elseif (
|
|
||||||
config.gamesettings.buffer_lock == 2 and not inputs["down"]
|
|
||||||
) then
|
|
||||||
self.buffer_soft_drop = false
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -542,8 +534,16 @@ function GameMode:hold(inputs, ruleset, ihs)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function GameMode:initializeNextPiece(inputs, ruleset, piece_data, generate_next_piece)
|
function GameMode:initializeNextPiece(inputs, ruleset, piece_data, generate_next_piece)
|
||||||
self.piece_hard_dropped = false
|
if not self.buffer_soft_drop and self.lock_drop or (
|
||||||
self.piece_soft_locked = false
|
not ruleset.are or self:getARE() == 0
|
||||||
|
) then
|
||||||
|
self.drop_locked = true
|
||||||
|
end
|
||||||
|
if not self.buffer_hard_drop and self.lock_hard_drop or (
|
||||||
|
not ruleset.are or self:getARE() == 0
|
||||||
|
) then
|
||||||
|
self.hard_drop_locked = true
|
||||||
|
end
|
||||||
self.piece = ruleset:initializePiece(
|
self.piece = ruleset:initializePiece(
|
||||||
inputs, piece_data, self.grid, self:getGravity(),
|
inputs, piece_data, self.grid, self:getGravity(),
|
||||||
self.prev_inputs, self.move,
|
self.prev_inputs, self.move,
|
||||||
@ -553,47 +553,30 @@ function GameMode:initializeNextPiece(inputs, ruleset, piece_data, generate_next
|
|||||||
self.frames == 0 or (ruleset.are and self:getARE() ~= 0)
|
self.frames == 0 or (ruleset.are and self:getARE() ~= 0)
|
||||||
) and self.irs or false
|
) and self.irs or false
|
||||||
)
|
)
|
||||||
if self.buffer_hard_drop then
|
if config.gamesettings.buffer_lock == 3 then
|
||||||
self.piece:dropToBottom(self.grid)
|
if self.buffer_hard_drop then
|
||||||
self.piece.locked = self.lock_on_hard_drop
|
local prev_y = self.piece.position.y
|
||||||
local above_field = (
|
self.piece:dropToBottom(self.grid)
|
||||||
(config.gamesettings.spawn_positions == 1 and
|
self.piece.locked = self.lock_on_hard_drop
|
||||||
ruleset.spawn_above_field) or
|
self:onHardDrop(self.piece.position.y - prev_y)
|
||||||
config.gamesettings.spawn_positions == 3
|
end
|
||||||
)
|
if self.buffer_soft_drop then
|
||||||
self:onHardDrop(self.piece.position.y - (
|
if (
|
||||||
self.piece.big and
|
self.lock_on_soft_drop and
|
||||||
ruleset.big_spawn_positions[self.piece.shape].y or
|
self.piece:isDropBlocked(self.grid)
|
||||||
ruleset.spawn_positions[self.piece.shape].y) +
|
) then
|
||||||
(above_field and ruleset:getAboveFieldOffset(
|
self.piece.locked = true
|
||||||
piece_data.shape, piece_data.orientation
|
end
|
||||||
) or 0)
|
|
||||||
)
|
|
||||||
self.buffer_hard_drop = false
|
|
||||||
end
|
|
||||||
if self.buffer_soft_drop then
|
|
||||||
if (
|
|
||||||
self.lock_on_soft_drop and
|
|
||||||
self.piece:isDropBlocked(self.grid)
|
|
||||||
) then
|
|
||||||
self.piece.locked = true
|
|
||||||
end
|
end
|
||||||
self.buffer_soft_drop = false
|
|
||||||
end
|
end
|
||||||
|
self.piece_hard_dropped = false
|
||||||
|
self.piece_soft_locked = false
|
||||||
|
self.buffer_hard_drop = false
|
||||||
|
self.buffer_soft_drop = false
|
||||||
if self.piece:isDropBlocked(self.grid) and
|
if self.piece:isDropBlocked(self.grid) and
|
||||||
self.grid:canPlacePiece(self.piece) then
|
self.grid:canPlacePiece(self.piece) then
|
||||||
playSE("bottom")
|
playSE("bottom")
|
||||||
end
|
end
|
||||||
if self.lock_drop or (
|
|
||||||
not ruleset.are or self:getARE() == 0
|
|
||||||
) then
|
|
||||||
self.drop_locked = true
|
|
||||||
end
|
|
||||||
if self.lock_hard_drop or (
|
|
||||||
not ruleset.are or self:getARE() == 0
|
|
||||||
) then
|
|
||||||
self.hard_drop_locked = true
|
|
||||||
end
|
|
||||||
if generate_next_piece == nil then
|
if generate_next_piece == nil then
|
||||||
table.remove(self.next_queue, 1)
|
table.remove(self.next_queue, 1)
|
||||||
table.insert(self.next_queue, self:getNextPiece(ruleset))
|
table.insert(self.next_queue, self:getNextPiece(ruleset))
|
||||||
|
Loading…
Reference in New Issue
Block a user