fix fail bug ( no preference existed for it.. )

This commit is contained in:
Jonathan Payne
2011-03-01 13:45:36 -08:00
parent f3fbb07c80
commit 797cf8d836
2 changed files with 35 additions and 12 deletions
+12 -4
View File
@@ -18,9 +18,17 @@ function ScreenSelectMusic:setupmusicstagemods()
local pm = GAMESTATE:GetPlayMode()
if pm == "PlayMode_Battle" or pm == "PlayMode_Rave" then
local so = GAMESTATE:GetDefaultSongOptions() .. ",failoff"
GAMESTATE:SetSongOptions( "ModsLevel_Stage", so )
MESSAGEMAN:Broadcast( "SongOptionsChanged" )
-- FIX DAT BUG;
local sFail = "";
if GetGamePref("DefaultFail") then
sFail = string.format("Fail%s", GetGamePref("DefaultFail") );
else
sFail = "Failoff";
end;
--
local so = GAMESTATE:GetDefaultSongOptions() .. "," .. sFail;
GAMESTATE:SetSongOptions( "ModsLevel_Stage", so );
MESSAGEMAN:Broadcast( "SongOptionsChanged" );
elseif GAMESTATE:IsAnExtraStage() then
if GAMESTATE:GetPreferredSongGroup() == "---Group All---" then
local song = GAMESTATE:GetCurrentSong()
@@ -51,7 +59,7 @@ function ScreenSelectMusic:setupmusicstagemods()
MESSAGEMAN:Broadcast( "PlayerOptionsChanged", {PlayerNumber = pn} )
end
-- if PREFSMAN:GetPreference("
GAMESTATE:SetSongOptions( "ModsLevel_Stage", so )
MESSAGEMAN:Broadcast( "SongOptionsChanged" )
@@ -479,7 +479,18 @@ function GamePrefDefaultFail()
LoadSelections = function(self, list, pn)
if ReadGamePrefFromFile("DefaultFail") ~= nil then
if GetGamePref("DefaultFail") then
list[table.find( list, GetGamePref("DefaultFail") )] = true;
if GetGamePref("DefaultFail") == "Immediate" then
list[1] = true;
elseif GetGamePref("DefaultFail") == "ImmediateContinue" then
list[2] = true;
elseif GetGamePref("DefaultFail") == "AtEnd" then
list[3] = true;
elseif GetGamePref("DefaultFail") == "Off" then
list[4] = true;
else
list[1] = true;
end
-- list[table.find( list, GetGamePref("DefaultFail") )] = true;
else
list[1] = true;
end;
@@ -492,14 +503,18 @@ function GamePrefDefaultFail()
-- 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
if list[1] then
val = tChoices[1];
elseif list[2] then
val = tChoices[2];
elseif list[3] then
val = tChoices[3];
elseif list[4] then
val = tChoices[4];
else
val = tChoices[1];
end
WriteGamePrefToFile("DefaultFail",tChoices[val]);
WriteGamePrefToFile("DefaultFail",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
end;