From 0791d8d032aa2f0048d6ee44c674e06c47ce657a Mon Sep 17 00:00:00 2001 From: Nicolas Date: Fri, 29 Dec 2017 21:03:05 -0300 Subject: [PATCH] Run cmd lua python script replacer on root folder --- .../Example_Actors/ActorFrameTexture.lua | 124 +++++++++++++----- .../Examples/Example_Actors/ActorScroller.lua | 20 ++- .../Example_Screens/ScreenHeartEntry.lua | 12 +- .../Example_Screens/ScreenMapControllers.lua | 76 ++++++++--- Docs/steps.lua | 8 +- .../common/common/Fallback Explosion.lua | 32 +++-- Themes/_fallback/Scripts/03 Gameplay.lua | 1 - 7 files changed, 204 insertions(+), 69 deletions(-) diff --git a/Docs/Themerdocs/Examples/Example_Actors/ActorFrameTexture.lua b/Docs/Themerdocs/Examples/Example_Actors/ActorFrameTexture.lua index 2c56cfa247..4bd4e0f1d7 100644 --- a/Docs/Themerdocs/Examples/Example_Actors/ActorFrameTexture.lua +++ b/Docs/Themerdocs/Examples/Example_Actors/ActorFrameTexture.lua @@ -94,7 +94,9 @@ local Example3_Diffuse = { 1,0.5,1,1 } -- Note that with Green of 50%, there is local Examples = { } Examples[1] = Def.ActorFrame{ - Def.Quad{ InitCommand=cmd(FullScreen) }; -- a blank background. + Def.Quad{ InitCommand=function(self) + self:FullScreen() -- a blank background. + end; Def.ActorFrameTexture{ InitCommand=function(self) self:SetTextureName( "Example 1" ) @@ -110,20 +112,32 @@ Examples[1] = Def.ActorFrame{ Def.ActorFrame{ Name = "Draw"; -- three random quads, two of them strattling the edge of the texture. - Def.Quad{ InitCommand=cmd(zoom,50;diffuse,1,0,0,0.5) }; - Def.Quad{ InitCommand=cmd(zoom,50;diffuse,0,1,0,0.5;x,64;y,64) }; - Def.Quad{ InitCommand=cmd(zoom,50;diffuse,0,0,1,0.5;x,120;y,100) }; + Def.Quad{ InitCommand=function(self) + self:zoom(50):diffuse(1,0,0,0.5) + end; + Def.Quad{ InitCommand=function(self) + self:zoom(50):diffuse(0,1,0,0.5):x(64):y(64) + end; + Def.Quad{ InitCommand=function(self) + self:zoom(50):diffuse(0,0,1,0.5):x(120):y(100) + end; }; }; Def.Sprite{ Texture="Example 1"; - InitCommand=cmd(Center;sleep,1;queuecommand,"Scroll"); - ScrollCommand=cmd(texcoordvelocity,1,0.5); -- Scroll the texture. Texture manipulation is one of the things that makes AFT special. + InitCommand=function(self) + self:Center():sleep(1):queuecommand("Scroll") + end; + ScrollCommand=function(self) + self:texcoordvelocity(1,0.5) - Scroll the texture. Texture manipulation is one of the things that makes AFT special. + end; }; } Examples[2] = Def.ActorFrame{ - Def.Quad{ InitCommand=cmd(FullScreen;diffuse,0,0,0,1) }; -- a blank background. + Def.Quad{ InitCommand=function(self) + self:FullScreen():diffuse(0,0,0,1) -- a blank background. + end; Def.ActorFrameTexture{ InitCommand=function(self) self:SetTextureName( "Example 2" ) @@ -138,17 +152,29 @@ Examples[2] = Def.ActorFrame{ end; Def.ActorFrame{ Name = "Draw"; - InitCommand=cmd(spin;x,64;y,64); -- Something has to change to demonstrate PreserveTexture. - Def.Quad{ InitCommand=cmd(zoom,50;rainbow;effectperiod,3;effectoffset,1;x,-40;y,-56) }; - Def.Quad{ InitCommand=cmd(zoom,50;rainbow;effectperiod,3;effectoffset,0) }; - Def.Quad{ InitCommand=cmd(zoom,50;rainbow;effectperiod,3;effectoffset,2;x,64;y,50) }; + InitCommand=function(self) + self:spin():x(64):y(64) -Something has to change to demonstrate PreserveTexture. + end; + Def.Quad{ InitCommand=function(self) + self:zoom(50):rainbow():effectperiod(3):effectoffset(1):x(-40):y(-56) + end; + Def.Quad{ InitCommand=function(self) + self:zoom(50):rainbow():effectperiod(3):effectoffset(0) + end; + Def.Quad{ InitCommand=function(self) + self:zoom(50):rainbow():effectperiod(3):effectoffset(2):x(64):y(50) + end; }; }; - Def.Sprite{ Texture="Example 2"; InitCommand=cmd(Center); }; + Def.Sprite{ Texture="Example 2"; InitCommand=function(self) + self:Center() + end; } Examples[3] = Def.ActorFrame{ - Def.Quad{ InitCommand=cmd(FullScreen;diffuse,0,0,0,1) }; -- a blank background. + Def.Quad{ InitCommand=function(self) + self:FullScreen():diffuse(0,0,0,1) -- a blank background. + end; Def.ActorFrameTexture{ InitCommand=function(self) self:SetTextureName( "Example 3" ) @@ -163,13 +189,23 @@ Examples[3] = Def.ActorFrame{ end; Def.ActorFrame{ Name = "Draw"; - Def.Quad{ InitCommand=cmd(zoom,80;diffuse,1,1,1,1;x,64;y,64) }; - Def.Quad{ InitCommand=cmd(zoom,80;diffuse,1,0,0,1;x,14;y,80;blend,"BlendMode_Add") }; - Def.Quad{ InitCommand=cmd(zoom,80;diffuse,0,1,0,1;x,74;y,20;blend,"BlendMode_Add") }; - Def.Quad{ InitCommand=cmd(zoom,80;diffuse,0,0,1,1;x,128;y,100;blend,"BlendMode_Add") }; + Def.Quad{ InitCommand=function(self) + self:zoom(80):diffuse(1,1,1,1):x(64):y(64) + end; + Def.Quad{ InitCommand=function(self) + self:zoom(80):diffuse(1,0,0,1):x(14):y(80):blend("BlendMode_Add") + end; + Def.Quad{ InitCommand=function(self) + self:zoom(80):diffuse(0,1,0,1):x(74):y(20):blend("BlendMode_Add") + end; + Def.Quad{ InitCommand=function(self) + self:zoom(80):diffuse(0,0,1,1):x(128):y(100):blend("BlendMode_Add") + end; }; }; - Def.Sprite{ Texture = "Example 3"; InitCommand=cmd(Center;diffuse,Example3_Diffuse); }; + Def.Sprite{ Texture = "Example 3"; InitCommand=function(self) + self:Center():diffuse(Example3_Diffuse) + end; } --[[ @@ -187,7 +223,9 @@ Examples[3] = Def.ActorFrame{ --]] Examples[4] = Def.ActorFrame{ - Def.Quad{ InitCommand=cmd(FullScreen;diffuse,0,0,0,1) }; -- a blank background. + Def.Quad{ InitCommand=function(self) + self:FullScreen():diffuse(0,0,0,1) -- a blank background. + end; Def.ActorFrameTexture{ Name = "Memory"; InitCommand=function(self) @@ -198,7 +236,9 @@ Examples[4] = Def.ActorFrame{ self:Create(); end; -- Cannot call the second AFT's texture by name as it has not been created when this Sprite loads. - Def.Sprite{ Name = "Sprite"; InitCommand=cmd(x,128;y,128) }; + Def.Sprite{ Name = "Sprite"; InitCommand=function(self) + self:x(128):y(128) + end; }; Def.ActorFrameTexture{ InitCommand=function(self) @@ -211,23 +251,45 @@ Examples[4] = Def.ActorFrame{ self:GetParent():GetChild("Memory"):GetChild("Sprite"):SetTexture( self:GetTexture() ); end; -- A sprite to draw the 'trail' with. - Def.Sprite{ Texture = "Memory"; InitCommand=cmd(x,128;y,128;diffuse,1,1,1,.995); }; + Def.Sprite{ Texture = "Memory"; InitCommand=function(self) + self:x(128):y(128):diffuse(1,1,1,.995) + end; Def.ActorFrame{ -- eliptical motion. - InitCommand=cmd(x,128;y,128;bob;effectmagnitude,96,0,0;effectoffset,0.5); + InitCommand=function(self) + self:x(128):y(128):bob():effectmagnitude(96,0,0):effectoffset(0.5) + end; Def.ActorFrame{ - InitCommand=cmd(bob;effectmagnitude,0,64,0); + InitCommand=function(self) + self:bob():effectmagnitude(0,64,0) + end; -- A pixel ghost. - Def.Quad{ InitCommand=cmd(zoomto,32,40); }; - Def.Quad{ InitCommand=cmd(zoomto,8,8;x,-8;y,-8;diffuse,0,0,0,1); }; - Def.Quad{ InitCommand=cmd(zoomto,8,8;x,8;y,-8;diffuse,0,0,0,1); }; - Def.Quad{ InitCommand=cmd(zoomto,24,8;x,0;y,2;diffuse,0,0,0,1); }; - Def.Quad{ InitCommand=cmd(zoomto,8,16;x,-12;y,24); }; - Def.Quad{ InitCommand=cmd(zoomto,8,16;x,12;y,24); }; - Def.Quad{ InitCommand=cmd(zoomto,8,16;x,0;y,24); }; + Def.Quad{ InitCommand=function(self) + self:zoomto(32,40) + end; + Def.Quad{ InitCommand=function(self) + self:zoomto(8,8):x(-8):y(-8):diffuse(0,0,0,1) + end; + Def.Quad{ InitCommand=function(self) + self:zoomto(8,8):x(8):y(-8):diffuse(0,0,0,1) + end; + Def.Quad{ InitCommand=function(self) + self:zoomto(24,8):x(0):y(2):diffuse(0,0,0,1) + end; + Def.Quad{ InitCommand=function(self) + self:zoomto(8,16):x(-12):y(24) + end; + Def.Quad{ InitCommand=function(self) + self:zoomto(8,16):x(12):y(24) + end; + Def.Quad{ InitCommand=function(self) + self:zoomto(8,16):x(0):y(24) + end; }; }; }; - Def.Sprite{ Name = "Ghosting"; Texture = "Output"; InitCommand=cmd(Center); }; + Def.Sprite{ Name = "Ghosting"; Texture = "Output"; InitCommand=function(self) + self:Center() + end; } return Examples[ ExampleToShow ] \ No newline at end of file diff --git a/Docs/Themerdocs/Examples/Example_Actors/ActorScroller.lua b/Docs/Themerdocs/Examples/Example_Actors/ActorScroller.lua index 433e7c9e3d..a45753c4c2 100644 --- a/Docs/Themerdocs/Examples/Example_Actors/ActorScroller.lua +++ b/Docs/Themerdocs/Examples/Example_Actors/ActorScroller.lua @@ -38,7 +38,9 @@ Def.ActorScroller{ Name="ScrollItem1", Font="Common Normal", Text="Scroll Item 1", - InitCommand=cmd(diffuse,color("#FF0000")), + InitCommand=function(self) + self:diffuse(color("#FF0000")) + end, }, }, Def.ActorFrame{ @@ -46,17 +48,25 @@ Def.ActorScroller{ Name="ScrollItem2", Font="Common Normal", Text="Scroll Item 2", - InitCommand=cmd(glow,color("#00FF0088")), + InitCommand=function(self) + self:glow(color("#00FF0088")) + end, }, }, Def.BitmapText{ Name="ScrollItem3", Font="Common Normal", Text="Scroll Item 3", - InitCommand=cmd(bob;effectmagnitude,8,0,4), + InitCommand=function(self) + self:bob():effectmagnitude(8,0,4) + end, }, -- Scroller commands - InitCommand=cmd(Center), - OnCommand=cmd(scrollwithpadding,8,8), + InitCommand=function(self) + self:Center() + end, + OnCommand=function(self) + self:scrollwithpadding(8,8) + end, } diff --git a/Docs/Themerdocs/Examples/Example_Screens/ScreenHeartEntry.lua b/Docs/Themerdocs/Examples/Example_Screens/ScreenHeartEntry.lua index b6b4e87bf3..2382f2c709 100644 --- a/Docs/Themerdocs/Examples/Example_Screens/ScreenHeartEntry.lua +++ b/Docs/Themerdocs/Examples/Example_Screens/ScreenHeartEntry.lua @@ -31,7 +31,9 @@ for i, pn in ipairs(GAMESTATE:GetEnabledPlayers()) do -- numpad in detail. heart_entries[pn]= new_numpad_entry{ Name= pn .. "_heart_entry", - InitCommand= cmd(xy, heart_xs[pn], SCREEN_CENTER_Y+48), + InitCommand= function(self) + self:xy(heart_xs[pn], SCREEN_CENTER_Y+48) + end, -- Settings for value are optional, but you will probably want to -- change them, so they are provided in this example. -- If a simple colored BitmapText isn't what you want for displaying @@ -168,8 +170,12 @@ local args= { -- The BitmapText used to display the elapsed time. Def.BitmapText{ Name= "timer_text", Font= "Common Normal", Text= "00.0", - InitCommand= cmd(xy, SCREEN_CENTER_X, SCREEN_CENTER_Y-80; diffuse, Color.White), - OnCommand= cmd(strokecolor,Color.Outline), + InitCommand= function(self) + self:xy(SCREEN_CENTER_X, SCREEN_CENTER_Y-80):diffuse(Color.White) + end, + OnCommand= function(self) + self:strokecolor(Color.Outline) + end, } }, } diff --git a/Docs/Themerdocs/Examples/Example_Screens/ScreenMapControllers.lua b/Docs/Themerdocs/Examples/Example_Screens/ScreenMapControllers.lua index 00cb0a0c5d..4c16404d76 100644 --- a/Docs/Themerdocs/Examples/Example_Screens/ScreenMapControllers.lua +++ b/Docs/Themerdocs/Examples/Example_Screens/ScreenMapControllers.lua @@ -40,23 +40,37 @@ -- Here is a simple actor that dims the screen and displays the text. ---------------------------------------------------------------- return Def.ActorFrame{ - InitCommand=cmd(xy, SCREEN_CENTER_X, SCREEN_CENTER_Y), + InitCommand=function(self) + self:xy(SCREEN_CENTER_X, SCREEN_CENTER_Y) + end, Def.Quad{ - TweenOnCommand=cmd(zoomto, SCREEN_WIDTH, SCREEN_HEIGHT; diffuse, Color.Black), - TweenOffCommand=cmd(linear, 0.5; diffusealpha, 0), + TweenOnCommand=function(self) + self:zoomto(SCREEN_WIDTH, SCREEN_HEIGHT):diffuse(Color.Black) + end, + TweenOffCommand=function(self) + self:linear(0.5):diffusealpha(0) + end, }, Def.BitmapText{ Font="Common Normal", Text=ScreenString("WarningHeader"), - TweenOnCommand=cmd(y,-80;diffuse,Color.Red), - TweenOffCommand=cmd(linear,0.5;diffusealpha,0), + TweenOnCommand=function(self) + self:y(-80):diffuse(Color.Red) + end, + TweenOffCommand=function(self) + self:linear(0.5):diffusealpha(0) + end, }, Def.BitmapText{ Font="Common Normal", Text=ScreenString("WarningText"), - TweenOnCommand=cmd(y,10;wrapwidthpixels,SCREEN_WIDTH-48), - TweenOffCommand=cmd(linear,0.5;diffusealpha,0), + TweenOnCommand=function(self) + self:y(10):wrapwidthpixels(SCREEN_WIDTH-48) + end, + TweenOffCommand=function(self) + self:linear(0.5):diffusealpha(0) + end, }, } @@ -70,7 +84,9 @@ return Def.ActorFrame{ ---------------------------------------------------------------- return Def.BitmapText{ Font="Common Normal", - InitCommand= cmd(x, SCREEN_CENTER_X; zoom, .75; diffuse, color("#808080")), + InitCommand= function(self) + self:x(SCREEN_CENTER_X):zoom(.75):diffuse(color("#808080")) + end, OnCommand= function(self) self:diffusealpha(0) self:decelerate(0.5) @@ -84,10 +100,18 @@ return Def.BitmapText{ self:settext( THEME:GetString("ScreenMapControllers", "Action" .. self:GetName())) end, - 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), + OffCommand=function(self) + self:stoptweening():accelerate(0.3):diffusealpha(0):queuecommand("Hide") + end, + HideCommand=function(self) + self:visible(false) + end, + GainFocusCommand=function(self) + self:diffuseshift():effectcolor2(color("#808080")):effectcolor1(color("#FFFFFF")) + end, + LoseFocusCommand=function(self) + self:stopeffect() + end, } ---------------------------------------------------------------- @@ -116,19 +140,33 @@ return Def.BitmapText{ -- the player from overflowing the tween stack by mashing. ---------------------------------------------------------------- return Def.ActorFrame{ - InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y), + InitCommand=function(self) + self:x(SCREEN_CENTER_X):y(SCREEN_CENTER_Y) + end, Def.Quad{ - InitCommand=cmd(zoomto,SCREEN_WIDTH,SCREEN_HEIGHT;diffuse,Color.Black;diffusealpha,0), - TweenOnCommand=cmd(stoptweening;diffusealpha,1;linear,0.5;diffusealpha,0.8), - TweenOffCommand=cmd(stoptweening;linear,0.5;diffusealpha,0), + InitCommand=function(self) + self:zoomto(SCREEN_WIDTH,SCREEN_HEIGHT):diffuse(Color.Black):diffusealpha(0) + end, + TweenOnCommand=function(self) + self:stoptweening():diffusealpha(1):linear(0.5):diffusealpha(0.8) + end, + TweenOffCommand=function(self) + self:stoptweening():linear(0.5):diffusealpha(0) + end, }, Def.ActorFrame{ Def.BitmapText{ Font="Common Normal", Text=ScreenString("NoSetListPrompt"), - InitCommand=cmd(y,10;wrapwidthpixels,SCREEN_WIDTH-48;diffusealpha,0), - TweenOnCommand=cmd(stoptweening;diffusealpha,0;sleep,0.5125;linear,0.125;diffusealpha,1), - TweenOffCommand=cmd(stoptweening;linear,0.5;diffusealpha,0), + InitCommand=function(self) + self:y(10):wrapwidthpixels(SCREEN_WIDTH-48):diffusealpha(0) + end, + TweenOnCommand=function(self) + self:stoptweening():diffusealpha(0):sleep(0.5125):linear(0.125):diffusealpha(1) + end, + TweenOffCommand=function(self) + self:stoptweening():linear(0.5):diffusealpha(0) + end, }, }, } diff --git a/Docs/steps.lua b/Docs/steps.lua index 4f8d015e9c..8cd9c7506d 100644 --- a/Docs/steps.lua +++ b/Docs/steps.lua @@ -42,8 +42,12 @@ local MetaData = { startTime = { path, rate, offset, commands } Any ommitted arguments will default to nil, except for rate, which would use 1.0 ]] - 0 = {"path/to/bga", 1.0, 0.000, 0, cmd(rainbow) }, - 0 = {"path/to/bga2", 1.0, 0.000, 0, cmd(thump) } + 0 = {"path/to/bga", 1.0, 0.000, 0, function(self) + self:rainbow() + end, + 0 = {"path/to/bga2", 1.0, 0.000, 0, function(self) + self:thump() + end} }, }, --[[ diff --git a/NoteSkins/common/common/Fallback Explosion.lua b/NoteSkins/common/common/Fallback Explosion.lua index 0f6050faaf..a2284c909b 100644 --- a/NoteSkins/common/common/Fallback Explosion.lua +++ b/NoteSkins/common/common/Fallback Explosion.lua @@ -23,12 +23,20 @@ local t = Def.ActorFrame { W3Command=NOTESKIN:GetMetricA("GhostArrowDim", "W3Command"); W2Command=NOTESKIN:GetMetricA("GhostArrowDim", "W2Command"); W1Command=NOTESKIN:GetMetricA("GhostArrowDim", "W1Command"); - JudgmentCommand=cmd(finishtweening); - BrightCommand=cmd(visible,false); - DimCommand=cmd(visible,true); + JudgmentCommand=function(self) + self:finishtweening() + end; + BrightCommand=function(self) + self:visible(false) + end; + DimCommand=function(self) + self:visible(true) + end; }; NOTESKIN:LoadActor( Var "Button", "Held Explosion Dim" ) .. { - InitCommand=cmd(diffusealpha,0); + InitCommand=function(self) + self:diffusealpha(0) + end; HeldCommand=NOTESKIN:GetMetricA("GhostArrowDim", "HeldCommand"); JudgmentCommand=function(self) self:finishtweening() @@ -49,12 +57,20 @@ local t = Def.ActorFrame { W3Command=NOTESKIN:GetMetricA("GhostArrowBright", "W3Command"); W2Command=NOTESKIN:GetMetricA("GhostArrowBright", "W2Command"); W1Command=NOTESKIN:GetMetricA("GhostArrowBright", "W1Command"); - JudgmentCommand=cmd(finishtweening); - BrightCommand=cmd(visible,true); - DimCommand=cmd(visible,false); + JudgmentCommand=function(self) + self:finishtweening() + end; + BrightCommand=function(self) + self:visible(true) + end; + DimCommand=function(self) + self:visible(false) + end; }; NOTESKIN:LoadActor( Var "Button", "Held Explosion Bright" ) .. { - InitCommand=cmd(diffusealpha,0); + InitCommand=function(self) + self:diffusealpha(0) + end; HeldCommand=NOTESKIN:GetMetricA("GhostArrowBright", "HeldCommand"); JudgmentCommand=function(self) self:finishtweening() diff --git a/Themes/_fallback/Scripts/03 Gameplay.lua b/Themes/_fallback/Scripts/03 Gameplay.lua index 0aed51694c..f9f3432206 100644 --- a/Themes/_fallback/Scripts/03 Gameplay.lua +++ b/Themes/_fallback/Scripts/03 Gameplay.lua @@ -260,7 +260,6 @@ end local RoutineSkins = { dance = { P1 = "midi-routine-p1", P2 = "midi-routine-p2" }, - pump = { P1 = "cmd-routine-p1", P2 = "cmd-routine-p2" }, kb7 = { P1 = "default", P2 = "retrobar" }, ------------------------------------------------------------- default = { P1 = "default", P2 = "default" }