Skip to content

Commit

Permalink
kill machine profile/unlockmanager
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed May 5, 2017
1 parent 3f32e4d commit f87046d
Show file tree
Hide file tree
Showing 48 changed files with 60 additions and 2,802 deletions.
39 changes: 0 additions & 39 deletions src/Banner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "ThemeMetric.h"
#include "CharacterManager.h"
#include "ActorUtil.h"
#include "UnlockManager.h"
#include "PrefsManager.h"

REGISTER_ACTOR_CLASS( Banner );
Expand Down Expand Up @@ -147,30 +146,6 @@ void Banner::LoadIconFromCharacter( const Character *pCharacter )
m_bScrolling = false;
}

void Banner::LoadBannerFromUnlockEntry( const UnlockEntry* pUE )
{
if( pUE == NULL )
LoadFallback();
else
{
RString sFile = pUE->GetBannerFile();
Load( sFile );
m_bScrolling = false;
}
}

void Banner::LoadBackgroundFromUnlockEntry( const UnlockEntry* pUE )
{
if( pUE == NULL )
LoadFallback();
else
{
RString sFile = pUE->GetBackgroundFile();
Load( sFile );
m_bScrolling = false;
}
}

void Banner::LoadFallback()
{
Load( THEME->GetPathG("Common","fallback banner") );
Expand Down Expand Up @@ -254,18 +229,6 @@ class LunaBanner: public Luna<Banner>
else { Character *pC = Luna<Character>::check(L,1); p->LoadIconFromCharacter( pC ); }
COMMON_RETURN_SELF;
}
static int LoadBannerFromUnlockEntry( T* p, lua_State *L )
{
if( lua_isnil(L,1) ) { p->LoadBannerFromUnlockEntry( NULL ); }
else { UnlockEntry *pUE = Luna<UnlockEntry>::check(L,1); p->LoadBannerFromUnlockEntry( pUE ); }
COMMON_RETURN_SELF;
}
static int LoadBackgroundFromUnlockEntry( T* p, lua_State *L )
{
if( lua_isnil(L,1) ) { p->LoadBackgroundFromUnlockEntry( NULL ); }
else { UnlockEntry *pUE = Luna<UnlockEntry>::check(L,1); p->LoadBackgroundFromUnlockEntry( pUE ); }
COMMON_RETURN_SELF;
}
static int LoadFromSongGroup( T* p, lua_State *L )
{
p->LoadFromSongGroup( SArg(1) );
Expand Down Expand Up @@ -293,8 +256,6 @@ class LunaBanner: public Luna<Banner>
ADD_METHOD( LoadFromCachedBanner );
ADD_METHOD( LoadIconFromCharacter );
ADD_METHOD( LoadCardFromCharacter );
ADD_METHOD( LoadBannerFromUnlockEntry );
ADD_METHOD( LoadBackgroundFromUnlockEntry );
ADD_METHOD( LoadFromSongGroup );
ADD_METHOD( LoadFromSortOrder );
ADD_METHOD( GetScrolling );
Expand Down
3 changes: 0 additions & 3 deletions src/Banner.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "GameConstantsAndTypes.h"
class Song;
class Character;
class UnlockEntry;

/** @brief The characteristics of a Banner */
class Banner : public Sprite
Expand All @@ -33,8 +32,6 @@ class Banner : public Sprite
void LoadFromSongGroup( const RString &sSongGroup );
void LoadCardFromCharacter( const Character *pCharacter );
void LoadIconFromCharacter( const Character *pCharacter );
void LoadBannerFromUnlockEntry( const UnlockEntry* pUE );
void LoadBackgroundFromUnlockEntry( const UnlockEntry* pUE );
void LoadRoulette();
void LoadRandom();
void LoadFromSortOrder( SortOrder so );
Expand Down
6 changes: 0 additions & 6 deletions src/FadingBanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,6 @@ void FadingBanner::LoadIconFromCharacter( Character* pCharacter )
m_Banner[m_iIndexLatest].LoadIconFromCharacter( pCharacter );
}

void FadingBanner::LoadBannerFromUnlockEntry( const UnlockEntry* pUE )
{
BeforeChange();
m_Banner[m_iIndexLatest].LoadBannerFromUnlockEntry( pUE );
}

void FadingBanner::LoadRoulette()
{
BeforeChange();
Expand Down
1 change: 0 additions & 1 deletion src/FadingBanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class FadingBanner : public ActorFrame
void LoadMode();
void LoadFromSongGroup( const RString &sSongGroup );
void LoadIconFromCharacter( Character* pCharacter );
void LoadBannerFromUnlockEntry( const UnlockEntry* pUE );
void LoadRoulette();
void LoadRandom();
void LoadFromSortOrder( SortOrder so );
Expand Down
22 changes: 0 additions & 22 deletions src/GameCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "PlayerState.h"
#include "SongManager.h"
#include "Song.h"
#include "UnlockManager.h"
#include "LocalizedString.h"
#include "arch/ArchHooks/ArchHooks.h"
#include "ScreenPrompt.h"
Expand Down Expand Up @@ -549,27 +548,6 @@ bool GameCommand::IsPlayable( RString *why ) const
return false;
}
}

if( !m_sPreferredModifiers.empty() )
{
// TODO: Split this and check each modifier individually
if( UNLOCKMAN->ModifierIsLocked(m_sPreferredModifiers) )
{ if( why )
*why = "Modifier is locked";
return false;
}
}

if( !m_sStageModifiers.empty() )
{
// TODO: Split this and check each modifier individually
if( UNLOCKMAN->ModifierIsLocked(m_sStageModifiers) )
{ if( why )
*why = "Modifier is locked";
return false;
}
}

return true;
}

Expand Down
1 change: 0 additions & 1 deletion src/GameConstantsAndTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ LuaXType( TapNoteScoreJudgeType );
static const char *ProfileSlotNames[] = {
"Player1",
"Player2",
"Machine",
};
XToString( ProfileSlot );
LuaXType( ProfileSlot );
Expand Down
1 change: 0 additions & 1 deletion src/GameConstantsAndTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ enum ProfileSlot
{
ProfileSlot_Player1,
ProfileSlot_Player2,
ProfileSlot_Machine,
NUM_ProfileSlot,
ProfileSlot_Invalid
};
Expand Down
79 changes: 0 additions & 79 deletions src/GameState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include "Steps.h"
#include "Style.h"
#include "ThemeManager.h"
#include "UnlockManager.h"
#include "ScreenManager.h"
#include "Screen.h"

Expand Down Expand Up @@ -392,12 +391,6 @@ void GameState::JoinPlayer( PlayerNumber pn )
if( GetNumSidesJoined() == 1 )
BeginGame();

// Count each player join as a play.
{
Profile* pMachineProfile = PROFILEMAN->GetMachineProfile();
pMachineProfile->m_iTotalSessions++;
}

// Set the current style to something appropriate for the new number of joined players.
// beat gametype's versus styles use a different stepstype from its single
// styles, so when GameCommand tries to join both players for a versus
Expand Down Expand Up @@ -653,7 +646,6 @@ bool GameState::HaveProfileToSave()
void GameState::SaveLocalData()
{
BOOKKEEPER->WriteToDisk();
PROFILEMAN->SaveMachineProfile();
}

int GameState::GetNumStagesMultiplierForSong( const Song* pSong )
Expand Down Expand Up @@ -758,9 +750,6 @@ void GameState::CommitStageStats()
// Update TotalPlaySeconds.
int iPlaySeconds = max( 0, (int) m_timeGameStarted.GetDeltaTime() );

Profile* pMachineProfile = PROFILEMAN->GetMachineProfile();
pMachineProfile->m_iTotalSessionSeconds += iPlaySeconds;

FOREACH_HumanPlayer( p )
{
Profile* pPlayerProfile = PROFILEMAN->GetProfile( p );
Expand Down Expand Up @@ -814,7 +803,6 @@ void GameState::FinishStage()
if( iOldStageIndex/iSaveProfileEvery < m_iCurrentStageIndex/iSaveProfileEvery )
{
LOG->Trace( "Played %i stages; saving profiles ...", iSaveProfileEvery );
PROFILEMAN->SaveMachineProfile();
this->SavePlayerProfiles();
}
}
Expand Down Expand Up @@ -1842,33 +1830,6 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
Song* pSong = vSongAndSteps[i].pSong;
Steps* pSteps = vSongAndSteps[i].pSteps;

// Find Machine Records
{
HighScoreList &hsl = PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSong,pSteps);
for( unsigned j=0; j<hsl.vHighScores.size(); j++ )
{
HighScore &hs = hsl.vHighScores[j];

if( hs.GetName() != RANKING_TO_FILL_IN_MARKER[pn] )
continue;

RankingFeat feat;
feat.Type = RankingFeat::SONG;
feat.pSong = pSong;
feat.pSteps = pSteps;
feat.Feat = ssprintf("MR #%d in %s %s", j+1, pSong->GetTranslitMainTitle().c_str(), DifficultyToString(pSteps->GetDifficulty()).c_str() );
feat.pStringToFill = hs.GetNameMutable();
feat.grade = hs.GetGrade();
feat.fPercentDP = hs.GetPercentDP();
feat.iScore = hs.GetScore();

if( pSong->HasBanner() )
feat.Banner = pSong->GetBannerPath();

asFeatsOut.push_back( feat );
}
}

// Find Personal Records
if( pProf && PROFILE_RECORD_FEATS )
{
Expand Down Expand Up @@ -1906,30 +1867,6 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
StageStats stats;
STATSMAN->GetFinalEvalStageStats( stats );


// Find Machine Category Records
FOREACH_ENUM( RankingCategory, rc )
{
if( !CATEGORY_RECORD_FEATS )
continue;
HighScoreList &hsl = PROFILEMAN->GetMachineProfile()->GetCategoryHighScoreList( st, rc );
for( unsigned j=0; j<hsl.vHighScores.size(); j++ )
{
HighScore &hs = hsl.vHighScores[j];
if( hs.GetName() != RANKING_TO_FILL_IN_MARKER[pn] )
continue;

RankingFeat feat;
feat.Type = RankingFeat::CATEGORY;
feat.Feat = ssprintf("MR #%d in Type %c (%d)", j+1, 'A'+rc, stats.GetAverageMeter(pn) );
feat.pStringToFill = hs.GetNameMutable();
feat.grade = Grade_NoData;
feat.iScore = hs.GetScore();
feat.fPercentDP = hs.GetPercentDP();
asFeatsOut.push_back( feat );
}
}

// Find Personal Category Records
FOREACH_ENUM( RankingCategory, rc )
{
Expand Down Expand Up @@ -2016,22 +1953,6 @@ void GameState::StoreRankingName( PlayerNumber pn, RString sName )
// save name pointers as we fill them
m_vpsNamesThatWereFilled.push_back( aFeats[i].pStringToFill );
}


Profile *pProfile = PROFILEMAN->GetMachineProfile();

if( !PREFSMAN->m_bAllowMultipleHighScoreWithSameName )
{
// erase all but the highest score for each name
FOREACHM( SongID, Profile::HighScoresForASong, pProfile->m_SongHighScores, iter )
FOREACHM( StepsID, Profile::HighScoresForASteps, iter->second.m_StepsHighScores, iter2 )
iter2->second.hsl.RemoveAllButOneOfEachName();
}

// clamp high score sizes
FOREACHM( SongID, Profile::HighScoresForASong, pProfile->m_SongHighScores, iter )
FOREACHM( StepsID, Profile::HighScoresForASteps, iter->second.m_StepsHighScores, iter2 )
iter2->second.hsl.ClampSize( true );
}

bool GameState::AllAreInDangerOrWorse() const
Expand Down
54 changes: 1 addition & 53 deletions src/MusicWheel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "NetworkSyncManager.h"
#include "Song.h"
#include "Steps.h"
#include "UnlockManager.h"
#include "GameCommand.h"
#include "ActorUtil.h"
#include "SongUtil.h"
Expand Down Expand Up @@ -408,25 +407,6 @@ void MusicWheel::GetSongList( vector<Song*> &arraySongs, SortOrder so )
{
Song* pSong = apAllSongs[i];

int iLocked = UNLOCKMAN->SongIsLocked( pSong );
if( iLocked & LOCKED_DISABLED )
continue;

// If we're on an extra stage, and this song is selected, ignore #SELECTABLE.
if( pSong != GAMESTATE->m_pCurSong || !GAMESTATE->IsAnExtraStage() )
{
// Hide songs that asked to be hidden via #SELECTABLE.
if( iLocked & LOCKED_SELECTABLE )
continue;
if( so != SORT_ROULETTE && iLocked & LOCKED_ROULETTE )
continue;
}

/* Hide locked songs. If RANDOM_PICKS_LOCKED_SONGS, hide in Roulette
* and Random, too. */
if( (so!=SORT_ROULETTE || !RANDOM_PICKS_LOCKED_SONGS) && iLocked )
continue;

if( PREFSMAN->m_bOnlyPreferredDifficulties )
{
// if the song has steps that fit the preferred difficulty of the default player
Expand Down Expand Up @@ -737,8 +717,7 @@ void MusicWheel::BuildWheelItemDatas( vector<MusicWheelItemData *> &arrayWheelIt
SongUtil::SortSongPointerArrayByGenre( arraySongs );
break;
case SORT_RECENT:
SongUtil::SortByMostRecentlyPlayedForMachine( arraySongs );
if( (int) arraySongs.size() > RECENT_SONGS_TO_SHOW )
if( static_cast<int>(arraySongs.size()) > RECENT_SONGS_TO_SHOW )
arraySongs.erase( arraySongs.begin()+RECENT_SONGS_TO_SHOW, arraySongs.end() );
bUseSections = false;
break;
Expand Down Expand Up @@ -988,37 +967,6 @@ void MusicWheel::FilterWheelItemDatas(vector<MusicWheelItemData *> &aUnFilteredD
continue;
}

int iLocked = UNLOCKMAN->SongIsLocked( pSong );
if( iLocked & LOCKED_DISABLED )
{
aiRemove[i] = true;
continue;
}

/* If we're on an extra stage, and this song is selected, ignore #SELECTABLE. */
if( pSong != GAMESTATE->m_pCurSong || !GAMESTATE->IsAnExtraStage() )
{
/* Hide songs that asked to be hidden via #SELECTABLE. */
if( iLocked & LOCKED_SELECTABLE )
{
aiRemove[i] = true;
continue;
}
if( so != SORT_ROULETTE && iLocked & LOCKED_ROULETTE )
{
aiRemove[i] = true;
continue;
}
}

/* Hide locked songs. If RANDOM_PICKS_LOCKED_SONGS, hide in Roulette and Random,
* too. */
if( (so!=SORT_ROULETTE || !RANDOM_PICKS_LOCKED_SONGS) && iLocked )
{
aiRemove[i] = true;
continue;
}

/* If the song has no steps for the current style, remove it. */
if( !CommonMetrics::AUTO_SET_STYLE && !pSong->HasStepsType(GAMESTATE->GetCurrentStyle(PLAYER_INVALID)->m_StepsType) )
{
Expand Down
2 changes: 0 additions & 2 deletions src/MusicWheelItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,6 @@ void MusicWheelItem::RefreshGrades()
ProfileSlot ps;
if( PROFILEMAN->IsPersistentProfile(p) )
ps = (ProfileSlot)p;
else if( GRADES_SHOW_MACHINE )
ps = ProfileSlot_Machine;
else
continue;

Expand Down
Loading

0 comments on commit f87046d

Please sign in to comment.