-- ActorFrame name, used for controlling the children from control actor (in FG).
local name = 'display'

local base_param = ...
local sw,sh,scx,scy,songdir,rr,am,bt,hs,pe,hr,ease,wratio,hratio,paraph = base_param.sw,base_param.sh,base_param.scx,base_param.scy,base_param.songdir,base_param.rr,base_param.am,base_param.bt,base_param.hs,base_param.pe,base_param.hr,base_param.ease,base_param.wratio,base_param.hratio,base_param.paraph

-- Camera manipulation table
local Cameras = {
	Name=name,
	Tween={
	}
}

-- Children manipulation table
local Actors = {
	Name=name,
	Tween={
		{'Glitch', 228, 'queuecommand', 'Glitch'},
		{'Glitch', 240, 'queuecommand', 'Normal'},
		{'Glitch', 420, 'queuecommand', 'Glitch'},
		{'Glitch', 432, 'queuecommand', 'Normal'},
		{'Glitch', 612, 'queuecommand', 'Glitch'},
		{'Glitch', 624, 'queuecommand', 'Normal'},
		{'Glitch', 804, 'queuecommand', 'Glitch'},
		{'Glitch', 816, 'queuecommand', 'Normal'},
		{'Glitch', 10236, 'queuecommand', 'Glitch'},
		{'Glitch', 10248, 'queuecommand', 'Normal'},
		{'Glitch', 12240, 'queuecommand', 'Glitch'},
		{'Glitch', 12288, 'queuecommand', 'Normal'},
		{'Glitch', 12624, 'queuecommand', 'Glitch'},
		{'Glitch', 12672, 'queuecommand', 'Normal'},
	}
}

-- Display does not manipulate Players.

-- Shortcut to the 'FG' ActorFrame.
local FG

-- The display should start at the very beginning of the songs.
return Def.ActorFrame{
Name=name,
InitCommand=function(self) FG = self:GetParent() end,
OnCommand=function(self)
	local c = FG:GetChild('Cameras')
	local a = FG:GetChild('Actors')
	c[#c+1] = Cameras
	a[#a+1] = Actors
	-- Display 
	self:fov(90):queuecommand('Initialize')
end,
paraph.AMVQuad({})..{
	Name='normal',
	OnCommand=function(self) self:SetTexture(FG:GetChild('elements'):GetTexture()) end
},
loadfile(songdir..'fg/glitch.lua')(base_param)..{
	Name='Glitch',
	OnCommand=function(self) self:visible(false) end,
	GlitchCommand=function(self) self:visible(true) end,
	NormalCommand=function(self) self:visible(false) end,
},
}