From d404736c338df97c7fa85cc6e7a8474e7319bf6a Mon Sep 17 00:00:00 2001 From: Jonathan Payne Date: Sun, 27 Feb 2011 16:47:20 -0800 Subject: [PATCH] fixing stuff. --- Themes/_fallback/Languages/en.ini | 6 ++- Themes/_fallback/Scripts/02 Utilities.lua | 16 ++++++ .../Scripts/03 ThemeAndGamePrefs.lua | 53 ++++++++++++++++++- Themes/_fallback/metrics.ini | 3 +- .../ScreenEvaluation overlay/default.lua | 12 ++++- 5 files changed, 84 insertions(+), 6 deletions(-) diff --git a/Themes/_fallback/Languages/en.ini b/Themes/_fallback/Languages/en.ini index 735d4cca65..f7c61ddf24 100644 --- a/Themes/_fallback/Languages/en.ini +++ b/Themes/_fallback/Languages/en.ini @@ -476,7 +476,8 @@ Play=Play the course. Save=Save the course. Edit Course=Edit Course contents. Shuffle=Shuffle the songs around. - +# +GamePrefDefaultFail=Immediate fail causes a player to die when their life bar reaches 0. ImmediateContinue allows you to continue playing afterwards. [OptionNames] 0=0 0.25x=0.25x @@ -1036,7 +1037,8 @@ Max Minutes=Max Minutes Play=Play Edit Course=Edit Course Shuffle=Shuffle - +# +GamePrefDefaultFail=Default Fail Type [PaneDisplay] Steps=Steps Holds=Holds diff --git a/Themes/_fallback/Scripts/02 Utilities.lua b/Themes/_fallback/Scripts/02 Utilities.lua index 31f5384db0..616b14ea21 100644 --- a/Themes/_fallback/Scripts/02 Utilities.lua +++ b/Themes/_fallback/Scripts/02 Utilities.lua @@ -123,6 +123,22 @@ function table.deviation( t ) end return offset end +-- See if this exists +function table.search( t, sFind ) + for i=1,#t do + if t[i] == sFind then + return true + end + end +end +-- Retreive the entry that has this +function table.find( t, sFind ) + for i=1,#t do + if t[i] == sFind then + return i + end + end +end function round(val, decimal) if (decimal) then diff --git a/Themes/_fallback/Scripts/03 ThemeAndGamePrefs.lua b/Themes/_fallback/Scripts/03 ThemeAndGamePrefs.lua index 7d20bef84f..6c5cddd245 100644 --- a/Themes/_fallback/Scripts/03 ThemeAndGamePrefs.lua +++ b/Themes/_fallback/Scripts/03 ThemeAndGamePrefs.lua @@ -1,6 +1,11 @@ -- sm-ssc Default Theme Preferences Handler function InitGamePrefs() - local Prefs = + local Prefs = + { + { "DefaultFail", "Immediate" }, + }; + + local BPrefs = { { "AutoSetStyle", false }, { "NotePosition", true }, @@ -9,6 +14,12 @@ function InitGamePrefs() }; for idx,pref in ipairs(Prefs) do + if GetGamePref( pref[1] ) == nil then + SetGamePref( pref[1], pref[2] ); + end; + end; + + for idx,pref in ipairs(BPrefs) do if GetGamePrefB( pref[1] ) == nil then SetGamePref( pref[1], pref[2] ); end; @@ -456,3 +467,43 @@ function GamePrefNotePosition() setmetatable( t, t ); return t; end + +function GamePrefDefaultFail() + local t = { + Name = "GamePrefDefaultFail"; + LayoutType = "ShowAllInRow"; + SelectType = "SelectOne"; + OneChoiceForAllPlayers = true; + ExportOnChange = false; + Choices = { "Immediate","ImmediateContinue", "AtEnd", "Off" }; + LoadSelections = function(self, list, pn) + if ReadGamePrefFromFile("DefaultFail") ~= nil then + if GetGamePref("DefaultFail") then + list[table.find( list, GetGamePref("DefaultFail") )] = true; + else + list[1] = true; + end; + else + WriteGamePrefToFile("DefaultFail","Immediate"); + list[1] = true; + end; + end; + SaveSelections = function(self, list, pn) + -- This is so stupid. + local tChoices = { "Immediate","ImmediateContinue", "AtEnd", "Off" }; + local val; + for i=1,#list do + if list[i] then + val = i; + else + val = 1; + end + end + WriteGamePrefToFile("DefaultFail",tChoices[val]); + MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } ); + THEME:ReloadMetrics(); + end; + }; + setmetatable( t, t ); + return t; +end diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index bfc0d6b4b6..0fbff822c0 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -2732,7 +2732,8 @@ LineNames="2,3,4,8,11,13,14,15,16,28,29,30" Line2="conf,ScoringType" Line3="conf,TimingWindowScale" Line4="conf,LifeDifficulty" -Line8="conf,DefaultFailType" +Line8="lua,GamePrefDefaultFail()" +# Line8="conf,DefaultFailType" Line11="conf,AllowW1" Line13="conf,HiddenSongs" Line14="conf,EasterEggs" diff --git a/Themes/default/BGAnimations/ScreenEvaluation overlay/default.lua b/Themes/default/BGAnimations/ScreenEvaluation overlay/default.lua index 8bf1f85bb4..a8620aed20 100644 --- a/Themes/default/BGAnimations/ScreenEvaluation overlay/default.lua +++ b/Themes/default/BGAnimations/ScreenEvaluation overlay/default.lua @@ -33,7 +33,7 @@ local function CreateStats( pnPlayer ) -- local t = Def.ActorFrame {}; t[#t+1] = Def.ActorFrame { - InitCommand=cmd(y,-16); + InitCommand=cmd(y,-32); LoadActor(THEME:GetPathG("ScreenTitleMenu","PreferenceFrame")) .. { InitCommand=cmd(zoom,0.875;diffuse,PlayerColor( pnPlayer )); }; @@ -43,7 +43,7 @@ local function CreateStats( pnPlayer ) aText .. { Text=string.format("%04i",tValues["ITG_MAX"]); InitCommand=cmd(x,32;y,5;vertalign,bottom;zoom,0.5); }; }; t[#t+1] = Def.ActorFrame { - InitCommand=cmd(y,16); + InitCommand=cmd(y,-16); LoadActor(THEME:GetPathG("ScreenTitleMenu","PreferenceFrame")) .. { InitCommand=cmd(zoom,0.875;diffuse,PlayerColor( pnPlayer )); }; @@ -52,6 +52,14 @@ local function CreateStats( pnPlayer ) aText .. { Text="/"; InitCommand=cmd(x,28;y,5;vertalign,bottom;zoom,0.5;diffusealpha,0.5); }; aText .. { Text=string.format("%04i",tValues["MIGS_MAX"]); InitCommand=cmd(x,32;y,5;vertalign,bottom;zoom,0.5); }; }; + t[#t+1] = Def.ActorFrame { + InitCommand=cmd(y,0); + LoadActor(THEME:GetPathG("ScreenTitleMenu","PreferenceFrame")) .. { + InitCommand=cmd(zoom,0.875;diffuse,PlayerColor( pnPlayer )); + }; + aLabel .. { Text="Signed:"; InitCommand=cmd(x,-64) }; + aText .. { Text=string.format( #(tPlayerData[PLAYER_1].SignedJudgments) ); InitCommand=cmd(x,-8;y,5;vertalign,bottom;zoom,0.675); }; + }; return t end; local t = Def.ActorFrame {};