Skip to content

Commit

Permalink
clean lua format and versusDB
Browse files Browse the repository at this point in the history
  • Loading branch information
Jousway committed Sep 15, 2022
1 parent ed3dc91 commit a43ca9b
Show file tree
Hide file tree
Showing 17 changed files with 3,093 additions and 2,744 deletions.
5 changes: 3 additions & 2 deletions BGAnimations/OFSelectMusic background.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
-- Random BG Colour
return Def.Quad {
OnCommand=function(self) self:Center():zoomto(SCREEN_WIDTH,SCREEN_HEIGHT):diffuse(math.random()/4,math.random()/4,math.random()/4,1) end
}
OnCommand = function(self) self:Center():zoomto(SCREEN_WIDTH, SCREEN_HEIGHT):diffuse(math.random() / 4, math.random() /
4, math.random() / 4, 1) end
}
7 changes: 4 additions & 3 deletions BGAnimations/OFSelectMusic overlay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ if not Last then Last = 0 end
local function RandButNotLast(Amount)
local Now
while true do
Now = math.random(1,Amount)
Now = math.random(1, Amount)
if Now ~= Last then break end
end
Last = Now
return Now
end

--Return the Def table that contains all the stuff, Check the module folder for the wheels.
return LoadModule("Wheel."..Wheels[RandButNotLast(#Wheels)]..".lua")(GameModeStyles[GAMESTATE:GetCurrentGame():GetName()] or "dance_single")
return LoadModule("Wheel." .. Wheels[RandButNotLast(#Wheels)] .. ".lua")(GameModeStyles[
GAMESTATE:GetCurrentGame():GetName()] or "dance_single")

--Debugging.
--return LoadModule("Wheel.Popn10Wheel.lua")(GameModeStyles[GAMESTATE:GetCurrentGame():GetName()] or "dance_single")
--return LoadModule("Wheel.Popn10Wheel.lua")(GameModeStyles[GAMESTATE:GetCurrentGame():GetName()] or "dance_single")
2 changes: 1 addition & 1 deletion BGAnimations/ScreenTitleMenu overlay.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- Insantly go to DDR Wheel.
return Def.ActorFrame {
OnCommand=function(self)
OnCommand = function(self)
SCREENMAN:GetTopScreen():SetNextScreenName("OFSelectMusic"):StartTransitioningScreen("SM_GoToNextScreen")
end
}
18 changes: 9 additions & 9 deletions Modules/Group.List.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
return function(Songs)

local Groups = {}
local Groups = {}

for _,v in ipairs(Songs) do
for _, v in ipairs(Songs) do
local Add = true
for _,v2 in ipairs(Groups) do
for _, v2 in ipairs(Groups) do
if v2 == v[1]:GetGroupName() then Add = false break end
end
if Add then
Groups[#Groups+1] = v[1]:GetGroupName()
end
end
return Groups
end
Groups[#Groups + 1] = v[1]:GetGroupName()
end
end

return Groups
end
36 changes: 18 additions & 18 deletions Modules/Group.Sort.lua
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
-- Return the main function that contains a list of the groups.
return function(Songs,CurGroup)
return function(Songs, CurGroup)

local Groups = {}

for _,v in ipairs(Songs) do
for _, v in ipairs(Songs) do
local Add = true
for _,v2 in ipairs(Groups) do
for _, v2 in ipairs(Groups) do
if v2 == v[1]:GetGroupName() then Add = false break end
end
if Add then
Groups[#Groups+1] = v[1]:GetGroupName()
end
end
Groups[#Groups + 1] = v[1]:GetGroupName()
end
end

local function compare(a, b)
return a < b
end

local function compare(a,b)
return a < b
end

table.sort(Groups, compare)

local GroupsAndSongs = {}
for _,v in ipairs(Groups) do
GroupsAndSongs[#GroupsAndSongs+1] = v

for _, v in ipairs(Groups) do
GroupsAndSongs[#GroupsAndSongs + 1] = v
if v == CurGroup then
for _,v2 in ipairs(Songs) do
for _, v2 in ipairs(Songs) do
if v2[1]:GetGroupName() == v then
GroupsAndSongs[#GroupsAndSongs+1] = v2
GroupsAndSongs[#GroupsAndSongs + 1] = v2
end
end
end
end
end

return GroupsAndSongs
end
end
26 changes: 13 additions & 13 deletions Modules/Songs.DifficultyLoader.lua
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
local DiffTab = {
["Difficulty_Beginner"] = 1,
["Difficulty_Easy"] = 1,
["Difficulty_Medium"] = 2,
["Difficulty_Hard"] = 2,
["Difficulty_Challenge"] = 3,
["Difficulty_Edit"] = 4
local DiffTab = {
["Difficulty_Beginner"] = 1,
["Difficulty_Easy"] = 1,
["Difficulty_Medium"] = 2,
["Difficulty_Hard"] = 2,
["Difficulty_Challenge"] = 3,
["Difficulty_Edit"] = 4
}

return function(Songs,CurGroup)
return function(Songs, CurGroup)
local DiffSongs = {}
for i = 1,4 do
for i = 1, 4 do
DiffSongs[i] = {}
end

for _,song in pairs(Songs) do
for _, song in pairs(Songs) do

if CurGroup == "" then
CurGroup = song[1]:GetGroupName()
end

if CurGroup == song[1]:GetGroupName() then
for _,diffs in pairs(song) do
for _, diffs in pairs(song) do
if diffs ~= song[1] then
local curdiff = DiffTab[diffs:GetDifficulty()]
DiffSongs[curdiff][#DiffSongs[curdiff]+1] = {song[1],diffs}
DiffSongs[curdiff][#DiffSongs[curdiff] + 1] = { song[1], diffs }
end
end
end
end

return DiffSongs
end
end
24 changes: 12 additions & 12 deletions Modules/Songs.ImagePreLoader.lua
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
local Songs = TF_WHEEL.Songs
local Modes = TF_WHEEL.Modes

local Images = Def.ActorFrame {Name="PreLoad"}
local Images = Def.ActorFrame { Name = "PreLoad" }

for i = 1,#Songs do
for i = 1, #Songs do
if type(Songs[i]) ~= "string" then
if string.find(string.lower(Modes), "banner") then
Images[#Images+1] = Def.Sprite {
Name=Songs[i][1]:GetBannerPath(),
Texture=Songs[i][1]:GetBannerPath()
Images[#Images + 1] = Def.Sprite {
Name = Songs[i][1]:GetBannerPath(),
Texture = Songs[i][1]:GetBannerPath()
}
end
if string.find(string.lower(Modes), "background") then
Images[#Images+1] = Def.Sprite {
Name=Songs[i][1]:GetBackgroundPath(),
Texture=Songs[i][1]:GetBackgroundPath()
Images[#Images + 1] = Def.Sprite {
Name = Songs[i][1]:GetBackgroundPath(),
Texture = Songs[i][1]:GetBackgroundPath()
}
end
else
if SONGMAN:GetSongGroupBannerPath(Songs[i]) ~= "" then
Images[#Images+1] = Def.Sprite {
Name=SONGMAN:GetSongGroupBannerPath(Songs[i]),
Texture="../../../../"..SONGMAN:GetSongGroupBannerPath(Songs[i])
Images[#Images + 1] = Def.Sprite {
Name = SONGMAN:GetSongGroupBannerPath(Songs[i]),
Texture = "../../../../" .. SONGMAN:GetSongGroupBannerPath(Songs[i])
}
end
end
end

return Images
return Images
44 changes: 22 additions & 22 deletions Modules/Songs.Loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,69 +4,69 @@ return function(Style)

-- All the Compatible Songs Container.
local AllCompSongs = {}

-- For all Songs.
for _, CurSong in pairs(SONGMAN:GetAllSongs()) do

-- Temp Difficulty Container.
local DiffCon = {}

-- Set the first value to be Current Looped Song, In the Temp Current Song Container.
local CurSongCon = {CurSong}
local CurSongCon = { CurSong }

-- For all the steps in Current looped Song.
for i, CurStep in ipairs(CurSong:GetAllSteps()) do
-- Find if Steps supports current selected Style.

if string.find(CurStep:GetStepsType():lower(), Style) then

-- Check the type of Steps
-- Check the type of Steps
local Type = 1

-- Check if its HalfDoubles.
if string.find(CurStep:GetStepsType():lower(), "half") then
Type = 2
--Check if its Doubles.
--Check if its Doubles.
elseif string.find(CurStep:GetStepsType():lower(), "double") then
Type = 3
end

-- Check the step level.
local Meter = tonumber(CurStep:GetMeter())
-- If the step level is under 10, Add a 0 in front.
if tonumber(CurStep:GetMeter()) < 10 then
-- Add the 0.
Meter = "0"..CurStep:GetMeter()
Meter = "0" .. CurStep:GetMeter()
end
-- Add the Difficulty to the Temp Difficulty Contrainer.
DiffCon[Type.."_"..tonumber(TF_WHEEL.DiffTab[CurStep:GetDifficulty()]).."_"..Meter] = CurStep
DiffCon[Type .. "_" .. tonumber(TF_WHEEL.DiffTab[CurStep:GetDifficulty()]) .. "_" .. Meter] = CurStep
end
end

-- We want to sort the Difficulties, So we gra the Keys and Sort based on them.
local Keys = {}
for k in pairs(DiffCon) do table.insert(Keys, k) end
table.sort(Keys)

-- Now we put the Difficulies inside the Temp Current Song Contrainer.
for _, k in pairs(Keys) do
if DiffCon[k] then
CurSongCon[#CurSongCon+1] = DiffCon[k]
CurSongCon[#CurSongCon + 1] = DiffCon[k]
end
end

-- If a Difficulty exist for song using Style, Add it to All Compatible Songs.
if CurSongCon[2] then
AllCompSongs[#AllCompSongs+1] = CurSongCon
if CurSongCon[2] then
AllCompSongs[#AllCompSongs + 1] = CurSongCon
end
end
end

local function compare(a, b)
return a[1]:GetDisplayMainTitle() < b[1]:GetDisplayMainTitle()
end

local function compare(a,b)
return a[1]:GetDisplayMainTitle() < b[1]:GetDisplayMainTitle()
end

table.sort(AllCompSongs, compare)

-- Return all the Songs, That support Current Style.
return AllCompSongs
end
end
Loading

0 comments on commit a43ca9b

Please sign in to comment.