Merged per-chart music. Updated changelog.
This commit is contained in:
@@ -127,7 +127,7 @@ void AutoKeysounds::LoadTracks( const Song *pSong, RageSoundReader *&pShared, Ra
|
||||
pShared = NULL;
|
||||
|
||||
vector<RString> vsMusicFile;
|
||||
const RString sMusicPath = pSong->GetMusicPath();
|
||||
const RString sMusicPath = GAMESTATE->m_pCurSteps[GAMESTATE->GetMasterPlayerNumber()]->GetMusicPath();
|
||||
|
||||
if( !sMusicPath.empty() )
|
||||
vsMusicFile.push_back( sMusicPath );
|
||||
|
||||
@@ -1077,6 +1077,75 @@ void GameState::ForceSharedSidesMatch()
|
||||
}
|
||||
}
|
||||
|
||||
void GameState::ForceOtherPlayersToCompatibleSteps(PlayerNumber main)
|
||||
{
|
||||
if(IsCourseMode())
|
||||
{
|
||||
Trail* steps_to_match= m_pCurTrail[main].Get();
|
||||
if(steps_to_match == NULL) { return; }
|
||||
int num_players= GAMESTATE->GetNumPlayersEnabled();
|
||||
StyleType styletype_to_match= GAMEMAN->GetFirstCompatibleStyle(
|
||||
GAMESTATE->GetCurrentGame(), num_players, steps_to_match->m_StepsType)
|
||||
->m_StyleType;
|
||||
FOREACH_EnabledPlayer(pn)
|
||||
{
|
||||
Trail* pn_steps= m_pCurTrail[pn].Get();
|
||||
bool match_failed= false;
|
||||
if(steps_to_match != pn_steps && pn_steps != NULL)
|
||||
{
|
||||
StyleType pn_styletype= GAMEMAN->GetFirstCompatibleStyle(
|
||||
GAMESTATE->GetCurrentGame(), num_players, pn_steps->m_StepsType)
|
||||
->m_StyleType;
|
||||
if(styletype_to_match == StyleType_TwoPlayersSharedSides ||
|
||||
pn_styletype == StyleType_TwoPlayersSharedSides)
|
||||
{
|
||||
match_failed= true;
|
||||
}
|
||||
|
||||
if(match_failed)
|
||||
{
|
||||
m_pCurTrail[pn].Set(steps_to_match);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Steps* steps_to_match= m_pCurSteps[main].Get();
|
||||
if(steps_to_match == NULL) { return; }
|
||||
int num_players= GAMESTATE->GetNumPlayersEnabled();
|
||||
StyleType styletype_to_match= GAMEMAN->GetFirstCompatibleStyle(
|
||||
GAMESTATE->GetCurrentGame(), num_players, steps_to_match->m_StepsType)
|
||||
->m_StyleType;
|
||||
RString music_to_match= steps_to_match->GetMusicFile();
|
||||
FOREACH_EnabledPlayer(pn)
|
||||
{
|
||||
Steps* pn_steps= m_pCurSteps[pn].Get();
|
||||
bool match_failed= false;
|
||||
if(steps_to_match != pn_steps && pn_steps != NULL)
|
||||
{
|
||||
StyleType pn_styletype= GAMEMAN->GetFirstCompatibleStyle(
|
||||
GAMESTATE->GetCurrentGame(), num_players, pn_steps->m_StepsType)
|
||||
->m_StyleType;
|
||||
if(styletype_to_match == StyleType_TwoPlayersSharedSides ||
|
||||
pn_styletype == StyleType_TwoPlayersSharedSides)
|
||||
{
|
||||
match_failed= true;
|
||||
}
|
||||
if(music_to_match != pn_steps->GetMusicFile())
|
||||
{
|
||||
match_failed= true;
|
||||
}
|
||||
|
||||
if(match_failed)
|
||||
{
|
||||
m_pCurSteps[pn].Set(steps_to_match);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GameState::Update( float fDelta )
|
||||
{
|
||||
m_SongOptions.Update( fDelta );
|
||||
@@ -2602,6 +2671,7 @@ public:
|
||||
Steps *pS = Luna<Steps>::check(L,2);
|
||||
SetCompatibleStyleOrError(p, L, pS->m_StepsType, pn);
|
||||
p->m_pCurSteps[pn].Set(pS);
|
||||
p->ForceOtherPlayersToCompatibleSteps(pn);
|
||||
}
|
||||
COMMON_RETURN_SELF;
|
||||
}
|
||||
@@ -2632,6 +2702,7 @@ public:
|
||||
Trail *pS = Luna<Trail>::check(L,2);
|
||||
SetCompatibleStyleOrError(p, L, pS->m_StepsType, pn);
|
||||
p->m_pCurTrail[pn].Set(pS);
|
||||
p->ForceOtherPlayersToCompatibleSteps(pn);
|
||||
}
|
||||
COMMON_RETURN_SELF;
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ public:
|
||||
bool CanSafelyEnterGameplay(RString& reason);
|
||||
void SetCompatibleStylesForPlayers();
|
||||
void ForceSharedSidesMatch();
|
||||
void ForceOtherPlayersToCompatibleSteps(PlayerNumber main);
|
||||
|
||||
void Update( float fDelta );
|
||||
|
||||
|
||||
@@ -727,6 +727,11 @@ bool SSCLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
|
||||
pNewNotes->SetFilename(sPath);
|
||||
out.AddSteps( pNewNotes );
|
||||
}
|
||||
|
||||
else if(sValueName == "MUSIC")
|
||||
{
|
||||
pNewNotes->SetMusicFile(sParams[1]);
|
||||
}
|
||||
|
||||
else if( sValueName=="BPMS" )
|
||||
{
|
||||
|
||||
@@ -362,6 +362,12 @@ static RString GetSSCNoteData( const Song &song, const Steps &in, bool bSavingCa
|
||||
lines.push_back( ssprintf( "#DIFFICULTY:%s;", DifficultyToString(in.GetDifficulty()).c_str() ) );
|
||||
lines.push_back( ssprintf( "#METER:%d;", in.GetMeter() ) );
|
||||
|
||||
const RString& music= in.GetMusicFile();
|
||||
if(!music.empty())
|
||||
{
|
||||
lines.push_back(ssprintf("#MUSIC:%s;", music.c_str()));
|
||||
}
|
||||
|
||||
vector<RString> asRadarValues;
|
||||
FOREACH_PlayerNumber( pn )
|
||||
{
|
||||
|
||||
+33
-2
@@ -106,6 +106,7 @@ AutoScreenMessage( SM_BackFromSpeedWaitChange );
|
||||
AutoScreenMessage( SM_BackFromSpeedModeChange );
|
||||
AutoScreenMessage( SM_BackFromScrollChange );
|
||||
AutoScreenMessage( SM_BackFromFakeChange );
|
||||
AutoScreenMessage( SM_BackFromStepMusicChange );
|
||||
AutoScreenMessage( SM_DoEraseStepTiming );
|
||||
AutoScreenMessage( SM_DoSaveAndExit );
|
||||
AutoScreenMessage( SM_DoExit );
|
||||
@@ -915,7 +916,9 @@ static MenuDef g_StepsInformation(
|
||||
true, EditMode_Full, true, true, 0, NULL ),
|
||||
MenuRowDef(ScreenEdit::step_max_bpm,
|
||||
"Max BPM",
|
||||
true, EditMode_Full, true, true, 0, NULL )
|
||||
true, EditMode_Full, true, true, 0, NULL ),
|
||||
MenuRowDef(ScreenEdit::step_music,
|
||||
"Music File", true, EditMode_Full,true, true, 0, NULL)
|
||||
);
|
||||
|
||||
static MenuDef g_StepsData(
|
||||
@@ -2343,6 +2346,9 @@ bool ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
|
||||
int(vSteps.size()) );
|
||||
SCREENMAN->SystemMessage( s );
|
||||
m_soundSwitchSteps.Play(true);
|
||||
// Reload the music because it can be different for every steps. -Kyz
|
||||
m_AutoKeysounds.FinishLoading();
|
||||
m_pSoundMusic = m_AutoKeysounds.GetSound();
|
||||
|
||||
ScrollTo( GetAppropriateTiming().GetBeatFromElapsedTime(curSecond) );
|
||||
}
|
||||
@@ -3663,7 +3669,12 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
|
||||
SetDirty( true );
|
||||
}
|
||||
}
|
||||
|
||||
else if ( SM == SM_BackFromStepMusicChange && !ScreenTextEntry::s_bCancelledLast )
|
||||
{
|
||||
// Reload the music because it just changed. -Kyz
|
||||
m_AutoKeysounds.FinishLoading();
|
||||
m_pSoundMusic = m_AutoKeysounds.GetSound();
|
||||
}
|
||||
else if( SM == SM_BackFromBGChange )
|
||||
{
|
||||
HandleBGChangeChoice( (BGChangeChoice)ScreenMiniMenu::s_iLastRowCode, ScreenMiniMenu::s_viLastAnswers );
|
||||
@@ -4300,6 +4311,12 @@ static void ChangeStepMeter( const RString &sNew )
|
||||
GAMESTATE->m_pCurSteps[PLAYER_1]->SetMeter(max(diff, 1));
|
||||
}
|
||||
|
||||
static void ChangeStepMusic(const RString& sNew)
|
||||
{
|
||||
Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
|
||||
pSteps->SetMusicFile(sNew);
|
||||
}
|
||||
|
||||
static void ChangeMainTitle( const RString &sNew )
|
||||
{
|
||||
Song* pSong = GAMESTATE->m_pCurSong;
|
||||
@@ -4589,6 +4606,8 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
|
||||
g_StepsInformation.rows[step_display_bpm].iDefaultChoice = pSteps->GetDisplayBPM();
|
||||
g_StepsInformation.rows[step_min_bpm].SetOneUnthemedChoice( FloatToString(pSteps->GetMinBPM()));
|
||||
g_StepsInformation.rows[step_max_bpm].SetOneUnthemedChoice( FloatToString(pSteps->GetMaxBPM()));
|
||||
g_StepsInformation.rows[step_music].bEnabled = (EDIT_MODE.GetValue() >= EditMode_Full);
|
||||
g_StepsInformation.rows[step_music].SetOneUnthemedChoice( pSteps->GetMusicFile() );
|
||||
EditMiniMenu( &g_StepsInformation, SM_BackFromStepsInformation, SM_None );
|
||||
}
|
||||
break;
|
||||
@@ -5358,6 +5377,7 @@ static LocalizedString ENTER_NEW_STEP_AUTHOR( "ScreenEdit", "Enter the author wh
|
||||
static LocalizedString ENTER_NEW_METER( "ScreenEdit", "Enter a new meter." );
|
||||
static LocalizedString ENTER_MIN_BPM ("ScreenEdit","Enter a new min BPM.");
|
||||
static LocalizedString ENTER_MAX_BPM ("ScreenEdit","Enter a new max BPM.");
|
||||
static LocalizedString ENTER_NEW_STEP_MUSIC("ScreenEdit", "Enter the music file for this chart.");
|
||||
void ScreenEdit::HandleStepsInformationChoice( StepsInformationChoice c, const vector<int> &iAnswers )
|
||||
{
|
||||
Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
|
||||
@@ -5438,6 +5458,17 @@ void ScreenEdit::HandleStepsInformationChoice( StepsInformationChoice c, const v
|
||||
ChangeStepsMaxBPM, NULL);
|
||||
break;
|
||||
}
|
||||
case step_music:
|
||||
{
|
||||
ScreenTextEntry::TextEntry(SM_BackFromStepMusicChange,
|
||||
ENTER_NEW_STEP_MUSIC,
|
||||
m_pSteps->GetMusicFile(),
|
||||
255,
|
||||
SongUtil::ValidateCurrentStepsMusic,
|
||||
ChangeStepMusic,
|
||||
NULL);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -537,6 +537,7 @@ public:
|
||||
step_display_bpm,
|
||||
step_min_bpm,
|
||||
step_max_bpm,
|
||||
step_music,
|
||||
NUM_STEPS_INFORMATION_CHOICES
|
||||
};
|
||||
void HandleStepsInformationChoice( StepsInformationChoice c, const vector<int> &iAnswers );
|
||||
|
||||
@@ -1039,6 +1039,7 @@ void ScreenSelectMusic::ChangeSteps( PlayerNumber pn, int dir )
|
||||
m_soundDifficultyHarder.SetProperty( "Pan", fBalance );
|
||||
m_soundDifficultyHarder.PlayCopy();
|
||||
}
|
||||
GAMESTATE->ForceOtherPlayersToCompatibleSteps(pn);
|
||||
|
||||
Message msg( "ChangeSteps" );
|
||||
msg.SetParam( "Player", pn );
|
||||
|
||||
+1
-1
@@ -1417,7 +1417,7 @@ vector<RString> Song::GetInstrumentTracksToVectorString() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
RString GetSongAssetPath( RString sPath, const RString &sSongPath )
|
||||
RString Song::GetSongAssetPath( RString sPath, const RString &sSongPath )
|
||||
{
|
||||
if( sPath == "" )
|
||||
return RString();
|
||||
|
||||
@@ -248,6 +248,7 @@ public:
|
||||
AttackArray m_Attacks;
|
||||
vector<RString> m_sAttackString;
|
||||
|
||||
static RString GetSongAssetPath( RString sPath, const RString &sSongPath );
|
||||
RString GetMusicPath() const;
|
||||
RString GetInstrumentTrackPath( InstrumentTrack it ) const;
|
||||
RString GetBannerPath() const;
|
||||
|
||||
@@ -917,6 +917,24 @@ bool SongUtil::ValidateCurrentSongPreview(const RString& answer, RString& error)
|
||||
return valid;
|
||||
}
|
||||
|
||||
static LocalizedString MUSIC_DOES_NOT_EXIST("SongUtil", "The music file '%s' does not exist.");
|
||||
bool SongUtil::ValidateCurrentStepsMusic(const RString &answer, RString &error)
|
||||
{
|
||||
if(answer.empty())
|
||||
return true;
|
||||
Steps *pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
|
||||
RString real_file= pSteps->GetMusicFile();
|
||||
pSteps->SetMusicFile(answer);
|
||||
RString path= pSteps->GetMusicPath();
|
||||
bool valid= DoesFileExist(path);
|
||||
pSteps->SetMusicFile(real_file);
|
||||
if(!valid)
|
||||
{
|
||||
error= ssprintf(MUSIC_DOES_NOT_EXIST.GetValue(), answer.c_str());
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
void SongUtil::GetAllSongGenres( vector<RString> &vsOut )
|
||||
{
|
||||
set<RString> genres;
|
||||
|
||||
@@ -166,6 +166,7 @@ namespace SongUtil
|
||||
bool ValidateCurrentStepsCredit( const RString &sAnswer, RString &sErrorOut );
|
||||
bool ValidateCurrentStepsChartName(const RString &answer, RString &error);
|
||||
bool ValidateCurrentSongPreview(const RString& answer, RString& error);
|
||||
bool ValidateCurrentStepsMusic(const RString &answer, RString &error);
|
||||
|
||||
void GetAllSongGenres( vector<RString> &vsOut );
|
||||
/**
|
||||
|
||||
@@ -589,6 +589,23 @@ bool Steps::HasSignificantTimingChanges() const
|
||||
return false;
|
||||
}
|
||||
|
||||
const RString Steps::GetMusicPath() const
|
||||
{
|
||||
return Song::GetSongAssetPath(
|
||||
m_MusicFile.empty() ? m_pSong->m_sMusicFile : m_MusicFile,
|
||||
m_pSong->GetSongDir());
|
||||
}
|
||||
|
||||
const RString& Steps::GetMusicFile() const
|
||||
{
|
||||
return m_MusicFile;
|
||||
}
|
||||
|
||||
void Steps::SetMusicFile(const RString& file)
|
||||
{
|
||||
m_MusicFile= file;
|
||||
}
|
||||
|
||||
void Steps::SetCachedRadarValues( const RadarValues v[NUM_PLAYERS] )
|
||||
{
|
||||
DeAutogen();
|
||||
|
||||
+7
-1
@@ -173,6 +173,10 @@ public:
|
||||
* @return true if it does, or false otherwise. */
|
||||
bool HasAttacks() const;
|
||||
|
||||
const RString GetMusicPath() const; // Returns the path for loading.
|
||||
const RString& GetMusicFile() const; // Returns the filename for the simfile.
|
||||
void SetMusicFile(const RString& file);
|
||||
|
||||
// Lua
|
||||
void PushSelf( lua_State *L );
|
||||
|
||||
@@ -218,7 +222,9 @@ private:
|
||||
/** @brief The name of the file where these steps are stored. */
|
||||
RString m_sFilename;
|
||||
/** @brief true if these Steps were loaded from or saved to disk. */
|
||||
bool m_bSavedToDisk;
|
||||
bool m_bSavedToDisk;
|
||||
/** @brief allows the steps to specify their own music file. */
|
||||
RString m_MusicFile;
|
||||
/** @brief What profile was used? This is ProfileSlot_Invalid if not from a profile. */
|
||||
ProfileSlot m_LoadedFromProfile;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user