Some minor tweaks to make the image prefetching feel less flickery : when a card goes from a player's library into their hand, trigger a prefetch of the image. Also do the same thing when the AI decides on what card to play and creates an action. The idea being, new cards in play will probably want to be viewed by the player (and in the case of the AI playing a spell, we automatically show the image during the interrupt window before it comes into play). This makes for a much smoother gameplay - we have to get the image at some point anyway, and by doing it before we get to the render call, we no longer have the back card image pop up briefly.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "PrecompiledHeader.h"
|
||||
|
||||
#include "CardSelectorSingleton.h"
|
||||
#include "MTGGameZones.h"
|
||||
#include "Player.h"
|
||||
#include "WEvent.h"
|
||||
@@ -237,6 +238,23 @@ void MTGPlayerCards::drawFromLibrary()
|
||||
}
|
||||
MTGCardInstance * toMove = library->cards[library->nb_cards - 1];
|
||||
library->lastCardDrawn = toMove;
|
||||
|
||||
// useability tweak - assume that the user is probably going to want to see the new card,
|
||||
// so prefetch it.
|
||||
|
||||
// if we're not in text mode, always get the thumb
|
||||
if (CardSelectorSingleton::Instance()->GetDrawMode() != DrawMode::kText)
|
||||
{
|
||||
DebugTrace("Prefetching AI card going into play: " << toMove->getImageName());
|
||||
WResourceManager::Instance()->RetrieveCard(toMove, RETRIEVE_THUMB);
|
||||
|
||||
// also cache the large image if we're using kNormal mode
|
||||
if (CardSelectorSingleton::Instance()->GetDrawMode() == DrawMode::kNormal)
|
||||
{
|
||||
WResourceManager::Instance()->RetrieveCard(toMove);
|
||||
}
|
||||
}
|
||||
|
||||
putInZone(toMove, library, hand);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user