Nearly there
authorCameron Ball <c.ball1729@gmail.com>
Fri, 20 Dec 2013 06:54:58 +0000 (14:54 +0800)
committerCameron Ball <c.ball1729@gmail.com>
Fri, 20 Dec 2013 06:54:58 +0000 (14:54 +0800)
Themes/GrooveNights/Scripts/01 ProfileRows.lua
Themes/GrooveNights/Scripts/05 CustomMods.lua
Themes/GrooveNights/Scripts/gnSystem.lua
Themes/GrooveNights/metrics.ini

index fbca9fb..7afed48 100644 (file)
@@ -85,7 +85,7 @@ function CreateGenericOptionRow( Params, Choices, Values )
                 if Params.SelectType ~= "SelectMultiple" and list[i] then return end
             end
 
-            if Params.Default then list[Params.Default] = true else list[1] = true SCREENMAN:SystemMessage("here") end
+            if Params.Default then list[Params.Default] = true else if Params.SelectType ~= "SelectMultiple" then list[1] = true end end
         end
 
         local function Save(self, list, pn)
@@ -100,15 +100,12 @@ 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 = {} end
         
-        Params.LoadCallback = function(List, Value) if Params.SekectType ~= "SelectMultiple" then return Value == pref else return pref[Value] end 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
-                                    if type(ProfileTable[Params.Name]) ~= "table" then ProfileTable[Params.Name] = {} end
-                                    ProfileTable[Params.Name][Value] = List
-                                    PROFILEMAN:SaveMachineProfile()
-                                end
+                                if Params.SelectType == "SelectMultiple" then ProfileTable[Params.Name][Value] = List PROFILEMAN:SaveMachineProfile() end
                               end
 
         return CreateGenericOptionRow( Params, Choices, Values )
index fc47976..0f0c5ec 100644 (file)
@@ -17,6 +17,28 @@ function RegisterCustomMod(Name, fn, Params, Choices)
     
     AppliedModsTable[PLAYER_1][Name] = false
     AppliedModsTable[PLAYER_2][Name] = false
+
+    NullMod(Name)
+end
+
+function NullMod( Name )
+    SCREENMAN:SystemMessage('nulling ' .. Name)
+
+    local Choices = ModsTable[Name].Choices 
+    local Params = ModsTable[Name].Params
+
+    AppliedModsTable[PLAYER_1][Name] = false
+    AppliedModsTable[PLAYER_2][Name] = false
+
+    if Params.SelectType == "SelectMultiple" then
+        AppliedModsTable[PLAYER_1][Name] = {}
+        AppliedModsTable[PLAYER_2][Name] = {}
+
+        for ModName,ModValue in pairs(Choices) do
+            AppliedModsTable[PLAYER_1][Name][ModValue] = false
+            AppliedModsTable[PLAYER_2][Name][ModValue] = false
+        end
+    end
 end
 
 function CustomModOptionRow(Name)
@@ -26,28 +48,31 @@ function CustomModOptionRow(Name)
     Params.LoadCallback = function(List, Value, pn)
                             WasInOptions[pn] = true
 
-                            -- If this is the first round, reset the skin as it may still be set from earlier
-                            --if GetStageText() == "1" then AppliedModsTable[pn][Name] = nil end
-                           if AppliedModsTable[pn][Name] then Trace("MODSTABLE IS " ..AppliedModsTable[pn][Name]) end
-                            return AppliedModsTable[pn][Name] == Value
+                           -- If this is the first round, reset the skin as it may still be set from earlier
+                           if GAMESTATE:StageIndex() == 0 then NullMod(Name) end
+                           if Params.SelectType ~= "SelectMultiple" then return AppliedModsTable[pn][Name] == Value  end
+                           if Params.SelectType == "SelectMultiple" then return AppliedModsTable[pn][Name][Value] end
                           end
 
-    Params.SaveCallback = function(List, Value, pn) if List then AppliedModsTable[pn][Name] = Value end end
+    Params.SaveCallback = function(List, Value, pn)
+                           if Params.SelectType ~= "SelectMultiple" and List then AppliedModsTable[pn][Name] = Value return end
+                           if Params.SelectType == "SelectMultiple" then AppliedModsTable[pn][Name][Value] = List end
+                          end
 
     return CreateGenericOptionRow( Params, Choices, Choices )
 end
 
 function DoCustomMod(Name, pn, Params)
     --if this is the first stage and the user was NOT in the options, reset the mod to default
-    if GetStageText() == "1" and not WasInOptions[pn] then AppliedModsTable[pn][Name] = nil end
-
-    if AppliedModsTable[pn][Name] ~= nil then Params.Value = AppliedModsTable[pn][Name] return ModsTable[Name].Callback(Params) end
-
+    if GAMESTATE:StageIndex() == 0 and not WasInOptions[pn] then NullMod(Name) end
     WasInOptions[pn] = false
+
+    Params.Value = AppliedModsTable[pn][Name]
+    ModsTable[Name].Callback(Params)
 end
 
 function CustomModsServiceOptionRow()
-    local Choices = {}
+    local Choices = { }
     local Params = { Name = "CustomMods", SelectType = "SelectMultiple"  }
 
     for ModName,ModValue in pairs(ModsTable) do
index 000981f..e1553f3 100644 (file)
@@ -418,15 +418,17 @@ RegisterGlobalCallback("TotalTimeSeconds", TotalTimeSeconds)
 
 -- custom mods
 local function LoadJudgeSkin(Params)
-    Params.Actor:Load( THEME:GetPath( EC_GRAPHICS, '', '_Judgements/' .. Params.Value ))
+    if Params.Value ~= nil and Params.Value ~= "GrooveNights" then
+        Params.Actor:Load( THEME:GetPath( EC_GRAPHICS, '', '_Judgements/' .. Params.Value ))
+    end
 end
 
-local function DummyCallback(Params)
-    return true
+local function PlayfieldMods(Params)
+   -- if type(Params.Value) == "table" then SCREENMAN:SystemMessage('got a table!') end
 end
 
 RegisterCustomMod( "JudgeSkin", LoadJudgeSkin, { OneChoiceForAllPlayers = false, LineNumber = 25 }, { "GrooveNights", "Love", "Tactics", "Chromatic", "Deco", "FP", "ITG2" } )
-RegisterCustomMod( "DummyMod", DummyCallback, { OneChoiceForAllPlayers = false, LineNumber = 26 }, { "Yolo", "Swag", "Young", "Money", "Cash", "Money" } )
+RegisterCustomMod( "Playfield", PlayfieldMods, { OneChoiceForAllPlayers = false, LineNumber = 26, SelectType = "SelectMultiple" }, { "Vibrate", "Wag", "Bob", "Pulse" } )
 
 --actor setters
 
index fd3c033..7a45462 100644 (file)
@@ -2515,7 +2515,7 @@ ScoreP1OffCommand=addy,0;
 ScoreP1OnCommand=addy,-100;addy,100;
 ScoreP1X=SCREEN_CENTER_X-180-CourseHorizontal()+(48*HorizontalRecovery())
 ScoreP1Y=SCREEN_TOP+56
-#Rebroadcase these bad boys so we can use them on other actors
+#Rebroadcast these bad boys so we can use them on other actors
 ScoreP1BehindCommand=%function(self) MESSAGEMAN:Broadcast('P1Behind') end
 ScoreP2BehindCommand=%function(self) MESSAGEMAN:Broadcast('P2Behind') end
 ScoreP1AheadCommand=%function(self) MESSAGEMAN:Broadcast('P1Ahead') end
@@ -2560,8 +2560,8 @@ CombinedLifeX=SCREEN_CENTER_X
 CombinedLifeY=SCREEN_TOP+54
 CombinedLifeOnCommand=addy,-100;addy,+100
 CombinedLifeOffCommand=
-PlayerP1OnCommand=%function(self) DoCustomMod("JudgeSkin", PLAYER_1, { Actor = self:GetChild('Judgment'):GetChild('') } )end
-PlayerP2OnCommand=%function(self) DoCustomMod("JudgeSkin", PLAYER_2, { Actor = self:GetChild('Judgment'):GetChild('') } )end
+PlayerP1OnCommand=%function(self) DoCustomMod("JudgeSkin", PLAYER_1, { Actor = self:GetChild('Judgment'):GetChild('') } ) DoCustomMod("Playfield", PLAYER_1, { Actor = self } ) end
+PlayerP2OnCommand=%function(self) DoCustomMod("JudgeSkin", PLAYER_2, { Actor = self:GetChild('Judgment'):GetChild('') } ) DoCustomMod("Playfield", PLAYER_2, { Actor = self } ) end
 
 [ScreenGameplayTraining]
 Fallback=ScreenGameplay
@@ -3957,7 +3957,7 @@ CapitalizeAllOptionNames=0
 [ScreenArcadeOptions]
 Fallback=ScreenOptionsSubmenu
 LineNames=@oitgACoptions()
-OptionMenuFlags=together;forceallplayers;explanations
+OptionMenuFlags=together;forceallplayers;explanations;firstchoicegoesdown
 Line1=conf,CoinModeNoHome
 Line2=conf,SongsPerPlay
 Line3=conf,CoinsPerCredit
@@ -4050,7 +4050,7 @@ Line3=lua,SpeedMods('Type')
 Line4=list,Persp
 Line5=lua,RateMods()
 Line25=lua,CustomModOptionRow('JudgeSkin')
-Line26=lua,CustomModOptionRow('DummyMod')
+Line26=lua,CustomModOptionRow('Playfield')
 Line6=list,NoteSkins2
 Line7=list,Accel
 Line8=list,Mini