in this commit suspend now states the amount of turns in the menutext....

made changes to some of the simple menu items, made the simple menu not draw massive horizontal and vertical poles, that look was extremely dated.
This commit is contained in:
omegablast2002@yahoo.com
2012-03-13 16:12:00 +00:00
parent 0a357e7eb0
commit eb8c0c54f1
8 changed files with 58 additions and 23 deletions
+1 -10
View File
@@ -66,7 +66,6 @@ public:
MTGEventBonus(GameObserver* observer, int _id); MTGEventBonus(GameObserver* observer, int _id);
virtual MTGEventBonus * clone() const; virtual MTGEventBonus * clone() const;
}; };
class MTGPutInPlayRule: public PermanentAbility class MTGPutInPlayRule: public PermanentAbility
{ {
public: public:
@@ -182,15 +181,7 @@ public:
string suspendmenu; string suspendmenu;
virtual ostream& toString(ostream& out) const; virtual ostream& toString(ostream& out) const;
MTGSuspendRule(GameObserver* observer, int _id); MTGSuspendRule(GameObserver* observer, int _id);
const char * getMenuText() const char * getMenuText();
{
suspendmenu = "suspend";
//char buffer[20];
//sprintf(buffer,"-%i",card->suspendedTime);
//suspendmenu.append(buffer);
//TODO:make this work so it shows "Suspend-the amount of turns"
return suspendmenu.c_str();
}
virtual MTGSuspendRule * clone() const; virtual MTGSuspendRule * clone() const;
}; };
+2
View File
@@ -39,6 +39,8 @@ public:
string deckName; string deckName;
string phaseRing; string phaseRing;
int offerInterruptOnPhase; int offerInterruptOnPhase;
int skippingTurn;
int extraTurn;
Player(GameObserver *observer, string deckFile, string deckFileSmall, MTGDeck * deck = NULL); Player(GameObserver *observer, string deckFile, string deckFileSmall, MTGDeck * deck = NULL);
virtual ~Player(); virtual ~Player();
virtual void setObserver(GameObserver*g); virtual void setObserver(GameObserver*g);
+6
View File
@@ -76,6 +76,12 @@ struct WEventDamageStackResolved : public WEvent {
WEventDamageStackResolved(); WEventDamageStackResolved();
}; };
struct WEventPhasePreChange : public WEvent {
Phase * from;
Phase * to;
bool eventChanged;
WEventPhasePreChange(Phase * from,Phase * to);
};
struct WEventPhaseChange : public WEvent { struct WEventPhaseChange : public WEvent {
Phase * from; Phase * from;
Phase * to; Phase * to;
+17 -3
View File
@@ -274,8 +274,6 @@ MTGEventBonus * MTGEventBonus::clone() const
{ {
return NEW MTGEventBonus(*this); return NEW MTGEventBonus(*this);
} }
//
MTGPutInPlayRule::MTGPutInPlayRule(GameObserver* observer, int _id) : MTGPutInPlayRule::MTGPutInPlayRule(GameObserver* observer, int _id) :
PermanentAbility(observer, _id) PermanentAbility(observer, _id)
{ {
@@ -452,6 +450,7 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card)
if (!card->has(Constants::STORM)) if (!card->has(Constants::STORM))
{ {
copy->X = spell->computeX(copy); copy->X = spell->computeX(copy);
copy->castX = copy->X;
} }
} }
@@ -584,6 +583,7 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card)
if (!card->has(Constants::STORM)) if (!card->has(Constants::STORM))
{ {
copy->X = spell->computeX(copy); copy->X = spell->computeX(copy);
copy->castX = copy->X;
} }
} }
@@ -738,6 +738,7 @@ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alter
{ {
ManaCost * c = spellCost->Diff(alternateCost); ManaCost * c = spellCost->Diff(alternateCost);
copy->X = c->getCost(Constants::NB_Colors); copy->X = c->getCost(Constants::NB_Colors);
copy->castX = copy->X;
delete c; delete c;
} }
} }
@@ -908,8 +909,15 @@ int MTGSuspendRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
Player * player = game->currentlyActing(); Player * player = game->currentlyActing();
ManaCost * alternateManaCost = card->getManaCost()->suspend; ManaCost * alternateManaCost = card->getManaCost()->suspend;
if (!player->game->hand->hasCard(card)) if (!player->game->hand->hasCard(card) || !alternateManaCost)
return 0; return 0;
suspendmenu = "suspend";
char buffer[20];
if(alternateManaCost->hasX())
sprintf(buffer,"- X");
else
sprintf(buffer,"-%i",card->suspendedTime);
suspendmenu.append(buffer);
return MTGAlternativeCostRule::isReactingToClick( card, mana, alternateManaCost ); return MTGAlternativeCostRule::isReactingToClick( card, mana, alternateManaCost );
} }
@@ -990,6 +998,11 @@ int MTGSuspendRule::reactToClick(MTGCardInstance * card)
return 1; return 1;
} }
const char * MTGSuspendRule::getMenuText()
{
return suspendmenu.c_str();
}
ostream& MTGSuspendRule::toString(ostream& out) const ostream& MTGSuspendRule::toString(ostream& out) const
{ {
out << "MTGSuspendRule ::: ("; out << "MTGSuspendRule ::: (";
@@ -1107,6 +1120,7 @@ int MTGMorphCostRule::reactToClick(MTGCardInstance * card)
if (!card->has(Constants::STORM)) if (!card->has(Constants::STORM))
{ {
copy->X = spell->computeX(copy); copy->X = spell->computeX(copy);
copy->castX = copy->X;
} }
return 1; return 1;
} }
+2
View File
@@ -30,6 +30,8 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck *
mAvatarTex = NULL; mAvatarTex = NULL;
type_as_damageable = DAMAGEABLE_PLAYER; type_as_damageable = DAMAGEABLE_PLAYER;
playMode = MODE_HUMAN; playMode = MODE_HUMAN;
skippingTurn = 0;
extraTurn = 0;
if (deck != NULL) if (deck != NULL)
{ {
game = NEW MTGPlayerCards(deck); game = NEW MTGPlayerCards(deck);
+22 -9
View File
@@ -11,8 +11,13 @@ namespace
const float kPoleWidth = 7; const float kPoleWidth = 7;
const float kVerticalMargin = 16; const float kVerticalMargin = 16;
const float kHorizontalMargin = 30; const float kHorizontalMargin = 30;
const float kLineHeight = 20;
#ifdef TOUCH_ENABLED
const float kLineHeight = 30;
#else
const float kLineHeight = 20;
#endif
//For the "Classic" Theme //For the "Classic" Theme
const float kSpadeHeightOffset = 4; const float kSpadeHeightOffset = 4;
const float kSpadeWidthOffset = 9; const float kSpadeWidthOffset = 9;
@@ -130,7 +135,7 @@ void SimpleMenu::Render()
for (int i = 0; i < mCount; ++i) for (int i = 0; i < mCount; ++i)
{ {
float width = (static_cast<SimpleMenuItem*> (mObjects[i]))->GetWidth(); float width = (static_cast<SimpleMenuItem*> (mObjects[i]))->GetWidth() + 15;
if (mWidth < width) mWidth = width; if (mWidth < width) mWidth = width;
} }
if ((!title.empty()) && (mWidth < titleFont->GetStringWidth(title.c_str()))) if ((!title.empty()) && (mWidth < titleFont->GetStringWidth(title.c_str())))
@@ -145,7 +150,7 @@ void SimpleMenu::Render()
for (int i = 0; i < mCount; ++i) for (int i = 0; i < mCount; ++i)
{ {
float y = mY + kVerticalMargin + i * kLineHeight; float y = mY + kVerticalMargin + i * kLineHeight + 3;//spacing between first object and title bar
SimpleMenuItem * smi = static_cast<SimpleMenuItem*> (mObjects[i]); SimpleMenuItem * smi = static_cast<SimpleMenuItem*> (mObjects[i]);
smi->Relocate(mX + mWidth / 2, y); smi->Relocate(mX + mWidth / 2, y);
if (smi->hasFocus()) sY = y; if (smi->hasFocus()) sY = y;
@@ -163,17 +168,24 @@ void SimpleMenu::Render()
renderer->FillRect(mX, mY, mWidth, height, ARGB(180,0,0,0)); renderer->FillRect(mX, mY, mWidth, height, ARGB(180,0,0,0));
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA); renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
drawVertPole(mX, mY - 16, height + 32); drawVertPole(mX, mY, height);
drawVertPole(mX + mWidth, mY - 16, height + 32); drawVertPole(mX + mWidth, mY, height);
drawHorzPole(mX - 16, mY, mWidth + 32); drawHorzPole(mX, mY, mWidth);
drawHorzPole(mX - 25, mY + height, mWidth + 50); drawHorzPole(mX, mY + height, mWidth);
//drawVertPole(mX, mY - 16, height + 32);
//drawVertPole(mX + mWidth, mY - 16, height + 32);
//drawHorzPole(mX - 16, mY, mWidth + 32);
//drawHorzPole(mX - 25, mY + height, mWidth + 50);
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE); renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE);
stars->Render(); stars->Render();
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA); renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
mFont->SetScale(1.0f); if (!title.empty())
if (!title.empty()) titleFont->DrawString(title.c_str(), mX + mWidth / 2, mY - 3, JGETEXT_CENTER); {
mFont->SetScale(1.5f);
titleFont->DrawString(title.c_str(), mX + mWidth / 2, mY - 3, JGETEXT_CENTER);
}
for (int i = startId; i < startId + maxItems; i++) for (int i = startId; i < startId + maxItems; i++)
{ {
if (i > mCount - 1) break; if (i > mCount - 1) break;
@@ -190,6 +202,7 @@ void SimpleMenu::Render()
(static_cast<SimpleMenuItem*> (mObjects[i]))->RenderWithOffset(-kLineHeight * startId); (static_cast<SimpleMenuItem*> (mObjects[i]))->RenderWithOffset(-kLineHeight * startId);
} }
} }
mFont->SetScale(1.0f);
} }
void SimpleMenu::Update(float dt) void SimpleMenu::Update(float dt)
+6
View File
@@ -47,6 +47,12 @@ WEventPhaseChange::WEventPhaseChange(Phase * from, Phase * to) :
{ {
} }
WEventPhasePreChange::WEventPhasePreChange(Phase * from, Phase * to) :
WEvent(CHANGE_PHASE), from(from), to(to)
{
eventChanged = false;
}
WEventCardTap::WEventCardTap(MTGCardInstance * card, bool before, bool after) : WEventCardTap::WEventCardTap(MTGCardInstance * card, bool before, bool after) :
WEventCardUpdate(card), before(before), after(after) WEventCardUpdate(card), before(before), after(after)
{ {
+2 -1
View File
@@ -1967,7 +1967,7 @@ void WGuiFilterItem::updateValue()
SAFE_DELETE(mParent->subMenu); SAFE_DELETE(mParent->subMenu);
mState = STATE_CHOOSE_TYPE; mState = STATE_CHOOSE_TYPE;
SAFE_DELETE(mParent->subMenu); SAFE_DELETE(mParent->subMenu);
mParent->subMenu = NEW SimpleMenu(JGE::GetInstance(), -1234, this, Fonts::MENU_FONT, 20, 20, "Filter By...", 10); mParent->subMenu = NEW SimpleMenu(JGE::GetInstance(), -1234, this, Fonts::MAIN_FONT, 30, 30, "Filter By...", 6);
if (mParent->isAvailable(FILTER_SET)) if (mParent->isAvailable(FILTER_SET))
{ {
mParent->subMenu->Add(FILTER_SET, "Set"); mParent->subMenu->Add(FILTER_SET, "Set");
@@ -2050,6 +2050,7 @@ void WGuiFilterItem::updateValue()
mParent->addArg("Legendary", "t:Legendary;"); mParent->addArg("Legendary", "t:Legendary;");
mParent->addArg("Sorcery", "t:Sorcery;"); mParent->addArg("Sorcery", "t:Sorcery;");
mParent->addArg("Tribal", "t:Tribal;"); mParent->addArg("Tribal", "t:Tribal;");
mParent->addArg("Planeswalker", "t:Planeswalker;");
} }
else if (filterType == FILTER_SUBTYPE) else if (filterType == FILTER_SUBTYPE)