Improved delays
parent
e76a78d199
commit
137f8cefc1
|
@ -30,10 +30,11 @@ k_jump=4
|
|||
k_dash=5
|
||||
|
||||
|
||||
-- If true, disable screensake
|
||||
hack_no_shake = true
|
||||
|
||||
-- False until the game has initialized
|
||||
hack_ready = false
|
||||
hack_no_shake = true
|
||||
|
||||
-- Slow down frame rate
|
||||
hack_frame_counter = 0
|
||||
|
@ -277,7 +278,7 @@ player =
|
|||
has_dashed=true
|
||||
|
||||
-- HACK: fast-forward dashes
|
||||
hack_frame_foward_bonus = 8
|
||||
hack_frame_foward_bonus = 10
|
||||
hack_can_dash = false
|
||||
|
||||
this.dash_effect_time=10
|
||||
|
@ -1209,7 +1210,7 @@ end
|
|||
-- default for celeste is 30.
|
||||
function _update()
|
||||
|
||||
-- Skip a few frames at start to initialize
|
||||
-- Run at full speed until ready
|
||||
if not hack_ready then
|
||||
old_update()
|
||||
old_draw()
|
||||
|
@ -1221,20 +1222,14 @@ function _update()
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- Do nothing for a few frames.
|
||||
-- This gives us time to run computations
|
||||
if hack_frame_counter < hack_frame_freeze then
|
||||
-- Freeze frames
|
||||
hack_frame_counter+=1
|
||||
return
|
||||
elseif hack_frame_counter < (hack_frame_foward + hack_frame_freeze + hack_frame_foward_bonus) then
|
||||
-- Forward frames
|
||||
hack_frame_counter+=1
|
||||
old_update()
|
||||
old_draw()
|
||||
extcmd("screen")
|
||||
else
|
||||
end
|
||||
|
||||
|
||||
-- Wait for input
|
||||
if (not (
|
||||
btn(k_left) or
|
||||
|
@ -1250,13 +1245,28 @@ function _update()
|
|||
end
|
||||
|
||||
|
||||
hack_frame_counter = 0
|
||||
hack_frame_foward_bonus = 0
|
||||
|
||||
-- Delay for input to stabilize
|
||||
-- Required to reliably send multiple key presses
|
||||
wait(5)
|
||||
|
||||
-- Run a few frames
|
||||
for i=1,hack_frame_foward do
|
||||
old_update()
|
||||
old_draw()
|
||||
extcmd("screen")
|
||||
end
|
||||
|
||||
-- Run bonus frames if we earned bonus frames
|
||||
for i=1,hack_frame_foward_bonus do
|
||||
old_update()
|
||||
old_draw()
|
||||
extcmd("screen")
|
||||
end
|
||||
|
||||
-- Reset counters
|
||||
hack_frame_counter = 0
|
||||
hack_frame_foward_bonus = 0
|
||||
|
||||
|
||||
hack_has_sent_first_message = true
|
||||
out_string = "dc:" .. tostr(deaths) .. ";"
|
||||
|
@ -1271,33 +1281,12 @@ function _update()
|
|||
out_string = out_string .. k ..":" .. v .. ";"
|
||||
end
|
||||
printh(out_string)
|
||||
end
|
||||
end
|
||||
|
||||
-- Called at the same rate as _update
|
||||
-- Called at the same rate as _update,
|
||||
-- but not necessarily at the same time.
|
||||
function _draw()
|
||||
|
||||
--old_draw()
|
||||
|
||||
--[[
|
||||
if not (
|
||||
btn(k_left) or
|
||||
btn(k_right) or
|
||||
btn(k_up) or
|
||||
btn(k_down) or
|
||||
btn(k_jump) or
|
||||
btn(k_dash)
|
||||
) and hack_run_delay then
|
||||
return
|
||||
end
|
||||
|
||||
if draw_frame_counter < frame_rate_hack and hack_run_delay then
|
||||
draw_frame_counter += 1
|
||||
else
|
||||
draw_frame_counter = 0
|
||||
old_draw()
|
||||
end
|
||||
--]]
|
||||
end
|
||||
|
||||
function old_update()
|
||||
|
|
Reference in New Issue