remove children nodes

This commit is contained in:
Glenn Maynard
2007-05-18 16:57:36 +00:00
parent 0832b5dd8b
commit ddf7194ee7
14 changed files with 86 additions and 102 deletions
@@ -1,15 +1,12 @@
local t = local t = Def.ActorFrame {
Def.ActorFrame {
children = {
LoadActor("white.png") .. { LoadActor("white.png") .. {
OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;stretchto,SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;stretchto,SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM)
}, };
LoadActor("stepmania (dither).png") .. { LoadActor("stepmania (dither).png") .. {
File="stepmania (dither).png", File="stepmania (dither).png",
InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;diffusealpha,0), InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;diffusealpha,0),
OnCommand=cmd(linear,1;diffusealpha,1), OnCommand=cmd(linear,1;diffusealpha,1),
} };
}
} }
return t return t
@@ -118,7 +118,14 @@ local fontPath = THEME:GetPathF( "ScreenCredits", "titles" )
local lineOn = cmd(zoom,0.5) local lineOn = cmd(zoom,0.5)
local sectionOn = cmd(zoom,0.5;diffuse,1,.5,.5,1) local sectionOn = cmd(zoom,0.5;diffuse,1,.5,.5,1)
local otherOn = cmd(zoom,0.5;diffuse,.5,.5,1,1) local otherOn = cmd(zoom,0.5;diffuse,.5,.5,1,1)
local children = {} local t = Def.ActorScroller {
SecondsPerItem = 0.40;
NumItemsToDraw = 40;
TransformFunction = function( self, offset, itemIndex, numItems)
self:y(30*offset)
end;
OnCommand = cmd(zoom,0.64;scrollwithpadding,12,0);
}
local function AddLine( text, command ) local function AddLine( text, command )
local t = Def.BitmapText { local t = Def.BitmapText {
@@ -128,7 +135,7 @@ local function AddLine( text, command )
OnCommand = command or lineOn; OnCommand = command or lineOn;
} }
-- XXX: Hack. Wrap in an ActorFrame so OnCommand works -- XXX: Hack. Wrap in an ActorFrame so OnCommand works
table.insert( children, WrapInActorFrame({t}) ) table.insert( t, WrapInActorFrame({t}) )
end end
-- Add header and padding -- Add header and padding
@@ -155,13 +162,4 @@ for i=1,13 do AddLine() end
AddLine( "Join the StepMania team", otherOn ) AddLine( "Join the StepMania team", otherOn )
AddLine( "and help us out!" ) AddLine( "and help us out!" )
-- Wrap everything up in an ActorScroller return t;
return Def.ActorScroller {
SecondsPerItem = 0.40;
NumItemsToDraw = 40;
TransformFunction = function( self, offset, itemIndex, numItems)
self:y(30*offset)
end;
OnCommand = cmd(zoom,0.64;scrollwithpadding,12,0);
children = children;
}
@@ -1,4 +1,4 @@
local children = { local t = Def.ActorFrame {
LoadActor( "song background scroller" ) .. { LoadActor( "song background scroller" ) .. {
InitCommand = cmd(x,SCREEN_CENTER_X-160;y,SCREEN_CENTER_Y); InitCommand = cmd(x,SCREEN_CENTER_X-160;y,SCREEN_CENTER_Y);
}; };
@@ -7,4 +7,4 @@ local children = {
}; };
} }
return WrapInActorFrame( children ) return t;
@@ -1,23 +1,20 @@
local template = Def.ActorFrame { local template = Def.ActorFrame {
children = {
Def.Sprite { Def.Sprite {
OnCommand = cmd(LoadBackground,GetRandomSongBackground();scaletoclipped,312,232); OnCommand = cmd(LoadBackground,GetRandomSongBackground();scaletoclipped,312,232);
}; };
LoadActor( THEME:GetPathG("ScreenCredits", "background frame") ); LoadActor( THEME:GetPathG("ScreenCredits", "background frame") );
};
} }
local children = {} local t = Def.ActorScroller {
for i=1,10 do
table.insert( children, template )
end
return Def.ActorScroller {
SecondsPerItem = 4.25; SecondsPerItem = 4.25;
NumItemsToDraw = 4; NumItemsToDraw = 4;
TransformFunction = function( self, offset, itemIndex, numItems ) TransformFunction = function( self, offset, itemIndex, numItems )
self:y(-240*offset) self:y(-240*offset)
end; end;
OnCommand = cmd(scrollwithpadding,2,3); OnCommand = cmd(scrollwithpadding,2,3);
children = children;
} }
for i=1,10 do
table.insert( t, template );
end
return t;
@@ -1,5 +1,4 @@
local children = local t = Def.ActorFrame {
{
LoadActor("../_black.png") .. { LoadActor("../_black.png") .. {
OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomtowidth,SCREEN_WIDTH;zoomtoheight,120;diffusealpha,0.7); OnCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomtowidth,SCREEN_WIDTH;zoomtoheight,120;diffusealpha,0.7);
}; };
@@ -8,4 +7,4 @@ local children =
}; };
}; };
return Def.ActorFrame{ children=children }; return t;
@@ -1,9 +1,8 @@
local children = local t = Def.ActorFrame {
{
LoadActor("gameover.png") .. { LoadActor("gameover.png") .. {
InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;diffusealpha,0); InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;diffusealpha,0);
OnCommand=cmd(linear,0.3;diffusealpha,0.9;sleep,5); OnCommand=cmd(linear,0.3;diffusealpha,0.9;sleep,5);
}; };
}; };
return Def.ActorFrame{ children=children }; return t;
@@ -1,4 +1,4 @@
local children = { local t = Def.ActorFrame {
Def.Quad { Def.Quad {
InitCommand=cmd(diffuse,color("#000000");stretchto,SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM); InitCommand=cmd(diffuse,color("#000000");stretchto,SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM);
StartCommand=cmd(diffusealpha,0;sleep,1;linear,0.5;diffusealpha,1); StartCommand=cmd(diffusealpha,0;sleep,1;linear,0.5;diffusealpha,1);
@@ -11,4 +11,4 @@ local children = {
FinishCommand=cmd(sleep,1;linear,0.5;diffusealpha,0); FinishCommand=cmd(sleep,1;linear,0.5;diffusealpha,0);
}; };
}; };
return Def.ActorFrame { children = children }; return t;
@@ -1,4 +1,4 @@
local children = { local t = Def.ActorFrame {
LoadSongBackground() .. { LoadSongBackground() .. {
OnCommand=cmd(diffusealpha,0;sleep,0.5;linear,0.5;diffusealpha,1); OnCommand=cmd(diffusealpha,0;sleep,0.5;linear,0.5;diffusealpha,1);
}; };
@@ -6,7 +6,6 @@ local children = {
-- Cleared -- Cleared
Def.ActorFrame { Def.ActorFrame {
Condition=GAMESTATE:GetPlayMode() ~= PLAY_MODE_BATTLE and GAMESTATE:GetPlayMode() ~= PLAY_MODE_RAVE and not GAMESTATE:IsDemonstration(); Condition=GAMESTATE:GetPlayMode() ~= PLAY_MODE_BATTLE and GAMESTATE:GetPlayMode() ~= PLAY_MODE_RAVE and not GAMESTATE:IsDemonstration();
children = {
LoadActor("extra1") .. { LoadActor("extra1") .. {
Condition=GAMESTATE:IsExtraStage(); Condition=GAMESTATE:IsExtraStage();
StartTransitioningCommand=cmd(hide_if,not GAMESTATE:HasEarnedExtraStage()); StartTransitioningCommand=cmd(hide_if,not GAMESTATE:HasEarnedExtraStage());
@@ -21,11 +20,9 @@ local children = {
OnCommand=cmd(diffusealpha,0;sleep,1;linear,0.5;diffusealpha,1;sleep,2); OnCommand=cmd(diffusealpha,0;sleep,1;linear,0.5;diffusealpha,1;sleep,2);
}; };
}; };
};
-- Winner -- Winner
Def.ActorFrame { Def.ActorFrame {
Condition=GAMESTATE:GetPlayMode() == PLAY_MODE_BATTLE or GAMESTATE:GetPlayMode() == PLAY_MODE_RAVE; Condition=GAMESTATE:GetPlayMode() == PLAY_MODE_BATTLE or GAMESTATE:GetPlayMode() == PLAY_MODE_RAVE;
children = {
LoadActor("p1 win") .. { LoadActor("p1 win") .. {
InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y); InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y);
StartTransitioningCommand=cmd(hide_if,not GAMESTATE:IsWinner(PLAYER_1)); StartTransitioningCommand=cmd(hide_if,not GAMESTATE:IsWinner(PLAYER_1));
@@ -42,17 +39,15 @@ local children = {
OnCommand=cmd(diffusealpha,0;sleep,1.5;linear,0.5;diffusealpha,1;sleep,2); OnCommand=cmd(diffusealpha,0;sleep,1.5;linear,0.5;diffusealpha,1;sleep,2);
}; };
}; };
};
-- Demonstration -- Demonstration
Def.ActorFrame { Def.ActorFrame {
Condition=GAMESTATE:IsDemonstration(); Condition=GAMESTATE:IsDemonstration();
children = {
Def.Quad { Def.Quad {
InitCommand=cmd(stretchto,SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM;diffuse,color("0,0,0,1")); InitCommand=cmd(stretchto,SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM;diffuse,color("0,0,0,1"));
OnCommand=cmd(sleep,1.5;diffusealpha,0); OnCommand=cmd(sleep,1.5;diffusealpha,0);
}; };
}; };
};
}; };
return Def.ActorFrame { children = children };
return t;
@@ -1,4 +1,4 @@
local children = { local t = Def.ActorFrame {
LoadActor(THEME:GetPathS("", "_extra1")) .. { LoadActor(THEME:GetPathS("", "_extra1")) .. {
StartTransitioningCommand=function(self) StartTransitioningCommand=function(self)
if GAMESTATE:HasEarnedExtraStage() then self:play() end if GAMESTATE:HasEarnedExtraStage() then self:play() end
@@ -23,4 +23,4 @@ local children = {
}; };
}; };
return Def.ActorFrame { children = children }; return t;
@@ -1,4 +1,4 @@
local children = { local t = Def.ActorFrame {
LoadActor(THEME:GetPathS("", "_extra2")) .. { LoadActor(THEME:GetPathS("", "_extra2")) .. {
StartTransitioningCommand=function(self) StartTransitioningCommand=function(self)
if GAMESTATE:HasEarnedExtraStage() then self:play() end if GAMESTATE:HasEarnedExtraStage() then self:play() end
@@ -23,4 +23,4 @@ local children = {
}; };
}; };
return Def.ActorFrame { children = children }; return t;
@@ -1,18 +1,19 @@
local children = { }; local Def.ActorFrame {
};
if GAMESTATE:IsExtraStage() then if GAMESTATE:IsExtraStage() then
children[#children+1] = LoadActor("_extra score frame") .. { t[#t+1] = LoadActor("_extra score frame") .. {
InitCommand=cmd(x,SCREEN_CENTER_X+0;y,SCREEN_CENTER_Y-208); InitCommand=cmd(x,SCREEN_CENTER_X+0;y,SCREEN_CENTER_Y-208);
OnCommand=cmd(addy,-100;sleep,0.5;linear,1;addy,100); OnCommand=cmd(addy,-100;sleep,0.5;linear,1;addy,100);
OffCommand=cmd(linear,1;addy,-100); OffCommand=cmd(linear,1;addy,-100);
}; };
else else
local sFile = GAMESTATE:GetPlayMode() == "PlayMode_Oni" and "_oni score frame" or "_score frame"; local sFile = GAMESTATE:GetPlayMode() == "PlayMode_Oni" and "_oni score frame" or "_score frame";
children[#children+1] = LoadActor(sFile) .. { t[#t+1] = LoadActor(sFile) .. {
InitCommand=cmd(x,SCREEN_CENTER_X+0;y,SCREEN_CENTER_Y+208); InitCommand=cmd(x,SCREEN_CENTER_X+0;y,SCREEN_CENTER_Y+208);
OnCommand=cmd(addy,100;linear,0.5;addy,-100); OnCommand=cmd(addy,100;linear,0.5;addy,-100);
OffCommand=cmd(linear,0.5;addy,100); OffCommand=cmd(linear,0.5;addy,100);
}; };
end end
return Def.ActorFrame { children = children }; return t;
@@ -1,4 +1,4 @@
local children = { local t = Def.ActorFrame {
LoadActor("_warning") .. { LoadActor("_warning") .. {
InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y; InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;
vertalign,top; vertalign,top;
@@ -10,4 +10,4 @@ local children = {
}; };
}; };
return Def.ActorFrame { children = children }; return t;
@@ -88,8 +88,7 @@ local function Radar()
return t; return t;
end end
local children = local t = Def.ActorFrame {
{
LoadActor( "_banner mask" ) .. { LoadActor( "_banner mask" ) .. {
InitCommand=cmd(y,SCREEN_CENTER_Y-84;blend,"BlendMode_NoEffect";zwrite,1); InitCommand=cmd(y,SCREEN_CENTER_Y-84;blend,"BlendMode_NoEffect";zwrite,1);
OnCommand=cmd(x,SCREEN_CENTER_X-180-SCREEN_WIDTH*0.6;bounceend,0.5;addx,SCREEN_WIDTH*0.6); OnCommand=cmd(x,SCREEN_CENTER_X-180-SCREEN_WIDTH*0.6;bounceend,0.5;addx,SCREEN_WIDTH*0.6);
@@ -391,4 +390,4 @@ local children =
CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); CurrentCourseChangedMessageCommand=cmd(playcommand,"Set");
}; };
}; };
return Def.ActorFrame { children=children }; return t;
@@ -1,6 +1,7 @@
local children = {}; local Def.ActorFrame {
};
for idx, diff in pairs(Difficulty) do -- 0, Difficulty_Beginner for idx, diff in pairs(Difficulty) do -- 0, Difficulty_Beginner
children[#children+1] = LoadActor( "_DifficultyDisplay 6x1" ) .. { t[#t+1] = LoadActor( "_DifficultyDisplay 6x1" ) .. {
InitCommand=cmd(pause;setstate,Difficulty:Reverse()[diff]); InitCommand=cmd(pause;setstate,Difficulty:Reverse()[diff]);
ShowCommand=cmd(stoptweening;linear,0.1;diffusealpha,1); ShowCommand=cmd(stoptweening;linear,0.1;diffusealpha,1);
HideCommand=cmd(stoptweening;linear,0.1;diffusealpha,0); HideCommand=cmd(stoptweening;linear,0.1;diffusealpha,0);
@@ -18,6 +19,4 @@ for idx, diff in pairs(Difficulty) do -- 0, Difficulty_Beginner
}; };
end end
return Def.ActorFrame { return t;
children = children
};