diff --git a/Themes/default/BGAnimations/ScreenGameplay underlay/ScreenFilter.lua b/Themes/default/BGAnimations/ScreenGameplay underlay/ScreenFilter.lua index c01da0b495..bba442f8e6 100644 --- a/Themes/default/BGAnimations/ScreenGameplay underlay/ScreenFilter.lua +++ b/Themes/default/BGAnimations/ScreenGameplay underlay/ScreenFilter.lua @@ -1,83 +1,65 @@ ---[[ Screen Filter ]] -local numPlayers = GAMESTATE:GetNumPlayersEnabled() -local center1P = PREFSMAN:GetPreference("Center1Player") - -local padding = 8 -- 4px on each side -local arrowWidth = 64 -- until noteskin metrics are implemented... - -local filterColor = color("0.135,0.135,0.135,1") -local filterAlphas = { - PlayerNumber_P1 = 1, - PlayerNumber_P2 = 1, - Default = 0, -} - -local t = Def.ActorFrame{}; - -local style = GAMESTATE:GetCurrentStyle() -local cols = style:ColumnsPerPlayer() -local styleType = ToEnumShortString(style:GetStyleType()) -local filterWidth = (arrowWidth * cols) + padding - -if numPlayers == 1 then - local player = GAMESTATE:GetMasterPlayerNumber() - local pNum = (player == PLAYER_1) and 1 or 2 - filterAlphas[player] = tonumber(getenv("ScreenFilterP"..pNum)); - - local pos; - -- [ScreenGameplay] PlayerP#Player*Side(s)X - if center1P then - pos = SCREEN_CENTER_X - else - local metricName = string.format("PlayerP%i%sX",pNum,styleType) - pos = THEME:GetMetric("ScreenGameplay",metricName) - end - t[#t+1] = Def.Quad{ - Name="SinglePlayerFilter"; - InitCommand=function(self) - self:x(pos); - self:CenterY(); - self:zoomto(filterWidth, SCREEN_HEIGHT); - self:diffusecolor(filterColor); - self:diffusealpha(filterAlphas[player]); - end; - }; -else - -- two players... a bit more complex. - if styleType == "TwoPlayersSharedSides" then - -- routine, just use one in the center. - local player = GAMESTATE:GetMasterPlayerNumber() - local pNum = player == PLAYER_1 and 1 or 2 - local metricName = "PlayerP".. pNum .."TwoPlayersSharedSidesX" - t[#t+1] = Def.Quad{ - Name="RoutineFilter"; - InitCommand=function(self) - self:x(THEME:GetMetric("ScreenGameplay",metricName)); - self:CenterY(); - self:zoomto(filterWidth, SCREEN_HEIGHT); - self:diffusecolor(filterColor); - self:diffusealpha(filterAlphas[player]); - end; - }; - else - -- otherwise we need two separate ones. to the pairsmobile! - for i, player in ipairs(PlayerNumber) do - local pNum = (player == PLAYER_1) and 1 or 2 - filterAlphas[player] = tonumber(getenv("ScreenFilterP"..pNum)); - local metricName = string.format("PlayerP%i%sX",pNum,styleType) - local pos = THEME:GetMetric("ScreenGameplay",metricName) - t[#t+1] = Def.Quad{ - Name="Player"..pNum.."Filter"; - InitCommand=function(self) - self:x(pos); - self:CenterY(); - self:zoomto(filterWidth, SCREEN_HEIGHT); - self:diffusecolor(filterColor); - self:diffusealpha(filterAlphas[player]); - end; - }; - end - end -end - +--[[ Screen Filter ]] +local numPlayers = GAMESTATE:GetNumPlayersEnabled() +local center1P = PREFSMAN:GetPreference("Center1Player") + +local padding = 8 -- 4px on each side +local arrowWidth = 64 -- until noteskin metrics are implemented... + +local filterColor = color("0.135,0.135,0.135,1") +local filterAlphas = { + PlayerNumber_P1 = 1, + PlayerNumber_P2 = 1, + Default = 0, +} + +local t = Def.ActorFrame{}; + +local style = GAMESTATE:GetCurrentStyle() +local cols = style:ColumnsPerPlayer() +local styleType = ToEnumShortString(style:GetStyleType()) +local filterWidth = (arrowWidth * cols) + padding + +if numPlayers == 1 then + local player = GAMESTATE:GetMasterPlayerNumber() + local pNum = (player == PLAYER_1) and 1 or 2 + filterAlphas[player] = tonumber(getenv("ScreenFilterP"..pNum)); + + local pos; + -- [ScreenGameplay] PlayerP#Player*Side(s)X + if center1P then + pos = SCREEN_CENTER_X + else + local metricName = string.format("PlayerP%i%sX",pNum,styleType) + pos = THEME:GetMetric("ScreenGameplay",metricName) + end + t[#t+1] = Def.Quad{ + Name="SinglePlayerFilter"; + InitCommand=cmd(x,pos;CenterY;zoomto,filterWidth,SCREEN_HEIGHT;diffusecolor,filterColor;diffusealpha,filterAlphas[player]); + }; +else + -- two players... a bit more complex. + if styleType == "TwoPlayersSharedSides" then + -- routine, just use one in the center. + local player = GAMESTATE:GetMasterPlayerNumber() + local pNum = player == PLAYER_1 and 1 or 2 + local metricName = "PlayerP".. pNum .."TwoPlayersSharedSidesX" + t[#t+1] = Def.Quad{ + Name="RoutineFilter"; + InitCommand=cmd(x,THEME:GetMetric("ScreenGameplay",metricName);CenterY;zoomto,filterWidth,SCREEN_HEIGHT;diffusecolor,filterColor;diffusealpha,filterAlphas[player]); + }; + else + -- otherwise we need two separate ones. to the pairsmobile! + for i, player in ipairs(PlayerNumber) do + local pNum = (player == PLAYER_1) and 1 or 2 + filterAlphas[player] = tonumber(getenv("ScreenFilterP"..pNum)); + local metricName = string.format("PlayerP%i%sX",pNum,styleType) + local pos = THEME:GetMetric("ScreenGameplay",metricName) + t[#t+1] = Def.Quad{ + Name="Player"..pNum.."Filter"; + InitCommand=cmd(x,pos;CenterY;zoomto,filterWidth,SCREEN_HEIGHT;diffusecolor,filterColor;diffusealpha,filterAlphas[player]); + }; + end + end +end + return t; \ No newline at end of file diff --git a/Themes/default/BGAnimations/ScreenHowToInstallSongs overlay.lua b/Themes/default/BGAnimations/ScreenHowToInstallSongs overlay.lua index a046ad0340..9a81d425c1 100644 --- a/Themes/default/BGAnimations/ScreenHowToInstallSongs overlay.lua +++ b/Themes/default/BGAnimations/ScreenHowToInstallSongs overlay.lua @@ -3,29 +3,9 @@ local t = Def.ActorFrame{ LoadFont("Common Normal")..{ Name="Header"; - InitCommand=function(self) - self:x(SCREEN_LEFT + 24); - self:y(SCREEN_TOP + 24); - self:halign(0); - self:diffuse(color("#CCCCCC")); - self:settext(Screen.String("BodyHeader")); - self:shadowlength(1); - self:shadowcolor(HSV(40,0,0.6)); - self:diffusetopedge(color("#FFFFFF")); - end; - OnCommand=function(self) - self:queuecommand("Anim"); - end; - AnimCommand=function(self) - self:cropright(1); - self:faderight(1); - self:addx(96); - self:decelerate(1); - self:addx(-96); - self:skewx(-0.1); - self:cropright(0); - self:faderight(0); - end; + InitCommand=cmd(x,SCREEN_LEFT+24;y,SCREEN_TOP+24;halign,0;diffuse,color("#CCCCCC");settext,Screen.String("BodyHeader");shadowlength,1;shadowcolor,HSV(40,0,0.6);diffusetopedge,color("#FFFFFF")); + OnCommand=cmd(queuecommand,"Anim"); + AnimCommand=cmd(cropright,1;faderight,1;addx,96;decelerate,1;addx,-96;skewx,-0.1;cropright,0;faderight,0;); }; -- todo: add explantion paragraph here (above the scroller) }; diff --git a/Themes/default/BGAnimations/ScreenSelectProfile overlay.lua b/Themes/default/BGAnimations/ScreenSelectProfile overlay.lua index 43da46982a..466ae0e109 100644 --- a/Themes/default/BGAnimations/ScreenSelectProfile overlay.lua +++ b/Themes/default/BGAnimations/ScreenSelectProfile overlay.lua @@ -1,344 +1,337 @@ -function GetLocalProfiles() - local ret = {}; - - for p = 0,PROFILEMAN:GetNumLocalProfiles()-1 do - local profile=PROFILEMAN:GetLocalProfileFromIndex(p); - local item = Def.ActorFrame { - - LoadFont("Common Normal") .. { - Text=profile:GetDisplayName(); - InitCommand=function(self) - self:shadowlength(1); - self:y(-10); - self:zoom(1); - self:ztest(true); - end; - }; - LoadFont("Common Normal") .. { - InitCommand=function(self) - self:shadowlength(1); - self:y(8); - self:zoom(0.5); - self:vertspacing(-8); - self:ztest(true); - end; - BeginCommand=function(self) - local numSongsPlayed = profile:GetNumTotalSongsPlayed(); - local s = numSongsPlayed == 1 and "Song" or "Songs"; - self:settext( string.format(THEME:GetString("ScreenSelectProfile","%d "..s.." Played"),numSongsPlayed) ); - end; - }; - }; - table.insert( ret, item ); - end; - - return ret; -end; - -function LoadCard(cColor) - local t = Def.ActorFrame { - LoadActor( THEME:GetPathG("ScreenSelectProfile","CardBackground") ) .. { - InitCommand=function(self) - self:diffuse(cColor); - end; - }; - LoadActor( THEME:GetPathG("ScreenSelectProfile","CardFrame") ); - }; - return t -end -function LoadPlayerStuff(Player) - local ret = {}; - - local pn = (Player == PLAYER_1) and 1 or 2; - - local t = Def.ActorFrame { - Name = 'JoinFrame'; - LoadCard(Color('Orange')); - - LoadFont("Common Normal") .. { - Text=THEME:GetString("ScreenSelectProfile","PressStart"); - 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; - }; - }; - table.insert( ret, t ); - - t = Def.ActorFrame { - Name = 'BigFrame'; - LoadCard(PlayerColor(Player)); - }; - table.insert( ret, t ); - - t = Def.ActorFrame { - Name = 'SmallFrame'; - - InitCommand=function(self) - self:y(-2); - end; - Def.Quad { - InitCommand=function(self) - self:zoomto(200-10, 40+2); - end; - OnCommand=function(self) - self:diffuse(Color('Black')); - self:diffusealpha(0.5); - end; - }; - 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; - }; - 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; - }; - 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; - }; - }; - table.insert( ret, t ); - - t = Def.ActorScroller{ - Name = 'ProfileScroller'; - NumItemsToDraw=6; - OnCommand=function(self) - self:y(1); - self:SetFastCatchup(true); - self:SetMask(200, 58); - self:SetSecondsPerItem(0.15); - end; - 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 )); - end; - children = GetLocalProfiles(); - }; - table.insert( ret, t ); - - t = Def.ActorFrame { - Name = "EffectFrame"; - }; - table.insert( ret, t ); - t = LoadFont("Common Normal") .. { - Name = 'SelectedProfileText'; - InitCommand=function(self) - self:y(160); - self:shadowlength(1); - end; - }; - table.insert( ret, t ); - - return ret; -end; - -function UpdateInternal3(self, Player) - local pn = (Player == PLAYER_1) and 1 or 2; - local frame = self:GetChild(string.format('P%uFrame', pn)); - local scroller = frame:GetChild('ProfileScroller'); - local seltext = frame:GetChild('SelectedProfileText'); - local joinframe = frame:GetChild('JoinFrame'); - local smallframe = frame:GetChild('SmallFrame'); - local bigframe = frame:GetChild('BigFrame'); - - if GAMESTATE:IsHumanPlayer(Player) then - frame:visible(true); - if MEMCARDMAN:GetCardState(Player) == 'MemoryCardState_none' then - --using profile if any - joinframe:visible(false); - smallframe:visible(true); - bigframe:visible(true); - seltext:visible(true); - scroller:visible(true); - local ind = SCREENMAN:GetTopScreen():GetProfileIndex(Player); - if ind > 0 then - scroller:SetDestinationItem(ind-1); - seltext:settext(PROFILEMAN:GetLocalProfileFromIndex(ind-1):GetDisplayName()); - else - if SCREENMAN:GetTopScreen():SetProfileIndex(Player, 1) then - scroller:SetDestinationItem(0); - self:queuecommand('UpdateInternal2'); - else - joinframe:visible(true); - smallframe:visible(false); - bigframe:visible(false); - scroller:visible(false); - seltext:settext('No profile'); - end; - end; - else - --using card - smallframe:visible(false); - scroller:visible(false); - seltext:settext('CARD'); - SCREENMAN:GetTopScreen():SetProfileIndex(Player, 0); - end; - else - joinframe:visible(true); - scroller:visible(false); - seltext:visible(false); - smallframe:visible(false); - bigframe:visible(false); - end; -end; - -local t = Def.ActorFrame { - - StorageDevicesChangedMessageCommand=function(self, params) - self:queuecommand('UpdateInternal2'); - end; - - CodeMessageCommand = function(self, params) - if params.Name == 'Start' or params.Name == 'Center' then - MESSAGEMAN:Broadcast("StartButton"); - if not GAMESTATE:IsHumanPlayer(params.PlayerNumber) then - SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, -1); - else - SCREENMAN:GetTopScreen():Finish(); - end; - end; - if params.Name == 'Up' or params.Name == 'Up2' or params.Name == 'DownLeft' then - if GAMESTATE:IsHumanPlayer(params.PlayerNumber) then - local ind = SCREENMAN:GetTopScreen():GetProfileIndex(params.PlayerNumber); - if ind > 1 then - if SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, ind - 1 ) then - MESSAGEMAN:Broadcast("DirectionButton"); - self:queuecommand('UpdateInternal2'); - end; - end; - end; - end; - if params.Name == 'Down' or params.Name == 'Down2' or params.Name == 'DownRight' then - if GAMESTATE:IsHumanPlayer(params.PlayerNumber) then - local ind = SCREENMAN:GetTopScreen():GetProfileIndex(params.PlayerNumber); - if ind > 0 then - if SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, ind + 1 ) then - MESSAGEMAN:Broadcast("DirectionButton"); - self:queuecommand('UpdateInternal2'); - end; - end; - end; - end; - if params.Name == 'Back' then - if GAMESTATE:GetNumPlayersEnabled()==0 then - SCREENMAN:GetTopScreen():Cancel(); - else - MESSAGEMAN:Broadcast("BackButton"); - SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, -2); - end; - end; - end; - - PlayerJoinedMessageCommand=function(self, params) - self:queuecommand('UpdateInternal2'); - end; - - PlayerUnjoinedMessageCommand=function(self, params) - self:queuecommand('UpdateInternal2'); - end; - - OnCommand=function(self, params) - self:queuecommand('UpdateInternal2'); - end; - - UpdateInternal2Command=function(self) - UpdateInternal3(self, PLAYER_1); - UpdateInternal3(self, PLAYER_2); - end; - - 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; - PlayerJoinedMessageCommand=function(self,param) - if param.Player == PLAYER_1 then - self:zoom(1.15); - self:bounceend(0.175); - self:zoom(1.0); - 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; - PlayerJoinedMessageCommand=function(self,param) - if param.Player == PLAYER_2 then - self:zoom(1.15); - self:bounceend(0.175); - self:zoom(1.0); - end; - end; - children = LoadPlayerStuff(PLAYER_2); - }; - -- sounds - LoadActor( THEME:GetPathS("Common","start") )..{ - StartButtonMessageCommand=function(self) - self:play(); - end; - }; - LoadActor( THEME:GetPathS("Common","cancel") )..{ - BackButtonMessageCommand=function(self) - self:play(); - end; - }; - LoadActor( THEME:GetPathS("Common","value") )..{ - DirectionButtonMessageCommand=function(self) - self:play(); - end; - }; - }; -}; - -return t; +function GetLocalProfiles() + local ret = {}; + + for p = 0,PROFILEMAN:GetNumLocalProfiles()-1 do + local profile=PROFILEMAN:GetLocalProfileFromIndex(p); + local item = 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; + }; + LoadFont("Common Normal") .. { + InitCommand=function(self) + self:shadowlength(1); + self:y(8); + self:zoom(0.5); + self:vertspacing(-8); + self:ztest(true); + end; + BeginCommand=function(self) + local numSongsPlayed = profile:GetNumTotalSongsPlayed(); + local s = numSongsPlayed == 1 and "Song" or "Songs"; + self:settext( string.format(THEME:GetString("ScreenSelectProfile","%d "..s.." Played"),numSongsPlayed) ); + end; + }; + }; + table.insert( ret, item ); + end; + + return ret; +end; + +function LoadCard(cColor) + local t = Def.ActorFrame { + LoadActor( THEME:GetPathG("ScreenSelectProfile","CardBackground") ) .. { + InitCommand=function(self) + self:diffuse(cColor); + end; + }; + LoadActor( THEME:GetPathG("ScreenSelectProfile","CardFrame") ); + }; + return t +end +function LoadPlayerStuff(Player) + local ret = {}; + + local pn = (Player == PLAYER_1) and 1 or 2; + +--[[ local t = LoadActor(THEME:GetPathB('', '_frame 3x3'), 'metal', 200, 230) .. { + Name = 'BigFrame'; + }; --]] + local t = 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=THEME:GetString("ScreenSelectProfile","PressStart"); + 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; + }; + }; + table.insert( ret, t ); + + t = Def.ActorFrame { + Name = 'BigFrame'; + LoadCard(PlayerColor(Player)); + }; + table.insert( ret, t ); + +--[[ t = LoadActor(THEME:GetPathB('', '_frame 3x3'), 'metal', 170, 20) .. { + Name = 'SmallFrame'; + }; --]] + t = Def.ActorFrame { + Name = 'SmallFrame'; + + 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; + }; + 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; + }; + 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; + }; + 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; + }; + }; + table.insert( ret, t ); + + t = Def.ActorScroller{ + Name = 'ProfileScroller'; + NumItemsToDraw=6; + 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(); + }; + table.insert( ret, t ); + + t = Def.ActorFrame { + Name = "EffectFrame"; + --[[ Def.Quad { + InitCommand=cmd(y,-230/2;vertalign,top;zoomto,200,8;fadebottom,1); + OnCommand=cmd(diffuse,Color("Black");diffusealpha,0.25); + }; + Def.Quad { + InitCommand=cmd(y,230/2;vertalign,bottom;zoomto,200,8;fadetop,1); + OnCommand=cmd(diffuse,Color("Black");diffusealpha,0.25); + }; --]] + }; + table.insert( ret, t ); +--[[ t = Def.BitmapText { + OnCommand = cmd(y,160); + Name = 'SelectedProfileText'; + Font = "Common Normal"; + Text = 'No profile'; + }; --]] + t = LoadFont("Common Normal") .. { + Name = 'SelectedProfileText'; + InitCommand=cmd(y,160;shadowlength,1;); + }; + table.insert( ret, t ); + + return ret; +end; + +function UpdateInternal3(self, Player) + local pn = (Player == PLAYER_1) and 1 or 2; + local frame = self:GetChild(string.format('P%uFrame', pn)); + local scroller = frame:GetChild('ProfileScroller'); + local seltext = frame:GetChild('SelectedProfileText'); + local joinframe = frame:GetChild('JoinFrame'); + local smallframe = frame:GetChild('SmallFrame'); + local bigframe = frame:GetChild('BigFrame'); + + if GAMESTATE:IsHumanPlayer(Player) then + frame:visible(true); + if MEMCARDMAN:GetCardState(Player) == 'MemoryCardState_none' then + --using profile if any + joinframe:visible(false); + smallframe:visible(true); + bigframe:visible(true); + seltext:visible(true); + scroller:visible(true); + local ind = SCREENMAN:GetTopScreen():GetProfileIndex(Player); + if ind > 0 then + scroller:SetDestinationItem(ind-1); + seltext:settext(PROFILEMAN:GetLocalProfileFromIndex(ind-1):GetDisplayName()); + else + if SCREENMAN:GetTopScreen():SetProfileIndex(Player, 1) then + scroller:SetDestinationItem(0); + self:queuecommand('UpdateInternal2'); + else + joinframe:visible(true); + smallframe:visible(false); + bigframe:visible(false); + scroller:visible(false); + seltext:settext('No profile'); + end; + end; + else + --using card + smallframe:visible(false); + scroller:visible(false); + seltext:settext('CARD'); + SCREENMAN:GetTopScreen():SetProfileIndex(Player, 0); + end; + else + joinframe:visible(true); + scroller:visible(false); + seltext:visible(false); + smallframe:visible(false); + bigframe:visible(false); + end; +end; + +local t = Def.ActorFrame { + + StorageDevicesChangedMessageCommand=function(self, params) + self:queuecommand('UpdateInternal2'); + end; + + CodeMessageCommand = function(self, params) + if params.Name == 'Start' or params.Name == 'Center' then + MESSAGEMAN:Broadcast("StartButton"); + if not GAMESTATE:IsHumanPlayer(params.PlayerNumber) then + SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, -1); + else + SCREENMAN:GetTopScreen():Finish(); + end; + end; + if params.Name == 'Up' or params.Name == 'Up2' or params.Name == 'DownLeft' then + if GAMESTATE:IsHumanPlayer(params.PlayerNumber) then + local ind = SCREENMAN:GetTopScreen():GetProfileIndex(params.PlayerNumber); + if ind > 1 then + if SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, ind - 1 ) then + MESSAGEMAN:Broadcast("DirectionButton"); + self:queuecommand('UpdateInternal2'); + end; + end; + end; + end; + if params.Name == 'Down' or params.Name == 'Down2' or params.Name == 'DownRight' then + if GAMESTATE:IsHumanPlayer(params.PlayerNumber) then + local ind = SCREENMAN:GetTopScreen():GetProfileIndex(params.PlayerNumber); + if ind > 0 then + if SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, ind + 1 ) then + MESSAGEMAN:Broadcast("DirectionButton"); + self:queuecommand('UpdateInternal2'); + end; + end; + end; + end; + if params.Name == 'Back' then + if GAMESTATE:GetNumPlayersEnabled()==0 then + SCREENMAN:GetTopScreen():Cancel(); + else + MESSAGEMAN:Broadcast("BackButton"); + SCREENMAN:GetTopScreen():SetProfileIndex(params.PlayerNumber, -2); + end; + end; + end; + + PlayerJoinedMessageCommand=function(self, params) + self:queuecommand('UpdateInternal2'); + end; + + PlayerUnjoinedMessageCommand=function(self, params) + self:queuecommand('UpdateInternal2'); + end; + + OnCommand=function(self, params) + self:queuecommand('UpdateInternal2'); + end; + + UpdateInternal2Command=function(self) + UpdateInternal3(self, PLAYER_1); + UpdateInternal3(self, PLAYER_2); + end; + + children = { + Def.ActorFrame { + Name = 'P1Frame'; + 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 + (cmd(;zoom,1.15;bounceend,0.175;zoom,1.0;))(self); + end; + end; + children = LoadPlayerStuff(PLAYER_1); + }; + Def.ActorFrame { + Name = 'P2Frame'; + 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 + (cmd(zoom,1.15;bounceend,0.175;zoom,1.0;))(self); + end; + end; + children = LoadPlayerStuff(PLAYER_2); + }; + -- sounds + LoadActor( THEME:GetPathS("Common","start") )..{ + StartButtonMessageCommand=cmd(play); + }; + LoadActor( THEME:GetPathS("Common","cancel") )..{ + BackButtonMessageCommand=cmd(play); + }; + LoadActor( THEME:GetPathS("Common","value") )..{ + DirectionButtonMessageCommand=cmd(play); + }; + }; +}; + +return t; diff --git a/Themes/default/BGAnimations/ScreenWithMenuElements background/_particleLoader.lua b/Themes/default/BGAnimations/ScreenWithMenuElements background/_particleLoader.lua index 642dde0c63..e44c6cca0b 100644 --- a/Themes/default/BGAnimations/ScreenWithMenuElements background/_particleLoader.lua +++ b/Themes/default/BGAnimations/ScreenWithMenuElements background/_particleLoader.lua @@ -1,80 +1,74 @@ -local hideFancyElements = (ThemePrefs.Get("FancyUIBG") == false) -local t = Def.ActorFrame{}; -if hideFancyElements then return t; end - -local Params = { - NumParticles = 30, - VelocityXMin = 100, - VelocityXMax = 400, - VelocityYMin = 0, - VelocityYMax = 0, - VelocityZMin = 0, - VelocityZMax = 0, - BobRateZMin = 0.4, - BobRateZMax = 0.7, - ZoomMin = 0.5, - ZoomMax = 1, - SpinZ = 0, - BobZ = 52, - File = "_particle normal", -}; - -local tParticleInfo = {} - -for i=1,Params.NumParticles do - tParticleInfo[i] = { - X = math.random(Params.VelocityXMin, Params.VelocityXMax), - Y = Params.VelocityYMin ~= Params.VelocityYMax and math.random(Params.VelocityYMin, Params.VelocityYMax) or Params.VelocityYMin, - Z = Params.VelocityZMin ~= Params.VelocityZMax and math.random(Params.VelocityZMin, Params.VelocityZMax) or Params.VelocityZMin, - Zoom = math.random(Params.ZoomMin*1000,Params.ZoomMax*1000) / 1000, - BobZRate = math.random(Params.BobRateZMin*1000,Params.BobRateZMax*1000) / 1000, - Age = 0, - }; - t[#t+1] = LoadActor( Params.File )..{ - Name="Particle"..i; - InitCommand=function(self) - self:basezoom(tParticleInfo[i].Zoom); - self:x(math.random(SCREEN_LEFT+(self:GetWidth()/2),SCREEN_RIGHT-(self:GetWidth()/2))); - self:y(math.random(SCREEN_TOP+(self:GetHeight()/2),SCREEN_BOTTOM-(self:GetHeight()/2))); - --self:z(math.random(-64,0)); - end; - OnCommand=function(self) - self:diffuse(ColorLightTone(color("#ffd400"))); - self:diffusealpha(0.8); - end; - }; -end - -local function UpdateParticles(self,DeltaTime) - tParticles = self:GetChildren(); - for i=1, Params.NumParticles do - local p = tParticles["Particle"..i]; - local vX = tParticleInfo[i].X; - local vY = tParticleInfo[i].Y; - local vZ = tParticleInfo[i].Z; - tParticleInfo[i].Age = tParticleInfo[i].Age + DeltaTime; - p:x(p:GetX() + (vX * DeltaTime)); - p:y(p:GetY() + (vY * DeltaTime)); - p:z(p:GetZ() + (vZ * DeltaTime)); --- p:zoom( 1 + math.cos( --- (tParticleInfo[i].Age * math.pi*2) --- ) * 0.125 ); - if p:GetX() > SCREEN_RIGHT + (p:GetWidth()/2 - p:GetZ()) then - p:x(SCREEN_LEFT - (p:GetWidth()/2)); - elseif p:GetX() < SCREEN_LEFT - (p:GetWidth()/2 - p:GetZ()) then - p:x(SCREEN_RIGHT + (p:GetWidth()/2)); - end - if p:GetY() > SCREEN_BOTTOM + (p:GetHeight()/2 - p:GetZ()) then - p:y(SCREEN_TOP - (p:GetHeight()/2)); - elseif p:GetY() < SCREEN_TOP - (p:GetHeight()/2 - p:GetZ()) then - p:y(SCREEN_BOTTOM + (p:GetHeight()/2)); - end - end; -end; - -t.InitCommand = function(self) - self:fov(90); - self:SetUpdateFunction(UpdateParticles); -end; - -return t; +local hideFancyElements = (ThemePrefs.Get("FancyUIBG") == false) +local t = Def.ActorFrame{}; +if hideFancyElements then return t; end + +local Params = { + NumParticles = 30, + VelocityXMin = 100, + VelocityXMax = 400, + VelocityYMin = 0, + VelocityYMax = 0, + VelocityZMin = 0, + VelocityZMax = 0, + BobRateZMin = 0.4, + BobRateZMax = 0.7, + ZoomMin = 0.5, + ZoomMax = 1, + SpinZ = 0, + BobZ = 52, + File = "_particle normal", +}; + +local tParticleInfo = {} + +for i=1,Params.NumParticles do + tParticleInfo[i] = { + X = math.random(Params.VelocityXMin, Params.VelocityXMax), + Y = Params.VelocityYMin ~= Params.VelocityYMax and math.random(Params.VelocityYMin, Params.VelocityYMax) or Params.VelocityYMin, + Z = Params.VelocityZMin ~= Params.VelocityZMax and math.random(Params.VelocityZMin, Params.VelocityZMax) or Params.VelocityZMin, + Zoom = math.random(Params.ZoomMin*1000,Params.ZoomMax*1000) / 1000, + BobZRate = math.random(Params.BobRateZMin*1000,Params.BobRateZMax*1000) / 1000, + Age = 0, + }; + t[#t+1] = LoadActor( Params.File )..{ + Name="Particle"..i; + InitCommand=function(self) + self:basezoom(tParticleInfo[i].Zoom); + self:x(math.random(SCREEN_LEFT+(self:GetWidth()/2),SCREEN_RIGHT-(self:GetWidth()/2))); + self:y(math.random(SCREEN_TOP+(self:GetHeight()/2),SCREEN_BOTTOM-(self:GetHeight()/2))); + --self:z(math.random(-64,0)); + end; + OnCommand=cmd(diffuse,ColorLightTone(color("#ffd400"));diffusealpha,0.8); + }; +end + +local function UpdateParticles(self,DeltaTime) + tParticles = self:GetChildren(); + for i=1, Params.NumParticles do + local p = tParticles["Particle"..i]; + local vX = tParticleInfo[i].X; + local vY = tParticleInfo[i].Y; + local vZ = tParticleInfo[i].Z; + tParticleInfo[i].Age = tParticleInfo[i].Age + DeltaTime; + p:x(p:GetX() + (vX * DeltaTime)); + p:y(p:GetY() + (vY * DeltaTime)); + p:z(p:GetZ() + (vZ * DeltaTime)); +-- p:zoom( 1 + math.cos( +-- (tParticleInfo[i].Age * math.pi*2) +-- ) * 0.125 ); + if p:GetX() > SCREEN_RIGHT + (p:GetWidth()/2 - p:GetZ()) then + p:x(SCREEN_LEFT - (p:GetWidth()/2)); + elseif p:GetX() < SCREEN_LEFT - (p:GetWidth()/2 - p:GetZ()) then + p:x(SCREEN_RIGHT + (p:GetWidth()/2)); + end + if p:GetY() > SCREEN_BOTTOM + (p:GetHeight()/2 - p:GetZ()) then + p:y(SCREEN_TOP - (p:GetHeight()/2)); + elseif p:GetY() < SCREEN_TOP - (p:GetHeight()/2 - p:GetZ()) then + p:y(SCREEN_BOTTOM + (p:GetHeight()/2)); + end + end; +end; + +t.InitCommand = cmd(fov,90;SetUpdateFunction,UpdateParticles); + +return t; diff --git a/Themes/default/Graphics/LifeMeterBattery lives/default.lua b/Themes/default/Graphics/LifeMeterBattery lives/default.lua index f5dabc9449..8fd1c40f0e 100755 --- a/Themes/default/Graphics/LifeMeterBattery lives/default.lua +++ b/Themes/default/Graphics/LifeMeterBattery lives/default.lua @@ -1,49 +1,43 @@ -local player = Var "Player" -local blinkTime = 1.2 -local barWidth = 256; -local barHeight = 32; -local c; -local LifeMeter, MaxLives, CurLives; -local LifeRatio; - -local t = Def.ActorFrame { - LoadActor("_lives")..{ - InitCommand=function(self) - self:pause(); - self:horizalign(left); - self:x(barWidth / -2); - end; - BeginCommand=function(self,param) - local screen = SCREENMAN:GetTopScreen(); - local glifemeter = screen:GetLifeMeter(player); - self:setstate(glifemeter:GetTotalLives()-1); - - if glifemeter:GetTotalLives() <= 4 then - self:zoomx(barWidth/(4*64)); - else - self:zoomx(barWidth/((glifemeter:GetTotalLives())*64)); - end - self:cropright((640-(((glifemeter:GetTotalLives())*64)))/640); - end; - LifeChangedMessageCommand=function(self,param) - if param.Player == player then - if param.LivesLeft == 0 then - self:visible(false) - else - self:setstate( math.max(param.LivesLeft-1,0) ) - self:visible(true) - end - end - end; - StartCommand=function(self,param) - if param.Player == player then - self:setstate( math.max(param.LivesLeft-1,0) ); - end - end; - FinishCommand=function(self) - self:playcommand("Start"); - end; - }; -}; - +local player = Var "Player" +local blinkTime = 1.2 +local barWidth = 256; +local barHeight = 32; +local c; +local LifeMeter, MaxLives, CurLives; +local LifeRatio; + +local t = Def.ActorFrame { + LoadActor("_lives")..{ + InitCommand=cmd(pause;horizalign,left;x,-(barWidth/2)); + BeginCommand=function(self,param) + local screen = SCREENMAN:GetTopScreen(); + local glifemeter = screen:GetLifeMeter(player); + self:setstate(glifemeter:GetTotalLives()-1); + + if glifemeter:GetTotalLives() <= 4 then + self:zoomx(barWidth/(4*64)); + else + self:zoomx(barWidth/((glifemeter:GetTotalLives())*64)); + end + self:cropright((640-(((glifemeter:GetTotalLives())*64)))/640); + end; + LifeChangedMessageCommand=function(self,param) + if param.Player == player then + if param.LivesLeft == 0 then + self:visible(false) + else + self:setstate( math.max(param.LivesLeft-1,0) ) + self:visible(true) + end + end + end; + StartCommand=function(self,param) + if param.Player == player then + self:setstate( math.max(param.LivesLeft-1,0) ); + end + end; + FinishCommand=cmd(playcommand,"Start"); + }; +}; + return t; \ No newline at end of file diff --git a/Themes/default/Graphics/PaneDisplay text.lua b/Themes/default/Graphics/PaneDisplay text.lua index 3e8c4ca4d1..1c07882473 100644 --- a/Themes/default/Graphics/PaneDisplay text.lua +++ b/Themes/default/Graphics/PaneDisplay text.lua @@ -1,236 +1,161 @@ -local iPN = ...; -assert(iPN,"[Graphics/PaneDisplay text.lua] No PlayerNumber Provided."); - -local t = Def.ActorFrame {}; -local function GetRadarData( pnPlayer, rcRadarCategory ) - local tRadarValues; - local StepsOrTrail; - local fDesiredValue = 0; - if GAMESTATE:GetCurrentSteps( pnPlayer ) then - StepsOrTrail = GAMESTATE:GetCurrentSteps( pnPlayer ); - fDesiredValue = StepsOrTrail:GetRadarValues( pnPlayer ):GetValue( rcRadarCategory ); - elseif GAMESTATE:GetCurrentTrail( pnPlayer ) then - StepsOrTrail = GAMESTATE:GetCurrentTrail( pnPlayer ); - fDesiredValue = StepsOrTrail:GetRadarValues( pnPlayer ):GetValue( rcRadarCategory ); - else - StepsOrTrail = nil; - end; - return fDesiredValue; -end; - -local function CreatePaneDisplayItem( _pnPlayer, _sLabel, _rcRadarCategory ) - return Def.ActorFrame { - LoadFont("Common SemiBold") .. { - Text=string.upper( THEME:GetString("PaneDisplay",_sLabel) ); - InitCommand=function(self) - self:horizalign(left); - end; - OnCommand=function(self) - self:zoom(0.5875); - self:diffuse(color("0.9,0.9,0.9")); - self:shadowlength(1); - end; - }; - LoadFont("Common Normal") .. { - Text=string.format("%04i", 0); - InitCommand=function(self) - self:x(96); - self:horizalign(right); - end; - OnCommand=function(self) - self:zoom(0.5875); - self:shadowlength(1); - end; - CurrentSongChangedMessageCommand=function(self) - self:playcommand("Set"); - end; - CurrentStepsP1ChangedMessageCommand=function(self) - self:playcommand("Set"); - end; - CurrentStepsP2ChangedMessageCommand=function(self) - self:playcommand("Set"); - end; - CurrentTrailP1ChangedMessageCommand=function(self) - self:playcommand("Set"); - end; - CurrentTrailP2ChangedMessageCommand=function(self) - self:playcommand("Set"); - end; - CurrentCourseChangedMessageCommand=function(self) - self:playcommand("Set"); - end; - SetCommand=function(self) - local song = GAMESTATE:GetCurrentSong() - local course = GAMESTATE:GetCurrentCourse() - if not song and not course then - self:settextf("%04i", 0); - else - self:settextf("%04i", GetRadarData( _pnPlayer, _rcRadarCategory ) ); - end - end; - }; - }; -end; - -local function CreatePaneDisplayGraph( _pnPlayer, _sLabel, _rcRadarCategory ) - return Def.ActorFrame { - LoadFont("Common Normal") .. { - Text=_sLabel; - InitCommand=function(self) - self:horizalign(left); - end; - OnCommand=function(self) - self:zoom(0.5); - self:shadowlength(1); - end; - }; - Def.Quad { - InitCommand=function(self) - self:x(12); - self:zoomto(50, 10); - self:horizalign(left); - end; - OnCommand=function(self) - self:diffuse(Color("Black")); - self:shadowlength(1); - self:diffusealpha(0.5); - end; - }; - Def.Quad { - InitCommand=function(self) - self:x(12); - self:zoomto(50, 10); - self:horizalign(left); - end; - OnCommand=function(self) - self:shadowlength(0); - self:diffuse(Color("Green")); - self:diffusebottomedge(ColorLightTone(Color("Green"))); - end; - CurrentSongChangedMessageCommand=function(self) - self:playcommand("Set"); - end; - CurrentStepsP1ChangedMessageCommand=function(self) - self:playcommand("Set"); - end; - CurrentStepsP2ChangedMessageCommand=function(self) - self:playcommand("Set"); - end; - CurrentTrailP1ChangedMessageCommand=function(self) - self:playcommand("Set"); - end; - CurrentTrailP2ChangedMessageCommand=function(self) - self:playcommand("Set"); - end; - CurrentCourseChangedMessageCommand=function(self) - self:playcommand("Set"); - end; - SetCommand=function(self) - local song = GAMESTATE:GetCurrentSong() - local course = GAMESTATE:GetCurrentCourse() - if not song and not course then - self:stoptweening(); - self:decelerate(0.2); - self:zoomtowidth(0); - else - self:stoptweening(); - self:decelerate(0.2); - self:zoomtowidth( clamp(GetRadarData( _pnPlayer, _rcRadarCategory ) * 50,0,50) ); - end - end; - }; - LoadFont("Common Normal") .. { - InitCommand=function(self) - self:x(14); - self:zoom(0.5); - self:halign(0); - end; - OnCommand=function(self) - self:shadowlength(1); - self:strokecolor(color("0.15,0.15,0.15,0.625")); - end; - CurrentSongChangedMessageCommand=function(self) - self:playcommand("Set"); - end; - CurrentStepsP1ChangedMessageCommand=function(self) - self:playcommand("Set"); - end; - CurrentStepsP2ChangedMessageCommand=function(self) - self:playcommand("Set"); - end; - CurrentTrailP1ChangedMessageCommand=function(self) - self:playcommand("Set"); - end; - CurrentTrailP2ChangedMessageCommand=function(self) - self:playcommand("Set"); - end; - CurrentCourseChangedMessageCommand=function(self) - self:playcommand("Set"); - end; - SetCommand=function(self) - local song = GAMESTATE:GetCurrentSong() - local course = GAMESTATE:GetCurrentCourse() - if not song and not course then - self:settext("") - else - self:settextf("%i%%", GetRadarData( _pnPlayer, _rcRadarCategory ) * 100 ); - end - end; - }; - }; -end; - ---[[ Numbers ]] -t[#t+1] = Def.ActorFrame { - -- Left - CreatePaneDisplayItem( iPN, "Taps", 'RadarCategory_TapsAndHolds' ) .. { - InitCommand=function(self) - self:x(-128 + 16 + 8); - self:y(-14 + 16 * 0); - end; - }; - CreatePaneDisplayItem( iPN, "Jumps", 'RadarCategory_Jumps' ) .. { - InitCommand=function(self) - self:x(-128 + 16 + 8); - self:y(-14 + 16 * 1); - end; - }; - CreatePaneDisplayItem( iPN, "Holds", 'RadarCategory_Holds' ) .. { - InitCommand=function(self) - self:x(-128 + 16 + 8); - self:y(-14 + 16 * 2); - end; - }; - CreatePaneDisplayItem( iPN, "Mines", 'RadarCategory_Mines' ) .. { - InitCommand=function(self) - self:x(-128 + 16 + 8); - self:y(-14 + 16 * 3); - end; - }; - -- Center - CreatePaneDisplayItem( iPN, "Hands", 'RadarCategory_Hands' ) .. { - InitCommand=function(self) - self:x(8); - self:y(-14 + 16 * 0); - end; - }; - CreatePaneDisplayItem( iPN, "Rolls", 'RadarCategory_Rolls' ) .. { - InitCommand=function(self) - self:x(8); - self:y(-14 + 16 * 1); - end; - }; - CreatePaneDisplayItem( iPN, "Lifts", 'RadarCategory_Lifts' ) .. { - InitCommand=function(self) - self:x(8); - self:y(-14 + 16 * 2); - end; - }; - CreatePaneDisplayItem( iPN, "Fakes", 'RadarCategory_Fakes' ) .. { - InitCommand=function(self) - self:x(8); - self:y(-14 + 16 * 3); - end; - }; -}; +local iPN = ...; +assert(iPN,"[Graphics/PaneDisplay text.lua] No PlayerNumber Provided."); + +local t = Def.ActorFrame {}; +local function GetRadarData( pnPlayer, rcRadarCategory ) + local tRadarValues; + local StepsOrTrail; + local fDesiredValue = 0; + if GAMESTATE:GetCurrentSteps( pnPlayer ) then + StepsOrTrail = GAMESTATE:GetCurrentSteps( pnPlayer ); + fDesiredValue = StepsOrTrail:GetRadarValues( pnPlayer ):GetValue( rcRadarCategory ); + elseif GAMESTATE:GetCurrentTrail( pnPlayer ) then + StepsOrTrail = GAMESTATE:GetCurrentTrail( pnPlayer ); + fDesiredValue = StepsOrTrail:GetRadarValues( pnPlayer ):GetValue( rcRadarCategory ); + else + StepsOrTrail = nil; + end; + return fDesiredValue; +end; + +local function CreatePaneDisplayItem( _pnPlayer, _sLabel, _rcRadarCategory ) + return Def.ActorFrame { + LoadFont("Common SemiBold") .. { + Text=string.upper( THEME:GetString("PaneDisplay",_sLabel) ); + InitCommand=function(self) + self:horizalign(left); + end; + OnCommand=function(self) + self:zoom(0.5875); + self:diffuse(color("0.9,0.9,0.9")); + self:shadowlength(1); + end; + }; + LoadFont("Common Normal") .. { + Text=string.format("%04i", 0); + InitCommand=function(self) + self:x(96); + InitCommand=cmd(x,96;horizalign,right); + OnCommand=cmd(zoom,0.5875;shadowlength,1); + CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); + CurrentStepsP1ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentStepsP2ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); + SetCommand=function(self) + local song = GAMESTATE:GetCurrentSong() + local course = GAMESTATE:GetCurrentCourse() + if not song and not course then + self:settextf("%04i", 0); + else + self:settextf("%04i", GetRadarData( _pnPlayer, _rcRadarCategory ) ); + end + end; + }; + }; +end; + +local function CreatePaneDisplayGraph( _pnPlayer, _sLabel, _rcRadarCategory ) + return Def.ActorFrame { + LoadFont("Common Normal") .. { + Text=_sLabel; + InitCommand=function(self) + self:horizalign(left); + end; + OnCommand=function(self) + self:zoom(0.5); + self:shadowlength(1); + end; + }; + Def.Quad { + InitCommand=function(self) + self:x(12); + self:zoomto(50, 10); + self:horizalign(left); + end; + OnCommand=function(self) + self:diffuse(Color("Black")); + self:shadowlength(1); + self:diffusealpha(0.5); + end; + }; + Def.Quad { + InitCommand=function(self) + self:x(12); + InitCommand=cmd(x,12;zoomto,50,10;horizalign,left); + OnCommand=cmd(shadowlength,0;diffuse,Color("Green");diffusebottomedge,ColorLightTone(Color("Green"))); + CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); + CurrentStepsP1ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentStepsP2ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); + SetCommand=function(self) + local song = GAMESTATE:GetCurrentSong() + local course = GAMESTATE:GetCurrentCourse() + if not song and not course then + self:stoptweening(); + self:decelerate(0.2); + self:zoomtowidth(0); + else + self:stoptweening(); + self:decelerate(0.2); + self:zoomtowidth( clamp(GetRadarData( _pnPlayer, _rcRadarCategory ) * 50,0,50) ); + end + end; + }; + LoadFont("Common Normal") .. { + InitCommand=function(self) + self:x(14); + InitCommand=cmd(x,14;zoom,0.5;halign,0;); + OnCommand=cmd(shadowlength,1;strokecolor,color("0.15,0.15,0.15,0.625")); + CurrentSongChangedMessageCommand=cmd(playcommand,"Set"); + CurrentStepsP1ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentStepsP2ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set"); + CurrentCourseChangedMessageCommand=cmd(playcommand,"Set"); + SetCommand=function(self) + local song = GAMESTATE:GetCurrentSong() + local course = GAMESTATE:GetCurrentCourse() + if not song and not course then + self:settext("") + else + self:settextf("%i%%", GetRadarData( _pnPlayer, _rcRadarCategory ) * 100 ); + end + end; + }; + }; +end; + +--[[ Numbers ]] +t[#t+1] = Def.ActorFrame { + -- Left + CreatePaneDisplayItem( iPN, "Taps", 'RadarCategory_TapsAndHolds' ) .. { + InitCommand=cmd(x,-128+16+8;y,-14); + }; + CreatePaneDisplayItem( iPN, "Jumps", 'RadarCategory_Jumps' ) .. { + InitCommand=cmd(x,-128+16+8;y,-14+16); + }; + CreatePaneDisplayItem( iPN, "Holds", 'RadarCategory_Holds' ) .. { + InitCommand=cmd(x,-128+16+8;y,-14+16*2); + }; + CreatePaneDisplayItem( iPN, "Mines", 'RadarCategory_Mines' ) .. { + InitCommand=cmd(x,-128+16+8;y,-14+16*3); + }; + -- Center + CreatePaneDisplayItem( iPN, "Hands", 'RadarCategory_Hands' ) .. { + InitCommand=cmd(x,8;y,-14); + }; + CreatePaneDisplayItem( iPN, "Rolls", 'RadarCategory_Rolls' ) .. { + InitCommand=cmd(x,8;y,-14+16); + }; + CreatePaneDisplayItem( iPN, "Lifts", 'RadarCategory_Lifts' ) .. { + InitCommand=cmd(x,8;y,-14+16*2); + }; + CreatePaneDisplayItem( iPN, "Fakes", 'RadarCategory_Fakes' ) .. { + InitCommand=cmd(x,8;y,-14+16*3); + }; +}; return t; \ No newline at end of file diff --git a/Themes/default/Graphics/Player judgment/default.lua b/Themes/default/Graphics/Player judgment/default.lua index 1752db4ec7..4cb0edcb90 100644 --- a/Themes/default/Graphics/Player judgment/default.lua +++ b/Themes/default/Graphics/Player judgment/default.lua @@ -1,370 +1,255 @@ -local c; -local player = Var "Player"; -local function ShowProtiming() - if GAMESTATE:IsDemonstration() then - return false - else - return GetUserPrefB("UserPrefProtiming" .. ToEnumShortString(player)); - end -end; -local bShowProtiming = ShowProtiming(); -local ProtimingWidth = 240; -local function MakeAverage( t ) - local sum = 0; - for i=1,#t do - sum = sum + t[i]; - end - return sum / #t -end - -local tTotalJudgments = {}; - -local JudgeCmds = { - TapNoteScore_W1 = THEME:GetMetric( "Judgment", "JudgmentW1Command" ); - TapNoteScore_W2 = THEME:GetMetric( "Judgment", "JudgmentW2Command" ); - TapNoteScore_W3 = THEME:GetMetric( "Judgment", "JudgmentW3Command" ); - TapNoteScore_W4 = THEME:GetMetric( "Judgment", "JudgmentW4Command" ); - TapNoteScore_W5 = THEME:GetMetric( "Judgment", "JudgmentW5Command" ); - TapNoteScore_Miss = THEME:GetMetric( "Judgment", "JudgmentMissCommand" ); -}; - -local ProtimingCmds = { - TapNoteScore_W1 = THEME:GetMetric( "Protiming", "ProtimingW1Command" ); - TapNoteScore_W2 = THEME:GetMetric( "Protiming", "ProtimingW2Command" ); - TapNoteScore_W3 = THEME:GetMetric( "Protiming", "ProtimingW3Command" ); - TapNoteScore_W4 = THEME:GetMetric( "Protiming", "ProtimingW4Command" ); - TapNoteScore_W5 = THEME:GetMetric( "Protiming", "ProtimingW5Command" ); - TapNoteScore_Miss = THEME:GetMetric( "Protiming", "ProtimingMissCommand" ); -}; - -local AverageCmds = { - Pulse = THEME:GetMetric( "Protiming", "AveragePulseCommand" ); -}; -local TextCmds = { - Pulse = THEME:GetMetric( "Protiming", "TextPulseCommand" ); -}; - -local TNSFrames = { - TapNoteScore_W1 = 0; - TapNoteScore_W2 = 1; - TapNoteScore_W3 = 2; - TapNoteScore_W4 = 3; - TapNoteScore_W5 = 4; - TapNoteScore_Miss = 5; -}; -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; - OnCommand=THEME:GetMetric("Judgment","JudgmentOnCommand"); - ResetCommand=function(self) - self:finishtweening(); - self:stopeffect(); - self:visible(false); - end; - }; - LoadFont("Combo Numbers") .. { - Name="ProtimingDisplay"; - Text=""; - InitCommand=function(self) - self:visible(false); - end; - OnCommand=THEME:GetMetric("Protiming","ProtimingOnCommand"); - ResetCommand=function(self) - self:finishtweening(); - self:stopeffect(); - self:visible(false); - end; - }; - LoadFont("Common Normal") .. { - Name="ProtimingAverage"; - Text=""; - InitCommand=function(self) - self:visible(false); - end; - OnCommand=THEME:GetMetric("Protiming","AverageOnCommand"); - ResetCommand=function(self) - self:finishtweening(); - self:stopeffect(); - self:visible(false); - end; - }; - LoadFont("Common Normal") .. { - Name="TextDisplay"; - Text=THEME:GetString("Protiming","MS"); - InitCommand=function(self) - self:visible(false); - end; - OnCommand=THEME:GetMetric("Protiming","TextOnCommand"); - ResetCommand=function(self) - self:finishtweening(); - self:stopeffect(); - self:visible(false); - end; - }; - Def.Quad { - Name="ProtimingGraphBG"; - InitCommand=function(self) - self:visible(false); - self:y(32); - self:zoomto(ProtimingWidth, 16); - end; - ResetCommand=function(self) - self:finishtweening(); - self:diffusealpha(0.8); - self:visible(false); - end; - OnCommand=function(self) - self:diffuse(Color("Black")); - self:diffusetopedge(color("0.1,0.1,0.1,1")); - self:diffusealpha(0.8); - self:shadowlength(2); - end; - }; - Def.Quad { - Name="ProtimingGraphWindowW3"; - InitCommand=function(self) - self:visible(false); - self:y(32); - self:zoomto(ProtimingWidth - 4, 16 - 4); - end; - ResetCommand=function(self) - self:finishtweening(); - self:diffusealpha(1); - self:visible(false); - end; - OnCommand=function(self) - self:diffuse(GameColor.Judgment["JudgmentLine_W3"]); - end; - }; - Def.Quad { - Name="ProtimingGraphWindowW2"; - InitCommand=function(self) - self:visible(false); - self:y(32); - self:zoomto(scale( - PREFSMAN:GetPreference("TimingWindowSecondsW2"), - 0, - PREFSMAN:GetPreference("TimingWindowSecondsW3"), - 0, - ProtimingWidth-4),16-4); - end; - ResetCommand=function(self) - self:finishtweening(); - self:diffusealpha(1); - self:visible(false); - end; - OnCommand=function(self) - self:diffuse(GameColor.Judgment["JudgmentLine_W2"]); - end; - }; - Def.Quad { - Name="ProtimingGraphWindowW1"; - InitCommand=function(self) - self:visible(false); - self:y(32); - self:zoomto(scale( - PREFSMAN:GetPreference("TimingWindowSecondsW1"), - 0, - PREFSMAN:GetPreference("TimingWindowSecondsW3"), - 0, - ProtimingWidth-4),16-4); - end; - ResetCommand=function(self) - self:finishtweening(); - self:diffusealpha(1); - self:visible(false); - end; - OnCommand=function(self) - self:diffuse(GameColor.Judgment["JudgmentLine_W1"]); - end; - }; - Def.Quad { - Name="ProtimingGraphUnderlay"; - InitCommand=function(self) - self:visible(false); - self:y(32); - self:zoomto(ProtimingWidth-4,16-4); - end; - ResetCommand=function(self) - self:finishtweening(); - self:diffusealpha(0.25); - self:visible(false); - end; - OnCommand=function(self) - self:diffuse(Color("Black")); - self:diffusealpha(0.25); - end; - }; - Def.Quad { - Name="ProtimingGraphFill"; - InitCommand=function(self) - self:visible(false); - self:y(32); - self:zoomto(0,16-4); - self:horizalign(left); - end; - ResetCommand=function(self) - self:finishtweening(); - self:diffusealpha(1); - self:visible(false); - end; - OnCommand=function(self) - self:diffuse(Color("Red")); - end; - }; - Def.Quad { - Name="ProtimingGraphAverage"; - InitCommand=function(self) - self:visible(false); - self:y(32); - self:zoomto(2,7); - end; - ResetCommand=function(self) - self:finishtweening(); - self:diffusealpha(0.85); - self:visible(false); - end; - OnCommand=function(self) - self:diffuse(Color("Orange")); - self:diffusealpha(0.85); - end; - }; - Def.Quad { - Name="ProtimingGraphCenter"; - InitCommand=function(self) - self:visible(false); - self:y(32); - self:zoomto(2,16-4); - end; - ResetCommand=function(self) - self:finishtweening(); - self:diffusealpha(1); - self:visible(false); - end; - OnCommand=function(self) - self:diffuse(Color("White")); - self:diffusealpha(1); - end; - }; - InitCommand = function(self) - c = self:GetChildren(); - end; - - JudgmentMessageCommand=function(self, param) - -- Fix Player Combo animating when player successfully avoids a mine. - local msgParam = param; - MESSAGEMAN:Broadcast("TestJudgment",msgParam); - -- - if param.Player ~= player then return end; - if param.HoldNoteScore then return end; - - local iNumStates = c.Judgment:GetNumStates(); - local iFrame = TNSFrames[param.TapNoteScore]; - - if not iFrame then return end - if iNumStates == 12 then - iFrame = iFrame * 2; - if not param.Early then - iFrame = iFrame + 1; - end - end - - - local fTapNoteOffset = param.TapNoteOffset; - if param.HoldNoteScore then - fTapNoteOffset = 1; - else - fTapNoteOffset = param.TapNoteOffset; - end - - if param.TapNoteScore == 'TapNoteScore_Miss' then - fTapNoteOffset = 1; - bUseNegative = true; - else --- fTapNoteOffset = fTapNoteOffset; - bUseNegative = false; - end; - - if fTapNoteOffset ~= 1 then - -- we're safe, you can push the values - tTotalJudgments[#tTotalJudgments+1] = math.abs(fTapNoteOffset); ---~ tTotalJudgments[#tTotalJudgments+1] = bUseNegative and fTapNoteOffset or math.abs( fTapNoteOffset ); - end - - self:playcommand("Reset"); - - c.Judgment:visible( not bShowProtiming ); - c.Judgment:setstate( iFrame ); - JudgeCmds[param.TapNoteScore](c.Judgment); - - c.ProtimingDisplay:visible( bShowProtiming ); - c.ProtimingDisplay:settextf("%i",fTapNoteOffset * 1000); - ProtimingCmds[param.TapNoteScore](c.ProtimingDisplay); - - c.ProtimingAverage:visible( bShowProtiming ); - c.ProtimingAverage:settextf("%.2f%%",clamp(100 - MakeAverage( tTotalJudgments ) * 1000 ,0,100)); - AverageCmds['Pulse'](c.ProtimingAverage); - - c.TextDisplay:visible( bShowProtiming ); - TextCmds['Pulse'](c.TextDisplay); - - c.ProtimingGraphBG:visible( bShowProtiming ); - c.ProtimingGraphUnderlay:visible( bShowProtiming ); - c.ProtimingGraphWindowW3:visible( bShowProtiming ); - c.ProtimingGraphWindowW2:visible( bShowProtiming ); - c.ProtimingGraphWindowW1:visible( bShowProtiming ); - c.ProtimingGraphFill:visible( bShowProtiming ); - c.ProtimingGraphFill:finishtweening(); - c.ProtimingGraphFill:decelerate(1/60); - c.ProtimingGraphFill:zoomtowidth( clamp( - scale( - fTapNoteOffset, - 0,PREFSMAN:GetPreference("TimingWindowSecondsW3"), - 0,(ProtimingWidth-4)/2), - -(ProtimingWidth-4)/2,(ProtimingWidth-4)/2) - ); - c.ProtimingGraphAverage:visible( bShowProtiming ); - c.ProtimingGraphAverage:zoomtowidth( clamp( - scale( - MakeAverage( tTotalJudgments ), - 0,PREFSMAN:GetPreference("TimingWindowSecondsW3"), - 0,ProtimingWidth-4), - 0,ProtimingWidth-4) - ); --- c.ProtimingGraphAverage:zoomtowidth( clamp(MakeAverage( tTotalJudgments ) * 1880,0,188) ); - c.ProtimingGraphCenter:visible( bShowProtiming ); - c.ProtimingGraphBG.sleep(2); - c.ProtimingGraphBG.linear(0.5); - c.ProtimingGraphBG.diffusealpha(0); - c.ProtimingGraphUnderlay.sleep(2); - c.ProtimingGraphUnderlay.linear(0.5); - c.ProtimingGraphUnderlay.diffusealpha(0); - c.ProtimingGraphWindowW3.sleep(2); - c.ProtimingGraphWindowW3.linear(0.5); - c.ProtimingGraphWindowW3.diffusealpha(0); - c.ProtimingGraphWindowW2.sleep(2); - c.ProtimingGraphWindowW2.linear(0.5); - c.ProtimingGraphWindowW2.diffusealpha(0); - c.ProtimingGraphWindowW1.sleep(2); - c.ProtimingGraphWindowW1.linear(0.5); - c.ProtimingGraphWindowW1.diffusealpha(0); - c.ProtimingGraphFill.sleep(2); - c.ProtimingGraphFill.linear(0.5); - c.ProtimingGraphFill.diffusealpha(0); - c.ProtimingGraphAverage.sleep(2); - c.ProtimingGraphAverage.linear(0.5); - c.ProtimingGraphAverage.diffusealpha(0); - c.ProtimingGraphCenter.sleep(2); - c.ProtimingGraphCenter.linear(0.5); - c.ProtimingGraphCenter.diffusealpha(0); - end; - -}; - - -return t; +local c; +local player = Var "Player"; +local function ShowProtiming() + if GAMESTATE:IsDemonstration() then + return false + else + return GetUserPrefB("UserPrefProtiming" .. ToEnumShortString(player)); + end +end; +local bShowProtiming = ShowProtiming(); +local ProtimingWidth = 240; +local function MakeAverage( t ) + local sum = 0; + for i=1,#t do + sum = sum + t[i]; + end + return sum / #t +end + +local tTotalJudgments = {}; + +local JudgeCmds = { + TapNoteScore_W1 = THEME:GetMetric( "Judgment", "JudgmentW1Command" ); + TapNoteScore_W2 = THEME:GetMetric( "Judgment", "JudgmentW2Command" ); + TapNoteScore_W3 = THEME:GetMetric( "Judgment", "JudgmentW3Command" ); + TapNoteScore_W4 = THEME:GetMetric( "Judgment", "JudgmentW4Command" ); + TapNoteScore_W5 = THEME:GetMetric( "Judgment", "JudgmentW5Command" ); + TapNoteScore_Miss = THEME:GetMetric( "Judgment", "JudgmentMissCommand" ); +}; + +local ProtimingCmds = { + TapNoteScore_W1 = THEME:GetMetric( "Protiming", "ProtimingW1Command" ); + TapNoteScore_W2 = THEME:GetMetric( "Protiming", "ProtimingW2Command" ); + TapNoteScore_W3 = THEME:GetMetric( "Protiming", "ProtimingW3Command" ); + TapNoteScore_W4 = THEME:GetMetric( "Protiming", "ProtimingW4Command" ); + TapNoteScore_W5 = THEME:GetMetric( "Protiming", "ProtimingW5Command" ); + TapNoteScore_Miss = THEME:GetMetric( "Protiming", "ProtimingMissCommand" ); +}; + +local AverageCmds = { + Pulse = THEME:GetMetric( "Protiming", "AveragePulseCommand" ); +}; +local TextCmds = { + Pulse = THEME:GetMetric( "Protiming", "TextPulseCommand" ); +}; + +local TNSFrames = { + TapNoteScore_W1 = 0; + TapNoteScore_W2 = 1; + TapNoteScore_W3 = 2; + TapNoteScore_W4 = 3; + TapNoteScore_W5 = 4; + TapNoteScore_Miss = 5; +}; +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; + OnCommand=THEME:GetMetric("Judgment","JudgmentOnCommand"); + ResetCommand=cmd(finishtweening;stopeffect;visible,false); + }; + LoadFont("Combo Numbers") .. { + Name="ProtimingDisplay"; + Text=""; + InitCommand=function(self) + self:visible(false); + end; + OnCommand=THEME:GetMetric("Protiming","ProtimingOnCommand"); + ResetCommand=cmd(finishtweening;stopeffect;visible,false); + }; + LoadFont("Common Normal") .. { + Name="ProtimingAverage"; + Text=""; + InitCommand=function(self) + self:visible(false); + end; + OnCommand=THEME:GetMetric("Protiming","AverageOnCommand"); + ResetCommand=cmd(finishtweening;stopeffect;visible,false); + }; + LoadFont("Common Normal") .. { + Name="TextDisplay"; + Text=THEME:GetString("Protiming","MS"); + InitCommand=function(self) + self:visible(false); + end; + OnCommand=THEME:GetMetric("Protiming","TextOnCommand"); + ResetCommand=cmd(finishtweening;stopeffect;visible,false); + }; + Def.Quad { + Name="ProtimingGraphBG"; + InitCommand=function(self) + self:visible(false); + self:y(32); + self:zoomto(ProtimingWidth, 16); + end; + ResetCommand=function(self) + self:finishtweening(); + self:diffusealpha(0.8); + self:visible(false); + end; + OnCommand=function(self) + self:diffuse(Color("Black")); + self:diffusetopedge(color("0.1,0.1,0.1,1")); + self:diffusealpha(0.8); + self:shadowlength(2); + end; + }; + Def.Quad { + Name="ProtimingGraphWindowW3"; + InitCommand=cmd(visible,false;y,32;zoomto,ProtimingWidth-4,16-4); + ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false); + OnCommand=cmd(diffuse,GameColor.Judgment["JudgmentLine_W3"];); + }; + Def.Quad { + Name="ProtimingGraphWindowW2"; + InitCommand=cmd(visible,false;y,32;zoomto,scale(PREFSMAN:GetPreference("TimingWindowSecondsW2"),0,PREFSMAN:GetPreference("TimingWindowSecondsW3"),0,ProtimingWidth-4),16-4); + ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false); + OnCommand=cmd(diffuse,GameColor.Judgment["JudgmentLine_W2"];); + }; + Def.Quad { + Name="ProtimingGraphWindowW1"; + InitCommand=cmd(visible,false;y,32;zoomto,scale(PREFSMAN:GetPreference("TimingWindowSecondsW1"),0,PREFSMAN:GetPreference("TimingWindowSecondsW3"),0,ProtimingWidth-4),16-4); + ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false); + OnCommand=cmd(diffuse,GameColor.Judgment["JudgmentLine_W1"];); + }; + Def.Quad { + Name="ProtimingGraphUnderlay"; + InitCommand=cmd(visible,false;y,32;zoomto,ProtimingWidth-4,16-4); + ResetCommand=cmd(finishtweening;diffusealpha,0.25;visible,false); + OnCommand=cmd(diffuse,Color("Black");diffusealpha,0.25); + }; + Def.Quad { + Name="ProtimingGraphFill"; + InitCommand=cmd(visible,false;y,32;zoomto,0,16-4;horizalign,left;); + ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false); + OnCommand=cmd(diffuse,Color("Red");); + }; + Def.Quad { + Name="ProtimingGraphAverage"; + InitCommand=cmd(visible,false;y,32;zoomto,2,7;); + ResetCommand=cmd(finishtweening;diffusealpha,0.85;visible,false); + OnCommand=cmd(diffuse,Color("Orange");diffusealpha,0.85); + }; + Def.Quad { + Name="ProtimingGraphCenter"; + InitCommand=cmd(visible,false;y,32;zoomto,2,16-4;); + ResetCommand=cmd(finishtweening;diffusealpha,1;visible,false); + OnCommand=cmd(diffuse,Color("White");diffusealpha,1); + }; + InitCommand = function(self) + c = self:GetChildren(); + end; + + JudgmentMessageCommand=function(self, param) + -- Fix Player Combo animating when player successfully avoids a mine. + local msgParam = param; + MESSAGEMAN:Broadcast("TestJudgment",msgParam); + -- + if param.Player ~= player then return end; + if param.HoldNoteScore then return end; + + local iNumStates = c.Judgment:GetNumStates(); + local iFrame = TNSFrames[param.TapNoteScore]; + + if not iFrame then return end + if iNumStates == 12 then + iFrame = iFrame * 2; + if not param.Early then + iFrame = iFrame + 1; + end + end + + + local fTapNoteOffset = param.TapNoteOffset; + if param.HoldNoteScore then + fTapNoteOffset = 1; + else + fTapNoteOffset = param.TapNoteOffset; + end + + if param.TapNoteScore == 'TapNoteScore_Miss' then + fTapNoteOffset = 1; + bUseNegative = true; + else +-- fTapNoteOffset = fTapNoteOffset; + bUseNegative = false; + end; + + if fTapNoteOffset ~= 1 then + -- we're safe, you can push the values + tTotalJudgments[#tTotalJudgments+1] = math.abs(fTapNoteOffset); +--~ tTotalJudgments[#tTotalJudgments+1] = bUseNegative and fTapNoteOffset or math.abs( fTapNoteOffset ); + end + + self:playcommand("Reset"); + + c.Judgment:visible( not bShowProtiming ); + c.Judgment:setstate( iFrame ); + JudgeCmds[param.TapNoteScore](c.Judgment); + + c.ProtimingDisplay:visible( bShowProtiming ); + c.ProtimingDisplay:settextf("%i",fTapNoteOffset * 1000); + ProtimingCmds[param.TapNoteScore](c.ProtimingDisplay); + + c.ProtimingAverage:visible( bShowProtiming ); + c.ProtimingAverage:settextf("%.2f%%",clamp(100 - MakeAverage( tTotalJudgments ) * 1000 ,0,100)); + AverageCmds['Pulse'](c.ProtimingAverage); + + c.TextDisplay:visible( bShowProtiming ); + TextCmds['Pulse'](c.TextDisplay); + + c.ProtimingGraphBG:visible( bShowProtiming ); + c.ProtimingGraphUnderlay:visible( bShowProtiming ); + c.ProtimingGraphWindowW3:visible( bShowProtiming ); + c.ProtimingGraphWindowW2:visible( bShowProtiming ); + c.ProtimingGraphWindowW1:visible( bShowProtiming ); + c.ProtimingGraphFill:visible( bShowProtiming ); + c.ProtimingGraphFill:finishtweening(); + c.ProtimingGraphFill:decelerate(1/60); +-- c.ProtimingGraphFill:zoomtowidth( clamp(fTapNoteOffset * 188,-188/2,188/2) ); + c.ProtimingGraphFill:zoomtowidth( clamp( + scale( + fTapNoteOffset, + 0,PREFSMAN:GetPreference("TimingWindowSecondsW3"), + 0,(ProtimingWidth-4)/2), + -(ProtimingWidth-4)/2,(ProtimingWidth-4)/2) + ); + c.ProtimingGraphAverage:visible( bShowProtiming ); + c.ProtimingGraphAverage:zoomtowidth( clamp( + scale( + MakeAverage( tTotalJudgments ), + 0,PREFSMAN:GetPreference("TimingWindowSecondsW3"), + 0,ProtimingWidth-4), + 0,ProtimingWidth-4) + ); +-- c.ProtimingGraphAverage:zoomtowidth( clamp(MakeAverage( tTotalJudgments ) * 1880,0,188) ); + c.ProtimingGraphCenter:visible( bShowProtiming ); + (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphBG); + (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphUnderlay); + (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphWindowW3); + (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphWindowW2); + (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphWindowW1); + (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphFill); + (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphAverage); + (cmd(sleep,2;linear,0.5;diffusealpha,0))(c.ProtimingGraphCenter); + end; + +}; + + +return t; diff --git a/Themes/default/Graphics/ScreenHowToInstallSongs Icon.lua b/Themes/default/Graphics/ScreenHowToInstallSongs Icon.lua index 9d28f5510c..73fd0c5e72 100644 --- a/Themes/default/Graphics/ScreenHowToInstallSongs Icon.lua +++ b/Themes/default/Graphics/ScreenHowToInstallSongs Icon.lua @@ -7,14 +7,8 @@ local previewHeight = SCREEN_CENTER_Y; local t = Def.ActorFrame{ Name="PreviewFrame"; - InitCommand=function(self) - self:x(SCREEN_CENTER_X * 1.5); - self:y(SCREEN_CENTER_Y * 0.85); - end; - OffCommand=function(self) - self:bouncebegin(0.25); - self:addx(SCREEN_CENTER_X); - end; + InitCommand=cmd(x,SCREEN_CENTER_X*1.5;y,SCREEN_CENTER_Y*0.85); + OffCommand=cmd(bouncebegin,0.25;addx,SCREEN_CENTER_X); }; local function TitleMenuItem(text,focused) @@ -22,231 +16,92 @@ local function TitleMenuItem(text,focused) local textColor = focused and color("#FFFFFF") or color("#888888"); return LoadFont("Common Normal")..{ Text=text; - InitCommand=function(self) - self:zoom(0.45); - self:strokecolor(Color("Outline")); - self:diffuse(textColor); - end; - GainFocusCommand=function(self) - self:stoptweening(); - self:decelerate(0.5); - self:diffusealpha(1); - end; - LoseFocusCommand=function(self) - self:stoptweening(); - self:accelerate(0.5); - self:diffusealpha(0); - end; + InitCommand=cmd(zoom,0.45;strokecolor,Color("Outline");diffuse,textColor); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); }; end; local previews = { WhereToFind = Def.ActorFrame{ LoadActor(THEME:GetPathG("_howto","find"))..{ - InitCommand=function(self) - self:zoomto(previewWidth, previewHeight); - end; - GainFocusCommand=function(self) - self:stoptweening(); - self:decelerate(0.5); - self:diffusealpha(1); - end; - LoseFocusCommand=function(self) - self:stoptweening(); - self:accelerate(0.5); - self:diffusealpha(0); - end; + InitCommand=cmd(zoomto,previewWidth,previewHeight); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); }; }; HowToInstall = Def.ActorFrame{ LoadActor(THEME:GetPathG("_howto","install"))..{ - InitCommand=function(self) - self:zoomto(previewWidth, previewHeight); - end; - GainFocusCommand=function(self) - self:stoptweening(); - self:decelerate(0.5); - self:diffusealpha(1); - end; - LoseFocusCommand=function(self) - self:stoptweening(); - self:accelerate(0.5); - self:diffusealpha(0); - end; + InitCommand=cmd(zoomto,previewWidth,previewHeight); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); }; }; AdditionalFolders = Def.ActorFrame{ Def.Quad{ - InitCommand=function(self) - self:zoomto(previewWidth, previewHeight); - end; - GainFocusCommand=function(self) - self:stoptweening(); - self:decelerate(0.5); - self:diffusealpha(1); - end; - LoseFocusCommand=function(self) - self:stoptweening(); - self:accelerate(0.5); - self:diffusealpha(0); - end; + InitCommand=cmd(zoomto,previewWidth,previewHeight); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); }; Def.Quad{ - InitCommand=function(self) - self:y(-previewHeight * 0.45); - self:diffuse(color("#E0F0F0")); - self:zoomto(previewWidth, previewHeight * 0.1); - end; - GainFocusCommand=function(self) - self:stoptweening(); - self:decelerate(0.5); - self:diffusealpha(1); - end; - LoseFocusCommand=function(self) - self:stoptweening(); - self:accelerate(0.5); - self:diffusealpha(0); - end; + InitCommand=cmd(y,-previewHeight*0.45;diffuse,color("#E0F0F0");zoomto,previewWidth,previewHeight*0.1;); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); }; LoadFont("Common normal")..{ - InitCommand=function(self) - self:x(SCREEN_CENTER_X * -0.4); - self:y(SCREEN_CENTER_Y * -0.475); - self:zoom(0.625); - self:halign(0); - self:valign(0); - self:diffuse(color("#000000")); - end; + InitCommand=cmd(x,-(SCREEN_CENTER_X*0.4);y,-(SCREEN_CENTER_Y*0.475);zoom,0.625;halign,0;valign,0;diffuse,color("#000000")); BeginCommand=function(self) local text = "Preferences.ini"; self:settext(text); end; - GainFocusCommand=function(self) - self:stoptweening(); - self:decelerate(0.5); - self:diffusealpha(1); - end; - LoseFocusCommand=function(self) - self:stoptweening(); - self:accelerate(0.5); - self:diffusealpha(0); - end; + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); }; LoadFont("Common normal")..{ Text="[Options]\nAdditionalCourseFolders=\nAdditionalFolders=\nAdditionalSongFolders="; - InitCommand=function(self) - self:x(SCREEN_CENTER_X * -0.4); - self:y(SCREEN_CENTER_Y * -0.35); - self:zoom(0.75); - self:halign(0); - self:valign(0); - self:diffuse(color("#000000")); - end; - GainFocusCommand=function(self) - self:stoptweening(); - self:decelerate(0.5); - self:diffusealpha(1); - end; - LoseFocusCommand=function(self) - self:stoptweening(); - self:accelerate(0.5); - self:diffusealpha(0); - end; + InitCommand=cmd(x,-(SCREEN_CENTER_X*0.4);y,-(SCREEN_CENTER_Y*0.35);zoom,0.75;halign,0;valign,0;diffuse,color("#000000")); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); }; }; ReloadSongs = Def.ActorFrame{ LoadActor(THEME:GetPathB("ScreenTitleMenu","background/_bg"))..{ - InitCommand=function(self) - self:zoomto(previewWidth, previewHeight); - self:halign(0.5); - self:valign(0.5); - end; - GainFocusCommand=function(self) - self:stoptweening(); - self:decelerate(0.5); - self:diffusealpha(1); - end; - LoseFocusCommand=function(self) - self:stoptweening(); - self:accelerate(0.5); - self:diffusealpha(0); - end; + InitCommand=cmd(zoomto,previewWidth,previewHeight;halign,0.5;valign,0.5); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); }; LoadFont("Common normal")..{ - InitCommand=function(self) - self:zoom(0.4); - self:maxwidth((previewWidth * 1.6) - 8); - end; + InitCommand=cmd(zoom,0.4;maxwidth,(previewWidth*1.6)-8); BeginCommand=function(self) local song = SONGMAN:GetRandomSong(); self:settext("Loading songs...\n"..song:GetGroupName().."\n"..song:GetDisplayFullTitle()); end; - GainFocusCommand=function(self) - self:stoptweening(); - self:decelerate(0.5); - self:diffusealpha(1); - end; - LoseFocusCommand=function(self) - self:stoptweening(); - self:accelerate(0.5); - self:diffusealpha(0); - end; + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); }; }; Exit = Def.ActorFrame{ LoadActor(THEME:GetPathB("ScreenTitleMenu","background/_bg"))..{ - InitCommand=function(self) - self:zoomto(previewWidth, previewHeight); - self:halign(0.5); - self:valign(0.5); - end; - GainFocusCommand=function(self) - self:stoptweening(); - self:decelerate(0.5); - self:diffusealpha(1); - end; - LoseFocusCommand=function(self) - self:stoptweening(); - self:accelerate(0.5); - self:diffusealpha(0); - end; + InitCommand=cmd(zoomto,previewWidth,previewHeight;halign,0.5;valign,0.5); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); }; LoadActor(THEME:GetPathG("ScreenTitleMenu","logo"))..{ - InitCommand=function(self) - self:y(-28); - self:zoom(0.35); - self:propagate(true); - end; - GainFocusCommand=function(self) - self:stoptweening(); - self:decelerate(0.5); - self:diffusealpha(1); - end; - LoseFocusCommand=function(self) - self:stoptweening(); - self:accelerate(0.5); - self:diffusealpha(0); - end; + InitCommand=cmd(y,-28;zoom,0.35;propagate,true); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); }; TitleMenuItem("Game Start",true)..{ - InitCommand=function(self) - self:y(20); - end; + InitCommand=cmd(y,20); }; TitleMenuItem("Options")..{ - InitCommand=function(self) - self:y(32); - end; + InitCommand=cmd(y,32); }; TitleMenuItem("Edit/Share")..{ - InitCommand=function(self) - self:y(44); - end; + InitCommand=cmd(y,44); }; TitleMenuItem("Exit")..{ - InitCommand=function(self) - self:y(56); - end; + InitCommand=cmd(y,56); }; }; }; @@ -258,26 +113,9 @@ t[#t+1] = LoadFont("Common normal")..{ --Text="The quick brown fox jumps over the lazy dog ".. Index .." times."; Text=Screen.String("Explanation-"..Name); -- was x,-(SCREEN_CENTER_X*0.4);y,SCREEN_CENTER_Y*0.525; - InitCommand=function(self) - self:x(SCREEN_CENTER_X * -0.8); - self:y(SCREEN_CENTER_Y * 0.8); - self:halign(0); - self:valign(0); - self:zoom(0.65); - self:wrapwidthpixels((SCREEN_WIDTH * 0.55) * 1.75); - self:NoStroke(); - self:shadowlength(1); - end; - GainFocusCommand=function(self) - self:stoptweening(); - self:decelerate(0.5); - self:diffusealpha(1); - end; - LoseFocusCommand=function(self) - self:stoptweening(); - self:accelerate(0.5); - self:diffusealpha(0); - end; + InitCommand=cmd(x,-(SCREEN_CENTER_X*0.8);y,SCREEN_CENTER_Y*0.8;halign,0;valign,0;zoom,0.65;wrapwidthpixels,(SCREEN_WIDTH*0.55)*1.75;NoStroke;shadowlength,1); + GainFocusCommand=cmd(stoptweening;decelerate,0.5;diffusealpha,1); + LoseFocusCommand=cmd(stoptweening;accelerate,0.5;diffusealpha,0); }; return t; \ No newline at end of file diff --git a/Themes/default/Graphics/ScreenSelectMusic AlternateHelpDisplay.lua b/Themes/default/Graphics/ScreenSelectMusic AlternateHelpDisplay.lua index 1269ed60ed..e950ca90f1 100644 --- a/Themes/default/Graphics/ScreenSelectMusic AlternateHelpDisplay.lua +++ b/Themes/default/Graphics/ScreenSelectMusic AlternateHelpDisplay.lua @@ -8,3 +8,26 @@ return Def.HelpDisplay { self:SetTipsColonSeparated( params.Text ); end; }; +--[[ local sString = THEME:GetString(Var "LoadingScreen","AlternateHelpText"); +local tItems = split(sString,"&"); + +local t = Def.ActorScroller { + NumItemsToDraw=#tItems; + SecondsPerItem=1.25; + TransformFunction=function( self, offset, itemIndex, numItems ) + self:x( offset*74 ); + end; + InitCommand=cmd(SetLoop,true); +-- OnCommand=cmd(scrollwithpadding,10,0); +}; + +for i=1,#tItems do + t[#t+1] = Def.ActorFrame { + LoadFont("HelpDisplay", "text") .. { + Text=tostring(tItems[i]); + OnCommand=THEME:GetMetric( Var "LoadingScreen","HelpOnCommand"); + }; + }; +end + +return t; --]] diff --git a/Themes/default/Graphics/ScreenSelectPlayMode scroller/default.lua b/Themes/default/Graphics/ScreenSelectPlayMode scroller/default.lua index defa4905ca..e387139cd9 100644 --- a/Themes/default/Graphics/ScreenSelectPlayMode scroller/default.lua +++ b/Themes/default/Graphics/ScreenSelectPlayMode scroller/default.lua @@ -11,6 +11,8 @@ local colors = { local t = Def.ActorFrame {}; -- Background! t[#t+1] = Def.ActorFrame { +-- GainFocusCommand=cmd(visible,true); +-- LoseFocusCommand=cmd(visible,false); LoadActor(THEME:GetPathG("ScreenSelectPlayMode","BackgroundFrame")) .. { InitCommand=function(self) self:diffuse(Color("Black")); diff --git a/Themes/default/Graphics/ScreenTitleMenu SystemDirection/default.lua b/Themes/default/Graphics/ScreenTitleMenu SystemDirection/default.lua index 040ad7b2f3..1984fd0044 100644 --- a/Themes/default/Graphics/ScreenTitleMenu SystemDirection/default.lua +++ b/Themes/default/Graphics/ScreenTitleMenu SystemDirection/default.lua @@ -53,38 +53,21 @@ local function MakeIcon( sTarget ) Def.ActorFrame { -- Life goes up to 1-5 Def.ActorFrame { - InitCommand=function(self) - self:y(12); - end; + InitCommand=cmd(y,12); MakeDisplayBar( 6, 5 ) .. { - InitCommand=function(self) - self:x(-16); - self:visible( GetLifeDifficulty() >= 1 ); - end; + InitCommand=cmd(x,-16;visible,( GetLifeDifficulty() >= 1 )); }; MakeDisplayBar( 6, 9 ) .. { - InitCommand=function(self) - self:x(-8); - self:visible( GetLifeDifficulty() >= 2 ); - end; + InitCommand=cmd(x,-8;visible,( GetLifeDifficulty() >= 2 )); }; MakeDisplayBar( 6, 13 ) .. { - InitCommand=function(self) - self:x(0); - self:visible( GetLifeDifficulty() >= 3 ); - end; + InitCommand=cmd(x,0;visible,( GetLifeDifficulty() >= 3 )); }; MakeDisplayBar( 6, 16 ) .. { - InitCommand=function(self) - self:x(8); - self:visible( GetLifeDifficulty() >= 4 ); - end; + InitCommand=cmd(x,8;visible,( GetLifeDifficulty() >= 4 )); }; MakeDisplayBar( 6, 20 ) .. { - InitCommand=function(self) - self:x(16); - self:visible( GetLifeDifficulty() >= 5 ); - end; + InitCommand=cmd(x,16;visible,( GetLifeDifficulty() >= 5 )); }; }; Condition=sTarget[1] == "LifeDifficulty"; @@ -92,69 +75,47 @@ local function MakeIcon( sTarget ) Def.ActorFrame { -- Timing goes up to 1-8 Def.ActorFrame { - InitCommand=function(self) - self:y(12); - end; + InitCommand=cmd(y,12); MakeDisplayBar( 4, 5 ) .. { - InitCommand=function(self) - self:x(-20); - self:visible( GetTimingDifficulty() >= 1 ); - end; + InitCommand=cmd(x,-20;visible,( GetTimingDifficulty() >= 1 )); }; MakeDisplayBar( 4, 9 ) .. { - InitCommand=function(self) - self:x(-215); - self:visible( GetTimingDifficulty() >= 2 ); - end; + InitCommand=cmd(x,-15;visible,( GetTimingDifficulty() >= 2 )); }; MakeDisplayBar( 4, 13 ) .. { - InitCommand=function(self) - self:x(-10); - self:visible( GetTimingDifficulty() >= 3 ); - end; + InitCommand=cmd(x,-10;visible,( GetTimingDifficulty() >= 3 )); }; MakeDisplayBar( 4, 16 ) .. { - InitCommand=function(self) - self:x(-5); - self:visible( GetTimingDifficulty() >= 4 ); - end; + InitCommand=cmd(x,-5;visible,( GetTimingDifficulty() >= 4 )); }; MakeDisplayBar( 4, 20 ) .. { - InitCommand=function(self) - self:x(5); - self:visible( GetTimingDifficulty() >= 5 ); - end; + InitCommand=cmd(x,5;visible,( GetTimingDifficulty() >= 5 )); }; MakeDisplayBar( 4, 20 ) .. { - function(self) - self:x(10); - self:visible( GetTimingDifficulty() >= 6 ); - end; + InitCommand=cmd(x,10;visible,( GetTimingDifficulty() >= 6 )); }; MakeDisplayBar( 4, 20 ) .. { - function(self) - self:x(15); - self:visible( GetTimingDifficulty() >= 7 ); - end; + InitCommand=cmd(x,15;visible,( GetTimingDifficulty() >= 7 )); }; MakeDisplayBar( 4, 20 ) .. { - function(self) - self:x(20); - self:visible( GetTimingDifficulty() >= 8 ); - end; + InitCommand=cmd(x,20;visible,( GetTimingDifficulty() >= 8 )); }; }; Condition=sTarget[1] == "TimingDifficulty"; }; + -- +--[[ for i=1,8 do + t[#t+1] = Def.Quad { + InitCommand=cmd(vertalign,bottom;zoomto,4,10+(i*4)); + }; + end --]] }; return t end; for i=1,#tInfo do t[#t+1] = MakeIcon( tInfo[i] ) .. { - InitCommand=function(self) - self:x((i - 1) * fSpacingX); - end; + InitCommand=cmd(x,(i-1)*fSpacingX); }; end