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