mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-25 12:29:02 -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,23 +553,12 @@ 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 config.gamesettings.buffer_lock == 3 then
|
||||||
if self.buffer_hard_drop then
|
if self.buffer_hard_drop then
|
||||||
|
local prev_y = self.piece.position.y
|
||||||
self.piece:dropToBottom(self.grid)
|
self.piece:dropToBottom(self.grid)
|
||||||
self.piece.locked = self.lock_on_hard_drop
|
self.piece.locked = self.lock_on_hard_drop
|
||||||
local above_field = (
|
self:onHardDrop(self.piece.position.y - prev_y)
|
||||||
(config.gamesettings.spawn_positions == 1 and
|
|
||||||
ruleset.spawn_above_field) or
|
|
||||||
config.gamesettings.spawn_positions == 3
|
|
||||||
)
|
|
||||||
self:onHardDrop(self.piece.position.y - (
|
|
||||||
self.piece.big and
|
|
||||||
ruleset.big_spawn_positions[self.piece.shape].y or
|
|
||||||
ruleset.spawn_positions[self.piece.shape].y) +
|
|
||||||
(above_field and ruleset:getAboveFieldOffset(
|
|
||||||
piece_data.shape, piece_data.orientation
|
|
||||||
) or 0)
|
|
||||||
)
|
|
||||||
self.buffer_hard_drop = false
|
|
||||||
end
|
end
|
||||||
if self.buffer_soft_drop then
|
if self.buffer_soft_drop then
|
||||||
if (
|
if (
|
||||||
@ -578,22 +567,16 @@ function GameMode:initializeNextPiece(inputs, ruleset, piece_data, generate_next
|
|||||||
) then
|
) then
|
||||||
self.piece.locked = true
|
self.piece.locked = true
|
||||||
end
|
end
|
||||||
self.buffer_soft_drop = false
|
|
||||||
end
|
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