Skip to content

Commit

Permalink
make background type option persist through sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Jan 14, 2017
1 parent 7092e5e commit f022192
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 9 deletions.
21 changes: 16 additions & 5 deletions Themes/Til Death/BGAnimations/ScreenGameplay underlay/default.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
-- load this before screenfilter gets sized so it's right the first time
-- load certain preferences before gameplay initializes
local modslevel = topscreen == "ScreenEditOptions" and "ModsLevel_Stage" or "ModsLevel_Preferred"
local playeroptions = GAMESTATE:GetPlayerState(PLAYER_1):GetPlayerOptions(modslevel)
playeroptions:Mini( 2 - playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).ReceptorSize/50 )

local bgtype = playerConfig:get_data(pn_to_profile_slot(PLAYER_1)).BackgroundType
local songoptions = GAMESTATE:GetSongOptionsObject('ModsLevel_Preferred')
-- this seems really stupid - mina
if bgtype == 1 then
songoptions:StaticBackground(false)
songoptions:RandomBGOnly(false)
elseif bgtype == 2 then
songoptions:StaticBackground(true)
songoptions:RandomBGOnly(false)
elseif bgtype == 3 then
songoptions:StaticBackground(false)
songoptions:RandomBGOnly(true)
end

local t = Def.ActorFrame{}
t[#t+1] = LoadActor("bg")
t[#t+1] = LoadActor("ScreenFilter")
--t[#t+1] = LoadActor("cbHighlight")
--t[#t+1] = LoadActor("SpeedChange")
--t[#t+1] = LoadActor("pause")
return t --hurr almost everything here is useless
return t
4 changes: 2 additions & 2 deletions Themes/Til Death/Languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ ErrorBarLoc=Error Bar Position
PlayerInfo = Player Info
FullProgressBar = Full Progressbar
MiniProgressBar = Mini Progressbar

BackgroundType = Background Type
AvgScoreType = Avg. Scoretype
GhostScoreType=Ghost Scoretype
GhostTarget=Ghost Target
Expand Down Expand Up @@ -136,7 +136,7 @@ ErrorBarLoc = Set the positioning of the error bar to center or bottom.
PlayerInfo = Enable the player info display in the bottom left. This is the most taxing gameplay screen element. Expect a 20% or higher drop in average fps. It's also useless for non-streamers. Advised to disable.
FullProgressBar = Displays your progress through the song as well as song title.
MiniProgressBar = Display a smaller, less intrusive, more accessible version of the progress bar placed above the combo text.

BackgroundType = Set the type of background during gameplay. Static backgrounds will disable background movies.
AvgScoreType = Set Scoretype for average score
GhostScoreType= Set Scoretype of ghost score
GhostTarget= Set target for ghost score
Expand Down
1 change: 1 addition & 0 deletions Themes/Til Death/Scripts/01 player_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ local defaultConfig = {
OneShotMirror = false,
JudgmentText = true,
ReceptorSize = 100,
BackgroundType = 1,
}

playerConfig = create_setting("playerConfig", "playerConfig.lua", defaultConfig, -1)
Expand Down
32 changes: 31 additions & 1 deletion Themes/Til Death/Scripts/02 ThemePrefs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,36 @@ function NPSDisplay()
return t
end

function BackgroundType()
local t = {
Name = "BackgroundType";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = true;
Choices = { "Default","Static Background", "Random Background"};
LoadSelections = function(self, list, pn)
local pref = playerConfig:get_data(pn_to_profile_slot(pn)).BackgroundType
list[pref] = true
end,
SaveSelections = function(self, list, pn)
local value
if list[1] then
value = 1
elseif list[2] then
value = 2
else
value = 3
end
playerConfig:get_data(pn_to_profile_slot(pn)).BackgroundType = value
playerConfig:set_dirty(pn_to_profile_slot(pn))
playerConfig:save(pn_to_profile_slot(pn))
end
}
setmetatable( t, t )
return t
end

function DefaultScoreType()
local t = {
Name = "DefaultScoreType",
Expand Down Expand Up @@ -510,7 +540,7 @@ function SongBGEnabled()
}
setmetatable( t, t )
return t
end
end

function SongBGMouseEnabled()
local t = {
Expand Down
2 changes: 1 addition & 1 deletion Themes/Til Death/metrics.ini
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ LineSF="lua,OptionRowScreenFilter()"
LineLC="lua,LaneCover()"
LineNPS="lua,NPSDisplay()"
LineRate="list,Rate"
LineBG="list,Background"
LineBG="lua,BackgroundType()"
LineFail="list,Fail"
LineScore="list,SaveScores"
LineLife="conf,LifeDifficulty"
Expand Down

0 comments on commit f022192

Please sign in to comment.