New functions for #9 also cleaned up the existings ones.
authorCameron Ball <c.ball1729@gmail.com>
Mon, 9 Dec 2013 08:12:45 +0000 (16:12 +0800)
committerCameron Ball <c.ball1729@gmail.com>
Mon, 9 Dec 2013 08:12:45 +0000 (16:12 +0800)
Themes/GrooveNights/BGAnimations/ScreenEvaluation overlay.xml
Themes/GrooveNights/BGAnimations/ScreenPlayerOptions overlay/default.xml
Themes/GrooveNights/Scripts/Other.lua

index 65965a7..6bd1918 100644 (file)
@@ -262,7 +262,7 @@ end">
                             
                             if GAMESTATE:IsPlayerEnabled(PLAYER_2) then pn = PLAYER_2 end
 
-                            local bpm = DisplayBPM(pn, true, false)
+                            local bpm = DisplayBPM(pn)
 
                             if GetRateMod() ~= '1.0x' then
                                 gnSongLengthDisplay = string.gsub(gnSongLength,'Patched','Length Patched');
index ffeb98e..078071a 100644 (file)
                        InitCommand="%function(self) self:stoptweening(); self:zoom(0.5); self:shadowlength(0); self:x(SCREEN_CENTER_X-200); self:y(SCREEN_CENTER_Y+118); self:maxwidth(140); end"
                        SpeedModChangedMessageCommand="queuecommand,Update"
                        RateModChangedMessageCommand="queuecommand,Update"
-                       UpdateCommand="%function(self) self:settext(DisplayBPM(PLAYER_1, true, false)) end"
+                       UpdateCommand="%function(self) self:settext(DisplayBPM(PLAYER_1)) end"
                        OnCommand="horizalign,left;zoom,0.5;"                   
                />
                <BitmapText
                        OnCommand="horizalign,left;zoom,0.5;queuecommand,loop;"
                        SpeedModChangedMessageCommand="queuecommand,Update"
                        RateModChangedMessageCommand="queuecommand,Update"
-                       UpdateCommand="%function(self) self:settext(DisplayBPM(PLAYER_1, true, true)) end"                      
+                       UpdateCommand="%function(self) self:settext(DisplayScrollSpeed(PLAYER_1)) end"                  
                        
                        loopCommand="%function(self)
                        getModP1 = 0;
                        OnCommand="horizalign,left;zoom,0.5;"                   
                        SpeedModChangedMessageCommand="queuecommand,Update"
                        RateModChangedMessageCommand="queuecommand,Update"
-                       UpdateCommand="%function(self) self:settext(DisplayBPM(PLAYER_2, true, false)) end"
+                       UpdateCommand="%function(self) self:settext(DisplayBPM(PLAYER_2)) end"
                />
                <BitmapText
                        Text="Speed:"
                        OnCommand="horizalign,left;zoom,0.5;queuecommand,loop;"
                        SpeedModChangedMessageCommand="queuecommand,Update"
                        RateModChangedMessageCommand="queuecommand,Update"
-                       UpdateCommand="%function(self) self:settext(DisplayBPM(PLAYER_2, true, true)) end"                      
+                       UpdateCommand="%function(self) self:settext(DisplayScrollSpeed(PLAYER_2)) end"                  
                        
                        loopCommand="%function(self)
                        getModP2 = 0;
index 7922245..94b5066 100644 (file)
@@ -450,85 +450,43 @@ function SpeedLines()
     end
 end
 
-function DisplayBPM(pn, includeRate, includeSpeed) 
-        local lowBPM = bpm[1]
-        local highBPM = bpm[2]  
-
-        local rateMod = string.gsub(GetRateMod(),'x','')
-        rateMod = tonumber(rateMod)
-
-        local speedMod = GetSpeedMod(pn)
-        speedMod = string.gsub(speedMod,'x','')
-        speedMod = string.gsub(speedMod,'c','')
-        speedMod = string.gsub(speedMod,'m','')
-
-        if not includeRate then rateMod = 1 end
-        if not includeSpeed then speedMod = 1 end
-
-        if lowBPM == "Various" or lowBPM == "..." or lowBPM == nil then
-            return "???"
-        end
-
-        lowScrollBPM = lowBPM * speedMod * rateMod
-
-        if string.sub(lowScrollBPM, 2, 2) == "." then
-        lowScrollBPM = string.sub(lowScrollBPM, 1, 1)
-        end
-
-        if string.sub(lowScrollBPM, 3, 3) == "." then
-        lowScrollBPM = string.sub(lowScrollBPM, 1, 2)
-        end
-
-        if string.sub(lowScrollBPM, 4, 4) == "." then
-        lowScrollBPM = string.sub(lowScrollBPM, 1, 3)
-        end
-
-        if string.sub(lowScrollBPM, 5, 5) == "." then
-        lowScrollBPM = string.sub(lowScrollBPM, 1, 4)
-        end
-
-        if string.sub(lowScrollBPM, 6, 6) == "." then
-        lowScrollBPM = string.sub(lowScrollBPM, 1, 5)
-        end
-
-        if highBPM ~= "" then
-
-                highScrollBPM = highBPM * speedMod * rateMod
-
-                if string.sub(highScrollBPM, 2, 2) == "." then
-                highScrollBPM = string.sub(highScrollBPM, 1, 1)
-                end
-
-                if string.sub(highScrollBPM, 3, 3) == "." then
-                highScrollBPM = string.sub(highScrollBPM, 1, 2)
-                end
-
-                if string.sub(highScrollBPM, 4, 4) == "." then
-                highScrollBPM = string.sub(highScrollBPM, 1, 3)
-                end
-
-                if string.sub(highScrollBPM, 5, 5) == "." then
-                highScrollBPM = string.sub(highScrollBPM, 1, 4)
-                end
-
-                if string.sub(highScrollBPM, 6, 6) == "." then
-                highScrollBPM = string.sub(highScrollBPM, 1, 5)
-                end
-        end
-
-        --[[
-        If we want to include rate and speed but we also have a c or m mod, we
-        can just return the speedMod as that will be the scroll speed regardless
-        of the rate/speed mod chosen
-        ]]--
-        if includeRate and includeSpeed and (GetSpeedModType(pn) == "m-mod" or GetSpeedModType(pn) == "c-mod") then
-            return speedMod
-        end
-
-        -- In every other case we return the bpm range adjusted for the speed and rate.
-        if highBPM == "" then
-            return lowScrollBPM
-        else
-            return lowScrollBPM .. "-" .. highScrollBPM
-        end
+function DisplayBPM(pn) 
+    local lowBPM = bpm[1]
+    local highBPM = bpm[2]  
+
+    local rateMod = string.gsub(GetRateMod(),'x','')
+
+    if lowBPM == "Various" or lowBPM == "..." or lowBPM == nil then
+        return "???"
+    end
+
+    lowScrollBPM = math.floor(lowBPM * rateMod)
+
+    if highBPM ~= "" then highScrollBPM = math.floor(highBPM * rateMod) end
+
+    if highBPM == "" then return lowScrollBPM else return lowScrollBPM .. "-" .. highScrollBPM end
+end
+
+function DisplayScrollSpeed(pn)
+    local lowBPM = bpm[1]
+    local highBPM = bpm[2]  
+
+    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','')
+
+    if GetSpeedModType(pn) == "c-mod" or GetSpeedModType(pn) == "m-mod" then return speedMod end
+
+    if lowBPM == "Various" or lowBPM == "..." or lowBPM == nil then
+        return "???"
+    end
+
+    lowScrollBPM = math.floor(lowBPM * speedMod * rateMod)
+
+    if highBPM ~= "" then highScrollBPM = math.floor(highBPM *speedMod * rateMod) end
+
+    if highBPM == "" then return lowScrollBPM else return lowScrollBPM .. "-" .. highScrollBPM end
 end
\ No newline at end of file