From 0e834467ba8b1df7ed10ed4ff9cf506bced1ab31 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sat, 4 Jun 2011 21:43:00 -0400 Subject: [PATCH] Fix UserPrefAutoSetStyle. Also took care of some other lua issues with NotePosition and ComboUnderField. --- Docs/Changelog_sm5.txt | 1 + .../Scripts/03 ThemeAndGamePrefs.lua | 31 ++++++++++--------- Themes/_fallback/metrics.ini | 2 +- Themes/default/metrics.ini | 20 +++++------- 4 files changed, 25 insertions(+), 29 deletions(-) diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index 09e432f91b..88cc760eaf 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -12,6 +12,7 @@ StepMania 5.0 Preview 2 | 20110??? ---------- * Changed default MusicWheelSwitchSpeed to 15 (was 10). [AJ] * [AnnouncerManager] Fixed a bug where no announcers would be loaded. [AJ] +* Restored the UserPrefAutoSetStyle behavior. [Wolfman2000] ================================================================================ StepMania 5.0 Preview 1a | 20110603 diff --git a/Themes/_fallback/Scripts/03 ThemeAndGamePrefs.lua b/Themes/_fallback/Scripts/03 ThemeAndGamePrefs.lua index f7252fe2fd..87e6972667 100644 --- a/Themes/_fallback/Scripts/03 ThemeAndGamePrefs.lua +++ b/Themes/_fallback/Scripts/03 ThemeAndGamePrefs.lua @@ -7,10 +7,8 @@ function InitGamePrefs() local BPrefs = { - { "AutoSetStyle", false }, - { "NotePosition", true }, { "ComboOnRolls", false }, - { "ComboUnderField", true }, + }; for idx,pref in ipairs(Prefs) do @@ -41,6 +39,9 @@ function InitUserPrefs() local BPrefs = { + { "UserPrefComboUnderField", true }, + { "UserPrefAutoSetStyle", false }, + { "UserPrefNotePosition", true }, { "UserPrefShowLotsaOptions", true}, { "UserPrefLongFail", false}, { "UserPrefProtimingP1", false}, @@ -398,23 +399,23 @@ function GamePrefComboOnRolls() setmetatable( t, t ); return t; end -function GamePrefComboUnderField() +function UserPrefComboUnderField() local t = { - Name = "GamePrefComboUnderField"; + Name = "UserPrefComboUnderField"; LayoutType = "ShowAllInRow"; SelectType = "SelectOne"; OneChoiceForAllPlayers = true; ExportOnChange = false; Choices = { 'Off','On' }; LoadSelections = function(self, list, pn) - if ReadGamePrefFromFile("ComboUnderField") ~= nil then - if GetGamePrefB("ComboUnderField") then + if ReadPrefFromFile("UserPrefComboUnderField") ~= nil then + if GetUserPrefB("UserPrefComboUnderField") then list[2] = true; else list[1] = true; end; else - WriteGamePrefToFile("ComboUnderField",true); + WritePrefToFile("UserPrefComboUnderField",true); list[2] = true; end; end; @@ -425,7 +426,7 @@ function GamePrefComboUnderField() else val = false; end; - WriteGamePrefToFile("ComboUnderField",val); + WritePrefToFile("UserPrefComboUnderField",val); MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); THEME:ReloadMetrics(); end; @@ -469,23 +470,23 @@ function UserPrefAutoSetStyle() setmetatable( t, t ); return t; end -function GamePrefNotePosition() +function UserPrefNotePosition() local t = { - Name = "GamePrefNotePosition"; + Name = "UserPrefNotePosition"; LayoutType = "ShowAllInRow"; SelectType = "SelectOne"; OneChoiceForAllPlayers = true; ExportOnChange = false; Choices = { 'Normal','Lower' }; LoadSelections = function(self, list, pn) - if ReadGamePrefFromFile("NotePosition") ~= nil then - if GetGamePrefB("NotePosition") then + if ReadPrefFromFile("UserPrefNotePosition") ~= nil then + if GetUserPrefB("UserPrefNotePosition") then list[1] = true; else list[2] = true; end; else - WriteGamePrefToFile("NotePosition",false); + WritePrefToFile("UserPrefNotePosition",false); list[1] = true; end; end; @@ -496,7 +497,7 @@ function GamePrefNotePosition() else val = false; end; - WriteGamePrefToFile("NotePosition",val); + WritePrefToFile("UserPrefNotePosition",val); MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); THEME:ReloadMetrics(); end; diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index 46246439b0..195bd35e1f 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -25,7 +25,7 @@ ScreenHeight=480 # Allows you to pick all available game modes for your gametype: for example, # inserting enough coins for 1p would let you choose between solo, single # and double before each game -AutoSetStyle=GetGamePrefB("AutoSetStyle") +AutoSetStyle=GetUserPrefB("UserPrefAutoSetStyle") # Default modifiers and noteskin. DefaultModifiers="default,1.5x" diff --git a/Themes/default/metrics.ini b/Themes/default/metrics.ini index 30c94c4d1f..d3e01fbd43 100644 --- a/Themes/default/metrics.ini +++ b/Themes/default/metrics.ini @@ -409,8 +409,7 @@ MeterSetCommand=%function(self,param) \ end; # ShowDescription=true -DescriptionX=GetGamePrefB("AutoSetStyle") and (-64-8+20) or (-64-8) -# DescriptionX=GetUserPrefB("UserPrefAutoSetStyle") and (-64-8+20) or (-64-8) +DescriptionX=GetUserPrefB("UserPrefAutoSetStyle") and (-64-8+20) or (-64-8) DescriptionOnCommand=shadowlength,1;horizalign,left;zoom,0.65;maxwidth,128+8-20;uppercase,true; DescriptionSetCommand=%function(self,param) \ if self:GetText() == "" then \ @@ -428,7 +427,7 @@ AutogenY=0 #AutogenOnCommand=diffuseshift;effectcolor1,Colors.Alpha( Color("Green") , 0.5 );effectcolor2,ColorLightTone( Color("Green") ); AutogenOnCommand=blend,Blend.Add;diffuseshift;effectcolor1,color("#FFCC00FF");effectcolor2,color("#FFCC0088"); # -ShowStepsType=GetGamePrefB("AutoSetStyle") +ShowStepsType=GetUserPrefB("UserPrefAutoSetStyle") StepsTypeX=-64-8 StepsTypeY=0 StepsTypeOnCommand= @@ -883,8 +882,7 @@ StageDisplayY=SCREEN_TOP+24+3 StageDisplayOnCommand=skewx,-0.125;draworder,105;fov,90;zoom,0.675;zoomy,0;sleep,0.35;smooth,0.35;zoomy,0.675 StageDisplayOffCommand=linear,0.25;zoomy,0; # -ShowDifficultyDisplay=not GetGamePrefB("AutoSetStyle") and not GAMESTATE:IsCourseMode() -# ShowDifficultyDisplay=not GetUserPrefB("UserPrefAutoSetStyle") and not GAMESTATE:IsCourseMode() +ShowDifficultyDisplay=not GetUserPrefB("UserPrefAutoSetStyle") and not GAMESTATE:IsCourseMode() DifficultyDisplayX=SCREEN_CENTER_X-160 DifficultyDisplayY=SCREEN_TOP+160-96+2 DifficultyDisplayOnCommand=draworder,105;fov,90;zoom,1;zoomy,0;sleep,0.35;smooth,0.35;zoomy,1 @@ -1069,8 +1067,7 @@ end; # ShowDescription=true DescriptionX=-20-32 -DescriptionY=GetGamePrefB("AutoSetStyle") and -5 or 0 -# DescriptionY=GetUserPrefB("UserPrefAutoSetStyle") and -5 or 0 +DescriptionY=GetUserPrefB("UserPrefAutoSetStyle") and -5 or 0 DescriptionOnCommand=shadowlength,1;uppercase,true;zoom,0.75;maxwidth,128+8 DescriptionSetCommand=%function(self,param) \ if self:GetText() == "" then \ @@ -1088,8 +1085,7 @@ AutogenY=0 AutogenOnCommand= AutogenSetCommand=%function(self,param) if param.Difficulty then self:diffuse(CustomDifficultyToLightColor(param.Difficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.Difficulty)); end end # -ShowStepsType=GetGamePrefB("AutoSetStyle") -# ShowStepsType=GetUserPrefB("UserPrefAutoSetStyle") +ShowStepsType=GetUserPrefB("UserPrefAutoSetStyle") StepsTypeX=-20-32 StepsTypeY=7 StepsTypeOnCommand=zoom,0.45 @@ -1119,8 +1115,7 @@ end; # ShowDescription=true DescriptionX=-20 -DescriptionY=GetGamePrefB("AutoSetStyle") and -5 or 0 -# DescriptionY=GetUserPrefB("UserPrefAutoSetStyle") and -5 or 0 +DescriptionY=GetUserPrefB("UserPrefAutoSetStyle") and -5 or 0 DescriptionOnCommand=shadowlength,1;uppercase,true;zoom,0.75;maxwidth,128+8 DescriptionSetCommand=%function(self,param) \ if self:GetText() == "" then \ @@ -1139,8 +1134,7 @@ AutogenY=0 AutogenOnCommand= AutogenSetCommand=%function(self,param) if param.Difficulty then self:diffuse(CustomDifficultyToLightColor(param.Difficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.Difficulty)); end end # -ShowStepsType=GetGamePrefB("AutoSetStyle") -# ShowStepsType=GetUserPrefB("UserPrefAutoSetStyle") +ShowStepsType=GetUserPrefB("UserPrefAutoSetStyle") StepsTypeX=-20 StepsTypeY=7 StepsTypeOnCommand=zoom,0.45