- fix for counters slowness on psp

This commit is contained in:
wagic.the.homebrew
2011-07-30 14:29:12 +00:00
parent fe4b0a11e3
commit 78efba08b1
2 changed files with 16 additions and 13 deletions
+2
View File
@@ -28,6 +28,8 @@ struct CardGui: public PlayGuiObject
{ {
protected: protected:
static map<string, string>counterGraphics;
/* /*
** Tries to render the Big version of a card picture, backups to text version in case of failure ** Tries to render the Big version of a card picture, backups to text version in case of failure
*/ */
+14 -13
View File
@@ -22,6 +22,8 @@ const float CardGui::BigHeight = 285.0;
const float kWidthScaleFactor = 0.8f; const float kWidthScaleFactor = 0.8f;
map<string, string> CardGui::counterGraphics;
namespace namespace
{ {
inline float SineHelperFunction(const float& value) inline float SineHelperFunction(const float& value)
@@ -838,18 +840,19 @@ void CardGui::RenderCountersBig(MTGCard * mtgcard, const Pos& pos, int drawMode)
{ {
if (c->nb < 6) //we only render a counter's specific quad if there are 5 counters of this type or less. Otherwise we will use the generic one if (c->nb < 6) //we only render a counter's specific quad if there are 5 counters of this type or less. Otherwise we will use the generic one
{ {
string gfxRelativeName = "counters/"; if (counterGraphics.find(c->name) == counterGraphics.end())
gfxRelativeName.append(c->name);
gfxRelativeName.append(".png");
gfx = WResourceManager::Instance()->graphicsFile(gfxRelativeName);
if (fileExists(gfx.c_str()))
{ {
string gfxRelativeName = "counters/";
gfxRelativeName.append(c->name);
gfxRelativeName.append(".png");
string _gfx = WResourceManager::Instance()->graphicsFile(gfxRelativeName);
if (!fileExists(_gfx.c_str()))
_gfx = "";
counterGraphics[c->name] = _gfx;
}
gfx = counterGraphics[c->name];
if (gfx.size())
renderText = false; renderText = false;
}
else
{
gfx = "";
}
} }
if (renderText) if (renderText)
@@ -866,9 +869,7 @@ void CardGui::RenderCountersBig(MTGCard * mtgcard, const Pos& pos, int drawMode)
if (!gfx.size()) if (!gfx.size())
{ {
gfx = WResourceManager::Instance()->graphicsFile("counters/default.png"); gfx = "counters/default.png";
if (!fileExists(gfx.c_str()))
gfx = "";
} }
float x = pos.actX + (22 - BigWidth / 2) * pos.actZ; float x = pos.actX + (22 - BigWidth / 2) * pos.actZ;