Commit fdd7fc1c authored by nanahira's avatar nanahira

Merge branch 'master' into server

parents da3b93d2 4ee9545d
...@@ -177,6 +177,46 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -177,6 +177,46 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
} }
break; break;
} }
case BUTTON_RENAME_DECK: {
int sel = mainGame->cbDBDecks->getSelected();
if(sel == -1)
break;
mainGame->gMutex.Lock();
mainGame->wRenameDeck->setText(dataManager.GetSysString(1367));
mainGame->ebREName->setText(mainGame->cbDBDecks->getItem(sel));
mainGame->PopupElement(mainGame->wRenameDeck);
mainGame->gMutex.Unlock();
prev_operation = id;
prev_sel = sel;
break;
}
case BUTTON_RENAME_DECK_SAVE: {
mainGame->HideElement(mainGame->wRenameDeck);
if(prev_operation == BUTTON_RENAME_DECK) {
wchar_t newname[256];
BufferIO::CopyWStr(mainGame->ebREName->getText(), newname, 256);
if(mywcsncasecmp(newname + wcslen(newname) - 4, L"", 4)) {
myswprintf(newname, L"%ls", mainGame->ebREName->getText());
}
if(DeckManager::RenameDeck(mainGame->cbDBDecks->getItem(prev_sel), newname)) {
mainGame->RefreshDeck(mainGame->cbDBDecks);
mainGame->cbDBDecks->setSelected(prev_sel);
mainGame->stACMessage->setText(dataManager.GetSysString(1366));
mainGame->PopupElement(mainGame->wACMessage, 20);
} else {
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1365));
}
}
prev_operation = 0;
prev_sel = -1;
break;
}
case BUTTON_RENAME_DECK_CANCEL: {
mainGame->HideElement(mainGame->wRenameDeck);
prev_operation = 0;
prev_sel = -1;
break;
}
case BUTTON_DELETE_DECK: { case BUTTON_DELETE_DECK: {
int sel = mainGame->cbDBDecks->getSelected(); int sel = mainGame->cbDBDecks->getSelected();
if(sel == -1) if(sel == -1)
......
...@@ -90,6 +90,23 @@ void DeckManager::LoadLFList() { ...@@ -90,6 +90,23 @@ void DeckManager::LoadLFList() {
nolimit.content = new std::unordered_map<int, int>; nolimit.content = new std::unordered_map<int, int>;
_lfList.push_back(nolimit); _lfList.push_back(nolimit);
} }
bool DeckManager::RenameDeck(const wchar_t* oldname, const wchar_t* newname) {
wchar_t oldfname[256];
wchar_t newfname[256];
myswprintf(oldfname, L"./deck/%ls.ydk", oldname);
myswprintf(newfname, L"./deck/%ls.ydk", newname);
#ifdef WIN32
BOOL result = MoveFileW(oldfname, newfname);
return !!result;
#else
char oldfilefn[256];
char newfilefn[256];
BufferIO::EncodeUTF8(oldfname, oldfilefn);
BufferIO::EncodeUTF8(newfname, newfilefn);
int result = rename(oldfilefn, newfilefn);
return result == 0;
#endif
}
wchar_t* DeckManager::GetLFListName(int lfhash) { wchar_t* DeckManager::GetLFListName(int lfhash) {
for(size_t i = 0; i < _lfList.size(); ++i) { for(size_t i = 0; i < _lfList.size(); ++i) {
if(_lfList[i].hash == (unsigned int)lfhash) { if(_lfList[i].hash == (unsigned int)lfhash) {
......
...@@ -44,6 +44,7 @@ public: ...@@ -44,6 +44,7 @@ public:
bool LoadDeck(const wchar_t* file); bool LoadDeck(const wchar_t* file);
bool SaveDeck(Deck& deck, const wchar_t* name); bool SaveDeck(Deck& deck, const wchar_t* name);
bool DeleteDeck(Deck& deck, const wchar_t* name); bool DeleteDeck(Deck& deck, const wchar_t* name);
static bool RenameDeck(const wchar_t* oldname, const wchar_t* newname);
}; };
extern DeckManager deckManager; extern DeckManager deckManager;
......
...@@ -662,6 +662,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -662,6 +662,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->btnChainAlways->setVisible(false); mainGame->btnChainAlways->setVisible(false);
mainGame->btnChainWhenAvail->setVisible(false); mainGame->btnChainWhenAvail->setVisible(false);
mainGame->btnCancelOrFinish->setVisible(false); mainGame->btnCancelOrFinish->setVisible(false);
if(!mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
mainGame->dInfo.isReplaySkiping = false;
mainGame->stMessage->setText(dataManager.GetSysString(1500)); mainGame->stMessage->setText(dataManager.GetSysString(1500));
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
...@@ -929,7 +931,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -929,7 +931,7 @@ 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) if(mainGame->dInfo.isReplaySkiping)
return true; return true;
switch (type) { switch (type) {
case HINT_EVENT: { case HINT_EVENT: {
...@@ -1059,6 +1061,12 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1059,6 +1061,12 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
case MSG_WIN: { case MSG_WIN: {
mainGame->dInfo.isFinished = true; mainGame->dInfo.isFinished = true;
if(!mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) {
mainGame->dInfo.isReplaySkiping = false;
mainGame->gMutex.Lock();
mainGame->dField.RefreshAllCards();
mainGame->gMutex.Unlock();
}
int player = BufferIO::ReadInt8(pbuf); int player = BufferIO::ReadInt8(pbuf);
int type = BufferIO::ReadInt8(pbuf); int type = BufferIO::ReadInt8(pbuf);
mainGame->showcarddif = 110; mainGame->showcarddif = 110;
...@@ -1928,7 +1936,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1928,7 +1936,7 @@ 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) if(mainGame->dInfo.isReplaySkiping)
return true; return true;
soundManager.PlaySoundEffect(SOUND_REVEAL); soundManager.PlaySoundEffect(SOUND_REVEAL);
myswprintf(textBuffer, dataManager.GetSysString(207), count); myswprintf(textBuffer, dataManager.GetSysString(207), count);
...@@ -1968,7 +1976,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1968,7 +1976,7 @@ 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) if(mainGame->dInfo.isReplaySkiping)
return true; return true;
soundManager.PlaySoundEffect(SOUND_REVEAL); soundManager.PlaySoundEffect(SOUND_REVEAL);
myswprintf(textBuffer, dataManager.GetSysString(207), count); myswprintf(textBuffer, dataManager.GetSysString(207), count);
...@@ -2001,7 +2009,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2001,7 +2009,7 @@ 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) { if(mainGame->dInfo.isReplaySkiping) {
pbuf += count * 7; pbuf += count * 7;
return true; return true;
} }
...@@ -2105,7 +2113,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2105,7 +2113,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if(mainGame->dField.deck[player].size() < 2) if(mainGame->dField.deck[player].size() < 2)
return true; return true;
bool rev = mainGame->dField.deck_reversed; bool rev = mainGame->dField.deck_reversed;
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplaySkiping) {
mainGame->dField.deck_reversed = false; mainGame->dField.deck_reversed = false;
if(rev) { if(rev) {
for (size_t i = 0; i < mainGame->dField.deck[player].size(); ++i) for (size_t i = 0; i < mainGame->dField.deck[player].size(); ++i)
...@@ -2117,7 +2125,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2117,7 +2125,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.deck[player][i]->code = 0; mainGame->dField.deck[player][i]->code = 0;
mainGame->dField.deck[player][i]->is_reversed = false; mainGame->dField.deck[player][i]->is_reversed = false;
} }
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplaySkiping) {
soundManager.PlaySoundEffect(SOUND_SHUFFLE); soundManager.PlaySoundEffect(SOUND_SHUFFLE);
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) {
...@@ -2142,7 +2150,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2142,7 +2150,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
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) { if(!mainGame->dInfo.isReplaySkiping) {
if(count > 1) if(count > 1)
soundManager.PlaySoundEffect(SOUND_SHUFFLE); soundManager.PlaySoundEffect(SOUND_SHUFFLE);
mainGame->WaitFrameSignal(5); mainGame->WaitFrameSignal(5);
...@@ -2171,7 +2179,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2171,7 +2179,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
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) { if(!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);
...@@ -2185,7 +2193,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2185,7 +2193,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadInt8(pbuf);
if((mainGame->dField.extra[player].size() - mainGame->dField.extra_p_count[player]) < 2) if((mainGame->dField.extra[player].size() - mainGame->dField.extra_p_count[player]) < 2)
return true; return true;
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplaySkiping) {
if(count > 1) if(count > 1)
soundManager.PlaySoundEffect(SOUND_SHUFFLE); soundManager.PlaySoundEffect(SOUND_SHUFFLE);
for (int i = 0; i < 5; ++i) { for (int i = 0; i < 5; ++i) {
...@@ -2215,7 +2223,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2215,7 +2223,7 @@ 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));
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplaySkiping) {
mainGame->dField.grave[player].swap(mainGame->dField.deck[player]); mainGame->dField.grave[player].swap(mainGame->dField.deck[player]);
for (auto 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;
...@@ -2259,7 +2267,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2259,7 +2267,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
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) { if(!mainGame->dInfo.isReplaySkiping) {
for(size_t i = 0; i < mainGame->dField.deck[0].size(); ++i) for(size_t 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(size_t i = 0; i < mainGame->dField.deck[1].size(); ++i) for(size_t i = 0; i < mainGame->dField.deck[1].size(); ++i)
...@@ -2293,14 +2301,14 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2293,14 +2301,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) { if(!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) if(!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));
...@@ -2316,7 +2324,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2316,7 +2324,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
swp->sequence = ps; swp->sequence = ps;
} }
} }
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplaySkiping) {
soundManager.PlaySoundEffect(SOUND_SHUFFLE); soundManager.PlaySoundEffect(SOUND_SHUFFLE);
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);
...@@ -2358,7 +2366,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2358,7 +2366,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) { if(!mainGame->dInfo.isReplaySkiping) {
soundManager.PlaySoundEffect(SOUND_NEXT_TURN); soundManager.PlaySoundEffect(SOUND_NEXT_TURN);
mainGame->showcardcode = 10; mainGame->showcardcode = 10;
mainGame->showcarddif = 30; mainGame->showcarddif = 30;
...@@ -2406,7 +2414,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2406,7 +2414,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
mainGame->btnPhaseStatus->setPressed(true); mainGame->btnPhaseStatus->setPressed(true);
mainGame->btnPhaseStatus->setVisible(true); mainGame->btnPhaseStatus->setVisible(true);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplaySkiping) {
soundManager.PlaySoundEffect(SOUND_PHASE); soundManager.PlaySoundEffect(SOUND_PHASE);
mainGame->showcard = 101; mainGame->showcard = 101;
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
...@@ -2425,7 +2433,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2425,7 +2433,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int cs = BufferIO::ReadInt8(pbuf); int cs = BufferIO::ReadInt8(pbuf);
int cp = BufferIO::ReadInt8(pbuf); int cp = BufferIO::ReadInt8(pbuf);
int reason = BufferIO::ReadInt32(pbuf); int reason = BufferIO::ReadInt32(pbuf);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplaySkiping) {
if(cl & LOCATION_REMOVED && pl != cl) if(cl & LOCATION_REMOVED && pl != cl)
soundManager.PlaySoundEffect(SOUND_BANISHED); soundManager.PlaySoundEffect(SOUND_BANISHED);
else if(reason & REASON_DESTROY && pl != cl) else if(reason & REASON_DESTROY && pl != cl)
...@@ -2435,7 +2443,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2435,7 +2443,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) { if(!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();
...@@ -2452,7 +2460,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2452,7 +2460,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) { if(!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();
...@@ -2484,7 +2492,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2484,7 +2492,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->is_showequip = false; pcard->is_showequip = false;
pcard->is_showtarget = false; pcard->is_showtarget = false;
pcard->is_showchaintarget = false; pcard->is_showchaintarget = false;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplaySkiping) {
mainGame->dField.RemoveCard(pc, pl, ps); mainGame->dField.RemoveCard(pc, pl, ps);
pcard->position = cp; pcard->position = cp;
mainGame->dField.AddCard(pcard, cc, cl, cs); mainGame->dField.AddCard(pcard, cc, cl, cs);
...@@ -2536,7 +2544,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2536,7 +2544,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->is_showtarget = false; pcard->is_showtarget = false;
pcard->is_showchaintarget = false; pcard->is_showchaintarget = false;
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) { if(mainGame->dInfo.isReplaySkiping) {
mainGame->dField.RemoveCard(pc, pl, ps); mainGame->dField.RemoveCard(pc, pl, ps);
olcard->overlayed.push_back(pcard); olcard->overlayed.push_back(pcard);
mainGame->dField.overlay_cards.insert(pcard); mainGame->dField.overlay_cards.insert(pcard);
...@@ -2565,7 +2573,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2565,7 +2573,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} 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) { if(mainGame->dInfo.isReplaySkiping) {
olcard->overlayed.erase(olcard->overlayed.begin() + pcard->sequence); olcard->overlayed.erase(olcard->overlayed.begin() + pcard->sequence);
pcard->overlayTarget = 0; pcard->overlayTarget = 0;
pcard->position = cp; pcard->position = cp;
...@@ -2595,7 +2603,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2595,7 +2603,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
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) { if(mainGame->dInfo.isReplaySkiping) {
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);
pcard->sequence = olcard2->overlayed.size() - 1; pcard->sequence = olcard2->overlayed.size() - 1;
...@@ -2638,7 +2646,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2638,7 +2646,7 @@ 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) { if(!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);
...@@ -2651,7 +2659,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2651,7 +2659,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) if(!mainGame->dInfo.isReplaySkiping)
soundManager.PlaySoundEffect(SOUND_SET); soundManager.PlaySoundEffect(SOUND_SET);
myswprintf(event_string, dataManager.GetSysString(1601)); myswprintf(event_string, dataManager.GetSysString(1601));
return true; return true;
...@@ -2670,7 +2678,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2670,7 +2678,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) { if(!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);
...@@ -2705,7 +2713,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2705,7 +2713,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) { if(!mainGame->dInfo.isReplaySkiping) {
soundManager.PlaySoundEffect(SOUND_SUMMON); soundManager.PlaySoundEffect(SOUND_SUMMON);
myswprintf(event_string, dataManager.GetSysString(1603), dataManager.GetName(code)); myswprintf(event_string, dataManager.GetSysString(1603), dataManager.GetName(code));
mainGame->showcardcode = code; mainGame->showcardcode = code;
...@@ -2728,7 +2736,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2728,7 +2736,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) { if(!mainGame->dInfo.isReplaySkiping) {
CardData cd; CardData cd;
if(dataManager.GetData(code, &cd) && (cd.type & TYPE_TOKEN)) if(dataManager.GetData(code, &cd) && (cd.type & TYPE_TOKEN))
soundManager.PlaySoundEffect(SOUND_TOKEN); soundManager.PlaySoundEffect(SOUND_TOKEN);
...@@ -2757,7 +2765,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2757,7 +2765,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) { if(!mainGame->dInfo.isReplaySkiping) {
soundManager.PlaySoundEffect(SOUND_FILP); soundManager.PlaySoundEffect(SOUND_FILP);
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);
...@@ -2787,7 +2795,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2787,7 +2795,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
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);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplaySkiping)
return true; return true;
soundManager.PlaySoundEffect(SOUND_ACTIVATE); soundManager.PlaySoundEffect(SOUND_ACTIVATE);
ClientCard* pcard = mainGame->dField.GetCard(pcc, pcl, pcs, subs); ClientCard* pcard = mainGame->dField.GetCard(pcc, pcl, pcs, subs);
...@@ -2828,7 +2836,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2828,7 +2836,7 @@ 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) if(mainGame->dInfo.isReplaySkiping)
return true; 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();
...@@ -2841,7 +2849,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2841,7 +2849,7 @@ 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) if(mainGame->dInfo.isReplaySkiping)
return true; return true;
if (mainGame->dField.chains.size() > 1) { if (mainGame->dField.chains.size() > 1) {
if (mainGame->dField.last_chain) if (mainGame->dField.last_chain)
...@@ -2872,7 +2880,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2872,7 +2880,7 @@ 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) { if(!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;
...@@ -2887,7 +2895,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2887,7 +2895,7 @@ 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) { if(mainGame->dInfo.isReplaySkiping) {
pbuf += count * 4; pbuf += count * 4;
return true; return true;
} }
...@@ -2912,7 +2920,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2912,7 +2920,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
case MSG_BECOME_TARGET: { case MSG_BECOME_TARGET: {
//soundManager.PlaySoundEffect(SOUND_TARGET); //soundManager.PlaySoundEffect(SOUND_TARGET);
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadInt8(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplaySkiping) {
pbuf += count * 4; pbuf += count * 4;
return true; return true;
} }
...@@ -2950,7 +2958,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2950,7 +2958,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if(!mainGame->dField.deck_reversed || code) if(!mainGame->dField.deck_reversed || code)
pcard->SetCode(code & 0x7fffffff); pcard->SetCode(code & 0x7fffffff);
} }
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplaySkiping) {
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
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);
mainGame->dField.deck[player].erase(mainGame->dField.deck[player].end() - 1); mainGame->dField.deck[player].erase(mainGame->dField.deck[player].end() - 1);
...@@ -2980,7 +2988,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2980,7 +2988,7 @@ 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) { if(mainGame->dInfo.isReplaySkiping) {
mainGame->dInfo.lp[player] = final; mainGame->dInfo.lp[player] = final;
myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]); myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]);
return true; return true;
...@@ -3009,7 +3017,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3009,7 +3017,7 @@ 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) { if(mainGame->dInfo.isReplaySkiping) {
mainGame->dInfo.lp[player] = final; mainGame->dInfo.lp[player] = final;
myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]); myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]);
return true; return true;
...@@ -3045,7 +3053,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3045,7 +3053,7 @@ 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) { if(mainGame->dInfo.isReplaySkiping) {
if(pc1->equipTarget) if(pc1->equipTarget)
pc1->equipTarget->equipped.erase(pc1); pc1->equipTarget->equipped.erase(pc1);
pc1->equipTarget = pc2; pc1->equipTarget = pc2;
...@@ -3071,7 +3079,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3071,7 +3079,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
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) { if(mainGame->dInfo.isReplaySkiping) {
mainGame->dInfo.lp[player] = val; mainGame->dInfo.lp[player] = val;
myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]); myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]);
return true; return true;
...@@ -3092,7 +3100,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3092,7 +3100,7 @@ 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) { if(mainGame->dInfo.isReplaySkiping) {
pc->equipTarget->equipped.erase(pc); pc->equipTarget->equipped.erase(pc);
pc->equipTarget = 0; pc->equipTarget = 0;
} else { } else {
...@@ -3118,7 +3126,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3118,7 +3126,7 @@ 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) { if(mainGame->dInfo.isReplaySkiping) {
pc1->cardTarget.insert(pc2); pc1->cardTarget.insert(pc2);
pc2->ownerTarget.insert(pc1); pc2->ownerTarget.insert(pc1);
} else { } else {
...@@ -3144,7 +3152,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3144,7 +3152,7 @@ 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) { if(mainGame->dInfo.isReplaySkiping) {
pc1->cardTarget.erase(pc2); pc1->cardTarget.erase(pc2);
pc2->ownerTarget.erase(pc1); pc2->ownerTarget.erase(pc1);
} else { } else {
...@@ -3165,7 +3173,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3165,7 +3173,7 @@ 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) { if(mainGame->dInfo.isReplaySkiping) {
mainGame->dInfo.lp[player] = final; mainGame->dInfo.lp[player] = final;
myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]); myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]);
return true; return true;
...@@ -3196,7 +3204,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3196,7 +3204,7 @@ 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) if(mainGame->dInfo.isReplaySkiping)
return true; return true;
soundManager.PlaySoundEffect(SOUND_COUNTER_ADD); soundManager.PlaySoundEffect(SOUND_COUNTER_ADD);
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));
...@@ -3219,7 +3227,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3219,7 +3227,7 @@ 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) if(mainGame->dInfo.isReplaySkiping)
return true; return true;
soundManager.PlaySoundEffect(SOUND_COUNTER_REMOVE); soundManager.PlaySoundEffect(SOUND_COUNTER_REMOVE);
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));
...@@ -3242,7 +3250,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3242,7 +3250,7 @@ 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) if(mainGame->dInfo.isReplaySkiping)
return true; return true;
float sy; float sy;
if (ld != 0) { if (ld != 0) {
...@@ -3298,7 +3306,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3298,7 +3306,7 @@ 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) if(mainGame->dInfo.isReplaySkiping)
return true; return true;
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
ClientCard* pcard = mainGame->dField.GetCard(ca, la, sa); ClientCard* pcard = mainGame->dField.GetCard(ca, la, sa);
...@@ -3354,7 +3362,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3354,7 +3362,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
*pwbuf++ = L']'; *pwbuf++ = L']';
} }
*pwbuf = 0; *pwbuf = 0;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplaySkiping)
return true; return true;
soundManager.PlaySoundEffect(SOUND_COIN); soundManager.PlaySoundEffect(SOUND_COIN);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
...@@ -3378,7 +3386,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3378,7 +3386,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
*pwbuf++ = L']'; *pwbuf++ = L']';
} }
*pwbuf = 0; *pwbuf = 0;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplaySkiping)
return true; return true;
soundManager.PlaySoundEffect(SOUND_DICE); soundManager.PlaySoundEffect(SOUND_DICE);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
...@@ -3392,7 +3400,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3392,7 +3400,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
case MSG_ROCK_PAPER_SCISSORS: { case MSG_ROCK_PAPER_SCISSORS: {
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplaySkiping)
return true; return true;
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->PopupElement(mainGame->wHand); mainGame->PopupElement(mainGame->wHand);
...@@ -3401,7 +3409,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3401,7 +3409,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
case MSG_HAND_RES: { case MSG_HAND_RES: {
int res = BufferIO::ReadInt8(pbuf); int res = BufferIO::ReadInt8(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) if(mainGame->dInfo.isReplaySkiping)
return true; return true;
mainGame->stHintMsg->setVisible(false); mainGame->stHintMsg->setVisible(false);
int res1 = (res & 0x3) - 1; int res1 = (res & 0x3) - 1;
...@@ -3533,7 +3541,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3533,7 +3541,7 @@ 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) if(mainGame->dInfo.isReplaySkiping)
return true; return true;
if(pcard->location & LOCATION_ONFIELD) if(pcard->location & LOCATION_ONFIELD)
pcard->is_highlighting = true; pcard->is_highlighting = true;
...@@ -3573,7 +3581,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3573,7 +3581,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
size_t pcount = (size_t)BufferIO::ReadInt8(pbuf); size_t pcount = (size_t)BufferIO::ReadInt8(pbuf);
size_t hcount = (size_t)BufferIO::ReadInt8(pbuf); size_t hcount = (size_t)BufferIO::ReadInt8(pbuf);
int topcode = BufferIO::ReadInt32(pbuf); int topcode = BufferIO::ReadInt32(pbuf);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!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;
...@@ -3598,7 +3606,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3598,7 +3606,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->WaitFrameSignal(5); mainGame->WaitFrameSignal(5);
} }
// //
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) if(!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) {
...@@ -3646,10 +3654,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3646,10 +3654,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
} }
mainGame->dField.extra_p_count[player] = pcount; mainGame->dField.extra_p_count[player] = pcount;
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) if(!mainGame->dInfo.isReplaySkiping)
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
// //
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!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);
......
...@@ -1680,6 +1680,17 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1680,6 +1680,17 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
break; break;
} }
case irr::KEY_KEY_Z: {
if(!mainGame->dInfo.isReplay && !mainGame->HasFocus(EGUIET_EDIT_BOX)) {
mainGame->dInfo.isReplaySkiping = event.KeyInput.PressedDown;
if(mainGame->dInfo.isStarted && !mainGame->dInfo.isReplaySkiping) {
mainGame->gMutex.Lock();
mainGame->dField.RefreshAllCards();
mainGame->gMutex.Unlock();
}
}
break;
}
case irr::KEY_F1: case irr::KEY_F1:
case irr::KEY_F2: case irr::KEY_F2:
case irr::KEY_F3: case irr::KEY_F3:
......
...@@ -540,11 +540,21 @@ bool Game::Initialize() { ...@@ -540,11 +540,21 @@ bool Game::Initialize() {
btnSideSort->setVisible(false); btnSideSort->setVisible(false);
btnSideReload = env->addButton(rect<s32>(440, 100, 500, 130), 0, BUTTON_SIDE_RELOAD, dataManager.GetSysString(1309)); btnSideReload = env->addButton(rect<s32>(440, 100, 500, 130), 0, BUTTON_SIDE_RELOAD, dataManager.GetSysString(1309));
btnSideReload->setVisible(false); btnSideReload->setVisible(false);
btnRenameDeck = env->addButton(rect<s32>(170, 99, 220, 120), wDeckEdit, BUTTON_RENAME_DECK, dataManager.GetSysString(1362));
// //
scrFilter = env->addScrollBar(false, recti(999, 161, 1019, 629), 0, SCROLL_FILTER); scrFilter = env->addScrollBar(false, recti(999, 161, 1019, 629), 0, SCROLL_FILTER);
scrFilter->setLargeStep(10); scrFilter->setLargeStep(10);
scrFilter->setSmallStep(1); scrFilter->setSmallStep(1);
scrFilter->setVisible(false); scrFilter->setVisible(false);
//rename deck
wRenameDeck = env->addWindow(rect<s32>(510, 200, 820, 320), false, dataManager.GetSysString(1367));
wRenameDeck->getCloseButton()->setVisible(false);
wRenameDeck->setVisible(false);
env->addStaticText(dataManager.GetSysString(1368), rect<s32>(20, 25, 290, 45), false, false, wRenameDeck);
ebREName = env->addEditBox(L"", rect<s32>(20, 50, 290, 70), true, wRenameDeck, -1);
ebREName->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
btnREYes = env->addButton(rect<s32>(70, 80, 140, 105), wRenameDeck, BUTTON_RENAME_DECK_SAVE, dataManager.GetSysString(1341));
btnRENo = env->addButton(rect<s32>(170, 80, 240, 105), wRenameDeck, BUTTON_RENAME_DECK_CANCEL, dataManager.GetSysString(1212));
//sort type //sort type
wSort = env->addStaticText(L"", rect<s32>(930, 132, 1020, 156), true, false, 0, -1, true); wSort = env->addStaticText(L"", rect<s32>(930, 132, 1020, 156), true, false, 0, -1, true);
cbSortType = env->addComboBox(rect<s32>(10, 2, 85, 22), wSort, COMBOBOX_SORTTYPE); cbSortType = env->addComboBox(rect<s32>(10, 2, 85, 22), wSort, COMBOBOX_SORTTYPE);
...@@ -1728,6 +1738,7 @@ void Game::OnResize() { ...@@ -1728,6 +1738,7 @@ void Game::OnResize() {
btnSideSort->setRelativePosition(Resize(375, 100, 435, 130)); btnSideSort->setRelativePosition(Resize(375, 100, 435, 130));
btnSideReload->setRelativePosition(Resize(440, 100, 500, 130)); btnSideReload->setRelativePosition(Resize(440, 100, 500, 130));
btnDeleteDeck->setRelativePosition(Resize(225, 95, 290, 120)); btnDeleteDeck->setRelativePosition(Resize(225, 95, 290, 120));
btnRenameDeck->setRelativePosition(Resize(170, 99, 220, 120));
wLanWindow->setRelativePosition(ResizeWin(220, 100, 800, 520)); wLanWindow->setRelativePosition(ResizeWin(220, 100, 800, 520));
wCreateHost->setRelativePosition(ResizeWin(320, 100, 700, 520)); wCreateHost->setRelativePosition(ResizeWin(320, 100, 700, 520));
......
...@@ -464,6 +464,12 @@ public: ...@@ -464,6 +464,12 @@ public:
irr::gui::IGUIStaticText* stStar; irr::gui::IGUIStaticText* stStar;
irr::gui::IGUIStaticText* stSearch; irr::gui::IGUIStaticText* stSearch;
irr::gui::IGUIStaticText* stScale; irr::gui::IGUIStaticText* stScale;
irr::gui::IGUIButton* btnRenameDeck;
//deck rename
irr::gui::IGUIWindow* wRenameDeck;
irr::gui::IGUIEditBox* ebREName;
irr::gui::IGUIButton* btnREYes;
irr::gui::IGUIButton* btnRENo;
//filter //filter
irr::gui::IGUIStaticText* wFilter; irr::gui::IGUIStaticText* wFilter;
irr::gui::IGUIScrollBar* scrFilter; irr::gui::IGUIScrollBar* scrFilter;
...@@ -675,6 +681,10 @@ extern HostInfo game_info; ...@@ -675,6 +681,10 @@ extern HostInfo game_info;
#define BUTTON_MARKS_FILTER 380 #define BUTTON_MARKS_FILTER 380
#define BUTTON_MARKERS_OK 381 #define BUTTON_MARKERS_OK 381
#define BUTTON_RENAME_DECK 386
#define BUTTON_RENAME_DECK_SAVE 387
#define BUTTON_RENAME_DECK_CANCEL 388
#define TEXTURE_DUEL 0 #define TEXTURE_DUEL 0
#define TEXTURE_DECK 1 #define TEXTURE_DECK 1
#define TEXTURE_MENU 2 #define TEXTURE_MENU 2
......
...@@ -378,6 +378,9 @@ ...@@ -378,6 +378,9 @@
!system 1363 是否删除这个录像? !system 1363 是否删除这个录像?
!system 1364 重命名录像 !system 1364 重命名录像
!system 1365 重命名失败,可能存在同名文件 !system 1365 重命名失败,可能存在同名文件
!system 1366 重命名成功
!system 1367 重命名卡组
!system 1368 卡组文件:
!system 1370 星数↑ !system 1370 星数↑
!system 1371 攻击↑ !system 1371 攻击↑
!system 1372 守备↑ !system 1372 守备↑
......
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