From d22b7b5e3710b62ffb6c513564b943ebd15d77c2 Mon Sep 17 00:00:00 2001 From: "wagic.the.homebrew@gmail.com" Date: Sat, 23 Jan 2010 03:35:43 +0000 Subject: [PATCH] Erwan -some fixes for HQ cards support --- projects/mtg/include/WResourceManager.h | 2 +- projects/mtg/src/CardGui.cpp | 4 ++++ projects/mtg/src/GameApp.cpp | 4 ++-- projects/mtg/src/GameStateDeckViewer.cpp | 3 ++- projects/mtg/src/ShopItem.cpp | 8 ++++++-- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/projects/mtg/include/WResourceManager.h b/projects/mtg/include/WResourceManager.h index 5bca99684..a830ce237 100644 --- a/projects/mtg/include/WResourceManager.h +++ b/projects/mtg/include/WResourceManager.h @@ -7,7 +7,7 @@ #include "MTGCard.h" #include "WCachedResource.h" -#define HUGE_CACHE_LIMIT 6000000 // Size of the cache for Windows and Linux +#define HUGE_CACHE_LIMIT 20000000 // Size of the cache for Windows and Linux #define SAMPLES_CACHE_SIZE 1500000 // Size in bytes of the cached samples #define PSI_CACHE_SIZE 500000 // Size in bytes of the cahed particles #define TEXTURES_CACHE_MINSIZE 2000000 // Minimum size of the cache on the PSP. The program should complain if the cache ever gets smaller than this diff --git a/projects/mtg/src/CardGui.cpp b/projects/mtg/src/CardGui.cpp index 06aad9f74..cbfbeea5b 100644 --- a/projects/mtg/src/CardGui.cpp +++ b/projects/mtg/src/CardGui.cpp @@ -54,6 +54,10 @@ void CardGui::Render() bool alternate = true; JQuad * quad = resources.RetrieveCard(card,CACHE_THUMB); +#if defined (WIN32) || defined (LINUX) + //On pcs we render the big image if the thumbnail is not available + if (!quad) quad = resources.RetrieveCard(card); +#endif if (quad) alternate = false; else quad = alternateThumbQuad(card); diff --git a/projects/mtg/src/GameApp.cpp b/projects/mtg/src/GameApp.cpp index db0472798..9a6613b51 100644 --- a/projects/mtg/src/GameApp.cpp +++ b/projects/mtg/src/GameApp.cpp @@ -115,8 +115,8 @@ void GameApp::Create() for (int i = sizeof(manaIcons)/sizeof(manaIcons[0]) - 1; i >= 0; --i) manaIcons[i]->SetHotSpot(16,16); resources.RetrieveTexture("back.jpg",RETRIEVE_MANAGE); - JQuad * jq = resources.RetrieveQuad("back.jpg", 0, 0, 200, 285, "back",RETRIEVE_MANAGE); - jq->SetHotSpot(100, 145); + JQuad * jq = resources.RetrieveQuad("back.jpg", 0, 0, 0, 0, "back",RETRIEVE_MANAGE); + jq->SetHotSpot(jq->mWidth/2, jq->mHeight/2); resources.RetrieveTexture("back_thumb.jpg",RETRIEVE_MANAGE); resources.RetrieveQuad("back_thumb.jpg", 0, 0, MTG_MINIIMAGE_WIDTH, MTG_MINIIMAGE_HEIGHT, "back_thumb",RETRIEVE_MANAGE); diff --git a/projects/mtg/src/GameStateDeckViewer.cpp b/projects/mtg/src/GameStateDeckViewer.cpp index 51d3bfef8..f77d566a2 100644 --- a/projects/mtg/src/GameStateDeckViewer.cpp +++ b/projects/mtg/src/GameStateDeckViewer.cpp @@ -1223,7 +1223,8 @@ void GameStateDeckViewer::renderCard(int id, float rotation){ int quadAlpha = alpha; if ( !displayed_deck->cards[card]) quadAlpha /=2; quad->SetColor(ARGB(mAlpha,quadAlpha,quadAlpha,quadAlpha)); - JRenderer::GetInstance()->RenderQuad(quad, x , y , 0.0f,scale,scale); + float _scale = scale *(285 / quad->mHeight); + JRenderer::GetInstance()->RenderQuad(quad, x , y , 0.0f,_scale,_scale); if (showName){ char buffer[4096]; sprintf(buffer, "%s", _(card->data->getName()).c_str()); diff --git a/projects/mtg/src/ShopItem.cpp b/projects/mtg/src/ShopItem.cpp index 52981d76f..d33d10876 100644 --- a/projects/mtg/src/ShopItem.cpp +++ b/projects/mtg/src/ShopItem.cpp @@ -72,7 +72,10 @@ ShopItem::ShopItem(int id, JLBFont *font, int _cardid, float _xy[], bool hasFocu quad = NULL; thumb = resources.RetrieveCard(card,RETRIEVE_LOCK,TEXTURE_SUB_THUMB); - +#if defined (WIN32) || defined (LINUX) + //On pcs we render the big image if the thumbnail is not available + if (!thumb) thumb = resources.RetrieveCard(card,RETRIEVE_LOCK); +#endif if (!thumb) thumb = CardGui::alternateThumbQuad(card); else @@ -147,8 +150,9 @@ void ShopItem::Render(){ if (mHasFocus){ if (card) quad = resources.RetrieveCard(card); if (quad){ + float scale = 0.9 * 285/ quad->mHeight; quad->SetColor(ARGB(255,255,255,255)); - renderer->RenderQuad(quad,SCREEN_WIDTH - 105,SCREEN_HEIGHT/2 - 5,0, 0.9f,0.9f); + renderer->RenderQuad(quad,SCREEN_WIDTH - 105,SCREEN_HEIGHT/2 - 5,0, scale,scale); }else{ if (card) CardGui::alternateRender(card,Pos(SCREEN_WIDTH - 105,SCREEN_HEIGHT/2 - 5,0.9f* 285/250, 0,255));