Added Sprite::NewBlankSprite for use by NoteSkinManager. Removed default texture loading from Sprite::Sprite. Should fix problems with white banners and garbage on videos.

This commit is contained in:
Kyzentun
2014-08-02 00:38:40 -07:00
committed by Jonathan Payne
parent 2e43a70752
commit 2134151b90
3 changed files with 17 additions and 6 deletions
+3 -3
View File
@@ -438,14 +438,14 @@ Actor *NoteSkinManager::LoadActor( const RString &sButton, const RString &sEleme
if( !PushActorTemplate(L, sButton, sElement, bSpriteOnly) )
{
// ActorUtil will warn about the error
return new Sprite;
return Sprite::NewBlankSprite();
}
auto_ptr<XNode> pNode( XmlFileUtil::XNodeFromTable(L) );
if( pNode.get() == NULL )
{
// XNode will warn about the error
return new Sprite;
return Sprite::NewBlankSprite();
}
LUA->Release( L );
@@ -460,7 +460,7 @@ Actor *NoteSkinManager::LoadActor( const RString &sButton, const RString &sEleme
{
LuaHelpers::ReportScriptErrorFmt("%s: %s %s must be a Sprite", m_sCurrentNoteSkin.c_str(), sButton.c_str(), sElement.c_str());
delete pRet;
return new Sprite;
return Sprite::NewBlankSprite();
}
}
+11 -3
View File
@@ -32,11 +32,19 @@ Sprite::Sprite()
m_fTexCoordVelocityX = 0;
m_fTexCoordVelocityY = 0;
// An uninitialized sprite should be valid to display. -Kyz
Load(TEXTUREMAN->GetDefaultTextureID());
}
// NoteSkinManager needs a sprite with a texture set to return in cases where
// the noteskin doesn't return a valid actor. I would really prefer to make
// Sprite::Sprite load the default texture, but that causes problems for
// banners on ScreenSelectMusic and videos on ScreenGameplay. So rather than
// dig through either of those, NoteSkinManager uses this special function.
Sprite* Sprite::NewBlankSprite()
{
Sprite* news= new Sprite;
news->Load(TEXTUREMAN->GetDefaultTextureID());
return news;
}
Sprite::~Sprite()
{
+3
View File
@@ -15,6 +15,9 @@ public:
Sprite( const Sprite &cpy );
virtual ~Sprite();
// See explanation in source.
static Sprite* NewBlankSprite();
virtual void InitState();
void LoadFromNode( const XNode* pNode );