don't reset actors each frame by default; make the behavior toggleable

This commit is contained in:
Jill 2022-12-09 21:55:11 +03:00
parent f4e8c1df7c
commit 0a1805e6fa
2 changed files with 37 additions and 5 deletions

View File

@ -108,6 +108,8 @@
oat.useProfiler = false
oat.profilerInfo = {}
local resetOnFrameStartCfg = false
local resetOnFrameStartActors = {}
local uraniumFunc = {}
@ -207,6 +209,11 @@
local function onCommand(self)
actorsInitialized = true
actorsInitializing = false
local resetOnFrameStartActors_ = {}
for k,v in pairs(resetOnFrameStartActors) do
resetOnFrameStartActors_[k.__raw] = v
end
resetOnFrameStartActors = resetOnFrameStartActors_
uranium:call('init')
end
@ -291,6 +298,15 @@
DISPLAY:ClearShaderFuck()
end
function resetOnFrameStart(bool)
resetOnFrameStartCfg = bool
end
function resetActorOnFrameStart(actor, bool)
if bool == nil then bool = not resetOnFrameStartCfg end
resetOnFrameStartActors[actor.__raw or actor] = bool
end
-- actors
local actorQueue = {}
@ -770,14 +786,21 @@
drawfunctionArguments = {}
for _, q in ipairs(globalQueue) do
local enabled = resetOnFrameStartCfg
local actor = q[1]
local v = q[2]
local func = actor[v[1]]
if not func then
-- uhmmm ??? hm. what do we do??
else
patchFunction(func, actor)(unpack(v[2]))
local pref = resetOnFrameStartActors[actor]
if pref ~= nil then enabled = pref end
if enabled then
local func = actor[v[1]]
if not func then
-- uhmmm ??? hm. what do we do??
else
patchFunction(func, actor)(unpack(v[2]))
end
end
end

View File

@ -78,6 +78,15 @@ function setDrawFunction(frame, func) end
---@param shader RageShaderProgram
function setShader(actor, shader) end
-- Toggle actor resetting on frame start behavior by default.
---@param bool boolean
function resetOnFrameStart(bool) end
-- Toggle actor resetting on frame start for individual actors. `bool` defaults to the opposite of your `resetOnFrameStart` config
---@param actor Actor
---@param bool boolean | nil
function resetActorOnFrameStart(actor, bool) end
---@type number
--- A simple timer. Ticks upwards at a rate of 1/sec.
---