Skip to content

Commit a43ca9b

Browse files
committed
clean lua format and versusDB
1 parent ed3dc91 commit a43ca9b

17 files changed

+3093
-2744
lines changed
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
-- Random BG Colour
22
return Def.Quad {
3-
OnCommand=function(self) self:Center():zoomto(SCREEN_WIDTH,SCREEN_HEIGHT):diffuse(math.random()/4,math.random()/4,math.random()/4,1) end
4-
}
3+
OnCommand = function(self) self:Center():zoomto(SCREEN_WIDTH, SCREEN_HEIGHT):diffuse(math.random() / 4, math.random() /
4+
4, math.random() / 4, 1) end
5+
}

BGAnimations/OFSelectMusic overlay.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,16 @@ if not Last then Last = 0 end
3737
local function RandButNotLast(Amount)
3838
local Now
3939
while true do
40-
Now = math.random(1,Amount)
40+
Now = math.random(1, Amount)
4141
if Now ~= Last then break end
4242
end
4343
Last = Now
4444
return Now
4545
end
4646

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

5051
--Debugging.
51-
--return LoadModule("Wheel.Popn10Wheel.lua")(GameModeStyles[GAMESTATE:GetCurrentGame():GetName()] or "dance_single")
52+
--return LoadModule("Wheel.Popn10Wheel.lua")(GameModeStyles[GAMESTATE:GetCurrentGame():GetName()] or "dance_single")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- Insantly go to DDR Wheel.
22
return Def.ActorFrame {
3-
OnCommand=function(self)
3+
OnCommand = function(self)
44
SCREENMAN:GetTopScreen():SetNextScreenName("OFSelectMusic"):StartTransitioningScreen("SM_GoToNextScreen")
55
end
66
}

Modules/Group.List.lua

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
return function(Songs)
22

3-
local Groups = {}
3+
local Groups = {}
44

5-
for _,v in ipairs(Songs) do
5+
for _, v in ipairs(Songs) do
66
local Add = true
7-
for _,v2 in ipairs(Groups) do
7+
for _, v2 in ipairs(Groups) do
88
if v2 == v[1]:GetGroupName() then Add = false break end
99
end
1010
if Add then
11-
Groups[#Groups+1] = v[1]:GetGroupName()
12-
end
13-
end
14-
15-
return Groups
16-
end
11+
Groups[#Groups + 1] = v[1]:GetGroupName()
12+
end
13+
end
14+
15+
return Groups
16+
end

Modules/Group.Sort.lua

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
-- Return the main function that contains a list of the groups.
2-
return function(Songs,CurGroup)
2+
return function(Songs, CurGroup)
33

44
local Groups = {}
55

6-
for _,v in ipairs(Songs) do
6+
for _, v in ipairs(Songs) do
77
local Add = true
8-
for _,v2 in ipairs(Groups) do
8+
for _, v2 in ipairs(Groups) do
99
if v2 == v[1]:GetGroupName() then Add = false break end
1010
end
1111
if Add then
12-
Groups[#Groups+1] = v[1]:GetGroupName()
13-
end
14-
end
12+
Groups[#Groups + 1] = v[1]:GetGroupName()
13+
end
14+
end
15+
16+
local function compare(a, b)
17+
return a < b
18+
end
1519

16-
local function compare(a,b)
17-
return a < b
18-
end
19-
2020
table.sort(Groups, compare)
21-
21+
2222
local GroupsAndSongs = {}
23-
24-
for _,v in ipairs(Groups) do
25-
GroupsAndSongs[#GroupsAndSongs+1] = v
23+
24+
for _, v in ipairs(Groups) do
25+
GroupsAndSongs[#GroupsAndSongs + 1] = v
2626
if v == CurGroup then
27-
for _,v2 in ipairs(Songs) do
27+
for _, v2 in ipairs(Songs) do
2828
if v2[1]:GetGroupName() == v then
29-
GroupsAndSongs[#GroupsAndSongs+1] = v2
29+
GroupsAndSongs[#GroupsAndSongs + 1] = v2
3030
end
31-
end
31+
end
3232
end
3333
end
3434

3535
return GroupsAndSongs
36-
end
36+
end

Modules/Songs.DifficultyLoader.lua

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
local DiffTab = {
2-
["Difficulty_Beginner"] = 1,
3-
["Difficulty_Easy"] = 1,
4-
["Difficulty_Medium"] = 2,
5-
["Difficulty_Hard"] = 2,
6-
["Difficulty_Challenge"] = 3,
7-
["Difficulty_Edit"] = 4
1+
local DiffTab = {
2+
["Difficulty_Beginner"] = 1,
3+
["Difficulty_Easy"] = 1,
4+
["Difficulty_Medium"] = 2,
5+
["Difficulty_Hard"] = 2,
6+
["Difficulty_Challenge"] = 3,
7+
["Difficulty_Edit"] = 4
88
}
99

10-
return function(Songs,CurGroup)
10+
return function(Songs, CurGroup)
1111
local DiffSongs = {}
12-
for i = 1,4 do
12+
for i = 1, 4 do
1313
DiffSongs[i] = {}
1414
end
1515

16-
for _,song in pairs(Songs) do
16+
for _, song in pairs(Songs) do
1717

1818
if CurGroup == "" then
1919
CurGroup = song[1]:GetGroupName()
2020
end
2121

2222
if CurGroup == song[1]:GetGroupName() then
23-
for _,diffs in pairs(song) do
23+
for _, diffs in pairs(song) do
2424
if diffs ~= song[1] then
2525
local curdiff = DiffTab[diffs:GetDifficulty()]
26-
DiffSongs[curdiff][#DiffSongs[curdiff]+1] = {song[1],diffs}
26+
DiffSongs[curdiff][#DiffSongs[curdiff] + 1] = { song[1], diffs }
2727
end
2828
end
2929
end
3030
end
3131

3232
return DiffSongs
33-
end
33+
end

Modules/Songs.ImagePreLoader.lua

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
local Songs = TF_WHEEL.Songs
22
local Modes = TF_WHEEL.Modes
33

4-
local Images = Def.ActorFrame {Name="PreLoad"}
4+
local Images = Def.ActorFrame { Name = "PreLoad" }
55

6-
for i = 1,#Songs do
6+
for i = 1, #Songs do
77
if type(Songs[i]) ~= "string" then
88
if string.find(string.lower(Modes), "banner") then
9-
Images[#Images+1] = Def.Sprite {
10-
Name=Songs[i][1]:GetBannerPath(),
11-
Texture=Songs[i][1]:GetBannerPath()
9+
Images[#Images + 1] = Def.Sprite {
10+
Name = Songs[i][1]:GetBannerPath(),
11+
Texture = Songs[i][1]:GetBannerPath()
1212
}
1313
end
1414
if string.find(string.lower(Modes), "background") then
15-
Images[#Images+1] = Def.Sprite {
16-
Name=Songs[i][1]:GetBackgroundPath(),
17-
Texture=Songs[i][1]:GetBackgroundPath()
15+
Images[#Images + 1] = Def.Sprite {
16+
Name = Songs[i][1]:GetBackgroundPath(),
17+
Texture = Songs[i][1]:GetBackgroundPath()
1818
}
1919
end
2020
else
2121
if SONGMAN:GetSongGroupBannerPath(Songs[i]) ~= "" then
22-
Images[#Images+1] = Def.Sprite {
23-
Name=SONGMAN:GetSongGroupBannerPath(Songs[i]),
24-
Texture="../../../../"..SONGMAN:GetSongGroupBannerPath(Songs[i])
22+
Images[#Images + 1] = Def.Sprite {
23+
Name = SONGMAN:GetSongGroupBannerPath(Songs[i]),
24+
Texture = "../../../../" .. SONGMAN:GetSongGroupBannerPath(Songs[i])
2525
}
2626
end
2727
end
2828
end
2929

30-
return Images
30+
return Images

Modules/Songs.Loader.lua

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,69 +4,69 @@ return function(Style)
44

55
-- All the Compatible Songs Container.
66
local AllCompSongs = {}
7-
7+
88
-- For all Songs.
99
for _, CurSong in pairs(SONGMAN:GetAllSongs()) do
10-
10+
1111
-- Temp Difficulty Container.
1212
local DiffCon = {}
13-
13+
1414
-- Set the first value to be Current Looped Song, In the Temp Current Song Container.
15-
local CurSongCon = {CurSong}
16-
15+
local CurSongCon = { CurSong }
16+
1717
-- For all the steps in Current looped Song.
1818
for i, CurStep in ipairs(CurSong:GetAllSteps()) do
1919
-- Find if Steps supports current selected Style.
2020

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

23-
-- Check the type of Steps
23+
-- Check the type of Steps
2424
local Type = 1
2525

2626
-- Check if its HalfDoubles.
2727
if string.find(CurStep:GetStepsType():lower(), "half") then
2828
Type = 2
29-
--Check if its Doubles.
29+
--Check if its Doubles.
3030
elseif string.find(CurStep:GetStepsType():lower(), "double") then
3131
Type = 3
3232
end
33-
33+
3434
-- Check the step level.
3535
local Meter = tonumber(CurStep:GetMeter())
3636
-- If the step level is under 10, Add a 0 in front.
3737
if tonumber(CurStep:GetMeter()) < 10 then
3838
-- Add the 0.
39-
Meter = "0"..CurStep:GetMeter()
39+
Meter = "0" .. CurStep:GetMeter()
4040
end
4141
-- Add the Difficulty to the Temp Difficulty Contrainer.
42-
DiffCon[Type.."_"..tonumber(TF_WHEEL.DiffTab[CurStep:GetDifficulty()]).."_"..Meter] = CurStep
42+
DiffCon[Type .. "_" .. tonumber(TF_WHEEL.DiffTab[CurStep:GetDifficulty()]) .. "_" .. Meter] = CurStep
4343
end
4444
end
45-
45+
4646
-- We want to sort the Difficulties, So we gra the Keys and Sort based on them.
4747
local Keys = {}
4848
for k in pairs(DiffCon) do table.insert(Keys, k) end
4949
table.sort(Keys)
50-
50+
5151
-- Now we put the Difficulies inside the Temp Current Song Contrainer.
5252
for _, k in pairs(Keys) do
5353
if DiffCon[k] then
54-
CurSongCon[#CurSongCon+1] = DiffCon[k]
54+
CurSongCon[#CurSongCon + 1] = DiffCon[k]
5555
end
5656
end
57-
57+
5858
-- If a Difficulty exist for song using Style, Add it to All Compatible Songs.
59-
if CurSongCon[2] then
60-
AllCompSongs[#AllCompSongs+1] = CurSongCon
59+
if CurSongCon[2] then
60+
AllCompSongs[#AllCompSongs + 1] = CurSongCon
6161
end
62-
end
62+
end
63+
64+
local function compare(a, b)
65+
return a[1]:GetDisplayMainTitle() < b[1]:GetDisplayMainTitle()
66+
end
6367

64-
local function compare(a,b)
65-
return a[1]:GetDisplayMainTitle() < b[1]:GetDisplayMainTitle()
66-
end
67-
6868
table.sort(AllCompSongs, compare)
6969

7070
-- Return all the Songs, That support Current Style.
7171
return AllCompSongs
72-
end
72+
end

0 commit comments

Comments
 (0)