add Screen Filter to ScreenPlayerOptions

This commit is contained in:
AJ Kelly
2011-09-03 19:55:58 -05:00
parent afe7569f08
commit ffa6bbf2e0
4 changed files with 62 additions and 12 deletions
@@ -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()
@@ -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
+41 -3
View File
@@ -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
+1
View File
@@ -1275,6 +1275,7 @@ LineFancyUIBG="lua,UserPrefFancyUIBG()"
[ScreenPlayerOptions]
LineNames=GetDefaultOptionLines()
LineSF="lua,OptionRowScreenFilter()"
Line17="lua,OptionRowProTiming()"
Line18="list,Characters"