Commit fbc256c3 authored by argon.sun's avatar argon.sun

fix

parent d0007b49
......@@ -87,8 +87,10 @@ void ClientField::Initial(int player, int deckc, int extrac) {
pcard->mTransform.setRotationRadians(pcard->curRot);
}
}
ClientCard* ClientField::GetCard(int controler, int location, int sequence) {
ClientCard* ClientField::GetCard(int controler, int location, int sequence, int sub_seq) {
std::vector<ClientCard*>* lst = 0;
bool is_xyz = (location & 0x80);
location &= 0x7f;
switch(location) {
case LOCATION_DECK:
lst = &deck[controler];
......@@ -114,9 +116,19 @@ ClientCard* ClientField::GetCard(int controler, int location, int sequence) {
}
if(!lst)
return 0;
if(is_xyz) {
if(sequence >= lst->size())
return 0;
ClientCard* scard = (*lst)[sequence];
if(scard && scard->overlayed.size() > sub_seq)
return scard->overlayed[sub_seq];
else
return 0;
} else {
if(sequence >= lst->size())
return 0;
return (*lst)[sequence];
}
}
void ClientField::AddCard(ClientCard* pcard, int controler, int location, int sequence) {
pcard->controler = controler;
......@@ -393,6 +405,20 @@ void ClientField::ReplaySwap() {
std::swap(grave[0], grave[1]);
std::swap(remove[0], remove[1]);
std::swap(extra[0], extra[1]);
RefreshAllCards();
mainGame->dInfo.isFirst = !mainGame->dInfo.isFirst;
std::swap(mainGame->dInfo.lp[0], mainGame->dInfo.lp[1]);
for(int i = 0; i < 16; ++i)
std::swap(mainGame->dInfo.strLP[0][i], mainGame->dInfo.strLP[1][i]);
for(int i = 0; i < 20; ++i)
std::swap(mainGame->dInfo.hostname[i], mainGame->dInfo.clientname[i]);
for(auto chit = chains.begin(); chit != chains.end(); ++chit) {
chit->controler = 1 - chit->controler;
GetChainLocation(chit->controler, chit->location, chit->sequence, &chit->chain_pos);
}
disabled_field = (disabled_field >> 16) | (disabled_field << 16);
}
void ClientField::RefreshAllCards() {
for(int p = 0; p < 2; ++p) {
for(auto cit = deck[p].begin(); cit != deck[p].end(); ++cit) {
(*cit)->controler = 1 - (*cit)->controler;
......@@ -455,17 +481,6 @@ void ClientField::ReplaySwap() {
(*cit)->mTransform.setRotationRadians((*cit)->curRot);
(*cit)->is_moving = false;
}
mainGame->dInfo.isFirst = !mainGame->dInfo.isFirst;
std::swap(mainGame->dInfo.lp[0], mainGame->dInfo.lp[1]);
for(int i = 0; i < 16; ++i)
std::swap(mainGame->dInfo.strLP[0][i], mainGame->dInfo.strLP[1][i]);
for(int i = 0; i < 20; ++i)
std::swap(mainGame->dInfo.hostname[i], mainGame->dInfo.clientname[i]);
for(auto chit = chains.begin(); chit != chains.end(); ++chit) {
chit->controler = 1 - chit->controler;
GetChainLocation(chit->controler, chit->location, chit->sequence, &chit->chain_pos);
}
disabled_field = (disabled_field >> 16) | (disabled_field << 16);
}
void ClientField::GetChainLocation(int controler, int location, int sequence, irr::core::vector3df* t) {
t->X = 0;
......
......@@ -72,7 +72,7 @@ public:
ClientField();
void Clear();
void Initial(int player, int deckc, int extrac);
ClientCard* GetCard(int controler, int location, int sequence);
ClientCard* GetCard(int controler, int location, int sequence, int sub_seq = 0);
void AddCard(ClientCard* pcard, int controler, int location, int sequence);
ClientCard* RemoveCard(int controler, int location, int sequence);
void UpdateCard(int controler, int location, int sequence, char* data);
......@@ -82,6 +82,7 @@ public:
void ClearChainSelect();
void ShowSelectCard(bool buttonok = false);
void ReplaySwap();
void RefreshAllCards();
void GetChainLocation(int controler, int location, int sequence, irr::core::vector3df* t);
void GetCardLocation(ClientCard* pcard, irr::core::vector3df* t, irr::core::vector3df* r, bool setTrans = false);
......
......@@ -53,14 +53,19 @@ void Game::DrawBackGround() {
im.setTranslation(vector3df(0, 0, -0.01));
driver->setTransform(irr::video::ETS_WORLD, im);
//dark shade
matManager.mSelField.AmbientColor = 0xff000000;
matManager.mSelField.DiffuseColor = 0xa0000000;
driver->setMaterial(matManager.mSelField);
for(int i = 0; i < 120; i += 4)
driver->drawVertexPrimitiveList(&matManager.vFields[i], 4, matManager.iRectangle, 2);
// matManager.mSelField.AmbientColor = 0xff000000;
// matManager.mSelField.DiffuseColor = 0xa0000000;
// driver->setMaterial(matManager.mSelField);
// for(int i = 0; i < 120; i += 4)
// driver->drawVertexPrimitiveList(&matManager.vFields[i], 4, matManager.iRectangle, 2);
// driver->setTransform(irr::video::ETS_WORLD, irr::core::IdentityMatrix);
// driver->setMaterial(matManager.mBackLine);
// driver->drawVertexPrimitiveList(matManager.vBackLine, 76, matManager.iBackLine, 58, irr::video::EVT_STANDARD, irr::scene::EPT_LINES);
//draw field
driver->setTransform(irr::video::ETS_WORLD, irr::core::IdentityMatrix);
driver->setMaterial(matManager.mBackLine);
driver->drawVertexPrimitiveList(matManager.vBackLine, 76, matManager.iBackLine, 58, irr::video::EVT_STANDARD, irr::scene::EPT_LINES);
matManager.mTexture.setTexture(0, imageManager.tField);
driver->setMaterial(matManager.mTexture);
driver->drawVertexPrimitiveList(matManager.vField, 4, matManager.iRectangle, 2);
//select field
if(dInfo.curMsg == MSG_SELECT_PLACE || dInfo.curMsg == MSG_SELECT_DISFIELD) {
float cv[4] = {0.0f, 0.0f, 1.0f, 1.0f};
......
......@@ -7,6 +7,7 @@
#include "../ocgcore/duel.h"
#include "game.h"
#include "replay.h"
#include "replay_mode.h"
namespace ygo {
......@@ -714,6 +715,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int type = BufferIO::ReadInt8(pbuf);
int player = BufferIO::ReadInt8(pbuf);
int data = BufferIO::ReadInt32(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true;
switch (type) {
case HINT_EVENT: {
myswprintf(event_string, L"%ls", dataManager.GetDesc(data));
......@@ -811,6 +814,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->showcardp = 0;
mainGame->dInfo.vic_string = 0;
wchar_t vic_buf[256];
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
mainGame->gMutex.Unlock();
if(player == 2)
mainGame->showcardcode = 3;
else if(mainGame->LocalPlayer(player) == 0) {
......@@ -1418,9 +1423,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int count = BufferIO::ReadInt8(pbuf);
int code;
ClientCard* pcard;
myswprintf(textBuffer, dataManager.GetSysString(207), count);
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
mainGame->dField.selectable_cards.clear();
for (int i = 0; i < count; ++i) {
code = BufferIO::ReadInt32(pbuf);
......@@ -1429,11 +1431,18 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if (code != 0)
pcard->SetCode(code);
}
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true;
myswprintf(textBuffer, dataManager.GetSysString(207), count);
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
for (int i = 0; i < count; ++i) {
pcard = *(mainGame->dField.deck[player].rbegin() + i);
mainGame->gMutex.Lock();
myswprintf(textBuffer, L"*[%ls]", dataManager.GetName(pcard->code));
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(pcard->code);
mainGame->gMutex.Unlock();
float shift = -0.15f;
if (player == 1) shift = 0.15f;
pcard->dPos = irr::core::vector3df(shift, 0, 0);
......@@ -1455,6 +1464,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
std::vector<ClientCard*> field_confirm;
std::vector<ClientCard*> panel_confirm;
ClientCard* pcard;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
pbuf += count * 7;
return true;
}
myswprintf(textBuffer, dataManager.GetSysString(208), count);
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
......@@ -1466,9 +1479,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard = mainGame->dField.GetCard(c, l, s);
if (code != 0)
pcard->SetCode(code);
mainGame->gMutex.Lock();
myswprintf(textBuffer, L"*[%ls]", dataManager.GetName(code));
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(code);
mainGame->gMutex.Unlock();
if (l & 0x41) {
if(count == 1) {
float shift = -0.15f;
......@@ -1537,14 +1552,17 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
case MSG_SHUFFLE_DECK: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
bool rev = mainGame->dField.deck_reversed;
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->dField.deck_reversed = false;
if(rev) {
for (int i = 0; i < mainGame->dField.deck[player].size(); ++i)
mainGame->dField.MoveCard(mainGame->dField.deck[player][i], 10);
mainGame->WaitFrameSignal(10);
}
}
for (int i = 0; i < mainGame->dField.deck[player].size(); ++i)
mainGame->dField.deck[player][i]->code = 0;
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
for (int i = 0; i < 5; ++i) {
for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ++cit) {
(*cit)->dPos = irr::core::vector3df(rand() * 0.4f / RAND_MAX - 0.2f, 0, 0);
......@@ -1562,11 +1580,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
for (int i = 0; i < mainGame->dField.deck[player].size(); ++i)
mainGame->dField.MoveCard(mainGame->dField.deck[player][i], 10);
}
}
return true;
}
case MSG_SHUFFLE_HAND: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int count = BufferIO::ReadInt8(pbuf);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->WaitFrameSignal(5);
if(player == 1 && !mainGame->dInfo.isReplay && !mainGame->dInfo.isSingleMode) {
bool flip = false;
......@@ -1590,13 +1610,16 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
(*cit)->aniFrame = 5;
}
mainGame->WaitFrameSignal(11);
}
for (auto cit = mainGame->dField.hand[player].begin(); cit != mainGame->dField.hand[player].end(); ++cit)
(*cit)->SetCode(BufferIO::ReadInt32(pbuf));
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
for (auto cit = mainGame->dField.hand[player].begin(); cit != mainGame->dField.hand[player].end(); ++cit) {
(*cit)->is_hovered = false;
mainGame->dField.MoveCard(*cit, 5);
}
mainGame->WaitFrameSignal(5);
}
return true;
}
case MSG_REFRESH_DECK: {
......@@ -1605,27 +1628,36 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
case MSG_SWAP_GRAVE_DECK: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
std::vector<ClientCard*>::iterator cit;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
mainGame->dField.grave[player].swap(mainGame->dField.deck[player]);
for (auto cit = mainGame->dField.grave[player].begin(); cit != mainGame->dField.grave[player].end(); ++cit)
(*cit)->location = LOCATION_GRAVE;
for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ++cit)
(*cit)->location = LOCATION_DECK;
} else {
mainGame->gMutex.Lock();
mainGame->dField.grave[player].swap(mainGame->dField.deck[player]);
for (cit = mainGame->dField.grave[player].begin(); cit != mainGame->dField.grave[player].end(); ++cit) {
for (auto cit = mainGame->dField.grave[player].begin(); cit != mainGame->dField.grave[player].end(); ++cit) {
(*cit)->location = LOCATION_GRAVE;
mainGame->dField.MoveCard(*cit, 10);
}
for (cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ++cit) {
for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ++cit) {
(*cit)->location = LOCATION_DECK;
mainGame->dField.MoveCard(*cit, 10);
}
mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(11);
}
return true;
}
case MSG_REVERSE_DECK: {
mainGame->dField.deck_reversed = !mainGame->dField.deck_reversed;
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
for(int i = 0; i < mainGame->dField.deck[0].size(); ++i)
mainGame->dField.MoveCard(mainGame->dField.deck[0][i], 10);
for(int i = 0; i < mainGame->dField.deck[1].size(); ++i)
mainGame->dField.MoveCard(mainGame->dField.deck[1][i], 10);
}
return true;
}
case MSG_DECK_TOP: {
......@@ -1648,11 +1680,14 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
BufferIO::ReadInt8(pbuf);
mc[i] = mainGame->dField.mzone[c][s];
mc[i]->SetCode(0);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mc[i]->dPos = irr::core::vector3df((3.95f - mc[i]->curPos.X) / 10, 0, 0.05f);
mc[i]->dRot = irr::core::vector3df(0, 0, 0);
mc[i]->is_moving = true;
mc[i]->aniFrame = 10;
}
}
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping)
mainGame->WaitFrameSignal(20);
for (int i = 0; i < count; ++i) {
c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
......@@ -1668,12 +1703,14 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
swp->sequence = ps;
}
}
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
for (int i = 0; i < count; ++i) {
mainGame->dField.MoveCard(mc[i], 10);
for (cit = mc[i]->overlayed.begin(); cit != mc[i]->overlayed.end(); ++cit)
mainGame->dField.MoveCard(*cit, 10);
}
mainGame->WaitFrameSignal(11);
}
return true;
}
case MSG_NEW_TURN: {
......@@ -1689,6 +1726,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
else
mainGame->dInfo.tag_player[1] = !mainGame->dInfo.tag_player[1];
}
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
myswprintf(mainGame->dInfo.strTurn, L"Turn:%d", mainGame->dInfo.turn);
mainGame->showcardcode = 10;
mainGame->showcarddif = 30;
......@@ -1696,18 +1734,17 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->showcard = 101;
mainGame->WaitFrameSignal(40);
mainGame->showcard = 0;
}
return true;
}
case MSG_NEW_PHASE: {
int phase = (unsigned char)BufferIO::ReadInt8(pbuf);
mainGame->gMutex.Lock();
mainGame->btnDP->setVisible(false);
mainGame->btnSP->setVisible(false);
mainGame->btnM1->setVisible(false);
mainGame->btnBP->setVisible(false);
mainGame->btnM2->setVisible(false);
mainGame->btnEP->setVisible(false);
mainGame->gMutex.Unlock();
mainGame->showcarddif = 30;
mainGame->showcardp = 0;
switch (phase) {
......@@ -1742,9 +1779,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->showcardcode = 9;
break;
}
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->showcard = 101;
mainGame->WaitFrameSignal(40);
mainGame->showcard = 0;
}
return true;
}
case MSG_MOVE: {
......@@ -1762,6 +1801,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
ClientCard* pcard = new ClientCard();
pcard->position = cp;
pcard->SetCode(code);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->gMutex.Lock();
mainGame->dField.AddCard(pcard, cc, cl, cs);
mainGame->gMutex.Unlock();
......@@ -1771,6 +1811,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->curAlpha = 5;
mainGame->dField.FadeCard(pcard, 255, 20);
mainGame->WaitFrameSignal(20);
} else
mainGame->dField.AddCard(pcard, cc, cl, cs);
} else if (cl == 0) {
ClientCard* pcard = mainGame->dField.GetCard(pc, pl, ps);
if (code != 0 && pcard->code != code)
......@@ -1778,6 +1820,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->ClearTarget();
for(auto eqit = pcard->equipped.begin(); eqit != pcard->equipped.end(); ++eqit)
(*eqit)->equipTarget = 0;
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->dField.FadeCard(pcard, 5, 20);
mainGame->WaitFrameSignal(20);
mainGame->gMutex.Lock();
......@@ -1785,6 +1828,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->gMutex.Unlock();
if(pcard == mainGame->dField.hovered_card)
mainGame->dField.hovered_card = 0;
}
delete pcard;
} else {
if (!(pl & 0x80) && !(cl & 0x80)) {
......@@ -1805,6 +1849,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
pcard->is_showequip = false;
pcard->is_showtarget = false;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
mainGame->dField.RemoveCard(pc, pl, ps);
pcard->position = cp;
mainGame->dField.AddCard(pcard, cc, cl, cs);
} else {
mainGame->gMutex.Lock();
mainGame->dField.RemoveCard(pc, pl, ps);
pcard->position = cp;
......@@ -1842,6 +1891,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
mainGame->WaitFrameSignal(5);
}
}
} else if (!(pl & 0x80)) {
ClientCard* pcard = mainGame->dField.GetCard(pc, pl, ps);
if (code != 0 && pcard->code != code)
......@@ -1849,6 +1899,14 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->counters.clear();
pcard->ClearTarget();
ClientCard* olcard = mainGame->dField.GetCard(cc, cl & 0x7f, cs);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
mainGame->dField.RemoveCard(pc, pl, ps);
olcard->overlayed.push_back(pcard);
mainGame->dField.overlay_cards.insert(pcard);
pcard->overlayTarget = olcard;
pcard->location = 0x80;
pcard->sequence = olcard->overlayed.size() - 1;
} else {
mainGame->gMutex.Lock();
mainGame->dField.RemoveCard(pc, pl, ps);
olcard->overlayed.push_back(pcard);
......@@ -1866,9 +1924,19 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(5);
}
}
} else if (!(cl & 0x80)) {
ClientCard* olcard = mainGame->dField.GetCard(pc, pl & 0x7f, ps);
ClientCard* pcard = olcard->overlayed[pp];
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
olcard->overlayed.erase(olcard->overlayed.begin() + pcard->sequence);
pcard->overlayTarget = 0;
pcard->position = cp;
mainGame->dField.AddCard(pcard, cc, cl, cs);
mainGame->dField.overlay_cards.erase(pcard);
for (int i = 0; i < olcard->overlayed.size(); ++i)
olcard->overlayed[i]->sequence = i;
} else {
mainGame->gMutex.Lock();
olcard->overlayed.erase(olcard->overlayed.begin() + pcard->sequence);
pcard->overlayTarget = 0;
......@@ -1885,10 +1953,21 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.MoveCard(pcard, 10);
mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(5);
}
} else {
ClientCard* olcard1 = mainGame->dField.GetCard(pc, pl & 0x7f, ps);
ClientCard* pcard = olcard1->overlayed[pp];
ClientCard* olcard2 = mainGame->dField.GetCard(cc, cl & 0x7f, cs);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
olcard1->overlayed.erase(olcard1->overlayed.begin() + pcard->sequence);
olcard2->overlayed.push_back(pcard);
pcard->sequence = olcard2->overlayed.size() - 1;
pcard->location = 0x80;
pcard->overlayTarget = olcard2;
for (int i = 0; i < olcard1->overlayed.size(); ++i) {
olcard1->overlayed[i]->sequence = i;
}
} else {
mainGame->gMutex.Lock();
olcard1->overlayed.erase(olcard1->overlayed.begin() + pcard->sequence);
olcard2->overlayed.push_back(pcard);
......@@ -1904,6 +1983,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->WaitFrameSignal(5);
}
}
}
return true;
}
case MSG_POS_CHANGE: {
......@@ -1921,9 +2001,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if (code != 0 && pcard->code != code)
pcard->SetCode(code);
pcard->position = cp;
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
myswprintf(event_string, dataManager.GetSysString(1600));
mainGame->dField.MoveCard(pcard, 10);
mainGame->WaitFrameSignal(11);
}
return true;
}
case MSG_SET: {
......@@ -1949,6 +2031,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf(event_string, dataManager.GetSysString(1602));
ClientCard* pc1 = mainGame->dField.GetCard(c1, l1, s1);
ClientCard* pc2 = mainGame->dField.GetCard(c2, l2, s2);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->gMutex.Lock();
mainGame->dField.RemoveCard(c1, l1, s1);
mainGame->dField.RemoveCard(c2, l2, s2);
......@@ -1962,6 +2045,12 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.MoveCard(pc2->overlayed[i], 10);
mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(11);
} else {
mainGame->dField.RemoveCard(c1, l1, s1);
mainGame->dField.RemoveCard(c2, l2, s2);
mainGame->dField.AddCard(pc1, c2, l2, s2);
mainGame->dField.AddCard(pc2, c1, l1, s1);
}
return true;
}
case MSG_FIELD_DISABLED: {
......@@ -1977,6 +2066,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int cl = BufferIO::ReadInt8(pbuf);
int cs = BufferIO::ReadInt8(pbuf);
int cp = BufferIO::ReadInt8(pbuf);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
myswprintf(event_string, dataManager.GetSysString(1603), dataManager.GetName(code));
mainGame->showcardcode = code;
mainGame->showcarddif = 0;
......@@ -1985,6 +2075,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->WaitFrameSignal(30);
mainGame->showcard = 0;
mainGame->WaitFrameSignal(11);
}
return true;
}
case MSG_SUMMONED: {
......@@ -1997,6 +2088,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int cl = BufferIO::ReadInt8(pbuf);
int cs = BufferIO::ReadInt8(pbuf);
int cp = BufferIO::ReadInt8(pbuf);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
myswprintf(event_string, dataManager.GetSysString(1605), dataManager.GetName(code));
mainGame->showcardcode = code;
mainGame->showcarddif = 1;
......@@ -2004,6 +2096,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->WaitFrameSignal(30);
mainGame->showcard = 0;
mainGame->WaitFrameSignal(11);
}
return true;
}
case MSG_SPSUMMONED: {
......@@ -2019,6 +2112,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
ClientCard* pcard = mainGame->dField.GetCard(cc, cl, cs);
pcard->SetCode(code);
pcard->position = cp;
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
myswprintf(event_string, dataManager.GetSysString(1607), dataManager.GetName(code));
mainGame->dField.MoveCard(pcard, 10);
mainGame->WaitFrameSignal(11);
......@@ -2029,6 +2123,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->WaitFrameSignal(30);
mainGame->showcard = 0;
mainGame->WaitFrameSignal(11);
}
return true;
}
case MSG_FLIPSUMMONED: {
......@@ -2040,13 +2135,15 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int pcc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int pcl = BufferIO::ReadInt8(pbuf);
int pcs = BufferIO::ReadInt8(pbuf);
BufferIO::ReadInt8(pbuf);
int subs = BufferIO::ReadInt8(pbuf);
int cc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int cl = BufferIO::ReadInt8(pbuf);
int cs = BufferIO::ReadInt8(pbuf);
int desc = BufferIO::ReadInt32(pbuf);
int ct = BufferIO::ReadInt8(pbuf);
ClientCard* pcard = mainGame->dField.GetCard(pcc, pcl, pcs);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true;
ClientCard* pcard = mainGame->dField.GetCard(pcc, pcl, pcs, subs);
mainGame->showcardcode = code;
mainGame->showcarddif = 0;
mainGame->showcard = 1;
......@@ -2079,6 +2176,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
case MSG_CHAINED: {
int ct = BufferIO::ReadInt8(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true;
myswprintf(event_string, dataManager.GetSysString(1609), dataManager.GetName(mainGame->dField.current_chain.code));
mainGame->gMutex.Lock();
mainGame->dField.chains.push_back(mainGame->dField.current_chain);
......@@ -2090,6 +2189,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
case MSG_CHAIN_SOLVING: {
int ct = BufferIO::ReadInt8(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true;
if (mainGame->dField.chains.size() > 1) {
if (mainGame->dField.last_chain)
mainGame->WaitFrameSignal(11);
......@@ -2114,11 +2215,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
case MSG_CHAIN_NEGATED:
case MSG_CHAIN_DISABLED: {
int ct = BufferIO::ReadInt8(pbuf);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->showcardcode = mainGame->dField.chains[ct - 1].code;
mainGame->showcarddif = 0;
mainGame->showcard = 3;
mainGame->WaitFrameSignal(30);
mainGame->showcard = 0;
}
return true;
}
case MSG_CARD_SELECTED: {
......@@ -2127,6 +2230,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
case MSG_RANDOM_SELECTED: {
int player = BufferIO::ReadInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
pbuf += count * 4;
return true;
}
ClientCard* pcards[10];
for (int i = 0; i < count; ++i) {
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
......@@ -2146,6 +2253,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
case MSG_BECOME_TARGET: {
int count = BufferIO::ReadInt8(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
pbuf += count * 4;
return true;
}
ClientCard* pcard;
for (int i = 0; i < count; ++i) {
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
......@@ -2180,6 +2291,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if(!mainGame->dField.deck_reversed || code)
pcard->SetCode(code);
}
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
for (int i = 0; i < count; ++i) {
pcard = mainGame->dField.GetCard(player, LOCATION_DECK, mainGame->dField.deck[player].size() - 1);
mainGame->dField.deck[player].erase(mainGame->dField.deck[player].end() - 1);
mainGame->dField.AddCard(pcard, player, LOCATION_HAND, 0);
}
} else {
for (int i = 0; i < count; ++i) {
mainGame->gMutex.Lock();
pcard = mainGame->dField.GetCard(player, LOCATION_DECK, mainGame->dField.deck[player].size() - 1);
......@@ -2190,6 +2308,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(5);
}
}
if (player == 0)
myswprintf(event_string, dataManager.GetSysString(1611), count);
else myswprintf(event_string, dataManager.GetSysString(1612), count);
......@@ -2201,6 +2320,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int final = mainGame->dInfo.lp[player] - val;
if (final < 0)
final = 0;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
mainGame->dInfo.lp[player] = final;
myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]);
return true;
}
mainGame->lpd = (mainGame->dInfo.lp[player] - final) / 10;
if (player == 0)
myswprintf(event_string, dataManager.GetSysString(1613), val);
......@@ -2224,6 +2348,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int val = BufferIO::ReadInt32(pbuf);
int final = mainGame->dInfo.lp[player] + val;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
mainGame->dInfo.lp[player] = final;
myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]);
return true;
}
mainGame->lpd = (mainGame->dInfo.lp[player] - final) / 10;
if (player == 0)
myswprintf(event_string, dataManager.GetSysString(1615), val);
......@@ -2254,6 +2383,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
BufferIO::ReadInt8(pbuf);
ClientCard* pc1 = mainGame->dField.GetCard(c1, l1, s1);
ClientCard* pc2 = mainGame->dField.GetCard(c2, l2, s2);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
pc1->equipTarget = pc2;
pc2->equipped.insert(pc1);
} else {
mainGame->gMutex.Lock();
pc1->equipTarget = pc2;
pc2->equipped.insert(pc1);
......@@ -2262,11 +2395,17 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
else if (mainGame->dField.hovered_card == pc2)
pc1->is_showequip = true;
mainGame->gMutex.Unlock();
}
return true;
}
case MSG_LPUPDATE: {
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int val = BufferIO::ReadInt32(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
mainGame->dInfo.lp[player] = val;
myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]);
return true;
}
mainGame->lpd = (mainGame->dInfo.lp[player] - val) / 10;
mainGame->lpplayer = player;
mainGame->lpframe = 10;
......@@ -2283,6 +2422,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int s1 = BufferIO::ReadInt8(pbuf);
BufferIO::ReadInt8(pbuf);
ClientCard* pc = mainGame->dField.GetCard(c1, l1, s1);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
pc->equipTarget->equipped.erase(pc);
pc->equipTarget = 0;
} else {
mainGame->gMutex.Lock();
if (mainGame->dField.hovered_card == pc)
pc->equipTarget->is_showequip = false;
......@@ -2291,6 +2434,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pc->equipTarget->equipped.erase(pc);
pc->equipTarget = 0;
mainGame->gMutex.Unlock();
}
return true;
}
case MSG_CARD_TARGET: {
......@@ -2304,6 +2448,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
BufferIO::ReadInt8(pbuf);
ClientCard* pc1 = mainGame->dField.GetCard(c1, l1, s1);
ClientCard* pc2 = mainGame->dField.GetCard(c2, l2, s2);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
pc1->cardTarget.insert(pc2);
pc2->ownerTarget.insert(pc1);
} else {
mainGame->gMutex.Lock();
pc1->cardTarget.insert(pc2);
pc2->ownerTarget.insert(pc1);
......@@ -2312,6 +2460,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
else if (mainGame->dField.hovered_card == pc2)
pc1->is_showtarget = true;
mainGame->gMutex.Unlock();
}
break;
}
case MSG_CANCEL_TARGET: {
......@@ -2325,6 +2474,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
BufferIO::ReadInt8(pbuf);
ClientCard* pc1 = mainGame->dField.GetCard(c1, l1, s1);
ClientCard* pc2 = mainGame->dField.GetCard(c2, l2, s2);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
pc1->cardTarget.erase(pc2);
pc2->ownerTarget.erase(pc1);
} else {
mainGame->gMutex.Lock();
pc1->cardTarget.erase(pc2);
pc2->ownerTarget.erase(pc1);
......@@ -2333,6 +2486,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
else if (mainGame->dField.hovered_card == pc2)
pc1->is_showtarget = false;
mainGame->gMutex.Unlock();
}
break;
}
case MSG_PAY_LPCOST: {
......@@ -2341,6 +2495,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int final = mainGame->dInfo.lp[player] - cost;
if (final < 0)
final = 0;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
mainGame->dInfo.lp[player] = final;
myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]);
return true;
}
mainGame->lpd = (mainGame->dInfo.lp[player] - final) / 10;
mainGame->lpccolor = 0xff0000ff;
mainGame->lpplayer = player;
......@@ -2366,6 +2525,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if (pc->counters.count(type))
pc->counters[type] += count;
else pc->counters[type] = count;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true;
myswprintf(textBuffer, dataManager.GetSysString(1617), dataManager.GetName(pc->code), count, dataManager.GetCounterName(type));
pc->is_highlighting = true;
mainGame->gMutex.Lock();
......@@ -2386,6 +2547,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pc->counters[type] -= count;
if (pc->counters[type] <= 0)
pc->counters.erase(type);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true;
myswprintf(textBuffer, dataManager.GetSysString(1618), dataManager.GetName(pc->code), count, dataManager.GetCounterName(type));
pc->is_highlighting = true;
mainGame->gMutex.Lock();
......@@ -2406,6 +2569,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int ld = BufferIO::ReadInt8(pbuf);
int sd = BufferIO::ReadInt8(pbuf);
BufferIO::ReadInt8(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true;
float sy;
if (ld != 0) {
mainGame->dField.attack_target = mainGame->dField.GetCard(cd, ld, sd);
......@@ -2458,6 +2623,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int datk = BufferIO::ReadInt32(pbuf);
int ddef = BufferIO::ReadInt32(pbuf);
int dd = BufferIO::ReadInt8(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true;
mainGame->gMutex.Lock();
ClientCard* pcard = mainGame->dField.GetCard(ca, la, sa);
if(aatk != pcard->attack) {
......@@ -2512,6 +2679,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
*pwbuf++ = L']';
}
*pwbuf = 0;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true;
mainGame->gMutex.Lock();
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
......@@ -2533,6 +2702,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
*pwbuf++ = L']';
}
*pwbuf = 0;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true;
mainGame->gMutex.Lock();
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
......@@ -2630,6 +2801,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if(chtype == CHINT_TURN) {
if(value == 0)
return true;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true;
if(pcard->location & LOCATION_ONFIELD)
pcard->is_highlighting = true;
mainGame->showcardcode = pcard->code;
......@@ -2648,6 +2821,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int ecount = BufferIO::ReadInt8(pbuf);
int hcount = BufferIO::ReadInt8(pbuf);
int topcode = BufferIO::ReadInt32(pbuf);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ++cit) {
if(player == 0) (*cit)->dPos.Y = 0.4f;
else (*cit)->dPos.Y = -0.6f;
......@@ -2670,7 +2844,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
(*cit)->aniFrame = 5;
}
mainGame->WaitFrameSignal(5);
}
//
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping)
mainGame->gMutex.Lock();
if(mainGame->dField.deck[player].size() > mcount) {
while(mainGame->dField.deck[player].size() > mcount) {
......@@ -2717,8 +2893,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.extra[player].push_back(ccard);
}
}
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping)
mainGame->gMutex.Unlock();
//
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ++cit) {
ClientCard* pcard = *cit;
mainGame->dField.GetCardLocation(pcard, &pcard->curPos, &pcard->curRot);
......@@ -2745,6 +2923,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.MoveCard(*cit, 5);
}
mainGame->WaitFrameSignal(5);
}
break;
}
case MSG_RELOAD_FIELD: {
......
......@@ -29,6 +29,7 @@ struct Config {
struct DuelInfo {
bool isStarted;
bool isReplay;
bool isReplaySkiping;
bool isFirst;
bool isTag;
bool isSingleMode;
......
......@@ -22,6 +22,7 @@ bool ImageManager::Initial() {
tHand[1] = driver->getTexture("textures/f2.jpg");
tHand[2] = driver->getTexture("textures/f3.jpg");
tBackGround = driver->getTexture("textures/bg.jpg");
tField = driver->getTexture("textures/field.png");
return true;
}
void ImageManager::SetDevice(irr::IrrlichtDevice* dev) {
......
......@@ -35,6 +35,7 @@ public:
irr::video::ITexture* tLim;
irr::video::ITexture* tHand[3];
irr::video::ITexture* tBackGround;
irr::video::ITexture* tField;
};
extern ImageManager imageManager;
......
......@@ -37,6 +37,10 @@ Materials::Materials() {
vActivate[1] = S3DVertex(vector3df(0.5, -0.5, 0), vector3df(0, 0, 1), SColor(255, 255, 255, 255), vector2df(1, 0));
vActivate[2] = S3DVertex(vector3df(-0.5, 0.5, 0), vector3df(0, 0, 1), SColor(255, 255, 255, 255), vector2df(0, 1));
vActivate[3] = S3DVertex(vector3df(0.5, 0.5, 0), vector3df(0, 0, 1), SColor(255, 255, 255, 255), vector2df(1, 1));
vField[0] = S3DVertex(vector3df(0.0, -4.0, 0), vector3df(0, 0, 1), SColor(255, 255, 255, 255), vector2df(0, 0));
vField[1] = S3DVertex(vector3df(8.0, -4.0, 0), vector3df(0, 0, 1), SColor(255, 255, 255, 255), vector2df(1, 0));
vField[2] = S3DVertex(vector3df(0.0, 4.0, 0), vector3df(0, 0, 1), SColor(255, 255, 255, 255), vector2df(0, 1));
vField[3] = S3DVertex(vector3df(8.0, 4.0, 0), vector3df(0, 0, 1), SColor(255, 255, 255, 255), vector2df(1, 1));
//background grids
for (int i = 0; i < 6; ++i) {
vBackLine[i * 6 + 0] = S3DVertex(vector3df(1.2f + i * 1.1f, 0.5f, -0.01f), vector3df(0, 0, 1), SColor(255, 255, 255, 255), vector2df(0, 0));
......
......@@ -15,6 +15,7 @@ public:
S3DVertex vNegate[4];
S3DVertex vChainNum[4];
S3DVertex vActivate[4];
S3DVertex vField[4];
S3DVertex vBackLine[76];
S3DVertex vFields[128];
S3DVertex vArrow[40];
......
......@@ -160,7 +160,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame->dField.Clear();
mainGame->HideElement(mainGame->wReplay);
mainGame->device->setEventReceiver(&mainGame->dField);
ReplayMode::StartReplay();
ReplayMode::StartReplay(0);
break;
}
case BUTTON_CANCEL_REPLAY: {
......
......@@ -15,9 +15,11 @@ bool ReplayMode::is_pausing = false;
bool ReplayMode::is_paused = false;
bool ReplayMode::is_swaping = false;
bool ReplayMode::exit_pending = false;
int ReplayMode::skip_turn = 0;
wchar_t ReplayMode::event_string[256];
bool ReplayMode::StartReplay() {
bool ReplayMode::StartReplay(int skipturn) {
skip_turn = skipturn;
Thread::NewThread(ReplayThread, 0);
return true;
}
......@@ -134,6 +136,13 @@ int ReplayMode::ReplayThread(void* param) {
char engineBuffer[0x1000];
is_continuing = true;
exit_pending = false;
if(skip_turn < 0)
skip_turn = 0;
if(skip_turn) {
mainGame->dInfo.isReplaySkiping = true;
mainGame->gMutex.Lock();
} else
mainGame->dInfo.isReplaySkiping = false;
int len = 0, flag = 0;
while (is_continuing && !exit_pending) {
int result = process(pduel);
......@@ -183,6 +192,8 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
mainGame->dInfo.curMsg = BufferIO::ReadUInt8(pbuf);
switch (mainGame->dInfo.curMsg) {
case MSG_RETRY: {
if(mainGame->dInfo.isReplaySkiping)
mainGame->gMutex.Unlock();
mainGame->gMutex.Lock();
mainGame->stMessage->setText(L"Error occurs.");
mainGame->PopupElement(mainGame->wMessage);
......@@ -344,6 +355,14 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
break;
}
case MSG_NEW_TURN: {
if(skip_turn) {
skip_turn--;
if(skip_turn == 0) {
mainGame->dInfo.isReplaySkiping = false;
mainGame->dField.RefreshAllCards();
mainGame->gMutex.Unlock();
}
}
player = BufferIO::ReadInt8(pbuf);
DuelClient::ClientAnalyze(offset, pbuf - offset);
break;
......@@ -365,7 +384,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
int cp = pbuf[11];
pbuf += 16;
DuelClient::ClientAnalyze(offset, pbuf - offset);
if(pl != cl || pc != cc)
if(cl && !(cl & 0x80) && (pl != cl || pc != cc))
ReplayRefreshSingle(cc, cl, cs);
break;
}
......
......@@ -18,12 +18,13 @@ private:
static bool is_paused;
static bool is_swaping;
static bool exit_pending;
static int skip_turn;
static wchar_t event_string[256];
public:
static Replay cur_replay;
public:
static bool StartReplay();
static bool StartReplay(int skipturn);
static void StopReplay(bool is_exiting = false);
static void SwapField();
static void Pause(bool is_pause, bool is_step);
......
......@@ -341,7 +341,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
int cp = pbuf[11];
pbuf += 16;
DuelClient::ClientAnalyze(offset, pbuf - offset);
if(pl != cl || pc != cc)
if(cl && !(cl & 0x80) && (pl != cl || pc != cc))
SinglePlayRefreshSingle(cc, cl, cs);
break;
}
......
......@@ -878,15 +878,15 @@ void card::reset(uint32 id, uint32 reset_type) {
if (rrm->second & 0xffff0000 & id)
relations.erase(rrm);
}
if(id & 0x7c0000)
if(id & 0x47c0000)
relate_effect.clear();
if(id & 0x1fc0000) {
if(id & 0x5fc0000) {
announced_cards.clear();
attacked_cards.clear();
announce_count = 0;
attacked_count = 0;
}
if(id & 0x1fe0000) {
if(id & 0x5fe0000) {
battled_cards.clear();
reset_effect_count();
auto pr = field_effect.equal_range(EFFECT_DISABLE_FIELD);
......
......@@ -2493,7 +2493,7 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
pcard->current.reason |= REASON_REDIRECT;
pcard->operation_param = (pcard->operation_param & 0xffff0000) | (redirect << 8) | redirect_seq;
}
if((pcard->current.location == LOCATION_MZONE) && pcard->is_status(STATUS_BATTLE_DESTROYED) && !(pcard->current.reason & REASON_DESTROY)) {
if((pcard->current.location == LOCATION_MZONE) && pcard->is_status(STATUS_BATTLE_DESTROYED) && !(pcard->current.reason & (REASON_DESTROY | REASON_EFFECT))) {
pcard->current.reason |= REASON_DESTROY | REASON_BATTLE;
raise_single_event(pcard, 0, EVENT_DESTROY, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
destroying.insert(pcard);
......
......@@ -17,15 +17,27 @@ function c61314842.xyzfilter(c,mg)
if c.xyz_count~=2 then return false end
return c:IsXyzSummonable(mg)
end
function c61314842.mfilter1(c,exg)
return exg:IsExists(c61314842.mfilter2,1,nil,c)
end
function c61314842.mfilter2(c,mc)
return c.xyz_filter(mc)
end
function c61314842.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
local mg=Duel.GetMatchingGroup(c61314842.filter,tp,LOCATION_GRAVE,0,nil,e,tp)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and mg:GetCount()>1
and Duel.IsExistingMatchingCard(c61314842.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,mg) end
local exg=Duel.GetMatchingGroup(c61314842.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg1=mg:FilterSelect(tp,c61314842.mfilter1,1,1,nil,exg)
local tc1=sg1:GetFirst()
local exg2=exg:Filter(c61314842.mfilter2,nil,tc1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=mg:Select(tp,2,2,nil)
Duel.SetTargetCard(g)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,2,0,0)
local sg2=mg:FilterSelect(tp,c61314842.mfilter1,1,1,tc1,exg2)
sg1:Merge(sg2)
Duel.SetTargetCard(sg1)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg1,2,0,0)
end
function c61314842.filter2(c,e,tp)
return c:IsRelateToEffect(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
......@@ -37,6 +49,7 @@ function c61314842.activate(e,tp,eg,ep,ev,re,r,rp)
local xyzg=Duel.GetMatchingGroup(c61314842.xyzfilter,tp,LOCATION_EXTRA,0,nil,g)
if xyzg:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local xyz=xyzg:Select(tp,1,1,nil):GetFirst()
Duel.XyzSummon(tp,xyz,g)
......
......@@ -3,7 +3,7 @@ function c96704018.initial_effect(c)
--lv change
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(96704018,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetOperation(c96704018.operation)
c:RegisterEffect(e1)
......
......@@ -362,11 +362,11 @@
!victory 0x2 没有卡可抽
!victory 0x3 超时
!victory 0x4 失去连接
!victory 0x10 封印されしエクゾディア
!victory 0x11 終焉のカウントダウン
!victory 0x12 毒蛇神ヴェノミナーガ
!victory 0x13 光の創造神 ホルアクティ
!victory 0x14 究極封印神エクゾディオス
!victory 0x10 「被封印的艾克佐迪亚」效果胜利
!victory 0x11 「终焉的倒计时」效果胜利
!victory 0x12 「毒蛇神 维诺米纳迦」效果胜利
!victory 0x13 「光之创造神 哈拉克提」效果胜利
!victory 0x14 「究极封印神 艾克佐迪奥斯」效果胜利
#counters
!counter 0x3001 魔力指示物
!counter 0x2 楔指示物
......
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