Commit 44b7e104 authored by fallenstardust's avatar fallenstardust

优化超量素材叠放视觉

parent bfacf1f8
...@@ -869,6 +869,9 @@ void ClientField::GetCardLocation(ClientCard* pcard, irr::core::vector3df* t, ir ...@@ -869,6 +869,9 @@ void ClientField::GetCardLocation(ClientCard* pcard, irr::core::vector3df* t, ir
int sequence = pcard->sequence; int sequence = pcard->sequence;
int location = pcard->location; int location = pcard->location;
int rule = (mainGame->dInfo.duel_rule >= 4) ? 1 : 0; int rule = (mainGame->dInfo.duel_rule >= 4) ? 1 : 0;
const float overlay_buttom = 0.0f;
const float material_height = 0.003f;
const float mzone_buttom = 0.020f;
switch (location) { switch (location) {
case LOCATION_DECK: { case LOCATION_DECK: {
t->X = (matManager.vFieldDeck[controler][0].Pos.X + matManager.vFieldDeck[controler][1].Pos.X) / 2; t->X = (matManager.vFieldDeck[controler][0].Pos.X + matManager.vFieldDeck[controler][1].Pos.X) / 2;
...@@ -948,7 +951,7 @@ void ClientField::GetCardLocation(ClientCard* pcard, irr::core::vector3df* t, ir ...@@ -948,7 +951,7 @@ void ClientField::GetCardLocation(ClientCard* pcard, irr::core::vector3df* t, ir
case LOCATION_MZONE: { case LOCATION_MZONE: {
t->X = (matManager.vFieldMzone[controler][sequence][0].Pos.X + matManager.vFieldMzone[controler][sequence][1].Pos.X) / 2; t->X = (matManager.vFieldMzone[controler][sequence][0].Pos.X + matManager.vFieldMzone[controler][sequence][1].Pos.X) / 2;
t->Y = (matManager.vFieldMzone[controler][sequence][0].Pos.Y + matManager.vFieldMzone[controler][sequence][2].Pos.Y) / 2; t->Y = (matManager.vFieldMzone[controler][sequence][0].Pos.Y + matManager.vFieldMzone[controler][sequence][2].Pos.Y) / 2;
t->Z = 0.01f; t->Z = mzone_buttom;
if (controler == 0) { if (controler == 0) {
if (pcard->position & POS_DEFENSE) { if (pcard->position & POS_DEFENSE) {
r->X = 0.0f; r->X = 0.0f;
...@@ -1061,21 +1064,22 @@ void ClientField::GetCardLocation(ClientCard* pcard, irr::core::vector3df* t, ir ...@@ -1061,21 +1064,22 @@ void ClientField::GetCardLocation(ClientCard* pcard, irr::core::vector3df* t, ir
break; break;
} }
case LOCATION_OVERLAY: { case LOCATION_OVERLAY: {
if (pcard->overlayTarget->location != 0x4) { if (pcard->overlayTarget->location != LOCATION_MZONE) {
return; return;
} }
int oseq = pcard->overlayTarget->sequence; int oseq = pcard->overlayTarget->sequence;
int mseq = (sequence < MAX_LAYER_COUNT) ? sequence : (MAX_LAYER_COUNT - 1);
if (pcard->overlayTarget->controler == 0) { if (pcard->overlayTarget->controler == 0) {
t->X = (matManager.vFieldMzone[0][oseq][0].Pos.X + matManager.vFieldMzone[0][oseq][1].Pos.X) / 2 - 0.12f + 0.06f * sequence; t->X = (matManager.vFieldMzone[0][oseq][0].Pos.X + matManager.vFieldMzone[0][oseq][1].Pos.X) / 2 - 0.12f + 0.06f * mseq;
t->Y = (matManager.vFieldMzone[0][oseq][0].Pos.Y + matManager.vFieldMzone[0][oseq][2].Pos.Y) / 2 + 0.05f; t->Y = (matManager.vFieldMzone[0][oseq][0].Pos.Y + matManager.vFieldMzone[0][oseq][2].Pos.Y) / 2 + 0.05f;
t->Z = 0.005f + pcard->sequence * 0.0001f; t->Z = overlay_buttom + mseq * material_height;
r->X = 0.0f; r->X = 0.0f;
r->Y = 0.0f; r->Y = 0.0f;
r->Z = 0.0f; r->Z = 0.0f;
} else { } else {
t->X = (matManager.vFieldMzone[1][oseq][0].Pos.X + matManager.vFieldMzone[1][oseq][1].Pos.X) / 2 + 0.12f - 0.06f * sequence; t->X = (matManager.vFieldMzone[1][oseq][0].Pos.X + matManager.vFieldMzone[1][oseq][1].Pos.X) / 2 + 0.12f - 0.06f * mseq;
t->Y = (matManager.vFieldMzone[1][oseq][0].Pos.Y + matManager.vFieldMzone[1][oseq][2].Pos.Y) / 2 - 0.05f; t->Y = (matManager.vFieldMzone[1][oseq][0].Pos.Y + matManager.vFieldMzone[1][oseq][2].Pos.Y) / 2 - 0.05f;
t->Z = 0.005f + pcard->sequence * 0.0001f; t->Z = overlay_buttom + mseq * material_height;
r->X = 0.0f; r->X = 0.0f;
r->Y = 0.0f; r->Y = 0.0f;
r->Z = 3.1415926f; r->Z = 3.1415926f;
......
...@@ -282,8 +282,21 @@ void Game::DrawLinkedZones(ClientCard* pcard, ClientCard* fcard) { ...@@ -282,8 +282,21 @@ void Game::DrawLinkedZones(ClientCard* pcard, ClientCard* fcard) {
} }
void Game::DrawCards() { void Game::DrawCards() {
for(auto cit = dField.overlay_cards.begin(); cit != dField.overlay_cards.end(); ++cit) for (auto cit = dField.overlay_cards.begin(); cit != dField.overlay_cards.end(); ++cit) {
DrawCard(*cit); auto pcard = (*cit);
auto olcard = pcard->overlayTarget;
if (pcard->aniFrame) {
DrawCard(pcard);
}
else if (olcard && olcard->location == LOCATION_MZONE) {
if (pcard->sequence < MAX_LAYER_COUNT) {
DrawCard(pcard);
}
}
else {
DrawCard(pcard);
}
}
for(int p = 0; p < 2; ++p) { for(int p = 0; p < 2; ++p) {
for(auto it = dField.mzone[p].begin(); it != dField.mzone[p].end(); ++it) for(auto it = dField.mzone[p].begin(); it != dField.mzone[p].end(); ++it)
if(*it) if(*it)
......
...@@ -2669,7 +2669,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2669,7 +2669,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->overlayTarget = olcard; pcard->overlayTarget = olcard;
pcard->location = LOCATION_OVERLAY; pcard->location = LOCATION_OVERLAY;
pcard->sequence = olcard->overlayed.size() - 1; pcard->sequence = olcard->overlayed.size() - 1;
if (olcard->location == 0x4) { if (olcard->location == LOCATION_MZONE) {
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->dField.MoveCard(pcard, 10); mainGame->dField.MoveCard(pcard, 10);
if (pl == 0x2) if (pl == 0x2)
......
...@@ -2554,25 +2554,62 @@ void ClientField::GetHoverField(int x, int y) { ...@@ -2554,25 +2554,62 @@ void ClientField::GetHoverField(int x, int y) {
hovered_sequence = sequence; hovered_sequence = sequence;
} else if(boardy >= matManager.vFieldMzone[0][5][0].Pos.Y && boardy <= matManager.vFieldMzone[0][5][2].Pos.Y) { } else if(boardy >= matManager.vFieldMzone[0][5][0].Pos.Y && boardy <= matManager.vFieldMzone[0][5][2].Pos.Y) {
if(sequence == 1) { if(sequence == 1) {
if(!mzone[1][6]) { if (mzone[0][5]) {
hovered_controler = 0; hovered_controler = 0;
hovered_location = LOCATION_MZONE; hovered_location = LOCATION_MZONE;
hovered_sequence = 5; hovered_sequence = 5;
} else { }
else if(mzone[1][6]) {
hovered_controler = 1; hovered_controler = 1;
hovered_location = LOCATION_MZONE; hovered_location = LOCATION_MZONE;
hovered_sequence = 6; hovered_sequence = 6;
} }
} else if(sequence == 3) { else if((mainGame->dInfo.curMsg == MSG_SELECT_PLACE || mainGame->dInfo.curMsg == MSG_SELECT_DISFIELD)) {
if(!mzone[1][5]) { if (mainGame->dField.selectable_field & (0x1 << (16 + 6))) {
hovered_controler = 1;
hovered_location = LOCATION_MZONE;
hovered_sequence = 6;
}
else {
hovered_controler = 0;
hovered_location = LOCATION_MZONE;
hovered_sequence = 5;
}
}
else{
hovered_controler = 0;
hovered_location = LOCATION_MZONE;
hovered_sequence = 5;
}
}
else if(sequence == 3) {
if (mzone[0][6]) {
hovered_controler = 0; hovered_controler = 0;
hovered_location = LOCATION_MZONE; hovered_location = LOCATION_MZONE;
hovered_sequence = 6; hovered_sequence = 6;
} else { }
else if (mzone[1][5]) {
hovered_controler = 1; hovered_controler = 1;
hovered_location = LOCATION_MZONE; hovered_location = LOCATION_MZONE;
hovered_sequence = 5; hovered_sequence = 5;
} }
else if ((mainGame->dInfo.curMsg == MSG_SELECT_PLACE || mainGame->dInfo.curMsg == MSG_SELECT_DISFIELD)) {
if (mainGame->dField.selectable_field & (0x1 << (16 + 5))) {
hovered_controler = 1;
hovered_location = LOCATION_MZONE;
hovered_sequence = 5;
}
else {
hovered_controler = 0;
hovered_location = LOCATION_MZONE;
hovered_sequence = 6;
}
}
else {
hovered_controler = 0;
hovered_location = LOCATION_MZONE;
hovered_sequence = 6;
}
} }
} else if(boardy >= matManager.vFieldMzone[1][0][2].Pos.Y && boardy <= matManager.vFieldMzone[1][0][0].Pos.Y) { } else if(boardy >= matManager.vFieldMzone[1][0][2].Pos.Y && boardy <= matManager.vFieldMzone[1][0][0].Pos.Y) {
hovered_controler = 1; hovered_controler = 1;
......
...@@ -927,6 +927,7 @@ extern Game* mainGame; ...@@ -927,6 +927,7 @@ extern Game* mainGame;
#define DEFAULT_DUEL_RULE 5 #define DEFAULT_DUEL_RULE 5
#define CARD_ARTWORK_VERSIONS_OFFSET 10 #define CARD_ARTWORK_VERSIONS_OFFSET 10
#define MAX_LAYER_COUNT 6
#ifdef _IRR_ANDROID_PLATFORM_ #ifdef _IRR_ANDROID_PLATFORM_
#define GAME_WIDTH 1024 #define GAME_WIDTH 1024
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment