Fixed dkong and dkong2 freezing

This commit is contained in:
leiradel 2019-05-05 18:24:57 +01:00
parent dc0feaf9a7
commit 40fb9baefc
2 changed files with 2 additions and 70 deletions

View File

@ -51,7 +51,7 @@ unit1.bsound = true
unit1.imode = 2
unit1.form1.gam_set_mode()
local tick = system.init(
return system.init(
unit1.form1.im_background_open,
keymap,
function( key ) unit1.form1.onkeydown( nil, key, 0 ) end,
@ -60,37 +60,3 @@ local tick = system.init(
nil,
menu
)
local state = {}
local last_bcontroller
local newtick = function()
local active = tick()
if active then
if unit1.bcontroller ~= last_bcontroller then
last_bcontroller = unit1.bcontroller
-- repeat keypresses when bcontroller is true again
if last_bcontroller then
system.inputstate( state )
for button, pressed in pairs( state ) do
local keys = keymap[ button ]
if keys then
if pressed then
for _, key in ipairs( keys ) do
unit1.form1.onkeydown( nil, key, 0 )
end
end
end
end
end
end
end
return active
end
return newtick

View File

@ -56,7 +56,7 @@ unit1.bsound = true
unit1.imode = 2
unit1.form1.gam_set_mode()
local tick = system.init(
return system.init(
unit1.form1.im_background_open,
keymap,
function( key ) unit1.form1.onkeydown( nil, key, 0 ) end,
@ -65,37 +65,3 @@ local tick = system.init(
nil,
menu
)
local state = {}
local last_barrowkeypressed
local newtick = function()
local active = tick()
if active then
if unit1.bcontroller ~= last_bcontroller then
last_barrowkeypressed = unit1.barrowkeypressed
-- repeat keypresses when barrowkeypressed is true again
if last_barrowkeypressed then
system.inputstate( state )
for button, pressed in pairs( state ) do
local keys = keymap[ button ]
if keys then
if pressed then
for _, key in ipairs( keys ) do
unit1.form1.onkeydown( nil, key, 0 )
end
end
end
end
end
end
end
return active
end
return newtick