Improved hack
parent
0ca1410643
commit
d6452f5ed8
|
@ -31,6 +31,19 @@ k_dash=5
|
||||||
|
|
||||||
-- HACK: used to slow down frame rate
|
-- HACK: used to slow down frame rate
|
||||||
frame_counter = 0
|
frame_counter = 0
|
||||||
|
draw_frame_counter = 0
|
||||||
|
|
||||||
|
-- False until the game has initialized
|
||||||
|
hack_ready = false
|
||||||
|
|
||||||
|
-- Skip each nth frame.
|
||||||
|
-- Celeste usually runs at 30 fps, we run it at 60.
|
||||||
|
-- so, a value of 2 gives normal speed
|
||||||
|
-- and a value of 3 gives 3/2 speed.
|
||||||
|
frame_rate_hack = 10
|
||||||
|
|
||||||
|
-- HACK: keep track of player state
|
||||||
|
player_state = {}
|
||||||
|
|
||||||
-- entry point --
|
-- entry point --
|
||||||
-----------------
|
-----------------
|
||||||
|
@ -325,14 +338,15 @@ player =
|
||||||
|
|
||||||
|
|
||||||
-- HACK: print player status
|
-- HACK: print player status
|
||||||
printh(
|
hack_ready = true
|
||||||
"px:" .. tostr(this.x) ..
|
player_state = {
|
||||||
";py:" .. tostr(this.y)..
|
px = tostr(this.x),
|
||||||
";vx:" .. tostr(this.spd.x) ..
|
py = tostr(this.y),
|
||||||
";vy:" .. tostr(this.spd.y) ..
|
vx = tostr(this.spd.x),
|
||||||
";rx:" .. tostr(room.x) ..
|
vy = tostr(this.spd.y),
|
||||||
";ry:" .. tostr(room.y)
|
rx = tostr(room.x),
|
||||||
)
|
ry = tostr(room.y)
|
||||||
|
}
|
||||||
|
|
||||||
end, --<end update loop
|
end, --<end update loop
|
||||||
|
|
||||||
|
@ -1098,11 +1112,6 @@ function kill_player(obj)
|
||||||
deaths+=1
|
deaths+=1
|
||||||
shake=10
|
shake=10
|
||||||
|
|
||||||
-- HACK: print death status
|
|
||||||
printh(
|
|
||||||
"dc:" .. tostr(deaths)
|
|
||||||
)
|
|
||||||
|
|
||||||
destroy_object(obj)
|
destroy_object(obj)
|
||||||
dead_particles={}
|
dead_particles={}
|
||||||
for dir=0,7 do
|
for dir=0,7 do
|
||||||
|
@ -1188,18 +1197,31 @@ end
|
||||||
-- _update30 runs at 30 fps
|
-- _update30 runs at 30 fps
|
||||||
-- _update60 does 60 fps
|
-- _update60 does 60 fps
|
||||||
-- default for celeste is 30.
|
-- default for celeste is 30.
|
||||||
|
function _update60()
|
||||||
function _update()
|
if frame_counter < frame_rate_hack then
|
||||||
--wait(10)
|
|
||||||
old_update()
|
|
||||||
--[[
|
|
||||||
if frame_counter < 10 then
|
|
||||||
frame_counter+=1
|
frame_counter+=1
|
||||||
else
|
else
|
||||||
frame_counter = 0
|
frame_counter = 0
|
||||||
old_update()
|
old_update()
|
||||||
|
|
||||||
|
if hack_ready then
|
||||||
|
out_string = "dc:" .. tostr(deaths) .. ";"
|
||||||
|
for k, v in pairs(player_state) do
|
||||||
|
out_string = out_string .. k ..":" .. v .. ";"
|
||||||
|
end
|
||||||
|
printh(out_string)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Called at the same rate as _update
|
||||||
|
function _draw()
|
||||||
|
if draw_frame_counter < frame_rate_hack then
|
||||||
|
draw_frame_counter += 1
|
||||||
|
else
|
||||||
|
draw_frame_counter = 0
|
||||||
|
old_draw()
|
||||||
end
|
end
|
||||||
]]--
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function old_update()
|
function old_update()
|
||||||
|
@ -1270,7 +1292,7 @@ end
|
||||||
|
|
||||||
-- drawing functions --
|
-- drawing functions --
|
||||||
-----------------------
|
-----------------------
|
||||||
function _draw()
|
function old_draw()
|
||||||
if freeze>0 then return end
|
if freeze>0 then return end
|
||||||
|
|
||||||
-- reset all palette values
|
-- reset all palette values
|
||||||
|
|
Reference in New Issue