Changed ScreenSelectMusic and Song to look for preview.ogg and use it for a sample if it exists instead of the music file. Sample length still comes from simfile. Changed foreach_ordered to work on tables with string and number keys.
This commit is contained in:
+11
-4
@@ -4,22 +4,29 @@ The StepMania 5 Changelog covers all post-sm-ssc changes. For a list of changes
|
|||||||
from StepMania 4 alpha 5 to sm-ssc v1.2.5, see Changelog_sm-ssc.txt.
|
from StepMania 4 alpha 5 to sm-ssc v1.2.5, see Changelog_sm-ssc.txt.
|
||||||
________________________________________________________________________________
|
________________________________________________________________________________
|
||||||
|
|
||||||
|
2015/03/01
|
||||||
|
----------
|
||||||
|
* [SelectMusic] Select Music now plays preview.ogg for a simfile if it exists
|
||||||
|
instead of using the song file for the sample music. The sample length
|
||||||
|
from the simfile is used and the sample start is treated as 0. [kyzentun]
|
||||||
|
* [foreach] foreach_ordered lua function now works on tables that have both
|
||||||
|
number and string keys. Number keys are iterated over first. [kyzentun]
|
||||||
|
|
||||||
2015/02/27
|
2015/02/27
|
||||||
----------
|
----------
|
||||||
* [ActorFrame] Fixed RemoveChild and RemoveAllChildren lua functions to
|
* [ActorFrame] Fixed RemoveChild and RemoveAllChildren lua functions to
|
||||||
delete the children instead of leaking memory. [kyzentun]
|
delete the children instead of leaking memory. [kyzentun]
|
||||||
|
|
||||||
2015/02/26
|
2015/02/26
|
||||||
----------
|
----------
|
||||||
* [PaneDisplay] Changed to print an error when metrics or player number are
|
* [PaneDisplay] Changed to print an error when metrics or player number are
|
||||||
omitted instead of crashing. [kyzentun]
|
omitted instead of crashing. [kyzentun]
|
||||||
* [Screen] Fixed crash when AddInputCallback is passed nil. [kyzentun]
|
* [Screen] Fixed crash when AddInputCallback is passed nil. [kyzentun]
|
||||||
|
|
||||||
2015/02/22
|
2015/02/22
|
||||||
----------
|
----------
|
||||||
* [BitmapText] Place characters of right-to-left alphabets correctly.
|
* [BitmapText] Place characters of right-to-left alphabets correctly.
|
||||||
(untested) [roothorick]
|
(untested) [roothorick]
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
StepMania 5.0.6 | 20150217
|
StepMania 5.0.6 | 20150217
|
||||||
@@ -28,7 +35,7 @@ StepMania 5.0.6 | 20150217
|
|||||||
2015/02/16
|
2015/02/16
|
||||||
----------
|
----------
|
||||||
* [EditMode] Fixed mistake in TimingData that broke editing bpms. [kyzentun]
|
* [EditMode] Fixed mistake in TimingData that broke editing bpms. [kyzentun]
|
||||||
Fixed crash when deleting steps. [kyzentun]
|
Fixed crash when deleting steps. [kyzentun]
|
||||||
* [InputMapper] Backslash can be mapped now. [kyzentun]
|
* [InputMapper] Backslash can be mapped now. [kyzentun]
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|||||||
@@ -6,14 +6,26 @@ Note that this is a namespace, not a class per se.
|
|||||||
|
|
||||||
-- TODO: move this into a more general section
|
-- TODO: move this into a more general section
|
||||||
-- func takes a key and a value
|
-- func takes a key and a value
|
||||||
|
function foreach_by_sorted_keys(tbl, keys, func)
|
||||||
|
table.sort(keys)
|
||||||
|
for _, key in ipairs(keys) do func(key, tbl[key]) end
|
||||||
|
end
|
||||||
|
|
||||||
function foreach_ordered( tbl, func )
|
function foreach_ordered( tbl, func )
|
||||||
local keys = { }
|
local string_keys= {}
|
||||||
for k,_ in pairs(tbl) do keys[#keys+1] = k end
|
local number_keys= {}
|
||||||
|
-- First person to to use this on a table that uses something else as keys
|
||||||
table.sort( keys )
|
-- gets to extend this function to cover more types. And a beating. -Kyz
|
||||||
|
for k,_ in pairs(tbl) do
|
||||||
|
if type(k) == "string" then
|
||||||
|
table.insert(string_keys, k)
|
||||||
|
elseif type(k) == "number" then
|
||||||
|
table.insert(number_keys, k)
|
||||||
|
end
|
||||||
|
end
|
||||||
-- iterate in sorted order
|
-- iterate in sorted order
|
||||||
for _,key in ipairs(keys) do func( key, tbl[key]) end
|
foreach_by_sorted_keys(tbl, number_keys, func)
|
||||||
|
foreach_by_sorted_keys(tbl, string_keys, func)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- redeclared here for my sanity's sake
|
-- redeclared here for my sanity's sake
|
||||||
|
|||||||
@@ -1796,9 +1796,9 @@ void ScreenSelectMusic::AfterMusicChange()
|
|||||||
case SampleMusicPreviewMode_Normal:
|
case SampleMusicPreviewMode_Normal:
|
||||||
case SampleMusicPreviewMode_LastSong: // fall through
|
case SampleMusicPreviewMode_LastSong: // fall through
|
||||||
// play the sample music
|
// play the sample music
|
||||||
m_sSampleMusicToPlay = pSong->GetMusicPath();
|
m_sSampleMusicToPlay = pSong->GetPreviewMusicPath();
|
||||||
m_pSampleMusicTimingData = &pSong->m_SongTiming;
|
m_pSampleMusicTimingData = &pSong->m_SongTiming;
|
||||||
m_fSampleStartSeconds = pSong->m_fMusicSampleStartSeconds;
|
m_fSampleStartSeconds = pSong->GetPreviewStartSeconds();
|
||||||
m_fSampleLengthSeconds = pSong->m_fMusicSampleLengthSeconds;
|
m_fSampleLengthSeconds = pSong->m_fMusicSampleLengthSeconds;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -1477,6 +1477,26 @@ RString Song::GetPreviewVidPath() const
|
|||||||
return GetSongAssetPath( m_sPreviewVidFile, m_sSongDir );
|
return GetSongAssetPath( m_sPreviewVidFile, m_sSongDir );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RString Song::GetPreviewMusicPath() const
|
||||||
|
{
|
||||||
|
RString preview= GetSongDir() + "preview.ogg";
|
||||||
|
if(FILEMAN->DoesFileExist(preview))
|
||||||
|
{
|
||||||
|
return preview;
|
||||||
|
}
|
||||||
|
return GetMusicPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
float Song::GetPreviewStartSeconds() const
|
||||||
|
{
|
||||||
|
RString preview= GetSongDir() + "preview.ogg";
|
||||||
|
if(FILEMAN->DoesFileExist(preview))
|
||||||
|
{
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
return m_fMusicSampleStartSeconds;
|
||||||
|
}
|
||||||
|
|
||||||
RString Song::GetDisplayMainTitle() const
|
RString Song::GetDisplayMainTitle() const
|
||||||
{
|
{
|
||||||
if(!PREFSMAN->m_bShowNativeLanguage) return GetTranslitMainTitle();
|
if(!PREFSMAN->m_bShowNativeLanguage) return GetTranslitMainTitle();
|
||||||
|
|||||||
@@ -257,6 +257,8 @@ public:
|
|||||||
RString GetBackgroundPath() const;
|
RString GetBackgroundPath() const;
|
||||||
RString GetCDTitlePath() const;
|
RString GetCDTitlePath() const;
|
||||||
RString GetPreviewVidPath() const;
|
RString GetPreviewVidPath() const;
|
||||||
|
RString GetPreviewMusicPath() const;
|
||||||
|
float GetPreviewStartSeconds() const;
|
||||||
|
|
||||||
// For loading only:
|
// For loading only:
|
||||||
bool m_bHasMusic, m_bHasBanner, m_bHasBackground;
|
bool m_bHasMusic, m_bHasBanner, m_bHasBackground;
|
||||||
|
|||||||
Reference in New Issue
Block a user