Changed ArbitrarySpeedMods to use a large increment that is not forced to be a multiple of the smaller increment.

This commit is contained in:
Kyzentun
2014-08-02 00:38:31 -07:00
committed by Jonathan Payne
parent 4b7a6d092a
commit 32664e7e17
3 changed files with 21 additions and 22 deletions
+2 -2
View File
@@ -480,7 +480,7 @@ SoundVolume=Adjust the volume level during gameplay.
SoundVolumeAttract=Adjust the volume level during attract mode. SoundVolumeAttract=Adjust the volume level during attract mode.
Speed=Speed Speed=Speed
Speed Increment=Size of the smaller increments used to adjust the speed mod. Speed Increment=Size of the smaller increments used to adjust the speed mod.
Speed Multiple=Multiplied by Speed Increment to calculate the size of the large increments used to adjust the speed mod. Speed Increment Large=Size of the larger increments used to adjust the speed mod.
StepMania Credits=The StepMania Development Team. StepMania Credits=The StepMania Development Team.
Steps=Steps Steps=Steps
StretchBackgrounds=Toggle the stretching of backgrounds. StretchBackgrounds=Toggle the stretching of backgrounds.
@@ -1104,7 +1104,7 @@ SoundVolume=Sound Volume
SoundVolumeAttract=Attract Volume SoundVolumeAttract=Attract Volume
Speed=Speed Speed=Speed
Speed Increment=Speed Increment Speed Increment=Speed Increment
Speed Multiple=Speed Multiple Speed Increment Large=Speed Increment Large
Step Author=Step Author Step Author=Step Author
Steps=Steps Steps=Steps
Stream=Stream Stream=Stream
+18 -19
View File
@@ -247,7 +247,7 @@ function SpeedMods()
end end
local default_speed_increment= 25 local default_speed_increment= 25
local default_speed_inc_multiple= 4 local default_speed_inc_large= 100
local function get_speed_increment() local function get_speed_increment()
local increment= default_speed_increment local increment= default_speed_increment
@@ -259,14 +259,14 @@ local function get_speed_increment()
return increment return increment
end end
local function get_speed_multiple() local function get_speed_inc_large()
local multiple= default_speed_inc_multiple local inc_large= default_speed_inc_large
if ReadGamePrefFromFile("SpeedMultiple") then if ReadGamePrefFromFile("SpeedIncLarge") then
multiple= tonumber(GetGamePref("SpeedMultiple")) or default_speed_inc_multiple inc_large= tonumber(GetGamePref("SpeedIncLarge")) or default_speed_inc_large
else else
WriteGamePrefToFile("SpeedMultiple", multiple) WriteGamePrefToFile("SpeedIncLarge", inc_large)
end end
return multiple return inc_large
end end
function SpeedModIncSize() function SpeedModIncSize()
@@ -305,12 +305,12 @@ function SpeedModIncSize()
return ret return ret
end end
function SpeedModIncMultiple() function SpeedModIncLarge()
-- An option row for controlling the size of the increment used by -- An option row for controlling the size of the increment used by
-- ArbitrarySpeedMods. -- ArbitrarySpeedMods.
local multiple= get_speed_multiple() local inc_large= get_speed_inc_large()
local ret= { local ret= {
Name= "Speed Multiple", Name= "Speed Increment Large",
LayoutType= "ShowAllInRow", LayoutType= "ShowAllInRow",
SelectType= "SelectMultiple", SelectType= "SelectMultiple",
OneChoiceForAllPlayers= true, OneChoiceForAllPlayers= true,
@@ -319,22 +319,22 @@ function SpeedModIncMultiple()
list[1]= true list[1]= true
end, end,
SaveSelections= function(self, list, pn) SaveSelections= function(self, list, pn)
WriteGamePrefToFile("SpeedMultiple", multiple) WriteGamePrefToFile("SpeedIncLarge", inc_large)
end, end,
NotifyOfSelection= function(self, pn, choice) NotifyOfSelection= function(self, pn, choice)
-- return true even though we didn't actually change anything so that -- return true even though we didn't actually change anything so that
-- the underlines will stay correct. -- the underlines will stay correct.
if choice == 1 then return true end if choice == 1 then return true end
local incs= {5, 1, -1, -5} local incs= {10, 1, -1, -10}
local new_val= multiple + incs[choice-1] local new_val= inc_large + incs[choice-1]
if new_val > 0 then if new_val > 0 then
multiple= new_val inc_large= new_val
end end
self:GenChoices() self:GenChoices()
return true return true
end, end,
GenChoices= function(self) GenChoices= function(self)
self.Choices= {tostring(multiple), "+5", "+1", "-1", "-5"} self.Choices= {tostring(inc_large), "+10", "+1", "-1", "-10"}
end end
} }
ret:GenChoices() ret:GenChoices()
@@ -344,7 +344,7 @@ end
function ArbitrarySpeedMods() function ArbitrarySpeedMods()
-- If players are allowed to join while this option row is active, problems will probably occur. -- If players are allowed to join while this option row is active, problems will probably occur.
local increment= get_speed_increment() local increment= get_speed_increment()
local multiple= get_speed_multiple() local inc_large= get_speed_inc_large()
local ret= { local ret= {
Name= "Speed", Name= "Speed",
LayoutType= "ShowAllInRow", LayoutType= "ShowAllInRow",
@@ -391,8 +391,7 @@ function ArbitrarySpeedMods()
if real_choice < 1 then return true end if real_choice < 1 then return true end
local val= self.CurValues[pn] local val= self.CurValues[pn]
if real_choice < 5 then if real_choice < 5 then
local big_inc= increment * multiple local incs= {inc_large, increment, -increment, -inc_large}
local incs= {big_inc, increment, -increment, -big_inc}
local new_val= val.speed + incs[real_choice] local new_val= val.speed + incs[real_choice]
if new_val > 0 then if new_val > 0 then
val.speed= math.round(new_val) val.speed= math.round(new_val)
@@ -412,7 +411,7 @@ function ArbitrarySpeedMods()
show_x_incs= true show_x_incs= true
end end
end end
local big_inc= increment * multiple local big_inc= inc_large
local small_inc= increment local small_inc= increment
if show_x_incs then if show_x_incs then
big_inc= tostring(big_inc / 100) big_inc= tostring(big_inc / 100)
+1 -1
View File
@@ -2938,7 +2938,7 @@ Line3="conf,TimingWindowScale"
Line4="conf,LifeDifficulty" Line4="conf,LifeDifficulty"
Line8="lua,GamePrefDefaultFail()" Line8="lua,GamePrefDefaultFail()"
LineSI="lua,SpeedModIncSize()" LineSI="lua,SpeedModIncSize()"
LineSM="lua,SpeedModIncMultiple()" LineSM="lua,SpeedModIncLarge()"
Line11="conf,AllowW1" Line11="conf,AllowW1"
Line13="conf,HiddenSongs" Line13="conf,HiddenSongs"
Line14="conf,EasterEggs" Line14="conf,EasterEggs"