use ActorUtil::GetAttrPath
This commit is contained in:
@@ -23,14 +23,10 @@ void ActorSound::LoadFromNode( const RString& sDir, const XNode* pNode )
|
||||
Actor::LoadFromNode( sDir, pNode );
|
||||
|
||||
RString sFile;
|
||||
if( pNode->GetAttrValue("File", sFile) || pNode->GetAttrValue("Path", sFile) ) /* Path deprecated */
|
||||
if( ActorUtil::GetAttrPath(pNode, "File", sFile) || ActorUtil::GetAttrPath(pNode, "Path", sFile) ) /* Path deprecated */
|
||||
{
|
||||
FixSlashesInPlace( sFile );
|
||||
|
||||
RString sNewPath = sFile.Left(1) == "/"? sFile : sDir+sFile;
|
||||
ActorUtil::ResolvePath( sNewPath, sDir );
|
||||
|
||||
Load( sNewPath );
|
||||
ActorUtil::ResolvePath( sFile, sDir );
|
||||
Load( sFile );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,14 +44,10 @@ bool DifficultyIcon::Load( RString sPath )
|
||||
void DifficultyIcon::LoadFromNode( const RString& sDir, const XNode* pNode )
|
||||
{
|
||||
RString sFile;
|
||||
if( !pNode->GetAttrValue( "File", sFile ) )
|
||||
if( !ActorUtil::GetAttrPath(pNode, "File", sFile) )
|
||||
RageException::Throw( "MeterDisplay in \"%s\" missing \"File\" attribute.", sDir.c_str() );
|
||||
|
||||
if( !sFile.empty() && sFile[0] != '/' )
|
||||
{
|
||||
sFile = sDir + sFile;
|
||||
ActorUtil::ResolvePath( sFile, sDir );
|
||||
}
|
||||
ActorUtil::ResolvePath( sFile, sDir );
|
||||
|
||||
Load( sFile );
|
||||
|
||||
|
||||
@@ -28,12 +28,9 @@ void HoldJudgment::Load( const RString &sPath )
|
||||
void HoldJudgment::LoadFromNode( const RString& sDir, const XNode* pNode )
|
||||
{
|
||||
RString sFile;
|
||||
if( !pNode->GetAttrValue("File", sFile) )
|
||||
if( ActorUtil::GetAttrPath(pNode, "File", sFile) )
|
||||
RageException::Throw( "HoldJudgment node in \"%s\" is missing the attribute \"File\"", sDir.c_str() );
|
||||
|
||||
if( sFile.Left(1) != "/" )
|
||||
sFile = sDir+sFile;
|
||||
|
||||
CollapsePath( sFile );
|
||||
|
||||
Load( sFile );
|
||||
|
||||
@@ -19,11 +19,8 @@ Judgment::Judgment()
|
||||
void Judgment::LoadFromNode( const RString& sDir, const XNode* pNode )
|
||||
{
|
||||
RString sFile;
|
||||
if( pNode->GetAttrValue("File", sFile) )
|
||||
if( ActorUtil::GetAttrPath(pNode, "File", sFile) )
|
||||
{
|
||||
if( sFile.Left(1) != "/" )
|
||||
sFile = sDir+sFile;
|
||||
|
||||
CollapsePath( sFile );
|
||||
LoadNormal( sFile );
|
||||
}
|
||||
|
||||
@@ -40,14 +40,10 @@ void MeterDisplay::LoadFromNode( const RString& sDir, const XNode* pNode )
|
||||
|
||||
{
|
||||
RString sStreamPath;
|
||||
if( !pNode->GetAttrValue( "StreamPath", sStreamPath ) )
|
||||
if( !ActorUtil::GetAttrPath(pNode, "StreamPath", sStreamPath) )
|
||||
RageException::Throw( "MeterDisplay in \"%s\" is missing the \"StreamPath\" attribute.", sDir.c_str() );
|
||||
|
||||
if( !sStreamPath.empty() && sStreamPath[0] != '/' )
|
||||
{
|
||||
sStreamPath = sDir + sStreamPath;
|
||||
ActorUtil::ResolvePath( sStreamPath, sDir );
|
||||
}
|
||||
ActorUtil::ResolvePath( sStreamPath, sDir );
|
||||
|
||||
m_sprStream.Load( sStreamPath );
|
||||
m_sprStream->SetZoomX( m_fStreamWidth / m_sprStream->GetUnzoomedWidth() );
|
||||
|
||||
+3
-11
@@ -111,20 +111,12 @@ void Model::LoadFromNode( const RString& sDir, const XNode* pNode )
|
||||
Actor::LoadFromNode( sDir, pNode );
|
||||
|
||||
RString s1, s2, s3;
|
||||
pNode->GetAttrValue( "Meshes", s1 );
|
||||
pNode->GetAttrValue( "Materials", s2 );
|
||||
pNode->GetAttrValue( "Bones", s3 );
|
||||
ActorUtil::GetAttrPath( pNode, "Meshes", s1 );
|
||||
ActorUtil::GetAttrPath( pNode, "Materials", s2 );
|
||||
ActorUtil::GetAttrPath( pNode, "Bones", s3 );
|
||||
if( !s1.empty() || !s2.empty() || !s3.empty() )
|
||||
{
|
||||
ASSERT( !s1.empty() && !s2.empty() && !s3.empty() );
|
||||
|
||||
if( s1.Left(1) != "/" )
|
||||
s1 = sDir+s1;
|
||||
if( s2.Left(1) != "/" )
|
||||
s2 = sDir+s2;
|
||||
if( s3.Left(1) != "/" )
|
||||
s3 = sDir+s3;
|
||||
|
||||
LoadPieces( s1, s2, s3 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,11 +109,7 @@ void Sprite::Load( RageTextureID ID )
|
||||
void Sprite::LoadFromNode( const RString& sDir, const XNode* pNode )
|
||||
{
|
||||
RString sPath;
|
||||
if( pNode->GetAttrValue( "Texture", sPath ) )
|
||||
{
|
||||
bool bIsAbsolutePath = sPath.Left(1) == "/";
|
||||
sPath = bIsAbsolutePath ? sPath : sDir+sPath;
|
||||
}
|
||||
ActorUtil::GetAttrPath( pNode, "Texture", sPath );
|
||||
|
||||
if( !sPath.empty() )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user