show front face of facedown cards in VPicture when player can legitmately look at them

This commit is contained in:
myk
2013-03-29 17:47:02 +00:00
parent c0a8ca9e95
commit 780ed417c7
3 changed files with 23 additions and 7 deletions

View File

@@ -8427,6 +8427,14 @@ public class Card extends GameEntity implements Comparable<Card> {
return this.getCharacteristics().getImageKey();
}
public final String getImageKey(CardCharacteristicName state) {
CardCharacteristics characteristics = characteristicsMap.get(state);
if (null == characteristics) {
return null;
}
return characteristics.getImageKey();
}
/**
* <p>
* Setter for the field <code>evoked</code>.

View File

@@ -99,21 +99,29 @@ public class ImageCache {
}
/**
* retrieve an image from the cache. returns null if the image is not found in the cache
* retrieve an image from the cache. returns a default image if the image is not found in the cache
* and cannot be loaded from disk. pass -1 for width and/or height to avoid resizing in that dimension.
*/
public static BufferedImage getImage(Card card, int width, int height) {
return getImage(card, width, height, false);
}
/**
* retrieve an image from the cache. returns a default image if the image is not found in the cache
* and cannot be loaded from disk. pass -1 for width and/or height to avoid resizing in that dimension.
*/
public static BufferedImage getImage(Card card, int width, int height, boolean ignoreFaceDown) {
final String key;
if (!card.canBeShownTo(Singletons.getControl().getPlayer()) || card.isFaceDown()) {
if (!card.canBeShownTo(Singletons.getControl().getPlayer()) || (!ignoreFaceDown && card.isFaceDown())) {
key = TOKEN_PREFIX + NewConstants.CACHE_MORPH_IMAGE_FILE;
} else {
key = card.getImageKey();
key = ignoreFaceDown ? card.getImageKey(CardCharacteristicName.Original) : card.getImageKey();
}
return scaleImage(key, width, height, true);
}
/**
* retrieve an image from the cache. returns null if the image is not found in the cache
* retrieve an image from the cache. returns a default image if the image is not found in the cache
* and cannot be loaded from disk. pass -1 for width and/or height to avoid resizing in that dimension.
*/
public static BufferedImage getImage(InventoryItem ii, int width, int height) {

View File

@@ -87,8 +87,8 @@ public final class CardPicturePanel extends JPanel {
image = ImageCache.getImage((InventoryItem)this.displayed, this.getWidth() - i.left - i.right, this.getHeight()
- i.top - i.bottom);
} else if (displayed instanceof Card) {
image = ImageCache.getImage((Card)this.displayed, this.getWidth() - i.left - i.right - 2, this.getHeight() - i.top
- i.bottom - 2);
image = ImageCache.getImage((Card)this.displayed,
this.getWidth() - i.left - i.right - 2, this.getHeight() - i.top - i.bottom - 2, true);
}
if (image != this.currentImage) {