WIP easter eggs api
authorCameron Ball <c.ball1729@gmail.com>
Tue, 10 Dec 2013 05:48:50 +0000 (13:48 +0800)
committerCameron Ball <c.ball1729@gmail.com>
Tue, 10 Dec 2013 05:48:50 +0000 (13:48 +0800)
Themes/GrooveNights/BGAnimations/ScreenPlayerOptions overlay/default.xml
Themes/GrooveNights/Scripts/EasterEggs.lua
Themes/GrooveNights/Scripts/Other.lua
Themes/GrooveNights/Scripts/SpeedMods.lua
Themes/GrooveNights/Scripts/gnSystem.lua
Themes/GrooveNights/metrics.ini

index 35a6ada..6511659 100644 (file)
                        OnCommand="horizalign,left;zoom,0.65;rainbow;"
                        SpeedModChangedMessageCommand="queuecommand,Update"
                        RateModChangedMessageCommand="queuecommand,Update"
-                       UpdateCommand="%function(self) if IsBlazed(PLAYER_1) then self:diffusealpha(1) else self:diffusealpha(0) end end"
+                       UpdateCommand="%function(self) if DoEasterEgg('BlazeIt', {pn = PLAYER_1}) then self:diffusealpha(1) else self:diffusealpha(0) end end"
                />
                
 <!--No Scope P1 -->            
                        OnCommand="horizalign,left;zoom,0.65;rainbow;"
                        SpeedModChangedMessageCommand="queuecommand,Update"
                        RateModChangedMessageCommand="queuecommand,Update"
-                       UpdateCommand="%function(self) if IsNoScoped(PLAYER_1) then self:diffusealpha(1) else self:diffusealpha(0) end end"
+                       UpdateCommand="%function(self) if DoEasterEgg('NoScope', {pn = PLAYER_1}) then self:diffusealpha(1) else self:diffusealpha(0) end end"
                />
                        
 <!--Step Artists P1-->
                        OnCommand="horizalign,left;zoom,0.65;rainbow;"
                        SpeedModChangedMessageCommand="queuecommand,Update"
                        RateModChangedMessageCommand="queuecommand,Update"
-                       UpdateCommand="%function(self) if IsBlazed(PLAYER_2) then self:diffusealpha(1) else self:diffusealpha(0) end end"
+                       UpdateCommand="%function(self) if DoEasterEgg('BlazeIt', {pn = PLAYER_2}) then self:diffusealpha(1) else self:diffusealpha(0) end end"
                />
                
 <!--No Scope P2 -->            
                        OnCommand="horizalign,left;zoom,0.65;rainbow;"
                        SpeedModChangedMessageCommand="queuecommand,Update"
                        RateModChangedMessageCommand="queuecommand,Update"
-                       UpdateCommand="%function(self) if IsNoScoped(PLAYER_2) then self:diffusealpha(1) else self:diffusealpha(0) end end"
+                       UpdateCommand="%function(self) if DoEasterEgg('NoScope', {pn = PLAYER_2}) then self:diffusealpha(1) else self:diffusealpha(0) end end"
                />
                
 <!--Step Artists P2-->
index 15cd760..03aaa37 100644 (file)
@@ -1,11 +1,45 @@
-function IsBlazed(pn)\r
-       if DisplayScrollSpeed(pn) == '420' then return true end\r
-               \r
-       return false\r
+-- This is purely for convenience\r
+local ProfileTable\r
+local FunctionTable = {}\r
+\r
+-- Without this check, when StepMania starts it will report a lua runtime error as PROFILEMAN apparently doesn't exist yet.\r
+if PROFILEMAN ~= nil then\r
+    ProfileTable = PROFILEMAN:GetMachineProfile():GetSaved()\r
+end\r
+\r
+-- Valid speed mod row type names.\r
+local choices = { "OFF", "ON" }\r
+\r
+local FunctionTable = {}\r
+\r
+function EasterEggsEnabled()\r
+    --Default to off\r
+    if ProfileTable.EasterEggs == nil then return false end\r
+\r
+    return ProfileTable.EasterEggs\r
+end\r
+\r
+function ToggleEasterEggs()\r
+    local function Load(self, list, pn)\r
+        if EasterEggsEnabled() then list[2] = true else list[1] = true end\r
+    end\r
+\r
+    local function Save(self, list, pn)\r
+        if list[1] then ProfileTable.EasterEggs = false else ProfileTable.EasterEggs = true end\r
+        PROFILEMAN:SaveMachineProfile()\r
+        return\r
+    end\r
+\r
+    local Params = { Name = "EasterEggs" }\r
+    return CreateOptionRow( Params, choices, Load, Save )\r
+end\r
+\r
+function RegisterEasterEgg(Name, fn)\r
+    FunctionTable[Name] = fn\r
 end\r
 \r
-function IsNoScoped(pn)\r
-       if DisplayScrollSpeed(pn) == '360' then return true end\r
-               \r
-       return false\r
+function DoEasterEgg(Name, Params)\r
+    if EasterEggsEnabled() then\r
+        if FunctionTable[Name] ~= nil then return FunctionTable[Name](Params) end\r
+    end\r
 end
\ No newline at end of file
index 372f57f..85da2d6 100644 (file)
@@ -430,9 +430,9 @@ end
 
 function oitgACoptions()
     -- Right now we return the same line names for both OITG and whatever else happens to be running. But in the future they might be different.
-    if OPENITG then return "1,2,3,4,5,6,7,8,9,10,11" end
+    if OPENITG then return "1,2,3,4,5,6,7,8,9,10,11,12" end
 
-    return "1,2,3,4,5,6,7,8,9,10,11"
+    return "1,2,3,4,5,6,7,8,9,10,11,12"
 end
 
 function SongModifiers()
index 48d31d4..168710c 100644 (file)
@@ -19,7 +19,7 @@ if PROFILEMAN ~= nil then
     ProfileTable = PROFILEMAN:GetMachineProfile():GetSaved()\r
 end\r
 \r
-       -- Valid speed mod row type names.\r
+-- Valid speed mod row type names.\r
 local Names = { "Basic", "Advanced", "Pro" }\r
 \r
 function SpeedModTypeRow()\r
index 9bd3f8e..5ebb241 100644 (file)
@@ -346,3 +346,20 @@ function ScreenTransitionWhoosh(i)
        local Path = THEME:GetPath( EC_SOUNDS, 'gnScreenTransition', 'whoosh '..i );
        SOUND:PlayOnce(Path);
 end
+
+
+--easter eggs
+local function IsBlazed(Params)
+       if DisplayScrollSpeed(Params.pn) == '420' then return true end
+               
+       return false
+end
+
+local function IsNoScoped(Params)
+       if DisplayScrollSpeed(Params.pn) == '360' then return true end
+               
+       return false
+end
+
+RegisterEasterEgg("BlazeIt", IsBlazed)
+RegisterEasterEgg("NoScope", IsNoScoped)
\ No newline at end of file
index 9e4a587..2d3143c 100644 (file)
@@ -3956,6 +3956,7 @@ Line8=conf,JudgeDifficulty
 Line9=conf,DefaultFailType
 Line10=conf,Theme
 Line11=lua,SpeedModTypeRow()
+Line12=lua,ToggleEasterEggs()
 
 [ScreenGraphicOptions]
 Fallback=ScreenOptionsSubmenu