* New interface.
* This breaks a lot of things. It is not feature-equivalent. It
  probably doesn't compile under windows and doesn't work on PSP.
* Damage is not resolved any more. This will have to be fixed.
* Blockers can't be ordered any more. This will have to be fixed.
* A lot of new art is included.
This commit is contained in:
jean.chalard
2009-08-22 05:59:43 +00:00
parent bf4262c0a0
commit 3349f974f1
101 changed files with 2424 additions and 2361 deletions

View File

@@ -2,21 +2,21 @@
#include "../include/ShopItem.h"
#include "../include/GameStateShop.h"
#include "../include/CardGui.h"
#include "../include/TexturesCache.h"
#include "../include/Translate.h"
#include <hge/hgedistort.h>
float ShopItems::_x1[] = { 40, 3, 23, 99,142,182, 90,132,177,106,163};
float ShopItems::_y1[] = {156,174,194,166,166,162,184,185,180,211,208};
float ShopItems::_x1[] = { 40, 3, 23, 99,142,182, 90,132,177,106,163};
float ShopItems::_y1[] = {156,174,194,166,166,162,184,185,180,211,208};
float ShopItems::_x2[] = { 44, 25, 64,128,171,211,121,165,209,143,200};
float ShopItems::_y2[] = {147,163,190,166,166,162,184,185,180,211,208};
float ShopItems::_x3[] = { 86, 47, 12, 85,133,177, 73,120,170, 88,153};
float ShopItems::_y3[] = {152,177,216,181,180,176,203,204,198,237,232};
float ShopItems::_x4[] = { 86, 66, 58,118,164,207,108,156,205,130,199};
float ShopItems::_x2[] = { 44, 25, 64,128,171,211,121,165,209,143,200};
float ShopItems::_y2[] = {147,163,190,166,166,162,184,185,180,211,208};
float ShopItems::_x3[] = { 86, 47, 12, 85,133,177, 73,120,170, 88,153};
float ShopItems::_y3[] = {152,177,216,181,180,176,203,204,198,237,232};
float ShopItems::_x4[] = { 86, 66, 58,118,164,207,108,156,205,130,199};
float ShopItems::_y4[] = {145,167,211,181,180,176,203,204,198,237,232};
ShopItem::ShopItem(int id, JLBFont *font, char* text, JQuad * _quad,JQuad * _thumb, float _xy[], bool hasFocus, int _price): JGuiObject(id), mFont(font), mText(text), quad(_quad), thumb(_thumb), price(_price)
@@ -31,16 +31,16 @@ ShopItem::ShopItem(int id, JLBFont *font, char* text, JQuad * _quad,JQuad * _thu
mScale = 1.0f;
mTargetScale = 1.0f;
mesh=NEW hgeDistortionMesh(2,2);
mesh->SetTexture(thumb->mTex);
float x0,y0,w0,h0;
thumb->GetTextureRect(&x0,&y0,&w0,&h0);
mesh->SetTextureRect(x0,y0,w0,h0);
mesh->Clear(ARGB(0xFF,0xFF,0xFF,0xFF));
mesh->SetDisplacement(0, 0, xy[0],xy[1], HGEDISP_NODE);
mesh->SetDisplacement(1, 0, xy[2] - w0,xy[3], HGEDISP_NODE);
mesh->SetDisplacement(0, 1,xy[4],xy[5]-h0, HGEDISP_NODE);
mesh->SetDisplacement(1, 1, xy[6]-w0,xy[7]-h0, HGEDISP_NODE);
mesh=NEW hgeDistortionMesh(2,2);
mesh->SetTexture(thumb->mTex);
float x0,y0,w0,h0;
thumb->GetTextureRect(&x0,&y0,&w0,&h0);
mesh->SetTextureRect(x0,y0,w0,h0);
mesh->Clear(ARGB(0xFF,0xFF,0xFF,0xFF));
mesh->SetDisplacement(0, 0, xy[0],xy[1], HGEDISP_NODE);
mesh->SetDisplacement(1, 0, xy[2] - w0,xy[3], HGEDISP_NODE);
mesh->SetDisplacement(0, 1,xy[4],xy[5]-h0, HGEDISP_NODE);
mesh->SetDisplacement(1, 1, xy[6]-w0,xy[7]-h0, HGEDISP_NODE);
mesh->SetColor(1,1,ARGB(255,100,100,100));
mesh->SetColor(0,1,ARGB(255,100,100,100));
mesh->SetColor(1,0,ARGB(255,100,100,100));
@@ -66,19 +66,20 @@ ShopItem::ShopItem(int id, JLBFont *font, int _cardid, float _xy[], bool hasFocu
quantity = 1 + (rand() % 4);
if (card->getRarity() == Constants::RARITY_L) quantity = 50;
quad = NULL;
thumb = card->getThumb();
if (!thumb) thumb = GameApp::CommonRes->GetQuad("back_thumb");
// thumb = card->getThumb();
// if (!thumb)
thumb = GameApp::CommonRes->GetQuad("back_thumb");
if (thumb){
mesh=NEW hgeDistortionMesh(2,2);
mesh->SetTexture(thumb->mTex);
float x0,y0,w0,h0;
thumb->GetTextureRect(&x0,&y0,&w0,&h0);
mesh->SetTextureRect(x0,y0,w0,h0);
mesh->Clear(ARGB(0xFF,0xFF,0xFF,0xFF));
mesh->SetDisplacement(0, 0, xy[0],xy[1], HGEDISP_NODE);
mesh->SetDisplacement(1, 0, xy[2] - w0,xy[3], HGEDISP_NODE);
mesh->SetDisplacement(0, 1,xy[4],xy[5]-h0, HGEDISP_NODE);
mesh->SetDisplacement(1, 1, xy[6]-w0,xy[7]-h0, HGEDISP_NODE);
mesh=NEW hgeDistortionMesh(2,2);
mesh->SetTexture(thumb->mTex);
float x0,y0,w0,h0;
thumb->GetTextureRect(&x0,&y0,&w0,&h0);
mesh->SetTextureRect(x0,y0,w0,h0);
mesh->Clear(ARGB(0xFF,0xFF,0xFF,0xFF));
mesh->SetDisplacement(0, 0, xy[0],xy[1], HGEDISP_NODE);
mesh->SetDisplacement(1, 0, xy[2] - w0,xy[3], HGEDISP_NODE);
mesh->SetDisplacement(0, 1,xy[4],xy[5]-h0, HGEDISP_NODE);
mesh->SetDisplacement(1, 1, xy[6]-w0,xy[7]-h0, HGEDISP_NODE);
mesh->SetColor(1,1,ARGB(255,100,100,100));
mesh->SetColor(0,1,ARGB(255,100,100,100));
mesh->SetColor(1,0,ARGB(255,100,100,100));
@@ -114,9 +115,8 @@ void ShopItem::Render(){
if (!quantity){
mFont->SetColor(ARGB(255,128,128,128));
}
if (card){
if (card){
if (nameCount){
char buffer[512];
sprintf(buffer, "%s (%i)", _(card->name).c_str(), nameCount );
@@ -136,7 +136,7 @@ void ShopItem::Render(){
renderer->FillPolygon(xs,ys,4,ARGB(200,0,0,0));
x0 = mX + 230 -30;
mFont->DrawString(mText.c_str(), x0, mY + 8,JGETEXT_RIGHT);
}else{
float xs[] = {mX-5, mX-5, mX-5+230,mX-5+230,};
float ys[] = {mY-5,mY-5+35,mY-5+17,mY-5+19} ;
@@ -153,14 +153,12 @@ void ShopItem::Render(){
//NOTHING
}
if (mHasFocus){
if (card){
quad = card->getQuad();
}
if (card) quad = cache.getQuad(card);
if (quad){
quad->SetColor(ARGB(255,255,255,255));
renderer->RenderQuad(quad,SCREEN_WIDTH/2 + 50,5,0, 0.9f,0.9f);
}else{
if (card) CardGui::alternateRender(card,NULL,SCREEN_WIDTH/2 + 100 + 20,133,0, 0.9f);
// if (card) CardGui::alternateRender(card,NULL,SCREEN_WIDTH/2 + 100 + 20,133,0, 0.9f);
}
mFont->DrawString(mText.c_str(), 100, SCREEN_HEIGHT - 30);
}
@@ -336,7 +334,7 @@ void ShopItems::ButtonPressed(int controllerId, int controlId){
tempDeck->addRandomCards(1, sets,1,rare_or_mythic);
tempDeck->addRandomCards(3, sets,1,Constants::RARITY_U);
tempDeck->addRandomCards(11, sets,1,Constants::RARITY_C);
playerdata->collection->add(tempDeck);
myCollection->Add(tempDeck);
@@ -344,7 +342,7 @@ void ShopItems::ButtonPressed(int controllerId, int controlId){
ShopItem * si = ((ShopItem *)mObjects[j]);
si->updateCount(myCollection);
}
int i = 0;
for (map<int,int>::iterator it = tempDeck->cards.begin(); it!=tempDeck->cards.end(); it++){
MTGCard * c = tempDeck->getCardById(it->first);