Advertisement
Jousway

zpawn common

Jan 7th, 2012
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.46 KB | None | 0 0
  1. local ret = ... or {}
  2.  
  3. ret.Redir = function(sButton, sElement)
  4.     -- To redirect files for Up to Down:
  5.     -- if sButton == "Up" then sButton = "Down"; end
  6.     return sButton, sElement;
  7. end
  8.  
  9. ret.Rotate =
  10. {
  11. };
  12.  
  13. ret.PartsToRotate =
  14. {
  15. };
  16.  
  17. ret.Blank =
  18. {
  19. -- To blank tap notes:
  20. -- ["tap note"] = true,
  21. };
  22.  
  23. local function func()
  24.     local sButton = Var "Button";
  25.     local sElement = Var "Element";
  26.  
  27.     if ret.Blank[sElement] then
  28.         -- Return a blank element.  If SpriteOnly is set,
  29.         -- we need to return a sprite; otherwise just return
  30.         -- a dummy actor.
  31.         local t;
  32.         if Var "SpriteOnly" then
  33.             t = LoadActor( "_blank" );
  34.         else
  35.             t = Def.Actor {};
  36.         end
  37.         return t .. {
  38.             cmd(visible,false);
  39.         };
  40.     end
  41.        
  42.     local sButtonToLoad, sElementToLoad = ret.Redir(sButton, sElement);
  43.     assert( sButtonToLoad );
  44.     assert( sElementToLoad );
  45.  
  46.     local sPath = NOTESKIN:GetPath( sButtonToLoad, sElementToLoad );
  47.  
  48.     local t = LoadActor( sPath );
  49.  
  50.     if ret.PartsToRotate[sElement] then
  51.         t.BaseRotationZ = ret.Rotate[sButton];
  52.     end
  53.    
  54.     local ThemeBoard = GetUserPrefB("UserPrefNotefieldBoardA");
  55.     local NoteskinBoard = GetUserPrefB("UserPrefNotefieldBoardB");
  56.    
  57.     --Define brightness
  58.     --there must be a other way but I'm a total noob haha
  59.     local Bright80 = GetUserPrefB("UserPrefNotefieldBrightness80");
  60.     local Bright60 = GetUserPrefB("UserPrefNotefieldBrightness60");
  61.     local Bright40 = GetUserPrefB("UserPrefNotefieldBrightness40");
  62.     local Bright20 = GetUserPrefB("UserPrefNotefieldBrightness20");
  63.  
  64.     local Brightness;
  65.  
  66.     if Bright80 then Brightness =  0.8
  67.     elseif Bright60 then Brightness = 0.6
  68.     elseif Bright40 then Brightness =  0.4
  69.     elseif Bright20 then Brightness =  0.2
  70.     else Brightness = 1
  71.     end
  72.    
  73.     local BoardLocation;
  74.     local BoardMetricDanceSingle;
  75.     local BoardMetricDanceSolo;
  76.     local BoardMetricPumpSingle;
  77.     local BoardMetricPumpHalfDouble;
  78.     local BoardMetricKeyboard7
  79.    
  80.     if ThemeBoard then
  81.     BoardLocation = THEME:GetPathG( "_Note", "Board" );
  82.     BoardMetricDanceSingle = THEME:GetMetric("NotefieldBoard", "DanceSingle");
  83.     BoardMetricDanceSolo = THEME:GetMetric("NotefieldBoard", "DanceSolo");
  84.     BoardMetricPumpSingle = THEME:GetMetric("NotefieldBoard", "PumpSingle");
  85.     BoardMetricPumpHalfDouble = THEME:GetMetric("NotefieldBoard", "PumpHalfDouble");
  86.     BoardMetricKeyboard7 = THEME:GetMetric("NotefieldBoard", "Keyboard7");
  87.     elseif NoteskinBoard then
  88.     BoardLocation = NOTESKIN:GetPath( "_Note", "Board" );
  89.     BoardMetricDanceSingle = NOTESKIN:GetMetricA("NotefieldBoard", "DanceSingle");
  90.     BoardMetricDanceSolo = NOTESKIN:GetMetricA("NotefieldBoard", "DanceSolo");
  91.     BoardMetricPumpSingle = NOTESKIN:GetMetricA("NotefieldBoard", "PumpSingle");
  92.     BoardMetricPumpHalfDouble = NOTESKIN:GetMetricA("NotefieldBoard", "PumpHalfDouble");
  93.     BoardMetricKeyboard7 = NOTESKIN:GetMetricA("NotefieldBoard", "Keyboard7");
  94.     end
  95.  
  96.     if NoteskinBoard or ThemeBoard then
  97.         local t = Def.ActorFrame {};
  98.         if GAMESTATE:GetCurrentGame():GetName() == "dance" then
  99.             if GAMESTATE:GetCurrentStyle():GetName() == "single"
  100.             or GAMESTATE:GetCurrentStyle():GetName() == "versus"
  101.             or GAMESTATE:GetCurrentStyle():GetName() == "double"
  102.             or GAMESTATE:GetCurrentStyle():GetName() == "couple" then
  103.                 if Var "Button" == "Left" and Var "Element" == "Receptor" then
  104.                     t[#t+1] = Def.ActorFrame {
  105.                         InitCommand=cmd(diffusealpha,Brightness;x,96;y,SCREEN_CENTER_Y);
  106.                         LoadActor( BoardLocation ) .. {
  107.                             InitCommand=BoardMetricDanceSingle;
  108.                         };
  109.                     };
  110.                     if sButtonToLoad == "Down" then
  111.                         t[#t+1] = LoadActor( sPath ) .. {
  112.                             InitCommand=cmd(rotationz,90);
  113.                         };
  114.                     elseif sButtonToLoad == "Right" then
  115.                         t[#t+1] = LoadActor( sPath ) .. {
  116.                             InitCommand=cmd(rotationz,180);
  117.                         };
  118.                     elseif sButtonToLoad == "Up" then
  119.                         t[#t+1] = LoadActor( sPath ) .. {
  120.                             InitCommand=cmd(rotationz,-90);
  121.                         };
  122.                     else
  123.                         t[#t+1] = LoadActor( sPath );
  124.                     end
  125.                     return t;
  126.                 end
  127.             end
  128.             if GAMESTATE:GetCurrentStyle():GetName() == "solo" then
  129.                 if Var "Button" == "Left" and Var "Element" == "Receptor" then
  130.                     t[#t+1] = Def.ActorFrame {
  131.                         InitCommand=cmd(diffusealpha,Brightness;x,160;y,SCREEN_CENTER_Y);
  132.                         LoadActor( BoardLocation ) .. {
  133.                             InitCommand=BoardMetricDanceSolo;
  134.                         };
  135.                     };
  136.                     if sButtonToLoad == "Down" then
  137.                         t[#t+1] = LoadActor( sPath ) .. {
  138.                             InitCommand=cmd(rotationz,90);
  139.                         };
  140.                     elseif sButtonToLoad == "Right" then
  141.                         t[#t+1] = LoadActor( sPath ) .. {
  142.                             InitCommand=cmd(rotationz,180);
  143.                         };
  144.                     elseif sButtonToLoad == "Up" then
  145.                         t[#t+1] = LoadActor( sPath ) .. {
  146.                             InitCommand=cmd(rotationz,-90);
  147.                         };
  148.                     elseif sButtonToLoad == "UpLeft" then
  149.                         t[#t+1] = LoadActor( sPath ) .. {
  150.                             InitCommand=cmd(rotationz,-45);
  151.                         };
  152.                     elseif sButtonToLoad == "UpRight" then
  153.                         t[#t+1] = LoadActor( sPath ) .. {
  154.                             InitCommand=cmd(rotationz,-135);
  155.                         };
  156.                     else
  157.                         t[#t+1] = LoadActor( sPath );
  158.                     end
  159.                     return t;
  160.                 end
  161.             end
  162.         end
  163.         if GAMESTATE:GetCurrentGame():GetName() == "pump" then
  164.             if GAMESTATE:GetCurrentStyle():GetName() == "single"
  165.             or GAMESTATE:GetCurrentStyle():GetName() == "versus"
  166.             or GAMESTATE:GetCurrentStyle():GetName() == "double"
  167.             or GAMESTATE:GetCurrentStyle():GetName() == "couple"
  168.             or GAMESTATE:GetCurrentStyle():GetName() == "routine" then
  169.                 if Var "Button" == "DownLeft" and Var "Element" == "Receptor" then
  170.                     t[#t+1] = Def.ActorFrame {
  171.                         InitCommand=cmd(diffusealpha,Brightness;x,128;y,SCREEN_CENTER_Y);
  172.                         LoadActor( BoardLocation ) .. {
  173.                             InitCommand=BoardMetricPumpSingle;
  174.                         };
  175.                     };
  176.                     if sButtonToLoad == "UpLeft" then
  177.                         t[#t+1] = LoadActor( sPath ) .. {
  178.                             InitCommand=cmd(rotationz,-90);
  179.                         };
  180.                     elseif sButtonToLoad == "UpRight" then
  181.                         t[#t+1] = LoadActor( sPath ) .. {
  182.                             InitCommand=cmd(rotationz,180);
  183.                         };
  184.                     elseif sButtonToLoad == "DownRight" then
  185.                         t[#t+1] = LoadActor( sPath ) .. {
  186.                             InitCommand=cmd(rotationz,90);
  187.                         };
  188.                     else
  189.                         t[#t+1] = LoadActor( sPath );
  190.                     end
  191.                     return t;
  192.                 end
  193.             end
  194.             if GAMESTATE:GetCurrentStyle():GetName() == "halfdouble" then
  195.                 if Var "Button" == "DownLeft" and Var "Element" == "Receptor" then
  196.                     t[#t+1] = Def.ActorFrame {
  197.                         InitCommand=cmd(diffusealpha,Brightness;x,-32;y,SCREEN_CENTER_Y);
  198.                         LoadActor( BoardLocation ) .. {
  199.                             InitCommand=BoardMetricPumpHalfDouble;
  200.                         };
  201.                     };
  202.                     if sButtonToLoad == "UpLeft" then
  203.                         t[#t+1] = LoadActor( sPath ) .. {
  204.                             InitCommand=cmd(rotationz,-90);
  205.                         };
  206.                     elseif sButtonToLoad == "UpRight" then
  207.                         t[#t+1] = LoadActor( sPath ) .. {
  208.                             InitCommand=cmd(rotationz,180);
  209.                         };
  210.                     elseif sButtonToLoad == "DownRight" then
  211.                         t[#t+1] = LoadActor( sPath ) .. {
  212.                             InitCommand=cmd(rotationz,90);
  213.                         };
  214.                     else
  215.                         t[#t+1] = LoadActor( sPath );
  216.                     end
  217.                     return t;
  218.                 end
  219.             end
  220.         end
  221.         if GAMESTATE:GetCurrentGame():GetName() == "kb7" then
  222.             if Var "Button" == "Key1" and Var "Element" == "Receptor" then
  223.                 t[#t+1] = Def.ActorFrame {
  224.                     InitCommand=cmd(diffusealpha,Brightness;x,208;y,SCREEN_CENTER_Y);
  225.                     LoadActor( BoardLocation ) .. {
  226.                         InitCommand=BoardMetricKeyboard7;
  227.                     };
  228.                 };
  229.                 t[#t+1] = LoadActor( sPath );
  230.                 return t;
  231.             end
  232.         end
  233.     end
  234.     return t;
  235. end
  236.  
  237. -- This is the only required function.
  238. ret.Load = func;
  239.  
  240. -- Use this to override the game types' default Load() functions.
  241. ret.CommonLoad = func;
  242.  
  243. return ret;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement