Merge pull request #955 from kevlahnota/master

Adjust stack display & game credits
This commit is contained in:
Anthony Calosa
2017-03-08 16:14:09 +08:00
committed by GitHub
5 changed files with 44 additions and 7 deletions

View File

@@ -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);

View File

@@ -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;
}
}

View File

@@ -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)
{

View File

@@ -40,6 +40,7 @@ JMusic * GameApp::music = NULL;
string GameApp::currentMusicFile = "";
string GameApp::systemError = "";
char GameApp::mynbcardsStr[512] = {0};
int GameApp::mycredits = 0;
vector<JQuadPtr > manaIcons;

View File

@@ -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)
{