Added license notice to SpeedMods.lua and moved the stuff to set up the row type...
authorCameron Ball <c.ball1729@gmail.com>
Mon, 9 Dec 2013 08:30:40 +0000 (16:30 +0800)
committerCameron Ball <c.ball1729@gmail.com>
Mon, 9 Dec 2013 08:30:40 +0000 (16:30 +0800)
Themes/GrooveNights/Scripts/SpeedMods.lua
Themes/GrooveNights/Scripts/gnCustomOptions.lua [deleted file]

index 2c84c59..48d31d4 100644 (file)
@@ -1,3 +1,68 @@
+--[[\r
+Simple SpeedMods API for 3.95/OpenITG, version 1.0\r
+Licensed under Creative Commons Attribution-Share Alike 3.0 Unported\r
+(http://creativecommons.org/licenses/by-sa/3.0/)\r
+\r
+Globally callable functions to set up multi-line speed mods and access the\r
+currently applied speed modifier.\r
+\r
+Written by Cameron Ball for OpenITG (http://www.boxorroxors.net/)\r
+All I ask is that you keep this notice intact and don't redistribute in bytecode.\r
+--]]\r
+\r
+\r
+-- This is purely for convenience\r
+local ProfileTable\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 Names = { "Basic", "Advanced", "Pro" }\r
+\r
+function SpeedModTypeRow()\r
+        local type = GetSpeedModRowType()\r
+\r
+        local function Load(self, list, pn)\r
+                -- what we're doing here is checking what we got from profileman against the valid names.\r
+                for i=1,3 do\r
+                        if type == string.lower(Names[i]) then list[i] = true return end\r
+                end\r
+\r
+                -- if nothing matched then just default to pro\r
+                list[3] = true\r
+        end\r
+\r
+        local function Save(self, list, pn)\r
+                -- go through each item in the list and save the first one that is set to true\r
+                for i=1,3 do\r
+                        if list[i] then\r
+                                ProfileTable.SpeedModType = string.lower(Names[i])\r
+                                PROFILEMAN:SaveMachineProfile()\r
+                                return\r
+                        end\r
+                end\r
+        end\r
+\r
+        local Params = { Name = "SpeedModType" }\r
+\r
+        return CreateOptionRow( Params, Names, Load, Save )\r
+end\r
+\r
+function GetSpeedModRowType()\r
+        local type = ProfileTable.SpeedModType\r
+\r
+        -- as soon as we find a valid name, return it.\r
+        for i=1,3 do\r
+            if type == string.lower(Names[i]) then return type end\r
+        end\r
+\r
+        -- no pref, default to the first name in the list.\r
+        return string.lower(Names[1])\r
+end\r
+\r
 function GetRateMods()\r
     return { "1.0x", "1.1x", "1.2x", "1.3x", "1.4x", "1.5x", "1.6x", "1.7x", "2.0x"}\r
 end\r
diff --git a/Themes/GrooveNights/Scripts/gnCustomOptions.lua b/Themes/GrooveNights/Scripts/gnCustomOptions.lua
deleted file mode 100644 (file)
index 458dd03..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
--- This is purely for convenience
-local ProfileTable
-
--- Without this check, when StepMania starts it will report a lua runtime error as PROFILEMAN apparently doesn't exist yet.
-if PROFILEMAN ~= nil then
-    ProfileTable = PROFILEMAN:GetMachineProfile():GetSaved()
-end
-
-       -- Valid speed mod row type names.
-local Names = { "Basic", "Advanced", "Pro" }
-
-function SpeedModTypeRow()
-        local type = GetSpeedModRowType()
-
-        local function Load(self, list, pn)
-                -- what we're doing here is checking what we got from profileman against the valid names.
-                for i=1,3 do
-                        if type == string.lower(Names[i]) then list[i] = true return end
-                end
-
-                -- if nothing matched then just default to pro
-                list[3] = true
-        end
-
-        local function Save(self, list, pn)
-                -- go through each item in the list and save the first one that is set to true
-                for i=1,3 do
-                        if list[i] then
-                                ProfileTable.SpeedModType = string.lower(Names[i])
-                                PROFILEMAN:SaveMachineProfile()
-                                return
-                        end
-                end
-        end
-
-        local Params = { Name = "SpeedModType" }
-
-        return CreateOptionRow( Params, Names, Load, Save )
-end
-
-function GetSpeedModRowType()
-        local type = ProfileTable.SpeedModType
-
-        -- as soon as we find a valid name, return it.
-        for i=1,3 do
-            if type == string.lower(Names[i]) then return type end
-        end
-
-        -- no pref, default to the first name in the list.
-        return string.lower(Names[1])
-end
\ No newline at end of file