From: Cameron Ball Date: Sat, 28 Dec 2013 18:10:51 +0000 (+0800) Subject: #33 this is a big one. Modifier menu should now be fully configurable from the servic... X-Git-Url: http://git.cameron1729.xyz/?a=commitdiff_plain;h=cb61cba56aac01060292032d6f21927984fbdf2d;p=GrooveNights.git #33 this is a big one. Modifier menu should now be fully configurable from the service menu (new screen in service menu called modifier options). I tested it reasonably thoroughly, but things may still break. --- diff --git a/Themes/GrooveNights/Languages/english.ini b/Themes/GrooveNights/Languages/english.ini index fec957d..30750eb 100644 --- a/Themes/GrooveNights/Languages/english.ini +++ b/Themes/GrooveNights/Languages/english.ini @@ -368,6 +368,12 @@ SpeedModType=Speed Mods CustomMods=Custom Mods GoodLuckCameron=Good Luck Cameron +#ScreenModifierOptions +Scroll Mods=Scroll Mods +Appearance Mods=Appearance Mods +Playfield Mods=Playfield Mods +Insert Mods=Insert Mods +Other Mods=Other Mods Windowed=Display DisplayResolution=Resolution @@ -922,6 +928,7 @@ popcorn=Popcorn #ScreenOptionsMenu Insert Credit=Insert Credit Arcade Options=Options +Modifier Options=Modifier Options Reset Menu=Restore Menu Defaults Center Image=Test Image System Diagnostics=System Diagnostics diff --git a/Themes/GrooveNights/Scripts/01 ProfileRows.lua b/Themes/GrooveNights/Scripts/01 ProfileRows.lua index 378cefd..ee0e4ce 100644 --- a/Themes/GrooveNights/Scripts/01 ProfileRows.lua +++ b/Themes/GrooveNights/Scripts/01 ProfileRows.lua @@ -82,10 +82,14 @@ function CreateGenericOptionRow( Params, Choices, Values ) for i=1,table.getn(Choices) do list[i] = Params.LoadCallback(list[i], Values[i], pn) + if list[i] == nil and Params.EnabledByDefault and Params.SelectType == "SelectMultiple" then list[i] = true end + if Params.SelectType ~= "SelectMultiple" and list[i] then return end end - if Params.Default then list[Params.Default] = true else if (Params.SelectType ~= "SelectMultiple" and Params.SelectType ~= "SelectNone") then list[1] = true end end + if Params.SelectType ~= "SelectMultiple" then + if Params.Default then list[Params.Default] = true else list[1] = true end + end end local function Save(self, list, pn) @@ -100,12 +104,13 @@ end -- creates a row list given a list of names and values function CreateProfileRow( Params, Choices, Values ) local pref = ProfileTable[Params.Name] - if type(pref) ~= "table" and Params.SelectType == "SelectMultiple" then pref = {} ProfileTable[Params.Name] = {} end - + if type(pref) ~= "table" and Params.SelectType == "SelectMultiple" then pref = {} pref[Params.Name] = {} end + Params.LoadCallback = function(List, Value) if Params.SelectType ~= "SelectMultiple" then return Value == pref else return pref[Value] end end Params.SaveCallback = function(List, Value) if Params.SelectType ~= "SelectMultiple" and List then ProfileTable[Params.Name] = Value PROFILEMAN:SaveMachineProfile() return end - if Params.SelectType == "SelectMultiple" then ProfileTable[Params.Name][Value] = List PROFILEMAN:SaveMachineProfile() end + -- TODO this is pretty inefficient, it saves the profile once for every item in the list, instead it should be clever and wait till the end or something. Edit: I think I made it a bit better lol + if Params.SelectType == "SelectMultiple" then if type(ProfileTable[Params.Name]) ~= "table" then ProfileTable[Params.Name] = {} ProfileTable[Params.Name][Value] = {} end ProfileTable[Params.Name][Value] = List PROFILEMAN:SaveMachineProfile() end end return CreateGenericOptionRow( Params, Choices, Values ) diff --git a/Themes/GrooveNights/Scripts/03 EasterEggs.lua b/Themes/GrooveNights/Scripts/03 EasterEggs.lua index 43b3f25..acc8aab 100644 --- a/Themes/GrooveNights/Scripts/03 EasterEggs.lua +++ b/Themes/GrooveNights/Scripts/03 EasterEggs.lua @@ -51,11 +51,11 @@ local FunctionTable = {} function EasterEggsEnabled() local pref = GetProfilePref("EasterEggs") - if pref == nil then return false else return pref end + if pref == nil then return true else return pref end end function EasterEggsOptionsRow() - local Params = { Name = "EasterEggs" } + local Params = { Name = "EasterEggs", Default = 2 } --2 is on return CreateProfileRowBool( Params ) end diff --git a/Themes/GrooveNights/Scripts/04 CustomMods.lua b/Themes/GrooveNights/Scripts/04 CustomMods.lua index bba0557..f98c896 100644 --- a/Themes/GrooveNights/Scripts/04 CustomMods.lua +++ b/Themes/GrooveNights/Scripts/04 CustomMods.lua @@ -6,6 +6,7 @@ local WasInOptions = {} -- Holds the mods local ModsTable = {} +local ModGroups = {} function RegisterCustomMod(Name, fn, Params, Choices) assert(ModsTable[Name] == nil, "Cannot re-register custom mod" .. Name) @@ -20,6 +21,15 @@ function RegisterCustomMod(Name, fn, Params, Choices) NullMod(Name) end +function RegisterSystemMod(Name, LineNumber, GroupID) + local Params = { ["LineNumber"] = LineNumber, ["GroupID"] = GroupID } + ModsTable[Name] = { ["Params"] = Params } +end + +function RegisterModGroup( GroupID, Name ) + ModGroups[GroupID] = Name +end + function NullMod( Name ) local Choices = ModsTable[Name].Choices local Params = ModsTable[Name].Params @@ -68,31 +78,33 @@ function DoCustomMod(Name, pn, Params) ModsTable[Name].Callback(Params) end -function CustomModsServiceOptionRow() +function CustomModsServiceOptionRow( GroupID ) local Choices = { } - local Params = { Name = "CustomMods", SelectType = "SelectMultiple" } + local Params = { ["Name"] = ModGroups[GroupID], SelectType = "SelectMultiple", EnabledByDefault = true } for ModName,ModValue in pairs(ModsTable) do - table.insert(Choices, ModName) + if ModsTable[ModName].Params.GroupID == GroupID then table.insert(Choices, ModName) end end - + return CreateProfileRow(Params, Choices, Choices) end -function CustomModLines() - local PrefTable = GetProfilePref("CustomMods") - local lines = '' - - if type(PrefTable) ~= "table" then return nil end - - for ModName,Enabled in pairs(PrefTable) do - if Enabled then - if ModsTable[ModName].Params.LineNumber then lines = lines .. ',' .. ModsTable[ModName].Params.LineNumber end +function ModLines() + local PrefTable + local lines = {} + for GroupID,GroupName in pairs(ModGroups) do + PrefTable = GetProfilePref(GroupName) + Trace("YOLO " .. GroupName) + for ModName,ModValue in pairs(ModsTable) do + Trace("SWAG " .. ModName) + if ModValue.Params.GroupID == GroupID then + if PrefTable == nil or PrefTable[ModName] then -- if the mod is enabled, (also default to enabled if there's nothing in the profile) + if ModValue.Params.LineNumber then table.insert(lines, ModValue.Params.LineNumber) end + end + end end end - - if lines ~= '' then return lines else return nil end -end - - + -- TODO the 101,102,103 is a quick hack to get us the speed mods, it really needs to be worked in with this system better + if lines then return "101,102,103," .. table.concat(lines, ",") else return nil end +end diff --git a/Themes/GrooveNights/Scripts/Other.lua b/Themes/GrooveNights/Scripts/Other.lua index eec072d..4cf20bd 100644 --- a/Themes/GrooveNights/Scripts/Other.lua +++ b/Themes/GrooveNights/Scripts/Other.lua @@ -429,9 +429,9 @@ function GetModifierNames( num ) end function oitgACoptions() - local OptionLines = "1,2,3,4,5,6,7,8,9,10,11,12,13" + local OptionLines = "1,2,3,4,5,6,7,8,9,10,11,12" - if EasterEggsEnabled() then OptionLines = OptionLines .. ",14" end + if EasterEggsEnabled() then OptionLines = OptionLines .. ",13" end return OptionLines end diff --git a/Themes/GrooveNights/Scripts/gnSystem.lua b/Themes/GrooveNights/Scripts/gnSystem.lua index d75ebb9..ef62ea1 100644 --- a/Themes/GrooveNights/Scripts/gnSystem.lua +++ b/Themes/GrooveNights/Scripts/gnSystem.lua @@ -433,8 +433,42 @@ local function PlayfieldMods(Params) if Params.Value == "Spin" then a:spin() a:effectclock('beat') a:effectmagnitude(0,0,45) end end -RegisterCustomMod( "JudgeSkin", LoadJudgeSkin, { OneChoiceForAllPlayers = false, LineNumber = 25 }, { "GrooveNights", "Love", "Tactics", "Chromatic", "Deco", "FP", "ITG2" } ) -RegisterCustomMod( "Playfield", PlayfieldMods, { OneChoiceForAllPlayers = false, LineNumber = 26 }, { "Off", "Vibrate", "Wag", "Bob", "Pulse", "Spin" } ) +RegisterCustomMod( "JudgeSkin", LoadJudgeSkin, { OneChoiceForAllPlayers = false, LineNumber = 201, GroupID = 2 }, { "GrooveNights", "Love", "Tactics", "Chromatic", "Deco", "FP", "ITG2" } ) +RegisterCustomMod( "Playfield", PlayfieldMods, { OneChoiceForAllPlayers = false, LineNumber = 301, GroupID = 3 }, { "Off", "Vibrate", "Wag", "Bob", "Pulse", "Spin" } ) + +-- register regular system mods + +RegisterSystemMod( "Perspective", 104, 1 ) +RegisterSystemMod( "Rate", 105, 1 ) +--Judgskin goes in here +RegisterSystemMod( "NoteSkins", 202, 2 ) +RegisterSystemMod( "Mini", 203, 2 ) +--Playfield mods in here +RegisterSystemMod( "Accel", 302, 3 ) +RegisterSystemMod( "Beat", 303, 3 ) +RegisterSystemMod( "Dizzy", 304, 3 ) +RegisterSystemMod( "Flip", 305, 3 ) +RegisterSystemMod( "Drift", 306, 3 ) +RegisterSystemMod( "Float", 307, 3 ) +RegisterSystemMod( "Invisible", 308, 3 ) +RegisterSystemMod( "Appearance", 309, 3 ) +RegisterSystemMod( "Turn", 401, 4 ) +RegisterSystemMod( "InsertOther", 402, 4 ) +RegisterSystemMod( "InsertTaps", 403, 4 ) +RegisterSystemMod( "Remove", 501, 5 ) +RegisterSystemMod( "Foreground", 502, 5 ) +RegisterSystemMod( "Hide", 503, 5 ) +RegisterSystemMod( "HideBG", 504, 5 ) +RegisterSystemMod( "BackButton", 505, 5 ) -- TODO this is a lua mod so maybe can implement with RegisterCustomMod? +RegisterSystemMod( "Steps", 506, 5 ) + +-- set up names for group ids + +RegisterModGroup(1, "Scroll Mods") +RegisterModGroup(2, "Appearance Mods") +RegisterModGroup(3, "Playfield Mods") +RegisterModGroup(4, "Insert Mods") +RegisterModGroup(5, "Other Mods") --actor setters @@ -449,6 +483,6 @@ end --throwing this down here until all this code is refactored and neatened function GoodLuckCameronOptionsRow() - local Params = { Name = "GoodLuckCameron" } + local Params = { Name = "GoodLuckCameron", Default = 1} -- 1 is OFF, 2 is ON return CreateProfileRowBool( Params ) end diff --git a/Themes/GrooveNights/metrics.ini b/Themes/GrooveNights/metrics.ini index 7a45462..6e3c0d5 100644 --- a/Themes/GrooveNights/metrics.ini +++ b/Themes/GrooveNights/metrics.ini @@ -3631,6 +3631,9 @@ HelpText=@GetScreenNameEntryTraditionalHelpText() Arcade Options=1;together;SelectNone Arcade OptionsDefault= Arcade Options,1=screen,ScreenArcadeOptions;name,Arcade Options +Modifier Options=1;together;SelectNone +Modifier OptionsDefault= +Modifier Options,1=screen,ScreenModifierOptions;name,Modifier Options Reset Menu=1,together;SelectNone Reset MenuDefault= Reset Menu,1=screen,ScreenResetOptions;name,Reset Menu @@ -3932,24 +3935,25 @@ GraphicOptions= InputOptions= MachineOptions= SoundOptions= -LineNames=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 +LineNames=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 Line1=list,Insert Credit Line2=list,Arcade Options Line3=list,Graphic Options -Line4=list,Bookkeeping -Line5=list,System Diagnostics -Line6=list,Machine Update -Line7=list,Transfer Stats From Machine -Line8=list,Transfer Stats To Machine -Line9=list,Copy Edits To Machine -Line10=list,Copy Edits From Machine -Line11=list,Center Image -Line12=list,Test Input -Line13=list,Test Lights -Line14=list,Set Machine Time -Line15=list,Config Key/Joy Mappings -Line16=list,Reset Menu -Line17=list,Fill Machine Stats +Line4=list,Modifier Options +Line5=list,Bookkeeping +Line6=list,System Diagnostics +Line7=list,Machine Update +Line8=list,Transfer Stats From Machine +Line9=list,Transfer Stats To Machine +Line10=list,Copy Edits To Machine +Line11=list,Copy Edits From Machine +Line12=list,Center Image +Line13=list,Test Input +Line14=list,Test Lights +Line15=list,Set Machine Time +Line16=list,Config Key/Joy Mappings +Line17=list,Reset Menu +Line18=list,Fill Machine Stats ShowUnderlines=0 CapitalizeAllOptionNames=0 @@ -3970,8 +3974,17 @@ Line9=conf,DefaultFailType Line10=conf,Theme Line11=lua,SpeedModTypeRow() Line12=lua,EasterEggsOptionsRow() -Line13=lua,CustomModsServiceOptionRow() -Line14=lua,GoodLuckCameronOptionsRow() +Line13=lua,GoodLuckCameronOptionsRow() + +[ScreenModifierOptions] +Fallback=ScreenOptionsSubmenu +LineNames=1,2,3,4,5 +OptionMenuFlags=together;forceallplayers;explanations;firstchoicegoesdown +Line1=lua,CustomModsServiceOptionRow( 1 ) +Line2=lua,CustomModsServiceOptionRow( 2 ) +Line3=lua,CustomModsServiceOptionRow( 3 ) +Line4=lua,CustomModsServiceOptionRow( 4 ) +Line5=lua,CustomModsServiceOptionRow( 5 ) [ScreenGraphicOptions] Fallback=ScreenOptionsSubmenu @@ -4042,36 +4055,44 @@ ShowStage=1 NextScreen=ScreenBranchStage PrevScreen=@SongSelectionScreen() PlayMusic=0 -LineNames=@SongModifiers() +LineNames=@ModLines() OptionMenuFlags=explanations;firstchoicegoesdown -Line1=lua,SpeedMods('Base') -Line2=lua,SpeedMods('Extra') -Line3=lua,SpeedMods('Type') -Line4=list,Persp -Line5=lua,RateMods() -Line25=lua,CustomModOptionRow('JudgeSkin') -Line26=lua,CustomModOptionRow('Playfield') -Line6=list,NoteSkins2 -Line7=list,Accel -Line8=list,Mini -Line9=list,Beat -Line10=list,Dizzy -Line11=list,Flip -Line12=list,Drift -Line13=List,Float -Line14=list,Invisible -Line15=list,Appearance -Line16=list,Handicap -Line17=list,Turn -Line18=list,InsertOther -Line19=list,Foreground -Line20=list,InsertTaps -Line21=list,Hide -Line22=list,HideBG -Line23=lua,BackButton() -Line24=list,Steps -#Removed from GrooveNights -#Line25=lua,StaminaMod() + +# perspective/speed/rate stuff, prefix with 1 +Line101=lua,SpeedMods('Base') +Line102=lua,SpeedMods('Extra') +Line103=lua,SpeedMods('Type') +Line104=list,Persp +Line105=lua,RateMods() + +# appearance mods, prefix with 2 +Line201=lua,CustomModOptionRow('JudgeSkin') +Line202=list,NoteSkins2 +Line203=list,Mini + +# playfield mods, prefix with 3 +Line301=lua,CustomModOptionRow('Playfield') +Line302=list,Accel +Line303=list,Beat +Line304=list,Dizzy +Line305=list,Flip +Line306=list,Drift +Line307=List,Float +Line308=list,Invisible +Line309=list,Appearance + +# Insert mods, prefix with 4 +Line401=list,Turn +Line402=list,InsertOther +Line403=list,InsertTaps + +# Other stuff +Line501=list,Handicap +Line502=list,Foreground +Line503=list,Hide +Line504=list,HideBG +Line505=lua,BackButton() +Line506=list,Steps CancelAllP1X=SCREEN_CENTER_X-160 CancelAllP1Y=SCREEN_CENTER_Y