Implemented Commander mode and rules, added Command Zone to game, added/fixed primitives, increased the major release version.

This commit is contained in:
valfieri
2020-12-06 20:11:51 +01:00
parent 6ef9ecc147
commit ced2c85076
33 changed files with 588 additions and 78 deletions
+30 -15
View File
@@ -16,6 +16,8 @@ GuiAvatars::GuiAvatars(DuelLayers* duelLayers) :
Add(selfLibrary = NEW GuiLibrary(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 5 + GuiGameZone::Height + 5, false, mpDuelLayers->getRenderedPlayer(), this));
//myexile
Add(selfExile = NEW GuiExile(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 30, false, mpDuelLayers->getRenderedPlayer(), this));
//mycommandZone
Add(selfCommandZone = NEW GuiCommandZone(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 + 9, SCREEN_HEIGHT - GuiAvatar::Height - 30, false, mpDuelLayers->getRenderedPlayer(), this));
Add(opponent = NEW GuiAvatar(0, 0, false, mpDuelLayers->getRenderedPlayerOpponent(), GuiAvatar::TOP_LEFT, this));
opponent->zoom = 0.9f;
@@ -29,19 +31,24 @@ GuiAvatars::GuiAvatars(DuelLayers* duelLayers) :
Add(opponentHand = NEW GuiOpponentHand(-15 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 43 + GuiGameZone::Height - 10, false,
mpDuelLayers->getRenderedPlayerOpponent(), this));
//opponentLibrary
Add(opponentLibrary = NEW GuiLibrary(-30 + GuiAvatar::Width * 1.2 - GuiGameZone::Width / 2, 43 + GuiGameZone::Height - 10,
false, mpDuelLayers->getRenderedPlayerOpponent(), this));
Add(opponentLibrary = NEW GuiLibrary(-30 + GuiAvatar::Width * 1.2 - GuiGameZone::Width / 2, 43 + GuiGameZone::Height - 10, false,
mpDuelLayers->getRenderedPlayerOpponent(), this));
//opponentCommandZone
Add(opponentCommandZone = NEW GuiCommandZone(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 43 + GuiGameZone::Height -10, false,
mpDuelLayers->getRenderedPlayerOpponent(), this));
observer->getCardSelector()->Add(self);
observer->getCardSelector()->Add(selfGraveyard);
observer->getCardSelector()->Add(selfExile);
observer->getCardSelector()->Add(selfCommandZone);
observer->getCardSelector()->Add(selfLibrary);
observer->getCardSelector()->Add(opponent);
observer->getCardSelector()->Add(opponentGraveyard);
observer->getCardSelector()->Add(opponentExile);
observer->getCardSelector()->Add(opponentCommandZone);
observer->getCardSelector()->Add(opponentLibrary);
observer->getCardSelector()->Add(opponentHand);
selfGraveyard->alpha = selfExile->alpha = opponentExile->alpha = selfLibrary->alpha = opponentGraveyard->alpha = opponentLibrary->alpha = opponentHand->alpha = 0;
selfGraveyard->alpha = selfExile->alpha = selfCommandZone->alpha = opponentCommandZone->alpha = opponentExile->alpha = selfLibrary->alpha = opponentGraveyard->alpha = opponentLibrary->alpha = opponentHand->alpha = 0;
}
float GuiAvatars::LeftBoundarySelf()
@@ -58,15 +65,15 @@ void GuiAvatars::Activate(PlayGuiObject* c)
c->zoom = 1.2f;
c->mHasFocus = true;
if ((opponentGraveyard == c) || (opponentExile == c) || (opponentLibrary == c) || (opponent == c) || (opponentHand == c))
if ((opponentGraveyard == c) || (opponentExile == c) || (opponentCommandZone == c) || (opponentLibrary == c) || (opponent == c) || (opponentHand == c))
{
opponentGraveyard->alpha = opponentExile->alpha = opponentLibrary->alpha = opponentHand->alpha = 128.0f;
opponentGraveyard->alpha = opponentExile->alpha = opponentCommandZone->alpha = opponentLibrary->alpha = opponentHand->alpha = 128.0f;
active = opponent;
opponent->zoom = 1.2f;
}
else if ((selfGraveyard == c) || (selfExile == c) || (selfLibrary == c) || (self == c))
else if ((selfGraveyard == c) || (selfExile == c) || (selfCommandZone == c) || (selfLibrary == c) || (self == c))
{
selfGraveyard->alpha = selfExile->alpha = selfLibrary->alpha = 128.0f;
selfGraveyard->alpha = selfExile->alpha = selfCommandZone->alpha = selfLibrary->alpha = 128.0f;
self->zoom = 1.0f;
active = self;
}
@@ -77,15 +84,15 @@ void GuiAvatars::Deactivate(PlayGuiObject* c)
{
c->zoom = 1.0;
c->mHasFocus = false;
if ((opponentGraveyard == c) || (opponentExile == c) || (opponentLibrary == c) || (opponentHand == c) || (opponent == c))
if ((opponentGraveyard == c) || (opponentExile == c) || (opponentCommandZone == c) || (opponentLibrary == c) || (opponentHand == c) || (opponent == c))
{
opponentGraveyard->alpha = opponentExile->alpha = opponentLibrary->alpha = opponentHand->alpha = 0;
opponentGraveyard->alpha = opponentExile->alpha = opponentCommandZone->alpha = opponentLibrary->alpha = opponentHand->alpha = 0;
opponent->zoom = 0.9f;
active = NULL;
}
else if ((selfGraveyard == c) || (selfExile == c) || (selfLibrary == c) || (self == c))
else if ((selfGraveyard == c) || (selfExile == c) || (selfCommandZone == c) || (selfLibrary == c) || (self == c))
{
selfGraveyard->alpha = selfExile->alpha = selfLibrary->alpha = 0;
selfGraveyard->alpha = selfExile->alpha = selfCommandZone->alpha = selfLibrary->alpha = 0;
self->zoom = 0.5f;
active = NULL;
}
@@ -93,15 +100,17 @@ void GuiAvatars::Deactivate(PlayGuiObject* c)
int GuiAvatars::receiveEventPlus(WEvent* e)
{
return selfGraveyard->receiveEventPlus(e) | selfExile->receiveEventPlus(e) | opponentExile->receiveEventPlus(e) | opponentGraveyard->receiveEventPlus(e) | opponentHand->receiveEventPlus(e);
return selfGraveyard->receiveEventPlus(e) | selfExile->receiveEventPlus(e) | selfCommandZone->receiveEventPlus(e) | opponentExile->receiveEventPlus(e) | opponentCommandZone->receiveEventPlus(e) | opponentGraveyard->receiveEventPlus(e) | opponentHand->receiveEventPlus(e);
}
int GuiAvatars::receiveEventMinus(WEvent* e)
{
selfGraveyard->receiveEventMinus(e);
selfExile->receiveEventMinus(e);
selfCommandZone->receiveEventMinus(e);
opponentGraveyard->receiveEventMinus(e);
opponentExile->receiveEventMinus(e);
opponentCommandZone->receiveEventMinus(e);
opponentHand->receiveEventMinus(e);
return 1;
}
@@ -116,10 +125,14 @@ bool GuiAvatars::CheckUserInput(JButton key)
return true;
if (selfExile->CheckUserInput(key))
return true;
if (selfCommandZone->CheckUserInput(key))
return true;
if (opponentGraveyard->CheckUserInput(key))
return true;
if (opponentExile->CheckUserInput(key))
return true;
if (opponentCommandZone->CheckUserInput(key))
return true;
if (opponentHand->CheckUserInput(key))
return true;
if (selfLibrary->CheckUserInput(key))
@@ -135,9 +148,11 @@ void GuiAvatars::Update(float dt)
opponent->Update(dt);
selfGraveyard->Update(dt);
selfExile->Update(dt);
selfCommandZone->Update(dt);
opponentHand->Update(dt);
opponentGraveyard->Update(dt);
opponentExile->Update(dt);
opponentCommandZone->Update(dt);
selfLibrary->Update(dt);
opponentLibrary->Update(dt);
}
@@ -150,12 +165,12 @@ void GuiAvatars::Render()
if (opponent == active)
{
r->FillRect(opponent->actX, opponent->actY, 40 * opponent->actZ, h+25 * opponent->actZ, ARGB(200,0,0,0));
r->FillRect(opponent->actX, opponent->actY, w * opponent->actZ, h * opponent->actZ, ARGB(200,0,0,0));
r->FillRect(opponent->actX, opponent->actY, w * opponent->actZ, h+25 * opponent->actZ, ARGB(200,0,0,0));
}
else if (self == active)
{
r->FillRect(self->actX - w * self->actZ - 4.5f, self->actY - h-28 * self->actZ, 24 * self->actZ, h+28 * self->actZ, ARGB(200,0,0,0));
r->FillRect(self->actX - w * self->actZ - 4.5f, self->actY - h * self->actZ, w * self->actZ, h * self->actZ, ARGB(200,0,0,0));
r->FillRect(self->actX - w * self->actZ - 4.5f, self->actY - h-28 * self->actZ, 24 * self->actZ + 19, h+28 * self->actZ, ARGB(200,0,0,0));
//r->FillRect(self->actX - w * self->actZ - 4.5f, self->actY - h * self->actZ, w * self->actZ, h * self->actZ, ARGB(200,0,0,0));
}
GuiLayer::Render();