diff --git a/Themes/_fallback/BGAnimations/ScreenConsoleOverlay overlay.lua b/Themes/_fallback/BGAnimations/ScreenConsoleOverlay overlay.lua index ecba4d487a..c5746656de 100644 --- a/Themes/_fallback/BGAnimations/ScreenConsoleOverlay overlay.lua +++ b/Themes/_fallback/BGAnimations/ScreenConsoleOverlay overlay.lua @@ -1,21 +1,14 @@ local t = Def.ActorFrame { Def.ActorFrame { - InitCommand=function(self) - self:Center(); - end; ---[[ - ToggleConsoleDisplayMessageCommand=function(self) + InitCommand=cmd(Center); + --[[ ToggleConsoleDisplayMessageCommand=function(self) bVisible = 1 - bVisible; bShow = (bVisible >= 1) and true or false; self:visible(bShow); - end; ---]] + end; --]] Def.Quad { InitCommand(zoomto,64,64;spin;); - ToggleConsoleDisplayMessageCommand=function(self) - self:zoomto(345, 345); - self:visible(true); - end; + ToggleConsoleDisplayMessageCommand=cmd(zoomto,345,345;visible,true); }; }; }; diff --git a/Themes/_fallback/BGAnimations/ScreenCredits overlay.lua b/Themes/_fallback/BGAnimations/ScreenCredits overlay.lua index c674ab2e16..02a2299b0c 100644 --- a/Themes/_fallback/BGAnimations/ScreenCredits overlay.lua +++ b/Themes/_fallback/BGAnimations/ScreenCredits overlay.lua @@ -117,18 +117,8 @@ local sections = { -- To add people or sections modify the above. -local lineOn = function(self) - self:zoom(0.875); - self:strokecolor(color("#444444")); - self:shadowcolor(color("#444444")); - self:shadowlength(3); -end; -local sectionOn = function(self) - self:diffuse(color("#88DDFF")); - self:strokecolor(color("#446688")); - self:shadowcolor(color("#446688")); - self:shadowlength(3); -end; +local lineOn = cmd(zoom,0.875;strokecolor,color("#444444");shadowcolor,color("#444444");shadowlength,3) +local sectionOn = cmd(diffuse,color("#88DDFF");strokecolor,color("#446688");shadowcolor,color("#446688");shadowlength,3) local item_padding_start = 4; local creditScroller = Def.ActorScroller { @@ -137,9 +127,7 @@ local creditScroller = Def.ActorScroller { TransformFunction = function( self, offset, itemIndex, numItems) self:y(30*offset) end; - OnCommand = function(self) - self:scrollwithpadding(item_padding_start, 15); - end; + OnCommand = cmd(scrollwithpadding,item_padding_start,15); } local function AddLine( text, command ) @@ -168,9 +156,6 @@ end; return Def.ActorFrame{ creditScroller..{ - InitCommand=function(self) - self:CenterX(); - self:y(SCREEN_BOTTOM - 64); - end; + InitCommand=cmd(CenterX;y,SCREEN_BOTTOM-64), } }; \ No newline at end of file diff --git a/Themes/_fallback/BGAnimations/ScreenInit background/default.lua b/Themes/_fallback/BGAnimations/ScreenInit background/default.lua index e51bf3994a..b823b61565 100644 --- a/Themes/_fallback/BGAnimations/ScreenInit background/default.lua +++ b/Themes/_fallback/BGAnimations/ScreenInit background/default.lua @@ -1,83 +1,39 @@ local t = Def.ActorFrame {}; t[#t+1] = Def.ActorFrame { - InitCommand=function(self) - self:Center(); - end; + InitCommand=cmd(Center); Def.Quad { - InitCommand=function(self) - self:scaletoclipped(SCREEN_WIDTH, SCREEN_HEIGHT); - end; - OnCommand=function(self) - self:diffuse(color("0,0,0,1")); - self:diffusetopedge(color("0.1,0.1,0.1,1")); - end; + InitCommand=cmd(scaletoclipped,SCREEN_WIDTH,SCREEN_HEIGHT); + OnCommand=cmd(diffuse,color("0,0,0,1");diffusetopedge,color("0.1,0.1,0.1,1")); }; }; t[#t+1] = Def.ActorFrame { - InitCommand=function(self) - self:Center(); - end; + InitCommand=cmd(Center); Def.ActorFrame { Def.Quad { - InitCommand=function(self) - self:zoomto(SCREEN_WIDTH, 128); - end; - OnCommand=function(self) - self:diffusealpha(1); - self:sleep(1.5); - self:linear(0.25); - end; + InitCommand=cmd(zoomto,SCREEN_WIDTH,128); + OnCommand=cmd(diffusealpha,1;sleep,1.5;linear,0.25); }; LoadActor("ssc") .. { - OnCommand=function(self) - self:diffusealpha(0); - self:linear(1); - self:diffusealpha(1); - self:sleep(0.75); - self:linear(0.25); - self:diffusealpha(0); - end; + OnCommand=cmd(diffusealpha,0;linear,1;diffusealpha,1;sleep,0.75;linear,0.25;diffusealpha,0); }; }; Def.ActorFrame { - OnCommand=function(self) - self:playcommandonchildren("ChildrenOn"); - end; - ChildrenOnCommand=function(self) - self:diffusealpha(0); - self:sleep(2); - self:linear(0.25); - self:diffusealpha(1); - end; + OnCommand=cmd(playcommandonchildren,"ChildrenOn"); + ChildrenOnCommand=cmd(diffusealpha,0;sleep,2;linear,0.25;diffusealpha,1); LoadFont("Common Normal") .. { Text=ProductID(); - InitCommand=function(self) - self:y(-20); - self:zoom(0.75); - end; - OnCommand=function(self) - self:diffuse(color("0,0,0,1")); - self:strokecolor(color("#f7941d")); - end; + InitCommand=cmd(y,-20;zoom,0.75); + OnCommand=cmd(diffuse,color("0,0,0,1");strokecolor,color("#f7941d")); }; LoadFont("Common Normal") .. { Text=THEME:GetThemeDisplayName(); - OnCommand=function(self) - self:diffuse(color("0,0,0,1")); - self:strokecolor(color("#f7941d")); - end; + OnCommand=cmd(diffuse,color("0,0,0,1");strokecolor,color("#f7941d")); }; LoadFont("Common Normal") .. { Text="Created by " .. THEME:GetThemeAuthor(); - InitCommand=function(self) - self:y(24); - self:zoom(0.75); - end; - OnCommand=function(self) - self:diffuse(color("0,0,0,1")); - self:strokecolor(color("#f7941d")); - end; + InitCommand=cmd(y,24;zoom,0.75); + OnCommand=cmd(diffuse,color("0,0,0,1");strokecolor,color("#f7941d")); }; }; }; diff --git a/Themes/_fallback/BGAnimations/ScreenMapControllers overlay.lua b/Themes/_fallback/BGAnimations/ScreenMapControllers overlay.lua index e92491d458..9f90de1fc3 100644 --- a/Themes/_fallback/BGAnimations/ScreenMapControllers overlay.lua +++ b/Themes/_fallback/BGAnimations/ScreenMapControllers overlay.lua @@ -1,69 +1,27 @@ -local waitTime = 7.5 - -local t = Def.ActorFrame { - InitCommand=function(self) - self:x(SCREEN_CENTER_X); - self:y(SCREEN_CENTER_Y); - end; - OnCommand=function(self) - self:queuecommand("TweenOn"); - self:sleep(waitTime); - self:queuecommand("TweenOff"); - end; -} -t[#t+1] = Def.Quad { - InitCommand=function(self) - self:zoomto(SCREEN_WIDTH, SCREEN_HEIGHT); - self:diffuse(Color.Black); - end; - TweenOnCommand=function(self) - self:diffusealpha(1); - self:linear(0.5); - self:diffusealpha(0.8); - end; - TweenOffCommand=function(self) - self:linear(0.5); - self:diffusealpha(0); - end; -}; -t[#t+1] = Def.ActorFrame { - LoadFont("Common Normal") .. { - Text=ScreenString("WarningHeader"); - InitCommand=function(self) - self:y(-70); - self:diffuse(Color.Red); - end; - TweenOnCommand=function(self) - self:diffusealpha(0); - self:zoomx(2); - self:zoomy(0); - self:sleep(0.5); - self:smooth(0.25); - self:zoom(1); - self:diffusealpha(1); - end; - TweenOffCommand=function(self) - self:linear(0.5); - self:diffusealpha(0); - end; - }; - LoadFont("Common Normal") .. { - Text=ScreenString("WarningText"); - InitCommand=function(self) - self:y(10); - self:wrapwidthpixels(SCREEN_WIDTH - 48); - end; - TweenOnCommand=function(self) - self:diffusealpha(0); - self:sleep(0.5125); - self:linear(0.125); - self:diffusealpha(1); - end; - TweenOffCommand=function(self) - self:linear(0.5); - self:diffusealpha(0); - end; - }; -}; - +local waitTime = 7.5 + +local t = Def.ActorFrame { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y); + OnCommand=cmd(queuecommand,"TweenOn";sleep,waitTime;queuecommand,"TweenOff"); +} +t[#t+1] = Def.Quad { + InitCommand=cmd(zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,Color.Black); + TweenOnCommand=cmd(diffusealpha,1;linear,0.5;diffusealpha,0.8); + TweenOffCommand=cmd(linear,0.5;diffusealpha,0); +}; +t[#t+1] = Def.ActorFrame { + LoadFont("Common Normal") .. { + Text=ScreenString("WarningHeader"); + InitCommand=cmd(y,-70;diffuse,Color.Red); + TweenOnCommand=cmd(diffusealpha,0;zoomx,2;zoomy,0;sleep,0.5;smooth,0.25;zoom,1;diffusealpha,1); + TweenOffCommand=cmd(linear,0.5;diffusealpha,0); + }; + LoadFont("Common Normal") .. { + Text=ScreenString("WarningText"); + InitCommand=cmd(y,10;wrapwidthpixels,SCREEN_WIDTH-48); + TweenOnCommand=cmd(diffusealpha,0;sleep,0.5125;linear,0.125;diffusealpha,1); + TweenOffCommand=cmd(linear,0.5;diffusealpha,0); + }; +}; + return t \ No newline at end of file diff --git a/Themes/_fallback/BGAnimations/ScreenNameEntryTraditional underlay/default.lua b/Themes/_fallback/BGAnimations/ScreenNameEntryTraditional underlay/default.lua index 0155b8e3a1..c6dae65298 100644 --- a/Themes/_fallback/BGAnimations/ScreenNameEntryTraditional underlay/default.lua +++ b/Themes/_fallback/BGAnimations/ScreenNameEntryTraditional underlay/default.lua @@ -1,52 +1,40 @@ -local Players = GAMESTATE:GetHumanPlayers(); ---[[ local tMath = { - PLAYER_1 = -1, - PLAYER_2 = 1 -}; --]] --- -local t = Def.ActorFrame {}; --- Is Anyone Enabled To Join -t[#t+1] = Def.ActorFrame { - InitCommand=function(self) - self:x(SCREEN_CENTER_X); - self:y(SCREEN_CENTER_Y); - end; - LoadFont("Common Normal") .. { - Text="A player has a high score"; - BeginCommand=function(self) - self:visible(SCREENMAN:GetTopScreen():GetAnyEntering()); - end; - }; - LoadFont("Common Normal") .. { - Text="No players has a high score"; - BeginCommand=function(self) - self:visible(not SCREENMAN:GetTopScreen():GetAnyEntering()); - end; - }; ---[[ - for pn in ivalues(Players) do - LoadFont("Common Normal") .. { - Text=ToEnumShortString(pn); - InitCommand=function(self) - self:x(128 * tMath[pn]); - self:y(32); - end - }; - end ---]] -}; --- -t[#t+1] = Def.Actor { - MenuTimerExpiredMessageCommand = function(self, param) - for pn in ivalues(Players) do - SCREENMAN:GetTopScreen():Finish(pn); - end - end; - CodeMessageCommand=function(self,param) - if param.Name == "Enter" then - SCREENMAN:GetTopScreen():Finish(pn); - end - end -}; --- +local Players = GAMESTATE:GetHumanPlayers(); +--[[ local tMath = { + PLAYER_1 = -1, + PLAYER_2 = 1 +}; --]] +-- +local t = Def.ActorFrame {}; +-- Is Anyone Enabled To Join +t[#t+1] = Def.ActorFrame { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y); + LoadFont("Common Normal") .. { + Text="A player has a high score"; + BeginCommand=cmd(visible,SCREENMAN:GetTopScreen():GetAnyEntering()); + }; + LoadFont("Common Normal") .. { + Text="No players has a high score"; + BeginCommand=cmd(visible,not SCREENMAN:GetTopScreen():GetAnyEntering()); + }; +--[[ for pn in ivalues(Players) do + LoadFont("Common Normal") .. { + Text=ToEnumShortString(pn); + InitCommand=cmd(x,128 * tMath[pn];y,32); + }; + end --]] +}; +-- +t[#t+1] = Def.Actor { + MenuTimerExpiredMessageCommand = function(self, param) + for pn in ivalues(Players) do + SCREENMAN:GetTopScreen():Finish(pn); + end + end; + CodeMessageCommand=function(self,param) + if param.Name == "Enter" then + SCREENMAN:GetTopScreen():Finish(pn); + end + end +}; +-- return t \ No newline at end of file diff --git a/Themes/_fallback/BGAnimations/ScreenNameEntryTraditional underlay/keyboard.lua b/Themes/_fallback/BGAnimations/ScreenNameEntryTraditional underlay/keyboard.lua index 818c16e18b..cdc1506c84 100644 --- a/Themes/_fallback/BGAnimations/ScreenNameEntryTraditional underlay/keyboard.lua +++ b/Themes/_fallback/BGAnimations/ScreenNameEntryTraditional underlay/keyboard.lua @@ -1,293 +1,271 @@ -local function distance( x1, y1, x2, y2 ) - return math.pow( math.pow(x1-x2, 2) + math.pow(y1-y2, 2), 0.5 ); -end - -local children = { -}; - -local Letters = { - "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", - "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", - "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "?", "!", - "BACK", "ENTER" -}; - -local LetterIndexes = { }; -for i, l in ipairs(Letters) do - LetterIndexes[l] = i; -end - -local MapNameToLetter = {}; -local MapLetterToName = {}; -local letter = LoadFont("Common Normal")..{ - InitCommand=function(self) - self:zoom(0.8); - self:shadowlength(0); - end; - PulseCommand = function(self) - self:finishtweening(); - local z = self:GetZoomX(); - self:accelerate(0.15); - self:zoom(1.2); - self:decelerate(0.15); - self:zoom(z); - end; -}; - -for l in ivalues(Letters) do - local Name = "letter " .. l; - MapNameToLetter[Name] = l; - MapLetterToName[l] = Name; - children[#children+1] = letter..{ - Name = Name; - Text = l; - }; - if l == "BACK" or l == "ENTER" then - children[#children].File = THEME:GetPathF("Common", "Normal"); - end; -end; -children[#children+1] = LoadActor( THEME:GetPathS("Common", "value") ) .. { Name = "Type"; SupportPan = true; } -children[#children+1] = LoadActor( THEME:GetPathS("Common", "cancel") ) .. { Name = "Back"; SupportPan = true; } -children[#children+1] = LoadActor( THEME:GetPathS("Common", "start") ).. { Name = "Enter"; SupportPan = true; } -children[#children+1] = LoadActor( THEME:GetPathS("MusicWheel", "change") ) .. { Name = "Move"; SupportPan = true; } - -local CursorFiles = { - [PLAYER_1] = "Cursor P1", - [PLAYER_2] = "Cursor P2" -}; - -for pn in ivalues(PlayerNumber) do - children[#children+1] = LoadActor( THEME:GetPathG("_frame", "1D"), - { 4/10, 2/10, 4/10 }, - LoadActor(CursorFiles[pn]) - )..{ - Name = CursorFiles[pn]; - BeginCommand = function(self) - self:visible(SCREENMAN:GetTopScreen():GetEnteringName(pn)); - end; - OnCommand = function(self) - self:zoom(0); - self:rotationz(-360 * 2); - self:sleep(0.55); - self:decelerate(0.5); - self:zoom(1); - self:rotationz(0); - end; - OffCommand = function(self) - self:sleep(0.3); - self:queuecommand("TweenOff"); - end; - PlayerFinishedMessageCommand = function(self,param) - if param.PlayerNumber ~= pn then return end - self:playcommand("TweenOff" ); - end; - TweenOffCommand = function(self,param) - self:accelerate(0.25); - self:zoomx(0); - end; - }; -end - -local c; -local Keys = {}; -local Selection = {}; -local PlayerX = {}; -local PlayerY = {}; -return Def.ActorFrame { - children = children; - BeginCommand = function(self) - c = self:GetChildren(); - c.Cursors = {}; - c.Cursors[PLAYER_1] = c["Cursor P1"]; - c.Cursors[PLAYER_2] = c["Cursor P2"]; - - for l in ivalues(Letters) do - local Name = MapLetterToName[l]; - assert(Name); - Keys[l] = { - Text = c[Name]; - Width = c[Name]:GetWidth(); - Height = c[Name]:GetHeight(); - }; - assert(c[Name], Name); - end; - - -- Position letters. - local RowWidths = {}; - local fX = 0; - local fXPadding = 4; - local fY = 0; - local iRow = 1; - for l in ivalues(Letters) do - if l == "O" or l == "0" or l == "BACK" then - fX = 0; - fY = fY + 30; - iRow = iRow + 1; - end; - Keys[l].Row = iRow; - Keys[l].Text:x(fX + Keys[l].Width/2); - Keys[l].Text:y(fY + Keys[l].Height/2); - fX = fX + Keys[l].Width; - RowWidths[iRow] = fX; - fX = fX + fXPadding; - end; - for l in ivalues(Letters) do - local iRow = Keys[l].Row; - Keys[l].Text:addx(-RowWidths[iRow]/2); - end; - - Keys["BACK"].Text:x(-140); - Keys["ENTER"].Text:x(140); - - for pn in ivalues(PlayerNumber) do - local sName = SCREENMAN:GetTopScreen():GetSelection(pn); - local DefaultKey = "A" - if #sName > 0 then - DefaultKey = "ENTER" - end - - self:playcommand("SelectKey", { Key = DefaultKey, PlayerNumber = pn }); - c.Cursors[pn]:finishtweening(); - end - end; - - CodeMessageCommand = function(self, param) - local pn = param.PlayerNumber; - if not SCREENMAN:GetTopScreen():GetAnyStillEntering() and param.Name == "Enter" then - if SCREENMAN:GetTopScreen():Finish(pn) then - c.Enter:play(); - end - return; - end - if SCREENMAN:GetTopScreen():GetFinalized( pn ) then - return; - end - - if param.Name == "Left" or param.Name == "Right" then - local iDir = param.Name == "Left" and -1 or 1; - - local idx = LetterIndexes[Selection[pn]]; - idx = idx + iDir; - idx = math.mod(idx+#Letters-1, #Letters)+1; - self:playcommand("SelectKey", { Key = Letters[idx], PlayerNumber = pn }); - c.Move:playforplayer(pn); - return; - end - - if param.Name == "JumpToEnter" then - self:playcommand("SelectKey", { Key = "ENTER", PlayerNumber = pn }); - c.Move:playforplayer(pn); - return; - end - if param.Name == "Backspace" then - if SCREENMAN:GetTopScreen():Backspace(pn) then - c.Back:playforplayer(pn); - end - return; - end - - if param.Name == "NextRow" or param.Name == "PrevRow" then - local iDir = param.Name == "PrevRow" and -1 or 1; - local idx = LetterIndexes[Selection[pn]]; - local iRow = Keys[Selection[pn]].Row; - iRow = iRow + iDir; - iRow = math.mod(iRow+4-1, 4)+1; - - local NearestLetter - local NearestLetterDistance - for l in ivalues(Letters) do - if iRow == Keys[l].Row then - local Text = Keys[l].Text; - - local fDist = distance( PlayerX[pn], PlayerY[pn], - Text:GetX(), Text:GetY() ); - if not NearestLetterDistance or fDist < NearestLetterDistance then - NearestLetterDistance = fDist; - NearestLetter = l; - end - end - end - assert( NearestLetter ); - self:playcommand("SelectKey", { Key = NearestLetter, PlayerNumber = pn, NoStore = true }); - - c.Move:playforplayer(pn); - - return; - end - - if param.Name == "Enter" then - if Selection[pn] == "BACK" then - if SCREENMAN:GetTopScreen():Backspace(pn) then - Keys[Selection[pn]].Text:playcommand( "Pulse" ); - c.Back:playforplayer(pn); - end - elseif Selection[pn] == "ENTER" then - if SCREENMAN:GetTopScreen():Finish(pn) then - Keys[Selection[pn]].Text:playcommand( "Pulse" ); - c.Enter:playforplayer(pn); - end - else - local key = Selection[pn]; -- EnterKey may change this - if SCREENMAN:GetTopScreen():EnterKey(pn, key) then - Keys[key].Text:playcommand( "Pulse" ); - c.Type:playforplayer(pn); - end - end - end - end; - - SelectKeyMessageCommand = function(self, param) - local key = param.Key; - local pn = param.PlayerNumber; - if not Keys[key] then return end - - Selection[pn] = key; - c.Cursors[pn]:stoptweening(); - c.Cursors[pn]:playcommand( "SetSize", { - Width=Keys[key].Width+6; tween=function(self) - self:stoptweening(); - self:linear(0.10); - end; - } ); - c.Cursors[pn]:x( Keys[key].Text:GetX() ); - c.Cursors[pn]:y( Keys[key].Text:GetY() ); - if not param.NoStore then - PlayerX[pn] = Keys[key].Text:GetX(); - PlayerY[pn] = Keys[key].Text:GetY(); - end - end; - MenuTimerExpiredMessageCommand = function(self, param) - for pn in ivalues(PlayerNumber) do - SCREENMAN:GetTopScreen():Finish(pn); - end - c.Enter:play(); - end; - - OnCommand = function(self, param) - for key in ivalues(Letters) do - local fDist = distance( Keys[key].Text:GetX(), Keys[key].Text:GetY(), 0, 100 ); - local f = function(self) - self:diffusealpha(0); - self:zoom(0); - self:sleep(0.25 + (fDist / 400)); - self:decelerate(0.5); - self:diffusealpha(1); - self:zoom(0.8); - end; - f(Keys[key].Text); - end - end; - - OffCommand = function(self, param) - for key in ivalues(Letters) do - local fDist = distance( Keys[key].Text:GetX(), Keys[key].Text:GetY(), 0, 100 ); - local f = function(self) - self:sleep(0.0 + (fDist / 400)); - self:decelerate(0.5); - self:diffusealpha(0); - self:zoom(0); - end; - f(Keys[key].Text); - end - end; -}; +local function distance( x1, y1, x2, y2 ) + return math.pow( math.pow(x1-x2, 2) + math.pow(y1-y2, 2), 0.5 ); +end + +local children = { +}; + +local Letters = { + "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", + "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "?", "!", + "BACK", "ENTER" +}; + +local LetterIndexes = { }; +for i, l in ipairs(Letters) do + LetterIndexes[l] = i; +end + +local MapNameToLetter = {}; +local MapLetterToName = {}; +local letter = LoadFont("Common Normal")..{ + InitCommand=cmd(zoom,0.8;shadowlength,0); + PulseCommand = function(self) + self:finishtweening(); + local z = self:GetZoomX(); + (cmd(accelerate,0.15;zoom,1.2;decelerate,0.15;zoom,z))(self); + end; +}; + +for l in ivalues(Letters) do + local Name = "letter " .. l; + MapNameToLetter[Name] = l; + MapLetterToName[l] = Name; + children[#children+1] = letter..{ + Name = Name; + Text = l; + }; + if l == "BACK" or l == "ENTER" then + children[#children].File = THEME:GetPathF("Common", "Normal"); + end; +end; +children[#children+1] = LoadActor( THEME:GetPathS("Common", "value") ) .. { Name = "Type"; SupportPan = true; } +children[#children+1] = LoadActor( THEME:GetPathS("Common", "cancel") ) .. { Name = "Back"; SupportPan = true; } +children[#children+1] = LoadActor( THEME:GetPathS("Common", "start") ).. { Name = "Enter"; SupportPan = true; } +children[#children+1] = LoadActor( THEME:GetPathS("MusicWheel", "change") ) .. { Name = "Move"; SupportPan = true; } + +local CursorFiles = { + [PLAYER_1] = "Cursor P1", + [PLAYER_2] = "Cursor P2" +}; + +for pn in ivalues(PlayerNumber) do + children[#children+1] = LoadActor( THEME:GetPathG("_frame", "1D"), + { 4/10, 2/10, 4/10 }, + LoadActor(CursorFiles[pn]) + )..{ + Name = CursorFiles[pn]; + BeginCommand = cmd(visible,SCREENMAN:GetTopScreen():GetEnteringName(pn)); + OnCommand = cmd( + zoom,0; + rotationz,-360*2; + sleep,0.55; + decelerate,0.5; + zoom,1; + rotationz,0; + ); + OffCommand = cmd(sleep,0.3;queuecommand,"TweenOff"); + PlayerFinishedMessageCommand = function(self,param) + if param.PlayerNumber ~= pn then return end + self:playcommand("TweenOff" ); + end; + TweenOffCommand = function(self,param) + (cmd(accelerate,0.25;zoomx,0;))(self); + end; + }; +end + +local c; +local Keys = {}; +local Selection = {}; +local PlayerX = {}; +local PlayerY = {}; +return Def.ActorFrame { + children = children; + BeginCommand = function(self) + c = self:GetChildren(); + c.Cursors = {}; + c.Cursors[PLAYER_1] = c["Cursor P1"]; + c.Cursors[PLAYER_2] = c["Cursor P2"]; + + for l in ivalues(Letters) do + local Name = MapLetterToName[l]; + assert(Name); + Keys[l] = { + Text = c[Name]; + Width = c[Name]:GetWidth(); + Height = c[Name]:GetHeight(); + }; + assert(c[Name], Name); + end; + + -- Position letters. + local RowWidths = {}; + local fX = 0; + local fXPadding = 4; + local fY = 0; + local iRow = 1; + for l in ivalues(Letters) do + if l == "O" or l == "0" or l == "BACK" then + fX = 0; + fY = fY + 30; + iRow = iRow + 1; + end; + Keys[l].Row = iRow; + Keys[l].Text:x(fX + Keys[l].Width/2); + Keys[l].Text:y(fY + Keys[l].Height/2); + fX = fX + Keys[l].Width; + RowWidths[iRow] = fX; + fX = fX + fXPadding; + end; + for l in ivalues(Letters) do + local iRow = Keys[l].Row; + Keys[l].Text:addx(-RowWidths[iRow]/2); + end; + + Keys["BACK"].Text:x(-140); + Keys["ENTER"].Text:x(140); + + for pn in ivalues(PlayerNumber) do + local sName = SCREENMAN:GetTopScreen():GetSelection(pn); + local DefaultKey = "A" + if #sName > 0 then + DefaultKey = "ENTER" + end + + self:playcommand("SelectKey", { Key = DefaultKey, PlayerNumber = pn }); + c.Cursors[pn]:finishtweening(); + end + end; + + CodeMessageCommand = function(self, param) + local pn = param.PlayerNumber; + if not SCREENMAN:GetTopScreen():GetAnyStillEntering() and param.Name == "Enter" then + if SCREENMAN:GetTopScreen():Finish(pn) then + c.Enter:play(); + end + return; + end + if SCREENMAN:GetTopScreen():GetFinalized( pn ) then + return; + end + + if param.Name == "Left" or param.Name == "Right" then + local iDir = param.Name == "Left" and -1 or 1; + + local idx = LetterIndexes[Selection[pn]]; + idx = idx + iDir; + idx = math.mod(idx+#Letters-1, #Letters)+1; + self:playcommand("SelectKey", { Key = Letters[idx], PlayerNumber = pn }); + c.Move:playforplayer(pn); + return; + end + + if param.Name == "JumpToEnter" then + self:playcommand("SelectKey", { Key = "ENTER", PlayerNumber = pn }); + c.Move:playforplayer(pn); + return; + end + if param.Name == "Backspace" then + if SCREENMAN:GetTopScreen():Backspace(pn) then + c.Back:playforplayer(pn); + end + return; + end + + if param.Name == "NextRow" or param.Name == "PrevRow" then + local iDir = param.Name == "PrevRow" and -1 or 1; + local idx = LetterIndexes[Selection[pn]]; + local iRow = Keys[Selection[pn]].Row; + iRow = iRow + iDir; + iRow = math.mod(iRow+4-1, 4)+1; + + local NearestLetter + local NearestLetterDistance + for l in ivalues(Letters) do + if iRow == Keys[l].Row then + local Text = Keys[l].Text; + + local fDist = distance( PlayerX[pn], PlayerY[pn], + Text:GetX(), Text:GetY() ); + if not NearestLetterDistance or fDist < NearestLetterDistance then + NearestLetterDistance = fDist; + NearestLetter = l; + end + end + end + assert( NearestLetter ); + self:playcommand("SelectKey", { Key = NearestLetter, PlayerNumber = pn, NoStore = true }); + + c.Move:playforplayer(pn); + + return; + end + + if param.Name == "Enter" then + if Selection[pn] == "BACK" then + if SCREENMAN:GetTopScreen():Backspace(pn) then + Keys[Selection[pn]].Text:playcommand( "Pulse" ); + c.Back:playforplayer(pn); + end + elseif Selection[pn] == "ENTER" then + if SCREENMAN:GetTopScreen():Finish(pn) then + Keys[Selection[pn]].Text:playcommand( "Pulse" ); + c.Enter:playforplayer(pn); + end + else + local key = Selection[pn]; -- EnterKey may change this + if SCREENMAN:GetTopScreen():EnterKey(pn, key) then + Keys[key].Text:playcommand( "Pulse" ); + c.Type:playforplayer(pn); + end + end + end + end; + + SelectKeyMessageCommand = function(self, param) + local key = param.Key; + local pn = param.PlayerNumber; + if not Keys[key] then return end + + Selection[pn] = key; + c.Cursors[pn]:stoptweening(); + c.Cursors[pn]:playcommand( "SetSize", { Width=Keys[key].Width+6; tween=cmd(stoptweening;linear,0.10); } ); + c.Cursors[pn]:x( Keys[key].Text:GetX() ); + c.Cursors[pn]:y( Keys[key].Text:GetY() ); + if not param.NoStore then + PlayerX[pn] = Keys[key].Text:GetX(); + PlayerY[pn] = Keys[key].Text:GetY(); + end + end; + MenuTimerExpiredMessageCommand = function(self, param) + for pn in ivalues(PlayerNumber) do + SCREENMAN:GetTopScreen():Finish(pn); + end + c.Enter:play(); + end; + + OnCommand = function(self, param) + for key in ivalues(Letters) do + local fDist = distance( Keys[key].Text:GetX(), Keys[key].Text:GetY(), 0, 100 ); + local f = cmd( + diffusealpha,0;zoom,0; + sleep,0.25 + (fDist / 400); + decelerate,0.5; + diffusealpha,1;zoom,0.8); + f(Keys[key].Text); + end + end; + + OffCommand = function(self, param) + for key in ivalues(Letters) do + local fDist = distance( Keys[key].Text:GetX(), Keys[key].Text:GetY(), 0, 100 ); + local f = cmd( + sleep,0.0 + (fDist / 400); + decelerate,0.5; + diffusealpha,0;zoom,0); + f(Keys[key].Text); + end + end; +}; diff --git a/Themes/_fallback/BGAnimations/ScreenNoise background/default.lua b/Themes/_fallback/BGAnimations/ScreenNoise background/default.lua index b1e05e184f..172373c4c1 100644 --- a/Themes/_fallback/BGAnimations/ScreenNoise background/default.lua +++ b/Themes/_fallback/BGAnimations/ScreenNoise background/default.lua @@ -1,28 +1,17 @@ -local t = Def.ActorFrame{ - LoadActor("noise")..{ - Name="Noise"; - InitCommand=function(self) - self:Center(); - self:texturewrapping(true); - self:SetTextureFiltering(false); - self:zoom(2); - self:diffusealpha(0); - end; - OnCommand=function(self) - self:linear(1); - self:diffusealpha(1); - end; - }; -}; - -local function Update(self) - local c = self:GetChild("Noise"); - local x = math.random(); - local y = math.random(); - c:customtexturerect(0+x,0+y,2+x,2+y); -end; -t.InitCommand = function(self) - self:SetUpdateFunction(Update); -end; - -return t; +local t = Def.ActorFrame{ + LoadActor("noise")..{ + Name="Noise"; + InitCommand=cmd(Center;texturewrapping,true;SetTextureFiltering,false;zoom,2;diffusealpha,0;); + OnCommand=cmd(linear,1;diffusealpha,1); + }; +}; + +local function Update(self) + local c = self:GetChild("Noise"); + local x = math.random(); + local y = math.random(); + c:customtexturerect(0+x,0+y,2+x,2+y); +end; +t.InitCommand = cmd(SetUpdateFunction,Update); + +return t; diff --git a/Themes/_fallback/BGAnimations/ScreenProfileLoad overlay.lua b/Themes/_fallback/BGAnimations/ScreenProfileLoad overlay.lua index feaf7f1921..0a4a6499ba 100644 --- a/Themes/_fallback/BGAnimations/ScreenProfileLoad overlay.lua +++ b/Themes/_fallback/BGAnimations/ScreenProfileLoad overlay.lua @@ -1,33 +1,22 @@ -local x = Def.ActorFrame{ - Def.Quad{ - InitCommand=function(self) - self:Center(); - self:zoomto(SCREEN_WIDTH, 80); - self:diffuse(color("0,0,0,0.5")); - end; - OnCommand=function(self) end; - OffCommand=function(self) end; - }; - LoadFont("Common Normal")..{ - Text=ScreenString("Loading Profiles"); - InitCommand=function(self) - self:Center(); - self:diffuse(color("1,1,1,1")); - self:shadowlength(1); - end; - OffCommand=function(self) - self:linear(0.15); - self:diffusealpha(0); - end; - }; -}; - -x[#x+1] = Def.Actor { - BeginCommand=function(self) - if SCREENMAN:GetTopScreen():HaveProfileToLoad() then self:sleep(1); end; - self:queuecommand("Load"); - end; - LoadCommand=function() SCREENMAN:GetTopScreen():Continue(); end; -}; - +local x = Def.ActorFrame{ + Def.Quad{ + InitCommand=cmd(Center;zoomto,SCREEN_WIDTH,80;diffuse,color("0,0,0,0.5")); + OnCommand=cmd(); + OffCommand=cmd(); + }; + LoadFont("Common Normal")..{ + Text=ScreenString("Loading Profiles"); + InitCommand=cmd(Center;diffuse,color("1,1,1,1");shadowlength,1); + OffCommand=cmd(linear,0.15;diffusealpha,0); + }; +}; + +x[#x+1] = Def.Actor { + BeginCommand=function(self) + if SCREENMAN:GetTopScreen():HaveProfileToLoad() then self:sleep(1); end; + self:queuecommand("Load"); + end; + LoadCommand=function() SCREENMAN:GetTopScreen():Continue(); end; +}; + return x; \ No newline at end of file diff --git a/Themes/_fallback/BGAnimations/ScreenProfileSave overlay.lua b/Themes/_fallback/BGAnimations/ScreenProfileSave overlay.lua index 2e4114f57e..b1fcb37c37 100644 --- a/Themes/_fallback/BGAnimations/ScreenProfileSave overlay.lua +++ b/Themes/_fallback/BGAnimations/ScreenProfileSave overlay.lua @@ -1,33 +1,22 @@ -local x = Def.ActorFrame{ - Def.Quad{ - InitCommand=function(self) - self:Center(); - self:zoomto(SCREEN_WIDTH, 80); - self:diffuse(color("0,0,0,0.5")); - end; - OnCommand=function(self) end; - OffCommand=function(self) end; - }; - LoadFont("Common Normal")..{ - Text=ScreenString("Saving Profiles"); - InitCommand=function(self) - self:Center(); - self:diffuse(color("1,1,1,1")); - self:shadowlength(1); - end; - OffCommand=function(self) - self:linear(0.15); - self:diffusealpha(0); - end; - }; -}; - -x[#x+1] = Def.Actor { - BeginCommand=function(self) - if SCREENMAN:GetTopScreen():HaveProfileToSave() then self:sleep(1); end; - self:queuecommand("Load"); - end; - LoadCommand=function() SCREENMAN:GetTopScreen():Continue(); end; -}; - +local x = Def.ActorFrame{ + Def.Quad{ + InitCommand=cmd(Center;zoomto,SCREEN_WIDTH,80;diffuse,color("0,0,0,0.5")); + OnCommand=cmd(); + OffCommand=cmd(); + }; + LoadFont("Common Normal")..{ + Text=ScreenString("Saving Profiles"); + InitCommand=cmd(Center;diffuse,color("1,1,1,1");shadowlength,1); + OffCommand=cmd(linear,0.15;diffusealpha,0); + }; +}; + +x[#x+1] = Def.Actor { + BeginCommand=function(self) + if SCREENMAN:GetTopScreen():HaveProfileToSave() then self:sleep(1); end; + self:queuecommand("Load"); + end; + LoadCommand=function() SCREENMAN:GetTopScreen():Continue(); end; +}; + return x; \ No newline at end of file diff --git a/Themes/_fallback/BGAnimations/ScreenSelectProfile overlay.lua b/Themes/_fallback/BGAnimations/ScreenSelectProfile overlay.lua index affa99a53a..d8d484d7b0 100644 --- a/Themes/_fallback/BGAnimations/ScreenSelectProfile overlay.lua +++ b/Themes/_fallback/BGAnimations/ScreenSelectProfile overlay.lua @@ -4,24 +4,16 @@ function GetLocalProfiles() for p = 0,PROFILEMAN:GetNumLocalProfiles()-1 do local profile=PROFILEMAN:GetLocalProfileFromIndex(p); local ProfileCard = Def.ActorFrame { - +--[[ Def.Quad { + InitCommand=cmd(zoomto,200,1;y,40/2); + OnCommand=cmd(diffuse,Color('Outline');); + }; --]] LoadFont("Common Normal") .. { Text=profile:GetDisplayName(); - InitCommand=function(self) - self:shadowlength(1); - self:y(-10); - self:zoom(1); - self:ztest(true); - end; + InitCommand=cmd(shadowlength,1;y,-10;zoom,1;ztest,true); }; LoadFont("Common Normal") .. { - InitCommand=function(self) - self:shadowlength(1); - self:y(8); - self:zoom(0.5); - self:vertspacing(-8); - self:ztest(true); - end; + InitCommand=cmd(shadowlength,1;y,8;zoom,0.5;vertspacing,-8;ztest,true); BeginCommand=function(self) local numSongsPlayed = profile:GetNumTotalSongsPlayed(); local s = numSongsPlayed == 1 and "Song" or "Songs"; @@ -39,9 +31,7 @@ end; function LoadCard(cColor) local t = Def.ActorFrame { LoadActor( THEME:GetPathG("ScreenSelectProfile","CardBackground") ) .. { - InitCommand=function(self) - self:diffuse(cColor); - end; + InitCommand=cmd(diffuse,cColor); }; LoadActor( THEME:GetPathG("ScreenSelectProfile","CardFrame") ); }; @@ -58,17 +48,18 @@ function LoadPlayerStuff(Player) t[#t+1] = Def.ActorFrame { Name = 'JoinFrame'; LoadCard(Color('Orange')); - +--[[ Def.Quad { + InitCommand=cmd(zoomto,200+4,230+4); + OnCommand=cmd(shadowlength,1;diffuse,color("0,0,0,0.5")); + }; + Def.Quad { + InitCommand=cmd(zoomto,200,230); + OnCommand=cmd(diffuse,Color('Orange');diffusealpha,0.5); + }; --]] LoadFont("Common Normal") .. { Text="Press &START; to join."; - InitCommand=function(self) - self:shadowlength(1); - end; - OnCommand=function(self) - self:diffuseshift(); - self:effectcolor1(Color('White')); - self:effectcolor2(color("0.5,0.5,0.5")); - end; + InitCommand=cmd(shadowlength,1); + OnCommand=cmd(diffuseshift;effectcolor1,Color('White');effectcolor2,color("0.5,0.5,0.5")); }; }; @@ -78,65 +69,37 @@ function LoadPlayerStuff(Player) }; t[#t+1] = Def.ActorFrame { Name = 'SmallFrame'; - InitCommand=function(self) - self:y(-2); - end; + InitCommand=cmd(y,-2); Def.Quad { - InitCommand=function(self) - self:zoomto(200 - 10, 40 + 2); - end; - OnCommand=function(self) - self:diffuse(Color('Black')); - self:diffusealpha(0.5); - end; + InitCommand=cmd(zoomto,200-10,40+2); + OnCommand=cmd(diffuse,Color('Black');diffusealpha,0.5); }; Def.Quad { - InitCommand=function(self) - self:zoomto(200 - 10, 40); - end; - OnCommand=function(self) - self:diffuse(PlayerColor(Player)); - self:fadeleft(0.25); - self:faderight(0.25); - self:glow(color("1,1,1,0.25")); - end; + InitCommand=cmd(zoomto,200-10,40); + OnCommand=cmd(diffuse,PlayerColor(Player);fadeleft,0.25;faderight,0.25;glow,color("1,1,1,0.25")); }; Def.Quad { - InitCommand=function(self) - self:zoomto(200 - 10, 40); - self:y(-40 / 2 + 20); - end; - OnCommand=function(self) - self:diffuse(Color("Black")); - self:fadebottom(1); - self:diffusealpha(0.35); - end; + InitCommand=cmd(zoomto,200-10,40;y,-40/2+20); + OnCommand=cmd(diffuse,Color("Black");fadebottom,1;diffusealpha,0.35); }; Def.Quad { - InitCommand=function(self) - self:zoomto(200 - 10, 1); - self:y(-40 / 2 + 1); - end; - OnCommand=function(self) - self:diffuse(PlayerColor(Player)); - self:glow(color("1,1,1,0.25")); - end; + InitCommand=cmd(zoomto,200-10,1;y,-40/2+1); + OnCommand=cmd(diffuse,PlayerColor(Player);glow,color("1,1,1,0.25")); }; }; t[#t+1] = Def.ActorScroller{ Name = 'Scroller'; NumItemsToDraw=6; - OnCommand=function(self) - self:y(1); - self:SetFastCatchup(true); - self:SetMask(200, 58); - self:SetSecondsPerItem(0.15); - end; +-- InitCommand=cmd(y,-230/2+20;); + OnCommand=cmd(y,1;SetFastCatchup,true;SetMask,200,58;SetSecondsPerItem,0.15); TransformFunction=function(self, offset, itemIndex, numItems) local focus = scale(math.abs(offset),0,2,1,0); self:visible(false); self:y(math.floor( offset*40 )); +-- self:zoomy( focus ); +-- self:z(-math.abs(offset)); +-- self:zoom(focus); end; children = GetLocalProfiles(); }; @@ -146,10 +109,8 @@ function LoadPlayerStuff(Player) }; t[#t+1] = LoadFont("Common Normal") .. { Name = 'SelectedProfileText'; - InitCommand=function(self) - self:y(160); - self:shadowlength(1); - end; + --InitCommand=cmd(y,160;shadowlength,1;diffuse,PlayerColor(Player)); + InitCommand=cmd(y,160;shadowlength,1;); }; return t; @@ -272,67 +233,37 @@ local t = Def.ActorFrame { children = { Def.ActorFrame { Name = 'P1Frame'; - InitCommand=function(self) - self:x(SCREEN_CENTER_X - 160); - self:y(SCREEN_CENTER_Y); - end; - OnCommand=function(self) - self:zoom(0); - self:bounceend(0.35); - self:zoom(1); - end; - OffCommand=function(self) - self:bouncebegin(0.35); - self:zoom(0); - end; + InitCommand=cmd(x,SCREEN_CENTER_X-160;y,SCREEN_CENTER_Y); + OnCommand=cmd(zoom,0;bounceend,0.35;zoom,1); + OffCommand=cmd(bouncebegin,0.35;zoom,0); PlayerJoinedMessageCommand=function(self,param) if param.Player == PLAYER_1 then - self:zoom(1.15); - self:bounceend(0.175); - self:zoom(1.0); + (cmd(;zoom,1.15;bounceend,0.175;zoom,1.0;))(self); end; end; children = LoadPlayerStuff(PLAYER_1); }; Def.ActorFrame { Name = 'P2Frame'; - InitCommand=function(self) - self:x(SCREEN_CENTER_X + 160); - self:y(SCREEN_CENTER_Y); - end; - OnCommand=function(self) - self:zoom(0); - self:bounceend(0.35); - self:zoom(1); - end; - OffCommand=function(self) - self:bouncebegin(0.35); - self:zoom(0); - end; + InitCommand=cmd(x,SCREEN_CENTER_X+160;y,SCREEN_CENTER_Y); + OnCommand=cmd(zoom,0;bounceend,0.35;zoom,1); + OffCommand=cmd(bouncebegin,0.35;zoom,0); PlayerJoinedMessageCommand=function(self,param) if param.Player == PLAYER_2 then - self:zoom(1.15); - self:bounceend(0.175); - self:zoom(1.0); + (cmd(zoom,1.15;bounceend,0.175;zoom,1.0;))(self); end; end; children = LoadPlayerStuff(PLAYER_2); }; -- sounds LoadActor( THEME:GetPathS("Common","start") )..{ - StartButtonMessageCommand=function(self) - self:play(); - end; + StartButtonMessageCommand=cmd(play); }; LoadActor( THEME:GetPathS("Common","cancel") )..{ - BackButtonMessageCommand=function(self) - self:play(); - end; + BackButtonMessageCommand=cmd(play); }; LoadActor( THEME:GetPathS("Common","value") )..{ - DirectionButtonMessageCommand=function(self) - self:play(); - end; + DirectionButtonMessageCommand=cmd(play); }; }; }; diff --git a/Themes/_fallback/BGAnimations/ScreenSystemLayer overlay/default.lua b/Themes/_fallback/BGAnimations/ScreenSystemLayer overlay/default.lua index 6252dde085..0e638d6afe 100644 --- a/Themes/_fallback/BGAnimations/ScreenSystemLayer overlay/default.lua +++ b/Themes/_fallback/BGAnimations/ScreenSystemLayer overlay/default.lua @@ -1,89 +1,90 @@ -local function CreditsText( pn ) - local text = LoadFont(Var "LoadingScreen","credits") .. { - InitCommand=function(self) - self:name("Credits" .. PlayerNumberToString(pn)) - ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); - end; - UpdateTextCommand=function(self) - local str = ScreenSystemLayerHelpers.GetCreditsMessage(pn); - self:settext(str); - end; - UpdateVisibleCommand=function(self) - local screen = SCREENMAN:GetTopScreen(); - local bShow = true; - if screen then - local sClass = screen:GetName(); - bShow = THEME:GetMetric( sClass, "ShowCreditDisplay" ); - end - - self:visible( bShow ); - end - }; - return text; -end; --- -local t = Def.ActorFrame {} - -- Aux -t[#t+1] = LoadActor(THEME:GetPathB("ScreenSystemLayer","aux")); - -- Credits -t[#t+1] = Def.ActorFrame { - CreditsText( PLAYER_1 ); - CreditsText( PLAYER_2 ); -}; - -- Text -t[#t+1] = Def.ActorFrame { - Def.Quad { - InitCommand=function(self) - self:zoomtowidth(SCREEN_WIDTH); - self:zoomtoheight(30); - self:horizalign(left); - self:vertalign(top); - self:y(SCREEN_TOP); - self:diffuse(color("0,0,0,0")); - end; - OnCommand=function(self) - self:finishtweening(); - self:diffusealpha(0.85); - end; - OffCommand=function(self) - self:sleep(3); - self:linear(0.5); - self:diffusealpha(0); - end; - }; - LoadFont("Common","Normal") .. { - Name="Text"; - InitCommand=function(self) - self:maxwidth(750); - self:horizalign(left); - self:vertalign(top); - self:y(SCREEN_TOP + 10); - self:x(SCREEN_LEFT + 10); - self:shadowlength(1); - self:diffusealpha(0); - end; - OnCommand=function(self) - self:finishtweening(); - self:diffusealpha(1); - self:zoom(0.5); - end; - OffCommand=function(self) - self:sleep(3); - self:linear(0.5); - self:diffusealpha(0); - end; - }; - SystemMessageMessageCommand = function(self, params) - self:GetChild("Text"):settext( params.Message ); - self:playcommand( "On" ); - if params.NoAnimate then - self:finishtweening(); - end - self:playcommand( "Off" ); - end; - HideSystemMessageMessageCommand = function(self) - self:finishtweening(); - end; -}; - -return t; +local function CreditsText( pn ) + local text = LoadFont(Var "LoadingScreen","credits") .. { + InitCommand=function(self) + self:name("Credits" .. PlayerNumberToString(pn)) + ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); + end; + UpdateTextCommand=function(self) + local str = ScreenSystemLayerHelpers.GetCreditsMessage(pn); + self:settext(str); + end; + UpdateVisibleCommand=function(self) + local screen = SCREENMAN:GetTopScreen(); + local bShow = true; + if screen then + local sClass = screen:GetName(); + bShow = THEME:GetMetric( sClass, "ShowCreditDisplay" ); + end + + self:visible( bShow ); + end + }; + return text; +end; + +--[[ local function PlayerPane( PlayerNumber ) + local t = Def.ActorFrame { + InitCommand=function(self) + self:name("PlayerPane" .. PlayerNumberToString(PlayerNumber)); + -- ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen"); + end + }; + t[#t+1] = Def.ActorFrame { + Name = "Background"; + Def.Quad { + InitCommand=cmd(zoomto,160,28;queuecommand,"On"); + OnCommand=cmd(diffuse,PlayerColor(PlayerNumber);fadebottom,1); + }; + }; + t[#t+1] = LoadFont("Common","Normal") .. { + Name = "PlayerText"; + InitCommand=cmd(x,-60;maxwidth,80/0.5;zoom,0.5;queuecommand,"On"); + OnCommand=cmd(playcommand,"Set"); + SetCommand=function(self) + local profile = PROFILEMAN:GetProfile( PlayerNumber) or PROFILEMAN:GetMachineProfile() + if profile then + self:settext( profile:GetDisplayName() ); + else + self:settext( "NoProf" ); + end + end; + }; + return t +end --]] +-- +local t = Def.ActorFrame {} + -- Aux +t[#t+1] = LoadActor(THEME:GetPathB("ScreenSystemLayer","aux")); + -- Credits +t[#t+1] = Def.ActorFrame { +--[[ PlayerPane( PLAYER_1 ) .. { + InitCommand=cmd(x,scale(0.125,0,1,SCREEN_LEFT,SCREEN_WIDTH);y,SCREEN_BOTTOM-16) + }; --]] + CreditsText( PLAYER_1 ); + CreditsText( PLAYER_2 ); +}; + -- Text +t[#t+1] = Def.ActorFrame { + Def.Quad { + InitCommand=cmd(zoomtowidth,SCREEN_WIDTH;zoomtoheight,30;horizalign,left;vertalign,top;y,SCREEN_TOP;diffuse,color("0,0,0,0")); + OnCommand=cmd(finishtweening;diffusealpha,0.85;); + OffCommand=cmd(sleep,3;linear,0.5;diffusealpha,0;); + }; + LoadFont("Common","Normal") .. { + Name="Text"; + InitCommand=cmd(maxwidth,750;horizalign,left;vertalign,top;y,SCREEN_TOP+10;x,SCREEN_LEFT+10;shadowlength,1;diffusealpha,0;); + OnCommand=cmd(finishtweening;diffusealpha,1;zoom,0.5); + OffCommand=cmd(sleep,3;linear,0.5;diffusealpha,0;); + }; + SystemMessageMessageCommand = function(self, params) + self:GetChild("Text"):settext( params.Message ); + self:playcommand( "On" ); + if params.NoAnimate then + self:finishtweening(); + end + self:playcommand( "Off" ); + end; + HideSystemMessageMessageCommand = cmd(finishtweening); +}; + +return t; diff --git a/Themes/_fallback/BGAnimations/ScreenTestInput underlay.lua b/Themes/_fallback/BGAnimations/ScreenTestInput underlay.lua index fc32642ac8..862f42fdb1 100644 --- a/Themes/_fallback/BGAnimations/ScreenTestInput underlay.lua +++ b/Themes/_fallback/BGAnimations/ScreenTestInput underlay.lua @@ -1,22 +1,14 @@ return Def.ActorFrame { + --Def.ControllerStateDisplay { + -- InitCommand=cmd(LoadGameController, + --}; Def.DeviceList { Font="Common normal"; - InitCommand=function(self) - self:x(SCREEN_LEFT + 20); - self:y(SCREEN_TOP + 80); - self:zoom(0.8); - self:halign(0); - end; + InitCommand=cmd(x,SCREEN_LEFT+20;y,SCREEN_TOP+80;zoom,0.8;halign,0); }; Def.InputList { Font="Common normal"; - InitCommand=function(self) - self:x(SCREEN_CENTER_X - 250); - self:y(SCREEN_CENTER_Y); - self:zoom(1); - self:halign(0); - self:vertspacing(8); - end; + InitCommand=cmd(x,SCREEN_CENTER_X-250;y,SCREEN_CENTER_Y;zoom,1;halign,0;vertspacing,8); }; }; diff --git a/Themes/_fallback/BGAnimations/_frame 3x1/default.lua b/Themes/_fallback/BGAnimations/_frame 3x1/default.lua index 5a9d67e491..9673efba02 100644 --- a/Themes/_fallback/BGAnimations/_frame 3x1/default.lua +++ b/Themes/_fallback/BGAnimations/_frame 3x1/default.lua @@ -1,32 +1,12 @@ -local File, Width = ... -assert( File ); -assert( Width ); - -local FullFile = THEME:GetPathB('','_frame files 3x1/'..File ) -local Frame = LoadActor( FullFile ) - -return Def.ActorFrame { - Frame .. { - InitCommand=function(self) - self:setstate(0); - self:pause(); - self:horizalign(right); - self:x(-Width / 2); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(1); - self:pause(); - self:zoomtowidth(Width); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(2); - self:pause(); - self:horizalign(left); - self:x(Width / 2); - end; - }; -}; +local File, Width = ... +assert( File ); +assert( Width ); + +local FullFile = THEME:GetPathB('','_frame files 3x1/'..File ) +local Frame = LoadActor( FullFile ) + +return Def.ActorFrame { + Frame .. { InitCommand=cmd(setstate,0;pause;horizalign,right;x,-Width/2) }; + Frame .. { InitCommand=cmd(setstate,1;pause;zoomtowidth,Width) }; + Frame .. { InitCommand=cmd(setstate,2;pause;horizalign,left;x,Width/2) }; +}; diff --git a/Themes/_fallback/BGAnimations/_frame 3x3/default.lua b/Themes/_fallback/BGAnimations/_frame 3x3/default.lua index 91a6a34fce..be645fc354 100644 --- a/Themes/_fallback/BGAnimations/_frame 3x3/default.lua +++ b/Themes/_fallback/BGAnimations/_frame 3x3/default.lua @@ -1,95 +1,18 @@ -local File, Width, Height = ... -assert( File ); -assert( Width ); -assert( Height ); - -local FullFile = THEME:GetPathB('','_frame files 3x3/'..File ) -local Frame = LoadActor( FullFile ) -return Def.ActorFrame { - Frame .. { - InitCommand=function(self) - self:setstate(0); - self:pause(); - self:horizalign(right); - self:vertalign(bottom); - self:x(-Width / 2); - self:y(-Height / 2); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(1); - self:pause(); - self:zoomtowidth(Width); - self:vertalign(bottom); - self:zoomtowidth(Width); - self:y(-Height / 2); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(2); - self:pause(); - self:horizalign(left); - self:vertalign(bottom); - self:x(Width / 2); - self:y(-Height / 2); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(3); - self:pause(); - self:horizalign(right); - self:x(-Width / 2); - self:zoomtoheight(Height); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(4); - self:pause(); - self:zoomtowidth(Width); - self:zoomtoheight(Height); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(5); - self:pause(); - self:horizalign(left); - self:x(Width / 2); - self:zoomtoheight(Height); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(6); - self:pause(); - self:horizalign(right); - self:vertalign(top); - self:x(-Width / 2); - self:y(Height / 2); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(7); - self:pause(); - self:zoomtowidth(Width); - self:vertalign(top); - self:zoomtowidth(Width); - self:y(Height / 2); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(8); - self:pause(); - self:horizalign(left); - self:vertalign(top); - self:x(Width / 2); - self:y(Height / 2); - end; - }; -}; +local File, Width, Height = ... +assert( File ); +assert( Width ); +assert( Height ); + +local FullFile = THEME:GetPathB('','_frame files 3x3/'..File ) +local Frame = LoadActor( FullFile ) +return Def.ActorFrame { + Frame .. { InitCommand=cmd(setstate,0;pause;horizalign,right;vertalign,bottom;x,-Width/2;y,-Height/2) }; + Frame .. { InitCommand=cmd(setstate,1;pause;zoomtowidth,Width;vertalign,bottom;zoomtowidth,Width;y,-Height/2) }; + Frame .. { InitCommand=cmd(setstate,2;pause;horizalign,left;vertalign,bottom;x,Width/2;y,-Height/2) }; + Frame .. { InitCommand=cmd(setstate,3;pause;horizalign,right;x,-Width/2;zoomtoheight,Height) }; + Frame .. { InitCommand=cmd(setstate,4;pause;zoomtowidth,Width;zoomtoheight,Height) }; + Frame .. { InitCommand=cmd(setstate,5;pause;horizalign,left;x,Width/2;zoomtoheight,Height) }; + Frame .. { InitCommand=cmd(setstate,6;pause;horizalign,right;vertalign,top;x,-Width/2;y,Height/2) }; + Frame .. { InitCommand=cmd(setstate,7;pause;zoomtowidth,Width;vertalign,top;zoomtowidth,Width;y,Height/2) }; + Frame .. { InitCommand=cmd(setstate,8;pause;horizalign,left;vertalign,top;x,Width/2;y,Height/2) }; +}; diff --git a/Themes/_fallback/BGAnimations/_wait.lua b/Themes/_fallback/BGAnimations/_wait.lua index 730d6b4403..c39ccb136e 100644 --- a/Themes/_fallback/BGAnimations/_wait.lua +++ b/Themes/_fallback/BGAnimations/_wait.lua @@ -1,6 +1,6 @@ -local waitTime = ... - --- default to 1 second if parameter is missing -if not waitTime then waitTime = 1 end - -return Def.Actor{ OnCommand=function(self) self:sleep(waitTime); end; }; \ No newline at end of file +local waitTime = ... + +-- default to 1 second if parameter is missing +if not waitTime then waitTime = 1 end + +return Def.Actor{ OnCommand=cmd(sleep,waitTime); }; \ No newline at end of file diff --git a/Themes/_fallback/Graphics/CombinedLifeMeterTug separator.lua b/Themes/_fallback/Graphics/CombinedLifeMeterTug separator.lua index 78fd419d43..26c8a67907 100644 --- a/Themes/_fallback/Graphics/CombinedLifeMeterTug separator.lua +++ b/Themes/_fallback/Graphics/CombinedLifeMeterTug separator.lua @@ -1,6 +1,3 @@ return Def.Quad{ - InitCommand=function(self) - self:zoomto(4, 22); - self:diffuse(color("#AABBDD")); - end; + InitCommand=cmd(zoomto,4,22;diffuse,color("#AABBDD")); }; \ No newline at end of file diff --git a/Themes/_fallback/Graphics/EditMenu left.lua b/Themes/_fallback/Graphics/EditMenu left.lua index 5937535445..41ab6ce449 100644 --- a/Themes/_fallback/Graphics/EditMenu left.lua +++ b/Themes/_fallback/Graphics/EditMenu left.lua @@ -1,16 +1,8 @@ return Def.ActorFrame { Def.Quad { - InitCommand=function(self) - self:zoomto(10, 10); - self:y(-5); - self:skewx(-1); - end; + InitCommand=cmd(zoomto,10,10;y,-5;skewx,-1); }; Def.Quad { - InitCommand=function(self) - self:zoomto(10, 10); - self:y(5); - self:skewx(1); - end; + InitCommand=cmd(zoomto,10,10;y,5;skewx,1); }; } \ No newline at end of file diff --git a/Themes/_fallback/Graphics/EditMenu right.lua b/Themes/_fallback/Graphics/EditMenu right.lua index 53a1f1d77e..3f898fc4a4 100644 --- a/Themes/_fallback/Graphics/EditMenu right.lua +++ b/Themes/_fallback/Graphics/EditMenu right.lua @@ -1,16 +1,8 @@ return Def.ActorFrame { Def.Quad { - InitCommand=function(self) - self:zoomto(10, 10); - self:y(-5); - self:skewx(1); - end; + InitCommand=cmd(zoomto,10,10;y,-5;skewx,1); }; Def.Quad { - InitCommand=function(self) - self:zoomto(10, 10); - self:y(5); - self:skewx(-1); - end; + InitCommand=cmd(zoomto,10,10;y,5;skewx,-1); }; } \ No newline at end of file diff --git a/Themes/_fallback/Graphics/Player combo/default.lua b/Themes/_fallback/Graphics/Player combo/default.lua index 6e29189c87..8ac9b38a1d 100644 --- a/Themes/_fallback/Graphics/Player combo/default.lua +++ b/Themes/_fallback/Graphics/Player combo/default.lua @@ -12,9 +12,7 @@ local LabelMinZoom = THEME:GetMetric("Combo", "LabelMinZoom"); local LabelMaxZoom = THEME:GetMetric("Combo", "LabelMaxZoom"); local t = Def.ActorFrame { - InitCommand=function(self) - self:vertalign(bottom); - end; + InitCommand=cmd(vertalign,bottom); LoadFont( "Combo", "numbers" ) .. { Name="Number"; OnCommand = THEME:GetMetric("Combo", "NumberOnCommand"); @@ -41,14 +39,11 @@ local t = Def.ActorFrame { return end; --]] TwentyFiveMilestoneCommand=function(self,parent) - self:skewy(-0.125); - self:decelerate(0.325); - self:skewy(0); + (cmd(skewy,-0.125;decelerate,0.325;skewy,0))(self); end; ToastyAchievedMessageCommand=function(self,params) if params.PlayerNumber == player then - self:thump(2); - self:effectclock('beat'); + (cmd(thump,2;effectclock,'beat'))(self); end; end; ComboCommand=function(self, param) @@ -93,19 +88,26 @@ local t = Def.ActorFrame { c.Number:diffuse(Color("White")); -- c.Number:diffuse(PlayerColor(player)); c.Number:stopeffect(); - c.Label.diffuse(Color("White")); - c.Label.diffusebottomedge(color("0.5,0.5,0.5,1")); + (cmd(diffuse,Color("White");diffusebottomedge,color("0.5,0.5,0.5,1")))(c.Label); else c.Number:diffuse(color("#ff0000")); c.Number:stopeffect(); - c.Label.diffuse(Color("Red")); - c.Label.diffusebottomedge(color("0.5,0,0,1")); + (cmd(diffuse,Color("Red");diffusebottomedge,color("0.5,0,0,1")))(c.Label); end -- Pulse Pulse( c.Number, param ); PulseLabel( c.Label, param ); -- Milestone Logic end; +--[[ ScoreChangedMessageCommand=function(self,param) + local iToastyCombo = param.ToastyCombo; + if iToastyCombo and (iToastyCombo > 0) then +-- (cmd(thump;effectmagnitude,1,1.2,1;effectclock,'beat'))(c.Number) +-- (cmd(thump;effectmagnitude,1,1.2,1;effectclock,'beat'))(c.Number) + else +-- c.Number:stopeffect(); + end; + end; --]] }; return t; diff --git a/Themes/_fallback/Graphics/Player judgment/default.lua b/Themes/_fallback/Graphics/Player judgment/default.lua index ff2fe96b1c..8a4ad4dfe0 100644 --- a/Themes/_fallback/Graphics/Player judgment/default.lua +++ b/Themes/_fallback/Graphics/Player judgment/default.lua @@ -31,29 +31,16 @@ local t = Def.ActorFrame {}; t[#t+1] = Def.ActorFrame { LoadActor(THEME:GetPathG("Judgment","Normal")) .. { Name="Judgment"; - InitCommand=function(self) - self:pause(); - self:visible(false); - end; + InitCommand=cmd(pause;visible,false); OnCommand=THEME:GetMetric("Judgment","JudgmentOnCommand"); - ResetCommand=function(self) - self:finishtweening(); - self:stopeffect(); - self:visible(false); - end; + ResetCommand=cmd(finishtweening;stopeffect;visible,false); }; LoadFont("Common Normal") .. { Name="ProtimingDisplay"; Text=""; - InitCommand=function(self) - self:visible(false); - end; + InitCommand=cmd(visible,false); OnCommand=THEME:GetMetric("Protiming","ProtimingOnCommand"); - ResetCommand=function(self) - self:finishtweening(); - self:stopeffect(); - self:visible(false); - end; + ResetCommand=cmd(finishtweening;stopeffect;visible,false); }; InitCommand = function(self) diff --git a/Themes/_fallback/Graphics/ScreenMapControllers exit.lua b/Themes/_fallback/Graphics/ScreenMapControllers exit.lua index e1e1cffaf0..e922b168d6 100644 --- a/Themes/_fallback/Graphics/ScreenMapControllers exit.lua +++ b/Themes/_fallback/Graphics/ScreenMapControllers exit.lua @@ -1,32 +1,10 @@ -return LoadFont("Common Normal") .. { - Text="Exit"; - InitCommand=function(self) - self:x(SCREEN_CENTER_X); - self:zoom(0.75); - self:shadowlength(0); - self:diffuse(color("#808080")); - end; - OnCommand=function(self) - self:diffusealpha(0); - self:decelerate(0.5); - self:diffusealpha(1); - end; - OffCommand=function(self) - self:stoptweening(); - self:accelerate(0.3); - self:diffusealpha(0); - self:queuecommand("Hide"); - end; - HideCommand=function(self) - self:visible(false); - end; - - GainFocusCommand=function(self) - self:diffuseshift(); - self:effectcolor2(color("#808080")); - self:effectcolor1(color("#FFFFFF")); - end; - LoseFocusCommand=function(self) - self:stopeffect(); - end; -}; +return LoadFont("Common Normal") .. { + Text="Exit"; + InitCommand=cmd(x,SCREEN_CENTER_X;zoom,0.75;shadowlength,0;diffuse,color("#808080")); + OnCommand=cmd(diffusealpha,0;decelerate,0.5;diffusealpha,1); + OffCommand=cmd(stoptweening;accelerate,0.3;diffusealpha,0;queuecommand,"Hide"); + HideCommand=cmd(visible,false); + + GainFocusCommand=cmd(diffuseshift;effectcolor2,color("#808080");effectcolor1,color("#FFFFFF")); + LoseFocusCommand=cmd(stopeffect); +}; diff --git a/Themes/_fallback/Graphics/ScreenPrompt cursor.lua b/Themes/_fallback/Graphics/ScreenPrompt cursor.lua index 2b6b8ea3f0..6dc2d32472 100644 --- a/Themes/_fallback/Graphics/ScreenPrompt cursor.lua +++ b/Themes/_fallback/Graphics/ScreenPrompt cursor.lua @@ -1,6 +1,3 @@ return Def.Quad{ - InitCommand=function(self) - self:setsize(96, 28); - self:diffuse(color("#44CCFFCC")); - end; + InitCommand=cmd(setsize,96,28;diffuse,color("#44CCFFCC");); }; \ No newline at end of file diff --git a/Themes/_fallback/Graphics/ScreenSelectMaster scroll.lua b/Themes/_fallback/Graphics/ScreenSelectMaster scroll.lua index c239f75a36..bf5b1c4711 100644 --- a/Themes/_fallback/Graphics/ScreenSelectMaster scroll.lua +++ b/Themes/_fallback/Graphics/ScreenSelectMaster scroll.lua @@ -6,10 +6,6 @@ t[#t+1] = LoadFont("Common Normal") .. { Text=gc:GetName(); }; -t.GainFocusCommand=function(self) - self:visible(true); -end; -t.LoseFocusCommand=function(self) - self:visible(false); -end; +t.GainFocusCommand=cmd(visible,true); +t.LoseFocusCommand=cmd(visible,false); return t; \ No newline at end of file diff --git a/Themes/_fallback/Graphics/ScrollBar TickThumb.lua b/Themes/_fallback/Graphics/ScrollBar TickThumb.lua index ccd05d353f..0c8ff6249f 100644 --- a/Themes/_fallback/Graphics/ScrollBar TickThumb.lua +++ b/Themes/_fallback/Graphics/ScrollBar TickThumb.lua @@ -2,9 +2,7 @@ local t = Def.ActorFrame {}; t[#t+1] = Def.ActorFrame { Def.Quad { - InitCommand=function(self) - self:zoomto(32, 32); - end; + InitCommand=cmd(zoomto,32,32); }; }; diff --git a/Themes/_fallback/Graphics/_frame 3x1/default.lua b/Themes/_fallback/Graphics/_frame 3x1/default.lua index eac45f8448..93b10e73ed 100644 --- a/Themes/_fallback/Graphics/_frame 3x1/default.lua +++ b/Themes/_fallback/Graphics/_frame 3x1/default.lua @@ -6,27 +6,7 @@ local FullFile = THEME:GetPathG('','_frame files 3x1/'..File ) local Frame = LoadActor( FullFile ) return Def.ActorFrame { - Frame .. { - InitCommand=function(self) - self:setstate(0); - self:pause(); - self:horizalign(right); - self:x(-Width / 2); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(1); - self:pause(); - self:zoomtowidth(Width); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(2); - self:pause(); - self:horizalign(left); - self:x(Width / 2); - end; - }; + Frame .. { InitCommand=cmd(setstate,0;pause;horizalign,right;x,-Width/2) }; + Frame .. { InitCommand=cmd(setstate,1;pause;zoomtowidth,Width) }; + Frame .. { InitCommand=cmd(setstate,2;pause;horizalign,left;x,Width/2) }; }; diff --git a/Themes/_fallback/Graphics/_frame 3x3/default.lua b/Themes/_fallback/Graphics/_frame 3x3/default.lua index 1bb80f7e56..fb62e93a94 100644 --- a/Themes/_fallback/Graphics/_frame 3x3/default.lua +++ b/Themes/_fallback/Graphics/_frame 3x3/default.lua @@ -6,90 +6,13 @@ assert( Height ); local FullFile = THEME:GetPathG('','_frame files 3x3/'..File ) local Frame = LoadActor( FullFile ) return Def.ActorFrame { - Frame .. { - InitCommand=function(self) - self:setstate(0); - self:pause(); - self:horizalign(right); - self:vertalign(bottom); - self:x(-Width / 2); - self:y(-Height / 2); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(1); - self:pause(); - self:zoomtowidth(Width); - self:vertalign(bottom); - self:zoomtowidth(Width); - self:y(-Height / 2); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(2); - self:pause(); - self:horizalign(left); - self:vertalign(bottom); - self:x(Width / 2); - self:y(-Height / 2); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(3); - self:pause(); - self:horizalign(right); - self:x(-Width / 2); - self:zoomtoheight(Height); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(4); - self:pause(); - self:zoomtowidth(Width); - self:zoomtoheight(Height); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(5); - self:pause(); - self:horizalign(left); - self:x(Width / 2); - self:zoomtoheight(Height); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(6); - self:pause(); - self:horizalign(right); - self:vertalign(top); - self:x(-Width / 2); - self:y(Height / 2); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(7); - self:pause(); - self:zoomtowidth(Width); - self:vertalign(top); - self:zoomtowidth(Width); - self:y(Height / 2); - end; - }; - Frame .. { - InitCommand=function(self) - self:setstate(8); - self:pause(); - self:horizalign(left); - self:vertalign(top); - self:x(Width / 2); - self:y(Height / 2); - end; - }; + Frame .. { InitCommand=cmd(setstate,0;pause;horizalign,right;vertalign,bottom;x,-Width/2;y,-Height/2) }; + Frame .. { InitCommand=cmd(setstate,1;pause;zoomtowidth,Width;vertalign,bottom;zoomtowidth,Width;y,-Height/2) }; + Frame .. { InitCommand=cmd(setstate,2;pause;horizalign,left;vertalign,bottom;x,Width/2;y,-Height/2) }; + Frame .. { InitCommand=cmd(setstate,3;pause;horizalign,right;x,-Width/2;zoomtoheight,Height) }; + Frame .. { InitCommand=cmd(setstate,4;pause;zoomtowidth,Width;zoomtoheight,Height) }; + Frame .. { InitCommand=cmd(setstate,5;pause;horizalign,left;x,Width/2;zoomtoheight,Height) }; + Frame .. { InitCommand=cmd(setstate,6;pause;horizalign,right;vertalign,top;x,-Width/2;y,Height/2) }; + Frame .. { InitCommand=cmd(setstate,7;pause;zoomtowidth,Width;vertalign,top;zoomtowidth,Width;y,Height/2) }; + Frame .. { InitCommand=cmd(setstate,8;pause;horizalign,left;vertalign,top;x,Width/2;y,Height/2) }; }; diff --git a/Themes/_fallback/Scripts/00 init.lua b/Themes/_fallback/Scripts/00 init.lua index 38d6a061b3..1f4d2950bc 100644 --- a/Themes/_fallback/Scripts/00 init.lua +++ b/Themes/_fallback/Scripts/00 init.lua @@ -1,58 +1,58 @@ --- This file is always executed first. - --- Override Lua's upper and lower functions with our own, which is always UTF-8. -if Uppercase then - string.upper = Uppercase - string.lower = Lowercase - Uppercase = nil -- don't use directly - Lowercase = nil -- don't use directly -end - -Trace = lua.Trace -Warn = lua.Warn -print = Trace - --- Use MersenneTwister in place of math.random and math.randomseed. -if MersenneTwister then - math.random = MersenneTwister.Random - math.randomseed = MersenneTwister.Seed -end - -PLAYER_1 = "PlayerNumber_P1" -PLAYER_2 = "PlayerNumber_P2" -NUM_PLAYERS = #PlayerNumber -OtherPlayer = { [PLAYER_1] = PLAYER_2, [PLAYER_2] = PLAYER_1 } - -function string:find_last(text) - local LastPos = 0 - while true do - local p = string.find(self, text, LastPos+1, true) - if not p then - return LastPos - end - LastPos = p - end -end - --- (c) 2006 Glenn Maynard --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. +-- This file is always executed first. + +-- Override Lua's upper and lower functions with our own, which is always UTF-8. +if Uppercase then + string.upper = Uppercase + string.lower = Lowercase + Uppercase = nil -- don't use directly + Lowercase = nil -- don't use directly +end + +Trace = lua.Trace +Warn = lua.Warn +print = Trace + +-- Use MersenneTwister in place of math.random and math.randomseed. +if MersenneTwister then + math.random = MersenneTwister.Random + math.randomseed = MersenneTwister.Seed +end + +PLAYER_1 = "PlayerNumber_P1" +PLAYER_2 = "PlayerNumber_P2" +NUM_PLAYERS = #PlayerNumber +OtherPlayer = { [PLAYER_1] = PLAYER_2, [PLAYER_2] = PLAYER_1 } + +function string:find_last(text) + local LastPos = 0 + while true do + local p = string.find(self, text, LastPos+1, true) + if not p then + return LastPos + end + LastPos = p + end +end + +-- (c) 2006 Glenn Maynard +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. diff --git a/Themes/_fallback/Scripts/02 Sprite.lua b/Themes/_fallback/Scripts/02 Sprite.lua index 82168a9b8f..905f05dbad 100644 --- a/Themes/_fallback/Scripts/02 Sprite.lua +++ b/Themes/_fallback/Scripts/02 Sprite.lua @@ -1,98 +1,92 @@ -function Sprite:LoadFromSongBanner(song) - if song then - local Path = song:GetBannerPath() - if not Path then - Path = THEME:GetPathG("Common","fallback banner") - end - - self:LoadBanner( Path ) - else - self:LoadBanner( THEME:GetPathG("Common","fallback banner") ) - end -end - -function Sprite:LoadFromSongBackground(song) - local Path = song:GetBackgroundPath() - if not Path then - Path = THEME:GetPathG("Common","fallback background") - end - - self:LoadBackground( Path ) -end - -function LoadSongBackground() - return Def.Sprite { - InitCommand=function(self) - self:x(SCREEN_CENTER_X); - self:y(SCREEN_CENTER_Y); - end; - BeginCommand=function(self) - self:LoadFromSongBackground(GAMESTATE:GetCurrentSong()); - self:scale_or_crop_background(); - end; - } -end - -function Sprite:LoadFromCurrentSongBackground() - local song = GAMESTATE:GetCurrentSong() - if not song then - local trail = GAMESTATE:GetCurrentTrail(GAMESTATE:GetMasterPlayerNumber()) - local e = trail:GetTrailEntries() - if #e > 0 then - song = e[1]:GetSong() - end - end - - if not song then return end - - self:LoadFromSongBackground(song) -end - -function Sprite:position( f ) - self:GetTexture():position( f ) -end - -function Sprite:loop( f ) - self:GetTexture():loop( f ) -end - -function Sprite:rate( f ) - self:GetTexture():rate( f ) -end - -function Sprite.LinearFrames(NumFrames, Seconds) - local Frames = {} - for i = 0,NumFrames-1 do - Frames[#Frames+1] = { - Frame = i, - Delay = (1/NumFrames)*Seconds - } - end - return Frames -end - --- command aliases: -function Sprite:cropto(w,h) self:CropTo(w,h) end - --- (c) 2005 Glenn Maynard --- All rights reserved. --- --- Permission is hereby granted, free of charge, to any person obtaining a --- copy of this software and associated documentation files (the --- "Software"), to deal in the Software without restriction, including --- without limitation the rights to use, copy, modify, merge, publish, --- distribute, and/or sell copies of the Software, and to permit persons to --- whom the Software is furnished to do so, provided that the above --- copyright notice(s) and this permission notice appear in all copies of --- the Software and that both the above copyright notice(s) and this --- permission notice appear in supporting documentation. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF --- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS --- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT --- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS --- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR --- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR --- PERFORMANCE OF THIS SOFTWARE. +function Sprite:LoadFromSongBanner(song) + if song then + local Path = song:GetBannerPath() + if not Path then + Path = THEME:GetPathG("Common","fallback banner") + end + + self:LoadBanner( Path ) + else + self:LoadBanner( THEME:GetPathG("Common","fallback banner") ) + end +end + +function Sprite:LoadFromSongBackground(song) + local Path = song:GetBackgroundPath() + if not Path then + Path = THEME:GetPathG("Common","fallback background") + end + + self:LoadBackground( Path ) +end + +function LoadSongBackground() + return Def.Sprite { + InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y), + BeginCommand=cmd(LoadFromSongBackground,GAMESTATE:GetCurrentSong();scale_or_crop_background) + } +end + +function Sprite:LoadFromCurrentSongBackground() + local song = GAMESTATE:GetCurrentSong() + if not song then + local trail = GAMESTATE:GetCurrentTrail(GAMESTATE:GetMasterPlayerNumber()) + local e = trail:GetTrailEntries() + if #e > 0 then + song = e[1]:GetSong() + end + end + + if not song then return end + + self:LoadFromSongBackground(song) +end + +function Sprite:position( f ) + self:GetTexture():position( f ) +end + +function Sprite:loop( f ) + self:GetTexture():loop( f ) +end + +function Sprite:rate( f ) + self:GetTexture():rate( f ) +end + +function Sprite.LinearFrames(NumFrames, Seconds) + local Frames = {} + for i = 0,NumFrames-1 do + Frames[#Frames+1] = { + Frame = i, + Delay = (1/NumFrames)*Seconds + } + end + return Frames +end + +-- command aliases: +function Sprite:cropto(w,h) self:CropTo(w,h) end + +-- (c) 2005 Glenn Maynard +-- All rights reserved. +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, and/or sell copies of the Software, and to permit persons to +-- whom the Software is furnished to do so, provided that the above +-- copyright notice(s) and this permission notice appear in all copies of +-- the Software and that both the above copyright notice(s) and this +-- permission notice appear in supporting documentation. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS +-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT +-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +-- PERFORMANCE OF THIS SOFTWARE. diff --git a/Themes/_fallback/Scripts/03 ThemeLibrary.lua b/Themes/_fallback/Scripts/03 ThemeLibrary.lua index 8b3b1cde88..242ae03a56 100644 --- a/Themes/_fallback/Scripts/03 ThemeLibrary.lua +++ b/Themes/_fallback/Scripts/03 ThemeLibrary.lua @@ -23,17 +23,8 @@ Library = { local t = Def.ActorFrame { Name="Radar"; Def.GrooveRadar { - OnCommand=function(self) - self:zoom(0); - self:sleep(0.583); - self:decelerate(0.150); - self:zoom(1); - end; - OffCommand=function(self) - self:sleep(0.183); - self:decelerate(0.167); - self:zoom(0); - end; + OnCommand=cmd(zoom,0;sleep,0.583;decelerate,0.150;zoom,1); + OffCommand=cmd(sleep,0.183;decelerate,0.167;zoom,0); CurrentSongChangedMessageCommand=function(self) for pn in ivalues(GAMESTATE:GetHumanPlayers()) do radarSet(self, pn);