Advertisement
Jousway

ScreenSelectMusic Overlay.lua

Sep 28th, 2014
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.13 KB | None | 0 0
  1. -- ITS A HACKJOB!
  2. -- I cant theme for shit -Jousway
  3.  
  4. -- I used some code from other themes, mostly the default theme, so massive respect to the creators
  5.  
  6. local t = Def.ActorFrame { 
  7.     --CDTitle Resizer/Container
  8.     Def.ActorFrame{
  9.         Name="Container";
  10.         OnCommand=cmd(x,SCREEN_CENTER_X-160;y,SCREEN_CENTER_Y);
  11.         --main background
  12.         Def.Quad{
  13.             InitCommand=cmd(y,-84;zoomto,294,295;diffuse,color("0.5,0.5,0.5,0.5"));
  14.         };
  15.        
  16.         --banner and title container
  17.         Def.Quad{
  18.             InitCommand=cmd(y,-155;zoomto,289,150;diffuse,color("0,0,0,0.5"));
  19.         };
  20.         --Banner Background
  21.         Def.Quad{
  22.             InitCommand=cmd(y,-160;zoomto,284,89;diffuse,color("0,0,0,0.5"););
  23.         };
  24.         --No Banner Text
  25.         LoadFont("Common Normal") .. {
  26.             Text="No Banner";
  27.             InitCommand=cmd(y,-160;diffuse,color("1,1,1,0.5"));
  28.         };
  29.         --Load Banner
  30.         Def.Sprite {
  31.             Name="Banner";
  32.             InitCommand=cmd(y,-160);
  33.         };
  34.         --Song Title above Banner
  35.         LoadFont("Common Normal") .. {
  36.             Name="title";
  37.             InitCommand=cmd(y,-218;zoom,0.6;maxwidth,460);
  38.         };
  39.        
  40.         --CDTitle Background
  41.         Def.Quad{
  42.             InitCommand=cmd(y,-45;x,102;zoomto,85,65;diffuse,color("0,0,0,0.5"););
  43.         };
  44.         --Load CDTitle
  45.         Def.Sprite {
  46.             Name="CDTitle";
  47.             InitCommand=cmd(y,-45;x,102);
  48.         };     
  49.        
  50.         --NPS Calculator/Display
  51.         LoadFont("Common Normal") .. {
  52.             Text="NPS";
  53.             InitCommand=cmd(x,70;y,-98;zoom,0.75;diffuse,1,1,1,1);
  54.         };
  55.         LoadFont("Common Normal") .. {
  56.             Name="P1NPS";
  57.             InitCommand=cmd(;y,-98;zoom,0.75;diffuse,color("#ef403d"));
  58.         };
  59.         LoadFont("Common Normal") .. {
  60.             Name="P2NPS";
  61.             InitCommand=cmd(y,-98;zoom,0.75;diffuse,color("#0089cf"));
  62.         };
  63.        
  64.         --BPM
  65.         LoadFont("Common Normal") .. {
  66.             Text="BPM";
  67.             InitCommand=cmd(x,-25;y,-98;zoom,0.75;diffuse,1,1,1,1);
  68.         };
  69.         LoadFont("Common Normal") .. {
  70.             Name="BPM";
  71.             InitCommand=cmd(x,25;y,-98;zoom,0.75;diffuse,color("#0089cf"));
  72.         };
  73.        
  74.         --Song Length
  75.         LoadFont("Common Normal") .. {
  76.             Name="length";
  77.             InitCommand=cmd(x,-95;y,-98;zoom,0.75;diffuse,color("#ef403d"));
  78.         };
  79.         LoadFont("Common Normal") .. {
  80.             Name="test";
  81.             InitCommand=cmd();
  82.         };
  83.        
  84.         --difficulty selector
  85.         Def.Quad{
  86.             Name="p2curB";
  87.             InitCommand=cmd(y,-28;diffuse,color("#0089cfaa"));
  88.         };
  89.         LoadFont("Common Normal") .. {
  90.             Name="p2curT";
  91.             Text="P2";
  92.             InitCommand=cmd(y,-28;zoom,0.8;diffuse,color("0,0,0,0.8"));
  93.         };
  94.         Def.Quad{
  95.             Name="p1curB";
  96.             InitCommand=cmd(y,-28;diffuse,color("#ef403daa"));
  97.         };
  98.         LoadFont("Common Normal") .. {
  99.             Name="p1curT";
  100.             Text="P1";
  101.             InitCommand=cmd(y,-28;zoom,0.8;diffuse,color("0,0,0,0.8"));
  102.         };
  103.         LoadActor( THEME:GetPathG("ScreenSelectMusic","DifficultyDisplay") ) .. {
  104.         };
  105.        
  106.         --song stats panel
  107.         Def.Quad{
  108.             InitCommand=cmd(y,25;x,-73;zoomto,143,70;diffuse,color("0,0,0,0.5"));
  109.         };
  110.         LoadFont("Common Normal") .. {
  111.             Name="p1SP";
  112.             Text="Press Start";
  113.             InitCommand=cmd(y,25;x,-73;zoom,0.7;diffuse,color("1,1,1,0.5"));
  114.         };
  115.         LoadActor( THEME:GetPathG("PaneDisplay","p1") ) .. {
  116.             InitCommand=cmd(x,-80;y,30;zoom,0.36);
  117.         };
  118.         Def.Quad{
  119.             InitCommand=cmd(y,25;x,73;zoomto,143,70;diffuse,color("0,0,0,0.5"));
  120.         };
  121.         LoadFont("Common Normal") .. {
  122.             Name="p2SP";
  123.             Text="Press Start";
  124.             InitCommand=cmd(y,25;x,73;zoom,0.7;diffuse,color("1,1,1,0.5"));
  125.         };
  126.         LoadActor( THEME:GetPathG("PaneDisplay","p2") ) .. {
  127.             InitCommand=cmd(x,66;y,30;zoom,0.36);
  128.         };
  129.     };
  130. };
  131.  
  132. local function Update(self)
  133.     local song = GAMESTATE:GetCurrentSong();
  134.  
  135.     --cdtitle and banner
  136.     local cdtitle = self:GetChild("Container"):GetChild("CDTitle");
  137.     local banner = self:GetChild("Container"):GetChild("Banner");
  138.     local cdheight = cdtitle:GetHeight();
  139.     local cdwidth = cdtitle:GetWidth();
  140.     local brheight = banner:GetHeight();
  141.     local brwidth = banner:GetWidth();
  142.    
  143.     --load of code just to load group banner
  144.     local musicwheel = SCREENMAN:GetTopScreen():GetMusicWheel();
  145.     local selection = musicwheel:GetSelectedSection();
  146.     local gbanner = SONGMAN:GetSongGroupBannerPath(selection);
  147.        
  148.     if song then
  149.        
  150.         bpm = string.format("%03.0f",GAMESTATE:GetSongBPS()*60);
  151.         songsec = song:MusicLengthSeconds()%60;
  152.         songmin = math.floor(song:MusicLengthSeconds()/60);
  153.         for c in string.gmatch(songsec,"%d+%p(%d%d)") do
  154.             songmil = c;
  155.         end;
  156.        
  157.         length = string.format("%02d:%02d",  songmin, songsec)..":"..songmil;
  158.        
  159.         title = song:GetDisplayMainTitle();
  160.         if song:HasCDTitle() then
  161.             cdtitle:visible(true);
  162.             cdtitle:Load(song:GetCDTitlePath());
  163.         else
  164.             cdtitle:visible(false);
  165.         end;
  166.         if song:HasBanner() then
  167.             banner:visible(true);
  168.             banner:Load(song:GetBannerPath());
  169.         else
  170.             banner:visible(false);
  171.         end;
  172.     else
  173.         if gbanner ~= "" then
  174.             banner:visible(true);
  175.             banner:Load(gbanner);
  176.         else
  177.             banner:visible(false);
  178.         end;
  179.        
  180.         cdtitle:visible(false);
  181.         title = "";
  182.         bpm = "000";
  183.         length = "00:00";
  184.     end;
  185.        
  186.     self:GetChild("Container"):GetChild("title"):settext(title);
  187.     self:GetChild("Container"):GetChild("BPM"):settext(bpm);
  188.     self:GetChild("Container"):GetChild("length"):settext(length);
  189.    
  190.     if cdheight >= 60 and cdwidth >= 80 then
  191.         if cdheight*(80/60) >= cdwidth then
  192.         cdtitle:zoom(60/cdheight);
  193.         else
  194.         cdtitle:zoom(80/cdwidth);
  195.         end;
  196.     elseif cdheight >= 60 then
  197.         cdtitle:zoom(60/cdheight);
  198.     elseif cdwidth >= 80 then
  199.         cdtitle:zoom(80/cdwidth);
  200.     else
  201.         cdtitle:zoom(1);
  202.     end;
  203.        
  204.     if brheight >= 89 and brwidth >= 284 then
  205.         if brheight*(284/89) >= brwidth then
  206.         banner:zoom(88/brheight);
  207.         else
  208.         banner:zoom(284/brwidth);
  209.         end;
  210.     elseif brheight >= 89 then
  211.         banner:zoom(89/brheight);
  212.     elseif brwidth >= 284 then
  213.         banner:zoom(284/brwidth);
  214.     elseif brwidth/3.22 >= brheight then
  215.         banner:zoom(284/brwidth);
  216.     else
  217.         banner:zoom(89/brheight);
  218.     end;
  219.    
  220.     --nps
  221.     local P1NPS = self:GetChild("Container"):GetChild("P1NPS");
  222.     local P2NPS = self:GetChild("Container"):GetChild("P2NPS");
  223.    
  224.     local difloc = {
  225.         Beginner    = 32*0.40,
  226.         Easy        = 32*1.46,
  227.         Medium      = 32*2.52,
  228.         Hard        = 32*3.58,
  229.         Challenge   = 32*4.64,
  230.         Edit        = 32*5.70,
  231.     };
  232.    
  233.    
  234.     p1curB = self:GetChild("Container"):GetChild("p1curB");
  235.     p1CurT = self:GetChild("Container"):GetChild("p1curT");
  236.     p2curB = self:GetChild("Container"):GetChild("p2curB");
  237.     p2CurT = self:GetChild("Container"):GetChild("p2curT");
  238.     p1SP = self:GetChild("Container"):GetChild("p1SP");
  239.     p2SP = self:GetChild("Container"):GetChild("p2SP");
  240.    
  241.     local function Radar(pn,cat)
  242.         local GetRadar = GAMESTATE:GetCurrentSteps(pn):GetRadarValues(pn);
  243.         return GetRadar:GetValue(cat);
  244.     end;
  245.        
  246.     --all this just to do difficulty, sadly this only works in sm5 beta 4, so beta 3 users need to update :<
  247.     if GAMESTATE:IsHumanPlayer(PLAYER_1) then
  248.         if song then
  249.             local ChartLenghtInSec = song:GetStepsSeconds();
  250.             local P1Taps = Radar(PLAYER_1,'RadarCategory_TapsAndHolds')+Radar(PLAYER_1,'RadarCategory_Jumps')+Radar(PLAYER_1,'RadarCategory_Hands');
  251.             P1NPS:settext(string.format("%0.0f",P1Taps/ChartLenghtInSec));
  252.         else
  253.             P1NPS:settext("0");
  254.         end;       
  255.         if GAMESTATE:GetCurrentSteps(PLAYER_1) then
  256.             local p1d = ToEnumShortString(GAMESTATE:GetCurrentSteps(PLAYER_1):GetDifficulty());
  257.             if song then
  258.                 p1curB:visible(true);
  259.                 p1CurT:visible(true);
  260.             else
  261.                 p1curB:visible(false);
  262.                 p1CurT:visible(false);
  263.             end;
  264.             p1curB:x(-142+difloc[p1d]);
  265.             p1CurT:x(-142+difloc[p1d]);
  266.         else
  267.             p1curB:visible(false);
  268.             p1CurT:visible(false);
  269.         end;
  270.         P2NPS:x(130);
  271.         p1SP:visible(false);
  272.     else
  273.         P2NPS:x(115);
  274.         p1curB:visible(false);
  275.         p1CurT:visible(false);
  276.         p1SP:visible(true);
  277.     end;
  278.    
  279.     if GAMESTATE:IsHumanPlayer(PLAYER_2) then
  280.         if song then
  281.             local ChartLenghtInSec = song:GetStepsSeconds();
  282.             local P2Taps = Radar(PLAYER_2,'RadarCategory_TapsAndHolds')+Radar(PLAYER_2,'RadarCategory_Jumps')+Radar(PLAYER_2,'RadarCategory_Hands');
  283.             P2NPS:settext(string.format("%0.0f",P2Taps/ChartLenghtInSec));
  284.         else
  285.             P2NPS:settext("0");
  286.         end;
  287.         if GAMESTATE:GetCurrentSteps(PLAYER_2) then
  288.             local p2d = ToEnumShortString(GAMESTATE:GetCurrentSteps(PLAYER_2):GetDifficulty());
  289.             if song then
  290.                 p2curB:visible(true);
  291.                 p2CurT:visible(true);
  292.             else
  293.                 p2curB:visible(false);
  294.                 p2CurT:visible(false);
  295.             end;
  296.             p2curB:x(-142+difloc[p2d]);
  297.             p2CurT:x(-142+difloc[p2d]);
  298.         else
  299.             p2curB:visible(false);
  300.             p2CurT:visible(false);
  301.         end;
  302.         P1NPS:x(105);
  303.         p2SP:visible(false);
  304.     else
  305.         P1NPS:x(115);
  306.         p2curB:visible(false);
  307.         p2CurT:visible(false);
  308.         p2SP:visible(true);
  309.     end;
  310.    
  311.     if GAMESTATE:IsHumanPlayer(PLAYER_1) and GAMESTATE:IsHumanPlayer(PLAYER_2) then
  312.         local p1d = ToEnumShortString(GAMESTATE:GetCurrentSteps(PLAYER_1):GetDifficulty());
  313.         local p2d = ToEnumShortString(GAMESTATE:GetCurrentSteps(PLAYER_2):GetDifficulty());
  314.         if p1d == p2d then
  315.             p1curB:zoomto(30,15);
  316.             p1CurT:zoomy(0.5);
  317.             p2curB:zoomto(30,15);
  318.             p2CurT:zoomy(0.5);
  319.             p1curB:y(-36);
  320.             p1CurT:y(-36);
  321.             p2curB:y(-20);
  322.             p2CurT:y(-20);
  323.         else
  324.             p1curB:zoomto(30,30);
  325.             p1CurT:zoomy(1);
  326.             p2curB:zoomto(30,30);
  327.             p2CurT:zoomy(1);
  328.             p1curB:y(-28);
  329.             p1CurT:y(-28);
  330.             p2curB:y(-28);
  331.             p2CurT:y(-28);
  332.         end;
  333.     else
  334.         p1curB:zoomto(30,30);
  335.         p1CurT:zoomy(1);
  336.         p2curB:zoomto(30,30);
  337.         p2CurT:zoomy(1);
  338.     end;
  339. end;
  340.  
  341. t.InitCommand=cmd(SetUpdateFunction,Update);
  342. return t
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement