diff --git a/projects/mtg/src/CardGui.cpp b/projects/mtg/src/CardGui.cpp index c8763102c..ba3105a23 100644 --- a/projects/mtg/src/CardGui.cpp +++ b/projects/mtg/src/CardGui.cpp @@ -58,9 +58,12 @@ void CardGui::Render() float cardScale = quad ? 40 / quad->mHeight : 1; float scale = actZ * cardScale; - JQuad* shadow = resources.GetQuad("shadow"); - shadow->SetColor(ARGB(static_cast(actA)/2,255,255,255)); - renderer->RenderQuad(shadow, actX + (actZ-1)*15, actY + (actZ-1)*15, actT, 28*actZ/16, 40*actZ/16); + JQuad* shadow = NULL; + if (actZ > 1) { + shadow = resources.GetQuad("shadow"); + shadow->SetColor(ARGB(static_cast(actA)/2,255,255,255)); + renderer->RenderQuad(shadow, actX + (actZ-1)*15, actY + (actZ-1)*15, actT, 28*actZ/16, 40*actZ/16); + } if (quad) { quad->SetColor(ARGB(static_cast(actA),255,255,255)); @@ -105,6 +108,7 @@ void CardGui::Render() } if (tc && !tc->canTarget(card)) { + if (!shadow) shadow = resources.GetQuad("shadow"); shadow->SetColor(ARGB(200,255,255,255)); renderer->RenderQuad(shadow, actX, actY, actT, (28*actZ + 1)/16 , 40*actZ/16); } diff --git a/projects/mtg/src/WCachedResource.cpp b/projects/mtg/src/WCachedResource.cpp index f13648953..3352aeb3f 100644 --- a/projects/mtg/src/WCachedResource.cpp +++ b/projects/mtg/src/WCachedResource.cpp @@ -8,6 +8,7 @@ #include #include "../include/GameOptions.h" #include "../include/WResourceManager.h" +#include //WResource @@ -277,6 +278,10 @@ bool WCachedTexture::Attempt(string filename, int submode, int & error){ if(submode & TEXTURE_SUB_5551) format = GU_PSM_5551; + if(!realname.size()){ + error = CACHE_ERROR_404; + return false; + } texture = JRenderer::GetInstance()->LoadTexture(realname.c_str(),TEX_TYPE_USE_VRAM,format); diff --git a/projects/mtg/src/WResourceManager.cpp b/projects/mtg/src/WResourceManager.cpp index 571bd93a8..afe184b70 100644 --- a/projects/mtg/src/WResourceManager.cpp +++ b/projects/mtg/src/WResourceManager.cpp @@ -965,22 +965,8 @@ cacheItem* WCache::AttemptNew(string filename, int submo cacheItem* item = NEW cacheItem; if(!item) { - //Try a few times to get an item. - for(int attempt=0;attempt::Get(string id, int style, int submod it = cache.find(lookup); //Well, we've found something... if(it != cache.end()) { - if(!it->second && (submode & CACHE_EXISTING)){ - mError = CACHE_ERROR_404; - } + if (!it->second) + mError = CACHE_ERROR_404; return it->second; //A hit. } } @@ -1154,15 +1139,12 @@ cacheItem * WCache::Get(string id, int style, int submod cacheItem * item = AttemptNew(id,submode); if(style == RETRIEVE_MANAGE){ + managed[lookup] = item; //Record a hit or miss. if(item){ - managed[lookup] = item; //Record a hit. item->deadbolt(); //Make permanent. } - else if(mError == CACHE_ERROR_404) - managed[lookup] = NULL; //File not found. Record a miss } else { - if(item || mError == CACHE_ERROR_404) cache[lookup] = item; }