GHAHAHAAAAAAAAAA IT WORKS
This commit is contained in:
parent
441ca0facc
commit
f6638b8f3e
44
actors.xml
44
actors.xml
|
@ -1,7 +1,37 @@
|
||||||
<ActorFrame InitCommand="%oat._actor.initFrame">
|
<ActorFrame InitCommand="%oat._actor.initFrame"><children>
|
||||||
<children>
|
|
||||||
<Layer Condition="oat._actor.noShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init"/>
|
<!-- help -->
|
||||||
<Layer Condition="oat._actor.hasShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" Frag="@oat._actor.frag()" Vert="@oat._actor.vert()" InitCommand="%oat._actor.init"/>
|
|
||||||
<Layer Condition="oat._actor.next()" File="actors.xml" />
|
<Layer Condition="oat._actor.noShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init"/>
|
||||||
</children>
|
<Layer Condition="oat._actor.hasShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init" Frag="@oat._actor.frag()" Vert="@oat._actor.vert()" />
|
||||||
</ActorFrame>
|
<Layer Condition="oat._actor.noShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init"/>
|
||||||
|
<Layer Condition="oat._actor.hasShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init" Frag="@oat._actor.frag()" Vert="@oat._actor.vert()" />
|
||||||
|
<Layer Condition="oat._actor.noShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init"/>
|
||||||
|
<Layer Condition="oat._actor.hasShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init" Frag="@oat._actor.frag()" Vert="@oat._actor.vert()" />
|
||||||
|
<Layer Condition="oat._actor.noShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init"/>
|
||||||
|
<Layer Condition="oat._actor.hasShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init" Frag="@oat._actor.frag()" Vert="@oat._actor.vert()" />
|
||||||
|
<Layer Condition="oat._actor.noShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init"/>
|
||||||
|
<Layer Condition="oat._actor.hasShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init" Frag="@oat._actor.frag()" Vert="@oat._actor.vert()" />
|
||||||
|
<Layer Condition="oat._actor.noShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init"/>
|
||||||
|
<Layer Condition="oat._actor.hasShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init" Frag="@oat._actor.frag()" Vert="@oat._actor.vert()" />
|
||||||
|
<Layer Condition="oat._actor.noShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init"/>
|
||||||
|
<Layer Condition="oat._actor.hasShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init" Frag="@oat._actor.frag()" Vert="@oat._actor.vert()" />
|
||||||
|
<Layer Condition="oat._actor.noShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init"/>
|
||||||
|
<Layer Condition="oat._actor.hasShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init" Frag="@oat._actor.frag()" Vert="@oat._actor.vert()" />
|
||||||
|
<Layer Condition="oat._actor.noShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init"/>
|
||||||
|
<Layer Condition="oat._actor.hasShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init" Frag="@oat._actor.frag()" Vert="@oat._actor.vert()" />
|
||||||
|
<Layer Condition="oat._actor.noShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init"/>
|
||||||
|
<Layer Condition="oat._actor.hasShader()" Type="@oat._actor.type()" File="@oat._actor.file()" Font="@oat._actor.font()" InitCommand="%oat._actor.init" Frag="@oat._actor.frag()" Vert="@oat._actor.vert()" />
|
||||||
|
|
||||||
|
<Layer Condition="oat._actor.recurse()" File="actors.xml" InitCommand="%oat._actor.endRecurse" />
|
||||||
|
<Layer Condition="oat._actor.recurse()" File="actors.xml" InitCommand="%oat._actor.endRecurse" />
|
||||||
|
<Layer Condition="oat._actor.recurse()" File="actors.xml" InitCommand="%oat._actor.endRecurse" />
|
||||||
|
<Layer Condition="oat._actor.recurse()" File="actors.xml" InitCommand="%oat._actor.endRecurse" />
|
||||||
|
<Layer Condition="oat._actor.recurse()" File="actors.xml" InitCommand="%oat._actor.endRecurse" />
|
||||||
|
<Layer Condition="oat._actor.recurse()" File="actors.xml" InitCommand="%oat._actor.endRecurse" />
|
||||||
|
<Layer Condition="oat._actor.recurse()" File="actors.xml" InitCommand="%oat._actor.endRecurse" />
|
||||||
|
<Layer Condition="oat._actor.recurse()" File="actors.xml" InitCommand="%oat._actor.endRecurse" />
|
||||||
|
<Layer Condition="oat._actor.recurse()" File="actors.xml" InitCommand="%oat._actor.endRecurse" />
|
||||||
|
<Layer Condition="oat._actor.recurse()" File="actors.xml" InitCommand="%oat._actor.endRecurse" />
|
||||||
|
|
||||||
|
</children></ActorFrame>
|
|
@ -1,6 +1,6 @@
|
||||||
<ActorFrame Condition="%function(self) print('actorframe condition'); return true end" InitCommand="%function(self) print('actorframe initcommand') end">
|
<ActorFrame Condition="(function() print('actorframe condition'); recursionc = (recursionc or 0) + 1; return recursionc < 4 end)()" InitCommand="%function(self) print('actorframe initcommand'); self:removecommand('Init') end">
|
||||||
<children>
|
<children>
|
||||||
<Layer Condition="%function(self) print('sprite condition'); return true end" InitCommand="%function(self) print('sprite initcommand') end"/>
|
<Layer Condition="(function() print('sprite condition'); return true end)()" InitCommand="%function(self) print('sprite initcommand'); self:removecommand('Init') end"/>
|
||||||
<Layer Condition="%function(self) print('file condition'); recursionc = (recursionc or 0) + 1; return recursionc < 4 end" InitCommand="%function(self) print('file initcommand') end" File="actors.xml" />
|
<Layer Condition="(function() print('file condition'); return true end)()" InitCommand="%function(self) print('file initcommand'); self:removecommand('Init') end" File="actorsTest.xml" />
|
||||||
</children>
|
</children>
|
||||||
</ActorFrame>
|
</ActorFrame>
|
93
main.xml
93
main.xml
|
@ -166,6 +166,9 @@
|
||||||
if hasExited then return end
|
if hasExited then return end
|
||||||
hasExited = true
|
hasExited = true
|
||||||
uranium:call('exit')
|
uranium:call('exit')
|
||||||
|
-- good templates clean up after themselves
|
||||||
|
_G.oat = nil
|
||||||
|
_main:hidden(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
local actorsInitialized = false -- if true, no new actors can be created
|
local actorsInitialized = false -- if true, no new actors can be created
|
||||||
|
@ -240,16 +243,20 @@
|
||||||
|
|
||||||
local errored = false
|
local errored = false
|
||||||
local firstrun = true
|
local firstrun = true
|
||||||
|
local playersLoaded = false
|
||||||
self:addcommand('Update', function()
|
self:addcommand('Update', function()
|
||||||
if not P1 and not P2 then -- sora exit hack
|
|
||||||
exit()
|
|
||||||
end
|
|
||||||
|
|
||||||
if errored then
|
if errored then
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
errored = true
|
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()
|
t = os.clock()
|
||||||
b = GAMESTATE:GetSongBeat()
|
b = GAMESTATE:GetSongBeat()
|
||||||
local dt = t - lastt
|
local dt = t - lastt
|
||||||
|
@ -313,17 +320,41 @@
|
||||||
|
|
||||||
oat._actor = {}
|
oat._actor = {}
|
||||||
|
|
||||||
function oat._actor.next()
|
local function nextActor()
|
||||||
local actor = actorQueue[1]
|
local new, idx = findFirstActor(currentPath)
|
||||||
if actor then
|
if not new then
|
||||||
table.remove(actorQueue, 1)
|
print('no actor!')
|
||||||
currentActor = actor
|
currentActor = nil
|
||||||
|
else
|
||||||
|
print('adding new actor')
|
||||||
|
currentActor = new
|
||||||
|
table.remove(currentPath, idx)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function oat._actor.recurse()
|
||||||
|
local newFrame, idx = findFirstActorFrame(currentPath)
|
||||||
|
if newFrame then
|
||||||
|
table.insert(pastPaths, currentPath)
|
||||||
|
currentPath = currentPath[idx]
|
||||||
|
table.remove(pastPaths[#pastPaths], idx)
|
||||||
|
print('recursing: ' .. #pastPaths)
|
||||||
|
return true
|
||||||
|
elseif currentActor then
|
||||||
|
table.insert(pastPaths, currentPath)
|
||||||
|
print('recursing (actor): ' .. #pastPaths)
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
|
print('no actor or actorframe!')
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function oat._actor.endRecurse()
|
||||||
|
print('heading back: ' .. #pastPaths)
|
||||||
|
currentPath = table.remove(pastPaths, #pastPaths)
|
||||||
|
end
|
||||||
|
|
||||||
function oat._actor.cond()
|
function oat._actor.cond()
|
||||||
return currentActor ~= nil
|
return currentActor ~= nil
|
||||||
end
|
end
|
||||||
|
@ -333,6 +364,7 @@
|
||||||
end
|
end
|
||||||
|
|
||||||
function oat._actor.noShader()
|
function oat._actor.noShader()
|
||||||
|
nextActor()
|
||||||
return oat._actor.cond() and not oat._actor.hasShader()
|
return oat._actor.cond() and not oat._actor.hasShader()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -358,18 +390,27 @@
|
||||||
|
|
||||||
function oat._actor.init(self)
|
function oat._actor.init(self)
|
||||||
currentActor.init(self)
|
currentActor.init(self)
|
||||||
currentActor = nil -- shouldn't be needed from now on
|
self:removecommand('Init')
|
||||||
|
currentActor = nil -- to prevent any weirdness
|
||||||
end
|
end
|
||||||
|
|
||||||
function oat._actor.initFrame(self)
|
function oat._actor.initFrame(self)
|
||||||
print('initiating an actorframe')
|
print('initializing an actorframe')
|
||||||
--local nextChild = self(2)
|
self:removecommand('Init')
|
||||||
self:SetDrawFunction(function()
|
self:SetDrawFunction(function()
|
||||||
--if nextChild then
|
for i = 1, self:GetNumChildren() do
|
||||||
-- nextChild:Draw()
|
local a = self(i)
|
||||||
--end
|
if a.fov then -- actorframe
|
||||||
-- TODO
|
a:Draw()
|
||||||
|
end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
if currentPath.init then
|
||||||
|
print('found init function, calling')
|
||||||
|
currentPath.init(self)
|
||||||
|
currentPath.init = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function createProxyActor(name)
|
local function createProxyActor(name)
|
||||||
|
@ -597,7 +638,7 @@
|
||||||
function addChild(frame, actor)
|
function addChild(frame, actor)
|
||||||
actorAssociationQueue[actor.__queue] = frame.__queue
|
actorAssociationQueue[actor.__queue] = frame.__queue
|
||||||
end
|
end
|
||||||
|
|
||||||
local function transformQueueToTree()
|
local function transformQueueToTree()
|
||||||
local tree = {}
|
local tree = {}
|
||||||
local paths = {}
|
local paths = {}
|
||||||
|
@ -633,18 +674,19 @@
|
||||||
end
|
end
|
||||||
|
|
||||||
local success, result = pcall(function()
|
local success, result = pcall(function()
|
||||||
--require('main')
|
require('main')
|
||||||
--require('stdlib.util')
|
require('stdlib.util')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if success then
|
if success then
|
||||||
luaobj = result
|
luaobj = result
|
||||||
|
|
||||||
--local queue = actorQueue
|
print('---')
|
||||||
--actorQueue = deepcopy(actorQueue)
|
|
||||||
--transformQueueToTree()
|
transformQueueToTree()
|
||||||
--Trace(fullDump(actorTree))
|
Trace(fullDump(actorTree))
|
||||||
--currentPath = actorTree
|
currentPath = actorTree
|
||||||
|
nextActor()
|
||||||
|
|
||||||
self:addcommand('On', onCommand)
|
self:addcommand('On', onCommand)
|
||||||
self:addcommand('Ready', screen_ready_command)
|
self:addcommand('Ready', screen_ready_command)
|
||||||
|
@ -668,7 +710,6 @@
|
||||||
-- By removing the command after it's done, it can only ever run once
|
-- By removing the command after it's done, it can only ever run once
|
||||||
self:removecommand('Init')
|
self:removecommand('Init')
|
||||||
end"><children>
|
end"><children>
|
||||||
<!--<Layer Condition="oat._actor.next()" File="actors.xml" />-->
|
<Layer File="actors.xml" />
|
||||||
<Layer File="actorsTest.xml" />
|
|
||||||
<Layer Type="Quad" InitCommand="xywh,SCREEN_CENTER_X,SCREEN_CENTER_Y,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,#000000;sleep,9e9"/>
|
<Layer Type="Quad" InitCommand="xywh,SCREEN_CENTER_X,SCREEN_CENTER_Y,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,#000000;sleep,9e9"/>
|
||||||
</children></Layer>
|
</children></Layer>
|
Loading…
Reference in New Issue