Erwan
- fix for issue 108 (mana icon disappears) - potential fix for issue 110 (victory bonus texts). Need to check - Fix for issue 100. A better solution would be to "stretch" the cards in hand the way it is done for the rest of the game, but this will do for now as it is a border case - Fix for issue 55. We'll remove 2 players mode for now, and put it back when/if we get network play
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
#include "../include/Translate.h"
|
#include "../include/Translate.h"
|
||||||
#include "../include/MTGDefinitions.h"
|
#include "../include/MTGDefinitions.h"
|
||||||
#include <Vector2D.h>
|
#include <Vector2D.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
const float CardGui::Width = 28.0;
|
const float CardGui::Width = 28.0;
|
||||||
@@ -89,9 +90,9 @@ void CardGui::Render()
|
|||||||
icon = resources.GetQuad("c_blue");
|
icon = resources.GetQuad("c_blue");
|
||||||
|
|
||||||
if (icon){
|
if (icon){
|
||||||
icon->SetHotSpot(16,16);
|
|
||||||
icon->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));
|
icon->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));
|
||||||
renderer->RenderQuad(icon, actX, actY, 0);
|
renderer->RenderQuad(icon, actX, actY, 0);
|
||||||
|
icon->SetColor(ARGB(255,255,255,255)); //Putting color back as this quad is shared
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -149,6 +150,11 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
|||||||
// Draw the "unknown" card model
|
// Draw the "unknown" card model
|
||||||
JRenderer * renderer = JRenderer::GetInstance();
|
JRenderer * renderer = JRenderer::GetInstance();
|
||||||
JQuad * q;
|
JQuad * q;
|
||||||
|
|
||||||
|
|
||||||
|
float x = pos.actX;
|
||||||
|
if (x < BigWidth / 2) x = BigWidth / 2;
|
||||||
|
|
||||||
int nb_colors = 0;
|
int nb_colors = 0;
|
||||||
for(int i=0;i<Constants::MTG_NB_COLORS;i++){
|
for(int i=0;i<Constants::MTG_NB_COLORS;i++){
|
||||||
if(card->colors[i])
|
if(card->colors[i])
|
||||||
@@ -176,7 +182,7 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
|||||||
|
|
||||||
float scale = pos.actZ * 250 / q->mHeight;
|
float scale = pos.actZ * 250 / q->mHeight;
|
||||||
q->SetColor(ARGB((int)pos.actA,255,255,255));
|
q->SetColor(ARGB((int)pos.actA,255,255,255));
|
||||||
renderer->RenderQuad(q, pos.actX, pos.actY, pos.actT, scale, scale);
|
renderer->RenderQuad(q, x, pos.actY, pos.actT, scale, scale);
|
||||||
}
|
}
|
||||||
// Write the title
|
// Write the title
|
||||||
JLBFont * font = resources.GetJLBFont("magic");
|
JLBFont * font = resources.GetJLBFont("magic");
|
||||||
@@ -190,7 +196,7 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
|||||||
float w = font->GetStringWidth(name) * 0.8 * pos.actZ;
|
float w = font->GetStringWidth(name) * 0.8 * pos.actZ;
|
||||||
if (w > BigWidth - 30)
|
if (w > BigWidth - 30)
|
||||||
font->SetScale((BigWidth - 30) / w);
|
font->SetScale((BigWidth - 30) / w);
|
||||||
font->DrawString(name, pos.actX + (22 - BigWidth / 2)*pos.actZ, pos.actY + (25 - BigHeight / 2)*pos.actZ);
|
font->DrawString(name, x + (22 - BigWidth / 2)*pos.actZ, pos.actY + (25 - BigHeight / 2)*pos.actZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the description
|
// Write the description
|
||||||
@@ -199,7 +205,7 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
|||||||
const std::vector<string> txt = card->formattedText();
|
const std::vector<string> txt = card->formattedText();
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
for (std::vector<string>::const_iterator it = txt.begin(); it != txt.end(); ++it, ++i)
|
for (std::vector<string>::const_iterator it = txt.begin(); it != txt.end(); ++it, ++i)
|
||||||
font->DrawString(it->c_str(), pos.actX + (22 - BigWidth / 2)*pos.actZ, pos.actY + (-BigHeight/2 + 80 + 11 * i)*pos.actZ);
|
font->DrawString(it->c_str(), x + (22 - BigWidth / 2)*pos.actZ, pos.actY + (-BigHeight/2 + 80 + 11 * i)*pos.actZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the strength
|
// Write the strength
|
||||||
@@ -208,7 +214,7 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
|||||||
char buffer[32];
|
char buffer[32];
|
||||||
sprintf(buffer, "%i/%i", card->power, card->toughness);
|
sprintf(buffer, "%i/%i", card->power, card->toughness);
|
||||||
float w = font->GetStringWidth(buffer) * 0.8;
|
float w = font->GetStringWidth(buffer) * 0.8;
|
||||||
font->DrawString(buffer, pos.actX + (65 - w / 2)*pos.actZ, pos.actY + (106)*pos.actZ);
|
font->DrawString(buffer, x + (65 - w / 2)*pos.actZ, pos.actY + (106)*pos.actZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mana
|
// Mana
|
||||||
@@ -225,13 +231,13 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
|||||||
|
|
||||||
if (scale < 0)
|
if (scale < 0)
|
||||||
{
|
{
|
||||||
renderer->RenderQuad(manaIcons[h->color1], pos.actX + (-12 * j + 75 + 3 * sinf(2*M_PI*((float)t)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(t-35))/256.0))*pos.actZ, 0, 0.4 + scale, 0.4 + scale);
|
renderer->RenderQuad(manaIcons[h->color1], x + (-12 * j + 75 + 3 * sinf(2*M_PI*((float)t)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(t-35))/256.0))*pos.actZ, 0, 0.4 + scale, 0.4 + scale);
|
||||||
renderer->RenderQuad(manaIcons[h->color2], pos.actX + (-12 * j + 75 + 3 * sinf(2*M_PI*((float)v)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(v-35))/256.0))*pos.actZ, 0, 0.4 - scale, 0.4 - scale);
|
renderer->RenderQuad(manaIcons[h->color2], x + (-12 * j + 75 + 3 * sinf(2*M_PI*((float)v)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(v-35))/256.0))*pos.actZ, 0, 0.4 - scale, 0.4 - scale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
renderer->RenderQuad(manaIcons[h->color2], pos.actX + (- 12 * j + 75 + 3 * sinf(2*M_PI*((float)v)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(v-35))/256.0))*pos.actZ, 0, 0.4 - scale, 0.4 - scale);
|
renderer->RenderQuad(manaIcons[h->color2], x + (- 12 * j + 75 + 3 * sinf(2*M_PI*((float)v)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(v-35))/256.0))*pos.actZ, 0, 0.4 - scale, 0.4 - scale);
|
||||||
renderer->RenderQuad(manaIcons[h->color1], pos.actX + (- 12 * j + 75 + 3 * sinf(2*M_PI*((float)t)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(t-35))/256.0))*pos.actZ, 0, 0.4 + scale, 0.4 + scale);
|
renderer->RenderQuad(manaIcons[h->color1], x + (- 12 * j + 75 + 3 * sinf(2*M_PI*((float)t)/256.0))*pos.actZ, pos.actY + (yOffset + 3 * cosf(2*M_PI*((float)(t-35))/256.0))*pos.actZ, 0, 0.4 + scale, 0.4 + scale);
|
||||||
}
|
}
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
@@ -239,7 +245,7 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
|||||||
{
|
{
|
||||||
for (int cost = manacost->getCost(i); cost > 0; --cost)
|
for (int cost = manacost->getCost(i); cost > 0; --cost)
|
||||||
{
|
{
|
||||||
renderer->RenderQuad(manaIcons[i], pos.actX + (-12*j + 75)*pos.actZ, pos.actY + (yOffset)*pos.actZ, 0, 0.4 * pos.actZ, 0.4 * pos.actZ);
|
renderer->RenderQuad(manaIcons[i], x + (-12*j + 75)*pos.actZ, pos.actY + (yOffset)*pos.actZ, 0, 0.4 * pos.actZ, 0.4 * pos.actZ);
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -248,9 +254,9 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
|||||||
{
|
{
|
||||||
char buffer[10];
|
char buffer[10];
|
||||||
sprintf(buffer, "%d", cost);
|
sprintf(buffer, "%d", cost);
|
||||||
renderer->RenderQuad(manaIcons[0], pos.actX + (- 12*j + 75)*pos.actZ, pos.actY +(yOffset)*pos.actZ, 0, 0.4 * pos.actZ, 0.4 * pos.actZ);
|
renderer->RenderQuad(manaIcons[0], x + (- 12*j + 75)*pos.actZ, pos.actY +(yOffset)*pos.actZ, 0, 0.4 * pos.actZ, 0.4 * pos.actZ);
|
||||||
float w = font->GetStringWidth(buffer);
|
float w = font->GetStringWidth(buffer);
|
||||||
font->DrawString(buffer, pos.actX +(- 12*j + 76 - w/2)*pos.actZ, pos.actY + (yOffset - 5)*pos.actZ);
|
font->DrawString(buffer, x +(- 12*j + 76 - w/2)*pos.actZ, pos.actY + (yOffset - 5)*pos.actZ);
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
//Has X?
|
//Has X?
|
||||||
@@ -258,9 +264,9 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
|||||||
{
|
{
|
||||||
char buffer[10];
|
char buffer[10];
|
||||||
sprintf(buffer, "X");
|
sprintf(buffer, "X");
|
||||||
renderer->RenderQuad(manaIcons[0], pos.actX + (- 12*j + 75)*pos.actZ, pos.actY +(yOffset)*pos.actZ, 0, 0.4 * pos.actZ, 0.4 * pos.actZ);
|
renderer->RenderQuad(manaIcons[0], x + (- 12*j + 75)*pos.actZ, pos.actY +(yOffset)*pos.actZ, 0, 0.4 * pos.actZ, 0.4 * pos.actZ);
|
||||||
float w = font->GetStringWidth(buffer);
|
float w = font->GetStringWidth(buffer);
|
||||||
font->DrawString(buffer, pos.actX +(- 12*j + 76 - w/2)*pos.actZ, pos.actY + (yOffset - 5)*pos.actZ);
|
font->DrawString(buffer, x +(- 12*j + 76 - w/2)*pos.actZ, pos.actY + (yOffset - 5)*pos.actZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,7 +279,7 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
|||||||
s += " - ";
|
s += " - ";
|
||||||
}
|
}
|
||||||
s += _(Subtypes::subtypesList->find(card->types[0]));
|
s += _(Subtypes::subtypesList->find(card->types[0]));
|
||||||
font->DrawString(s.c_str(), pos.actX + (22 - BigWidth / 2)*pos.actZ, pos.actY + (49 - BigHeight / 2)*pos.actZ);
|
font->DrawString(s.c_str(), x + (22 - BigWidth / 2)*pos.actZ, pos.actY + (49 - BigHeight / 2)*pos.actZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
//expansion and rarity
|
//expansion and rarity
|
||||||
@@ -301,10 +307,10 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
|||||||
case Constants::MTG_COLOR_BLACK:
|
case Constants::MTG_COLOR_BLACK:
|
||||||
case Constants::MTG_COLOR_LAND:
|
case Constants::MTG_COLOR_LAND:
|
||||||
font->SetColor(ARGB((int)pos.actA,255,255,255));
|
font->SetColor(ARGB((int)pos.actA,255,255,255));
|
||||||
font->DrawString(buf, pos.actX + (22 - BigWidth / 2)*pos.actZ, pos.actY + (BigHeight / 2 - 30)*pos.actZ);
|
font->DrawString(buf, x + (22 - BigWidth / 2)*pos.actZ, pos.actY + (BigHeight / 2 - 30)*pos.actZ);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
font->DrawString(buf, pos.actX + (22 - BigWidth / 2)*pos.actZ, pos.actY + (BigHeight / 2 - 30)*pos.actZ);
|
font->DrawString(buf, x + (22 - BigWidth / 2)*pos.actZ, pos.actY + (BigHeight / 2 - 30)*pos.actZ);
|
||||||
break; //Leave black
|
break; //Leave black
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,11 +326,14 @@ void CardGui::alternateRenderBig(const Pos& pos){
|
|||||||
void CardGui::RenderBig(MTGCard* card, const Pos& pos){
|
void CardGui::RenderBig(MTGCard* card, const Pos& pos){
|
||||||
JRenderer * renderer = JRenderer::GetInstance();
|
JRenderer * renderer = JRenderer::GetInstance();
|
||||||
|
|
||||||
|
float x = pos.actX;
|
||||||
|
if (x < BigWidth / 2) x = BigWidth / 2;
|
||||||
|
|
||||||
JQuad * quad = resources.RetrieveCard(card);
|
JQuad * quad = resources.RetrieveCard(card);
|
||||||
if (quad){
|
if (quad){
|
||||||
quad->SetColor(ARGB((int)pos.actA,255,255,255));
|
quad->SetColor(ARGB((int)pos.actA,255,255,255));
|
||||||
float scale = pos.actZ * 257.f / quad->mHeight;
|
float scale = pos.actZ * 257.f / quad->mHeight;
|
||||||
renderer->RenderQuad(quad, pos.actX, pos.actY, pos.actT, scale, scale);
|
renderer->RenderQuad(quad, x, pos.actY, pos.actT, scale, scale);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,7 +342,7 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos){
|
|||||||
{
|
{
|
||||||
float scale = pos.actZ * 250 / q->mHeight;
|
float scale = pos.actZ * 250 / q->mHeight;
|
||||||
q->SetColor(ARGB((int)pos.actA,255,255,255));
|
q->SetColor(ARGB((int)pos.actA,255,255,255));
|
||||||
renderer->RenderQuad(q, pos.actX, pos.actY, pos.actT, scale, scale);
|
renderer->RenderQuad(q, x, pos.actY, pos.actT, scale, scale);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -140,8 +140,11 @@ void Credits::Render(){
|
|||||||
JLBFont * f2 = resources.GetJLBFont(Constants::MENU_FONT);
|
JLBFont * f2 = resources.GetJLBFont(Constants::MENU_FONT);
|
||||||
JLBFont * f3 = resources.GetJLBFont(Constants::MAGIC_FONT);
|
JLBFont * f3 = resources.GetJLBFont(Constants::MAGIC_FONT);
|
||||||
f->SetScale(1);
|
f->SetScale(1);
|
||||||
|
f->SetColor(ARGB(255,255,255,255));
|
||||||
f2->SetScale(1);
|
f2->SetScale(1);
|
||||||
|
f2->SetColor(ARGB(255,255,255,255));
|
||||||
f3->SetScale(1);
|
f3->SetScale(1);
|
||||||
|
f3->SetColor(ARGB(255,255,255,255));
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
if (!g->turn){
|
if (!g->turn){
|
||||||
sprintf(buffer, _("Please check your deck (not enough cards?)").c_str() );
|
sprintf(buffer, _("Please check your deck (not enough cards?)").c_str() );
|
||||||
|
|||||||
@@ -473,7 +473,9 @@ JLBFont * mFont = resources.GetJLBFont(Constants::MENU_FONT);
|
|||||||
subMenuController = NEW SimpleMenu(102, this, mFont, 150,60);
|
subMenuController = NEW SimpleMenu(102, this, mFont, 150,60);
|
||||||
if (subMenuController){
|
if (subMenuController){
|
||||||
subMenuController->Add(SUBMENUITEM_1PLAYER,"1 Player");
|
subMenuController->Add(SUBMENUITEM_1PLAYER,"1 Player");
|
||||||
subMenuController->Add(SUBMENUITEM_2PLAYER, "2 Players");
|
// TODO Put 2 players mode back
|
||||||
|
// This requires to fix the hand (to accept 2 players) OR to implement network game
|
||||||
|
//subMenuController->Add(SUBMENUITEM_2PLAYER, "2 Players");
|
||||||
subMenuController->Add(SUBMENUITEM_DEMO,"Demo");
|
subMenuController->Add(SUBMENUITEM_DEMO,"Demo");
|
||||||
subMenuController->Add(SUBMENUITEM_CANCEL, "Cancel");
|
subMenuController->Add(SUBMENUITEM_CANCEL, "Cancel");
|
||||||
#ifdef TESTSUITE
|
#ifdef TESTSUITE
|
||||||
|
|||||||
Reference in New Issue
Block a user