Commit c4b5e990 authored by edo9300's avatar edo9300

added double deck mode

parent a440e683
...@@ -945,8 +945,6 @@ bool DeckBuilder::CardNameCompare(const wchar_t *sa, const wchar_t *sb) ...@@ -945,8 +945,6 @@ bool DeckBuilder::CardNameCompare(const wchar_t *sa, const wchar_t *sb)
{ {
ca = towupper(sa[i]); ca = towupper(sa[i]);
cb = towupper(sb[j]); cb = towupper(sb[j]);
if (ca == '-') ca = ' ';
if (cb == '-') cb = ' ';
if (ca == cb) if (ca == cb)
{ {
j++; j++;
......
...@@ -75,7 +75,7 @@ int DeckManager::TypeCount(std::vector<code_pointer> cards, int type) { ...@@ -75,7 +75,7 @@ int DeckManager::TypeCount(std::vector<code_pointer> cards, int type) {
} }
return count; return count;
} }
int DeckManager::CheckLFList(Deck& deck, int lfhash, bool allow_ocg, bool allow_tcg) { int DeckManager::CheckLFList(Deck& deck, int lfhash, bool allow_ocg, bool allow_tcg, bool doubled) {
std::unordered_map<int, int> ccount; std::unordered_map<int, int> ccount;
std::unordered_map<int, int>* list = 0; std::unordered_map<int, int>* list = 0;
for(size_t i = 0; i < _lfList.size(); ++i) { for(size_t i = 0; i < _lfList.size(); ++i) {
...@@ -87,7 +87,8 @@ int DeckManager::CheckLFList(Deck& deck, int lfhash, bool allow_ocg, bool allow_ ...@@ -87,7 +87,8 @@ int DeckManager::CheckLFList(Deck& deck, int lfhash, bool allow_ocg, bool allow_
if(!list) if(!list)
return 0; return 0;
int dc = 0; int dc = 0;
if(deck.main.size() < 40 || deck.main.size() > 60 || deck.extra.size() > 15 || deck.side.size() > 15) if(deck.main.size() < 40 || (!doubled && (deck.main.size() > 60 || deck.extra.size() > 15 || deck.side.size() > 15))
|| (doubled && (deck.main.size() != 100 || deck.extra.size() > 30 || deck.side.size() > 30)))
return 1; return 1;
for(size_t i = 0; i < deck.main.size(); ++i) { for(size_t i = 0; i < deck.main.size(); ++i) {
code_pointer cit = deck.main[i]; code_pointer cit = deck.main[i];
...@@ -126,9 +127,12 @@ int DeckManager::CheckLFList(Deck& deck, int lfhash, bool allow_ocg, bool allow_ ...@@ -126,9 +127,12 @@ int DeckManager::CheckLFList(Deck& deck, int lfhash, bool allow_ocg, bool allow_
} }
return 0; return 0;
} }
void DeckManager::LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec) { void DeckManager::LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec, int mainc2, int sidec2, bool doubled) {
deck.clear(); deck.clear();
int code; int code;
int d = 1;
if (doubled)
d = 2;
CardData cd; CardData cd;
for(int i = 0; i < mainc; ++i) { for(int i = 0; i < mainc; ++i) {
code = dbuf[i]; code = dbuf[i];
...@@ -136,9 +140,9 @@ void DeckManager::LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec) { ...@@ -136,9 +140,9 @@ void DeckManager::LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec) {
continue; continue;
if(cd.type & TYPE_TOKEN) if(cd.type & TYPE_TOKEN)
continue; continue;
else if(cd.type & 0x802040 && deck.extra.size() < 15) { else if(cd.type & 0x802040 && deck.extra.size() < 15*d) {
deck.extra.push_back(dataManager.GetCodePointer(code)); //verified by GetData() deck.extra.push_back(dataManager.GetCodePointer(code)); //verified by GetData()
} else if(deck.main.size() < 60) { } else if(deck.main.size() < 60*d) {
deck.main.push_back(dataManager.GetCodePointer(code)); deck.main.push_back(dataManager.GetCodePointer(code));
} }
} }
...@@ -148,7 +152,28 @@ void DeckManager::LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec) { ...@@ -148,7 +152,28 @@ void DeckManager::LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec) {
continue; continue;
if(cd.type & TYPE_TOKEN) if(cd.type & TYPE_TOKEN)
continue; continue;
if(deck.side.size() < 15) if(deck.side.size() < 15*d)
deck.side.push_back(dataManager.GetCodePointer(code)); //verified by GetData()
}
for(int i = 0; i < mainc2; ++i) {
code = dbuf[mainc + sidec + i];
if(!dataManager.GetData(code, &cd))
continue;
if(cd.type & TYPE_TOKEN)
continue;
else if(cd.type & 0x802040 && deck.extra.size() < 30) {
deck.extra.push_back(dataManager.GetCodePointer(code)); //verified by GetData()
} else if(deck.main.size() < 120) {
deck.main.push_back(dataManager.GetCodePointer(code));
}
}
for(int i = 0; i < sidec2; ++i) {
code = dbuf[mainc + sidec + mainc2 + i];
if(!dataManager.GetData(code, &cd))
continue;
if(cd.type & TYPE_TOKEN)
continue;
if(deck.side.size() < 30)
deck.side.push_back(dataManager.GetCodePointer(code)); //verified by GetData() deck.side.push_back(dataManager.GetCodePointer(code)); //verified by GetData()
} }
} }
...@@ -162,7 +187,7 @@ bool DeckManager::LoadSide(Deck& deck, int* dbuf, int mainc, int sidec) { ...@@ -162,7 +187,7 @@ bool DeckManager::LoadSide(Deck& deck, int* dbuf, int mainc, int sidec) {
for(size_t i = 0; i < deck.side.size(); ++i) for(size_t i = 0; i < deck.side.size(); ++i)
pcount[deck.side[i]->first]++; pcount[deck.side[i]->first]++;
Deck ndeck; Deck ndeck;
LoadDeck(ndeck, dbuf, mainc, sidec); LoadDeck(ndeck, dbuf, mainc, sidec,0,0,true);
if(ndeck.main.size() != deck.main.size() || ndeck.extra.size() != deck.extra.size()) if(ndeck.main.size() != deck.main.size() || ndeck.extra.size() != deck.extra.size())
return false; return false;
for(size_t i = 0; i < ndeck.main.size(); ++i) for(size_t i = 0; i < ndeck.main.size(); ++i)
...@@ -217,6 +242,73 @@ bool DeckManager::LoadDeck(const wchar_t* file) { ...@@ -217,6 +242,73 @@ bool DeckManager::LoadDeck(const wchar_t* file) {
LoadDeck(current_deck, cardlist, mainc, sidec); LoadDeck(current_deck, cardlist, mainc, sidec);
return true; return true;
} }
bool DeckManager::LoadDeckDouble(const wchar_t* file, const wchar_t* file2) {
int sp = 0, ct = 0, mainc = 0, sidec = 0, mainc2 = 0, sidec2 = 0, code;
wchar_t deck[64];
wchar_t deck2[64];
myswprintf(deck, L"./deck/%ls.ydk", file);
myswprintf(deck2, L"./deck/%ls.ydk", file2);
int cardlist[256];
bool is_side = false;
#ifdef WIN32
FILE* fp = _wfopen(deck, L"r");
FILE* fp2 = _wfopen(deck2, L"r");
#else
char deckfn[256];
BufferIO::EncodeUTF8(deck, deckfn);
FILE* fp = fopen(deckfn, "r");
BufferIO::EncodeUTF8(deck2, deckfn);
FILE* fp2 = fopen(deckfn, "r");
#endif
if(!fp || !fp2)
return false;
char linebuf[256];
fseek(fp, 0, SEEK_END);
int fsize = ftell(fp);
fseek(fp, 0, SEEK_SET);
fgets(linebuf, 256, fp);
while(ftell(fp) < fsize && ct < 128) {
fgets(linebuf, 256, fp);
if(linebuf[0] == '!') {
is_side = true;
continue;
}
if(linebuf[0] < '0' || linebuf[0] > '9')
continue;
sp = 0;
while(linebuf[sp] >= '0' && linebuf[sp] <= '9') sp++;
linebuf[sp] = 0;
code = atoi(linebuf);
cardlist[ct++] = code;
if(is_side) sidec++;
else mainc++;
}
fclose(fp);
is_side = false;
fseek(fp2, 0, SEEK_END);
int fsize2 = ftell(fp2);
fseek(fp2, 0, SEEK_SET);
fgets(linebuf, 256, fp2);
while(ftell(fp2) < fsize2 && ct < 128) {
fgets(linebuf, 256, fp2);
if(linebuf[0] == '!') {
is_side = true;
continue;
}
if(linebuf[0] < '0' || linebuf[0] > '9')
continue;
sp = 0;
while(linebuf[sp] >= '0' && linebuf[sp] <= '9') sp++;
linebuf[sp] = 0;
code = atoi(linebuf);
cardlist[ct++] = code;
if(is_side) sidec2++;
else mainc2++;
}
fclose(fp2);
LoadDeck(current_deck, cardlist, mainc, sidec, mainc2, sidec2);
return true;
}
bool DeckManager::SaveDeck(Deck& deck, const wchar_t* name) { bool DeckManager::SaveDeck(Deck& deck, const wchar_t* name) {
wchar_t file[64]; wchar_t file[64];
myswprintf(file, L"./deck/%ls.ydk", name); myswprintf(file, L"./deck/%ls.ydk", name);
......
...@@ -37,11 +37,12 @@ public: ...@@ -37,11 +37,12 @@ public:
void LoadLFList(); void LoadLFList();
wchar_t* GetLFListName(int lfhash); wchar_t* GetLFListName(int lfhash);
int CheckLFList(Deck& deck, int lfhash, bool allow_ocg, bool allow_tcg); int CheckLFList(Deck& deck, int lfhash, bool allow_ocg, bool allow_tcg,bool doubled);
int TypeCount(std::vector<code_pointer> cards, int type); int TypeCount(std::vector<code_pointer> cards, int type);
void LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec); void LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec, int mainc2=0, int sidec2=0, bool doubled = false);
bool LoadSide(Deck& deck, int* dbuf, int mainc, int sidec); bool LoadSide(Deck& deck, int* dbuf, int mainc, int sidec);
bool LoadDeck(const wchar_t* file); bool LoadDeck(const wchar_t* file);
bool LoadDeckDouble(const wchar_t* file, const wchar_t* file2);
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);
}; };
......
...@@ -132,12 +132,12 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) { ...@@ -132,12 +132,12 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
cscg.info.rose = mainGame->chkRules[8]->isChecked(); cscg.info.rose = mainGame->chkRules[8]->isChecked();
cscg.info.turbo1 = mainGame->chkRules[9]->isChecked(); cscg.info.turbo1 = mainGame->chkRules[9]->isChecked();
cscg.info.turbo2 = mainGame->chkRules[10]->isChecked(); cscg.info.turbo2 = mainGame->chkRules[10]->isChecked();
cscg.info.turbo3 = mainGame->chkRules[11]->isChecked(); cscg.info.doubled = mainGame->chkRules[11]->isChecked();
cscg.info.command = mainGame->chkRules[12]->isChecked(); cscg.info.command = mainGame->chkRules[12]->isChecked();
cscg.info.master = mainGame->chkRules[13]->isChecked(); cscg.info.master = mainGame->chkRules[13]->isChecked();
cscg.info.rule_count = 0; cscg.info.rule_count = 0;
for (int i = 0; i < 14; ++i) { for (int i = 0; i < 14; ++i) {
if (mainGame->chkRules[i]->isChecked()) if (mainGame->chkRules[i]->isChecked() && i!=11)
++cscg.info.rule_count; ++cscg.info.rule_count;
} }
cscg.info.no_check_deck = mainGame->chkNoCheckDeck->isChecked(); cscg.info.no_check_deck = mainGame->chkNoCheckDeck->isChecked();
...@@ -245,6 +245,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -245,6 +245,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->env->addMessageBox(L"", msgbuf); mainGame->env->addMessageBox(L"", msgbuf);
} }
mainGame->cbDeckSelect->setEnabled(true); mainGame->cbDeckSelect->setEnabled(true);
mainGame->cbDeckSelect2->setEnabled(true);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
break; break;
} }
...@@ -410,7 +411,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -410,7 +411,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1142)); myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1142));
str2.append(msgbuf); str2.append(msgbuf);
} }
if(pkt->info.turbo3) { if(pkt->info.doubled) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1143)); myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1143));
str2.append(msgbuf); str2.append(msgbuf);
} }
...@@ -455,7 +456,15 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -455,7 +456,15 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->SetStaticText(mainGame->stHostPrepRule, 180, mainGame->guiFont, (wchar_t*)str.c_str()); mainGame->SetStaticText(mainGame->stHostPrepRule, 180, mainGame->guiFont, (wchar_t*)str.c_str());
mainGame->SetStaticText(mainGame->stHostPrepRule2, 180, mainGame->guiFont, (wchar_t*)str2.c_str()); mainGame->SetStaticText(mainGame->stHostPrepRule2, 180, mainGame->guiFont, (wchar_t*)str2.c_str());
mainGame->RefreshDeck(mainGame->cbDeckSelect); mainGame->RefreshDeck(mainGame->cbDeckSelect);
mainGame->RefreshDeck(mainGame->cbDeckSelect2);
mainGame->cbDeckSelect->setEnabled(true); mainGame->cbDeckSelect->setEnabled(true);
if (pkt->info.doubled) {
mainGame->cbDeckSelect2->setVisible(true);
mainGame->cbDeckSelect2->setEnabled(true);
}else{
mainGame->cbDeckSelect2->setVisible(false);
mainGame->cbDeckSelect2->setEnabled(false);
}
if(mainGame->wCreateHost->isVisible()) if(mainGame->wCreateHost->isVisible())
mainGame->HideElement(mainGame->wCreateHost); mainGame->HideElement(mainGame->wCreateHost);
else if (mainGame->wLanWindow->isVisible()) else if (mainGame->wLanWindow->isVisible())
...@@ -1835,6 +1844,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1835,6 +1844,8 @@ 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));
int m = 0;
int e = mainGame->dField.extra[player].size();
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping) { if(mainGame->dInfo.isReplay && 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)
...@@ -1842,10 +1853,15 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1842,10 +1853,15 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ) { for (auto cit = mainGame->dField.deck[player].begin(); cit != mainGame->dField.deck[player].end(); ) {
if ((*cit)->type & 0x802040) { if ((*cit)->type & 0x802040) {
(*cit)->location = LOCATION_EXTRA; (*cit)->location = LOCATION_EXTRA;
(*cit)->position = POS_FACEDOWN;
(*cit)->sequence = e;
mainGame->dField.extra[player].push_back(*cit); mainGame->dField.extra[player].push_back(*cit);
cit = mainGame->dField.deck[player].erase(cit); cit = mainGame->dField.deck[player].erase(cit);
e++;
} else { } else {
(*cit)->location = LOCATION_DECK; (*cit)->location = LOCATION_DECK;
(*cit)->sequence = m;
m++;
++cit; ++cit;
} }
} }
...@@ -1860,10 +1876,15 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1860,10 +1876,15 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
ClientCard* pcard = *cit; ClientCard* pcard = *cit;
if (pcard->type & 0x802040) { if (pcard->type & 0x802040) {
pcard->location = LOCATION_EXTRA; pcard->location = LOCATION_EXTRA;
pcard->position = POS_FACEDOWN;
pcard->sequence = e;
mainGame->dField.extra[player].push_back(pcard); mainGame->dField.extra[player].push_back(pcard);
cit = mainGame->dField.deck[player].erase(cit); cit = mainGame->dField.deck[player].erase(cit);
e++;
} else { } else {
pcard->location = LOCATION_DECK; pcard->location = LOCATION_DECK;
pcard->sequence = m;
m++;
++cit; ++cit;
} }
mainGame->dField.MoveCard(pcard, 10); mainGame->dField.MoveCard(pcard, 10);
......
...@@ -30,7 +30,7 @@ bool Game::Initialize() { ...@@ -30,7 +30,7 @@ bool Game::Initialize() {
params.DriverType = irr::video::EDT_DIRECT3D9; params.DriverType = irr::video::EDT_DIRECT3D9;
else else
params.DriverType = irr::video::EDT_OPENGL; params.DriverType = irr::video::EDT_OPENGL;
params.WindowSize = irr::core::dimension2d<u32>(1024, 640); params.WindowSize = irr::core::dimension2d<u32>(1024, 640);
device = irr::createDeviceEx(params); device = irr::createDeviceEx(params);
if(!device) if(!device)
return false; return false;
...@@ -214,6 +214,8 @@ bool Game::Initialize() { ...@@ -214,6 +214,8 @@ bool Game::Initialize() {
env->addStaticText(dataManager.GetSysString(1254), rect<s32>(10, 235, 110, 255), false, false, wHostPrepare); env->addStaticText(dataManager.GetSysString(1254), rect<s32>(10, 235, 110, 255), false, false, wHostPrepare);
cbDeckSelect = env->addComboBox(rect<s32>(120, 230, 270, 255), wHostPrepare); cbDeckSelect = env->addComboBox(rect<s32>(120, 230, 270, 255), wHostPrepare);
cbDeckSelect->setMaxSelectionRows(10); cbDeckSelect->setMaxSelectionRows(10);
cbDeckSelect2 = env->addComboBox(rect<s32>(280, 230, 430, 255), wHostPrepare);
cbDeckSelect2->setMaxSelectionRows(10);
btnHostPrepStart = env->addButton(rect<s32>(230, 280, 340, 305), wHostPrepare, BUTTON_HP_START, dataManager.GetSysString(1215)); btnHostPrepStart = env->addButton(rect<s32>(230, 280, 340, 305), wHostPrepare, BUTTON_HP_START, dataManager.GetSysString(1215));
btnHostPrepCancel = env->addButton(rect<s32>(350, 280, 460, 305), wHostPrepare, BUTTON_HP_CANCEL, dataManager.GetSysString(1212)); btnHostPrepCancel = env->addButton(rect<s32>(350, 280, 460, 305), wHostPrepare, BUTTON_HP_CANCEL, dataManager.GetSysString(1212));
//img //img
......
...@@ -273,6 +273,7 @@ public: ...@@ -273,6 +273,7 @@ public:
irr::gui::IGUICheckBox* chkHostPrepReady[4]; irr::gui::IGUICheckBox* chkHostPrepReady[4];
irr::gui::IGUIButton* btnHostPrepKick[4]; irr::gui::IGUIButton* btnHostPrepKick[4];
irr::gui::IGUIComboBox* cbDeckSelect; irr::gui::IGUIComboBox* cbDeckSelect;
irr::gui::IGUIComboBox* cbDeckSelect2;
irr::gui::IGUIStaticText* stHostPrepRule; irr::gui::IGUIStaticText* stHostPrepRule;
irr::gui::IGUIStaticText* stHostPrepRule2; irr::gui::IGUIStaticText* stHostPrepRule2;
irr::gui::IGUIStaticText* stHostPrepOB; irr::gui::IGUIStaticText* stHostPrepOB;
...@@ -586,7 +587,7 @@ extern Game* mainGame; ...@@ -586,7 +587,7 @@ extern Game* mainGame;
#define CHECK_ROSE_DUEL 361 #define CHECK_ROSE_DUEL 361
#define CHECK_TURBO_DUEL_1 362 #define CHECK_TURBO_DUEL_1 362
#define CHECK_TURBO_DUEL_2 363 #define CHECK_TURBO_DUEL_2 363
#define CHECK_TURBO_DUEL_3 364 #define CHECK_DOUBLE_DECK 364
#define CHECK_COMMAND_DUEL 365 #define CHECK_COMMAND_DUEL 365
#define CHECK_DECK_MASTER_DUEL 366 #define CHECK_DECK_MASTER_DUEL 366
#define CHECKBOX_ENABLE_MUSIC 361 #define CHECKBOX_ENABLE_MUSIC 361
......
...@@ -324,8 +324,12 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -324,8 +324,12 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
mainGame->env->setFocus(mainGame->wHostPrepare); mainGame->env->setFocus(mainGame->wHostPrepare);
if(static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) { if(static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) {
if(mainGame->cbDeckSelect->getSelected() == -1 || bool check = false;
!deckManager.LoadDeck(mainGame->cbDeckSelect->getItem(mainGame->cbDeckSelect->getSelected()))) { if (!mainGame->chkRules[11]->isChecked())
check = (mainGame->cbDeckSelect->getSelected() == -1 || !deckManager.LoadDeck(mainGame->cbDeckSelect->getItem(mainGame->cbDeckSelect->getSelected())));
else
check = (mainGame->cbDeckSelect->getSelected() == -1 || mainGame->cbDeckSelect2->getSelected() == -1 || !deckManager.LoadDeckDouble(mainGame->cbDeckSelect->getItem(mainGame->cbDeckSelect->getSelected()), mainGame->cbDeckSelect2->getItem(mainGame->cbDeckSelect2->getSelected())));
if(check) {
static_cast<irr::gui::IGUICheckBox*>(caller)->setChecked(false); static_cast<irr::gui::IGUICheckBox*>(caller)->setChecked(false);
break; break;
} }
...@@ -344,21 +348,23 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -344,21 +348,23 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
DuelClient::SendBufferToServer(CTOS_UPDATE_DECK, deckbuf, pdeck - deckbuf); DuelClient::SendBufferToServer(CTOS_UPDATE_DECK, deckbuf, pdeck - deckbuf);
DuelClient::SendPacketToServer(CTOS_HS_READY); DuelClient::SendPacketToServer(CTOS_HS_READY);
mainGame->cbDeckSelect->setEnabled(false); mainGame->cbDeckSelect->setEnabled(false);
mainGame->cbDeckSelect2->setEnabled(false);
} else { } else {
DuelClient::SendPacketToServer(CTOS_HS_NOTREADY); DuelClient::SendPacketToServer(CTOS_HS_NOTREADY);
mainGame->cbDeckSelect->setEnabled(true); mainGame->cbDeckSelect->setEnabled(true);
mainGame->cbDeckSelect2->setEnabled(true);
} }
break; break;
} }
case CHECK_SEALED_DUEL: { case CHECK_SEALED_DUEL: {
if (static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) { if (static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) {
for (int i = 1; i < 14; ++i) for (int i = 1; i < 14; ++i)
if (i != 3) if (i != 3 && i != 11)
mainGame->chkRules[i]->setEnabled(false); mainGame->chkRules[i]->setEnabled(false);
} }
else { else {
for (int i = 1; i < 14; ++i) for (int i = 1; i < 14; ++i)
if (i != 3) if (i != 3 && i != 11)
mainGame->chkRules[i]->setEnabled(true); mainGame->chkRules[i]->setEnabled(true);
} }
break; break;
...@@ -366,12 +372,12 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -366,12 +372,12 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
case CHECK_BOOSTER_DUEL: { case CHECK_BOOSTER_DUEL: {
if (static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) { if (static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) {
for (int i = 0; i < 14; ++i) for (int i = 0; i < 14; ++i)
if(i != 1 && i != 3) if(i != 1 && i != 3 && i != 11)
mainGame->chkRules[i]->setEnabled(false); mainGame->chkRules[i]->setEnabled(false);
} }
else { else {
for (int i = 0; i < 14; ++i) for (int i = 0; i < 14; ++i)
if (i != 1 && i != 3) if (i != 1 && i != 3 && i != 11)
mainGame->chkRules[i]->setEnabled(true); mainGame->chkRules[i]->setEnabled(true);
} }
break; break;
...@@ -380,16 +386,16 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -380,16 +386,16 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
if (static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) { if (static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) {
mainGame->chkRules[0]->setEnabled(false); mainGame->chkRules[0]->setEnabled(false);
mainGame->chkRules[1]->setEnabled(false); mainGame->chkRules[1]->setEnabled(false);
for (int i = 9; i < 12; ++i) mainGame->chkRules[9]->setEnabled(false);
mainGame->chkRules[i]->setEnabled(false); mainGame->chkRules[10]->setEnabled(false);
} }
else { else {
mainGame->chkRules[0]->setEnabled(true); mainGame->chkRules[0]->setEnabled(true);
mainGame->chkRules[1]->setEnabled(true); mainGame->chkRules[1]->setEnabled(true);
for (int i = 9; i < 12; ++i) mainGame->chkRules[9]->setEnabled(true);
mainGame->chkRules[i]->setEnabled(true); mainGame->chkRules[10]->setEnabled(true);
for (int i = 0; i < 14; ++i) { for (int i = 0; i < 14; ++i) {
if (mainGame->chkRules[i]->isChecked() && i != 3) if (mainGame->chkRules[i]->isChecked() && i != 3 && i != 11)
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
mainGame->chkRules[i]->setEnabled(false); mainGame->chkRules[i]->setEnabled(false);
} }
...@@ -411,7 +417,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -411,7 +417,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
mainGame->chkRules[i]->setEnabled(true); mainGame->chkRules[i]->setEnabled(true);
for (int i = 0; i < 16; ++i) { for (int i = 0; i < 16; ++i) {
if (mainGame->chkRules[i]->isChecked() && i != 3) if (mainGame->chkRules[i]->isChecked() && i != 3 && i != 11)
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
mainGame->chkRules[i]->setEnabled(false); mainGame->chkRules[i]->setEnabled(false);
} }
...@@ -423,15 +429,13 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -423,15 +429,13 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)
mainGame->chkRules[i]->setEnabled(false); mainGame->chkRules[i]->setEnabled(false);
mainGame->chkRules[10]->setEnabled(false); mainGame->chkRules[10]->setEnabled(false);
mainGame->chkRules[11]->setEnabled(false);
} }
else { else {
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)
mainGame->chkRules[i]->setEnabled(true); mainGame->chkRules[i]->setEnabled(true);
mainGame->chkRules[10]->setEnabled(true); mainGame->chkRules[10]->setEnabled(true);
mainGame->chkRules[11]->setEnabled(true);
for (int i = 0; i < 16; ++i) { for (int i = 0; i < 16; ++i) {
if (mainGame->chkRules[i]->isChecked() && i != 3) if (mainGame->chkRules[i]->isChecked() && i != 3 && i != 11)
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
mainGame->chkRules[i]->setEnabled(false); mainGame->chkRules[i]->setEnabled(false);
} }
...@@ -443,35 +447,13 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -443,35 +447,13 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)
mainGame->chkRules[i]->setEnabled(false); mainGame->chkRules[i]->setEnabled(false);
mainGame->chkRules[9]->setEnabled(false); mainGame->chkRules[9]->setEnabled(false);
mainGame->chkRules[11]->setEnabled(false);
}
else {
for (int i = 0; i < 3; ++i)
mainGame->chkRules[i]->setEnabled(true);
mainGame->chkRules[9]->setEnabled(true);
mainGame->chkRules[11]->setEnabled(true);
for (int i = 0; i < 16; ++i) {
if (mainGame->chkRules[i]->isChecked() && i != 3)
for (int i = 0; i < 2; ++i)
mainGame->chkRules[i]->setEnabled(false);
}
}
break;
}
case CHECK_TURBO_DUEL_3: {
if (static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) {
for (int i = 0; i < 3; ++i)
mainGame->chkRules[i]->setEnabled(false);
mainGame->chkRules[9]->setEnabled(false);
mainGame->chkRules[10]->setEnabled(false);
} }
else { else {
for (int i = 0; i < 3; ++i) for (int i = 0; i < 3; ++i)
mainGame->chkRules[i]->setEnabled(true); mainGame->chkRules[i]->setEnabled(true);
mainGame->chkRules[9]->setEnabled(true); mainGame->chkRules[9]->setEnabled(true);
mainGame->chkRules[10]->setEnabled(true);
for (int i = 0; i < 16; ++i) { for (int i = 0; i < 16; ++i) {
if (mainGame->chkRules[i]->isChecked() && i != 3) if (mainGame->chkRules[i]->isChecked() && i != 3 && i != 11)
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
mainGame->chkRules[i]->setEnabled(false); mainGame->chkRules[i]->setEnabled(false);
} }
......
...@@ -28,7 +28,7 @@ struct HostInfo { ...@@ -28,7 +28,7 @@ struct HostInfo {
bool rose; bool rose;
bool turbo1; bool turbo1;
bool turbo2; bool turbo2;
bool turbo3; bool doubled;
bool command; bool command;
bool master; bool master;
unsigned int rule_count; unsigned int rule_count;
......
...@@ -254,7 +254,7 @@ void SingleDuel::PlayerReady(DuelPlayer* dp, bool is_ready) { ...@@ -254,7 +254,7 @@ void SingleDuel::PlayerReady(DuelPlayer* dp, bool is_ready) {
if(is_ready) { if(is_ready) {
bool allow_ocg = host_info.rule == 0 || host_info.rule == 2; bool allow_ocg = host_info.rule == 0 || host_info.rule == 2;
bool allow_tcg = host_info.rule == 1 || host_info.rule == 2; bool allow_tcg = host_info.rule == 1 || host_info.rule == 2;
int res = host_info.no_check_deck ? false : deckManager.CheckLFList(pdeck[dp->type], host_info.lflist, allow_ocg, allow_tcg); int res = host_info.no_check_deck ? false : deckManager.CheckLFList(pdeck[dp->type], host_info.lflist, allow_ocg, allow_tcg, host_info.doubled);
if(res) { if(res) {
STOC_HS_PlayerChange scpc; STOC_HS_PlayerChange scpc;
scpc.status = (dp->type << 4) | PLAYERCHANGE_NOTREADY; scpc.status = (dp->type << 4) | PLAYERCHANGE_NOTREADY;
...@@ -286,7 +286,7 @@ void SingleDuel::UpdateDeck(DuelPlayer* dp, void* pdata) { ...@@ -286,7 +286,7 @@ void SingleDuel::UpdateDeck(DuelPlayer* dp, void* pdata) {
int mainc = BufferIO::ReadInt32(deckbuf); int mainc = BufferIO::ReadInt32(deckbuf);
int sidec = BufferIO::ReadInt32(deckbuf); int sidec = BufferIO::ReadInt32(deckbuf);
if(duel_count == 0) { if(duel_count == 0) {
deckManager.LoadDeck(pdeck[dp->type], (int*)deckbuf, mainc, sidec); deckManager.LoadDeck(pdeck[dp->type], (int*)deckbuf, mainc, sidec,0,0, host_info.doubled);
} else { } else {
if(deckManager.LoadSide(pdeck[dp->type], (int*)deckbuf, mainc, sidec)) { if(deckManager.LoadSide(pdeck[dp->type], (int*)deckbuf, mainc, sidec)) {
ready[dp->type] = true; ready[dp->type] = true;
...@@ -415,8 +415,6 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) { ...@@ -415,8 +415,6 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
int opt = 0; int opt = 0;
if(host_info.enable_priority) if(host_info.enable_priority)
opt |= DUEL_OBSOLETE_RULING; opt |= DUEL_OBSOLETE_RULING;
if(host_info.destiny_draw)
opt |= DUEL_DESTINY_DRAW;
if(host_info.no_shuffle_deck) if(host_info.no_shuffle_deck)
opt |= DUEL_PSEUDO_SHUFFLE; opt |= DUEL_PSEUDO_SHUFFLE;
last_replay.WriteInt32(host_info.start_lp, false); last_replay.WriteInt32(host_info.start_lp, false);
...@@ -471,11 +469,11 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) { ...@@ -471,11 +469,11 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
if(host_info.turbo2) { if(host_info.turbo2) {
new_card(pduel, 110000000, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE); new_card(pduel, 110000000, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(110000000, false); last_replay.WriteInt32(110000000, false);
} }/*
if(host_info.turbo3) { if(host_info.doubled) {
new_card(pduel, 511001727, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE); new_card(pduel, 511001727, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(511001727, false); last_replay.WriteInt32(511001727, false);
} }*/
if(host_info.command) { if(host_info.command) {
new_card(pduel, 95200000, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE); new_card(pduel, 95200000, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(95200000, false); last_replay.WriteInt32(95200000, false);
......
...@@ -224,7 +224,7 @@ void TagDuel::PlayerReady(DuelPlayer* dp, bool is_ready) { ...@@ -224,7 +224,7 @@ void TagDuel::PlayerReady(DuelPlayer* dp, bool is_ready) {
if(is_ready) { if(is_ready) {
bool allow_ocg = host_info.rule == 0 || host_info.rule == 2; bool allow_ocg = host_info.rule == 0 || host_info.rule == 2;
bool allow_tcg = host_info.rule == 1 || host_info.rule == 2; bool allow_tcg = host_info.rule == 1 || host_info.rule == 2;
int res = host_info.no_check_deck ? false : deckManager.CheckLFList(pdeck[dp->type], host_info.lflist, allow_ocg, allow_tcg); int res = host_info.no_check_deck ? false : deckManager.CheckLFList(pdeck[dp->type], host_info.lflist, allow_ocg, allow_tcg, host_info.doubled);
if(res) { if(res) {
STOC_HS_PlayerChange scpc; STOC_HS_PlayerChange scpc;
scpc.status = (dp->type << 4) | PLAYERCHANGE_NOTREADY; scpc.status = (dp->type << 4) | PLAYERCHANGE_NOTREADY;
...@@ -256,7 +256,7 @@ void TagDuel::UpdateDeck(DuelPlayer* dp, void* pdata) { ...@@ -256,7 +256,7 @@ void TagDuel::UpdateDeck(DuelPlayer* dp, void* pdata) {
char* deckbuf = (char*)pdata; char* deckbuf = (char*)pdata;
int mainc = BufferIO::ReadInt32(deckbuf); int mainc = BufferIO::ReadInt32(deckbuf);
int sidec = BufferIO::ReadInt32(deckbuf); int sidec = BufferIO::ReadInt32(deckbuf);
deckManager.LoadDeck(pdeck[dp->type], (int*)deckbuf, mainc, sidec); deckManager.LoadDeck(pdeck[dp->type], (int*)deckbuf, mainc, sidec, 0, 0, host_info.doubled);
} }
void TagDuel::StartDuel(DuelPlayer* dp) { void TagDuel::StartDuel(DuelPlayer* dp) {
if(dp != host_player) if(dp != host_player)
...@@ -385,8 +385,6 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) { ...@@ -385,8 +385,6 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
int opt = 0; int opt = 0;
if(host_info.enable_priority) if(host_info.enable_priority)
opt |= DUEL_OBSOLETE_RULING; opt |= DUEL_OBSOLETE_RULING;
if(host_info.destiny_draw)
opt |= DUEL_DESTINY_DRAW;
if(host_info.no_shuffle_deck) if(host_info.no_shuffle_deck)
opt |= DUEL_PSEUDO_SHUFFLE; opt |= DUEL_PSEUDO_SHUFFLE;
opt |= DUEL_TAG_MODE; opt |= DUEL_TAG_MODE;
...@@ -447,11 +445,11 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) { ...@@ -447,11 +445,11 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
if(host_info.turbo2) { if(host_info.turbo2) {
new_card(pduel, 110000000, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE); new_card(pduel, 110000000, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(110000000, false); last_replay.WriteInt32(110000000, false);
} }/*
if(host_info.turbo3) { if(host_info.doubled) {
new_card(pduel, 511001727, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE); new_card(pduel, 511001727, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(511001727, false); last_replay.WriteInt32(511001727, false);
} }*/
if(host_info.command) { if(host_info.command) {
new_card(pduel, 95200000, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE); new_card(pduel, 95200000, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(95200000, false); last_replay.WriteInt32(95200000, false);
......
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