Merge branch 'master' of https://github.com/stepmania/stepmania
This commit is contained in:
+33
-4
@@ -200,14 +200,23 @@ void NoteSkinManager::GetNoteSkinNames( const Game* pGame, vector<RString> &AddT
|
||||
GetAllNoteSkinNamesForGame( pGame, AddTo );
|
||||
}
|
||||
|
||||
bool NoteSkinManager::NoteSkinNameInList(const RString name, vector<RString> name_list)
|
||||
{
|
||||
for(size_t i= 0; i < name_list.size(); ++i)
|
||||
{
|
||||
if(0 == stricmp(name, name_list[i]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NoteSkinManager::DoesNoteSkinExist( const RString &sSkinName )
|
||||
{
|
||||
vector<RString> asSkinNames;
|
||||
GetAllNoteSkinNamesForGame( GAMESTATE->m_pCurGame, asSkinNames );
|
||||
for( unsigned i=0; i<asSkinNames.size(); i++ )
|
||||
if( 0==stricmp(sSkinName, asSkinNames[i]) )
|
||||
return true;
|
||||
return false;
|
||||
return NoteSkinNameInList(sSkinName, asSkinNames);
|
||||
}
|
||||
|
||||
bool NoteSkinManager::DoNoteSkinsExistForGame( const Game *pGame )
|
||||
@@ -217,6 +226,26 @@ bool NoteSkinManager::DoNoteSkinsExistForGame( const Game *pGame )
|
||||
return !asSkinNames.empty();
|
||||
}
|
||||
|
||||
RString NoteSkinManager::GetDefaultNoteSkinName()
|
||||
{
|
||||
RString name= THEME->GetMetric("Common", "DefaultNoteSkinName");
|
||||
vector<RString> all_names;
|
||||
GetAllNoteSkinNamesForGame(GAMESTATE->m_pCurGame, all_names);
|
||||
if(all_names.empty())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
if(!NoteSkinNameInList(name, all_names))
|
||||
{
|
||||
name= "default";
|
||||
if(!NoteSkinNameInList(name, all_names))
|
||||
{
|
||||
name= all_names[1];
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
void NoteSkinManager::GetAllNoteSkinNamesForGame( const Game *pGame, vector<RString> &AddTo )
|
||||
{
|
||||
if( pGame == m_pCurGame )
|
||||
|
||||
@@ -20,8 +20,10 @@ public:
|
||||
void RefreshNoteSkinData( const Game* game );
|
||||
void GetNoteSkinNames( const Game* game, vector<RString> &AddTo );
|
||||
void GetNoteSkinNames( vector<RString> &AddTo ); // looks up current const Game* in GAMESTATE
|
||||
bool NoteSkinNameInList(const RString name, vector<RString> name_list);
|
||||
bool DoesNoteSkinExist( const RString &sNoteSkin ); // looks up current const Game* in GAMESTATE
|
||||
bool DoNoteSkinsExistForGame( const Game *pGame );
|
||||
RString GetDefaultNoteSkinName(); // looks up current const Game* in GAMESTATE
|
||||
|
||||
void SetCurrentNoteSkin( const RString &sNoteSkin ) { m_sCurrentNoteSkin = sNoteSkin; }
|
||||
const RString &GetCurrentNoteSkin() { return m_sCurrentNoteSkin; }
|
||||
|
||||
@@ -376,7 +376,11 @@ bool PlayerOptions::FromOneModString( const RString &sOneMod, RString &sErrorOut
|
||||
m_fTimeSpacing = 0;
|
||||
}
|
||||
|
||||
else if( sBit == "clearall" ) Init();
|
||||
else if( sBit == "clearall" )
|
||||
{
|
||||
Init();
|
||||
m_sNoteSkin= NOTESKIN->GetDefaultNoteSkinName();
|
||||
}
|
||||
else if( sBit == "resetspeed" )
|
||||
{
|
||||
/* level is set to the values from Init() because all speed related
|
||||
|
||||
@@ -72,7 +72,7 @@ void RollingNumbers::DrawPrimitives()
|
||||
|
||||
void RollingNumbers::Update( float fDeltaTime )
|
||||
{
|
||||
if(m_fCurrentNumber != m_fTargetNumber && m_fScoreVelocity > 0)
|
||||
if(m_fCurrentNumber != m_fTargetNumber)
|
||||
{
|
||||
fapproach( m_fCurrentNumber, m_fTargetNumber, fabsf(m_fScoreVelocity) * fDeltaTime );
|
||||
UpdateText();
|
||||
|
||||
@@ -94,6 +94,10 @@ void ScreenGameplaySyncMachine::HandleScreenMessage( const ScreenMessage SM )
|
||||
|
||||
if( SM == SM_GoToPrevScreen || SM == SM_GoToNextScreen )
|
||||
{
|
||||
FOREACH_PlayerNumber( pn )
|
||||
{
|
||||
GAMESTATE->m_pCurSteps[pn].Set( NULL );
|
||||
}
|
||||
GAMESTATE->m_PlayMode.Set( PlayMode_Invalid );
|
||||
GAMESTATE->SetCurrentStyle( NULL );
|
||||
GAMESTATE->m_pCurSong.Set( NULL );
|
||||
|
||||
+40
-2
@@ -864,12 +864,20 @@ RString ThemeManager::GetMetricsIniPath( const RString &sThemeName )
|
||||
bool ThemeManager::HasMetric( const RString &sMetricsGroup, const RString &sValueName )
|
||||
{
|
||||
RString sThrowAway;
|
||||
if(sMetricsGroup == "" || sValueName == "")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return GetMetricRawRecursive( g_pLoadedThemeData->iniMetrics, sMetricsGroup, sValueName, sThrowAway );
|
||||
}
|
||||
|
||||
bool ThemeManager::HasString( const RString &sMetricsGroup, const RString &sValueName )
|
||||
{
|
||||
RString sThrowAway;
|
||||
if(sMetricsGroup == "" || sValueName == "")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return GetMetricRawRecursive( g_pLoadedThemeData->iniStrings, sMetricsGroup, sValueName, sThrowAway );
|
||||
}
|
||||
|
||||
@@ -1045,6 +1053,11 @@ LuaReference ThemeManager::GetMetricR( const RString &sMetricsGroup, const RStri
|
||||
|
||||
void ThemeManager::PushMetric( Lua *L, const RString &sMetricsGroup, const RString &sValueName )
|
||||
{
|
||||
if(sMetricsGroup == "" || sValueName == "")
|
||||
{
|
||||
LuaHelpers::ReportScriptError("PushMetric: Attempted to fetch metric with empty group name or empty value name.");
|
||||
return;
|
||||
}
|
||||
RString sValue = GetMetricRaw( g_pLoadedThemeData->iniMetrics, sMetricsGroup, sValueName );
|
||||
|
||||
RString sName = ssprintf( "%s::%s", sMetricsGroup.c_str(), sValueName.c_str() );
|
||||
@@ -1179,6 +1192,11 @@ static RString PseudoLocalize( RString s )
|
||||
RString ThemeManager::GetString( const RString &sMetricsGroup, const RString &sValueName_ )
|
||||
{
|
||||
RString sValueName = sValueName_;
|
||||
if(sMetricsGroup == "" || sValueName == "")
|
||||
{
|
||||
LuaHelpers::ReportScriptError("PushMetric: Attempted to fetch metric with empty group name or empty value name.");
|
||||
return "";
|
||||
}
|
||||
|
||||
// TODO: Handle escaping = with \=
|
||||
DEBUG_ASSERT( sValueName.find('=') == sValueName.npos );
|
||||
@@ -1267,9 +1285,29 @@ public:
|
||||
static int ReloadMetrics( T* p, lua_State *L ) { p->ReloadMetrics(); return 0; }
|
||||
|
||||
static int HasMetric( T* p, lua_State *L ) { lua_pushboolean(L, p->HasMetric(SArg(1),SArg(2))); return 1; }
|
||||
static int GetMetric( T* p, lua_State *L ) { p->PushMetric( L, SArg(1),SArg(2) ); return 1; }
|
||||
static int GetMetric( T* p, lua_State *L )
|
||||
{
|
||||
RString group= SArg(1);
|
||||
RString name= SArg(2);
|
||||
if(group == "" || name == "")
|
||||
{
|
||||
luaL_error(L, "Cannot fetch metric with empty group name or empty value name.");
|
||||
}
|
||||
p->PushMetric(L, group, name);
|
||||
return 1;
|
||||
}
|
||||
static int HasString( T* p, lua_State *L ) { lua_pushboolean(L, p->HasString(SArg(1),SArg(2))); return 1; }
|
||||
static int GetString( T* p, lua_State *L ) { lua_pushstring(L, p->GetString(SArg(1),SArg(2)) ); return 1; }
|
||||
static int GetString( T* p, lua_State *L )
|
||||
{
|
||||
RString group= SArg(1);
|
||||
RString name= SArg(2);
|
||||
if(group == "" || name == "")
|
||||
{
|
||||
luaL_error(L, "Cannot fetch string with empty group name or empty value name.");
|
||||
}
|
||||
lua_pushstring(L, p->GetString(group, name));
|
||||
return 1;
|
||||
}
|
||||
static int GetPathInfoB( T* p, lua_State *L )
|
||||
{
|
||||
ThemeManager::PathInfo pi;
|
||||
|
||||
Reference in New Issue
Block a user