Progrss on #20, need to test on Jayce's cab
authorCameron Ball <c.ball1729@gmail.com>
Thu, 12 Dec 2013 16:52:37 +0000 (00:52 +0800)
committerCameron Ball <c.ball1729@gmail.com>
Thu, 12 Dec 2013 16:52:37 +0000 (00:52 +0800)
Themes/GrooveNights/Scripts/Other.lua
Themes/GrooveNights/Scripts/SpeedMods.lua
Themes/GrooveNights/Scripts/gnSystem.lua

index 8dcf776..3930fe5 100644 (file)
@@ -476,8 +476,8 @@ function DisplayScrollSpeed(pn)
     if lowBPM == highBPM then highBPM = nil end 
 
     local rateMod = string.gsub(GetRateMod(),'x','')
-
     local speedMod = GetSpeedMod(pn)
+       
     speedMod = string.gsub(speedMod,'x','')
     speedMod = string.gsub(speedMod,'c','')
     speedMod = string.gsub(speedMod,'m','')
index 168710c..d2bfe1c 100644 (file)
@@ -141,42 +141,36 @@ function RateMods()
 end\r
 \r
 function GetSpeedMod(pn)\r
-    local BaseSpeeds = GetBaseSpeeds()\r
-    local ExtraSpeeds = GetExtraSpeeds()\r
-    for n = 1, table.getn(BaseSpeeds) do\r
-        if GetSpeedModRowType() == "basic" or GetSpeedModRowType() == "advanced" then\r
-            if GAMESTATE:PlayerIsUsingModifier(pn, BaseSpeeds[n]) then return BaseSpeeds[n] end\r
-        end\r
-\r
-        if GetSpeedModRowType() == "pro" then\r
-            for m = 1, table.getn(ExtraSpeeds) do\r
-                local CombinedSpeeds = BaseSpeeds[n] + string.gsub(ExtraSpeeds[m], 'x', '') --combines the speeds in to things like 4.50\r
-\r
-                --check x-mods\r
-                if GAMESTATE:PlayerIsUsingModifier(pn, CombinedSpeeds .. 'x') then return CombinedSpeeds .. 'x' end\r
+       local BaseSpeeds = GetBaseSpeeds()\r
+       local ExtraSpeeds = GetExtraSpeeds()\r
+       for n = 1, table.getn(BaseSpeeds) do\r
+               if GetSpeedModRowType() == "basic" or GetSpeedModRowType() == "advanced" then\r
+                       if GAMESTATE:PlayerIsUsingModifier(pn, BaseSpeeds[n]) then return BaseSpeeds[n] end\r
+               end\r
+\r
+               if GetSpeedModRowType() == "pro" then\r
+                       for m = 1, table.getn(ExtraSpeeds) do\r
+                               local CombinedSpeeds = BaseSpeeds[n] + string.gsub(ExtraSpeeds[m], 'x', '') --combines the speeds in to things like 4.50\r
+\r
+                               --check x-mods\r
+                               if GAMESTATE:PlayerIsUsingModifier(pn, CombinedSpeeds .. 'x') then return CombinedSpeeds .. 'x' end\r
        \r
-                --check c-mods\r
-                if GAMESTATE:PlayerIsUsingModifier(pn, 'c' .. CombinedSpeeds*100) then return 'c' .. CombinedSpeeds*100 end\r
-            end\r
+                               --check c-mods\r
+                               if GAMESTATE:PlayerIsUsingModifier(pn, 'c' .. CombinedSpeeds*100) then return 'c' .. CombinedSpeeds*100 end\r
+                               \r
+                               --check m-mods (for some reason m0 is always applied so it has to be skipped)\r
+                               if GAMESTATE:PlayerIsUsingModifier(pn, 'm' .. CombinedSpeeds*100) and CombinedSpeeds ~= 0 then return 'm' .. CombinedSpeeds*100 end\r
+                       end\r
+               end\r
        end\r
-    end\r
-\r
-    -- M-Mods need to be checked last, as when the game starts m0 is always applied (even if a different default modifier has been chosen)\r
-    for n = 1, table.getn(BaseSpeeds) do\r
-        if GetSpeedModRowType() == "pro" then\r
-            for m = 1, table.getn(ExtraSpeeds) do\r
-                local CombinedSpeeds = BaseSpeeds[n] + string.gsub(ExtraSpeeds[m], 'x', '') --combines the speeds in to things like 4.50                       \r
-\r
-                if GAMESTATE:PlayerIsUsingModifier(pn, 'm' .. CombinedSpeeds*100) then return 'm' .. CombinedSpeeds*100 end\r
-            end\r
-        end\r
-    end\r
        \r
-    return nil\r
+       -- If we get here, chances are that m0 was applied.\r
+       return "m0"\r
 end\r
 \r
 function GetSpeedModBase(pn)\r
     local SpeedMod = GetSpeedMod(pn)\r
+       \r
     SpeedMod = string.gsub(SpeedMod, 'c', '')\r
     SpeedMod = string.gsub(SpeedMod, 'm', '')\r
     SpeedMod = string.gsub(SpeedMod, 'x', '')\r
@@ -250,7 +244,7 @@ function SpeedMods(name)
                        \r
         if GetSpeedModRowType() ~= "pro" then\r
             GAMESTATE:ApplyGameCommand('mod,' .. ModBase, pn+1)\r
-            MESSAGEMAN:Broadcast('SpeedModChanged')\r
+            MESSAGEMAN:Broadcast('SpeedModChangedP' .. pn+1)\r
         else\r
             SpeedMod = ModBase + ModExtra\r
                \r
@@ -267,7 +261,7 @@ function SpeedMods(name)
             if ModType == 'm-mod' then GAMESTATE:ApplyGameCommand('mod,9999x',pn+1) end\r
             if ModType == 'x-mod' then GAMESTATE:ApplyGameCommand('mod,m9999',pn+1) end\r
             GAMESTATE:ApplyGameCommand('mod,'..SpeedMod,pn+1) --this is so annoying, the player number has to be 1 or 2 for ApplyGameCommand\r
-            MESSAGEMAN:Broadcast('SpeedModChanged')\r
+            MESSAGEMAN:Broadcast('SpeedModChangedP' .. pn+1)\r
         end\r
     end\r
 \r
index da7321f..bf0bfd0 100644 (file)
@@ -355,9 +355,10 @@ end
 
 --easter eggs
 local function BlazeIt(Params)
-    local spaces = string.rep(" ", string.len(DisplayScrollSpeed(Params.pn)))
+       local ScrollSpeed = DisplayScrollSpeed(Params.pn)
+    local spaces = string.rep(" ", string.len(ScrollSpeed))
 
-    if DisplayScrollSpeed(Params.pn) == '420' then
+    if ScrollSpeed == '420' then
         Params.Actor:settext(spaces .. " Blaze It!")
         Params.Actor:diffusealpha(1)
         Params.Actor:rainbow()
@@ -367,9 +368,10 @@ local function BlazeIt(Params)
 end
 
 local function NoScope(Params)
-    local spaces = string.rep(" ", string.len(DisplayScrollSpeed(Params.pn)))
+       local ScrollSpeed = DisplayScrollSpeed(Params.pn)
+    local spaces = string.rep(" ", string.len(ScrollSpeed))
 
-    if DisplayScrollSpeed(Params.pn) == '360' then
+    if ScrollSpeed == '360' then
         Params.Actor:settext(spaces .. " No Scope!")
         Params.Actor:diffusealpha(1)
         Params.Actor:rainbow()