Jeck - Restored cache resets between game states, fixed minor issue with deck editor displaying the wrong first 7 cards when starting to edit a deck.

This commit is contained in:
wagic.jeck
2009-09-27 00:50:30 +00:00
parent 74170e9ee9
commit 28cb659a2e
2 changed files with 19 additions and 15 deletions
+14 -11
View File
@@ -586,17 +586,18 @@ void GameStateDeckViewer::renderCard(int id, float rotation){
JQuad * quad = NULL; JQuad * quad = NULL;
int showName = 0; int showName = 0;
#ifdef DEBUG_CACHE int cacheError = CACHE_ERROR_NONE;
quad = resources.RetrieveCard(card,RETRIEVE_NORMAL);
#else if(!options[Options::DISABLECARDS].number){
quad = resources.RetrieveCard(card,RETRIEVE_EXISTING); quad = resources.RetrieveCard(card,RETRIEVE_EXISTING);
#endif cacheError = resources.RetrieveError();
if (!quad && resources.RetrieveError() != CACHE_ERROR_404){ if (!quad && cacheError != CACHE_ERROR_404){
if(last_user_activity > (abs(2-id) + 1)* NO_USER_ACTIVITY_SHOWCARD_DELAY) if(last_user_activity > (abs(2-id) + 1)* NO_USER_ACTIVITY_SHOWCARD_DELAY)
quad = resources.RetrieveCard(card); quad = resources.RetrieveCard(card);
else{ else{
quad = backQuad; quad = backQuad;
showName = 1; showName = 1;
}
} }
} }
@@ -723,6 +724,8 @@ int GameStateDeckViewer::loadDeck(int deckid){
} }
current = myDeck->getNext(current); current = myDeck->getNext(current);
} }
currentCard = NULL;
loadIndexes();
return 1; return 1;
} }
+4 -3
View File
@@ -814,20 +814,21 @@ void WResourceManager::CacheForState(int state){
else else
textureWCache.Resize(SMALL_CACHE_LIMIT,SMALL_CACHE_ITEMS); textureWCache.Resize(SMALL_CACHE_LIMIT,SMALL_CACHE_ITEMS);
sampleWCache.Resize(SMALL_CACHE_LIMIT,MAX_CACHED_SAMPLES); sampleWCache.Resize(SMALL_CACHE_LIMIT,MAX_CACHED_SAMPLES);
//ClearUnlocked();
break; break;
//Deck editor and shop are entirely cache safe, so give it near infinite resources. //Deck editor and shop are entirely cache safe, so give it near infinite resources.
case GAME_STATE_SHOP: case GAME_STATE_SHOP:
case GAME_STATE_DECK_VIEWER: case GAME_STATE_DECK_VIEWER:
textureWCache.Resize(HUGE_CACHE_LIMIT,HUGE_CACHE_ITEMS); textureWCache.Resize(HUGE_CACHE_LIMIT,HUGE_CACHE_ITEMS);
//ClearUnlocked();
break; break;
//Anything unknown, use large cache. //Anything unknown, use large cache.
default: default:
textureWCache.Resize(LARGE_CACHE_LIMIT,LARGE_CACHE_ITEMS); textureWCache.Resize(LARGE_CACHE_LIMIT,LARGE_CACHE_ITEMS);
//Cleanup();
break; break;
} }
//Switching game states clears the cache on PSP.
ClearUnlocked();
#endif #endif
} }