Skip to content

Commit

Permalink
move song bg toggle thing to preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Aug 4, 2022
1 parent f7fb44d commit 3297f86
Show file tree
Hide file tree
Showing 21 changed files with 20 additions and 169 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-- reset context manager as early as possible in the evaluation init process
-- this should be a safe place to do it, between all context manager registrations (if they exist)
CONTEXTMAN:Reset()
local showbg = function() return PREFSMAN:GetPreference("ShowBackgrounds") end

local t = Def.ActorFrame {
Name = "UnderlayFile",
Expand All @@ -19,7 +20,7 @@ t[#t+1] = Def.Sprite {
end,
SetCommand = function(self, params)
self:finishtweening()
if params.song and params.song:GetBackgroundPath() then
if params.song and params.song:GetBackgroundPath() and showbg() then
self:visible(true)
self:LoadBackground(params.song:GetBackgroundPath())
self:scaletocover(0, 0, SCREEN_WIDTH, SCREEN_BOTTOM)
Expand Down
15 changes: 0 additions & 15 deletions Themes/Rebirth/BGAnimations/ScreenGameplay underlay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,4 @@ else
songoptions:RandomBGOnly(false)
end

local showbgs = themeConfig:get_data().global.ShowBackgrounds
if not showbgs then
return Def.ActorFrame {
Def.Quad {
Name = "SCUFFEDBACKGROUND",
InitCommand = function(self)
self:valign(0):halign(0)
self:zoomto(SCREEN_WIDTH, SCREEN_HEIGHT)
self:diffuse(color("#000000"))
self:diffusealpha(1)
end,
},
}
end

return Def.ActorFrame {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local showbg = function() return themeConfig:get_data().global.ShowBackgrounds end
local showbg = function() return PREFSMAN:GetPreference("ShowBackgrounds") end
local avgcolorbg = function() return themeConfig:get_data().global.FallbackToAverageColorBG end
local t = Def.ActorFrame {
Name = "UnderlayFile",
Expand Down
6 changes: 3 additions & 3 deletions Themes/Rebirth/BGAnimations/playerInfoFrame/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3231,7 +3231,7 @@ local function rightFrame()
},
wheelPosition = themeoption("global", "WheelPosition"),
wheelBanners = themeoption("global", "WheelBanners"),
showBackgrounds = themeoption("global", "ShowBackgrounds"),
showBackgrounds = PREFSMAN:GetPreference("ShowBackgrounds"),
useSingleColorBG = themeoption("global", "FallbackToAverageColorBG"),
showVisualizer = themeoption("global", "ShowVisualizer"),
tipType = themeoption("global", "TipType"),
Expand Down Expand Up @@ -5654,8 +5654,8 @@ local function rightFrame()
Type = "SingleChoice",
Explanation = translations["ShowBGsExplanation"],
Choices = choiceSkeleton("Yes", "No"),
Directions = optionDataToggleDirectionsFUNC("showBackgrounds", true, false),
ChoiceIndexGetter = optionDataToggleIndexGetterFUNC("showBackgrounds", true),
Directions = preferenceToggleDirections("ShowBackgrounds", true, false),
ChoiceIndexGetter = preferenceToggleIndexGetter("ShowBackgrounds", true),
},
{
Name = "BG Fallback to Banner Color",
Expand Down
1 change: 0 additions & 1 deletion Themes/Rebirth/Scripts/01 theme_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ local defaultConfig = {
global = {
TipType = 1, -- 1 = tips, 2 = quotes ...
ShowVisualizer = true,
ShowBackgrounds = true, -- wheel and gameplay bg
FallbackToAverageColorBG = true, -- wheel bg only
StaticBackgrounds = false,
VideoBanners = true,
Expand Down
64 changes: 0 additions & 64 deletions Themes/Rebirth/Scripts/02 ThemePrefs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -801,70 +801,6 @@ function TipType()
return t
end

function SongBGEnabled()
local t = {
Name = "SongBGEnabled",
LayoutType = "ShowAllInRow",
SelectType = "SelectOne",
OneChoiceForAllPlayers = true,
ExportOnChange = true,
Choices = {THEME:GetString("OptionNames", "Off"), THEME:GetString("OptionNames", "On")},
LoadSelections = function(self, list, pn)
local pref = themeConfig:get_data().global.SongBGEnabled
if pref then
list[2] = true
else
list[1] = true
end
end,
SaveSelections = function(self, list, pn)
local value
if list[1] then
value = false
else
value = true
end
themeConfig:get_data().global.SongBGEnabled = value
themeConfig:set_dirty()
themeConfig:save()
end
}
setmetatable(t, t)
return t
end

function SongBGMouseEnabled()
local t = {
Name = "SongBGMouseEnabled",
LayoutType = "ShowAllInRow",
SelectType = "SelectOne",
OneChoiceForAllPlayers = true,
ExportOnChange = true,
Choices = {THEME:GetString("OptionNames", "Off"), THEME:GetString("OptionNames", "On")},
LoadSelections = function(self, list, pn)
local pref = themeConfig:get_data().global.SongBGMouseEnabled
if pref then
list[2] = true
else
list[1] = true
end
end,
SaveSelections = function(self, list, pn)
local value
if list[1] then
value = false
else
value = true
end
themeConfig:get_data().global.SongBGMouseEnabled = value
themeConfig:set_dirty()
themeConfig:save()
end
}
setmetatable(t, t)
return t
end

function EvalBGType()
local t = {
Name = "EvalBGType",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local enabled = themeConfig:get_data().global.SongBGEnabled
local enabled = PREFSMAN:GetPreference("ShowBackgrounds")
local brightness = 0.4
local t = Def.ActorFrame {}

Expand Down
2 changes: 1 addition & 1 deletion Themes/Til Death/BGAnimations/_songbg.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local enabled = themeConfig:get_data().global.SongBGEnabled
local enabled = PREFSMAN:GetPreference("ShowBackgrounds")
local brightness = 0.3

local t = Def.ActorFrame {}
Expand Down
4 changes: 0 additions & 4 deletions Themes/Til Death/Languages/de.ini
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ NPSDisplay=NPS Anzeige
DefaultScoreType=Standard Ergebnisart
TipType=Tipps
SongBGEnabled=Lied-Hintergründe
EvalBGType=Evaluationshintergrundart
SongBGMouseEnabled=Hintergrund bewegen
Particles=Partikeleffekte
RateSort=Sortierung nach Rate
HelpMenu=Hilfsmenü
Expand Down Expand Up @@ -162,9 +160,7 @@ Avatars=Avatar setzen
DefaultScoreType=Standard Ergebnisart
TipType=Zeigt entweder Tipps, Zitate oder keines von beidem.
SongBGEnabled=Schaltet den Liedhintergrund Ein/Aus. Kann mittleres Ruckeln verursachen.
EvalBGType=Art des Hintergrundes für den Ergebnisbildschirm.
SongBGMouseEnabled=Erlaubt es den Hintergrund mit der Maus zu bewegen.
Particles=Partikeleffekte
RateSort=Ergebnise werden nach Rate sortiert.
Expand Down
4 changes: 0 additions & 4 deletions Themes/Til Death/Languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,7 @@ NPSDisplay=NPS Display
DefaultScoreType = Default ScoreType
TipType = Tip Type
SongBGEnabled = Show Background
EvalBGType = Eval Background Type
SongBGMouseEnabled = Move Background
Particles = Particles
RateSort = RateSort
HelpMenu = Help Menu
Expand Down Expand Up @@ -219,9 +217,7 @@ ShowPlayerOptionsHint=Turn this off to disable the bright hint that tells you to
DefaultScoreType = Default ScoreType
TipType = Sets the Tiptype to either display tips or random quotes and phrases or nothing at all.
SongBGEnabled = Toggle whether to show the song's background image or not on the select and the eval screen. Turn this off if you experience stutter or lag while scrolling through songs.
EvalBGType = Set the type of background to show for ScreenEvaluation.
SongBGMouseEnabled = Toggle whether to enable the moving of the background image with the mouse.
Particles = Toggle whether to show particles or not for certain screens.
RateSort = If enabled, the scores will be sorted for different rate mod that was used.
Expand Down
4 changes: 0 additions & 4 deletions Themes/Til Death/Languages/zh.ini
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,7 @@ NPSDisplay=NPS窗口
DefaultScoreType = 默認分數類型
TipType = 小貼士類型
SongBGEnabled = 歌曲背景圖片
EvalBGType = 結算背景樣式
SongBGMouseEnabled = 移動背景圖片
Particles = 粒子特效
RateSort = 播放速率排列
HelpMenu = 幫助菜單
Expand Down Expand Up @@ -212,9 +210,7 @@ Avatars=設置頭像. 此項是臨時的.
DefaultScoreType = 設定默認分數類型.
TipType = 設定小貼士的類型, 可選顯示幫助提示, 隨機語句或是關閉.
SongBGEnabled = 選擇是否在選歌界面和結算界面顯示歌曲背景圖片. 如果在選擇歌曲時有明顯卡頓, 建議關閉背景顯示.
EvalBGType = 設定在結算界面顯示的背景.
SongBGMouseEnabled = 選擇是否開啟可用鼠標移動背景圖片的功能.
Particles = 選擇是否在某些界面開啟粒子特效.
RateSort = 選擇是否開啟播放速率排列. 開啟時會將不同播放速率下的成績區分開.
Expand Down
3 changes: 0 additions & 3 deletions Themes/Til Death/Scripts/01 theme_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ local defaultConfig = {
DefaultScoreType = 4, -- refer to scripts/wife.lua for whatever scoring types are available
fallbackscoreType = 1,
TipType = 1, -- 1 = Hide,2=tips 3= random quotes phrases,
SongBGEnabled = true,
SongBGMouseEnabled = false, -- removing soon
Particles = false, -- removing soon
RateSort = true,
HelpMenu = false,
ScoreBoardNag = false,
Expand Down
64 changes: 0 additions & 64 deletions Themes/Til Death/Scripts/02 ThemePrefs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -744,70 +744,6 @@ function TipType()
return t
end

function SongBGEnabled()
local t = {
Name = "SongBGEnabled",
LayoutType = "ShowAllInRow",
SelectType = "SelectOne",
OneChoiceForAllPlayers = true,
ExportOnChange = true,
Choices = {THEME:GetString("OptionNames", "Off"), THEME:GetString("OptionNames", "On")},
LoadSelections = function(self, list, pn)
local pref = themeConfig:get_data().global.SongBGEnabled
if pref then
list[2] = true
else
list[1] = true
end
end,
SaveSelections = function(self, list, pn)
local value
if list[1] then
value = false
else
value = true
end
themeConfig:get_data().global.SongBGEnabled = value
themeConfig:set_dirty()
themeConfig:save()
end
}
setmetatable(t, t)
return t
end

function SongBGMouseEnabled()
local t = {
Name = "SongBGMouseEnabled",
LayoutType = "ShowAllInRow",
SelectType = "SelectOne",
OneChoiceForAllPlayers = true,
ExportOnChange = true,
Choices = {THEME:GetString("OptionNames", "Off"), THEME:GetString("OptionNames", "On")},
LoadSelections = function(self, list, pn)
local pref = themeConfig:get_data().global.SongBGMouseEnabled
if pref then
list[2] = true
else
list[1] = true
end
end,
SaveSelections = function(self, list, pn)
local value
if list[1] then
value = false
else
value = true
end
themeConfig:get_data().global.SongBGMouseEnabled = value
themeConfig:set_dirty()
themeConfig:save()
end
}
setmetatable(t, t)
return t
end

function EvalBGType()
local t = {
Name = "EvalBGType",
Expand Down
3 changes: 1 addition & 2 deletions Themes/Til Death/metrics.ini
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,8 @@ LineNames="SongBGEnabled,RateSort,HelpMenu,NPSWindow,MeasureLines,Visualizer,Ins
#LineDefaultScore="lua,DefaultScoreType()"
LineTipType="lua,TipType()"
LineFNFnGSM="lua,FadeNoteFieldInSyncMachine()"
LineSongBGEnabled="lua,SongBGEnabled()"
LineSongBGEnabled="conf,ShowBackgrounds"
LineEvalBGType="lua,EvalBGType()"
LineSongBGMouseEnabled="lua,SongBGMouseEnabled()"
LineParticles="lua,Particles()"
LineRateSort="lua,RateSort()"
LineHelpMenu="lua,HelpMenu()"
Expand Down
2 changes: 2 additions & 0 deletions Themes/_fallback/Languages/de.ini
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ Select Group=Toggle Songs in this Group.
Select Profile=Choose a profile
Server=Start Local Server
Servers=Servers
ShowBackgrounds=Schaltet den Liedhintergrund Ein/Aus. Kann mittleres Ruckeln verursachen.
ShowBanners=Toggles the display of Banners.
ShowCaution=Toggle whether the Caution screen is shown.
ShowDanger=Turn this option &oq;OFF&cq; to disable the flashing &oq;Danger&cq; background that shows when you're about to drop to 0% health.
Expand Down Expand Up @@ -903,6 +904,7 @@ XMode=XMode
Off=Aus
[OptionTitles]
ShowBackgrounds=Lied-Hintergründe
Edit Courses/Mods=Edit Courses/Mods
Accel=Beschleunigung
Add/Edit Background Change=Add/Edit Background Change
Expand Down
2 changes: 2 additions & 0 deletions Themes/_fallback/Languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ Select Group=Toggle Songs in this Group.
Select Profile=Choose a profile
Server=Start Local Server
Servers=Servers
ShowBackgrounds = Toggle whether to show the song's background image or not on the select and the eval screen. Turn this off if you experience stutter or lag while scrolling through songs.
ShowBanners=Toggles the display of Banners.
ShowCaution=Toggle whether the Caution screen is shown.
ShowDanger=Turn this option &oq;OFF&cq; to disable the flashing &oq;Danger&cq; background that shows when you're about to drop to 0% health.
Expand Down Expand Up @@ -1295,6 +1296,7 @@ Shift all timing changes down=Shift all timing changes down
Shift all timing changes up=Shift all timing changes up
Shift timing in region down=Shift timing in region down
Shift timing in region up=Shift timing in region up
ShowBackgrounds = Show Backgrounds
ShowBanners=Show Banners
ShowCaution=Caution
ShowDanger=Danger
Expand Down
2 changes: 2 additions & 0 deletions Themes/_fallback/Languages/zh.ini
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ Select Group=選擇歌曲放到曲包.
Select Profile=選擇一個個人資料.
Server=啟動本地服務器.
Servers=選擇服務器.
ShowBackgrounds = 選擇是否在選歌界面和結算界面顯示歌曲背景圖片. 如果在選擇歌曲時有明顯卡頓, 建議關閉背景顯示.
ShowBanners=選擇是否顯示歌曲標題圖片.
ShowCaution=選擇是否顯示警告畫面.
ShowDanger=選擇是否在血量少時顯示瀕死警告.
Expand Down Expand Up @@ -1226,6 +1227,7 @@ Shift all timing changes down=向下轉移全部的校時變更
Shift all timing changes up=向上轉移全部的校時變更
Shift timing in region down=向下轉移區域內的校時變更
Shift timing in region up=向上轉移區域內的校時變更
ShowBackgrounds = 歌曲背景圖片
ShowBanners=顯示歌曲 標題圖片
ShowCaution=注意事項
ShowDanger=瀕死警告
Expand Down
3 changes: 2 additions & 1 deletion src/Etterna/Actor/Gameplay/Background.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,8 @@ BackgroundImpl::LoadFromSong(const Song* pSong)

// do not load any background if it will never change and is 0 brightness
// this allows something like lua to load or modify in the background layer
if (PREFSMAN->m_fBGBrightness == 0.f && !m_pSong->HasBGChanges())
if ((PREFSMAN->m_fBGBrightness == 0.f || !PREFSMAN->m_bShowBackgrounds) &&
!m_pSong->HasBGChanges())
return;

// Choose a bunch of backgrounds that we'll use for the random file marker
Expand Down
1 change: 1 addition & 0 deletions src/Etterna/Screen/Options/ScreenOptionsMasterPrefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,7 @@ InitializeConfOptions()
"FitInside",
"FitInsideAvoidLetter",
"FitInsideAvoidPillar"));
ADD(ConfOption("ShowBackgrounds", MovePref<bool>, "Off", "On"));

ADD(ConfOption("ShowDanger", MovePref<bool>, "Hide", "Show"));
ADD(ConfOption(
Expand Down
1 change: 1 addition & 0 deletions src/Etterna/Singletons/PrefsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ PrefsManager::PrefsManager()
, m_iSoundWriteAhead("SoundWriteAhead", 0)
, m_bStretchBackgrounds("StretchBackgrounds", false)
, m_fBGBrightness("BGBrightness", 0.2f)
, m_bShowBackgrounds("ShowBackgrounds", true)
, m_iTextureColorDepth("TextureColorDepth", 32)
, m_bThreadedInput("ThreadedInput", true)
, m_bThreadedMovieDecode("ThreadedMovieDecode", true)
Expand Down
1 change: 1 addition & 0 deletions src/Etterna/Singletons/PrefsManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class PrefsManager

Preference<float> m_fLifeDifficultyScale;
Preference<float> m_fBGBrightness;
Preference<bool> m_bShowBackgrounds;

Preference<bool> m_bDelayedBack;
Preference<bool> m_AllowStartToGiveUp;
Expand Down

0 comments on commit 3297f86

Please sign in to comment.