Skip to content

Commit

Permalink
rebirth add preference for wheel spin speed
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Feb 19, 2023
1 parent 3ca13fb commit f0eb69a
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 8 deletions.
72 changes: 69 additions & 3 deletions Themes/Rebirth/BGAnimations/playerInfoFrame/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ local translations = {
["CategoryGameplay Elements 1"] = THEME:GetString("Settings", "CategoryGameplay Elements 1"),
["CategoryGameplay Elements 2"] = THEME:GetString("Settings", "CategoryGameplay Elements 2"),
["CategoryGlobal Options"] = THEME:GetString("Settings", "CategoryGlobal Options"),
["CategoryTheme Options"] = THEME:GetString("Settings", "CategoryTheme Options"),
["CategoryTheme Options 1"] = THEME:GetString("Settings", "CategoryTheme Options 1"),
["CategoryTheme Options 2"] = THEME:GetString("Settings", "CategoryTheme Options 2"),
["CategorySound Options"] = THEME:GetString("Settings", "CategorySound Options"),
["CategoryInput Options"] = THEME:GetString("Settings", "CategoryInput Options"),
["CategoryProfile Options"] = THEME:GetString("Settings", "CategoryProfile Options"),
Expand Down Expand Up @@ -377,6 +378,8 @@ local translations = {
MusicWheelPositionExplanation = THEME:GetString("Settings", "MusicWheelPositionExplanation"),
MusicWheelBanners = THEME:GetString("Settings", "MusicWheelBanners"),
MusicWheelBannersExplanation = THEME:GetString("Settings", "MusicWheelBannersExplanation"),
MusicWheelSpeed = THEME:GetString("Settings", "MusicWheelSpeed"),
MusicWheelSpeedExplanation = THEME:GetString("Settings", "MusicWheelSpeedExplanation"),
VideoBanners = THEME:GetString("Settings", "VideoBanners"),
VideoBannersExplanation = THEME:GetString("Settings", "VideoBannersExplanation"),
ShowBGs = THEME:GetString("Settings", "ShowBGs"),
Expand Down Expand Up @@ -3245,6 +3248,7 @@ local function rightFrame()
},
wheelPosition = themeoption("global", "WheelPosition"),
wheelBanners = themeoption("global", "WheelBanners"),
wheelSpeed = themeoption("global", "WheelSpeed"),
showBackgrounds = PREFSMAN:GetPreference("ShowBackgrounds"),
showBanners = themeoption("global", "ShowBanners"),
useSingleColorBG = themeoption("global", "FallbackToAverageColorBG"),
Expand Down Expand Up @@ -3552,7 +3556,8 @@ local function rightFrame()
},
Graphics = {
"Global Options",
"Theme Options",
"Theme Options 1",
"Theme Options 2",
},
Sound = {
"Sound Options",
Expand Down Expand Up @@ -5707,7 +5712,7 @@ local function rightFrame()
--
-----
-- THEME OPTIONS
["Theme Options"] = {
["Theme Options 1"] = {
{
Name = "Music Wheel Position",
DisplayName = translations["MusicWheelPosition"],
Expand All @@ -5726,6 +5731,33 @@ local function rightFrame()
Directions = optionDataToggleDirectionsFUNC("wheelBanners", true, false),
ChoiceIndexGetter = optionDataToggleIndexGetterFUNC("wheelBanners", true),
},
{
Name = "Music Wheel Speed",
DisplayName = translations["MusicWheelSpeed"],
Type = "SingleChoice",
Explanation = translations["MusicWheelSpeedExplanation"],
ChoiceGenerator = function()
local o = {}
for i = 5, 50 do
o[#o+1] = {
Name = i,
DisplayName = i,
ChosenFunction = function()
optionData["wheelSpeed"].set(i)
end,
}
end
return o
end,
ChoiceIndexGetter = function()
local v = optionData["wheelSpeed"].get()
if v < 1 or v > 50 then
return 1
else
return v
end
end,
},
{
Name = "Video Banners",
DisplayName = translations["VideoBanners"],
Expand Down Expand Up @@ -5789,6 +5821,40 @@ local function rightFrame()
Directions = preferenceToggleDirections("SortBySSRNormPercent", true, false),
ChoiceIndexGetter = preferenceToggleIndexGetter("SortBySSRNormPercent", true),
},
{
Name = "Color Config",
DisplayName = translations["ColorConfig"],
Type = "Button",
Explanation = translations["ColorConfigExplanation"],
Choices = {
{
Name = "Color Config",
DisplayName = translations["ColorConfigButton"],
ChosenFunction = function()
-- activate color config screen
MESSAGEMAN:Broadcast("ShowSettingsAlt", {name = "Color Config"})
end,
},
}
},
{
Name = "Asset Settings",
DisplayName = translations["AssetSettings"],
Type = "Button",
Explanation = translations["AssetSettingsExplanation"],
Choices = {
{
Name = "Asset Settings",
DisplayName = translations["AssetSettingsButton"],
ChosenFunction = function()
-- activate asset settings screen
MESSAGEMAN:Broadcast("PlayerInfoFrameTabSet", {tab = "AssetSettings", prevScreen = "Settings"})
end,
},
}
},
},
["Theme Options 2"] = {
{
Name = "Show Lyrics",
DisplayName = translations["ShowLyrics"],
Expand Down
5 changes: 4 additions & 1 deletion Themes/Rebirth/Languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,8 @@ CategoryInvalidating Options=Invalidating Options
CategoryGameplay Elements 1=Gameplay Elements 1
CategoryGameplay Elements 2=Gameplay Elements 2
CategoryGlobal Options=Global Options
CategoryTheme Options=Theme Options
CategoryTheme Options 1=Theme Options 1
CategoryTheme Options 2=Theme Options 2
CategorySound Options=Sound Options
CategoryInput Options=Input Options
CategoryProfile Options=Profile Options
Expand Down Expand Up @@ -929,6 +930,8 @@ MusicWheelPosition=Music Wheel Position
MusicWheelPositionExplanation=Set the side of the screen for the music wheel.
MusicWheelBanners=Music Wheel Banners
MusicWheelBannersExplanation=Toggle the banners on the music wheel.
MusicWheelSpeed=Music Wheel Speed
MusicWheelSpeedExplanation=Set the spin speed of the music wheel.
VideoBanners=Video Banners
VideoBannersExplanation=Toggle allowing video banners to play at all on the wheel and other locations in music select.
ShowBGs=Show Backgrounds
Expand Down
3 changes: 2 additions & 1 deletion Themes/Rebirth/Languages/ja.ini
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,8 @@ CategoryInvalidating Options=Invalidating Options
CategoryGameplay Elements 1=Gameplay Elements 1
CategoryGameplay Elements 2=Gameplay Elements 2
CategoryGlobal Options=Global Options
CategoryTheme Options=Theme Options
CategoryTheme Options 1=Theme Options 1
CategoryTheme Options 2=Theme Options 2
CategorySound Options=Sound Options
CategoryInput Options=Input Options
CategoryProfile Options=Profile Options
Expand Down
4 changes: 4 additions & 0 deletions Themes/Rebirth/Scripts/01 theme_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ local defaultConfig = {
VideoBanners = true,
WheelPosition = true, -- true = left, false = right
WheelBanners = true, -- true = on, false = off
WheelSpeed = 15,
},
}

Expand All @@ -21,6 +22,9 @@ end
function useWheelBanners()
return themeConfig:get_data().global.WheelBanners
end
function getWheelSpeed()
return themeConfig:get_data().global.WheelSpeed
end
function useVideoBanners()
return themeConfig:get_data().global.VideoBanners
end
Expand Down
18 changes: 15 additions & 3 deletions Themes/Rebirth/Scripts/11 Wheel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,18 @@ local SOUND_SELECT = nil

-- timer stuff
local last_wheel_move_timestamp = GetTimeSinceStart()
local MAX_WHEEL_SOUND_SPEED = 15
local spinSpeed = function()
if themeConfig and getWheelSpeed then
local sp = getWheelSpeed()
if sp > 0 then
return sp
else
return 15
end
else
return 15
end
end

Wheel.mt = {
updateMusicFromCurrentItem = function(whee)
Expand Down Expand Up @@ -167,7 +178,7 @@ Wheel.mt = {
end

whee.timeBeforeMovingBegins = 1 / 8 -- this was hardcoded and there is no justification for it
whee.spinSpeed = 15 -- preference based (CHANGE THIS)
whee.spinSpeed = spinSpeed() -- preference based (CHANGE THIS)
whee.moving = num

if whee.moving ~= 0 then
Expand Down Expand Up @@ -815,10 +826,11 @@ function Wheel:new(params)
whee.keepupdating = false
whee:update()
end
local MAX_WHEEL_SOUND_SPEED = spinSpeed()

-- handle wheel movement moving moves
if whee.moving ~= 0 and whee.timeBeforeMovingBegins == 0 then
local sping = whee.spinSpeed * whee.moving
local sping = whee.spinSpeed * whee.moving * 1.25
whee.positionOffsetFromSelection = clamp(whee.positionOffsetFromSelection - (sping * delta), -1, 1)
if (whee.moving == -1 and whee.positionOffsetFromSelection >= 0) or
(whee.moving == 1 and whee.positionOffsetFromSelection <= 0) then
Expand Down

0 comments on commit f0eb69a

Please sign in to comment.