mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 18:59:03 -06:00
Added an option to control buffer locking.
You can now choose if you want a drop input during ARE to lock the piece on the first frame it is active.
This commit is contained in:
parent
0d13a9f236
commit
84634d6933
@ -16,6 +16,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 Inputs", false, {"On", "Off"}},
|
||||||
{"sfx_volume", "SFX", true, "sfxSlider"},
|
{"sfx_volume", "SFX", true, "sfxSlider"},
|
||||||
{"bgm_volume", "BGM", true, "bgmSlider"},
|
{"bgm_volume", "BGM", true, "bgmSlider"},
|
||||||
}
|
}
|
||||||
@ -55,7 +56,7 @@ function ConfigScene:render()
|
|||||||
--Lazy check to see if we're on the SFX or BGM slider. Probably will need to be rewritten if more options get added.
|
--Lazy check to see if we're on the SFX or BGM slider. Probably will need to be rewritten if more options get added.
|
||||||
love.graphics.setColor(1, 1, 1, 0.5)
|
love.graphics.setColor(1, 1, 1, 0.5)
|
||||||
if not ConfigScene.options[self.highlight][3] then
|
if not ConfigScene.options[self.highlight][3] then
|
||||||
love.graphics.rectangle("fill", 20, 98 + self.highlight * 20, 170, 22)
|
love.graphics.rectangle("fill", 25, 98 + self.highlight * 20, 170, 22)
|
||||||
else
|
else
|
||||||
love.graphics.rectangle("fill", 65 + (1+self.highlight-#self.options) * 300, 322, 215, 33)
|
love.graphics.rectangle("fill", 65 + (1+self.highlight-#self.options) * 300, 322, 215, 33)
|
||||||
end
|
end
|
||||||
|
@ -327,6 +327,12 @@ function GameMode:processDelays(inputs, ruleset, drop_speed)
|
|||||||
playedGoSE = false
|
playedGoSE = false
|
||||||
end
|
end
|
||||||
if self.ready_frames > 0 then
|
if self.ready_frames > 0 then
|
||||||
|
if not self.prev_inputs["up"] and inputs["up"] then
|
||||||
|
self.buffer_hard_drop = true
|
||||||
|
end
|
||||||
|
if not self.prev_inputs["down"] and inputs["down"] then
|
||||||
|
self.buffer_soft_drop = true
|
||||||
|
end
|
||||||
if not playedReadySE then
|
if not playedReadySE then
|
||||||
playedReadySE = true
|
playedReadySE = true
|
||||||
playSEOnce("ready")
|
playSEOnce("ready")
|
||||||
@ -340,6 +346,12 @@ function GameMode:processDelays(inputs, ruleset, drop_speed)
|
|||||||
self:initializeOrHold(inputs, ruleset)
|
self:initializeOrHold(inputs, ruleset)
|
||||||
end
|
end
|
||||||
elseif self.lcd > 0 then
|
elseif self.lcd > 0 then
|
||||||
|
if not self.prev_inputs["up"] and inputs["up"] then
|
||||||
|
self.buffer_hard_drop = true
|
||||||
|
end
|
||||||
|
if not self.prev_inputs["down"] and inputs["down"] then
|
||||||
|
self.buffer_soft_drop = true
|
||||||
|
end
|
||||||
self.lcd = self.lcd - 1
|
self.lcd = self.lcd - 1
|
||||||
self:areCancel(inputs, ruleset)
|
self:areCancel(inputs, ruleset)
|
||||||
if self.lcd == 0 then
|
if self.lcd == 0 then
|
||||||
@ -350,6 +362,12 @@ function GameMode:processDelays(inputs, ruleset, drop_speed)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif self.are > 0 then
|
elseif self.are > 0 then
|
||||||
|
if not self.prev_inputs["up"] and inputs["up"] then
|
||||||
|
self.buffer_hard_drop = true
|
||||||
|
end
|
||||||
|
if not self.prev_inputs["down"] and inputs["down"] then
|
||||||
|
self.buffer_soft_drop = true
|
||||||
|
end
|
||||||
self.are = self.are - 1
|
self.are = self.are - 1
|
||||||
self:areCancel(inputs, ruleset)
|
self:areCancel(inputs, ruleset)
|
||||||
if self.are == 0 then
|
if self.are == 0 then
|
||||||
@ -403,8 +421,20 @@ function GameMode:initializeNextPiece(inputs, ruleset, piece_data, generate_next
|
|||||||
self.prev_inputs, self.move,
|
self.prev_inputs, self.move,
|
||||||
self:getLockDelay(), self:getDropSpeed(),
|
self:getLockDelay(), self:getDropSpeed(),
|
||||||
self.lock_drop, self.lock_hard_drop, self.big_mode,
|
self.lock_drop, self.lock_hard_drop, self.big_mode,
|
||||||
self.irs
|
self.irs, self.buffer_hard_drop, self.buffer_soft_drop,
|
||||||
|
self.lock_on_hard_drop, self.lock_on_soft_drop
|
||||||
)
|
)
|
||||||
|
if self.buffer_hard_drop then
|
||||||
|
self.buffer_hard_drop = false
|
||||||
|
self:onHardDrop(self.piece.position.y - (
|
||||||
|
self.big_mode and
|
||||||
|
ruleset.big_spawn_positions[self.piece.shape].y or
|
||||||
|
ruleset.spawn_positions[self.piece.shape].y)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
if self.buffer_soft_drop then
|
||||||
|
self.buffer_soft_drop = false
|
||||||
|
end
|
||||||
if self.lock_drop then
|
if self.lock_drop then
|
||||||
self.drop_locked = true
|
self.drop_locked = true
|
||||||
end
|
end
|
||||||
|
@ -181,7 +181,9 @@ function Ruleset:getDefaultOrientation() return 1 end
|
|||||||
function Ruleset:initializePiece(
|
function Ruleset:initializePiece(
|
||||||
inputs, data, grid, gravity, prev_inputs,
|
inputs, data, grid, gravity, prev_inputs,
|
||||||
move, lock_delay, drop_speed,
|
move, lock_delay, drop_speed,
|
||||||
drop_locked, hard_drop_locked, big, irs
|
drop_locked, hard_drop_locked, big, irs,
|
||||||
|
buffer_hard_drop, buffer_soft_drop,
|
||||||
|
lock_on_hard_drop, lock_on_soft_drop
|
||||||
)
|
)
|
||||||
local spawn_positions
|
local spawn_positions
|
||||||
if big then
|
if big then
|
||||||
@ -206,6 +208,13 @@ function Ruleset:initializePiece(
|
|||||||
self:rotatePiece(inputs, piece, grid, {}, true)
|
self:rotatePiece(inputs, piece, grid, {}, true)
|
||||||
end
|
end
|
||||||
self:dropPiece(inputs, piece, grid, gravity, drop_speed, drop_locked, hard_drop_locked)
|
self:dropPiece(inputs, piece, grid, gravity, drop_speed, drop_locked, hard_drop_locked)
|
||||||
|
if (buffer_hard_drop and config.gamesettings.buffer_lock == 1) then
|
||||||
|
piece:dropToBottom(grid)
|
||||||
|
if lock_on_hard_drop then piece.locked = true end
|
||||||
|
end
|
||||||
|
if (buffer_soft_drop and lock_on_soft_drop and piece:isDropBlocked(grid) and config.gamesettings.buffer_lock == 1) then
|
||||||
|
piece.locked = true
|
||||||
|
end
|
||||||
return piece
|
return piece
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user