mirror of
https://gitea.com/SweetSea-ButImNotSweet/tromi_mobile.git
synced 2025-01-08 17:33:09 +08:00
Add the missing buffer logical code in training mode
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
local GameScene = Scene:extend()
|
local GameScene = Scene:extend()
|
||||||
local binser = require 'libs.binser'
|
|
||||||
|
|
||||||
GameScene.title = "Game"
|
GameScene.title = "Game"
|
||||||
local tas = false
|
local tas = false
|
||||||
@@ -33,7 +32,7 @@ function GameScene:new(player_name, replay_file, replay_grade)
|
|||||||
rotate_180=false,
|
rotate_180=false,
|
||||||
hold=false,
|
hold=false,
|
||||||
}
|
}
|
||||||
self.inputs_waiting2trigger={ -- Used for buffering the input, in case the input is too quick (1f)
|
self.inputs_waiting2trigger={ -- Used for buffering the input, in case the input is too fast (1f)
|
||||||
left=false,
|
left=false,
|
||||||
right=false,
|
right=false,
|
||||||
up=false,
|
up=false,
|
||||||
@@ -56,9 +55,12 @@ function GameScene:update(nosound, tas_update)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
for input, value in pairs(self.inputs) do
|
for input, value in pairs(self.inputs) do
|
||||||
inputs[input] = value
|
if self.inputs_waiting2trigger[input] then
|
||||||
if self.inputs_waiting2trigger[input] then inputs[input]=true end
|
inputs[input]=true
|
||||||
self.inputs_waiting2trigger[input]=false
|
self.inputs_waiting2trigger[input]=false
|
||||||
|
else
|
||||||
|
inputs[input] = value
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if tas and tas_update then
|
if tas and tas_update then
|
||||||
self.paused = false
|
self.paused = false
|
||||||
|
|||||||
@@ -29,13 +29,30 @@ function TrainingScene:new()
|
|||||||
rotate_180=false,
|
rotate_180=false,
|
||||||
hold=false,
|
hold=false,
|
||||||
}
|
}
|
||||||
|
self.inputs_waiting2trigger={ -- Used for buffering the input, in case the input is too fast (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
|
self.paused = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function TrainingScene:update()
|
function TrainingScene:update()
|
||||||
local inputs = {}
|
local inputs = {}
|
||||||
for input, value in pairs(self.inputs) do
|
for input, value in pairs(self.inputs) do
|
||||||
inputs[input] = value
|
if self.inputs_waiting2trigger[input] then
|
||||||
|
inputs[input]=true
|
||||||
|
self.inputs_waiting2trigger[input]=false
|
||||||
|
else
|
||||||
|
inputs[input] = value
|
||||||
|
end
|
||||||
end
|
end
|
||||||
self.game:update(inputs, self.ruleset)
|
self.game:update(inputs, self.ruleset)
|
||||||
self.game.grid:update()
|
self.game.grid:update()
|
||||||
@@ -52,6 +69,7 @@ function TrainingScene:onInputPress(e)
|
|||||||
scene = TitleScene()
|
scene = TitleScene()
|
||||||
elseif e.input and string.sub(e.input, 1, 5) ~= "menu_" then
|
elseif e.input and string.sub(e.input, 1, 5) ~= "menu_" then
|
||||||
self.inputs[e.input] = true
|
self.inputs[e.input] = true
|
||||||
|
self.inputs_waiting2trigger[e.input] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user