From ff6e4aec9a243722d0e1757ce18ba375ede408b4 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Wed, 8 Mar 2017 13:38:19 +0800 Subject: [PATCH] adjust stack display & game credits the stack will display the latest object always on TOP so we can see which will resolve first, the last to resolve will always be on bottom... also increase credit bonus. default is 500 credits and for momir will be 800 credits. --- projects/mtg/include/GameApp.h | 1 + projects/mtg/src/ActionStack.cpp | 19 +++++++++++++++++++ projects/mtg/src/Credits.cpp | 12 ++++++------ projects/mtg/src/GameApp.cpp | 1 + projects/mtg/src/GameStateMenu.cpp | 18 +++++++++++++++++- 5 files changed, 44 insertions(+), 7 deletions(-) diff --git a/projects/mtg/include/GameApp.h b/projects/mtg/include/GameApp.h index d672e45bf..054d17654 100644 --- a/projects/mtg/include/GameApp.h +++ b/projects/mtg/include/GameApp.h @@ -74,6 +74,7 @@ public: static bool HasMusic; static string systemError; static char mynbcardsStr[512]; + static int mycredits; static JMusic* music; static string currentMusicFile; static void playMusic(string filename = "", bool loop = true); diff --git a/projects/mtg/src/ActionStack.cpp b/projects/mtg/src/ActionStack.cpp index 73baff338..0e2f84da1 100644 --- a/projects/mtg/src/ActionStack.cpp +++ b/projects/mtg/src/ActionStack.cpp @@ -1394,6 +1394,8 @@ void ActionStack::Render() //renderer->FillRoundRect(x0 - 7, y0+2, width + 17, height + 2, 9.0f, ARGB(128,0,0,0)); //stack fill renderer->FillRect(x0 - 7, y0+2, width + 17, height + 14, ARGB(225,5,5,5)); + //top stack fill + renderer->FillRect(x0 - 6, y0+37, width + 15, 40.5f, ARGB(60,135,206,235)); //stack highlight renderer->FillRect(x0 - 6, y0+3, width + 15, 30, ARGB(255,89,89,89)); //another border @@ -1453,15 +1455,32 @@ void ActionStack::Render() currenty += kIconVerticalOffset + kSpacer; + float totalmHeight = 0.f; + for (size_t i = 0; i < mObjects.size(); i++) + { + Interruptible * current = (Interruptible *) mObjects[i]; + if (current && current->state == NOT_RESOLVED) + totalmHeight += current->mHeight; + } + int sC = 0;//stack Count for (size_t i = 0; i < mObjects.size(); i++) { Interruptible * current = (Interruptible *) mObjects[i]; if (current && current->state == NOT_RESOLVED) { + /* current->x = x0; current->y = currenty; current->Render(); + currenty += current->mHeight;*/ + sC+=1; + float cH = current->mHeight*sC; + current->x = x0; + current->y = (5+kIconVerticalOffset + kSpacer) + (totalmHeight - cH); + //render the stack object + current->Render(); + currenty += current->mHeight; } } diff --git a/projects/mtg/src/Credits.cpp b/projects/mtg/src/Credits.cpp index 487daba86..bb50f9666 100644 --- a/projects/mtg/src/Credits.cpp +++ b/projects/mtg/src/Credits.cpp @@ -183,9 +183,9 @@ void Credits::compute(GameObserver* g, GameApp * _app) if (p2->isAI() && g->didWin(p1)) { gameLength = time(0) - g->startedAt; - value = 400; - if (app->gameType != GAME_TYPE_CLASSIC) - value = 200; + value = 500; + if (app->gameType == GAME_TYPE_MOMIR) + value = 800;//800 credits for momir int difficulty = options[Options::DIFFICULTY].number; if (options[Options::DIFFICULTY_MODE_UNLOCKED].number && difficulty) { @@ -360,9 +360,9 @@ void Credits::computeTournament(GameObserver* g, GameApp * _app,bool tournament, PlayerData * playerdata = NEW PlayerData(MTGCollection()); if (p2->isAI() && mPlayerWin) { - value = 400; - if (app->gameType != GAME_TYPE_CLASSIC) - value = 200; + value = 500; + if (app->gameType == GAME_TYPE_MOMIR) + value = 800; int difficulty = options[Options::DIFFICULTY].number; if (options[Options::DIFFICULTY_MODE_UNLOCKED].number && difficulty) { diff --git a/projects/mtg/src/GameApp.cpp b/projects/mtg/src/GameApp.cpp index cc83073ca..85b6df1f3 100644 --- a/projects/mtg/src/GameApp.cpp +++ b/projects/mtg/src/GameApp.cpp @@ -40,6 +40,7 @@ JMusic * GameApp::music = NULL; string GameApp::currentMusicFile = ""; string GameApp::systemError = ""; char GameApp::mynbcardsStr[512] = {0}; +int GameApp::mycredits = 0; vector manaIcons; diff --git a/projects/mtg/src/GameStateMenu.cpp b/projects/mtg/src/GameStateMenu.cpp index d1a90c160..d5abf57f7 100644 --- a/projects/mtg/src/GameStateMenu.cpp +++ b/projects/mtg/src/GameStateMenu.cpp @@ -187,6 +187,12 @@ void GameStateMenu::genNbCardsStr() sprintf(GameApp::mynbcardsStr, _("%i cards").c_str(),totalPrints); } + if(playerdata) + { + if(playerdata->credits > 0) + GameApp::mycredits = playerdata->credits; + } + SAFE_DELETE(playerdata); } @@ -835,7 +841,17 @@ void GameStateMenu::Render() renderer->RenderQuad(mBg.get(), SCREEN_WIDTH_F/2, 2, 0, 256 / mBg->mWidth, 166 / mBg->mHeight); RenderTopMenu(); - + //credits on lower left if available + std::ostringstream streamC; + streamC << "Credits: " << GameApp::mycredits; + mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); + mFont->SetScale(1.f); + mFont->SetColor(ARGB(200,248,248,255)); + mFont->DrawString(streamC.str(), 12, SCREEN_HEIGHT - 16); + mFont->SetColor(ARGB(255,255,255,255)); + mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); + mFont = WResourceManager::Instance()->GetWFont(Fonts::MENU_FONT); + //end } if (subMenuController) {