Commit e41eaecb authored by edo9300's avatar edo9300

added event modes

parent 0e4b962a
...@@ -120,6 +120,26 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) { ...@@ -120,6 +120,26 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
cscg.info.time_limit = _wtoi(mainGame->ebTimeLimit->getText()); cscg.info.time_limit = _wtoi(mainGame->ebTimeLimit->getText());
cscg.info.lflist = mainGame->cbLFlist->getItemData(mainGame->cbLFlist->getSelected()); cscg.info.lflist = mainGame->cbLFlist->getItemData(mainGame->cbLFlist->getSelected());
cscg.info.enable_priority = mainGame->chkEnablePriority->isChecked(); cscg.info.enable_priority = mainGame->chkEnablePriority->isChecked();
cscg.info.destiny_draw = mainGame->chkDrawDestiny->isChecked();
cscg.info.sealed = mainGame->chkRules[0]->isChecked();
cscg.info.booster = mainGame->chkRules[1]->isChecked();
cscg.info.action = mainGame->chkRules[2]->isChecked();
cscg.info.speed = mainGame->chkRules[3]->isChecked();
cscg.info.concentration = mainGame->chkRules[4]->isChecked();
cscg.info.boss = mainGame->chkRules[5]->isChecked();
cscg.info.city = mainGame->chkRules[6]->isChecked();
cscg.info.kingdom = mainGame->chkRules[7]->isChecked();
cscg.info.rose = mainGame->chkRules[8]->isChecked();
cscg.info.turbo1 = mainGame->chkRules[9]->isChecked();
cscg.info.turbo2 = mainGame->chkRules[10]->isChecked();
cscg.info.turbo3 = mainGame->chkRules[11]->isChecked();
cscg.info.command = mainGame->chkRules[12]->isChecked();
cscg.info.master = mainGame->chkRules[13]->isChecked();
cscg.info.rule_count = 0;
for (int i = 0; i < 14; ++i) {
if (mainGame->chkRules[i]->isChecked())
++cscg.info.rule_count;
}
cscg.info.no_check_deck = mainGame->chkNoCheckDeck->isChecked(); cscg.info.no_check_deck = mainGame->chkNoCheckDeck->isChecked();
cscg.info.no_shuffle_deck = mainGame->chkNoShuffleDeck->isChecked(); cscg.info.no_shuffle_deck = mainGame->chkNoShuffleDeck->isChecked();
SendPacketToServer(CTOS_CREATE_GAME, cscg); SendPacketToServer(CTOS_CREATE_GAME, cscg);
...@@ -151,6 +171,7 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) { ...@@ -151,6 +171,7 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
mainGame->btnJoinCancel->setEnabled(true); mainGame->btnJoinCancel->setEnabled(true);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->HideElement(mainGame->wHostPrepare); mainGame->HideElement(mainGame->wHostPrepare);
mainGame->HideElement(mainGame->wHostPrepare2);
mainGame->ShowElement(mainGame->wLanWindow); mainGame->ShowElement(mainGame->wLanWindow);
mainGame->wChat->setVisible(false); mainGame->wChat->setVisible(false);
if(events & BEV_EVENT_EOF) if(events & BEV_EVENT_EOF)
...@@ -311,6 +332,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -311,6 +332,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
case STOC_JOIN_GAME: { case STOC_JOIN_GAME: {
STOC_JoinGame* pkt = (STOC_JoinGame*)pdata; STOC_JoinGame* pkt = (STOC_JoinGame*)pdata;
std::wstring str; std::wstring str;
std::wstring str2;
wchar_t msgbuf[256]; wchar_t msgbuf[256];
myswprintf(msgbuf, L"%ls%ls\n", dataManager.GetSysString(1226), deckManager.GetLFListName(pkt->info.lflist)); myswprintf(msgbuf, L"%ls%ls\n", dataManager.GetSysString(1226), deckManager.GetLFListName(pkt->info.lflist));
str.append(msgbuf); str.append(msgbuf);
...@@ -333,6 +355,10 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -333,6 +355,10 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1236)); myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1236));
str.append(msgbuf); str.append(msgbuf);
} }
if(pkt->info.destiny_draw) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1626));
str.append(msgbuf);
}
if(pkt->info.no_check_deck) { if(pkt->info.no_check_deck) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1229)); myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1229));
str.append(msgbuf); str.append(msgbuf);
...@@ -341,6 +367,62 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -341,6 +367,62 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1230)); myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1230));
str.append(msgbuf); str.append(msgbuf);
} }
if(pkt->info.sealed) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1132));
str2.append(msgbuf);
}
if(pkt->info.booster) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1133));
str2.append(msgbuf);
}
if(pkt->info.action) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1134));
str2.append(msgbuf);
}
if(pkt->info.speed) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1135));
str2.append(msgbuf);
}
if(pkt->info.concentration) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1136));
str2.append(msgbuf);
}
if(pkt->info.boss) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1137));
str2.append(msgbuf);
}
if(pkt->info.city) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1138));
str2.append(msgbuf);
}
if(pkt->info.kingdom) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1139));
str2.append(msgbuf);
}
if(pkt->info.rose) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1140));
str2.append(msgbuf);
}
if(pkt->info.turbo1) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1141));
str2.append(msgbuf);
}
if(pkt->info.turbo2) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1142));
str2.append(msgbuf);
}
if(pkt->info.turbo3) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1143));
str2.append(msgbuf);
}
if(pkt->info.command) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1144));
str2.append(msgbuf);
}
if(pkt->info.master) {
myswprintf(msgbuf, L"*%ls\n", dataManager.GetSysString(1145));
str2.append(msgbuf);
}
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
if(pkt->info.mode == 2) { if(pkt->info.mode == 2) {
mainGame->dInfo.isTag = true; mainGame->dInfo.isTag = true;
...@@ -372,6 +454,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -372,6 +454,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->stHostPrepDuelist[3]->setText(L""); mainGame->stHostPrepDuelist[3]->setText(L"");
mainGame->stHostPrepOB->setText(L""); mainGame->stHostPrepOB->setText(L"");
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->RefreshDeck(mainGame->cbDeckSelect); mainGame->RefreshDeck(mainGame->cbDeckSelect);
mainGame->cbDeckSelect->setEnabled(true); mainGame->cbDeckSelect->setEnabled(true);
if(mainGame->wCreateHost->isVisible()) if(mainGame->wCreateHost->isVisible())
...@@ -379,6 +462,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -379,6 +462,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
else if (mainGame->wLanWindow->isVisible()) else if (mainGame->wLanWindow->isVisible())
mainGame->HideElement(mainGame->wLanWindow); mainGame->HideElement(mainGame->wLanWindow);
mainGame->ShowElement(mainGame->wHostPrepare); mainGame->ShowElement(mainGame->wHostPrepare);
if(pkt->info.rule_count > 0)
mainGame->ShowElement(mainGame->wHostPrepare2);
mainGame->wChat->setVisible(true); mainGame->wChat->setVisible(true);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
connect_state |= 0x4; connect_state |= 0x4;
...@@ -440,6 +525,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -440,6 +525,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
} }
case STOC_DUEL_START: { case STOC_DUEL_START: {
mainGame->HideElement(mainGame->wHostPrepare); mainGame->HideElement(mainGame->wHostPrepare);
mainGame->HideElement(mainGame->wHostPrepare2);
mainGame->WaitFrameSignal(11); mainGame->WaitFrameSignal(11);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->dField.Clear(); mainGame->dField.Clear();
...@@ -3422,7 +3508,7 @@ void DuelClient::BroadcastReply(evutil_socket_t fd, short events, void * arg) { ...@@ -3422,7 +3508,7 @@ void DuelClient::BroadcastReply(evutil_socket_t fd, short events, void * arg) {
hoststr.append(dataManager.GetSysString(pHP->host.mode + 1244)); hoststr.append(dataManager.GetSysString(pHP->host.mode + 1244));
hoststr.append(L"]["); hoststr.append(L"][");
if(pHP->host.draw_count == 1 && pHP->host.start_hand == 5 && pHP->host.start_lp == 8000 if(pHP->host.draw_count == 1 && pHP->host.start_hand == 5 && pHP->host.start_lp == 8000
&& !pHP->host.no_check_deck && !pHP->host.no_shuffle_deck && ! pHP->host.enable_priority) && !pHP->host.no_check_deck && !pHP->host.no_shuffle_deck && ! pHP->host.enable_priority && !pHP->host.destiny_draw && pHP->host.rule_count==0 )
hoststr.append(dataManager.GetSysString(1280)); hoststr.append(dataManager.GetSysString(1280));
else hoststr.append(dataManager.GetSysString(1281)); else hoststr.append(dataManager.GetSysString(1281));
hoststr.append(L"]"); hoststr.append(L"]");
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include <dirent.h> #include <dirent.h>
#endif #endif
const unsigned short PRO_VERSION = 0x133C; const unsigned short PRO_VERSION = 0x133A;
namespace ygo { namespace ygo {
...@@ -140,6 +140,16 @@ bool Game::Initialize() { ...@@ -140,6 +140,16 @@ bool Game::Initialize() {
ebTimeLimit->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); ebTimeLimit->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
env->addStaticText(dataManager.GetSysString(1228), rect<s32>(20, 150, 320, 170), false, false, wCreateHost); env->addStaticText(dataManager.GetSysString(1228), rect<s32>(20, 150, 320, 170), false, false, wCreateHost);
chkEnablePriority = env->addCheckBox(false, rect<s32>(20, 180, 360, 200), wCreateHost, -1, dataManager.GetSysString(1236)); chkEnablePriority = env->addCheckBox(false, rect<s32>(20, 180, 360, 200), wCreateHost, -1, dataManager.GetSysString(1236));
btnRuleCards = env->addButton(rect<s32>(260, 330, 370, 350), wCreateHost, BUTTON_RULE_CARDS, dataManager.GetSysString(1625));
wRules = env->addWindow(rect<s32>(630, 100, 1000, 310), false, dataManager.strBuffer);
wRules->getCloseButton()->setVisible(false);
wRules->setDrawTitlebar(false);
wRules->setDraggable(true);
wRules->setVisible(false);
btnRulesOK = env->addButton(rect<s32>(135, 175, 235, 200), wRules, BUTTON_RULE_OK, dataManager.GetSysString(1211));
for(int i = 0; i < 14; ++i)
chkRules[i] = env->addCheckBox(false, recti(10 + (i % 2) * 150, 10 + (i / 2) * 20, 200 + (i % 2) * 120, 30 + (i / 2) * 20), wRules, 353+i, dataManager.GetSysString(1132 + i));
chkDrawDestiny = env->addCheckBox(false, rect<s32>(180, 180, 360, 200), wCreateHost, -1, dataManager.GetSysString(1626));
chkNoCheckDeck = env->addCheckBox(false, rect<s32>(20, 210, 170, 230), wCreateHost, -1, dataManager.GetSysString(1229)); chkNoCheckDeck = env->addCheckBox(false, rect<s32>(20, 210, 170, 230), wCreateHost, -1, dataManager.GetSysString(1229));
chkNoShuffleDeck = env->addCheckBox(false, rect<s32>(180, 210, 360, 230), wCreateHost, -1, dataManager.GetSysString(1230)); chkNoShuffleDeck = env->addCheckBox(false, rect<s32>(180, 210, 360, 230), wCreateHost, -1, dataManager.GetSysString(1230));
env->addStaticText(dataManager.GetSysString(1231), rect<s32>(20, 240, 320, 260), false, false, wCreateHost); env->addStaticText(dataManager.GetSysString(1231), rect<s32>(20, 240, 320, 260), false, false, wCreateHost);
...@@ -163,6 +173,10 @@ bool Game::Initialize() { ...@@ -163,6 +173,10 @@ bool Game::Initialize() {
btnHostConfirm = env->addButton(rect<s32>(260, 355, 370, 380), wCreateHost, BUTTON_HOST_CONFIRM, dataManager.GetSysString(1211)); btnHostConfirm = env->addButton(rect<s32>(260, 355, 370, 380), wCreateHost, BUTTON_HOST_CONFIRM, dataManager.GetSysString(1211));
btnHostCancel = env->addButton(rect<s32>(260, 385, 370, 410), wCreateHost, BUTTON_HOST_CANCEL, dataManager.GetSysString(1212)); btnHostCancel = env->addButton(rect<s32>(260, 385, 370, 410), wCreateHost, BUTTON_HOST_CANCEL, dataManager.GetSysString(1212));
//host(single) //host(single)
wHostPrepare2 = env->addWindow(rect<s32>(750, 120, 950, 440), false, dataManager.GetSysString(1625));
wHostPrepare2->getCloseButton()->setVisible(false);
wHostPrepare2->setVisible(false);
stHostPrepRule2 = env->addStaticText(L"", rect<s32>(10, 30, 460, 230), false, true, wHostPrepare2);
wHostPrepare = env->addWindow(rect<s32>(270, 120, 750, 440), false, dataManager.GetSysString(1250)); wHostPrepare = env->addWindow(rect<s32>(270, 120, 750, 440), false, dataManager.GetSysString(1250));
wHostPrepare->getCloseButton()->setVisible(false); wHostPrepare->getCloseButton()->setVisible(false);
wHostPrepare->setVisible(false); wHostPrepare->setVisible(false);
......
...@@ -228,12 +228,19 @@ public: ...@@ -228,12 +228,19 @@ public:
irr::gui::IGUIEditBox* ebServerName; irr::gui::IGUIEditBox* ebServerName;
irr::gui::IGUIEditBox* ebServerPass; irr::gui::IGUIEditBox* ebServerPass;
irr::gui::IGUICheckBox* chkEnablePriority; irr::gui::IGUICheckBox* chkEnablePriority;
irr::gui::IGUIButton* btnRuleCards;
irr::gui::IGUIWindow* wRules;
irr::gui::IGUICheckBox* chkRules[14];
irr::gui::IGUIButton* btnRulesOK;
irr::gui::IGUICheckBox* chkDrawDestiny;
irr::gui::IGUICheckBox* chkNoCheckDeck; irr::gui::IGUICheckBox* chkNoCheckDeck;
irr::gui::IGUICheckBox* chkNoShuffleDeck; irr::gui::IGUICheckBox* chkNoShuffleDeck;
irr::gui::IGUIButton* btnHostConfirm; irr::gui::IGUIButton* btnHostConfirm;
irr::gui::IGUIButton* btnHostCancel; irr::gui::IGUIButton* btnHostCancel;
//host panel //host panel
irr::gui::IGUIWindow* wHostPrepare; irr::gui::IGUIWindow* wHostPrepare;
irr::gui::IGUIWindow* wHostPrepare2;
irr::gui::IGUIStaticText* stHostCardRule;
irr::gui::IGUIButton* btnHostPrepDuelist; irr::gui::IGUIButton* btnHostPrepDuelist;
irr::gui::IGUIButton* btnHostPrepOB; irr::gui::IGUIButton* btnHostPrepOB;
irr::gui::IGUIStaticText* stHostPrepDuelist[4]; irr::gui::IGUIStaticText* stHostPrepDuelist[4];
...@@ -241,6 +248,7 @@ public: ...@@ -241,6 +248,7 @@ public:
irr::gui::IGUIButton* btnHostPrepKick[4]; irr::gui::IGUIButton* btnHostPrepKick[4];
irr::gui::IGUIComboBox* cbDeckSelect; irr::gui::IGUIComboBox* cbDeckSelect;
irr::gui::IGUIStaticText* stHostPrepRule; irr::gui::IGUIStaticText* stHostPrepRule;
irr::gui::IGUIStaticText* stHostPrepRule2;
irr::gui::IGUIStaticText* stHostPrepOB; irr::gui::IGUIStaticText* stHostPrepOB;
irr::gui::IGUIButton* btnHostPrepStart; irr::gui::IGUIButton* btnHostPrepStart;
irr::gui::IGUIButton* btnHostPrepCancel; irr::gui::IGUIButton* btnHostPrepCancel;
...@@ -432,6 +440,8 @@ extern Game* mainGame; ...@@ -432,6 +440,8 @@ extern Game* mainGame;
#define BUTTON_HOST_CONFIRM 114 #define BUTTON_HOST_CONFIRM 114
#define BUTTON_HOST_CANCEL 115 #define BUTTON_HOST_CANCEL 115
#define BUTTON_LAN_REFRESH 116 #define BUTTON_LAN_REFRESH 116
#define BUTTON_RULE_CARDS 117
#define BUTTON_RULE_OK 118
#define BUTTON_HP_DUELIST 120 #define BUTTON_HP_DUELIST 120
#define BUTTON_HP_OBSERVER 121 #define BUTTON_HP_OBSERVER 121
#define BUTTON_HP_START 122 #define BUTTON_HP_START 122
...@@ -526,5 +536,19 @@ extern Game* mainGame; ...@@ -526,5 +536,19 @@ extern Game* mainGame;
#define LISTBOX_SINGLEPLAY_LIST 350 #define LISTBOX_SINGLEPLAY_LIST 350
#define BUTTON_LOAD_SINGLEPLAY 351 #define BUTTON_LOAD_SINGLEPLAY 351
#define BUTTON_CANCEL_SINGLEPLAY 352 #define BUTTON_CANCEL_SINGLEPLAY 352
#define CHECK_SEALED_DUEL 353
#define CHECK_BOOSTER_DUEL 354
#define CHECK_ACTION_DUEL 355
#define CHECK_SPEED_DUEL 356
#define CHECK_CONCENTRATION_DUEL 357
#define CHECK_BOSS_DUEL 358
#define CHECK_BATTLE_CITY 359
#define CHECK_DUELIST_KINGDOM 360
#define CHECK_ROSE_DUEL 361
#define CHECK_TURBO_DUEL_1 362
#define CHECK_TURBO_DUEL_2 363
#define CHECK_TURBO_DUEL_3 364
#define CHECK_COMMAND_DUEL 365
#define CHECK_DECK_MASTER_DUEL 366
#define COMBOBOX_SORTTYPE 370 #define COMBOBOX_SORTTYPE 370
#endif // GAME_H #endif // GAME_H
...@@ -87,6 +87,18 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -87,6 +87,18 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame->ShowElement(mainGame->wCreateHost); mainGame->ShowElement(mainGame->wCreateHost);
break; break;
} }
case BUTTON_RULE_CARDS: {
if(mainGame->wRules->isVisible()){
mainGame->HideElement(mainGame->wRules);
}else {
mainGame->PopupElement(mainGame->wRules);
}
break;
}
case BUTTON_RULE_OK: {
mainGame->HideElement(mainGame->wRules);
break;
}
case BUTTON_HOST_CONFIRM: { case BUTTON_HOST_CONFIRM: {
BufferIO::CopyWStr(mainGame->ebServerName->getText(), mainGame->gameConf.gamename, 20); BufferIO::CopyWStr(mainGame->ebServerName->getText(), mainGame->gameConf.gamename, 20);
if(!NetServer::StartServer(mainGame->gameConf.serverport)) if(!NetServer::StartServer(mainGame->gameConf.serverport))
...@@ -95,6 +107,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -95,6 +107,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
NetServer::StopServer(); NetServer::StopServer();
break; break;
} }
mainGame->HideElement(mainGame->wRules);
mainGame->btnHostConfirm->setEnabled(false); mainGame->btnHostConfirm->setEnabled(false);
mainGame->btnHostCancel->setEnabled(false); mainGame->btnHostCancel->setEnabled(false);
break; break;
...@@ -103,6 +116,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -103,6 +116,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame->btnCreateHost->setEnabled(true); mainGame->btnCreateHost->setEnabled(true);
mainGame->btnJoinHost->setEnabled(true); mainGame->btnJoinHost->setEnabled(true);
mainGame->btnJoinCancel->setEnabled(true); mainGame->btnJoinCancel->setEnabled(true);
mainGame->HideElement(mainGame->wRules);
mainGame->HideElement(mainGame->wCreateHost); mainGame->HideElement(mainGame->wCreateHost);
mainGame->ShowElement(mainGame->wLanWindow); mainGame->ShowElement(mainGame->wLanWindow);
break; break;
...@@ -140,6 +154,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -140,6 +154,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame->btnJoinHost->setEnabled(true); mainGame->btnJoinHost->setEnabled(true);
mainGame->btnJoinCancel->setEnabled(true); mainGame->btnJoinCancel->setEnabled(true);
mainGame->HideElement(mainGame->wHostPrepare); mainGame->HideElement(mainGame->wHostPrepare);
mainGame->HideElement(mainGame->wHostPrepare2);
mainGame->ShowElement(mainGame->wLanWindow); mainGame->ShowElement(mainGame->wLanWindow);
mainGame->wChat->setVisible(false); mainGame->wChat->setVisible(false);
if(exit_on_return) if(exit_on_return)
...@@ -335,6 +350,134 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -335,6 +350,134 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
} }
break; break;
} }
case CHECK_SEALED_DUEL: {
if (static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) {
for (int i = 1; i < 14; ++i)
if (i != 3)
mainGame->chkRules[i]->setEnabled(false);
}
else {
for (int i = 1; i < 14; ++i)
if (i != 3)
mainGame->chkRules[i]->setEnabled(true);
}
break;
}
case CHECK_BOOSTER_DUEL: {
if (static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) {
for (int i = 0; i < 14; ++i)
if(i != 1 && i != 3)
mainGame->chkRules[i]->setEnabled(false);
}
else {
for (int i = 0; i < 14; ++i)
if (i != 1 && i != 3)
mainGame->chkRules[i]->setEnabled(true);
}
break;
}
case CHECK_ACTION_DUEL: {
if (static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) {
mainGame->chkRules[0]->setEnabled(false);
mainGame->chkRules[1]->setEnabled(false);
for (int i = 9; i < 12; ++i)
mainGame->chkRules[i]->setEnabled(false);
}
else {
mainGame->chkRules[0]->setEnabled(true);
mainGame->chkRules[1]->setEnabled(true);
for (int i = 9; i < 12; ++i)
mainGame->chkRules[i]->setEnabled(true);
for (int i = 0; i < 14; ++i) {
if (mainGame->chkRules[i]->isChecked() && i != 3)
for (int i = 0; i < 2; ++i)
mainGame->chkRules[i]->setEnabled(false);
}
}
break;
}
case CHECK_CONCENTRATION_DUEL:
case CHECK_BOSS_DUEL:
case CHECK_BATTLE_CITY:
case CHECK_DUELIST_KINGDOM:
case CHECK_ROSE_DUEL:
case CHECK_COMMAND_DUEL:
case CHECK_DECK_MASTER_DUEL: {
if (static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) {
for (int i = 0; i < 2; ++i)
mainGame->chkRules[i]->setEnabled(false);
}
else {
for (int i = 0; i < 2; ++i)
mainGame->chkRules[i]->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_1: {
if (static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) {
for (int i = 0; i < 3; ++i)
mainGame->chkRules[i]->setEnabled(false);
mainGame->chkRules[10]->setEnabled(false);
mainGame->chkRules[11]->setEnabled(false);
}
else {
for (int i = 0; i < 3; ++i)
mainGame->chkRules[i]->setEnabled(true);
mainGame->chkRules[10]->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_2: {
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[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 {
for (int i = 0; i < 3; ++i)
mainGame->chkRules[i]->setEnabled(true);
mainGame->chkRules[9]->setEnabled(true);
mainGame->chkRules[10]->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;
}
} }
break; break;
} }
......
...@@ -16,6 +16,22 @@ struct HostInfo { ...@@ -16,6 +16,22 @@ struct HostInfo {
unsigned char rule; unsigned char rule;
unsigned char mode; unsigned char mode;
bool enable_priority; bool enable_priority;
bool destiny_draw;
bool sealed;
bool booster;
bool action;
bool speed;
bool concentration;
bool boss;
bool city;
bool kingdom;
bool rose;
bool turbo1;
bool turbo2;
bool turbo3;
bool command;
bool master;
unsigned int rule_count;
bool no_check_deck; bool no_check_deck;
bool no_shuffle_deck; bool no_shuffle_deck;
unsigned int start_lp; unsigned int start_lp;
......
...@@ -415,6 +415,8 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) { ...@@ -415,6 +415,8 @@ 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);
...@@ -422,21 +424,86 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) { ...@@ -422,21 +424,86 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
last_replay.WriteInt32(host_info.draw_count, false); last_replay.WriteInt32(host_info.draw_count, false);
last_replay.WriteInt32(opt, false); last_replay.WriteInt32(opt, false);
last_replay.Flush(); last_replay.Flush();
last_replay.WriteInt32(pdeck[0].main.size(), false); last_replay.WriteInt32(pdeck[0].main.size() + host_info.rule_count, false);
for(int32 i = (int32)pdeck[0].main.size() - 1; i >= 0; --i) { for(int32 i = (int32)pdeck[0].main.size() - 1; i >= 0; --i) {
new_card(pduel, pdeck[0].main[i]->first, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE); new_card(pduel, pdeck[0].main[i]->first, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(pdeck[0].main[i]->first, false); last_replay.WriteInt32(pdeck[0].main[i]->first, false);
} }
if(host_info.destiny_draw) {
new_card(pduel, 511004000, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(511004000, false);
}
if(host_info.sealed) {
new_card(pduel, 511005092, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(511005092, false);
}
if(host_info.booster) {
new_card(pduel, 511005093, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(511005093, false);
}
if(host_info.speed) {
new_card(pduel, 511004001, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(511004001, false);
}
if(host_info.concentration) {
//needed mode
}
if(host_info.boss) {
new_card(pduel, 95000000, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(95000000, false);
}
if(host_info.city) {
new_card(pduel, 511004014, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(511004014, false);
}
if(host_info.kingdom) {
new_card(pduel, 511002621, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(511002621, false);
}
if(host_info.rose) {
//needed mode
}
if(host_info.turbo1) {
new_card(pduel, 511002094, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(511002094, false);
}
if(host_info.turbo2) {
new_card(pduel, 110000000, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(110000000, false);
}
if(host_info.turbo3) {
new_card(pduel, 511001727, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(511001727, false);
}
if(host_info.command) {
new_card(pduel, 95200000, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(95200000, false);
}
if(host_info.master) {
new_card(pduel, 51100567, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(51100567, false);
}
if(host_info.action) {
new_card(pduel, 95000043, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(95000043, false);
}
last_replay.WriteInt32(pdeck[0].extra.size(), false); last_replay.WriteInt32(pdeck[0].extra.size(), false);
for(int32 i = (int32)pdeck[0].extra.size() - 1; i >= 0; --i) { for(int32 i = (int32)pdeck[0].extra.size() - 1; i >= 0; --i) {
new_card(pduel, pdeck[0].extra[i]->first, 0, 0, LOCATION_EXTRA, 0, POS_FACEDOWN_DEFENSE); new_card(pduel, pdeck[0].extra[i]->first, 0, 0, LOCATION_EXTRA, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(pdeck[0].extra[i]->first, false); last_replay.WriteInt32(pdeck[0].extra[i]->first, false);
} }
last_replay.WriteInt32(pdeck[1].main.size(), false); if(host_info.master)
last_replay.WriteInt32(pdeck[1].main.size() + 1, false);
else
last_replay.WriteInt32(pdeck[1].main.size(), false);
for(int32 i = (int32)pdeck[1].main.size() - 1; i >= 0; --i) { for(int32 i = (int32)pdeck[1].main.size() - 1; i >= 0; --i) {
new_card(pduel, pdeck[1].main[i]->first, 1, 1, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE); new_card(pduel, pdeck[1].main[i]->first, 1, 1, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(pdeck[1].main[i]->first, false); last_replay.WriteInt32(pdeck[1].main[i]->first, false);
} }
if(host_info.master) {
new_card(pduel, 51100567, 1, 1, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(51100567, false);
}
last_replay.WriteInt32(pdeck[1].extra.size(), false); last_replay.WriteInt32(pdeck[1].extra.size(), false);
for(int32 i = (int32)pdeck[1].extra.size() - 1; i >= 0; --i) { for(int32 i = (int32)pdeck[1].extra.size() - 1; i >= 0; --i) {
new_card(pduel, pdeck[1].extra[i]->first, 1, 1, LOCATION_EXTRA, 0, POS_FACEDOWN_DEFENSE); new_card(pduel, pdeck[1].extra[i]->first, 1, 1, LOCATION_EXTRA, 0, POS_FACEDOWN_DEFENSE);
......
...@@ -385,6 +385,8 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) { ...@@ -385,6 +385,8 @@ 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;
...@@ -394,11 +396,69 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) { ...@@ -394,11 +396,69 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
last_replay.WriteInt32(opt, false); last_replay.WriteInt32(opt, false);
last_replay.Flush(); last_replay.Flush();
// //
last_replay.WriteInt32(pdeck[0].main.size(), false); last_replay.WriteInt32(pdeck[0].main.size() + host_info.rule_count, false);
for(int32 i = (int32)pdeck[0].main.size() - 1; i >= 0; --i) { for(int32 i = (int32)pdeck[0].main.size() - 1; i >= 0; --i) {
new_card(pduel, pdeck[0].main[i]->first, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE); new_card(pduel, pdeck[0].main[i]->first, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(pdeck[0].main[i]->first, false); last_replay.WriteInt32(pdeck[0].main[i]->first, false);
} }
if(host_info.destiny_draw) {
new_card(pduel, 511004000, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(511004000, false);
}
if(host_info.sealed) {
new_card(pduel, 511005092, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(511005092, false);
}
if(host_info.booster) {
new_card(pduel, 511005093, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(511005093, false);
}
if(host_info.action) {
new_card(pduel, 95000043, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(95000043, false);
}
if(host_info.speed) {
new_card(pduel, 511004001, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(511004001, false);
}
if(host_info.concentration) {
//needed mode
}
if(host_info.boss) {
new_card(pduel, 95000000, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(95000000, false);
}
if(host_info.city) {
new_card(pduel, 511004014, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(511004014, false);
}
if(host_info.kingdom) {
new_card(pduel, 511002621, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(511002621, false);
}
if(host_info.rose) {
//needed mode
}
if(host_info.turbo1) {
new_card(pduel, 511002094, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(511002094, false);
}
if(host_info.turbo2) {
new_card(pduel, 110000000, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(110000000, false);
}
if(host_info.turbo3) {
new_card(pduel, 511001727, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(511001727, false);
}
if(host_info.command) {
new_card(pduel, 95200000, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(95200000, false);
}
if(host_info.master) {
new_card(pduel, 51100567, 0, 0, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(51100567, false);
}
last_replay.WriteInt32(pdeck[0].extra.size(), false); last_replay.WriteInt32(pdeck[0].extra.size(), false);
for(int32 i = (int32)pdeck[0].extra.size() - 1; i >= 0; --i) { for(int32 i = (int32)pdeck[0].extra.size() - 1; i >= 0; --i) {
new_card(pduel, pdeck[0].extra[i]->first, 0, 0, LOCATION_EXTRA, 0, POS_FACEDOWN_DEFENSE); new_card(pduel, pdeck[0].extra[i]->first, 0, 0, LOCATION_EXTRA, 0, POS_FACEDOWN_DEFENSE);
...@@ -416,11 +476,18 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) { ...@@ -416,11 +476,18 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
last_replay.WriteInt32(pdeck[1].extra[i]->first, false); last_replay.WriteInt32(pdeck[1].extra[i]->first, false);
} }
// //
last_replay.WriteInt32(pdeck[3].main.size(), false); if(host_info.master)
last_replay.WriteInt32(pdeck[3].main.size() + 1, false);
else
last_replay.WriteInt32(pdeck[3].main.size(), false);
for(int32 i = (int32)pdeck[3].main.size() - 1; i >= 0; --i) { for(int32 i = (int32)pdeck[3].main.size() - 1; i >= 0; --i) {
new_card(pduel, pdeck[3].main[i]->first, 1, 1, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE); new_card(pduel, pdeck[3].main[i]->first, 1, 1, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(pdeck[3].main[i]->first, false); last_replay.WriteInt32(pdeck[3].main[i]->first, false);
} }
if(host_info.master) {
new_card(pduel, 51100567, 1, 1, LOCATION_DECK, 0, POS_FACEDOWN_DEFENSE);
last_replay.WriteInt32(51100567, false);
}
last_replay.WriteInt32(pdeck[3].extra.size(), false); last_replay.WriteInt32(pdeck[3].extra.size(), false);
for(int32 i = (int32)pdeck[3].extra.size() - 1; i >= 0; --i) { for(int32 i = (int32)pdeck[3].extra.size() - 1; i >= 0; --i) {
new_card(pduel, pdeck[3].extra[i]->first, 1, 1, LOCATION_EXTRA, 0, POS_FACEDOWN_DEFENSE); new_card(pduel, pdeck[3].extra[i]->first, 1, 1, LOCATION_EXTRA, 0, POS_FACEDOWN_DEFENSE);
......
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