Skip to content

Commit

Permalink
remove dumb song functions
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Dec 6, 2018
1 parent e6106fe commit 55c65ba
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 549 deletions.
10 changes: 1 addition & 9 deletions src/MusicWheel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1402,11 +1402,6 @@ MusicWheel::SetOpenSection(const RString& group)
continue;
}

// Only show tutorial songs in arcade
if (GAMESTATE->m_PlayMode != PLAY_MODE_REGULAR && d.m_pSong &&
d.m_pSong->IsTutorial())
continue;

m_CurWheelItemData.emplace_back(&d);
}

Expand Down Expand Up @@ -1607,10 +1602,7 @@ MusicWheel::GetPreferredSelectionForRandomOrPortal()
wid[iSelection]->m_sText != sPreferredGroup)
continue;

// There's an off possibility that somebody might have only one song
// with only beginner steps.
if (i < 900 && pSong->IsTutorial())
continue;


FOREACH(Difficulty, vDifficultiesToRequire, d)
{
Expand Down
71 changes: 0 additions & 71 deletions src/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1488,45 +1488,6 @@ Song::GetFileHash()
return m_sFileHash;
}

bool
Song::IsEasy(StepsType st) const
{
/* Very fast songs and songs with wide tempo changes are hard for new
* players, even if they have beginner steps. */
DisplayBpms bpms;
this->GetDisplayBpms(bpms);
if (bpms.GetMax() >= 250 || bpms.GetMax() - bpms.GetMin() >= 75)
return false;

/* The easy marker indicates which songs a beginner, having selected
* "beginner", can play and actually get a very easy song: if there are
* actual beginner steps, or if the light steps are 1- or 2-foot. */
const Steps* pBeginnerNotes =
SongUtil::GetStepsByDifficulty(this, st, Difficulty_Beginner);
if (pBeginnerNotes != nullptr)
return true;

const Steps* pEasyNotes =
SongUtil::GetStepsByDifficulty(this, st, Difficulty_Easy);
if ((pEasyNotes != nullptr) && pEasyNotes->GetMeter() == 1)
return true;

return false;
}

bool
Song::IsTutorial() const
{
// A Song is considered a Tutorial if it has only Beginner steps.
FOREACH_CONST(Steps*, m_vpSteps, s)
{
if ((*s)->GetDifficulty() != Difficulty_Beginner)
return false;
}

return true;
}

bool
Song::HasEdits(StepsType st) const
{
Expand All @@ -1540,13 +1501,6 @@ Song::HasEdits(StepsType st) const

return false;
}

bool
Song::ShowInDemonstrationAndRanking() const
{
return !IsTutorial();
}

// Hack: see Song::TidyUpData comments.
bool
Song::HasMusic() const
Expand Down Expand Up @@ -2202,11 +2156,6 @@ class LunaSong : public Luna<Song>
lua_pushstring(L, p->GetSongFilePath());
return 1;
}
static int IsTutorial(T* p, lua_State* L)
{
lua_pushboolean(L, p->IsTutorial());
return 1;
}
static int IsEnabled(T* p, lua_State* L)
{
lua_pushboolean(L, p->GetEnabled());
Expand Down Expand Up @@ -2374,22 +2323,11 @@ class LunaSong : public Luna<Song>
lua_pushboolean(L, p->HasEdits(st));
return 1;
}
static int IsEasy(T* p, lua_State* L)
{
StepsType st = Enum::Check<StepsType>(L, 1);
lua_pushboolean(L, p->IsEasy(st));
return 1;
}
static int GetStepsSeconds(T* p, lua_State* L)
{
lua_pushnumber(L, p->GetStepsSeconds());
return 1;
}
static int ShowInDemonstrationAndRanking(T* p, lua_State* L)
{
lua_pushboolean(L, p->ShowInDemonstrationAndRanking());
return 1;
}
static int GetFirstSecond(T* p, lua_State* L)
{
lua_pushnumber(L, p->GetFirstSecond());
Expand All @@ -2410,11 +2348,6 @@ class LunaSong : public Luna<Song>
lua_pushnumber(L, p->GetLastBeat());
return 1;
}
static int HasAttacks(T* p, lua_State* L)
{
lua_pushboolean(L, 0);
return 1;
}
static int GetDisplayBpms(T* p, lua_State* L)
{
DisplayBpms temp;
Expand Down Expand Up @@ -2491,7 +2424,6 @@ class LunaSong : public Luna<Song>
ADD_METHOD(GetCDTitlePath);
ADD_METHOD(GetLyricsPath);
ADD_METHOD(GetSongFilePath);
ADD_METHOD(IsTutorial);
ADD_METHOD(IsEnabled);
ADD_METHOD(GetGroupName);
ADD_METHOD(MusicLengthSeconds);
Expand All @@ -2516,20 +2448,17 @@ class LunaSong : public Luna<Song>
ADD_METHOD(HasLyrics);
ADD_METHOD(HasSignificantBPMChangesOrStops);
ADD_METHOD(HasEdits);
ADD_METHOD(IsEasy);
ADD_METHOD(IsFavorited);
ADD_METHOD(GetStepsSeconds);
ADD_METHOD(GetFirstBeat);
ADD_METHOD(GetFirstSecond);
ADD_METHOD(GetLastBeat);
ADD_METHOD(GetLastSecond);
ADD_METHOD(HasAttacks);
ADD_METHOD(GetDisplayBpms);
ADD_METHOD(IsDisplayBpmSecret);
ADD_METHOD(IsDisplayBpmConstant);
ADD_METHOD(IsDisplayBpmRandom);
ADD_METHOD(IsStepsUsingDifferentTiming);
ADD_METHOD(ShowInDemonstrationAndRanking);
ADD_METHOD(HasPreviewVid);
ADD_METHOD(GetPreviewVidPath);
ADD_METHOD(GetPreviewMusicPath);
Expand Down
54 changes: 1 addition & 53 deletions src/Song.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,22 +312,14 @@ class Song

bool HasMusic() const;
bool HasInstrumentTrack(InstrumentTrack it) const;
/**
* @brief Does this song have a banner?
* @return true if it does, false otherwise. */
bool HasBanner() const;
/**
* @brief Does this song have a background image?
* @return true if it does, false otherwise. */
bool HasBackground() const;
bool HasJacket() const;
bool HasCDImage() const;
bool HasDisc() const;
bool HasCDTitle() const;
// bool HasMovieBackground() const;
bool HasBGChanges() const;
bool HasLyrics() const;
bool HasAttacks() const;
bool HasPreviewVid() const;

bool Matches(const RString& sGroup, const RString& sSong) const;
Expand Down Expand Up @@ -390,12 +382,7 @@ class Song
* This must be sorted before gameplay. */
vector<LyricSegment> m_LyricSegments;

/* [splittiming]
void AddBPMSegment( const BPMSegment &seg ) { m_Timing.AddBPMSegment(
seg ); } void AddStopSegment( const StopSegment &seg ) {
m_Timing.AddStopSegment( seg ); } void AddWarpSegment( const WarpSegment
&seg ) { m_Timing.AddWarpSegment( seg ); }
*/

void AddBackgroundChange(BackgroundLayer blLayer, BackgroundChange seg);
void AddForegroundChange(BackgroundChange seg);
void AddLyricSegment(LyricSegment seg);
Expand All @@ -404,47 +391,12 @@ class Song
const BackgroundChange& GetBackgroundAtBeat(BackgroundLayer iLayer,
float fBeat) const;

/* [splittiming]
float GetBPMAtBeat( float fBeat ) const { return m_Timing.GetBPMAtBeat(
fBeat ); } void SetBPMAtBeat( float fBeat, float fBPM ) {
m_Timing.SetBPMAtBeat( fBeat, fBPM ); } BPMSegment& GetBPMSegmentAtBeat(
float fBeat ) { return m_Timing.GetBPMSegmentAtBeat( fBeat ); }
*/

Steps* CreateSteps();
void InitSteps(Steps* pSteps);

RString GetOrTryAtLeastToGetSimfileAuthor();

/* [splittiming]
float SongGetBeatFromElapsedTime( float fElapsedTime ) const
{
return m_SongTiming.GetBeatFromElapsedTime( fElapsedTime );
}
float StepsGetBeatFromElapsedTime( float fElapsedTime, const Steps &steps )
const
{
return steps.m_Timing.GetBeatFromElapsedTime( fElapsedTime );
}
float SongGetElapsedTimeFromBeat( float fBeat ) const
{
return m_SongTiming.GetElapsedTimeFromBeat( fBeat );
}
float StepsGetElapsedTimeFromBeat( float fBeat, const Steps &steps ) const
{
return steps.m_Timing.GetElapsedTimeFromBeat( fBeat );
}
*/

/* [splittiming]
float GetBeatFromElapsedTime( float fElapsedTime ) const
{
return m_Timing.GetBeatFromElapsedTime( fElapsedTime );
}
float GetElapsedTimeFromBeat( float fBeat ) const { return
m_Timing.GetElapsedTimeFromBeat( fBeat ); }
*/

bool HasSignificantBpmChangesOrStops() const;
float GetStepsSeconds() const;
Expand All @@ -466,8 +418,6 @@ class Song
{
return m_vpStepsByType[st];
}
bool IsEasy(StepsType st) const;
bool IsTutorial() const;
bool HasEdits(StepsType st) const;

bool IsFavorited() { return isfavorited; }
Expand All @@ -480,8 +430,6 @@ class Song
void SetEnabled(bool b) { m_bEnabled = b; }
bool GetEnabled() const { return m_bEnabled; }

bool ShowInDemonstrationAndRanking() const;

/**
* @brief Add the chosen Steps to the Song.
* We are responsible for deleting the memory pointed to by pSteps!
Expand Down
2 changes: 0 additions & 2 deletions src/SongManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1383,8 +1383,6 @@ SongManager::GetRandomSong()
i++;
wrap(i, m_pShuffledSongs.size());
Song* pSong = m_pShuffledSongs[i];
if (pSong->IsTutorial())
continue;
return pSong;
}

Expand Down
Loading

0 comments on commit 55c65ba

Please sign in to comment.