- Adding "connected cards" color rendering

- Made "booster" check mod-dependent in test suite
This commit is contained in:
wagic.the.homebrew
2011-09-23 07:24:24 +00:00
parent 0b66caebf2
commit c633dc805f
6 changed files with 66 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 938 B

View File

@@ -1,4 +1,8 @@
########################
#Internal tests
########################
+pregametests
########################
#Generic engine features
########################
generic/attacks_each_turn.txt

View File

@@ -165,6 +165,54 @@ void CardGui::Render()
renderer->RenderQuad(extracostshadow.get(), actX + (actZ - 1) * 15, actY + (actZ - 1) * 15, actT, 28 * actZ / 16, 40 * actZ / 16);
}
// Am I a parent of a selected card, or am I a parent and myself being selected?
bool isActiveConnectedParent = mHasFocus && card->childrenCards.size();
if (!isActiveConnectedParent)
{
for (size_t i = 0; i < card->childrenCards.size(); ++i)
{
MTGCardInstance * child = card->childrenCards[i];
if (CardView* cv = dynamic_cast<CardView*>(child->view))
{
if (cv->mHasFocus)
{
isActiveConnectedParent = true;
break;
}
}
}
}
if (isActiveConnectedParent)
{
JQuadPtr white = WResourceManager::Instance()->GetQuad("white");
white->SetColor(ARGB(255,230,50,50));
renderer->RenderQuad(white.get(), actX, actY, actT, 30 * actZ / 16, 42 * actZ / 16);
}
// Am I a child of a selected card, or am I a child and myself being selected?
bool isActiveConnectedChild = mHasFocus && card->parentCards.size();
if (!isActiveConnectedChild)
{
for (size_t i = 0; i < card->parentCards.size(); ++i)
{
MTGCardInstance * parent = card->parentCards[i];
if (CardView* cv = dynamic_cast<CardView*>(parent->view))
{
if (cv->mHasFocus)
{
isActiveConnectedChild = true;
break;
}
}
}
}
if (isActiveConnectedChild)
{
JQuadPtr white = WResourceManager::Instance()->GetQuad("white");
white->SetColor(ARGB(255,0,0,255));
renderer->RenderQuad(white.get(), actX, actY, actT, 30 * actZ / 16, 42 * actZ / 16);
}
if (quad)
{
quad->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));

View File

@@ -208,6 +208,7 @@ void GameApp::Create()
WResourceManager::Instance()->RetrieveTexture("BattleIcon.png", RETRIEVE_MANAGE);
WResourceManager::Instance()->RetrieveTexture("DefenderIcon.png", RETRIEVE_MANAGE);
WResourceManager::Instance()->RetrieveTexture("shadow.png", RETRIEVE_MANAGE);
WResourceManager::Instance()->RetrieveTexture("white.png", RETRIEVE_MANAGE);
WResourceManager::Instance()->RetrieveTexture("extracostshadow.png", RETRIEVE_MANAGE);
WResourceManager::Instance()->RetrieveTexture("morph.jpg", RETRIEVE_MANAGE);
@@ -218,6 +219,9 @@ void GameApp::Create()
if (jq)
jq->SetHotSpot(12, 12);
jq = WResourceManager::Instance()->RetrieveQuad("shadow.png", 0, 0, 16, 16, "shadow", RETRIEVE_MANAGE);
if (jq)
jq->SetHotSpot(8, 8);
jq = WResourceManager::Instance()->RetrieveQuad("white.png", 0, 0, 16, 16, "white", RETRIEVE_MANAGE);
if (jq)
jq->SetHotSpot(8, 8);
jq = WResourceManager::Instance()->RetrieveQuad("extracostshadow.png", 0, 0, 16, 16, "extracostshadow", RETRIEVE_MANAGE);

View File

@@ -380,7 +380,6 @@ void GameStateDuel::Update(float dt)
{
loadTestSuitePlayers();
setGamePhase(DUEL_STATE_PLAY);
testSuite->pregameTests();
testSuite->initGame();
}
else

View File

@@ -576,6 +576,7 @@ TestSuite::TestSuite(const char * filename)
{
if (!s.size()) continue;
if (s[s.size() - 1] == '\r') s.erase(s.size() - 1); //Handle DOS files
if (!s.size()) continue;
if (s[0] == '/' && s[1] == '*') comment = 1;
if (s[0] && s[0] != '#' && !comment)
{
@@ -616,7 +617,15 @@ int TestSuite::loadNext()
if (!nbfiles) return 0;
if (currentfile >= nbfiles) return 0;
currentfile++;
if (!load(files[currentfile - 1].c_str()))
string currFilename = files[currentfile - 1];
if (currFilename == "+pregametests")
{
pregameTests();
return loadNext();
}
if (!load(currFilename.c_str()))
return loadNext();
else
cout << "Starting test : " << files[currentfile - 1] << endl;