Skip to content

Commit

Permalink
remove unused internal screenselectmusic actors
Browse files Browse the repository at this point in the history
this includes internal banner/cdtitle and highscoreframe actors that are all custom defined in lua as of now

also removes the internal showbanners pref
  • Loading branch information
MinaciousGrace committed Nov 21, 2018
1 parent 20cd6fb commit e01ab8a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 182 deletions.
1 change: 0 additions & 1 deletion src/PrefsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ PrefsManager::PrefsManager()
, m_bAllowedLag("AllowedLag", 0.001f)
, m_bShowStats("ShowStats", TRUE_IF_DEBUG)
, m_bShowSkips("ShowSkips", true)
, m_bShowBanners("ShowBanners", true)
, m_bShowMouseCursor("ShowMouseCursor", true)
, m_bVsync("Vsync", false)
, m_FastNoteRendering("FastNoteRendering", true)
Expand Down
1 change: 0 additions & 1 deletion src/PrefsManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ class PrefsManager
Preference<float> m_bAllowedLag;
Preference<bool> m_bShowStats;
Preference<bool> m_bShowSkips;
Preference<bool> m_bShowBanners;
Preference<bool> m_bShowMouseCursor;
Preference<bool> m_bVsync;
Preference<bool> m_FastNoteRendering;
Expand Down
2 changes: 0 additions & 2 deletions src/ScreenOptionsMasterPrefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1017,8 +1017,6 @@ InitializeConfOptions()
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
ADD(ConfOption("FastNoteRendering", MovePref<bool>, "Off", "On"));
ADD(ConfOption("ShowStats", MovePref<bool>, "Off", "On"));
ADD(ConfOption("ShowBanners", MovePref<bool>, "Off", "On"));

// Sound options
ADD(ConfOption("AttractSoundFrequency",
MovePref<AttractSoundFrequency>,
Expand Down
184 changes: 10 additions & 174 deletions src/ScreenSelectMusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ AutoScreenMessage(SM_BackFromPlayerOptions);
AutoScreenMessage(SM_ConfirmDeleteSong);
AutoScreenMessage(SM_BackFromNamePlaylist);

static RString g_sCDTitlePath;
static bool g_bWantFallbackCdTitle;
static bool g_bCDTitleWaiting = false;
static RString g_sBannerPath;
static bool g_bBannerWaiting = false;
static bool g_bSampleMusicWaiting = false;
static bool delayedchartupdatewaiting = false;
static RageTimer g_StartedLoadingAt(RageZeroTimer);
Expand Down Expand Up @@ -215,37 +210,6 @@ ScreenSelectMusic::Init()
m_OptionsList[PLAYER_2].Link(&m_OptionsList[PLAYER_1]);
}

// this is loaded SetSong and TweenToSong
m_Banner.SetName("Banner");
LOAD_ALL_COMMANDS_AND_SET_XY(m_Banner);
this->AddChild(&m_Banner);

m_sprCDTitleFront.SetName("CDTitle");
m_sprCDTitleFront.Load(THEME->GetPathG(m_sName, "fallback cdtitle"));
LOAD_ALL_COMMANDS_AND_SET_XY(m_sprCDTitleFront);
COMMAND(m_sprCDTitleFront, "Front");
this->AddChild(&m_sprCDTitleFront);

m_sprCDTitleBack.SetName("CDTitle");
m_sprCDTitleBack.Load(THEME->GetPathG(m_sName, "fallback cdtitle"));
LOAD_ALL_COMMANDS_AND_SET_XY(m_sprCDTitleBack);
COMMAND(m_sprCDTitleBack, "Back");
this->AddChild(&m_sprCDTitleBack);

FOREACH_ENUM(PlayerNumber, p)
{
m_sprHighScoreFrame[p].Load(
THEME->GetPathG(m_sName, ssprintf("ScoreFrame P%d", p + 1)));
m_sprHighScoreFrame[p]->SetName(ssprintf("ScoreFrameP%d", p + 1));
LOAD_ALL_COMMANDS_AND_SET_XY(m_sprHighScoreFrame[p]);
this->AddChild(m_sprHighScoreFrame[p]);

m_textHighScore[p].SetName(ssprintf("ScoreP%d", p + 1));
m_textHighScore[p].LoadFromFont(THEME->GetPathF(m_sName, "score"));
LOAD_ALL_COMMANDS_AND_SET_XY(m_textHighScore[p]);
this->AddChild(&m_textHighScore[p]);
}

RageSoundLoadParams SoundParams;
SoundParams.m_bSupportPan = true;

Expand Down Expand Up @@ -276,15 +240,15 @@ ScreenSelectMusic::BeginScreen()
GAMESTATE->SetCompatibleStylesForPlayers();
}

if (GAMESTATE->GetCurrentStyle(PLAYER_INVALID) == NULL) {
if (GAMESTATE->GetCurrentStyle(PLAYER_INVALID) == nullptr) {
LOG->Trace("The Style has not been set. A theme must set the Style "
"before loading ScreenSelectMusic.");
// Instead of crashing, set the first compatible style.
vector<StepsType> vst;
GAMEMAN->GetStepsTypesForGame(GAMESTATE->m_pCurGame, vst);
const Style* pStyle = GAMEMAN->GetFirstCompatibleStyle(
GAMESTATE->m_pCurGame, GAMESTATE->GetNumSidesJoined(), vst[0]);
if (pStyle == NULL) {
if (pStyle == nullptr) {
LOG->Warn(ssprintf("No compatible styles for %s with %d player%s.",
GAMESTATE->m_pCurGame->m_szName,
GAMESTATE->GetNumSidesJoined(),
Expand All @@ -300,13 +264,6 @@ ScreenSelectMusic::BeginScreen()
GAMESTATE->m_PlayMode.Set(PLAY_MODE_REGULAR);
LOG->Trace("PlayMode not set, setting as regular.");
}
FOREACH_ENUM(PlayerNumber, pn)
{
if (GAMESTATE->IsHumanPlayer(pn))
continue;
m_sprHighScoreFrame[pn]->SetVisible(false);
m_textHighScore[pn].SetVisible(false);
}

OPTIONS_MENU_AVAILABLE.Load(m_sName, "OptionsMenuAvailable");
PlayCommand("Mods");
Expand Down Expand Up @@ -348,31 +305,6 @@ ScreenSelectMusic::~ScreenSelectMusic()
void
ScreenSelectMusic::CheckBackgroundRequests(bool bForce)
{
if (g_bCDTitleWaiting) {
// The CDTitle is normally very small, so we don't bother waiting to
// display it.
RString sPath;
if (!m_BackgroundLoader.IsCacheFileFinished(g_sCDTitlePath, sPath))
return;

g_bCDTitleWaiting = false;

RString sCDTitlePath = sPath;

if (sCDTitlePath.empty() || !IsAFile(sCDTitlePath))
sCDTitlePath =
g_bWantFallbackCdTitle ? m_sFallbackCDTitlePath : RString("");

if (!sCDTitlePath.empty()) {
TEXTUREMAN->DisableOddDimensionWarning();
m_sprCDTitleFront.Load(sCDTitlePath);
m_sprCDTitleBack.Load(sCDTitlePath);
TEXTUREMAN->EnableOddDimensionWarning();
}

m_BackgroundLoader.FinishedWithCachedFile(g_sCDTitlePath);
}

/* Loading the rest can cause small skips, so don't do it until the wheel
* settles. Do load if we're transitioning out, though, so we don't miss
* starting the music for the options screen if a song is selected quickly.
Expand All @@ -382,30 +314,6 @@ ScreenSelectMusic::CheckBackgroundRequests(bool bForce)
if (!m_MusicWheel.IsSettled() && !m_MusicWheel.WheelIsLocked() && !bForce)
return;

if (g_bBannerWaiting) {
if (m_Banner.GetTweenTimeLeft() > 0)
return;

RString sPath;
bool bFreeCache = false;
if (TEXTUREMAN->IsTextureRegistered(
Sprite::SongBannerTexture(g_sBannerPath))) {
/* If the file is already loaded into a texture, it's finished,
* and we only do this to honor the HighQualTime value. */
sPath = g_sBannerPath;
} else {
if (!m_BackgroundLoader.IsCacheFileFinished(g_sBannerPath, sPath))
return;
bFreeCache = true;
}

g_bBannerWaiting = false;
m_Banner.Load(sPath, true);

if (bFreeCache)
m_BackgroundLoader.FinishedWithCachedFile(g_sBannerPath);
}

// we need something similar to the previewmusic delay except for charts, so
// heavy duty chart specific operations can be delayed when scrolling (chord
// density graph, possibly chart leaderboards, etc) -mina
Expand Down Expand Up @@ -1137,7 +1045,7 @@ ScreenSelectMusic::HandleMessage(const Message& msg)
}

m_iSelection[pn] = iSel;
Steps* pSteps = m_vpSteps.empty() ? NULL : m_vpSteps[m_iSelection[pn]];
Steps* pSteps = m_vpSteps.empty() ? nullptr : m_vpSteps[m_iSelection[pn]];

GAMESTATE->m_pCurSteps[pn].Set(pSteps);
}
Expand All @@ -1156,7 +1064,7 @@ ScreenSelectMusic::HandleScreenMessage(const ScreenMessage SM)
m_MenuTimer->SetSeconds(ROULETTE_TIMER_SECONDS);
m_MenuTimer->Start();
} else if (DO_ROULETTE_ON_MENU_TIMER &&
m_MusicWheel.GetSelectedSong() == NULL) {
m_MusicWheel.GetSelectedSong() == nullptr) {
m_MenuTimer->SetSeconds(ROULETTE_TIMER_SECONDS);
m_MenuTimer->Start();
} else {
Expand Down Expand Up @@ -1252,7 +1160,7 @@ ScreenSelectMusic::SelectCurrent(PlayerNumber pn)
return false;

// a song was selected
if (m_MusicWheel.GetSelectedSong() != NULL) {
if (m_MusicWheel.GetSelectedSong() != nullptr) {
if (TWO_PART_CONFIRMS_ONLY &&
SAMPLE_MUSIC_PREVIEW_MODE ==
SampleMusicPreviewMode_StartToPreview) {
Expand Down Expand Up @@ -1387,7 +1295,6 @@ ScreenSelectMusic::SelectCurrent(PlayerNumber pn)
/* If we're currently waiting on song assets, abort all except the music
* and start the music, so if we make a choice quickly before background
* requests come through, the music will still start. */
g_bCDTitleWaiting = g_bBannerWaiting = false;
m_BackgroundLoader.Abort();
CheckBackgroundRequests(true);

Expand Down Expand Up @@ -1462,17 +1369,14 @@ ScreenSelectMusic::AfterStepsOrTrailChange(const vector<PlayerNumber>& vpns)
MESSAGEMAN->Broadcast("TwoPartConfirmCanceled");
}

// FOREACH_CONST(PlayerNumber, vpns, p)
//{
// PlayerNumber pn = *p;
PlayerNumber pn = PLAYER_1;
ASSERT(GAMESTATE->IsHumanPlayer(pn));

if (GAMESTATE->m_pCurSong) {
CLAMP(m_iSelection[pn], 0, m_vpSteps.size() - 1);

Song* pSong = GAMESTATE->m_pCurSong;
Steps* pSteps = m_vpSteps.empty() ? NULL : m_vpSteps[m_iSelection[pn]];
Steps* pSteps = m_vpSteps.empty() ? nullptr : m_vpSteps[m_iSelection[pn]];

GAMESTATE->m_pCurSteps[pn].Set(pSteps);
if (pSteps != nullptr)
Expand All @@ -1490,13 +1394,7 @@ ScreenSelectMusic::AfterStepsOrTrailChange(const vector<PlayerNumber>& vpns)
}
delayedchartupdatewaiting = true;
}

m_textHighScore[pn].SetText(ssprintf("%*i", NUM_SCORE_DIGITS, iScore));
} else {
// The numbers shouldn't stay if the current selection is NULL.
m_textHighScore[pn].SetText(NULL_SCORE_STRING);
}
//}
}

void
Expand Down Expand Up @@ -1555,23 +1453,18 @@ ScreenSelectMusic::AfterMusicChange()
GAMESTATE->m_pCurSong.Set(pSong);
if (pSong != nullptr)
GAMESTATE->m_pPreferredSong = pSong;
else
GAMESTATE->m_pCurSteps[PLAYER_1].Set(nullptr); // set steps to null when moving out of packs -mina
GAMESTATE->SetPaused(false); // hacky can see this being problematic
// if we forget about it -mina

m_vpSteps.clear();

m_Banner.SetMovingFast(!!m_MusicWheel.IsMoving());

vector<RString> m_Artists, m_AltArtists;

if (SAMPLE_MUSIC_PREVIEW_MODE != SampleMusicPreviewMode_LastSong) {
m_sSampleMusicToPlay = "";
}
m_pSampleMusicTimingData = NULL;
g_sCDTitlePath = "";
g_sBannerPath = "";
g_bWantFallbackCdTitle = false;
bool bWantBanner = true &&m_Banner.GetVisible();
m_pSampleMusicTimingData = nullptr;

static SortOrder s_lastSortOrder = SortOrder_Invalid;
if (GAMESTATE->m_SortOrder != s_lastSortOrder) {
Expand All @@ -1588,9 +1481,6 @@ ScreenSelectMusic::AfterMusicChange()
case WheelItemDataType_Random:
case WheelItemDataType_Custom:
FOREACH_PlayerNumber(p) m_iSelection[p] = -1;

g_sCDTitlePath = ""; // none

if (SAMPLE_MUSIC_PREVIEW_MODE == SampleMusicPreviewMode_LastSong) {
// HACK: Make random music work in LastSong mode. -aj
if (m_sSampleMusicToPlay == m_sRandomMusicPath) {
Expand All @@ -1606,49 +1496,27 @@ ScreenSelectMusic::AfterMusicChange()
case WheelItemDataType_Section:
// reduce scope
{
SortOrder curSort = GAMESTATE->m_SortOrder;
if (curSort == SORT_GROUP) {
g_sBannerPath = SONGMAN->GetSongGroupBannerPath(
m_MusicWheel.GetSelectedSection());
} else {
bWantBanner = false; // we load it ourself
m_Banner.LoadFromSortOrder(curSort);
}

if (SAMPLE_MUSIC_PREVIEW_MODE !=
SampleMusicPreviewMode_LastSong)
m_sSampleMusicToPlay = m_sSectionMusicPath;
}
break;
case WheelItemDataType_Sort:
bWantBanner = false; // we load it ourself
m_Banner.LoadMode();
if (SAMPLE_MUSIC_PREVIEW_MODE !=
SampleMusicPreviewMode_LastSong)
m_sSampleMusicToPlay = m_sSortMusicPath;
break;
case WheelItemDataType_Roulette:
bWantBanner = false; // we load it ourself
m_Banner.LoadRoulette();
if (SAMPLE_MUSIC_PREVIEW_MODE !=
SampleMusicPreviewMode_LastSong)
m_sSampleMusicToPlay = m_sRouletteMusicPath;
break;
case WheelItemDataType_Random:
bWantBanner = false; // we load it ourself
m_Banner.LoadRandom();
// if( SAMPLE_MUSIC_PREVIEW_MODE !=
// SampleMusicPreviewMode_LastSong )
m_sSampleMusicToPlay = m_sRandomMusicPath;
break;
case WheelItemDataType_Custom: {
bWantBanner = false; // we load it ourself
RString sBannerName =
GetMusicWheel()
->GetCurWheelItemData(
GetMusicWheel()->GetCurrentIndex())
->m_pAction->m_sName.c_str();
m_Banner.LoadCustom(sBannerName);
if (SAMPLE_MUSIC_PREVIEW_MODE !=
SampleMusicPreviewMode_LastSong)
m_sSampleMusicToPlay = m_sSectionMusicPath;
Expand Down Expand Up @@ -1708,48 +1576,16 @@ ScreenSelectMusic::AfterMusicChange()
// nothing.");
}

if (PREFSMAN->m_bShowBanners)
g_sBannerPath = pSong->GetBannerPath();

g_sCDTitlePath = pSong->GetCDTitlePath();
g_bWantFallbackCdTitle = true;

SwitchToPreferredDifficulty();
break;
default:
FAIL_M(ssprintf("Invalid WheelItemDataType: %i", wtype));
}

m_sprCDTitleFront.UnloadTexture();
m_sprCDTitleBack.UnloadTexture();

// Cancel any previous, incomplete requests for song assets,
// since we need new ones.
m_BackgroundLoader.Abort();

g_bCDTitleWaiting = false;
if (!g_sCDTitlePath.empty() || g_bWantFallbackCdTitle) {
if (PREFSMAN->m_verbose_log > 1)
LOG->Trace("cache \"%s\"", g_sCDTitlePath.c_str());
m_BackgroundLoader.CacheFile(g_sCDTitlePath); // empty OK
g_bCDTitleWaiting = true;
}

g_bBannerWaiting = false;
if (bWantBanner) {
if (PREFSMAN->m_verbose_log > 1)
LOG->Trace("LoadFromCachedBanner(%s)", g_sBannerPath.c_str());
if (m_Banner.LoadFromCachedBanner(g_sBannerPath)) {
/* If the high-res banner is already loaded, just delay before
* loading it, so the low-res one has time to fade in. */
if (!TEXTUREMAN->IsTextureRegistered(
Sprite::SongBannerTexture(g_sBannerPath)))
m_BackgroundLoader.CacheFile(g_sBannerPath);

g_bBannerWaiting = true;
}
}

// Don't stop music if it's already playing the right file.
g_bSampleMusicWaiting = false;
if (!m_MusicWheel.IsRouletting() &&
Expand Down Expand Up @@ -1805,7 +1641,7 @@ ScreenSelectMusic::OnConfirmSongDeletion()
// delete the song directory from disk
FILEMAN->DeleteRecursive(deleteDir);

m_pSongAwaitingDeletionConfirmation = NULL;
m_pSongAwaitingDeletionConfirmation = nullptr;
}

bool
Expand Down
4 changes: 0 additions & 4 deletions src/ScreenSelectMusic.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,6 @@ class ScreenSelectMusic : public ScreenWithMenuElements
RString m_sLoopMusicPath;
RString m_sFallbackCDTitlePath;

FadingBanner m_Banner;
Sprite m_sprCDTitleFront, m_sprCDTitleBack;
AutoActor m_sprHighScoreFrame[NUM_PLAYERS];
BitmapText m_textHighScore[NUM_PLAYERS];
MusicWheel m_MusicWheel;
OptionsList m_OptionsList[NUM_PLAYERS];

Expand Down

0 comments on commit e01ab8a

Please sign in to comment.