Add `input.waiting2trigger` as buffer for too quick inputs

This commit is contained in:
Squishy (C6H12O6+NaCl+H2O)
2024-04-11 10:26:16 +07:00
parent e4b9ef4e51
commit 09f59d929f

View File

@@ -33,6 +33,18 @@ function GameScene:new(player_name, replay_file, replay_grade)
rotate_180=false,
hold=false,
}
self.inputs_waiting2trigger={ -- Used for buffering the input, in case the input is too quick (1f)
left=false,
right=false,
up=false,
down=false,
rotate_left=false,
rotate_left2=false,
rotate_right=false,
rotate_right2=false,
rotate_180=false,
hold=false,
}
self.paused = false
end
@@ -45,6 +57,8 @@ function GameScene:update(nosound, tas_update)
end
for input, value in pairs(self.inputs) do
inputs[input] = value
if self.inputs_waiting2trigger[input] then inputs[input]=true end
self.inputs_waiting2trigger[input]=false
end
if tas and tas_update then
self.paused = false
@@ -103,6 +117,7 @@ function GameScene:onInputPress(e)
self.grace_frames = 90
elseif e.input and string.sub(e.input, 1, 5) ~= "menu_" then
self.inputs[e.input] = true
self.inputs_waiting2trigger[e.input] = true
end
end