tiiny fixes!! almost there!! almost stable!!
This commit is contained in:
parent
7daf64afa7
commit
e6c2867aed
143
main.xml
143
main.xml
|
@ -167,8 +167,11 @@
|
||||||
hasExited = true
|
hasExited = true
|
||||||
uranium:call('exit')
|
uranium:call('exit')
|
||||||
-- good templates clean up after themselves
|
-- good templates clean up after themselves
|
||||||
|
uranium = nil
|
||||||
_G.oat = nil
|
_G.oat = nil
|
||||||
|
oat = nil
|
||||||
_main:hidden(1)
|
_main:hidden(1)
|
||||||
|
collectgarbage()
|
||||||
end
|
end
|
||||||
|
|
||||||
local actorsInitialized = false -- if true, no new actors can be created
|
local actorsInitialized = false -- if true, no new actors can be created
|
||||||
|
@ -236,62 +239,20 @@
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local lastt = GAMESTATE:GetSongTime()
|
GAMESTATE:ApplyModifiers('clearall')
|
||||||
local function screen_ready_command(self)
|
|
||||||
hideThemeActors()
|
|
||||||
self:hidden(0)
|
|
||||||
|
|
||||||
local errored = false
|
function setDrawFunction(frame, func)
|
||||||
local firstrun = true
|
frame:SetDrawFunction(function()
|
||||||
local playersLoaded = false
|
for i = 1, frame:GetNumChildren() do
|
||||||
self:addcommand('Update', function()
|
local a = frame:GetChildAt(i - 1)
|
||||||
if errored then
|
if a.fov then -- actorframe
|
||||||
return 0
|
a:Draw()
|
||||||
end
|
|
||||||
errored = true
|
|
||||||
|
|
||||||
if P1 and P2 then
|
|
||||||
playersLoaded = true
|
|
||||||
end
|
|
||||||
if playersLoaded and not P1 and not P2 then -- sora exit hack
|
|
||||||
exit()
|
|
||||||
end
|
|
||||||
|
|
||||||
t = os.clock()
|
|
||||||
b = GAMESTATE:GetSongBeat()
|
|
||||||
local dt = t - lastt
|
|
||||||
lastt = t
|
|
||||||
|
|
||||||
if firstrun then
|
|
||||||
firstrun = false
|
|
||||||
dt = 0
|
|
||||||
self:GetChildren()[2]:hidden(1)
|
|
||||||
uranium:call('ready')
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, q in ipairs(globalQueue) do
|
|
||||||
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]))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
func()
|
||||||
uranium:call('update', dt)
|
|
||||||
|
|
||||||
errored = false
|
|
||||||
|
|
||||||
return 0
|
|
||||||
end)
|
end)
|
||||||
self:luaeffect('Update')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
GAMESTATE:ApplyModifiers('clearall')
|
|
||||||
|
|
||||||
-- actors
|
-- actors
|
||||||
|
|
||||||
local actorQueue = {}
|
local actorQueue = {}
|
||||||
|
@ -332,12 +293,15 @@
|
||||||
|
|
||||||
function oat._actor.recurse(forceActor)
|
function oat._actor.recurse(forceActor)
|
||||||
local newFrame, idx = findFirstActorFrame(currentPath)
|
local newFrame, idx = findFirstActorFrame(currentPath)
|
||||||
if newFrame and not (currentActor and forceActor) then
|
local newActor = findFirstActor(currentPath)
|
||||||
|
if newFrame and not (newActor and forceActor) then
|
||||||
|
print('creating frame')
|
||||||
table.insert(pastPaths, currentPath)
|
table.insert(pastPaths, currentPath)
|
||||||
currentPath = currentPath[idx]
|
currentPath = currentPath[idx]
|
||||||
table.remove(pastPaths[#pastPaths], idx)
|
table.remove(pastPaths[#pastPaths], idx)
|
||||||
return true
|
return true
|
||||||
elseif currentActor then
|
elseif newActor then
|
||||||
|
print('creating actor')
|
||||||
table.insert(pastPaths, currentPath)
|
table.insert(pastPaths, currentPath)
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
|
@ -346,6 +310,7 @@
|
||||||
end
|
end
|
||||||
|
|
||||||
function oat._actor.recurseLast()
|
function oat._actor.recurseLast()
|
||||||
|
print('recurselast: hi!')
|
||||||
return oat._actor.recurse(true)
|
return oat._actor.recurse(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -396,7 +361,7 @@
|
||||||
self:removecommand('Init')
|
self:removecommand('Init')
|
||||||
self:SetDrawFunction(function()
|
self:SetDrawFunction(function()
|
||||||
for i = 1, self:GetNumChildren() do
|
for i = 1, self:GetNumChildren() do
|
||||||
local a = self(i)
|
local a = self:GetChildAt(i - 1)
|
||||||
if a.fov then -- actorframe
|
if a.fov then -- actorframe
|
||||||
a:Draw()
|
a:Draw()
|
||||||
end
|
end
|
||||||
|
@ -476,11 +441,14 @@
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- to make mr. Garbage Collector's job easier
|
||||||
initCommands = {}
|
initCommands = {}
|
||||||
queueRepresentation = nil -- to make mr. Garbage Collector's job easier
|
queueRepresentation = nil
|
||||||
|
queue = {}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return function(...)
|
return function(...)
|
||||||
|
if actorsInitialized then return end
|
||||||
if key == 'addcommand' and arg[2] == 'Init' then
|
if key == 'addcommand' and arg[2] == 'Init' then
|
||||||
table.insert(initCommands, {arg[3], debug.getinfo(2, 'Sl')})
|
table.insert(initCommands, {arg[3], debug.getinfo(2, 'Sl')})
|
||||||
else
|
else
|
||||||
|
@ -669,6 +637,71 @@
|
||||||
actorTree = tree
|
actorTree = tree
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local lastt = GAMESTATE:GetSongTime()
|
||||||
|
local function screenReadyCommand(self)
|
||||||
|
hideThemeActors()
|
||||||
|
self:hidden(0)
|
||||||
|
oat._actor = {}
|
||||||
|
|
||||||
|
actorQueue = {}
|
||||||
|
actorAssociationQueue = {}
|
||||||
|
|
||||||
|
actorTree = {}
|
||||||
|
currentPath = nil
|
||||||
|
pastPaths = {}
|
||||||
|
currentActor = nil
|
||||||
|
|
||||||
|
collectgarbage()
|
||||||
|
|
||||||
|
local errored = false
|
||||||
|
local firstrun = true
|
||||||
|
local playersLoaded = false
|
||||||
|
self:addcommand('Update', function()
|
||||||
|
if errored then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
errored = true
|
||||||
|
|
||||||
|
if P1 and P2 then
|
||||||
|
playersLoaded = true
|
||||||
|
end
|
||||||
|
if playersLoaded and not P1 and not P2 then -- sora exit hack
|
||||||
|
exit()
|
||||||
|
end
|
||||||
|
|
||||||
|
t = os.clock()
|
||||||
|
b = GAMESTATE:GetSongBeat()
|
||||||
|
local dt = t - lastt
|
||||||
|
lastt = t
|
||||||
|
|
||||||
|
if firstrun then
|
||||||
|
firstrun = false
|
||||||
|
dt = 0
|
||||||
|
self:GetChildren()[2]:hidden(1)
|
||||||
|
uranium:call('ready')
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, q in ipairs(globalQueue) do
|
||||||
|
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]))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
uranium:call('update', dt)
|
||||||
|
|
||||||
|
errored = false
|
||||||
|
|
||||||
|
return 0
|
||||||
|
end)
|
||||||
|
self:luaeffect('Update')
|
||||||
|
end
|
||||||
|
|
||||||
local success, result = pcall(function()
|
local success, result = pcall(function()
|
||||||
require('main')
|
require('main')
|
||||||
require('stdlib.util')
|
require('stdlib.util')
|
||||||
|
@ -684,7 +717,7 @@
|
||||||
currentPath = actorTree
|
currentPath = actorTree
|
||||||
|
|
||||||
self:addcommand('On', onCommand)
|
self:addcommand('On', onCommand)
|
||||||
self:addcommand('Ready', screen_ready_command)
|
self:addcommand('Ready', screenReadyCommand)
|
||||||
self:addcommand('Off', exit)
|
self:addcommand('Off', exit)
|
||||||
self:addcommand('SaltyReset', exit)
|
self:addcommand('SaltyReset', exit)
|
||||||
self:addcommand('WindowFocus', function()
|
self:addcommand('WindowFocus', function()
|
||||||
|
|
Loading…
Reference in New Issue