From 9e701d72d255c77a47ba068b273cf40b882219dc Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Sat, 20 Aug 2011 19:51:05 -0500 Subject: [PATCH] Cleaned up ProductivityHelpers (move some stuff from ProductivityHelpers to compat, among other things) --- Themes/_fallback/Scripts/01 compat.lua | 14 +++ .../Scripts/03 ProductivityHelpers.lua | 86 ++++++++----------- Themes/_fallback/metrics.ini | 4 +- 3 files changed, 53 insertions(+), 51 deletions(-) diff --git a/Themes/_fallback/Scripts/01 compat.lua b/Themes/_fallback/Scripts/01 compat.lua index 422324ad13..dc7ad45c3f 100644 --- a/Themes/_fallback/Scripts/01 compat.lua +++ b/Themes/_fallback/Scripts/01 compat.lua @@ -27,3 +27,17 @@ function GameState:GetSongBeatNoOffset() return self:GetSongPosition():GetSongBe function GameState:GetSongBPS() return self:GetSongPosition():GetCurBPS() end function GameState:GetSongDelay() return self:GetSongPosition():GetDelay() end function GameState:GetSongFreeze() return self:GetSongPosition():GetFreeze() end + +--[[ 3.9 Conditionals ]] +Condition = { + Hour = function() return Hour() end, + IsDemonstration = function() return GAMESTATE:IsDemonstration() end, + CurSong = function(sSongName) + return GAMESTATE:GetCurrentSong():GetDisplayMainTitle() == sSongName + end, + DayOfMonth = function() return DayOfMonth() end, + MonthOfYear = function() return MonthOfYear() end, + UsingModifier = function(pnPlayer, sModifier) + return GAMESTATE:PlayerIsUsingModifier( pnPlayer, sModifier ); + end, +} \ No newline at end of file diff --git a/Themes/_fallback/Scripts/03 ProductivityHelpers.lua b/Themes/_fallback/Scripts/03 ProductivityHelpers.lua index 4297389fc6..928f89f5b7 100644 --- a/Themes/_fallback/Scripts/03 ProductivityHelpers.lua +++ b/Themes/_fallback/Scripts/03 ProductivityHelpers.lua @@ -1,17 +1,15 @@ -- ProductivityHelpers: A set of useful aliases for theming. --- This is the sm-ssc version. You should not be using this in themes for --- SM4 right now... We'll post an updated version soon. --[[ Globals ]] function IsArcade() - local sPayMode = GAMESTATE:GetCoinMode(); - local bIsArcade = (sPayMode ~= 'CoinMode_Home'); + local sCoinMode = GAMESTATE:GetCoinMode(); + local bIsArcade = (sCoinMode ~= 'CoinMode_Home'); return bIsArcade; end function IsHome() - local sPayMode = GAMESTATE:GetCoinMode(); - local bIsHome = (sPayMode == 'CoinMode_Home'); + local sCoinMode = GAMESTATE:GetCoinMode(); + local bIsHome = (sCoinMode == 'CoinMode_Home'); return bIsHome; end @@ -24,49 +22,23 @@ function IsFreePlay() end function Center1Player() - if GAMESTATE:GetCurrentStyle():GetStyleType() == "StyleType_OnePlayerTwoSides" then + local styleType = GAMESTATE:GetCurrentStyle():GetStyleType() + -- always center in OnePlayerTwoSides. + if styleType == "StyleType_OnePlayerTwoSides" then return true + -- only Center1P if Pref enabled and OnePlayerOneSide. + -- (implicitly excludes Rave, Battle, Versus, Routine) elseif PREFSMAN:GetPreference("Center1Player") then - if GAMESTATE:GetCurrentStyle():GetStyleType() == "StyleType_OnePlayerOneSide" then - return true - else - return false - end + return styleType == "StyleType_OnePlayerOneSide" else return false end ---[[ return PREFSMAN:GetPreference("Center1Player") and - THEME:GetMetric("ScreenGameplay","AllowCenter1Player") and - not GAMESTATE:GetPlayMode("PlayMode_Battle") and - not GAMESTATE:GetPlayMode("PlayMode_Rave") and - GAMESTATE:GetCurrentStyle():GetStyleType() == "StyleType_OnePlayerOneSide"; --]] end ---[[ 3.9 Conditionals ]] -Condition = { - Hour = function() - return Hour() - end, - IsDemonstration = function() - return GAMESTATE:IsDemonstration() - end, - CurSong = function(sSongName) - return GAMESTATE:GetCurrentSong():GetDisplayMainTitle() == sSongName - end, - DayOfMonth = function() - return DayOfMonth() - end, - MonthOfYear = function() - return MonthOfYear() - end, - UsingModifier = function(pnPlayer, sModifier) - return GAMESTATE:PlayerIsUsingModifier( pnPlayer, sModifier ); - end, -} --[[ 3.9 Functions ]] Game = { GetStage = function() - + end, } --[[ Aliases ]] @@ -74,12 +46,32 @@ Game = { -- Blend Modes -- Aliases for blend modes. Blend = { - Normal = 'BlendMode_Normal', - Add = 'BlendMode_Add', - Modulate = 'BlendMode_Modulate', - Multiply = 'BlendMode_WeightedMultiply', - Invert = 'BlendMode_InvertDest', - NoEffect = 'BlendMode_NoEffect', + Normal = 'BlendMode_Normal', + Add = 'BlendMode_Add', + Subtract = 'BlendMode_Subtract', + Modulate = 'BlendMode_Modulate', + CopySource = 'BlendMode_CopySrc', + AlphaMask = 'BlendMode_AlphaMask', + AlphaKnockout = 'BlendMode_AlphaKnockout', + AlphaMultiply = 'BlendMode_AlphaMultiply', + Multiply = 'BlendMode_WeightedMultiply', + Invert = 'BlendMode_InvertDest', + NoEffect = 'BlendMode_NoEffect', +} +function StringToBlend(s) return Blend[s] or nil end + +-- EffectMode +-- Aliases for EffectMode (aka shaders) +EffectMode = { + Normal = 'EffectMode_Normal', + Unpremultiply = 'EffectMode_Unpremultiply', + ColorBurn = 'EffectMode_ColorBurn', + ColorDodge = 'EffectMode_ColorDodge', + VividLight = 'EffectMode_VividLight', + HardMix = 'EffectMode_HardMix', + Overlay = 'EffectMode_Overlay', + Screen = 'EffectMode_Screen', + YUYV422 = 'EffectMode_YUYV422', } -- Health Declarations @@ -260,9 +252,7 @@ function tobool(v) end end -function pname(pn) - return ToEnumShortString(pn) -end +function pname(pn) return ToEnumShortString(pn) end function math.round(num, pre) if pre and pre < 0 then pre = 0 end diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index 4277f72717..01d9c24816 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -3090,8 +3090,6 @@ OutTransitionLength=5 CourseTransitionLength=0.5 BeginFailedDelay=1.0 # -AllowCenter1Player=true -# PlayerP1OnePlayerOneSideX=math.floor(scale((0.85/3),0,1,SCREEN_LEFT,SCREEN_RIGHT)) PlayerP2OnePlayerOneSideX=math.floor(scale((2.15/3),0,1,SCREEN_LEFT,SCREEN_RIGHT)) PlayerP1TwoPlayersTwoSidesX=math.floor(scale((0.85/3),0,1,SCREEN_LEFT,SCREEN_RIGHT)) @@ -3885,7 +3883,7 @@ PrevScreen="ScreenOptionsExtended" NextScreen="ScreenOptionsExtended" PlayerType="PlayerSyncMachine" -AllowCenter1Player=false +#AllowCenter1Player=false SyncInfoOnCommand=x,PositionPerPlayer(GAMESTATE:GetMasterPlayerNumber(),SCREEN_CENTER_X+160,SCREEN_CENTER_X-160);y,SCREEN_CENTER_Y;zoom,0;decelerate,0.5;zoom,0.6 # hidden by default: