From ffa6bbf2e0a67c060e6f32e5958ae431d4733142 Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Sat, 3 Sep 2011 19:55:58 -0500 Subject: [PATCH] add Screen Filter to ScreenPlayerOptions --- .../Scripts/03 ThemeAndGamePrefs.lua | 6 +-- .../ScreenGameplay underlay/ScreenFilter.lua | 23 +++++++--- Themes/default/Scripts/03 ThemePrefs.lua | 44 +++++++++++++++++-- Themes/default/metrics.ini | 1 + 4 files changed, 62 insertions(+), 12 deletions(-) diff --git a/Themes/_fallback/Scripts/03 ThemeAndGamePrefs.lua b/Themes/_fallback/Scripts/03 ThemeAndGamePrefs.lua index 8632fbebb8..cc4ade9f22 100644 --- a/Themes/_fallback/Scripts/03 ThemeAndGamePrefs.lua +++ b/Themes/_fallback/Scripts/03 ThemeAndGamePrefs.lua @@ -235,8 +235,8 @@ end function GetDefaultOptionLines() local LineSets = { - "1,8,14,2,3,4,5,6,R,7,9,10,11,12,13,15,16,17,18", -- All - "1,8,14,2,7,13,16,17,18", -- DDR Essentials ( no turns, fx ) + "1,8,14,2,3,4,5,6,R,7,9,10,11,12,13,15,16,SF,17,18", -- All + "1,8,14,2,7,13,16,SF,17,18", -- DDR Essentials ( no turns, fx ) }; local function IsExtra() if GAMESTATE:IsExtraStage() or GAMESTATE:IsExtraStage2() then @@ -252,7 +252,7 @@ function GetDefaultOptionLines() return LineSets[2]; -- Just make sure! end else - return "1,8,14,2,7,13,16,17,18" -- "failsafe" list + return "1,8,14,2,7,13,16,SF,17,18" -- "failsafe" list end end; function UserPrefLongFail() diff --git a/Themes/default/BGAnimations/ScreenGameplay underlay/ScreenFilter.lua b/Themes/default/BGAnimations/ScreenGameplay underlay/ScreenFilter.lua index 44c7f7becf..bba442f8e6 100644 --- a/Themes/default/BGAnimations/ScreenGameplay underlay/ScreenFilter.lua +++ b/Themes/default/BGAnimations/ScreenGameplay underlay/ScreenFilter.lua @@ -4,7 +4,13 @@ local center1P = PREFSMAN:GetPreference("Center1Player") local padding = 8 -- 4px on each side local arrowWidth = 64 -- until noteskin metrics are implemented... -local filterColor = color("#22222288") + +local filterColor = color("0.135,0.135,0.135,1") +local filterAlphas = { + PlayerNumber_P1 = 1, + PlayerNumber_P2 = 1, + Default = 0, +} local t = Def.ActorFrame{}; @@ -15,37 +21,42 @@ 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 pNum = (player == PLAYER_1) and 1 or 2 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;diffuse,filterColor); + 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 metricName = "PlayerP1TwoPlayersSharedSidesX" + 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;diffuse,filterColor); + 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;diffuse,filterColor); + InitCommand=cmd(x,pos;CenterY;zoomto,filterWidth,SCREEN_HEIGHT;diffusecolor,filterColor;diffusealpha,filterAlphas[player]); }; end end diff --git a/Themes/default/Scripts/03 ThemePrefs.lua b/Themes/default/Scripts/03 ThemePrefs.lua index fd7237b0e1..3da2752cc3 100644 --- a/Themes/default/Scripts/03 ThemePrefs.lua +++ b/Themes/default/Scripts/03 ThemePrefs.lua @@ -51,7 +51,45 @@ end --[[ option rows ]] --- screen cover +-- screen filter +function OptionRowScreenFilter() + local t = { + Name="ScreenFilter", + LayoutType = "ShowAllInRow", + SelectType = "SelectOne", + OneChoiceForAllPlayers = false, + ExportOnChange = false, + Choices = { 'Off', '0.1', '0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1.0', }, + LoadSelections = function(self, list, pn) + local pName = ToEnumShortString(pn) + local filterValue = getenv("ScreenFilter"..pName) + if filterValue ~= nil then + local val = scale(tonumber(filterValue),0,1,1,#list ) + list[val] = true + else + setenv("ScreenFilter"..pName,0) + list[1] = true + end + end, + SaveSelections = function(self, list, pn) + local pName = ToEnumShortString(pn) + local found = false + for i=1,#list do + if not found then + if list[i] == true then + local val = scale(i,1,#list,0,1) + setenv("ScreenFilter"..pName,val) + found = true + end + end + end + end, + }; + setmetatable(t, t) + return t +end + +-- protiming function OptionRowProTiming() local t = { Name = "ProTiming", @@ -176,8 +214,8 @@ end function GetDefaultOptionLines() local LineSets = { -- none of these include characters yet. - "1,8,14,2,3A,3B,4,5,6,R,7,9,10,11,12,13,16,17", -- All - "1,8,14,2,7,13,16,17", -- DDR Essentials ( no turns, fx ) + "1,8,14,2,3A,3B,4,5,6,R,7,9,10,11,12,13,16,SF,17", -- All + "1,8,14,2,7,13,16,SF,17", -- DDR Essentials ( no turns, fx ) }; local function IsExtra() if GAMESTATE:IsExtraStage() or GAMESTATE:IsExtraStage2() then diff --git a/Themes/default/metrics.ini b/Themes/default/metrics.ini index 9c514ce711..76b1e6f468 100644 --- a/Themes/default/metrics.ini +++ b/Themes/default/metrics.ini @@ -1275,6 +1275,7 @@ LineFancyUIBG="lua,UserPrefFancyUIBG()" [ScreenPlayerOptions] LineNames=GetDefaultOptionLines() +LineSF="lua,OptionRowScreenFilter()" Line17="lua,OptionRowProTiming()" Line18="list,Characters"