--Since we're targeting 5.1 & 5.2, FromString exists to replace ApplyGameCommand. Thanks, Kyzentun! -Kid
local poptions = {GAMESTATE:GetPlayerState(0):GetPlayerOptions('ModsLevel_Song'),GAMESTATE:GetPlayerState(1):GetPlayerOptions('ModsLevel_Song')}
local function apply_mod(mod, pn) poptions[pn]:FromString(mod) end

-- local cond_f_result= FUCK_EXE
local cond_f_result= true
local function optional_actor(cond, actor)
	if cond then return actor end
	return Def.Actor{}
end

return Def.ActorFrame{
  Name= "actor_g",
  InitCommand= function(self)
	songName = GAMESTATE:GetCurrentSong():GetSongDir();
	
	m_bl = 60/140
			
	m_sk = 0
	
	kioku_p1r = {}
	kioku_p2r = {}
	
	kioku_p1speed = 2;
	kioku_p2speed = -2;
	
	kioku_colspeeds = {{1,1,1,1},{1,1,1,1}}
	
	kioku_p1a = {{},{},{}}
	kioku_p1ptr = {1,1,1}
	kioku_p2a = {{},{},{}}
	kioku_p2ptr = {1,1,1}
	
	kioku_p1e = {}
	kioku_p2e = {}
	kioku_p1eptr = 1;
	kioku_p2eptr = 1;
	
	kioku_flicker = 1;
	kioku_xpos = 0;
	kioku_tet = 20;
	kioku_bingusdelay = 8;
	
	kioku_note_height = 5;
	
	kioku_fg_all = self;
	
	sw = SCREEN_WIDTH;
	sh = SCREEN_HEIGHT;
	
end,
  optional_actor(cond_f_result,
  Def.ActorFrame{
    Name= "actor_h",
    OnCommand= function(self)
	if not string.find(string.lower(PREFSMAN:GetPreference('VideoRenderers')), 'opengl')
	or string.find(string.lower(PREFSMAN:GetPreference('VideoRenderers')), 'd3d')
	and string.find(string.lower(PREFSMAN:GetPreference('VideoRenderers')), 'opengl') 
	and string.find(string.lower(PREFSMAN:GetPreference('VideoRenderers')), 'd3d') < 
	string.find(string.lower(PREFSMAN:GetPreference('VideoRenderers')), 'opengl') then
		SCREENMAN:SystemMessage('D3D Video Renderer detected. Expect textures to fail.');
	end
end,
    Def.Quad{
      Name= "actor_i",
      InitCommand= cmd(visible,false),
      OnCommand= cmd(sleep,1000),
    },
    LoadActor('modhelpers.lua') .. {
      Name= "actor_j",
      File= "modhelpers.lua",
    },
    Def.Quad{
      Name= "actor_k",
      InitCommand= cmd(visible,false),
      OnCommand= function(self)
		
---------------------------------------------------------------------------------------
----------------------DON'T TOUCH IT KIDDO---------------------------------------------
---------------------------------------------------------------------------------------
			
			function list_compare(a,b)
				return a < b
			end
			
			checked = false;
			
			init_modsp1 = '2x';
			init_modsp2 = '2x';
			
			mod_plr = {};
			
			mod_firstSeenBeat = GAMESTATE:GetSongBeat();
			
---------------------------------------------------------------------------------------
----------------------END DON'T TOUCH IT KIDDO-----------------------------------------
---------------------------------------------------------------------------------------

			m_curnote = 1;
			--This will help take the resolution and aspect ratio into consideration with invert and other things. -Kid
			--It's also useful for scaling anything messing with the z position, because aspect ratio affects it. -Kid
			kioku_invert_ratio = (480*(SCREEN_WIDTH/SCREEN_HEIGHT))/640
			
			kioku_rot = {90,0,180,-90}
			
			function kioku_group(beat)
			
				if beat<164 then
			
					if beat/4 - math.floor(beat/4) < 0.5 then
						return 1
					else
						return 2
					end
				
				else
					
					local b = beat/4 - math.floor(beat/4)
					
					if b < 0.125 or b > 0.5 then
						return 1
					else
						return 2
					end
					
				end
				
				return 1
			end
			
			function kioku_quantize(beat)
				local r = beat-math.floor(beat)
				if r == 0 then return 1
				elseif r == 0.5 then return 2
				else return 3 end
			end
			
			function kioku_placenote(beat,col)
				
				local group = kioku_group(beat)
				local a = _G['kioku_p'..group..'a'][kioku_quantize(beat)][ _G['kioku_p'..group..'ptr'][kioku_quantize(beat)] ]
				
				col = col+1
				local speed = _G['kioku_p'..group..'speed']*kioku_colspeeds[group][col];
				
				a.active = true;
				a.col = col;
				a.alpha = 0;
				a.glow = 1;
				a.targ = beat
				a.zoom = 1;
				
				local b = a.actor
				
				if b then
					b:visible(true);
					b:x(_G['kioku_p'..group..'r'][col]:GetX())
					b:diffusealpha(1)
					b:glow(1,1,1,0);
					b:y((4*64*speed)+_G['kioku_p'..group..'r'][col]:GetY());
					b:z(_G['kioku_p'..group..'r'][col]:GetZ());
					b:zoom(1);
					b:rotationz(kioku_rot[col])
				end
				
				_G['kioku_p'..group..'ptr'][kioku_quantize(beat)] = _G['kioku_p'..group..'ptr'][kioku_quantize(beat)]+1
				if _G['kioku_p'..group..'ptr'][kioku_quantize(beat)] > table.getn(_G['kioku_p'..group..'a'][kioku_quantize(beat)]) then
					_G['kioku_p'..group..'ptr'][kioku_quantize(beat)] = 1
				end
				
			end
			
			function kioku_arroweffects(obj,targ,pf)
				local beat = GAMESTATE:GetSongBeat()
				obj:addx(_G['kioku_fp_sinewavep'..pf]:GetX()*math.sin((targ-beat)*math.pi*_G['kioku_fp_sineperiodp'..pf]:GetX()));
				obj:addy(_G['kioku_fp_sinewavep'..pf]:GetY()*math.sin((targ-beat)*math.pi*_G['kioku_fp_sineperiodp'..pf]:GetY()));
				obj:addz(_G['kioku_fp_sinewavep'..pf]:GetZ()*math.sin((targ-beat)*math.pi*_G['kioku_fp_sineperiodp'..pf]:GetZ()));
			end
			
			function kioku_update()
				local beat = GAMESTATE:GetSongBeat()
				for pf=1,2 do
					for q=1,3 do
						for i=1,table.getn(_G['kioku_p'..pf..'a'][q]) do
							local a = _G['kioku_p'..pf..'a'][q][i]
							if a.active and beat > mod_firstSeenBeat+1 then
								local speed = _G['kioku_p'..pf..'speed']*kioku_colspeeds[pf][a.col];
								local b = a.actor
								
								local x = b:GetX()-(_G['kioku_p'..pf..'r'][a.col]:GetX())
								local y = b:GetY()-(math.max(a.targ-beat,0)*64*speed)+_G['kioku_p'..pf..'r'][a.col]:GetY()
								local z = b:GetZ()-(_G['kioku_p'..pf..'r'][a.col]:GetZ())
								
								if math.sqrt((x*x)+(y*y)+(z*z)) < 20 then
									b:linear(0.02);
								end
								
								b:x(_G['kioku_p'..pf..'r'][a.col]:GetX())
								b:diffusealpha(a.alpha)
								b:glow(1,1,1,a.glow);
								b:y((math.max(a.targ-beat,0)*64*speed)+_G['kioku_p'..pf..'r'][a.col]:GetY());
								b:z(_G['kioku_p'..pf..'r'][a.col]:GetZ());
								b:zoom(a.zoom)
								b:rotationz(kioku_rot[a.col])
								
								kioku_arroweffects(b,a.targ,pf)
								
								if a.alpha < 1 then
									a.alpha = a.alpha+0.2;
								else
									a.alpha = 1
									if a.glow > 0 then
										a.glow = a.glow-0.2
									else
										a.glow = 0;
									end
								end
								
								if a.targ-beat <= 0 then
									kioku_flash(pf,a.col)
									b:visible(false);
									a.active = false;
								end
								
							end
						end
					end
				end
				
			end
			
			function kioku_flash(pf,col)
				local a = _G['kioku_p'..pf..'e'][ _G['kioku_p'..pf..'eptr'] ]
				
				a:visible(true);
				a:x(_G['kioku_p'..pf..'r'][col]:GetX());
				a:y(_G['kioku_p'..pf..'r'][col]:GetY());
				a:z(_G['kioku_p'..pf..'r'][col]:GetZ());
				a:rotationz(kioku_rot[col])
				a:diffusealpha(1.2);
				a:zoom(1.1);
				a:accelerate(0.18);
				a:zoom(1.0);
				a:diffusealpha(0);
				a:glowshift();
				a:effectperiod(0.05);
				a:effectcolor1(1,1,1,0);
				a:effectcolor2(1,1,1,0.5);
				a:queuecommand('Hide');
				
				_G['kioku_p'..pf..'eptr'] = _G['kioku_p'..pf..'eptr']+1
				if _G['kioku_p'..pf..'eptr'] > table.getn(_G['kioku_p'..pf..'e']) then
					_G['kioku_p'..pf..'eptr'] = 1
				end
			end

			--beat based mods
			--{beat_start, beat_end, mods, len_or_end, player_number}
			mods = {
				{0,999,'*10000 -100000 cover, *10000 no beat','end'},
				{0,999,'*0.3 2x','end'},
				
				{0,8,'*1000 dark','len'},
				{1,35,'*0.02 no dark','len'},
				--{4,30,'1000 reverse0, *0.666 1000 reverse1, *0.333 1000 reverse2, 1000 reverse','end'},
				
				{100,164,'*0.3 1.8x','end'},
				{31.5,100,'*0.6 -150 reverse,*0.8 stealth, *0.8 dark','end'},
				{100,108,'*1.5 no reverse,*1.25 no stealth','end'},
				
				{19.0-.1,1,'*10 100 drunk','len'},
				{19.25-.1,1,'*20 -100 drunk','len'},
				{19.50-.1,1,'*20 100 drunk','len'},
				{19.75-.1,1,'*10 no drunk','len'},
				
				{22.5-.1,1,'*10 100 drunk','len'},
				{22.75-.1,1,'*20 -100 drunk','len'},
				{23.0-.1,1,'*20 100 drunk','len'},
				{23.25-.1,1,'*20 -100 drunk','len'},
				{23.50-.1,1,'*20 100 drunk','len'},
				{23.75-.1,1,'*10 no drunk','len'},
				
				{27.0-.1,1,'*10 100 drunk','len'},
				{27.25-.1,1,'*20 -100 drunk','len'},
				{27.50-.1,1,'*20 100 drunk','len'},
				{27.75-.1,1,'*10 no drunk','len'},
				
				{103.5-.1,1,'*5 50 stealth','len'},
				{104.0-.1,1,'*5 no stealth','len'},
				{120-.1,1,'*10 stealth','len'},
				{120.5-.1,1,'*10 no stealth','len'},
				{135.5-.1,1,'*5 50 stealth','len'},
				{136.0-.1,1,'*5 no stealth','len'},
				{152-.1,1,'*10 stealth','len'},
				{152.5-.1,1,'*10 no stealth','len'},
				
				{180,196,'*0.2 40 drunk','end',1},
				{180,196,'*0.2 -40 drunk','end',2},
				
				{226.75,999,'*0.4 stealth, *0.4 dark','end'},
				{226,999,'*100000 -41 squareperiod','end'},-- -80% becomes -41% -Kid
			}
			
			simple_m0d(18.5,300,0.3,'tipsy');
			simple_m0d(25.5,200,0.3,'tipsy');
			
			--[[
			for i=0,3 do
				table.insert(mods,{164,197,'*10000 '..((i*2*20)+20)..' translatezoffset'..((i*2)),'end'});
				table.insert(mods,{164,197,'*10000 '..((((i*2)+1)*20)+20)..' translatezoffset'..((i*2)+1),'end'});
				table.insert(mods,{164,197,'*10 '..(200)..' translatez'..((i*2)),'end'});
				table.insert(mods,{164,197,'*10 '..(-200)..' translatez'..((i*2)+1),'end'});
			end
			
			for i=0,3 do
				table.insert(mods,{179,197,'*10 '..(200)..' translatez'..((i*2)),'end',1});
				table.insert(mods,{179,197,'*10 '..(-200)..' translatez'..((i*2)+1),'end',1});
				table.insert(mods,{179,197,'*10 '..(-200)..' translatez'..((i*2)),'end',2});
				table.insert(mods,{179,197,'*10 '..(200)..' translatez'..((i*2)+1),'end',2});
			end
			]]
			
			for i=164,177,2 do
				table.insert(mods,{i+.25-.05,.5,'*50 10 invert','len'})
				table.insert(mods,{i+.75-.05,.5,'*50 no invert','len'})
				table.insert(mods,{i+1.25-.05,.5,'*50 -10 invert','len'})
				table.insert(mods,{i+1.75-.05,.5,'*50 no invert','len'})
			end
			
			for i=164,196,2 do
				table.insert(mods,{i-.05,.5,'*50 5.0 alternate','len'})
				table.insert(mods,{i+.5-.05,.5,'*50 no alternate','len'})
				table.insert(mods,{i+1-.05,.5,'*50 -5.0 alternate, *50 5.0 reverse','len'})
				table.insert(mods,{i+1.5-.05,.5,'*50 no alternate, *50 no reverse','len'})
			end
			
			table.insert(mods,{179-.1,1,'*50 no alternate, *50 no reverse, *10 no drunk','len'})
			
			for i=180,196,2 do--Multiplied values by kioku_invert_ratio and did some math. -Kid
				table.insert(mods,{i+.25-.05,.5,'*50 -'..((250*kioku_invert_ratio) - 10)..' invert','len',1})
				table.insert(mods,{i+.75-.05,.5,'*50 -'..250*kioku_invert_ratio..' invert','len',1})
				table.insert(mods,{i+1.25-.05,.5,'*50 -'..((250*kioku_invert_ratio) + 10)..' invert','len',1})
				table.insert(mods,{i+1.75-.05,.5,'*50 -'..250*kioku_invert_ratio..' invert','len',1})
				
				table.insert(mods,{i+.25-.05,.5,'*50 '..((250*kioku_invert_ratio) + 10)..' invert','len',2})
				table.insert(mods,{i+.75-.05,.5,'*50 '..250*kioku_invert_ratio..' invert','len',2})
				table.insert(mods,{i+1.25-.05,.5,'*50 '..((250*kioku_invert_ratio) - 10)..' invert','len',2})
				table.insert(mods,{i+1.75-.05,.5,'*50 '..250*kioku_invert_ratio..' invert','len',2})
			end
			
			for i=164,178,2 do
				table.insert(mods,{i-.05,1,'*10 90 stealth','len',2})
				table.insert(mods,{i-.05,1,'*10 no stealth','len',1})
				table.insert(mods,{i+1-.05,1,'*10 90 stealth','len',1})
				table.insert(mods,{i+1-.05,1,'*10 no stealth','len',2})
			end
			
			table.insert(mods,{179,196,'1.8x','end'})
			
			for i=180,196,2 do
				table.insert(mods,{i-.05,1,'*10 90 stealth','len',2})
				table.insert(mods,{i-.05,1,'*10 no stealth','len',1})
				if i<196 then
					table.insert(mods,{i+1-.05,1,'*10 90 stealth','len',1})
				else
					table.insert(mods,{i+1-.05,1,'*10 no stealth','len',1})
				end
				table.insert(mods,{i+1-.05,1,'*10 no stealth','len',2})
			end
			
			table.insert(mods,{195,223,'*2.4 -100 reverse,*3.2 stealth','end'})
			
			simple_m0d(226.75,400,2,'square');
			
			simple_m0d(17.5,50,0.4,'stealth');
			simple_m0d(21.5,50,0.4,'stealth');
			simple_m0d(25.5,50,0.4,'stealth');
			
			--time based mods
			mod_time = 0;
			--{time_start, time_end, mods, len_or_end, player_number}
			mods2 = {
				--{0,200,'3x','end',1},
			}
			
			curaction = 1;
			--{beat,message,persists}
			mod_actions = {
				{0,function()
				
					for pn=1,2 do
						local a = _G['P'..pn]
						local p = 0.25;
						if pn == 2 then p = 0.75; end;
						if a then
							--Force position and fix zoomz. -Kid
							a:x(SCREEN_WIDTH*p):zoomz(SCREEN_HEIGHT/480);
						end
					end
					
				end},
				
				{0.25,function()
					MESSAGEMAN:Broadcast('ProxyThis');--It's all for the AFT. -Kid
				end},
				{17.5,'Hihat'},
				{21.5,'Hihat'},
				{25.5,'Hihat'},
				
				{36,function()
					for pn=1,2 do
						local a = _G['P'..pn]
						if pn==2 then d=-1 end
						if a then
							a:zoom(1*(SCREEN_HEIGHT/480));--It'll work on HD themes. -Kid
						end
					end
					kioku_p1:x(SCREEN_CENTER_X);
					kioku_p2:x(SCREEN_CENTER_X);
					kioku_p1:zoom(1*(SCREEN_HEIGHT/480));--It'll work on HD themes. -Kid
					kioku_p2:zoom(1*(SCREEN_HEIGHT/480));--It'll work on HD themes. -Kid
				end,true},
				
				{37.75,function()
					kioku_p1:skewx(0.33);
				end},
				{39.75,function()
					kioku_p2:skewx(-0.33);
				end},
				{41.75,function()
					kioku_p1:skewx(0);
					kioku_p1:rotationy(-30);
				end},
				{43.75,function()
					kioku_p2:skewx(0);
					kioku_p2:rotationy(30);
				end},
				{45.75,function()
					kioku_p1:rotationy(-30);
					kioku_p1:rotationx(-20);
				end},
				{47.75,function()
					kioku_p2:rotationy(30);
					kioku_p2:rotationx(20);
				end},
				{49.75,function()
					kioku_p1:rotationy(0);
					kioku_p1:rotationz(0);
					kioku_p1:rotationx(-30);
				end},
				{51.75,function()
					kioku_p2:rotationy(0);
					kioku_p2:rotationz(0);
					kioku_p2:rotationx(30);
				end},
				{53.75,function()
					kioku_p1:rotationx(-40);
				end},
				{55.75,function()
					kioku_p2:rotationx(40);
				end},
				{57.75,function()
					kioku_p1:rotationx(0);
					kioku_p1:rotationz(0.5*-20);
				end},
				{59.75,function()
					kioku_p2:rotationx(0);
					kioku_p2:rotationz(0.5*30);
				end},
				{61.75,function()
					kioku_p1:rotationy(0.75*-20);
					kioku_p1:rotationz(0.5*30);
				end},
				{63.75,function()
					kioku_p2:rotationy(0.75*-20);
					kioku_p2:rotationz(0.5*-30);
				end},
				{65.75,function()
					kioku_p1:rotationy(0.75*20);
					kioku_p1:rotationz(0.5*30);
				end},
				{67.75,function()
					kioku_p2:rotationy(0.75*20);
					kioku_p2:rotationz(0.5*-30);
				end},
				{69.75,function()
					kioku_p1:stopeffect();
					kioku_p1:rotationx(-40);
				end},
				{71.75,function()
					kioku_p2:stopeffect();
					kioku_p2:rotationx(40);
				end},
				{73.75,function()
					kioku_p1:rotationx(0);
					kioku_p1:rotationy(0);
					kioku_p1:rotationz(0);
					kioku_p1:zoom(SCREEN_HEIGHT/480)--It'll work on HD themes. -Kid
					kioku_p1:y(SCREEN_CENTER_Y)
					kioku_p1:bob()
					kioku_p1:effectclock('bgm');
					kioku_p1:effectperiod(2);
					kioku_p1:effectmagnitude(0,0,0);
					kioku_bobmag:linear(m_bl*2);
					kioku_bobmag:x(100);
				end},
				{75.75,function()
					kioku_p2:rotationx(0);
					kioku_p2:rotationy(0);
					kioku_p2:rotationz(0);
					kioku_p2:zoom(SCREEN_HEIGHT/480)--It'll work on HD themes. -Kid
					kioku_p2:y(SCREEN_CENTER_Y)
					kioku_p2:bob()
					kioku_p2:effectclock('bgm');
					kioku_p2:effectperiod(2);
					kioku_p2:effectmagnitude(-70,20,0);
				end},
				{77.75,function()
					kioku_p1:zoom(SCREEN_HEIGHT/480)--It'll work on HD themes. -Kid
					kioku_p1:y(SCREEN_CENTER_Y)
					kioku_p1:bob()
					kioku_p1:effectclock('bgm');
					kioku_p1:effectperiod(2);
					kioku_p1:effectmagnitude(60,-30,0);
				end},
				{79.75,function()
					kioku_p2:zoom(SCREEN_HEIGHT/480)--It'll work on HD themes. -Kid
					kioku_p2:y(SCREEN_CENTER_Y)
					kioku_p2:bob()
					kioku_p2:effectclock('bgm');
					kioku_p2:effectperiod(2);
					kioku_p2:effectmagnitude(-60,-30,0);
				end},
				
				{81.75,function()
					kioku_p1:stopeffect();
					kioku_p1:zoom(SCREEN_HEIGHT/480)--It'll work on HD themes. -Kid
					kioku_p1:y(SCREEN_CENTER_Y)
				end},
				{83.75,function()
					kioku_p2:stopeffect();
					kioku_p2speed = 2.5
					kioku_p2:zoom(1.3*(SCREEN_HEIGHT/480))--Scaling for HD themes. -Kid
					kioku_p2:y(SCREEN_CENTER_Y-80*(SCREEN_HEIGHT/480))
					kioku_p2:rotationx(-30);
					kioku_p2:rotationy(20);
					kioku_p2:rotationz(10);
					for i=1,4 do
						kioku_p2r[i]:addx(-250)
						kioku_p2r[i]:linear(m_bl*4)
						kioku_p2r[i]:addx(500)
						kioku_p2r[i]:sleep(0);
						kioku_p2r[i]:addx(-250)
					end
				end},
				{87.75,function()
					kioku_p2speed = 2.5
					kioku_p2:zoom(1.3*(SCREEN_HEIGHT/480))--Scaling for HD themes. -Kid
					kioku_p2:y(SCREEN_CENTER_Y-80*(SCREEN_HEIGHT/480))
					kioku_p2:rotationx(-30);
					kioku_p2:rotationy(-20);
					kioku_p2:rotationz(-10);
					for i=1,4 do
						kioku_p2r[i]:addx(300)
						kioku_p2r[i]:linear(m_bl*4)
						kioku_p2r[i]:addx(-500)
						kioku_p2r[i]:sleep(0);
						kioku_p2r[i]:addx(200)
					end
				end},
				{91.75,function()
					kioku_p2speed = -2
					kioku_p2:zoom(SCREEN_HEIGHT/480)--It'll work on HD themes. -Kid
					kioku_p2:y(SCREEN_CENTER_Y)
					kioku_p2:rotationx(0);
					kioku_p2:rotationy(0);
					kioku_p2:rotationz(0);
				end},
				
				--Note, z position also now depends on ratio, as that affects it! -Kid
				
				{92-.05,function()
					for i=0,3 do
						local d = 1
						if math.mod(i,2) == 0 then d = -1 end
						kioku_p1r[i+1]:linear(0.1)
						kioku_p1r[i+1]:z(80*d*kioku_invert_ratio)
					end
				end},
				{92.75-.05,function()
					for i=0,3 do
						local d = 1
						if math.mod(i,2) == 0 then d = -1 end
						kioku_p1r[i+1]:linear(0.1)
						kioku_p1r[i+1]:z(-80*d*kioku_invert_ratio)
					end
				end},
				{93.25-.05,function()
					for i=0,3 do
						local d = 1
						if math.mod(i,2) == 0 then d = -1 end
						kioku_p1r[i+1]:linear(0.1)
						kioku_p1r[i+1]:z(80*d*kioku_invert_ratio)
						kioku_p2r[i+1]:z(80*d*kioku_invert_ratio)
					end
				end},
				
				{94.25-.05,function()
					for i=0,3 do
						local d = 1
						if math.mod(i,2) == 0 then d = -1 end
						kioku_p1r[i+1]:linear(0.1)
						kioku_p1r[i+1]:z(-80*d*kioku_invert_ratio)
					end
				end},
				{94.75-.05,function()
					for i=0,3 do
						local d = 1
						if math.mod(i,2) == 0 then d = -1 end
						kioku_p1r[i+1]:linear(0.1)
						kioku_p1r[i+1]:z(80*d*kioku_invert_ratio)
					end
				end},
				{95.25-.05,function()
					for i=0,3 do
						local d = 1
						if math.mod(i,2) == 0 then d = -1 end
						kioku_p1r[i+1]:linear(0.1)
						kioku_p1r[i+1]:z(-50*d*kioku_invert_ratio)
					end
				end},
				
				{96-.05,function()
					kioku_p1:linear(0.1)
					kioku_p1:rotationy(15);
				end},
				{96.75-.05,function()
					kioku_p1:linear(0.1)
					kioku_p1:rotationy(-20);
				end},
				{97.25-.05,function()
					kioku_p1:linear(0.1)
					kioku_p1:rotationy(25);
					kioku_p2:rotationy(-25);
				end},
				
				{98.25-.05,function()
					kioku_p2:linear(0.1)
					kioku_p2:rotationy(30);
				end},
				{98.75-.05,function()
					kioku_p2:linear(0.1)
					kioku_p2:rotationy(-35);
				end},
				{99.25-.05,function()
					kioku_p2:linear(0.1)
					kioku_p2:rotationy(40);
				end},
				
				{100,function()
				
					MESSAGEMAN:Broadcast('ShowAFT');
					
				end},
				
				{100,function()
					kioku_xsc:x(0.1);
					kioku_xsc:linear(m_bl*60)
					kioku_xsc:x(0.4);
					kioku_xsc:linear(m_bl*4)
					kioku_xsc:x(0);
					kioku_ysc:y(0);
					kioku_ysc:linear(m_bl*56)
					kioku_ysc:y(0.6);
					kioku_ysc:linear(m_bl*8)
					kioku_ysc:y(0);
					kioku_skewer:linear(m_bl*60)
					kioku_skewer:x(2);
					kioku_skewer:linear(m_bl*4)
					kioku_skewer:x(0);
					
					kioku_zagger:x(0);
					kioku_zagger:linear(m_bl*60)
					kioku_zagger:x(100);
					kioku_zagger:linear(m_bl*4)
					kioku_zagger:x(0);
				end},
				
				{132,function()
					kioku_roter:linear(m_bl*28)
					kioku_roter:x(40);
					kioku_roter:linear(m_bl*4)
					kioku_roter:x(0);
					
					for i=0,3 do
						kioku_p1r[i+1]:z(0)
						kioku_p2r[i+1]:z(0)
					end
					kioku_p1:rotationy(0)
					kioku_p2:rotationy(0)
					
				end},
				
				{164,function()
					
					MESSAGEMAN:Broadcast('HideAFT');
					
				end},
				
				{179,function()
				
					kioku_invert:decelerate(m_bl)
					kioku_invert:x(250*kioku_invert_ratio);--Did some ratio BS to get ratio-specific inverts. -Kid
				
					for pn=1,2 do
						local a = _G['P'..pn]
						local d = -1;
						if pn == 2 then d = 1 end;
						if a then
							a:decelerate(m_bl)
							a:x(SCREEN_CENTER_X);
							a:GetChild('Judgment'):decelerate(m_bl);
							--Also, did some ratio BS to have the judgment & combo line up with the playfields. -Kid
							a:GetChild('Judgment'):x(160*d*kioku_invert_ratio):sleep(9.01 - m_bl);--Keep position. -Kid
							--The skewx is because of lambda doing things to combo. -Kid
							a:GetChild('Combo'):stoptweening():skewx(0):decelerate(m_bl);
							a:GetChild('Combo'):x(160*d*kioku_invert_ratio):sleep(9.01 - m_bl);--Keep position. -Kid
						end
					end
				end},
				
				{198.50,function()
					kioku_p2:rotationy(40);
				end},
				{200.50,function()
					kioku_p1:rotationy(-40);
				end},
				{202.50,function()
					kioku_p2:rotationy(0);
					kioku_p2:rotationx(30);
					kioku_p2:rotationz(-10);
				end},
				{204.50,function()
					kioku_p1:rotationy(0);
					kioku_p1:rotationx(-30);
					kioku_p1:rotationz(-10);
				end},
				{206.50,function()
					kioku_p2:rotationy(20);
					kioku_p2:rotationz(20);
				end},
				{208.50,function()
					kioku_p1:rotationy(20);
					kioku_p1:rotationz(20);
				end},
				
				
				
				{200,function()
				
					kioku_invert:decelerate(m_bl)
					kioku_invert:x(250*kioku_invert_ratio);--Did some ratio BS to get ratio-specific inverts. -Kid
				
					for pn=1,2 do
						local a = _G['P'..pn]
						local d = -1;
						local p = 0.25;
						if pn == 2 then d = 1; p = 0.75; end;
						if a then
							a:x(SCREEN_WIDTH*p);
							a:GetChild('Judgment'):x(0);
							a:GetChild('Combo'):x(0);
						end
					end
					
				end},
				
				{211.5,function()
					kioku_alter2:linear(m_bl*0.5);
					kioku_alter2:x(-1);
					kioku_alter:linear(m_bl*0.5);
					kioku_alter:x(2);
					kioku_p1:linear(m_bl*0.5);
					kioku_p1:rotationy(0);
					kioku_p1:rotationz(0);
					kioku_p1:rotationx(15);
					kioku_p2:linear(m_bl*0.5);
					kioku_p2:rotationy(0);
					kioku_p2:rotationz(0);
					kioku_p2:rotationx(-15);
					
					kioku_p1:linear(m_bl*16);
					kioku_p1:rotationx(40);
					kioku_p2:linear(m_bl*16);
					kioku_p2:rotationx(-40);
				end},
				
				{98,function()
					kioku_bg2:linear(0.5);
					kioku_bg2:diffusealpha(0);
					kioku_bg:linear(0.5);
					kioku_bg:diffusealpha(0.5);
					
					kioku_floaters:linear(4);
					kioku_floaters:diffusealpha(0.3);
				end},
				
				{130,function()
					kioku_floaters2:linear(4);
					kioku_floaters2:diffusealpha(0.4);
				end},
				
				{162,function()
					kioku_bg2:linear(0.5);
					kioku_bg2:diffusealpha(0.5);
					kioku_bg:linear(0.5);
					kioku_bg:diffusealpha(0);
					MESSAGEMAN:Broadcast('BackToNormal');
				end},
				
				{226.75,function()
					kioku_end_xpos:linear(5.25*60/140);
					kioku_end_xpos:x(SCREEN_WIDTH*0.25);
				end},
				
				{232,'Ending'},
			}
			
			for i=165,196,4 do
				if i ~= 177 then
					if i > 177 then
						table.insert(mod_actions,{i-.05,'TetTetTet'});
					else
						table.insert(mod_actions,{i-.05,'TetTetTet2'});
					end
				else
					table.insert(mod_actions,{i-.05,'TetTet'});
				end
			end
			
			for i=36,80,4 do
				table.insert(mod_actions,{i-.05,'WaveOn'});
			end
			
			table.insert(mod_actions,{84,'WaveOn3'});
			table.insert(mod_actions,{88,'WaveOn3'});
			table.insert(mod_actions,{196-.05,'WaveOn2'});
			table.insert(mod_actions,{200-.05,'WaveOn2'});
			table.insert(mod_actions,{204-.05,'WaveOn2'});
			table.insert(mod_actions,{212-.05,'WaveOn2'});
			table.insert(mod_actions,{216-.05,'WaveOn2'});
			table.insert(mod_actions,{220-.05,'WaveOn2'});
			
			--table.insert(mod_actions,{34,'ShowG2'});
			
			table.insert(mod_actions,{38-.75,'HideG1'});
			
			for i=0,3 do
				table.insert(mod_actions,{102+(16*i)-.05,'Bingus'});
			end
			
			
			for i=0,14 do
				table.insert(mod_actions,{40+(4*i)-.75,'ShowG1'});
				table.insert(mod_actions,{40+(4*i)-.75,'HideG2'});
				table.insert(mod_actions,{42+(4*i)-.75,'ShowG2'});
				table.insert(mod_actions,{42+(4*i)-.75,'HideG1'});
			end
			
			table.insert(mod_actions,{195.25,'ShowG2'});
			
			table.insert(mod_actions,{198-.75,'HideG2'});
			table.insert(mod_actions,{198-.75,'ShowG1'});
			
			for i=0,5 do
				table.insert(mod_actions,{200.75+(4*i)-.75,'ShowG2'});
				table.insert(mod_actions,{200.75+(4*i)-.75,'HideG1'});
				table.insert(mod_actions,{202.5+(4*i)-.75,'ShowG1'});
				table.insert(mod_actions,{202.5+(4*i)-.75,'HideG2'});
			end
			
			table.insert(mod_actions,{100,'HideG1',true});
			table.insert(mod_actions,{100,'HideG2',true});
			
			table.insert(mod_actions,{224.75,'HideG1',true});
			table.insert(mod_actions,{224.75,'HideG2',true});
			
			function kioku_main(beat,mod,dir,pn)
				local d = 0.75
				if beat-math.floor(beat) == 0.25 then d = 0.5 end
				local a = _G['P'..pn]
				if a then
					table.insert(mod_actions,{beat-.04,function()
						if mod == 'skew' then
							a:linear(m_sk);
							a:skewx(-0.3*dir);
							a:sleep(m_bl*d - m_sk)
							a:linear(m_sk);
							a:skewx(0.3*dir);
							a:sleep(m_bl*0.5 - m_sk)
							a:linear(m_sk);
							a:skewx(-0.3*dir);
						elseif mod == 'skew2' then
							a:linear(m_sk);
							a:skewx(-0.3*dir);
							a:sleep(m_bl*d - m_sk)
							a:linear(m_sk);
							a:skewx(0.3*dir);
						end
					end})
				end
			end
			
			--[[
			for i=0,7 do
				kioku_main(36+(8*i),'skew',1,1);
				kioku_main(38.25+(8*i),'skew',-1,2);
				kioku_main(40+(8*i),'skew',1,1);
				kioku_main(42.25+(8*i),'skew',-1,2);
			end
			]]
			
			
---------------------------------------------------------------------------------------
----------------------DON'T TOUCH IT KIDDO---------------------------------------------
---------------------------------------------------------------------------------------
			
			function modtable_compare(a,b)
				return a[1] < b[1]
			end
			
			if table.getn(mod_actions) > 1 then
				table.sort(mod_actions, modtable_compare)
			end
			
			self:queuecommand('Update');
			
---------------------------------------------------------------------------------------
----------------------END DON'T TOUCH IT KIDDO-----------------------------------------
---------------------------------------------------------------------------------------
			
		end,
      UpdateCommand= function(self)

			if GAMESTATE:GetSongBeat()>=0 and not checked then
				
				----------------------
				-- grab everything? --
				----------------------
				if SCREENMAN:GetTopScreen():GetChild('LifeP1') then LifeP1 = SCREENMAN:GetTopScreen():GetChild('LifeP1') end
				if SCREENMAN:GetTopScreen():GetChild('LifeP2') then LifeP2 = SCREENMAN:GetTopScreen():GetChild('LifeP2') end
				if SCREENMAN:GetTopScreen():GetChild('ScoreP1') then ScoreP1 = SCREENMAN:GetTopScreen():GetChild('ScoreP1') end
				if SCREENMAN:GetTopScreen():GetChild('ScoreP2') then ScoreP2 = SCREENMAN:GetTopScreen():GetChild('ScoreP2') end
				if SCREENMAN:GetTopScreen():GetChild('BPMDisplay') then BPMDisplay = SCREENMAN:GetTopScreen():GetChild('BPMDisplay') end
				if SCREENMAN:GetTopScreen():GetChild('LifeFrame') then LifeFrame = SCREENMAN:GetTopScreen():GetChild('LifeFrame') end
				if SCREENMAN:GetTopScreen():GetChild('ScoreFrame') then ScoreFrame = SCREENMAN:GetTopScreen():GetChild('ScoreFrame') end
				if SCREENMAN:GetTopScreen():GetChild('Lyrics') then Lyrics = SCREENMAN:GetTopScreen():GetChild('Lyrics') end
				if SCREENMAN:GetTopScreen():GetChild('SongForeground') then SongForeground = SCREENMAN:GetTopScreen():GetChild('SongForeground') end
				if SCREENMAN:GetTopScreen():GetChild('SongBackground') then SongBackground = SCREENMAN:GetTopScreen():GetChild('SongBackground') end
				if SCREENMAN:GetTopScreen():GetChild('Overlay') then Overlay = SCREENMAN:GetTopScreen():GetChild('Overlay') end
				if SCREENMAN:GetTopScreen():GetChild('Underlay') then Underlay = SCREENMAN:GetTopScreen():GetChild('Underlay') end
				
				--------------------------
				-- hide everything? y/n --
				--------------------------
				mod_hideall = true;
				if mod_hideall == true then
					if LifeFrame then LifeFrame:visible(false) end
					if LifeP1 then LifeP1:visible(false) end
					if LifeP2 then LifeP2:visible(false) end
					if ScoreP1 then ScoreP1:visible(false) end
					if ScoreP2 then ScoreP2:visible(false) end
					if SCREENMAN:GetTopScreen():GetChild('BPMDisplay') then BPMDisplay:visible(false) end
					if Overlay then Overlay:visible(false) end
					if Underlay then Underlay:visible(false) end
					if SCREENMAN:GetTopScreen():GetChild('ScoreFrame') then ScoreFrame:visible(false) end
					--Hide more things. -Kid
					if SCREENMAN:GetTopScreen():GetChild('StageDisplay') then SCREENMAN:GetTopScreen():GetChild('StageDisplay'):visible(false) end
					if SCREENMAN:GetTopScreen():GetChild('SongTitle') then SCREENMAN:GetTopScreen():GetChild('SongTitle'):visible(false) end
					if SCREENMAN:GetTopScreen():GetChild("SongMeterDisplayP1") then SCREENMAN:GetTopScreen():GetChild("SongMeterDisplayP1"):visible(false) end
					if SCREENMAN:GetTopScreen():GetChild("StepsDisplayP1") then SCREENMAN:GetTopScreen():GetChild("StepsDisplayP1"):visible(false) end
					if SCREENMAN:GetTopScreen():GetChild("SongMeterDisplayP2") then SCREENMAN:GetTopScreen():GetChild("SongMeterDisplayP2"):visible(false) end
					if SCREENMAN:GetTopScreen():GetChild("StepsDisplayP2") then SCREENMAN:GetTopScreen():GetChild("StepsDisplayP2"):visible(false) end
					--Lambda-specific things. -Kid
					if SCREENMAN:GetTopScreen():GetChild('LifeMeterBarP1') then SCREENMAN:GetTopScreen():GetChild('LifeMeterBarP1'):visible(false) end
					if SCREENMAN:GetTopScreen():GetChild('LifeMeterBarP2') then SCREENMAN:GetTopScreen():GetChild('LifeMeterBarP2'):visible(false) end
				end
				
				table.insert(mod_plr,SCREENMAN:GetTopScreen():GetChild('PlayerP1'));
				table.insert(mod_plr,SCREENMAN:GetTopScreen():GetChild('PlayerP2'));
				
				--for i,v in pairs(mod_plr) do
				--	if SCREENMAN:GetTopScreen():GetChild('PlayerOptionsP'..i) then
						--_G['init_modsp'..i] = SCREENMAN:GetTopScreen():GetChild('PlayerOptionsP'..i):GetText();
				--	end
				--end
				--In this case, we DO want the mod string, as that'll help keep things like FailOff active. -Kid
				for i=1,2 do
					_G['init_modsp'..i] = GAMESTATE:GetPlayerState(i-1):GetPlayerOptionsString('ModsLevel_Song')
				end
				
				P1 = SCREENMAN:GetTopScreen():GetChild('PlayerP1');
				P2 = SCREENMAN:GetTopScreen():GetChild('PlayerP2');
				--aliases for old times sake
				
				--add the extra notes to the main table
				for i=1,table.getn(kioku_notes2) do
					table.insert(kioku_notes,kioku_notes2[i]);
				end
				
				screen = SCREENMAN:GetTopScreen();
				checked = true;
			end
			
---------------------------------------------------------------------------------------
----------------------TOUCH THIS-------------------------------------------------------
---------------------------------------------------------------------------------------

			local beat = GAMESTATE:GetSongBeat()
			
			if beat > mod_firstSeenBeat+1 then
				while m_curnote<=table.getn(kioku_notes) and beat>kioku_notes[m_curnote][1]-4 do
					kioku_placenote(kioku_notes[m_curnote][1],kioku_notes[m_curnote][2])
					m_curnote = m_curnote+1;
				end
			end
			
			kioku_update();
			
---------------------------------------------------------------------------------------
----------------------DON'T TOUCH IT KIDDO---------------------------------------------
---------------------------------------------------------------------------------------
			
			disable = false;
			if disable ~= true and checked then
				
				-----------------------
				-- Player mod resets --
				-----------------------
				if beat > mod_firstSeenBeat+0.1 then -- performance coding!! --
					for i=1,2 do
						poptions[i]:FromString('clearall')
						if _G['init_modsp'..i] then 
							poptions[i]:FromString(_G['init_modsp'..i])
						end
					end
				end
				
				------------------------------------------------------------------------------
				-- custom mod reader by TaroNuke edited by WinDEU and re-stolen by TaroNuke --
				------------------------------------------------------------------------------
				if beat > mod_firstSeenBeat+0.1 then -- performance coding!! --
					for i,v in pairs(mods) do
						if v and table.getn(v) > 3 and v[1] and v[2] and v[3] and v[4] then
							if beat >=v[1] then
								if (v[4] == 'len' and beat <=v[1]+v[2]) or (v[4] == 'end' and beat <=v[2]) then
									if table.getn(v) == 5 then
										poptions[v[5]]:FromString(v[3])
									else
										for i=1,2 do
										    poptions[i]:FromString(v[3])
										end
									end
								end
							end
						else
							str = ''
							for j=1,5 do
								if j == 1 then
									str = tostring(v[j])
								else
									str = str..','..tostring(v[j])
								end
							end
							SCREENMAN:SystemMessage('Bad mod in beat-based table ('..str..')');
							v[1] = 0;
							v[2] = 0;
							v[3] = 'error';
							v[4] = 'error';
						end
					end
				end
				
				-----------------------------------------------------------------------------------------------------
				-- WinDEU's time-based len/end version of the #swag custom mod reader #teamproofofconcept (c) 2015 --
				-----------------------------------------------------------------------------------------------------
				if beat > mod_firstSeenBeat+0.1 then -- performance coding!! --
					for i,v in pairs(mods2) do
						if v and table.getn(v) > 3 and v[1] and v[2] and v[3] and v[4] then
							if mod_time >=v[1] then
								if (v[4] == 'len' and mod_time <=v[1]+v[2]) or (v[4] == 'end' and mod_time <=v[2]) then
									if table.getn(v) == 5 then
										poptions[v[5]]:FromString(v[3])
									else
										for i=1,2 do
										    poptions[i]:FromString(v[3])
										end
									end
								end
							end
						else
							str = ''
							for j=1,5 do
								if j == 1 then
									str = tostring(v[j])
								else
									str = str..','..tostring(v[j])
								end
							end
							SCREENMAN:SystemMessage('Bad mod in time-based table ('..str..')');
							v[1] = 0;
							v[2] = 0;
							v[3] = 'error';
							v[4] = 'error';
						end
					end
				end
				
				--------------------
				-- Perframe stuff --
				--------------------
				
				if perframe(1,31.5) then
					for i=0,3 do
					    for pn=1,2 do
						poptions[pn]:FromString('*10000 '..(kioku_intromag:GetX()*(50+50*math.cos((beat+(i/1))*-0.5*math.pi)))..' movey'..(i+1))
						poptions[pn]:FromString('*10000 '..(kioku_intromag:GetX()*(50*math.sin((beat+(i/1))*-0.5*math.pi)))..' movex'..(i+1))
						poptions[pn]:FromString('*10000 '..(kioku_intromag:GetX()*(200*math.sin((beat+(i/1))*-0.25*math.pi))*kioku_invert_ratio)..' movez'..(i+1))
					    end
					end
				end
				
				if perframe(73,75) then
					kioku_p1:effectmagnitude(kioku_bobmag:GetX()*0.7,kioku_bobmag:GetX()*0.2,0);
				end
				
				if perframe(100,164) then--I did some positioning BS-ery to get around the zoom rotation order. -Kid
					--However, another thing to be done is doing some *-1 to more accurately re-create the effect. -Kid
					kioku_aft_target:zoomx(1+(kioku_xsc:GetX()*0.9*math.sin(beat*0.25*math.pi)));
					kioku_aft_target:zoomy(1+(kioku_ysc:GetY()*0.9*math.cos(beat*0.25*math.pi)));
					kioku_aft_target:skewx(-1*kioku_skewer:GetX()*0.7*math.sin(beat*0.25*math.pi))
					kioku_aft_target_wrap:rotationz(-1*kioku_roter:GetX()*0.8*math.sin(beat*0.25*math.pi))
					
					beat = beat+0.2;
					
					--kioku_aft_target2:zoomx(1+(kioku_xsc:GetX()*0.9*math.sin(beat*0.25*math.pi)));
					--kioku_aft_target2:zoomy(1+(kioku_ysc:GetY()*0.9*math.cos(beat*0.25*math.pi)));
					--kioku_aft_target2:skewx(kioku_skewer:GetX()*0.7*math.sin(beat*0.25*math.pi))
					--kioku_aft_target2:rotationz(kioku_roter:GetX()*0.8*math.sin(beat*0.25*math.pi))
					--kioku_aft_target2:diffusealpha(kioku_bingus:GetX());
					kioku_aft_target_2_proxy:zoomx(1+(kioku_xsc:GetX()*0.9*math.sin(beat*0.25*math.pi)));
					kioku_aft_target_2_proxy:zoomy(1+(kioku_ysc:GetY()*0.9*math.cos(beat*0.25*math.pi)));
					kioku_aft_target_2_proxy:skewx(-1*kioku_skewer:GetX()*0.7*math.sin(beat*0.25*math.pi))
					kioku_aft_target_2_proxy_wrap:rotationz(-1*kioku_roter:GetX()*0.8*math.sin(beat*0.25*math.pi))
					kioku_aft_target_2_proxy:diffusealpha(kioku_bingus:GetX());
					
					beat = beat-0.2;
						
					local zmult = 1;
					for i=1,2 do
					    poptions[i]:MoveX1((1.5+1.5*math.cos(beat*-0.25*math.pi)),10000)
					    poptions[i]:MoveX2((0.5+0.5*math.cos(beat*-0.25*math.pi)),10000)
					    poptions[i]:MoveX3((-0.5-0.5*math.cos(beat*-0.25*math.pi)),10000)
					    poptions[i]:MoveX4((-1.5-1.5*math.cos(beat*-0.25*math.pi)),10000)
					    poptions[i]:MoveZ1((zmult*3*math.sin(beat*-0.25*math.pi)*kioku_invert_ratio),10000)
					    poptions[i]:MoveZ2((zmult*1*math.sin(beat*-0.25*math.pi)*kioku_invert_ratio),10000)
					    poptions[i]:MoveZ3((-zmult*1*math.sin(beat*-0.25*math.pi)*kioku_invert_ratio),10000)
					    poptions[i]:MoveZ4((-zmult*3*math.sin(beat*-0.25*math.pi)*kioku_invert_ratio),10000)
					    poptions[i]:Tornado((-0.5-0.5*math.cos(beat*-0.25*math.pi)),10000)
					    poptions[i]:BumpyPeriod(3,10000)
					    poptions[i]:Bumpy((-6*math.sin(beat*-0.25*math.pi)*kioku_invert_ratio),10000)
					    poptions[i]:Wave((1+1*math.cos(beat*-0.25*math.pi)),10000)
					end
					
				end
				
				if perframe(179,180) then
					poptions[1]:FromString('*10000 '..(-kioku_invert:GetX())..' invert')
					poptions[2]:FromString('*10000 '..(kioku_invert:GetX())..' invert')
				end
				
				if perframe(211.4,212.1) then
					kioku_p1speed = kioku_alter:GetX();
					kioku_p2speed = -kioku_alter:GetX();
					for pn=1,2 do
						kioku_colspeeds[pn][2] = kioku_alter2:GetX();
						kioku_colspeeds[pn][4] = kioku_alter2:GetX();
					end
				end
				
				if perframe(31.5,36) then
					kioku_flicker = kioku_flicker*-1
					--Did some *(SCREEN_HEIGHT/480) for HD themes. -Kid
					--Also, the usual *(SCREEN_WIDTH/640). -Kid
					if kioku_flicker == 1 then
						if P1 then P1:zoom(0); end
						kioku_p1:x(SCREEN_CENTER_X-(90*(36-beat))*(SCREEN_WIDTH/640));
						kioku_p1:zoom(SCREEN_HEIGHT/480)
						if P2 then P2:zoom(0); end
						kioku_p2:x(SCREEN_CENTER_X+(90*(36-beat))*(SCREEN_WIDTH/640));
						kioku_p2:zoom(SCREEN_HEIGHT/480)
					else
						if P1 then P1:zoom(SCREEN_HEIGHT/480); end
						kioku_p1:zoom(0)
						if P2 then P2:zoom(SCREEN_HEIGHT/480); end
						kioku_p2:zoom(0)
					end
				end
				
				if perframe(226.75,232) then
					kioku_flicker = kioku_flicker*-1
					local d = 1;
					for pn=1,2 do
						if pn==2 then d = -1 end
						local a = _G['P'..pn]
						if a then
							a:x((SCREEN_WIDTH/2)+(SCREEN_WIDTH*0.25*d*-1)+(kioku_flicker*kioku_end_xpos:GetX()));
						end
					end
					
				end
				
				---------------------------------------
				-- ACTION RPGS AINT GOT SHIT ON THIS --
				---------------------------------------
				if beat > mod_firstSeenBeat+0.1 then -- performance coding!! --
					while curaction<=table.getn(mod_actions) and GAMESTATE:GetSongBeat()>=mod_actions[curaction][1] do
						if mod_actions[curaction][3] or GAMESTATE:GetSongBeat() < mod_actions[curaction][1]+2 then
							if type(mod_actions[curaction][2]) == 'function' then
								mod_actions[curaction][2]()
							elseif type(mod_actions[curaction][2]) == 'string' then
								MESSAGEMAN:Broadcast(mod_actions[curaction][2]);
							end
						end
						curaction = curaction+1;
					end
				end
				
			end
			
			self:sleep(0.02);
			self:queuecommand('Update');

---------------------------------------------------------------------------------------
----------------------END DON'T TOUCH IT KIDDO-----------------------------------------
---------------------------------------------------------------------------------------
			
		end,
    },
    --EffectClock,beat; DiffuseRamp; EffectColor1/2; EffectDelay; EffectOffset -> effectclock,"beat"; diffuseramp; effectcolor1/2; effect_hold_at_full; effectoffset. -Kid
    Def.ActorFrame{
      Name= "actor_l",
      InitCommand= function(self) kioku_p2 = self:zoom(SCREEN_HEIGHT/480) end,
      OnCommand= cmd(x,SCREEN_WIDTH+200;y,SCREEN_CENTER_Y;fov,80),
      Def.ActorFrame{
        Name= "actor_m",--Unconverted x pos. -Kid
        OnCommand= cmd(x,-96;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2r,self) end,
        Def.Sprite{
          Name= "actor_n",
          Frames= {
            {Frame= 0, Delay= 1},
            {Frame= 1, Delay= 1},
            {Frame= 2, Delay= 1},
            {Frame= 3, Delay= 1},
        },
          HideG2MessageCommand= cmd(linear,0.1;diffusealpha,0),
          OnCommand= cmd(rotationz,90;addx,1;addy,1;
			effectclock,"beat";diffuseramp;effectcolor1,0.4,0.4,0.4,1;effectcolor2,1,1,1,1,1;
			effectperiod,0.5;effect_hold_at_full,0.5;effectoffset,0.05;sleep,0.02),
          ShowG2MessageCommand= cmd(linear,0.1;diffusealpha,1),
          Texture= "./receptor 4x1.png",
        },
      },
      Def.ActorFrame{
        Name= "actor_o",--Unconverted x pos. -Kid
        OnCommand= cmd(x,-32;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2r,self) end,
        Def.Sprite{
          Name= "actor_p",
          Frames= {
            {Frame= 0, Delay= 1},
            {Frame= 1, Delay= 1},
            {Frame= 2, Delay= 1},
            {Frame= 3, Delay= 1},
        },
          HideG2MessageCommand= cmd(linear,0.1;diffusealpha,0),
          OnCommand= cmd(rotationz,0;addx,1;addy,1;
			effectclock,"beat";diffuseramp;effectcolor1,0.4,0.4,0.4,1;effectcolor2,1,1,1,1,1;
			effectperiod,0.5;effect_hold_at_full,0.5;effectoffset,0.05;sleep,0.02),
          ShowG2MessageCommand= cmd(linear,0.1;diffusealpha,1),
          Texture= "./receptor 4x1.png",
        },
      },
      Def.ActorFrame{
        Name= "actor_q",--Unconverted x pos. -Kid
        OnCommand= cmd(x,32;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2r,self) end,
        Def.Sprite{
          Name= "actor_r",
          Frames= {
            {Frame= 0, Delay= 1},
            {Frame= 1, Delay= 1},
            {Frame= 2, Delay= 1},
            {Frame= 3, Delay= 1},
        },
          HideG2MessageCommand= cmd(linear,0.1;diffusealpha,0),
          OnCommand= cmd(rotationz,180;addx,1;addy,1;
			effectclock,"beat";diffuseramp;effectcolor1,0.4,0.4,0.4,1;effectcolor2,1,1,1,1,1;
			effectperiod,0.5;effect_hold_at_full,0.5;effectoffset,0.05;sleep,0.02),
          ShowG2MessageCommand= cmd(linear,0.1;diffusealpha,1),
          Texture= "./receptor 4x1.png",
        },
      },
      Def.ActorFrame{
        Name= "actor_s",--Unconverted x pos. -Kid
        OnCommand= cmd(x,96;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2r,self) end,
        Def.Sprite{
          Name= "actor_t",
          Frames= {
            {Frame= 0, Delay= 1},
            {Frame= 1, Delay= 1},
            {Frame= 2, Delay= 1},
            {Frame= 3, Delay= 1},
        },
          HideG2MessageCommand= cmd(linear,0.1;diffusealpha,0),
          OnCommand= cmd(rotationz,-90;addx,1;addy,1;
			effectclock,"beat";diffuseramp;effectcolor1,0.4,0.4,0.4,1;effectcolor2,1,1,1,1,1;
			effectperiod,0.5;effect_hold_at_full,0.5;effectoffset,0.05;sleep,0.02),
          ShowG2MessageCommand= cmd(linear,0.1;diffusealpha,1),
          Texture= "./receptor 4x1.png",
        },
      },
      Def.Model{
        Name= "actor_u",
        Bones= "arrows/4th/4arrowmesh.txt",
        Materials= "arrows/4th/4th.txt",
        Meshes= "arrows/4th/4arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[1],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_v",
        Bones= "arrows/4th/4arrowmesh.txt",
        Materials= "arrows/4th/4th.txt",
        Meshes= "arrows/4th/4arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[1],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_w",
        Bones= "arrows/4th/4arrowmesh.txt",
        Materials= "arrows/4th/4th.txt",
        Meshes= "arrows/4th/4arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[1],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_x",
        Bones= "arrows/4th/4arrowmesh.txt",
        Materials= "arrows/4th/4th.txt",
        Meshes= "arrows/4th/4arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[1],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_y",
        Bones= "arrows/4th/4arrowmesh.txt",
        Materials= "arrows/4th/4th.txt",
        Meshes= "arrows/4th/4arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[1],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_z",
        Bones= "arrows/4th/4arrowmesh.txt",
        Materials= "arrows/4th/4th.txt",
        Meshes= "arrows/4th/4arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[1],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_A",
        Bones= "arrows/4th/4arrowmesh.txt",
        Materials= "arrows/4th/4th.txt",
        Meshes= "arrows/4th/4arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[1],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_B",
        Bones= "arrows/4th/4arrowmesh.txt",
        Materials= "arrows/4th/4th.txt",
        Meshes= "arrows/4th/4arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[1],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_C",
        Bones= "arrows/8th/8arrowmesh.txt",
        Materials= "arrows/8th/8th.txt",
        Meshes= "arrows/8th/8arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[2],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_D",
        Bones= "arrows/8th/8arrowmesh.txt",
        Materials= "arrows/8th/8th.txt",
        Meshes= "arrows/8th/8arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[2],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_E",
        Bones= "arrows/8th/8arrowmesh.txt",
        Materials= "arrows/8th/8th.txt",
        Meshes= "arrows/8th/8arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[2],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_F",
        Bones= "arrows/8th/8arrowmesh.txt",
        Materials= "arrows/8th/8th.txt",
        Meshes= "arrows/8th/8arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[2],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_ab",
        Bones= "arrows/8th/8arrowmesh.txt",
        Materials= "arrows/8th/8th.txt",
        Meshes= "arrows/8th/8arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[2],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_bb",
        Bones= "arrows/8th/8arrowmesh.txt",
        Materials= "arrows/8th/8th.txt",
        Meshes= "arrows/8th/8arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[2],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_cb",
        Bones= "arrows/8th/8arrowmesh.txt",
        Materials= "arrows/8th/8th.txt",
        Meshes= "arrows/8th/8arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[2],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_db",
        Bones= "arrows/8th/8arrowmesh.txt",
        Materials= "arrows/8th/8th.txt",
        Meshes= "arrows/8th/8arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[2],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_eb",
        Bones= "arrows/16th/16arrowmesh.txt",
        Materials= "arrows/16th/16th.txt",
        Meshes= "arrows/16th/16arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[3],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_fb",
        Bones= "arrows/16th/16arrowmesh.txt",
        Materials= "arrows/16th/16th.txt",
        Meshes= "arrows/16th/16arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[3],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_gb",
        Bones= "arrows/16th/16arrowmesh.txt",
        Materials= "arrows/16th/16th.txt",
        Meshes= "arrows/16th/16arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[3],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_hb",
        Bones= "arrows/16th/16arrowmesh.txt",
        Materials= "arrows/16th/16th.txt",
        Meshes= "arrows/16th/16arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[3],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_ib",
        Bones= "arrows/16th/16arrowmesh.txt",
        Materials= "arrows/16th/16th.txt",
        Meshes= "arrows/16th/16arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[3],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_jb",
        Bones= "arrows/16th/16arrowmesh.txt",
        Materials= "arrows/16th/16th.txt",
        Meshes= "arrows/16th/16arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[3],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_kb",
        Bones= "arrows/16th/16arrowmesh.txt",
        Materials= "arrows/16th/16th.txt",
        Meshes= "arrows/16th/16arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[3],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_lb",
        Bones= "arrows/16th/16arrowmesh.txt",
        Materials= "arrows/16th/16th.txt",
        Meshes= "arrows/16th/16arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2a[3],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Sprite{
        Name= "actor_mb",
        HideCommand= cmd(visible,false),
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2e,self) end,
        Texture= "explo.png",
      },
      Def.Sprite{
        Name= "actor_nb",
        HideCommand= cmd(visible,false),
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2e,self) end,
        Texture= "explo.png",
      },
      Def.Sprite{
        Name= "actor_ob",
        HideCommand= cmd(visible,false),
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2e,self) end,
        Texture= "explo.png",
      },
      Def.Sprite{
        Name= "actor_pb",
        HideCommand= cmd(visible,false),
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2e,self) end,
        Texture= "explo.png",
      },
      Def.Sprite{
        Name= "actor_qb",
        HideCommand= cmd(visible,false),
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2e,self) end,
        Texture= "explo.png",
      },
      Def.Sprite{
        Name= "actor_rb",
        HideCommand= cmd(visible,false),
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2e,self) end,
        Texture= "explo.png",
      },
      Def.Sprite{
        Name= "actor_sb",
        HideCommand= cmd(visible,false),
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2e,self) end,
        Texture= "explo.png",
      },
      Def.Sprite{
        Name= "actor_tb",
        HideCommand= cmd(visible,false),
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p2e,self) end,
        Texture= "explo.png",
      },
    },
    Def.ActorFrame{
      Name= "actor_ub",
      InitCommand= function(self) kioku_p1 = self:zoom(SCREEN_HEIGHT/480) end,
      OnCommand= cmd(x,-200;y,SCREEN_CENTER_Y;fov,80),--Unconverted x pos. -Kid
      Def.ActorFrame{
        Name= "actor_vb",--Unconverted x pos. -Kid
        OnCommand= cmd(x,-96;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1r,self) end,
        Def.Sprite{
          Name= "actor_wb",
          Frames= {
            {Frame= 0, Delay= 1},
            {Frame= 1, Delay= 1},
            {Frame= 2, Delay= 1},
            {Frame= 3, Delay= 1},
        },
          HideG1MessageCommand= cmd(linear,0.1;diffusealpha,0),
          OnCommand= cmd(rotationz,90;addx,1;addy,1;
			effectclock,"beat";diffuseramp;effectcolor1,0.4,0.4,0.4,1;effectcolor2,1,1,1,1,1;
			effectperiod,0.5;effect_hold_at_full,0.5;effectoffset,0.05;sleep,0.02),
          ShowG1MessageCommand= cmd(linear,0.1;diffusealpha,1),
          Texture= "./receptor 4x1.png",
        },
      },
      Def.ActorFrame{
        Name= "actor_xb",--Unconverted x pos. -Kid
        OnCommand= cmd(x,-32;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1r,self) end,
        Def.Sprite{
          Name= "actor_yb",
          Frames= {
            {Frame= 0, Delay= 1},
            {Frame= 1, Delay= 1},
            {Frame= 2, Delay= 1},
            {Frame= 3, Delay= 1},
        },
          HideG1MessageCommand= cmd(linear,0.1;diffusealpha,0),
          OnCommand= cmd(rotationz,0;addx,1;addy,1;
			effectclock,"beat";diffuseramp;effectcolor1,0.4,0.4,0.4,1;effectcolor2,1,1,1,1,1;
			effectperiod,0.5;effect_hold_at_full,0.5;effectoffset,0.05;sleep,0.02),
          ShowG1MessageCommand= cmd(linear,0.1;diffusealpha,1),
          Texture= "./receptor 4x1.png",
        },
      },
      Def.ActorFrame{
        Name= "actor_zb",--Unconverted x pos. -Kid
        OnCommand= cmd(x,32;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1r,self) end,
        Def.Sprite{
          Name= "actor_Ab",
          Frames= {
            {Frame= 0, Delay= 1},
            {Frame= 1, Delay= 1},
            {Frame= 2, Delay= 1},
            {Frame= 3, Delay= 1},
        },
          HideG1MessageCommand= cmd(linear,0.1;diffusealpha,0),
          OnCommand= cmd(rotationz,180;addx,1;addy,1;
			effectclock,"beat";diffuseramp;effectcolor1,0.4,0.4,0.4,1;effectcolor2,1,1,1,1,1;
			effectperiod,0.5;effect_hold_at_full,0.5;effectoffset,0.05;sleep,0.02),
          ShowG1MessageCommand= cmd(linear,0.1;diffusealpha,1),
          Texture= "./receptor 4x1.png",
        },
      },
      Def.ActorFrame{
        Name= "actor_Bb",--Unconverted x pos. -Kid
        OnCommand= cmd(x,96;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1r,self) end,
        Def.Sprite{
          Name= "actor_Cb",
          Frames= {
            {Frame= 0, Delay= 1},
            {Frame= 1, Delay= 1},
            {Frame= 2, Delay= 1},
            {Frame= 3, Delay= 1},
        },
          HideG1MessageCommand= cmd(linear,0.1;diffusealpha,0),
          OnCommand= cmd(rotationz,-90;addx,1;addy,1;
			effectclock,"beat";diffuseramp;effectcolor1,0.4,0.4,0.4,1;effectcolor2,1,1,1,1,1;
			effectperiod,0.5;effect_hold_at_full,0.5;effectoffset,0.05;sleep,0.02),
          ShowG1MessageCommand= cmd(linear,0.1;diffusealpha,1),
          Texture= "./receptor 4x1.png",
        },
      },
      Def.Model{
        Name= "actor_Db",
        Bones= "arrows/4th/4arrowmesh.txt",
        Materials= "arrows/4th/4th.txt",
        Meshes= "arrows/4th/4arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[1],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_Eb",
        Bones= "arrows/4th/4arrowmesh.txt",
        Materials= "arrows/4th/4th.txt",
        Meshes= "arrows/4th/4arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[1],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_Fb",
        Bones= "arrows/4th/4arrowmesh.txt",
        Materials= "arrows/4th/4th.txt",
        Meshes= "arrows/4th/4arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[1],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_ac",
        Bones= "arrows/4th/4arrowmesh.txt",
        Materials= "arrows/4th/4th.txt",
        Meshes= "arrows/4th/4arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[1],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_bc",
        Bones= "arrows/4th/4arrowmesh.txt",
        Materials= "arrows/4th/4th.txt",
        Meshes= "arrows/4th/4arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[1],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_cc",
        Bones= "arrows/4th/4arrowmesh.txt",
        Materials= "arrows/4th/4th.txt",
        Meshes= "arrows/4th/4arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[1],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_dc",
        Bones= "arrows/4th/4arrowmesh.txt",
        Materials= "arrows/4th/4th.txt",
        Meshes= "arrows/4th/4arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[1],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_ec",
        Bones= "arrows/4th/4arrowmesh.txt",
        Materials= "arrows/4th/4th.txt",
        Meshes= "arrows/4th/4arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[1],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_fc",
        Bones= "arrows/8th/8arrowmesh.txt",
        Materials= "arrows/8th/8th.txt",
        Meshes= "arrows/8th/8arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[2],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_gc",
        Bones= "arrows/8th/8arrowmesh.txt",
        Materials= "arrows/8th/8th.txt",
        Meshes= "arrows/8th/8arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[2],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_hc",
        Bones= "arrows/8th/8arrowmesh.txt",
        Materials= "arrows/8th/8th.txt",
        Meshes= "arrows/8th/8arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[2],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_ic",
        Bones= "arrows/8th/8arrowmesh.txt",
        Materials= "arrows/8th/8th.txt",
        Meshes= "arrows/8th/8arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[2],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_jc",
        Bones= "arrows/8th/8arrowmesh.txt",
        Materials= "arrows/8th/8th.txt",
        Meshes= "arrows/8th/8arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[2],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_kc",
        Bones= "arrows/8th/8arrowmesh.txt",
        Materials= "arrows/8th/8th.txt",
        Meshes= "arrows/8th/8arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[2],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_lc",
        Bones= "arrows/8th/8arrowmesh.txt",
        Materials= "arrows/8th/8th.txt",
        Meshes= "arrows/8th/8arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[2],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_mc",
        Bones= "arrows/8th/8arrowmesh.txt",
        Materials= "arrows/8th/8th.txt",
        Meshes= "arrows/8th/8arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[2],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_nc",
        Bones= "arrows/16th/16arrowmesh.txt",
        Materials= "arrows/16th/16th.txt",
        Meshes= "arrows/16th/16arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[3],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_oc",
        Bones= "arrows/16th/16arrowmesh.txt",
        Materials= "arrows/16th/16th.txt",
        Meshes= "arrows/16th/16arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[3],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_pc",
        Bones= "arrows/16th/16arrowmesh.txt",
        Materials= "arrows/16th/16th.txt",
        Meshes= "arrows/16th/16arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[3],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_qc",
        Bones= "arrows/16th/16arrowmesh.txt",
        Materials= "arrows/16th/16th.txt",
        Meshes= "arrows/16th/16arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[3],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_rc",
        Bones= "arrows/16th/16arrowmesh.txt",
        Materials= "arrows/16th/16th.txt",
        Meshes= "arrows/16th/16arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[3],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_sc",
        Bones= "arrows/16th/16arrowmesh.txt",
        Materials= "arrows/16th/16th.txt",
        Meshes= "arrows/16th/16arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[3],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_tc",
        Bones= "arrows/16th/16arrowmesh.txt",
        Materials= "arrows/16th/16th.txt",
        Meshes= "arrows/16th/16arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[3],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Model{
        Name= "actor_uc",
        Bones= "arrows/16th/16arrowmesh.txt",
        Materials= "arrows/16th/16th.txt",
        Meshes= "arrows/16th/16arrowmesh.txt",
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1a[3],{actor=self,active=false,targ=0,col=0}); end,
      },
      Def.Sprite{
        Name= "actor_vc",
        HideCommand= cmd(visible,false),
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1e,self) end,
        Texture= "explo.png",
      },
      Def.Sprite{
        Name= "actor_wc",
        HideCommand= cmd(visible,false),
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1e,self) end,
        Texture= "explo.png",
      },
      Def.Sprite{
        Name= "actor_xc",
        HideCommand= cmd(visible,false),
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1e,self) end,
        Texture= "explo.png",
      },
      Def.Sprite{
        Name= "actor_yc",
        HideCommand= cmd(visible,false),
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1e,self) end,
        Texture= "explo.png",
      },
      Def.Sprite{
        Name= "actor_zc",
        HideCommand= cmd(visible,false),
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1e,self) end,
        Texture= "explo.png",
      },
      Def.Sprite{
        Name= "actor_Ac",
        HideCommand= cmd(visible,false),
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1e,self) end,
        Texture= "explo.png",
      },
      Def.Sprite{
        Name= "actor_Bc",
        HideCommand= cmd(visible,false),
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1e,self) end,
        Texture= "explo.png",
      },
      Def.Sprite{
        Name= "actor_Cc",
        HideCommand= cmd(visible,false),
        OnCommand= cmd(visible,false;sleep,0.02;queuecommand,"SetMe"),
        SetMeCommand= function(self) table.insert(kioku_p1e,self) end,
        Texture= "explo.png",
      },
      --For each position quad below, unconverted x pos.
    },
    Def.Quad{
      Name= "actor_Dc",
      InitCommand= function(self) kioku_xsc = self end,
      OnCommand= cmd(visible,false;x,1),
    },
    Def.Quad{
      Name= "actor_Ec",
      InitCommand= function(self) kioku_ysc = self end,
      OnCommand= cmd(visible,false;y,1),
    },
    Def.Quad{
      Name= "actor_Fc",
      InitCommand= function(self) kioku_skewer = self end,
      OnCommand= cmd(visible,false;x,0),
    },
    Def.Quad{
      Name= "actor_ad",
      InitCommand= function(self) kioku_roter = self end,
      OnCommand= cmd(visible,false;x,0),
    },
    Def.Quad{
      Name= "actor_bd",
      InitCommand= function(self) kioku_zagger = self end,
      OnCommand= cmd(visible,false;x,0),
    },
    Def.Quad{
      Name= "actor_cd",
      InitCommand= function(self) kioku_end_xpos = self end,
      OnCommand= cmd(visible,false;x,0),
    },
    Def.Quad{
      Name= "actor_dd",
      InitCommand= function(self) kioku_alter = self end,
      OnCommand= cmd(visible,false;x,2),
    },
    Def.Quad{
      Name= "actor_ed",
      InitCommand= function(self) kioku_alter2 = self end,
      OnCommand= cmd(visible,false;x,1),
    },
    Def.Quad{
      Name= "actor_fd",
      InitCommand= function(self) kioku_invert = self end,
      OnCommand= cmd(visible,false;x,0),
    },
    Def.Quad{
      Name= "actor_gd",
      BingusMessageCommand= function(self) self:x(1); self:linear(m_bl*kioku_bingusdelay); self:x(0); kioku_bingusdelay = kioku_bingusdelay+1 end,
      InitCommand= function(self) kioku_bingus = self end,
      OnCommand= cmd(visible,false;x,0),
    },
    Def.Quad{
      Name= "actor_hd",
      InitCommand= function(self) kioku_bobmag = self end,
      OnCommand= cmd(visible,false;x,0),
    },
    Def.Quad{
      Name= "actor_id",
      InitCommand= function(self) kioku_intromag = self end,
      OnCommand= cmd(visible,false;x,1.2),
    },
    Def.Quad{
      Name= "actor_jd",
      InitCommand= function(self) kioku_fp_sinewavep1 = self end,
      OnCommand= cmd(visible,false;x,0),
    },
    Def.Quad{
      Name= "actor_kd",
      InitCommand= function(self) kioku_fp_sinewavep2 = self end,
      OnCommand= cmd(visible,false;x,0),
    },
    Def.Quad{
      Name= "actor_ld",
      InitCommand= function(self) kioku_fp_sineperiodp1 = self end,
      OnCommand= cmd(visible,false;x,1;y,1;z,1),
    },
    Def.Quad{
      Name= "actor_md",
      InitCommand= function(self) kioku_fp_sineperiodp2 = self end,
      OnCommand= cmd(visible,false;x,1;y,1;z,1),
    },
    Def.ActorFrame{
      Name= "actor_nd",
      EndingMessageCommand= cmd(playcommand,"End";linear,0.2;zoomx,SCREEN_WIDTH;sleep,0.2;accelerate,0.3;zoomy,SCREEN_HEIGHT),
      OnCommand= cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomx,0;zoomy,2),
      Def.Quad{
        Name= "actor_od",
        EndCommand= cmd(sleep,0.6;linear,1;diffusealpha,1),
        OnCommand= cmd(diffuse,color('0,0,0,0.4')),
      },
    },
    Def.BitmapText{
      Name= "actor_pd",
      Font= "Common Normal",
      OnCommand= cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;effectclock,"music";playcommand,"SetTime";visible,false),
      SetTimeCommand= function(self) self:settext(self:GetSecsIntoEffect()); mod_time = tonumber(self:GetText()); self:sleep(0.02); self:queuecommand('SetTime'); end,
      Text= "test",
    },
    LoadActor('../kioku_notes.lua') .. {
      Name= "actor_qd",
      File= "../kioku_notes.lua",
    },
    LoadActor('../kioku_notes2.lua') .. {
      Name= "actor_rd",
      File= "../kioku_notes2.lua",
    },
    Def.Quad{
      Name= "actor_sd",
      HihatMessageCommand= function(self)
			kioku_intromag:decelerate(m_bl);
			kioku_intromag:x(0.1);
			kioku_intromag:sleep(m_bl);
			kioku_intromag:decelerate(m_bl);
			kioku_intromag:x(1.2);
			for pn=1,2 do
				local a = _G['P'..pn]
				if a then
					a:zoomx(2*(SCREEN_HEIGHT/480));--Because HD themes. -Kid
					a:spring(m_bl*0.75);
					a:zoomx(1*(SCREEN_HEIGHT/480));--Because HD themes. -Kid
				end
			end 
		end,
      OnCommand= cmd(visible,false),
      TetTetMessageCommand= function(self)
			for pn=1,2 do
				local a = _G['P'..pn]
				if a then
					--Did some SCREEN_HEIGHT/480 on all zoomz because HD themes. -Kid
					a:zoomz(kioku_tet*(SCREEN_HEIGHT/480)*kioku_invert_ratio);
					a:linear(m_bl*0.75);
					a:zoomz(1*(SCREEN_HEIGHT/480));
					a:sleep(0);
					a:zoomz(-kioku_tet*(SCREEN_HEIGHT/480)*kioku_invert_ratio);
					a:linear(m_bl*0.75);
					a:zoomz(1*(SCREEN_HEIGHT/480));
					a:sleep(0);
				end
			end
			kioku_tet = 30;
		end,
      TetTetTet2MessageCommand= function(self)
			for pn=1,2 do
				local a = _G['P'..pn]
				if a then
					--Did some SCREEN_HEIGHT/480 on all zoomz because HD themes. -Kid
					a:zoomz(((kioku_tet*2)+20)*(SCREEN_HEIGHT/480)*kioku_invert_ratio);
					a:z(((kioku_tet*2)+20)*-kioku_note_height*kioku_invert_ratio);
					a:linear(m_bl*0.75);
					a:zoomz(SCREEN_HEIGHT/480);
					a:z(0);
					a:sleep(0);
					a:zoomz(((kioku_tet*2)+20)*(SCREEN_HEIGHT/480)*kioku_invert_ratio);
					a:z(((kioku_tet*2)+20)*-kioku_note_height*kioku_invert_ratio);
					a:linear(m_bl*0.75);
					a:zoomz(SCREEN_HEIGHT/480);
					a:z(0);
					a:sleep(m_bl*0.5);
					a:zoomz(((kioku_tet*-2)-20)*(SCREEN_HEIGHT/480)*kioku_invert_ratio);
					a:z(((kioku_tet*2)+20)*kioku_note_height*kioku_invert_ratio);
					a:linear(m_bl*0.75);
					a:zoomz(SCREEN_HEIGHT/480);
					a:z(0);
					a:sleep(0);
				end
			end
			kioku_tet = kioku_tet+5;
		end,
      TetTetTetMessageCommand= function(self)
			for pn=1,2 do
				local a = _G['P'..pn]
				if a then
					--Did some SCREEN_HEIGHT/480 on all zoomz because HD themes. -Kid
					a:zoomz(kioku_tet*(SCREEN_HEIGHT/480)*kioku_invert_ratio);
					a:linear(m_bl*0.75);
					a:zoomz(SCREEN_HEIGHT/480);
					a:sleep(0);
					a:zoomz(kioku_tet*(SCREEN_HEIGHT/480)*kioku_invert_ratio);
					a:linear(m_bl*0.75);
					a:zoomz(SCREEN_HEIGHT/480);
					a:sleep(m_bl*0.5);
					a:zoomz(-kioku_tet*(SCREEN_HEIGHT/480)*kioku_invert_ratio);
					a:linear(m_bl*0.75);
					a:zoomz(SCREEN_HEIGHT/480);
					a:sleep(0);
				end
			end
			kioku_tet = kioku_tet+5;
		end,
      WaveOn2MessageCommand= function(self)
			for p = 1,2 do
				_G['kioku_fp_sinewavep'..p]:y(-50);
				_G['kioku_fp_sinewavep'..p]:spring(m_bl*0.5);
				_G['kioku_fp_sinewavep'..p]:y(0);
				_G['kioku_fp_sinewavep'..p]:sleep(m_bl*0.25);
				_G['kioku_fp_sinewavep'..p]:x(-50);
				_G['kioku_fp_sinewavep'..p]:spring(m_bl*0.5);
				_G['kioku_fp_sinewavep'..p]:x(0);
				_G['kioku_fp_sinewavep'..p]:sleep(0);
				_G['kioku_fp_sinewavep'..p]:y(50);
				_G['kioku_fp_sinewavep'..p]:spring(m_bl*0.5);
				_G['kioku_fp_sinewavep'..p]:y(0);
				_G['kioku_fp_sinewavep'..p]:sleep(0);
				_G['kioku_fp_sinewavep'..p]:x(-50);
				_G['kioku_fp_sinewavep'..p]:spring(m_bl*0.5);
				_G['kioku_fp_sinewavep'..p]:x(0);
			end
		end,
      WaveOn3MessageCommand= function(self)
			for p = 1,1 do
				_G['kioku_fp_sinewavep'..p]:x(-50);
				_G['kioku_fp_sinewavep'..p]:spring(m_bl*0.5);
				_G['kioku_fp_sinewavep'..p]:x(0);
				_G['kioku_fp_sinewavep'..p]:sleep(m_bl*0.25);
				_G['kioku_fp_sinewavep'..p]:y(50);
				_G['kioku_fp_sinewavep'..p]:spring(m_bl*0.5);
				_G['kioku_fp_sinewavep'..p]:y(0);
				_G['kioku_fp_sinewavep'..p]:sleep(0);
				_G['kioku_fp_sinewavep'..p]:x(50);
				_G['kioku_fp_sinewavep'..p]:spring(m_bl*0.5);
				_G['kioku_fp_sinewavep'..p]:x(0);
			end
		end,
      WaveOnMessageCommand= function(self)
			for p = 1,2 do
				_G['kioku_fp_sinewavep'..p]:x(-50);
				_G['kioku_fp_sinewavep'..p]:spring(m_bl*0.5);
				_G['kioku_fp_sinewavep'..p]:x(0);
				_G['kioku_fp_sinewavep'..p]:sleep(m_bl*0.25);
				_G['kioku_fp_sinewavep'..p]:y(50);
				_G['kioku_fp_sinewavep'..p]:spring(m_bl*0.5);
				_G['kioku_fp_sinewavep'..p]:y(0);
				_G['kioku_fp_sinewavep'..p]:sleep(0);
				_G['kioku_fp_sinewavep'..p]:x(50);
				_G['kioku_fp_sinewavep'..p]:spring(m_bl*0.5);
				_G['kioku_fp_sinewavep'..p]:x(0);
				_G['kioku_fp_sinewavep'..p]:sleep(m_bl*0.5);
				_G['kioku_fp_sinewavep'..p]:x(50);
				_G['kioku_fp_sinewavep'..p]:spring(m_bl*0.5);
				_G['kioku_fp_sinewavep'..p]:x(0);
				_G['kioku_fp_sinewavep'..p]:sleep(0);
				_G['kioku_fp_sinewavep'..p]:y(50);
				_G['kioku_fp_sinewavep'..p]:spring(m_bl*0.5);
				_G['kioku_fp_sinewavep'..p]:y(0);
				_G['kioku_fp_sinewavep'..p]:sleep(0);
				_G['kioku_fp_sinewavep'..p]:x(-50);
				_G['kioku_fp_sinewavep'..p]:spring(m_bl*0.5);
				_G['kioku_fp_sinewavep'..p]:x(0);
			end
		end,
    },
    Def.Sprite{
      Name= "actor_td",
      HideAFTMessageCommand= cmd(visible,false),
      --InitCommand= cmd(zoom,1;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;visible,false),
      InitCommand= cmd(zoom,1;x,0;y,0;visible,false),
      OnCommand= function(self)
		
			--self:basezoomx((SCREEN_WIDTH/DISPLAY:GetDisplayWidth()));
			--self:basezoomy((SCREEN_WIDTH/DISPLAY:GetDisplayWidth()))
		
			self:SetTexture(kioku_aft:GetTexture());
			self:customtexturerect(0,0,kioku_aft_width_ratio,kioku_aft_height_ratio)--The AFT texture doesn't fill the whole screen. This fixes that. -Kid
			
			self:diffusealpha(0);
			
			kioku_aft_target2 = self;
		end,
      ShowAFTMessageCommand= cmd(visible,true),
      Texture= "white",
    },
    Def.ActorFrameTexture{
      Name= "actor_ud",
      InitCommand= function(self)
			
			self:SetTextureName( 'screen_aft' )
			self:SetWidth( SCREEN_WIDTH );
			self:SetHeight( SCREEN_HEIGHT );
			self:EnableDepthBuffer( true );
			self:EnableAlphaBuffer( true );
			self:EnableFloat( false );
			self:EnablePreserveTexture( false );
			self:visible(true);
			
			self:Create();
			--self:Draw();--Beacuse SM5 AFT.-Kid
			screen_aft = self;
			
		end,
	Def.ActorProxy{
	    ProxyThisMessageCommand= function(self)
		if kioku_bg then
		    self:SetTarget(kioku_bg2):visible(true)
		end
	    end,
	},
	Def.ActorProxy{
	    ProxyThisMessageCommand= function(self)
		if kioku_bg then
		    self:SetTarget(kioku_bg):visible(true)
		end
	    end,
	},
	Def.ActorProxy{
	    ProxyThisMessageCommand= function(self)
		if P1 then
		    self:SetTarget(P1)
		end
	    end,
	},
	Def.ActorProxy{
	    ProxyThisMessageCommand= function(self)
		if P2 then
		    self:SetTarget(P2)
		end
	    end,
	},
	Def.Sprite{
	    ProxyThisMessageCommand= function(self)
		if kioku_aft_target2 then
		    self:SetTexture(kioku_aft:GetTexture())
		    kioku_aft_target_2_proxy = self
		    kioku_aft_target_2_proxy_wrap = self:AddWrapperState():x(SCREEN_CENTER_X):y(SCREEN_CENTER_Y)
		end
	    end,
	    ShowAFTMessageCommand= cmd(visible,true),
	},
    },
    Def.ActorFrameTexture{
      Name= "actor_ud",
      InitCommand= function(self)
			
			self:SetTextureName( 'kioku_aft' )
			self:SetWidth( SCREEN_WIDTH );
			self:SetHeight( SCREEN_HEIGHT );
			self:EnableDepthBuffer( true );
			self:EnableAlphaBuffer( true );
			self:EnableFloat( false );
			self:EnablePreserveTexture( true );
			self:visible(false);--Temporarilly true. -Kid
			
			self:Create();
			--self:Draw();--Beacuse SM5 AFT.-Kid
			kioku_aft = self;
			
			--By the very nature of the AFT, we need to make ratios for any sprites that wish to use this aft. -Kid
			kioku_aft_height_ratio = SCREEN_HEIGHT / kioku_aft:GetTexture():GetTextureHeight()
			kioku_aft_width_ratio = (SCREEN_HEIGHT * (SCREEN_WIDTH/SCREEN_HEIGHT) ) / kioku_aft:GetTexture():GetTextureWidth()
			
		end,
	ShowAFTMessageCommand= cmd(visible,true),
	Def.Sprite{
	    ProxyThisMessageCommand= function(self)
		--if kioku_aft_target2 then
		    self:SetTexture(screen_aft:GetTexture()):Center()
		    --self:customtexturerect(0,0,0.625*(SCREEN_WIDTH/640),0.937)--For some reason, the AFT was not filling the whole sprite. This should fix that,
		    kioku_aft_self = self
		--end
	    end,
	    ShowAFTMessageCommand= cmd(visible,true),
	},
    },
    Def.Quad{
      Name= "actor_vd",
      HideAFTMessageCommand= cmd(visible,false),
      InitCommand= cmd(visible,false),
      OnCommand= cmd(diffuse,color('0,0,0,.75');zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y),
      ShowAFTMessageCommand= cmd(visible,true),
    },
    Def.Sprite{
      Name= "actor_wd",
      BackToNormalMessageCommand= cmd(linear,0.5;diffusealpha,0),
      HideAFTMessageCommand= cmd(visible,false),
      InitCommand= cmd(visible,false),
      OnCommand= cmd(diffusealpha,0.5;zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y),
      ShowAFTMessageCommand= cmd(visible,true),
      Texture= "../bg.png",
    },
    Def.Sprite{
      Name= "actor_xd",
      HideAFTMessageCommand= cmd(visible,false),
      InitCommand= cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y),
      OnCommand= function(self)
			--self:zoomx((SCREEN_WIDTH/DISPLAY:GetDisplayWidth()));
			--self:zoomy((SCREEN_HEIGHT/DISPLAY:GetDisplayHeight()))
			
			
			
			self:SetTexture(kioku_aft:GetTexture());
			--This makes it so the aft fills the whole screen regardless of internal resolution OR screen ratio! -Kid
			self:customtexturerect(0,0,kioku_aft_width_ratio,kioku_aft_height_ratio)
			
			self:diffusealpha(0.99)
			kioku_aft_target = self;
			kioku_aft_target_wrap = self:x(0):y(0):AddWrapperState():x(SCREEN_CENTER_X):y(SCREEN_CENTER_Y)
		end,
      ShowAFTMessageCommand= cmd(visible,true),
      Texture= "white",
    },
    Def.Sprite{
      Name= "actor_yd",
      BackToNormalMessageCommand= cmd(linear,0.5;diffusealpha,0),
      InitCommand= function(self) kioku_floaters = self end,--Did some *(SCREEN_HEIGHT/480). -Kid
      OnCommand= cmd(diffusealpha,0;zoom,3*(SCREEN_HEIGHT/480);customtexturerect,0,0,2,2;texcoordvelocity,0.03,0.01;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;
	diffuseshift;effectperiod,4;effectclock,"bgm";effectcolor1,color('1,1,1,0.6');effectcolor2,color('1,1,1,0.8')),
      Texture= "floaters.png",
    },
    Def.Sprite{
      Name= "actor_zd",
      BackToNormalMessageCommand= cmd(linear,0.5;diffusealpha,0),
      InitCommand= function(self) kioku_floaters2 = self end,--Did some *(SCREEN_HEIGHT/480). -Kid
      OnCommand= cmd(diffusealpha,0;zoom,5*(SCREEN_HEIGHT/480);customtexturerect,0,0,2,2;texcoordvelocity,-0.02,0.008;x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;
	diffuseshift;effectperiod,6;effectoffset,2;effectclock,"bgm";effectcolor1,color('1,1,1,0.6');effectcolor2,color('1,1,1,0.8')),
      Texture= "floaters.png",
    },
  }),
}
