Skip to content

Commit

Permalink
ensure Casual Mode respects #SELECTABLE:NO;
Browse files Browse the repository at this point in the history
This fixes CasualMode to not show songs that are considered "locked" by
StepMania.  This includes one or more of:

  #SELECTABLE:NO is set in the simfile and StepMania's HiddenSongs preference is
    enabled.
  the song is locked using UNLOCKMAN
  the song is disabled via ScreenOptionsToggleSongs

UNLOCKMAN:SongIsLocked(song) will return an int between 0 to 15 inclusive, the
result of bitwise ORing powers-of-2 representing reasons a song could be locked,
defined in UnlockManager.h.

0 means the song is not locked for any reason, so let's ensure
UNLOCKMAN:SongIsLocked(song) returns 0 in ScreenSelectMusicCasual.  If not,
prune the song.
  • Loading branch information
quietly-turning authored and teejusb committed Oct 19, 2022
1 parent c1d9b14 commit 4912a0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion BGAnimations/ScreenSelectMusicCasual overlay/Input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ t.Handler = function(event)

--------------------------------------------------------------
--------------------------------------------------------------
-- handle SSMCasual's custom PlayerPptions menu input
-- handle SSMCasual's custom PlayerOptions menu input

else
-- get the index of the active optionrow for this player
Expand Down
8 changes: 6 additions & 2 deletions BGAnimations/ScreenSelectMusicCasual overlay/Setup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
-- The idea is basically to just throw setup-related stuff
-- in here that we don't want cluttering up default.lua
---------------------------------------------------------------------------

-- because no one wants "Invalid PlayMode 7"
GAMESTATE:SetCurrentPlayMode(0)
GAMESTATE:SetCurrentPlayMode('PlayMode_Regular')

---------------------------------------------------------------------------
-- local junk
Expand Down Expand Up @@ -112,7 +113,10 @@ local PruneSongsFromGroup = function(group)
-- this should be guaranteed by this point, but better safe than segfault
if song:HasStepsType(steps_type)
-- respect StepMania's cutoff for 1-round songs
and song:MusicLengthSeconds() < PREFSMAN:GetPreference("LongVerSongSeconds") then
and song:MusicLengthSeconds() < PREFSMAN:GetPreference("LongVerSongSeconds")
-- respect the #SELECTABLE tag in this song's simfile
and UNLOCKMAN:IsSongLocked(song) == 0
then
-- ensure that at least one stepchart has a meter ≤ CasualMaxMeter (10, by default)
for steps in ivalues(song:GetStepsByStepsType(steps_type)) do
if steps:GetMeter() <= ThemePrefs.Get("CasualMaxMeter") then
Expand Down

0 comments on commit 4912a0c

Please sign in to comment.