From eb8c0c54f1701b6991c0685c28a4e27ab5860ee8 Mon Sep 17 00:00:00 2001 From: "omegablast2002@yahoo.com" Date: Tue, 13 Mar 2012 16:12:00 +0000 Subject: [PATCH] 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. --- projects/mtg/include/MTGRules.h | 11 +---------- projects/mtg/include/Player.h | 2 ++ projects/mtg/include/WEvent.h | 6 ++++++ projects/mtg/src/MTGRules.cpp | 20 +++++++++++++++++--- projects/mtg/src/Player.cpp | 2 ++ projects/mtg/src/SimpleMenu.cpp | 31 ++++++++++++++++++++++--------- projects/mtg/src/WEvent.cpp | 6 ++++++ projects/mtg/src/WGui.cpp | 3 ++- 8 files changed, 58 insertions(+), 23 deletions(-) diff --git a/projects/mtg/include/MTGRules.h b/projects/mtg/include/MTGRules.h index 492ff170d..cf8457a43 100644 --- a/projects/mtg/include/MTGRules.h +++ b/projects/mtg/include/MTGRules.h @@ -66,7 +66,6 @@ public: MTGEventBonus(GameObserver* observer, int _id); virtual MTGEventBonus * clone() const; }; - class MTGPutInPlayRule: public PermanentAbility { public: @@ -182,15 +181,7 @@ public: string suspendmenu; virtual ostream& toString(ostream& out) const; MTGSuspendRule(GameObserver* observer, int _id); - 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(); - } + const char * getMenuText(); virtual MTGSuspendRule * clone() const; }; diff --git a/projects/mtg/include/Player.h b/projects/mtg/include/Player.h index e2b382904..cd5f520a6 100644 --- a/projects/mtg/include/Player.h +++ b/projects/mtg/include/Player.h @@ -39,6 +39,8 @@ public: string deckName; string phaseRing; int offerInterruptOnPhase; + int skippingTurn; + int extraTurn; Player(GameObserver *observer, string deckFile, string deckFileSmall, MTGDeck * deck = NULL); virtual ~Player(); virtual void setObserver(GameObserver*g); diff --git a/projects/mtg/include/WEvent.h b/projects/mtg/include/WEvent.h index 13cb9a4b8..bfc6b13ed 100644 --- a/projects/mtg/include/WEvent.h +++ b/projects/mtg/include/WEvent.h @@ -76,6 +76,12 @@ struct WEventDamageStackResolved : public WEvent { WEventDamageStackResolved(); }; +struct WEventPhasePreChange : public WEvent { + Phase * from; + Phase * to; + bool eventChanged; + WEventPhasePreChange(Phase * from,Phase * to); +}; struct WEventPhaseChange : public WEvent { Phase * from; Phase * to; diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index 5b4aa9901..ace1a8c8a 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -274,8 +274,6 @@ MTGEventBonus * MTGEventBonus::clone() const { return NEW MTGEventBonus(*this); } - -// MTGPutInPlayRule::MTGPutInPlayRule(GameObserver* observer, int _id) : PermanentAbility(observer, _id) { @@ -452,6 +450,7 @@ int MTGPutInPlayRule::reactToClick(MTGCardInstance * card) if (!card->has(Constants::STORM)) { copy->X = spell->computeX(copy); + copy->castX = copy->X; } } @@ -584,6 +583,7 @@ int MTGKickerRule::reactToClick(MTGCardInstance * card) if (!card->has(Constants::STORM)) { 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); copy->X = c->getCost(Constants::NB_Colors); + copy->castX = copy->X; delete c; } } @@ -908,8 +909,15 @@ int MTGSuspendRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana) Player * player = game->currentlyActing(); ManaCost * alternateManaCost = card->getManaCost()->suspend; - if (!player->game->hand->hasCard(card)) + if (!player->game->hand->hasCard(card) || !alternateManaCost) 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 ); } @@ -990,6 +998,11 @@ int MTGSuspendRule::reactToClick(MTGCardInstance * card) return 1; } +const char * MTGSuspendRule::getMenuText() +{ + return suspendmenu.c_str(); +} + ostream& MTGSuspendRule::toString(ostream& out) const { out << "MTGSuspendRule ::: ("; @@ -1107,6 +1120,7 @@ int MTGMorphCostRule::reactToClick(MTGCardInstance * card) if (!card->has(Constants::STORM)) { copy->X = spell->computeX(copy); + copy->castX = copy->X; } return 1; } diff --git a/projects/mtg/src/Player.cpp b/projects/mtg/src/Player.cpp index 7266982a9..3cb40ae74 100644 --- a/projects/mtg/src/Player.cpp +++ b/projects/mtg/src/Player.cpp @@ -30,6 +30,8 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck * mAvatarTex = NULL; type_as_damageable = DAMAGEABLE_PLAYER; playMode = MODE_HUMAN; + skippingTurn = 0; + extraTurn = 0; if (deck != NULL) { game = NEW MTGPlayerCards(deck); diff --git a/projects/mtg/src/SimpleMenu.cpp b/projects/mtg/src/SimpleMenu.cpp index 3f3063552..12e2c9cfa 100644 --- a/projects/mtg/src/SimpleMenu.cpp +++ b/projects/mtg/src/SimpleMenu.cpp @@ -11,8 +11,13 @@ namespace const float kPoleWidth = 7; const float kVerticalMargin = 16; 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 const float kSpadeHeightOffset = 4; const float kSpadeWidthOffset = 9; @@ -130,7 +135,7 @@ void SimpleMenu::Render() for (int i = 0; i < mCount; ++i) { - float width = (static_cast (mObjects[i]))->GetWidth(); + float width = (static_cast (mObjects[i]))->GetWidth() + 15; if (mWidth < width) mWidth = width; } if ((!title.empty()) && (mWidth < titleFont->GetStringWidth(title.c_str()))) @@ -145,7 +150,7 @@ void SimpleMenu::Render() 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 (mObjects[i]); smi->Relocate(mX + mWidth / 2, 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->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA); - 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); + drawVertPole(mX, mY, height); + drawVertPole(mX + mWidth, mY, height); + drawHorzPole(mX, mY, mWidth); + 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); stars->Render(); renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA); - mFont->SetScale(1.0f); - if (!title.empty()) titleFont->DrawString(title.c_str(), mX + mWidth / 2, mY - 3, JGETEXT_CENTER); + if (!title.empty()) + { + mFont->SetScale(1.5f); + titleFont->DrawString(title.c_str(), mX + mWidth / 2, mY - 3, JGETEXT_CENTER); + } for (int i = startId; i < startId + maxItems; i++) { if (i > mCount - 1) break; @@ -190,6 +202,7 @@ void SimpleMenu::Render() (static_cast (mObjects[i]))->RenderWithOffset(-kLineHeight * startId); } } + mFont->SetScale(1.0f); } void SimpleMenu::Update(float dt) diff --git a/projects/mtg/src/WEvent.cpp b/projects/mtg/src/WEvent.cpp index 5869c9dfb..ab9f6db32 100644 --- a/projects/mtg/src/WEvent.cpp +++ b/projects/mtg/src/WEvent.cpp @@ -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) : WEventCardUpdate(card), before(before), after(after) { diff --git a/projects/mtg/src/WGui.cpp b/projects/mtg/src/WGui.cpp index 9d1ee3f17..fc93a6410 100644 --- a/projects/mtg/src/WGui.cpp +++ b/projects/mtg/src/WGui.cpp @@ -1967,7 +1967,7 @@ void WGuiFilterItem::updateValue() SAFE_DELETE(mParent->subMenu); mState = STATE_CHOOSE_TYPE; 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)) { mParent->subMenu->Add(FILTER_SET, "Set"); @@ -2050,6 +2050,7 @@ void WGuiFilterItem::updateValue() mParent->addArg("Legendary", "t:Legendary;"); mParent->addArg("Sorcery", "t:Sorcery;"); mParent->addArg("Tribal", "t:Tribal;"); + mParent->addArg("Planeswalker", "t:Planeswalker;"); } else if (filterType == FILTER_SUBTYPE)