From 6ad869d32aacca09c81da43b4293ef637363cf43 Mon Sep 17 00:00:00 2001 From: MinaciousGrace Date: Thu, 4 May 2017 22:11:27 -0400 Subject: [PATCH] kill autogen --- src/GameState.cpp | 29 +------ src/GameState.h | 9 --- src/NoteDataUtil.cpp | 163 ---------------------------------------- src/NoteDataUtil.h | 5 -- src/NotesWriterDWI.cpp | 2 - src/NotesWriterJson.cpp | 2 - src/ScreenEdit.cpp | 3 - src/ScreenEditMenu.cpp | 6 -- src/ScreenHowToPlay.cpp | 1 - src/ScreenJukebox.cpp | 2 - src/Song.cpp | 117 +--------------------------- src/Song.h | 9 --- src/SongManager.cpp | 6 -- src/SongUtil.cpp | 4 - src/Steps.cpp | 86 +-------------------- src/Steps.h | 30 +++----- src/StepsDisplay.cpp | 17 ----- src/StepsDisplay.h | 2 - src/StepsUtil.cpp | 2 - 19 files changed, 12 insertions(+), 483 deletions(-) diff --git a/src/GameState.cpp b/src/GameState.cpp index 80c1661c33..f0f31a951c 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -2811,33 +2811,8 @@ class LunaGameState: public Luna return 0; } - static int GetAutoGenFarg(T* p, lua_State *L) - { - int i= IArg(1) - 1; - if(i < 0) { lua_pushnil(L); return 1; } - size_t si= static_cast(i); - if(si >= p->m_autogen_fargs.size()) { lua_pushnil(L); return 1; } - lua_pushnumber(L, p->GetAutoGenFarg(si)); - return 1; - } - static int SetAutoGenFarg(T* p, lua_State* L) - { - int i= IArg(1) - 1; - if(i < 0) - { - luaL_error(L, "%i is not a valid autogen arg index.", i); - } - float v= FArg(2); - size_t si= static_cast(i); - while(si >= p->m_autogen_fargs.size()) - { - p->m_autogen_fargs.push_back(0.0f); - } - p->m_autogen_fargs[si]= v; - COMMON_RETURN_SELF; - } - static int IsCourseMode(T* p, lua_State* L) { + static int IsCourseMode(T* p, lua_State* L) { // course mode is dead but leave this here for now -mina lua_pushboolean(L, false); return 1; } @@ -2952,8 +2927,6 @@ class LunaGameState: public Luna ADD_METHOD( SetCurrentStyle ); ADD_METHOD( SetCurrentPlayMode ); ADD_METHOD( SetStepsForEditMode ); - ADD_METHOD( GetAutoGenFarg ); - ADD_METHOD( SetAutoGenFarg ); ADD_METHOD( IsCourseMode ); ADD_METHOD( GetEtternaVersion ); ADD_METHOD( CountNotesSeparately ); diff --git a/src/GameState.h b/src/GameState.h index 56010dc9d0..253f989096 100644 --- a/src/GameState.h +++ b/src/GameState.h @@ -387,15 +387,6 @@ class GameState bool m_bDopefish; - // Autogen stuff. This should probably be moved to its own singleton or - // something when autogen is generalized and more customizable. -Kyz - float GetAutoGenFarg(size_t i) - { - if(i >= m_autogen_fargs.size()) { return 0.0f; } - return m_autogen_fargs[i]; - } - vector m_autogen_fargs; - // Lua void PushSelf( lua_State *L ); diff --git a/src/NoteDataUtil.cpp b/src/NoteDataUtil.cpp index f11c4d66d2..60f7340cd7 100644 --- a/src/NoteDataUtil.cpp +++ b/src/NoteDataUtil.cpp @@ -795,169 +795,6 @@ enum kickbox_limb { left_foot, left_fist, right_fist, right_foot, num_kickbox_limbs, invalid_limb= -1 }; -void NoteDataUtil::AutogenKickbox(const NoteData& in, NoteData& out, const TimingData& timing, StepsType out_type, int nonrandom_seed) -{ - // Each limb has its own list of tracks it is used for. This allows - // abstract handling of the different styles. - // By convention, the lower panels are pushed first. This gives the upper - // panels a higher index, which is mnemonically useful. - vector > limb_tracks(num_kickbox_limbs); - bool have_feet= true; - switch(out_type) - { - case StepsType_kickbox_human: - out.SetNumTracks(4); - limb_tracks[left_foot].push_back(0); - limb_tracks[left_fist].push_back(1); - limb_tracks[right_fist].push_back(2); - limb_tracks[right_foot].push_back(3); - break; - case StepsType_kickbox_quadarm: - out.SetNumTracks(4); - have_feet= false; - limb_tracks[left_fist].push_back(1); - limb_tracks[left_fist].push_back(0); - limb_tracks[right_fist].push_back(2); - limb_tracks[right_fist].push_back(3); - break; - case StepsType_kickbox_insect: - out.SetNumTracks(6); - limb_tracks[left_foot].push_back(0); - limb_tracks[left_fist].push_back(2); - limb_tracks[left_fist].push_back(1); - limb_tracks[right_fist].push_back(3); - limb_tracks[right_fist].push_back(4); - limb_tracks[right_foot].push_back(5); - break; - case StepsType_kickbox_arachnid: - out.SetNumTracks(8); - limb_tracks[left_foot].push_back(0); - limb_tracks[left_foot].push_back(1); - limb_tracks[left_fist].push_back(3); - limb_tracks[left_fist].push_back(2); - limb_tracks[right_fist].push_back(4); - limb_tracks[right_fist].push_back(5); - limb_tracks[right_foot].push_back(7); - limb_tracks[right_foot].push_back(6); - break; - DEFAULT_FAIL(out_type); - } - // prev_limb_panels keeps track of which panel in the track list the limb - // hit last. - vector prev_limb_panels(num_kickbox_limbs, 0); - vector panel_repeat_counts(num_kickbox_limbs, 0); - vector panel_repeat_goals(num_kickbox_limbs, 0); - RandomGen rnd(nonrandom_seed); - kickbox_limb prev_limb_used= invalid_limb; - // Kicks are only allowed if there is enough setup/recovery time. - float kick_recover_time= GAMESTATE->GetAutoGenFarg(0); - if(kick_recover_time <= 0.0f) - { - kick_recover_time= .25f; - } - float prev_note_time= -1.0f; - int rows_done= 0; -#define RAND_FIST ((rnd() % 2) ? left_fist : right_fist) -#define RAND_FOOT ((rnd() % 2) ? left_foot : right_foot) - FOREACH_NONEMPTY_ROW_ALL_TRACKS(in, r) - { - // Arbitrary: Drop everything except taps and hold heads out entirely, - // convert holds to tap just the head. - bool has_valid_tapnote= false; - for(int t= 0; t < in.GetNumTracks(); ++t) - { - const TapNote& tn= in.GetTapNote(t, r); - if(tn.type == TapNoteType_Tap || tn.type == TapNoteType_HoldHead) - { - has_valid_tapnote= true; - break; - } - } - if(!has_valid_tapnote) { continue; } - int next_row= r; - bool next_has_valid= false; - while(!next_has_valid) - { - if(!in.GetNextTapNoteRowForAllTracks(next_row)) - { - next_row= -1; - next_has_valid= true; - } - else - { - for(int t= 0; t < in.GetNumTracks(); ++t) - { - const TapNote& tn= in.GetTapNote(t, next_row); - if(tn.type == TapNoteType_Tap || tn.type == TapNoteType_HoldHead) - { - next_has_valid= true; - break; - } - } - } - } - float this_note_time= timing.GetElapsedTimeFromBeat(NoteRowToBeat(r)); - float next_note_time= timing.GetElapsedTimeFromBeat(NoteRowToBeat(next_row)); - kickbox_limb this_limb= invalid_limb; - switch(prev_limb_used) - { - case invalid_limb: - // First limb is arbitrarily always a fist. - this_limb= RAND_FIST; - break; - case left_foot: - case right_foot: - // Multiple kicks in a row are allowed if they're on the same foot. - // Allow the last note to be a kick. - // Switch feet if there's enough time. - if(next_note_time - this_note_time > kick_recover_time * 2.0f) - { - this_limb= prev_limb_used == left_foot ? right_foot : left_foot; - } - else if((next_note_time - this_note_time > kick_recover_time * .5f || - next_note_time < 0.0f) && (rnd() % 2)) - { - this_limb= prev_limb_used; - } - else - { - this_limb= RAND_FIST; - } - break; - case left_fist: - case right_fist: - if(this_note_time - prev_note_time > kick_recover_time && - (next_note_time - this_note_time > kick_recover_time || - next_note_time < 0.0f) && have_feet) - { - this_limb= RAND_FOOT; - } - else - { - // Alternate fists. - this_limb= prev_limb_used == left_fist ? right_fist : left_fist; - } - break; - default: - break; - } - size_t this_panel= prev_limb_panels[this_limb]; - if(panel_repeat_counts[this_limb] + 1 > panel_repeat_goals[this_limb]) - { - // Use a different panel. - this_panel= (this_panel + 1) % limb_tracks[this_limb].size(); - panel_repeat_counts[this_limb]= 0; - panel_repeat_goals[this_limb]= (rnd() % 8) + 1; - } - out.SetTapNote(limb_tracks[this_limb][this_panel], r, TAP_ORIGINAL_TAP); - ++panel_repeat_counts[this_limb]; - prev_limb_panels[this_limb]= this_panel; - prev_note_time= this_note_time; - prev_limb_used= this_limb; - ++rows_done; - } - out.RevalidateATIs(vector(), false); -} struct recent_note { diff --git a/src/NoteDataUtil.h b/src/NoteDataUtil.h index c88a377d8f..0052fa3b68 100644 --- a/src/NoteDataUtil.h +++ b/src/NoteDataUtil.h @@ -49,11 +49,6 @@ namespace NoteDataUtil void LoadTransformedLightsFromTwo( const NoteData &marquee, const NoteData &bass, NoteData &out ); void InsertHoldTails( NoteData &inout ); - // Special case so that kickbox can have autogen steps that are playable. - // Hopefully I'll replace this with a good generalized autogen system - // later. -Kyz - void AutogenKickbox(const NoteData& in, NoteData& out, const TimingData& timing, StepsType out_type, int nonrandom_seed); - void CalculateRadarValues( const NoteData &in, float fSongSeconds, RadarValues& out ); /** diff --git a/src/NotesWriterDWI.cpp b/src/NotesWriterDWI.cpp index 3206f898dd..610b132dfc 100644 --- a/src/NotesWriterDWI.cpp +++ b/src/NotesWriterDWI.cpp @@ -417,8 +417,6 @@ bool NotesWriterDWI::Write( const RString &sPath, const Song &out ) for( unsigned i=0; iIsAutogen() ) - continue; // don't save autogen notes if( !WriteDWINotesTag( f, *pSteps )) continue; diff --git a/src/NotesWriterJson.cpp b/src/NotesWriterJson.cpp index 3d0068370d..c0b748d48d 100644 --- a/src/NotesWriterJson.cpp +++ b/src/NotesWriterJson.cpp @@ -185,8 +185,6 @@ bool NotesWriterJson::WriteSong( const RString &sFile, const Song &out, bool bWr vector vpSteps; FOREACH_CONST( Steps*, out.GetAllSteps(), iter ) { - if( (*iter)->IsAutogen() ) - continue; vpSteps.push_back( *iter ); } JsonUtil::SerializeVectorPointers( vpSteps, Serialize, root["Charts"] ); diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index c5a1e3b4c7..5898699c99 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -4108,9 +4108,6 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM ) // If we're not on the same style, let it go. if( GAMESTATE->m_pCurSteps[PLAYER_1]->m_StepsType != (*s)->m_StepsType ) continue; - // If autogenned, it isn't being saved. - if( (*s)->IsAutogen() ) - continue; // If the notedata has content, let it go. if( !(*s)->GetNoteData().IsEmpty() ) continue; diff --git a/src/ScreenEditMenu.cpp b/src/ScreenEditMenu.cpp index af5527b536..41bbd5f089 100644 --- a/src/ScreenEditMenu.cpp +++ b/src/ScreenEditMenu.cpp @@ -252,12 +252,6 @@ bool ScreenEditMenu::MenuStart( const InputEventPlus & ) case EditMenuAction_Delete: { ASSERT( pSteps != NULL ); - if( pSteps->IsAutogen() ) - { - SCREENMAN->PlayInvalidSound(); - SCREENMAN->SystemMessage( DELETED_AUTOGEN_STEPS.GetValue() ); - return true; - } } default: break; } diff --git a/src/ScreenHowToPlay.cpp b/src/ScreenHowToPlay.cpp index aa9a1c9ace..672a310cef 100644 --- a/src/ScreenHowToPlay.cpp +++ b/src/ScreenHowToPlay.cpp @@ -144,7 +144,6 @@ void ScreenHowToPlay::Init() loaderSSC.LoadFromSimfile( sStepsPath, m_Song, false ); else loaderSM.LoadFromSimfile( sStepsPath, m_Song, false ); - m_Song.AddAutoGenNotes(); const Style* pStyle = GAMESTATE->GetCurrentStyle(PLAYER_INVALID); diff --git a/src/ScreenJukebox.cpp b/src/ScreenJukebox.cpp index 7900c2d014..d52a7d0250 100644 --- a/src/ScreenJukebox.cpp +++ b/src/ScreenJukebox.cpp @@ -77,8 +77,6 @@ void ScreenJukebox::SetSong() if( pSteps == NULL ) continue; // skip - if( !PREFSMAN->m_bAutogenSteps && pSteps->IsAutogen()) - continue; // skip // Found something we can use! GAMESTATE->m_pCurSong.Set( pSong ); diff --git a/src/Song.cpp b/src/Song.cpp index 600d45d0e3..7195e7f7d3 100644 --- a/src/Song.cpp +++ b/src/Song.cpp @@ -430,13 +430,11 @@ bool Song::ReloadFromSongDir( const RString &sDir ) // of loading from the cache. -Kyz FILEMAN->Remove(GetCacheFilePath()); - RemoveAutoGenNotes(); vector vOldSteps = m_vpSteps; Song copy; if( !copy.LoadFromSongDir( sDir ) ) return false; - copy.RemoveAutoGenNotes(); *this = copy; /* Go through the steps, first setting their Song pointer to this song @@ -490,7 +488,6 @@ bool Song::ReloadFromSongDir( const RString &sDir ) AddSteps( NewSteps ); } - AddAutoGenNotes(); // Reload any images associated with the song. -Kyz vector to_reload; to_reload.reserve(7); @@ -1115,8 +1112,7 @@ void Song::ReCalculateRadarValuesAndLastSecond(bool fromCache, bool duringCache) * 2. Don't calculate with edits unless the song only contains an edit * chart, like those in Mungyodance 3. Otherwise, edits installed on * the machine could extend the length of the song. */ - if( !pSteps->IsAutogen() && - !( pSteps->IsAnEdit() && m_vpSteps.size() > 1 ) ) + if( !( pSteps->IsAnEdit() && m_vpSteps.size() > 1 ) ) { // Don't set first/last beat based on lights. They often start very // early and end very late. @@ -1224,8 +1220,6 @@ bool Song::SaveToSMFile() FOREACH_CONST( Steps*, m_vpSteps, s ) { Steps *pSteps = *s; - if( pSteps->IsAutogen() ) - continue; // don't write autogen notes // Only save steps that weren't loaded from a profile. if( pSteps->WasLoadedFromProfile() ) @@ -1262,8 +1256,6 @@ bool Song::SaveToSSCFile( const RString &sPath, bool bSavingCache, bool autosave FOREACH_CONST( Steps*, m_vpSteps, s ) { Steps *pSteps = *s; - if( pSteps->IsAutogen() ) - continue; // don't write autogen notes // Only save steps that weren't loaded from a profile. if( pSteps->WasLoadedFromProfile() ) @@ -1353,72 +1345,11 @@ void Song::RemoveAutosave() // Change all the steps to point to the actual file, not the autosave // file. -Kyz RString extension= GetExtension(m_sSongFileName); - for(size_t i= 0; i < m_vpSteps.size(); ++i) - { - if(!m_vpSteps[i]->IsAutogen()) - { - m_vpSteps[i]->SetFilename( - SetExtension(m_vpSteps[i]->GetFilename(), extension)); - } - } FILEMAN->Remove(autosave_path); m_loaded_from_autosave= false; } } -void Song::AddAutoGenNotes() -{ - bool HasNotes[NUM_StepsType]; - memset( HasNotes, 0, sizeof(HasNotes) ); - for( unsigned i=0; i < m_vpSteps.size(); i++ ) // foreach Steps - { - if( m_vpSteps[i]->IsAutogen() ) - continue; - - StepsType st = m_vpSteps[i]->m_StepsType; - HasNotes[st] = true; - } - - FOREACH_ENUM( StepsType, stMissing ) - { - if( HasNotes[stMissing] ) - continue; - - // Only autogen what the player wants - if ( !(PREFSMAN->m_bAutogenLights && stMissing == StepsType_lights_cabinet) ) - continue; - if( !(PREFSMAN->m_bAutogenSteps && stMissing != StepsType_lights_cabinet) ) - continue; - if( !GAMEMAN->GetStepsTypeInfo(stMissing).bAllowAutogen ) - continue; - - // missing Steps of this type - int iNumTracksOfMissing = GAMEMAN->GetStepsTypeInfo(stMissing).iNumTracks; - - // look for closest match - StepsType stBestMatch = StepsType_Invalid; - int iBestTrackDifference = INT_MAX; - - FOREACH_ENUM( StepsType, st ) - { - if( !HasNotes[st] ) - continue; - - // has (non-autogen) Steps of this type - const int iNumTracks = GAMEMAN->GetStepsTypeInfo(st).iNumTracks; - const int iTrackDifference = abs(iNumTracks-iNumTracksOfMissing); - if( iTrackDifference < iBestTrackDifference ) - { - stBestMatch = st; - iBestTrackDifference = iTrackDifference; - } - } - - if( stBestMatch != StepsType_Invalid ) - AutoGen( stMissing, stBestMatch ); - } -} - RString Song::GetFileHash() { if (m_sFileHash.empty()) { @@ -1444,45 +1375,6 @@ RString Song::GetFileHash() } return m_sFileHash; } -void Song::AutoGen( StepsType ntTo, StepsType ntFrom ) -{ - // int iNumTracksOfTo = GAMEMAN->StepsTypeToNumTracks(ntTo); - - for( unsigned int j=0; jm_StepsType == ntFrom ) - { - Steps* pNewNotes = new Steps(this); - pNewNotes->AutogenFrom( pOriginalNotes, ntTo ); - this->AddSteps( pNewNotes ); - } - } -} - -void Song::RemoveAutoGenNotes() -{ - FOREACH_ENUM( StepsType, st ) - { - for( int j=m_vpStepsByType[st].size()-1; j>=0; j-- ) - { - if( m_vpStepsByType[st][j]->IsAutogen() ) - { - // delete m_vpSteps[j]; // delete below - m_vpStepsByType[st].erase( m_vpStepsByType[st].begin()+j ); - } - } - } - - for( int j=m_vpSteps.size()-1; j>=0; j-- ) - { - if( m_vpSteps[j]->IsAutogen() ) - { - delete m_vpSteps[j]; - m_vpSteps.erase( m_vpSteps.begin()+j ); - } - } -} bool Song::IsEasy( StepsType st ) const { @@ -1849,13 +1741,9 @@ void Song::AddSteps( Steps* pSteps ) void Song::DeleteSteps( const Steps* pSteps, bool bReAutoGen ) { - ASSERT( !pSteps->IsAutogen() ); - // Avoid any stale Note::parent pointers by removing all AutoGen'd Steps, // then adding them again. - if( bReAutoGen ) - RemoveAutoGenNotes(); vector &vpSteps = m_vpStepsByType[pSteps->m_StepsType]; for( int j=vpSteps.size()-1; j>=0; j-- ) @@ -1877,9 +1765,6 @@ void Song::DeleteSteps( const Steps* pSteps, bool bReAutoGen ) break; } } - - if( bReAutoGen ) - AddAutoGenNotes(); } bool Song::Matches(const RString &sGroup, const RString &sSong) const diff --git a/src/Song.h b/src/Song.h index 40a5ff99f8..3a548301b5 100644 --- a/src/Song.h +++ b/src/Song.h @@ -148,15 +148,6 @@ class Song const RString &GetSongFilePath() const; RString GetCacheFilePath() const; - void AddAutoGenNotes(); - /** - * @brief Automatically generate steps from one type to another. - * @param ntTo the StepsType we're making. - * @param ntFrom the StepsType we're generating from. - */ - void AutoGen( StepsType ntTo, StepsType ntFrom ); - void RemoveAutoGenNotes(); - // Directory this song data came from: const RString &GetSongDir() const { return m_sSongDir; } diff --git a/src/SongManager.cpp b/src/SongManager.cpp index d3e0ddc302..6703bc18f6 100644 --- a/src/SongManager.cpp +++ b/src/SongManager.cpp @@ -907,12 +907,6 @@ void SongManager::Invalidate( const Song *pStaleSong ) void SongManager::SetPreferences() { - for( unsigned int i=0; im_bAutogenSteps may have changed. - m_pSongs[i]->RemoveAutoGenNotes(); - m_pSongs[i]->AddAutoGenNotes(); - } } void SongManager::SaveEnabledSongsToPref() diff --git a/src/SongUtil.cpp b/src/SongUtil.cpp index 257ee64cb5..ce91345dd0 100644 --- a/src/SongUtil.cpp +++ b/src/SongUtil.cpp @@ -127,8 +127,6 @@ void SongUtil::GetSteps( continue; if( uHash != 0 && uHash != pSteps->GetHash() ) continue; - if( !bIncludeAutoGen && pSteps->IsAutogen() ) - continue; arrayAddTo.push_back( pSteps ); @@ -170,8 +168,6 @@ Steps* SongUtil::GetStepsByDifficulty( const Song *pSong, StepsType st, Difficul if( dc != Difficulty_Invalid && dc != pSteps->GetDifficulty() ) continue; - if( !bIncludeAutoGen && pSteps->IsAutogen() ) - continue; return pSteps; } diff --git a/src/Steps.cpp b/src/Steps.cpp index 64f3b10a42..5c42f08269 100644 --- a/src/Steps.cpp +++ b/src/Steps.cpp @@ -48,7 +48,7 @@ XToString( DisplayBPM ); LuaXType( DisplayBPM ); Steps::Steps(Song *song): m_StepsType(StepsType_Invalid), m_pSong(song), - parent(NULL), m_pNoteData(new NoteData), m_bNoteDataIsFilled(false), + m_pNoteData(new NoteData), m_bNoteDataIsFilled(false), m_sNoteDataCompressed(""), m_sFilename(""), m_bSavedToDisk(false), m_LoadedFromProfile(ProfileSlot_Invalid), m_iHash(0), m_sDescription(""), m_sChartStyle(""), @@ -84,8 +84,6 @@ bool Steps::HasAttacks() const unsigned Steps::GetHash() const { - if( parent ) - return parent->GetHash(); if( m_iHash ) return m_iHash; if( m_sNoteDataCompressed.empty() ) @@ -176,8 +174,6 @@ void Steps::SetNoteData( const NoteData& noteDataNew ) { ASSERT( noteDataNew.GetNumTracks() == GAMEMAN->GetStepsTypeInfo(m_StepsType).iNumTracks ); - DeAutogen( false ); - *m_pNoteData = noteDataNew; m_bNoteDataIsFilled = true; @@ -301,10 +297,6 @@ void Steps::TidyUpData() void Steps::CalculateRadarValues( float fMusicLengthSeconds ) { - // If we're autogen, don't calculate values. GetRadarValues will take from our parent. - if( parent != NULL ) - return; - if( m_bAreCachedRadarValuesJustLoaded ) { m_bAreCachedRadarValuesJustLoaded = false; @@ -375,44 +367,6 @@ void Steps::Decompress(bool isGameplay) if (m_bNoteDataIsFilled) { return; // already decompressed } - - if( parent ) - { - // get autogen m_pNoteData - NoteData notedata; - parent->GetNoteData( notedata, isGameplay ); - - m_bNoteDataIsFilled = true; - - int iNewTracks = GAMEMAN->GetStepsTypeInfo(m_StepsType).iNumTracks; - - if( this->m_StepsType == StepsType_lights_cabinet ) - { - NoteDataUtil::LoadTransformedLights( notedata, *m_pNoteData, iNewTracks ); - } - else - { - // Special case so that kickbox can have autogen steps that are playable. - // Hopefully I'll replace this with a good generalized autogen system - // later. -Kyz - if(stepstype_is_kickbox(this->m_StepsType)) - { - // Number of notes seems like a useful "random" input so that charts - // from different sources come out different, but autogen always - // makes the same thing from one source. -Kyz - NoteDataUtil::AutogenKickbox(notedata, *m_pNoteData, *GetTimingData(), - this->m_StepsType, - static_cast(GetRadarValues(PLAYER_1)[RadarCategory_TapsAndHolds])); - } - else - { - NoteDataUtil::LoadTransformedSlidingWindow( notedata, *m_pNoteData, iNewTracks ); - - NoteDataUtil::RemoveStretch( *m_pNoteData, m_StepsType ); - } - } - return; - } if( !m_sFilename.empty() && m_sNoteDataCompressed.empty() ) { @@ -614,36 +568,6 @@ void Steps::Compress() const m_bNoteDataIsFilled = false; } -/* Copy our parent's data. This is done when we're being changed from autogen - * to normal. (needed?) */ -void Steps::DeAutogen( bool bCopyNoteData ) -{ - if( !parent ) - return; // OK - - if( bCopyNoteData ) - Decompress(false); // fills in m_pNoteData with sliding window transform - - m_sDescription = Real()->m_sDescription; - m_sChartStyle = Real()->m_sChartStyle; - m_Difficulty = Real()->m_Difficulty; - m_iMeter = Real()->m_iMeter; - copy( Real()->m_CachedRadarValues, Real()->m_CachedRadarValues + NUM_PLAYERS, m_CachedRadarValues ); - m_sCredit = Real()->m_sCredit; - parent = NULL; - - if( bCopyNoteData ) - Compress(); -} - -void Steps::AutogenFrom( const Steps *parent_, StepsType ntTo ) -{ - parent = parent_; - m_StepsType = ntTo; - m_StepsTypeStr= GAMEMAN->GetStepsTypeInfo(ntTo).szName; - m_Timing = parent->m_Timing; -} - void Steps::CopyFrom( Steps* pSource, StepsType ntTo, float fMusicLengthSeconds ) // pSource does not have to be of the same StepsType { m_StepsType = ntTo; @@ -651,7 +575,6 @@ void Steps::CopyFrom( Steps* pSource, StepsType ntTo, float fMusicLengthSeconds NoteData noteData; pSource->GetNoteData( noteData, false ); noteData.SetNumTracks( GAMEMAN->GetStepsTypeInfo(ntTo).iNumTracks ); - parent = NULL; m_Timing = pSource->m_Timing; this->m_pSong = pSource->m_pSong; this->m_Attacks = pSource->m_Attacks; @@ -674,7 +597,6 @@ void Steps::CreateBlank( StepsType ntTo ) void Steps::SetDifficultyAndDescription( Difficulty dc, const RString &sDescription ) { - DeAutogen(); m_Difficulty = dc; m_sDescription = sDescription; if( GetDifficulty() == Difficulty_Edit ) @@ -683,13 +605,11 @@ void Steps::SetDifficultyAndDescription( Difficulty dc, const RString &sDescript void Steps::SetCredit( const RString &sCredit ) { - DeAutogen(); m_sCredit = sCredit; } void Steps::SetChartStyle( const RString &sChartStyle ) { - DeAutogen(); m_sChartStyle = sChartStyle; } @@ -705,7 +625,6 @@ bool Steps::MakeValidEditDescription( RString &sPreferredDescription ) void Steps::SetMeter( int meter ) { - DeAutogen(); m_iMeter = meter; } @@ -750,7 +669,6 @@ void Steps::SetMusicFile(const RString& file) void Steps::SetCachedRadarValues( const RadarValues v[NUM_PLAYERS] ) { - DeAutogen(); copy( v, v + NUM_PLAYERS, m_CachedRadarValues ); m_bAreCachedRadarValuesJustLoaded = true; } @@ -768,7 +686,6 @@ class LunaSteps: public Luna DEFINE_METHOD( GetAuthorCredit, GetCredit() ) DEFINE_METHOD( GetMeter, GetMeter() ) DEFINE_METHOD( GetFilename, GetFilename() ) - DEFINE_METHOD( IsAutogen, IsAutogen() ) DEFINE_METHOD( IsAnEdit, IsAnEdit() ) DEFINE_METHOD( IsAPlayerEdit, IsAPlayerEdit() ) @@ -930,7 +847,6 @@ class LunaSteps: public Luna ADD_METHOD( GetChartKey ); ADD_METHOD( GetMSD ); ADD_METHOD( IsAnEdit ); - ADD_METHOD( IsAutogen ); ADD_METHOD( IsAPlayerEdit ); ADD_METHOD( GetDisplayBpms ); ADD_METHOD( IsDisplayBpmSecret ); diff --git a/src/Steps.h b/src/Steps.h index e3bbeb9dd6..0548a3cc45 100644 --- a/src/Steps.h +++ b/src/Steps.h @@ -50,7 +50,6 @@ class Steps ~Steps(); // initializers - void AutogenFrom( const Steps *parent, StepsType ntTo ); void CopyFrom( Steps* pSource, StepsType ntTo, float fMusicLengthSeconds ); void CreateBlank( StepsType ntTo ); @@ -62,7 +61,6 @@ class Steps * @brief Determine if these steps were created by the autogenerator. * @return true if they were, false otherwise. */ - bool IsAutogen() const { return parent != NULL; } /** * @brief Determine if this set of Steps is an edit. @@ -87,40 +85,40 @@ class Steps * @brief Retrieve the description used for this edit. * @return the description used for this edit. */ - RString GetDescription() const { return Real()->m_sDescription; } + RString GetDescription() const { return m_sDescription; } /** * @brief Retrieve the ChartStyle used for this chart. * @return the description used for this chart. */ - RString GetChartStyle() const { return Real()->m_sChartStyle; } + RString GetChartStyle() const { return m_sChartStyle; } /** * @brief Retrieve the difficulty used for this edit. * @return the difficulty used for this edit. */ - Difficulty GetDifficulty() const { return Real()->m_Difficulty; } + Difficulty GetDifficulty() const { return m_Difficulty; } /** * @brief Retrieve the meter used for this edit. * @return the meter used for this edit. */ - int GetMeter() const { return Real()->m_iMeter; } - const RadarValues& GetRadarValues( PlayerNumber pn ) const { return Real()->m_CachedRadarValues[pn]; } + int GetMeter() const { return m_iMeter; } + const RadarValues& GetRadarValues( PlayerNumber pn ) const { return m_CachedRadarValues[pn]; } /** * @brief Retrieve the author credit used for this edit. * @return the author credit used for this edit. */ - RString GetCredit() const { return Real()->m_sCredit; } + RString GetCredit() const { return m_sCredit; } /** @brief The list of attacks. */ AttackArray m_Attacks; /** @brief The stringified list of attacks. */ vector m_sAttackString; - RString GetChartName() const { return parent ? Real()->GetChartName() : this->chartName; } + RString GetChartName() const { return chartName; } void SetChartName(const RString &name) { this->chartName = name; } void SetFilename( const RString &fn ) { m_sFilename = fn; } RString GetFilename() const { return m_sFilename; } - void SetSavedToDisk( bool b ) { DeAutogen(); m_bSavedToDisk = b; } - bool GetSavedToDisk() const { return Real()->m_bSavedToDisk; } + void SetSavedToDisk(bool b) { m_bSavedToDisk = b; } + bool GetSavedToDisk() const { return m_bSavedToDisk; } void SetDifficulty( Difficulty dc ) { SetDifficultyAndDescription( dc, GetDescription() ); } void SetDescription( const RString &sDescription ) { SetDifficultyAndDescription( this->GetDifficulty(), sDescription ); } void SetDifficultyAndDescription( Difficulty dc, const RString &sDescription ); @@ -233,16 +231,6 @@ class Steps } private: - inline const Steps *Real() const { return parent ? parent : this; } - void DeAutogen( bool bCopyNoteData = true ); /* If this Steps is autogenerated, make it a real Steps. */ - - /** - * @brief Identify this Steps' parent. - * - * If this Steps is autogenerated, this will point to the autogen - * source. If this is true, m_sNoteDataCompressed will always be empty. */ - const Steps *parent; - /* We can have one or both of these; if we have both, they're always identical. * Call Compress() to force us to only have m_sNoteDataCompressed; otherwise, creation of * these is transparent. */ diff --git a/src/StepsDisplay.cpp b/src/StepsDisplay.cpp index e6e23dcd90..1a72147a77 100644 --- a/src/StepsDisplay.cpp +++ b/src/StepsDisplay.cpp @@ -55,7 +55,6 @@ void StepsDisplay::Load( const RString &sMetricsGroup, const PlayerState *pPlaye m_bShowMeter.Load(m_sMetricsGroup,"ShowMeter"); m_bShowDescription.Load(m_sMetricsGroup,"ShowDescription"); m_bShowCredit.Load(m_sMetricsGroup,"ShowCredit"); - m_bShowAutogen.Load(m_sMetricsGroup,"ShowAutogen"); m_bShowStepsType.Load(m_sMetricsGroup,"ShowStepsType"); m_sZeroMeterString.Load(m_sMetricsGroup,"ZeroMeterString"); m_sMeterFormatString.Load(m_sMetricsGroup,"MeterFormatString"); @@ -100,14 +99,6 @@ void StepsDisplay::Load( const RString &sMetricsGroup, const PlayerState *pPlaye this->AddChild( &m_textAuthor ); } - if( m_bShowAutogen ) - { - m_sprAutogen.Load( THEME->GetPathG(m_sMetricsGroup,"Autogen") ); - m_sprAutogen->SetName( "Autogen" ); - ActorUtil::LoadAllCommandsAndSetXYAndOnCommand( m_sprAutogen, m_sMetricsGroup ); - this->AddChild( m_sprAutogen ); - } - if( m_bShowStepsType ) { m_sprStepsType.Load( THEME->GetPathG(m_sMetricsGroup,"StepsType") ); @@ -230,14 +221,6 @@ void StepsDisplay::SetInternal( const SetParams ¶ms ) m_textAuthor.SetText( sDisplayCredit ); m_textAuthor.HandleMessage( msg ); } - - if( m_bShowAutogen ) - { - bool b = params.pSteps && params.pSteps->IsAutogen(); - m_sprAutogen->HandleMessage( msg ); - m_sprAutogen->SetVisible( b ); - } - if( m_bShowStepsType ) { if( params.st != StepsType_Invalid ) diff --git a/src/StepsDisplay.h b/src/StepsDisplay.h index d9708869b0..04606de8a5 100644 --- a/src/StepsDisplay.h +++ b/src/StepsDisplay.h @@ -56,7 +56,6 @@ class StepsDisplay : public ActorFrame BitmapText m_textDescription; /** @brief The author of the chart. */ BitmapText m_textAuthor; - AutoActor m_sprAutogen; // visible if Steps and is autogen'd AutoActor m_sprStepsType; ThemeMetric m_iNumTicks; @@ -65,7 +64,6 @@ class StepsDisplay : public ActorFrame ThemeMetric m_bShowMeter; ThemeMetric m_bShowDescription; ThemeMetric m_bShowCredit; - ThemeMetric m_bShowAutogen; ThemeMetric m_bShowStepsType; ThemeMetric m_sZeroMeterString; ThemeMetric m_sMeterFormatString; diff --git a/src/StepsUtil.cpp b/src/StepsUtil.cpp index fcffbe11df..508afb34f5 100644 --- a/src/StepsUtil.cpp +++ b/src/StepsUtil.cpp @@ -157,8 +157,6 @@ void StepsUtil::SortStepsPointerArrayByNumPlays( vector &vStepsPointers, for( unsigned j=0; jIsAutogen() ) - continue; // skip vpAllSteps.push_back( pSteps ); mapStepsToSong[pSteps] = pSong; }