Skip to content

Commit 1b1f666

Browse files
committed
change join system.
1 parent b0a03f3 commit 1b1f666

9 files changed

+42
-97
lines changed

BGAnimations/ScreenTitleMenu overlay.lua

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
-- Reset Joined Players.
2-
Joined = nil
3-
41
-- Insantly go to DDR Wheel.
52
return Def.ActorFrame {
63
OnCommand=function(self)

Modules/Wheel.DDR1st1.5Wheel.lua

+5-12
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ if not CurSong then CurSong = 1 end
3737
-- We define the current group to be empty if no group is defined.
3838
if not CurGroup then GurGroup = "" end
3939

40-
-- The player joined.
41-
if not Joined then Joined = {} end
42-
4340
-- The Offset we use for the CD wheel.
4441
local CDOffset = 1
4542

@@ -425,11 +422,10 @@ return function(Style)
425422
-- Do stuff when a user presses the Back on Pad or Menu buttons.
426423
BackCommand=function(self)
427424
-- Check if User is joined.
428-
if Joined[self.pn] then
429-
if Joined[PLAYER_1] and Joined[PLAYER_2] then
425+
if GAMESTATE:IsSideJoined(self.pn) then
426+
if GAMESTATE:IsSideJoined(PLAYER_1) and GAMESTATE:IsSideJoined(PLAYER_2) then
430427
-- If both players are joined, We want to unjoin the player that pressed back.
431428
GAMESTATE:UnjoinPlayer(self.pn)
432-
Joined[self.pn] = false
433429

434430
-- A Player left, Change back to Single.
435431
self:GetChild("Style"):settext("SINGLE")
@@ -447,7 +443,7 @@ return function(Style)
447443
SCREENMAN:GetTopScreen():SetNextScreenName("ScreenPlayerOptions"):StartTransitioningScreen("SM_GoToNextScreen")
448444
end
449445
-- Check if player is joined.
450-
if Joined[self.pn] then
446+
if GAMESTATE:IsSideJoined(self.pn) then
451447

452448
-- Check if we are on a group.
453449
if type(GroupsAndSongs[CurSong]) == "string" then
@@ -487,7 +483,7 @@ return function(Style)
487483
GAMESTATE:SetCurrentSong(GroupsAndSongs[CurSong][1])
488484

489485
-- Check if 2 players are joined.
490-
if Joined[PLAYER_1] and Joined[PLAYER_2] then
486+
if GAMESTATE:IsSideJoined(PLAYER_1) and GAMESTATE:IsSideJoined(PLAYER_2) then
491487

492488
-- If they are, We will use Versus.
493489
GAMESTATE:SetCurrentStyle('versus')
@@ -528,11 +524,8 @@ return function(Style)
528524
-- Load the profles.
529525
GAMESTATE:LoadProfiles()
530526

531-
-- Add to joined list.
532-
Joined[self.pn] = true
533-
534527
-- Set Style Text to VERSUS when 2 Players.
535-
if Joined[PLAYER_1] and Joined[PLAYER_2] then
528+
if GAMESTATE:IsSideJoined(PLAYER_1) and GAMESTATE:IsSideJoined(PLAYER_2) then
536529
self:GetChild("Style"):settext("VERSUS")
537530
end
538531
end

Modules/Wheel.DDR2ndMIXCLUBVERSiON2Wheel.lua

+5-12
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ if not CurSong then CurSong = 1 end
3838
-- We define the current group to be empty if no group is defined.
3939
if not CurGroup then GurGroup = "" end
4040

41-
-- The player joined.
42-
if not Joined then Joined = {} end
43-
4441
-- The Offset we use for the CD wheel.
4542
local CDOffset = 1
4643

@@ -441,11 +438,10 @@ return function(Style)
441438
-- Do stuff when a user presses the Back on Pad or Menu buttons.
442439
BackCommand=function(self)
443440
-- Check if User is joined.
444-
if Joined[self.pn] then
445-
if Joined[PLAYER_1] and Joined[PLAYER_2] then
441+
if GAMESTATE:IsSideJoined(self.pn) then
442+
if GAMESTATE:IsSideJoined(PLAYER_1) and GAMESTATE:IsSideJoined(PLAYER_2) then
446443
-- If both players are joined, We want to unjoin the player that pressed back.
447444
GAMESTATE:UnjoinPlayer(self.pn)
448-
Joined[self.pn] = false
449445

450446
-- A Player left, Change back to Single.
451447
self:GetChild("Style"):settext("SINGLE")
@@ -463,7 +459,7 @@ return function(Style)
463459
SCREENMAN:GetTopScreen():SetNextScreenName("ScreenPlayerOptions"):StartTransitioningScreen("SM_GoToNextScreen")
464460
end
465461
-- Check if player is joined.
466-
if Joined[self.pn] then
462+
if GAMESTATE:IsSideJoined(self.pn) then
467463

468464
-- Check if we are on a group.
469465
if type(GroupsAndSongs[CurSong]) == "string" then
@@ -503,7 +499,7 @@ return function(Style)
503499
GAMESTATE:SetCurrentSong(GroupsAndSongs[CurSong][1])
504500

505501
-- Check if 2 players are joined.
506-
if Joined[PLAYER_1] and Joined[PLAYER_2] then
502+
if GAMESTATE:IsSideJoined(PLAYER_1) and GAMESTATE:IsSideJoined(PLAYER_2) then
507503

508504
-- If they are, We will use Versus.
509505
GAMESTATE:SetCurrentStyle('versus')
@@ -544,11 +540,8 @@ return function(Style)
544540
-- Load the profles.
545541
GAMESTATE:LoadProfiles()
546542

547-
-- Add to joined list.
548-
Joined[self.pn] = true
549-
550543
-- Set Style Text to VERSUS when 2 Players.
551-
if Joined[PLAYER_1] and Joined[PLAYER_2] then
544+
if GAMESTATE:IsSideJoined(PLAYER_1) and GAMESTATE:IsSideJoined(PLAYER_2) then
552545
self:GetChild("Style"):settext("VERSUS")
553546
end
554547
end

Modules/Wheel.DDR3rdMixPlusWheel.lua

+5-12
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ if not CurSong then CurSong = 1 end
4242
-- We define the current group to be empty if no group is defined.
4343
if not CurGroup then GurGroup = "" end
4444

45-
-- The player joined.
46-
if not Joined then Joined = {} end
47-
4845
-- The Offset we use for the CD wheel.
4946
local CDOffset = 1
5047

@@ -524,11 +521,10 @@ return function(Style)
524521
-- Do stuff when a user presses the Back on Pad or Menu buttons.
525522
BackCommand=function(self)
526523
-- Check if User is joined.
527-
if Joined[self.pn] then
528-
if Joined[PLAYER_1] and Joined[PLAYER_2] then
524+
if GAMESTATE:IsSideJoined(self.pn) then
525+
if GAMESTATE:IsSideJoined(PLAYER_1) and GAMESTATE:IsSideJoined(PLAYER_2) then
529526
-- If both players are joined, We want to unjoin the player that pressed back.
530527
GAMESTATE:UnjoinPlayer(self.pn)
531-
Joined[self.pn] = false
532528
else
533529
-- Go to the previous screen.
534530
SCREENMAN:GetTopScreen():SetNextScreenName(SCREENMAN:GetTopScreen():GetPrevScreenName()):StartTransitioningScreen("SM_GoToNextScreen")
@@ -543,7 +539,7 @@ return function(Style)
543539
SCREENMAN:GetTopScreen():SetNextScreenName("ScreenPlayerOptions"):StartTransitioningScreen("SM_GoToNextScreen")
544540
end
545541
-- Check if player is joined.
546-
if Joined[self.pn] then
542+
if GAMESTATE:IsSideJoined(self.pn) then
547543

548544
-- Check if we are on a group.
549545
if type(GroupsAndSongs[CurSong]) == "string" then
@@ -583,7 +579,7 @@ return function(Style)
583579
GAMESTATE:SetCurrentSong(GroupsAndSongs[CurSong][1])
584580

585581
-- Check if 2 players are joined.
586-
if Joined[PLAYER_1] and Joined[PLAYER_2] then
582+
if GAMESTATE:IsSideJoined(PLAYER_1) and GAMESTATE:IsSideJoined(PLAYER_2) then
587583

588584
-- If they are, We will use Versus.
589585
GAMESTATE:SetCurrentStyle('versus')
@@ -624,11 +620,8 @@ return function(Style)
624620
-- Load the profles.
625621
GAMESTATE:LoadProfiles()
626622

627-
-- Add to joined list.
628-
Joined[self.pn] = true
629-
630623
-- Set Style Text to VERSUS when 2 Players.
631-
if Joined[PLAYER_1] and Joined[PLAYER_2] then
624+
if GAMESTATE:IsSideJoined(PLAYER_1) and GAMESTATE:IsSideJoined(PLAYER_2) then
632625
self:GetChild("Style"):settext("VERSUS")
633626
end
634627
end

Modules/Wheel.DDR4thMixPlusWheel.lua

+10-17
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ if not CurSong then CurSong = 1 end
2828
-- We define the current group to be empty if no group is defined.
2929
if not CurGroup then GurGroup = "" end
3030

31-
-- The player joined.
32-
if not Joined then Joined = {} end
33-
3431
-- The current row of 7 songs that are being displayed.
3532
local CurRow = 1
3633

@@ -425,7 +422,7 @@ local function StartSelection(self,Songs)
425422
end
426423

427424
-- If player 1 is joined.
428-
if Joined[PLAYER_1] then
425+
if GAMESTATE:IsSideJoined(PLAYER_1) then
429426

430427
-- Show the difficulty border on the left side of the selector.
431428
self:GetChild("Diffs"):GetChild("DiffSelector"..i.."1"):GetChild("DiffCon"):sleep(.5):linear(.5):diffuse(DiffColors[TF_WHEEL.DiffTab[Songs[CurSong][i+1]:GetDifficulty()]])
@@ -435,7 +432,7 @@ local function StartSelection(self,Songs)
435432
end
436433

437434
-- If player 2 is joined
438-
if Joined[PLAYER_2] then
435+
if GAMESTATE:IsSideJoined(PLAYER_2) then
439436

440437
-- Show the difficulty border on the right side of the selector.
441438
self:GetChild("Diffs"):GetChild("DiffSelector"..i.."2"):GetChild("DiffCon"):sleep(.5):linear(.5):diffuse(DiffColors[TF_WHEEL.DiffTab[Songs[CurSong][i+1]:GetDifficulty()]])
@@ -459,7 +456,7 @@ local function MoveDifficulty(self,offset,Songs)
459456
if self.pn == PLAYER_2 then pn = 2 end
460457

461458
-- If player is joined, let them change the difficulty.
462-
if Joined[self.pn] then
459+
if GAMESTATE:IsSideJoined(self.pn) then
463460

464461
-- For all difficulties that are used stop the blink.
465462
for i = 1,6 do
@@ -788,11 +785,10 @@ return function(Style)
788785
-- Do stuff when a user presses the Back on Pad or Menu buttons.
789786
BackCommand=function(self)
790787
-- Check if User is joined.
791-
if Joined[self.pn] then
792-
if Joined[PLAYER_1] and Joined[PLAYER_2] then
788+
if GAMESTATE:IsSideJoined(self.pn) then
789+
if GAMESTATE:IsSideJoined(PLAYER_1) and GAMESTATE:IsSideJoined(PLAYER_2) then
793790
-- If both players are joined, We want to unjoin the player that pressed back.
794791
GAMESTATE:UnjoinPlayer(self.pn)
795-
Joined[self.pn] = false
796792
else
797793
-- Go to the previous screen.
798794
SCREENMAN:GetTopScreen():SetNextScreenName(SCREENMAN:GetTopScreen():GetPrevScreenName()):StartTransitioningScreen("SM_GoToNextScreen")
@@ -811,7 +807,7 @@ return function(Style)
811807
SCREENMAN:GetTopScreen():SetNextScreenName("ScreenPlayerOptions"):StartTransitioningScreen("SM_GoToNextScreen")
812808
end
813809
-- Check if player is joined.
814-
if Joined[self.pn] then
810+
if GAMESTATE:IsSideJoined(self.pn) then
815811

816812
--We use PlayMode_Regular for now.
817813
GAMESTATE:SetCurrentPlayMode("PlayMode_Regular")
@@ -820,7 +816,7 @@ return function(Style)
820816
GAMESTATE:SetCurrentSong(GroupsAndSongs[CurSong][1])
821817

822818
-- Check if 2 players are joined.
823-
if Joined[PLAYER_1] and Joined[PLAYER_2] then
819+
if GAMESTATE:IsSideJoined(PLAYER_1) and GAMESTATE:IsSideJoined(PLAYER_2) then
824820

825821
-- If they are, We will use Versus.
826822
GAMESTATE:SetCurrentStyle('versus')
@@ -857,7 +853,7 @@ return function(Style)
857853
if UnlockedInput then
858854

859855
-- Check if player is joined.
860-
if Joined[self.pn] then
856+
if GAMESTATE:IsSideJoined(self.pn) then
861857

862858
-- Check if we are on a group.
863859
if type(GroupsAndSongs[CurSong]) == "string" then
@@ -900,9 +896,6 @@ return function(Style)
900896

901897
-- Load the profles.
902898
GAMESTATE:LoadProfiles()
903-
904-
-- Add to joined list.
905-
Joined[self.pn] = true
906899
end
907900
end
908901
end
@@ -921,8 +914,8 @@ return function(Style)
921914
DiffSelection = true
922915

923916
-- Set the first value in the difficulty selector active.
924-
if Joined[PLAYER_1] then self:GetChild("Diffs"):GetChild("DiffSelector11"):effectclock("Beat"):glowshift() end
925-
if Joined[PLAYER_2] then self:GetChild("Diffs"):GetChild("DiffSelector12"):effectclock("Beat"):glowshift() end
917+
if GAMESTATE:IsSideJoined(PLAYER_1) then self:GetChild("Diffs"):GetChild("DiffSelector11"):effectclock("Beat"):glowshift() end
918+
if GAMESTATE:IsSideJoined(PLAYER_2) then self:GetChild("Diffs"):GetChild("DiffSelector12"):effectclock("Beat"):glowshift() end
926919
end,
927920

928921
Slider, -- Load the sliders

Modules/Wheel.DDR5thMixWheel.lua

+9-16
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ if not CurSong then CurSong = 1 end
2828
-- We define the current group to be empty if no group is defined.
2929
if not CurGroup then GurGroup = "" end
3030

31-
-- The player joined.
32-
if not Joined then Joined = {} end
33-
3431
-- Position on the difficulty select that shows up after we picked a song.
3532
local DiffPos = {[PLAYER_1] = 1,[PLAYER_2] = 1}
3633

@@ -250,7 +247,7 @@ local function MoveSelection(self,offset,Songs)
250247
if i > 6 then break end
251248

252249
-- Check if P1 is active.
253-
if Joined[PLAYER_1] then
250+
if GAMESTATE:IsSideJoined(PLAYER_1) then
254251

255252
-- Diffuse the background of the difficulty selector.
256253
self:GetChild("Diffs"):GetChild("DiffName1P"..i):GetChild("DiffBG"):diffuse(DiffColors[TF_WHEEL.DiffTab[Songs[CurSong][i+1]:GetDifficulty()]])
@@ -260,7 +257,7 @@ local function MoveSelection(self,offset,Songs)
260257
end
261258

262259
-- Check if P2 is active.
263-
if Joined[PLAYER_2] then
260+
if GAMESTATE:IsSideJoined(PLAYER_2) then
264261

265262
-- Diffuse the background of the difficulty selector.
266263
self:GetChild("Diffs"):GetChild("DiffName2P"..i):GetChild("DiffBG"):diffuse(DiffColors[TF_WHEEL.DiffTab[Songs[CurSong][i+1]:GetDifficulty()]])
@@ -288,12 +285,12 @@ local function MoveSelection(self,offset,Songs)
288285
end
289286

290287
-- Check if P1 is active, if P1 is active, show the difficulty selector.
291-
if Joined[PLAYER_1] then
288+
if GAMESTATE:IsSideJoined(PLAYER_1) then
292289
self:GetChild("Diffs"):GetChild("DiffName1P"..i):diffusealpha(1)
293290
end
294291

295292
-- Check if P2 is active, if P2 is active, show the difficulty selector.
296-
if Joined[PLAYER_2] then
293+
if GAMESTATE:IsSideJoined(PLAYER_2) then
297294
self:GetChild("Diffs"):GetChild("DiffName2P"..i):diffusealpha(1)
298295
end
299296

@@ -382,7 +379,7 @@ end
382379
local function MoveDifficulty(self,offset,Songs)
383380

384381
-- check if player is joined.
385-
if Joined[self.pn] then
382+
if GAMESTATE:IsSideJoined(self.pn) then
386383

387384
-- Move cursor.
388385
DiffPos[self.pn] = DiffPos[self.pn] + offset
@@ -619,11 +616,10 @@ return function(Style)
619616
-- Do stuff when a user presses the Back on Pad or Menu buttons.
620617
BackCommand=function(self)
621618
-- Check if User is joined.
622-
if Joined[self.pn] then
623-
if Joined[PLAYER_1] and Joined[PLAYER_2] then
619+
if GAMESTATE:IsSideJoined(self.pn) then
620+
if GAMESTATE:IsSideJoined(PLAYER_1) and GAMESTATE:IsSideJoined(PLAYER_2) then
624621
-- If both players are joined, We want to unjoin the player that pressed back.
625622
GAMESTATE:UnjoinPlayer(self.pn)
626-
Joined[self.pn] = false
627623

628624
MoveSelection(self,0,GroupsAndSongs)
629625
else
@@ -640,7 +636,7 @@ return function(Style)
640636
SCREENMAN:GetTopScreen():SetNextScreenName("ScreenPlayerOptions"):StartTransitioningScreen("SM_GoToNextScreen")
641637
end
642638
-- Check if player is joined.
643-
if Joined[self.pn] then
639+
if GAMESTATE:IsSideJoined(self.pn) then
644640

645641
-- Check if we are on a group.
646642
if type(GroupsAndSongs[CurSong]) == "string" then
@@ -680,7 +676,7 @@ return function(Style)
680676
GAMESTATE:SetCurrentSong(GroupsAndSongs[CurSong][1])
681677

682678
-- Check if 2 players are joined.
683-
if Joined[PLAYER_1] and Joined[PLAYER_2] then
679+
if GAMESTATE:IsSideJoined(PLAYER_1) and GAMESTATE:IsSideJoined(PLAYER_2) then
684680

685681
-- If they are, We will use Versus.
686682
GAMESTATE:SetCurrentStyle('versus')
@@ -718,9 +714,6 @@ return function(Style)
718714
-- Load the profles.
719715
GAMESTATE:LoadProfiles()
720716

721-
-- Add to joined list.
722-
Joined[self.pn] = true
723-
724717
MoveSelection(self,0,GroupsAndSongs)
725718
end
726719
end,

0 commit comments

Comments
 (0)