Commit b25022e7 authored by nanahira's avatar nanahira

Merge branch 'master' into another

parents e1567e82 3795bc66
......@@ -22,7 +22,7 @@ before_install:
- git submodule update --init --recursive
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update;
brew install freetype libevent sqlite dylibbundler;
brew install freetype libevent sqlite dylibbundler p7zip;
sudo cp -r /usr/local/include/freetype2 ./freetype2;
sudo cp -r /usr/local/include/event2 ./event2;
sudo rm -rf /usr/local/include/*;
......
......@@ -199,6 +199,8 @@ void ClientCard::ClearTarget() {
ownerTarget.clear();
}
bool ClientCard::client_card_sort(ClientCard* c1, ClientCard* c2) {
if(c1->is_selected != c2->is_selected)
return c1->is_selected < c2->is_selected;
int32 cp1 = c1->overlayTarget ? c1->overlayTarget->controler : c1->controler;
int32 cp2 = c2->overlayTarget ? c2->overlayTarget->controler : c2->controler;
if(cp1 != cp2)
......
......@@ -141,7 +141,7 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
cscg.info.draw_count = 1;
cscg.info.time_limit = 0;
cscg.info.lflist = 0;
cscg.info.duel_rule = mainGame->chkBotOldRule->isChecked() ? DEFAULT_DUEL_RULE - 1 : DEFAULT_DUEL_RULE;
cscg.info.duel_rule = mainGame->cbBotRule->getSelected() + 3;
cscg.info.no_check_deck = mainGame->chkBotNoCheckDeck->isChecked();
cscg.info.no_shuffle_deck = mainGame->chkBotNoShuffleDeck->isChecked();
}
......@@ -810,11 +810,13 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
wcsftime(timetext, 40, L"%Y-%m-%d %H-%M-%S", localedtime);
mainGame->ebRSName->setText(timetext);
if(!mainGame->chkAutoSaveReplay->isChecked()) {
mainGame->wReplaySave->setText(dataManager.GetSysString(1340));
mainGame->PopupElement(mainGame->wReplaySave);
mainGame->gMutex.unlock();
mainGame->replaySignal.Reset();
mainGame->replaySignal.Wait();
if (!auto_watch_mode) {
mainGame->wReplaySave->setText(dataManager.GetSysString(1340));
mainGame->PopupElement(mainGame->wReplaySave);
mainGame->gMutex.unlock();
mainGame->replaySignal.Reset();
mainGame->replaySignal.Wait();
}
}
else {
mainGame->actionParam = 1;
......@@ -3083,6 +3085,18 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int ct = BufferIO::ReadInt8(pbuf);
if(mainGame->dInfo.isReplaySkiping)
return true;
if (auto_watch_mode && mainGame->dField.chains.size() > 1) {
int code = mainGame->dField.chains[ct - 1].chain_card->code;
if (code > 0) {
mainGame->showcardcode = code;
mainGame->showcarddif = 0;
mainGame->showcardp = 0;
mainGame->showcard = 1;
mainGame->WaitFrameSignal(30);
mainGame->showcard = 0;
mainGame->WaitFrameSignal(11);
}
}
if (mainGame->dField.chains.size() > 1) {
if (mainGame->dField.last_chain)
mainGame->WaitFrameSignal(11);
......@@ -3093,10 +3107,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->WaitFrameSignal(3);
}
}
if (auto_watch_mode) {
int code = mainGame->dField.chains[ct - 1].chain_card->code;
mainGame->ShowCardInfo(code);
}
mainGame->dField.last_chain = false;
return true;
}
......@@ -3167,8 +3177,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int s = BufferIO::ReadInt8(pbuf);
/*int ss = */BufferIO::ReadInt8(pbuf);
ClientCard* pcard = mainGame->dField.GetCard(c, l, s);
if (auto_watch_mode && i == 0 && (pcard->position & POS_FACEUP) && (pcard->location & LOCATION_ONFIELD)) {
mainGame->ShowCardInfo(pcard->code);
if (auto_watch_mode && pcard->code > 0) {
mainGame->showcardcode = pcard->code;
mainGame->showcarddif = 0;
mainGame->showcardp = 0;
mainGame->showcard = 4;
}
pcard->is_highlighting = true;
mainGame->dField.current_chain.target.insert(pcard);
......@@ -3190,6 +3203,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.MoveCard(pcard, 5);
} else
mainGame->WaitFrameSignal(30);
if (auto_watch_mode && pcard->code > 0) {
mainGame->showcard = 0;
}
myswprintf(textBuffer, dataManager.GetSysString(1610), dataManager.GetName(pcard->code), dataManager.FormatLocation(l, s), s + 1);
mainGame->AddLog(textBuffer, pcard->code);
pcard->is_highlighting = false;
......@@ -3449,6 +3465,16 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int s = BufferIO::ReadInt8(pbuf);
int count = BufferIO::ReadInt16(pbuf);
ClientCard* pc = mainGame->dField.GetCard(c, l, s);
if (auto_watch_mode && pc->code > 0) {
myswprintf(event_string, dataManager.GetSysString(1610), dataManager.GetName(pc->code));
mainGame->showcardcode = pc->code;
mainGame->showcarddif = 0;
mainGame->showcardp = 0;
mainGame->showcard = 5;
mainGame->WaitFrameSignal(30);
mainGame->showcard = 0;
mainGame->WaitFrameSignal(11);
}
if (pc->counters.count(type))
pc->counters[type] += count;
else pc->counters[type] = count;
......@@ -3532,13 +3558,22 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
else
mainGame->atk_r = vector3df(0, 0, 3.1415926 - atan((xd - xa) / (yd - ya)));
}
matManager.GenArrow(sy);
if (auto_watch_mode) {
mainGame->ShowCardInfo(mainGame->dField.attacker->code);
int code = mainGame->dField.attacker->code;
if (code > 0) {
mainGame->showcardcode = code;
mainGame->showcarddif = 0;
mainGame->showcardp = 0;
mainGame->showcard = 2;
}
}
matManager.GenArrow(sy);
mainGame->attack_sv = 0;
mainGame->is_attacking = true;
mainGame->WaitFrameSignal(40);
if (auto_watch_mode) {
mainGame->showcard = 0;
}
mainGame->is_attacking = false;
return true;
}
......
......@@ -178,7 +178,8 @@ bool Game::Initialize() {
cbDuelRule->addItem(dataManager.GetSysString(1261));
cbDuelRule->addItem(dataManager.GetSysString(1262));
cbDuelRule->addItem(dataManager.GetSysString(1263));
cbDuelRule->setSelected(DEFAULT_DUEL_RULE - 1);
cbDuelRule->addItem(dataManager.GetSysString(1264));
cbDuelRule->setSelected(gameConf.default_rule - 1);
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));
env->addStaticText(dataManager.GetSysString(1231), rect<s32>(20, 240, 320, 260), false, false, wCreateHost);
......@@ -750,7 +751,11 @@ bool Game::Initialize() {
btnBotCancel = env->addButton(rect<s32>(459, 331, 569, 356), tabBot, BUTTON_CANCEL_SINGLEPLAY, dataManager.GetSysString(1210));
env->addStaticText(dataManager.GetSysString(1382), rect<s32>(360, 10, 550, 30), false, true, tabBot);
stBotInfo = env->addStaticText(L"", rect<s32>(360, 40, 560, 160), false, true, tabBot);
chkBotOldRule = env->addCheckBox(false, rect<s32>(360, 170, 560, 190), tabBot, CHECKBOX_BOT_OLD_RULE, dataManager.GetSysString(1383));
cbBotRule = env->addComboBox(rect<s32>(360, 165, 560, 190), tabBot, COMBOBOX_BOT_RULE);
cbBotRule->addItem(dataManager.GetSysString(1262));
cbBotRule->addItem(dataManager.GetSysString(1263));
cbBotRule->addItem(dataManager.GetSysString(1264));
cbBotRule->setSelected(gameConf.default_rule - 3);
chkBotHand = env->addCheckBox(false, rect<s32>(360, 200, 560, 220), tabBot, -1, dataManager.GetSysString(1384));
chkBotNoCheckDeck = env->addCheckBox(false, rect<s32>(360, 230, 560, 250), tabBot, -1, dataManager.GetSysString(1229));
chkBotNoShuffleDeck = env->addCheckBox(false, rect<s32>(360, 260, 560, 280), tabBot, -1, dataManager.GetSysString(1230));
......@@ -1178,8 +1183,11 @@ void Game::RefreshBot() {
fgets(linebuf, 256, fp);
newinfo.support_master_rule_3 = !!strstr(linebuf, "SUPPORT_MASTER_RULE_3");
newinfo.support_new_master_rule = !!strstr(linebuf, "SUPPORT_NEW_MASTER_RULE");
if((chkBotOldRule->isChecked() && newinfo.support_master_rule_3)
|| (!chkBotOldRule->isChecked() && newinfo.support_new_master_rule))
newinfo.support_master_rule_2020 = !!strstr(linebuf, "SUPPORT_MASTER_RULE_2020");
int rule = cbBotRule->getSelected() + 3;
if((rule == 3 && newinfo.support_master_rule_3)
|| (rule == 4 && newinfo.support_new_master_rule)
|| (rule == 5 && newinfo.support_master_rule_2020))
botInfo.push_back(newinfo);
continue;
}
......@@ -1226,6 +1234,7 @@ void Game::LoadConfig() {
gameConf.chkWaitChain = 0;
gameConf.chkIgnore1 = 0;
gameConf.chkIgnore2 = 0;
gameConf.default_rule = DEFAULT_DUEL_RULE;
gameConf.hide_setname = 0;
gameConf.hide_hint_button = 0;
gameConf.control_mode = 0;
......@@ -1298,6 +1307,10 @@ void Game::LoadConfig() {
gameConf.chkIgnore1 = atoi(valbuf);
} else if(!strcmp(strbuf, "mute_spectators")) {
gameConf.chkIgnore2 = atoi(valbuf);
} else if(!strcmp(strbuf, "default_rule")) {
gameConf.default_rule = atoi(valbuf);
if(gameConf.default_rule <= 0)
gameConf.default_rule = DEFAULT_DUEL_RULE;
} else if(!strcmp(strbuf, "hide_setname")) {
gameConf.hide_setname = atoi(valbuf);
} else if(!strcmp(strbuf, "hide_hint_button")) {
......@@ -1424,6 +1437,10 @@ void Game::LoadConfig() {
gameConf.chkIgnore1 = atoi(valbuf);
} else if(!strcmp(strbuf, "mute_spectators")) {
gameConf.chkIgnore2 = atoi(valbuf);
} else if(!strcmp(strbuf, "default_rule")) {
gameConf.default_rule = atoi(valbuf);
if(gameConf.default_rule <= 0)
gameConf.default_rule = DEFAULT_DUEL_RULE;
} else if(!strcmp(strbuf, "hide_setname")) {
gameConf.hide_setname = atoi(valbuf);
} else if(!strcmp(strbuf, "hide_hint_button")) {
......@@ -1598,6 +1615,7 @@ void Game::SaveConfig() {
fprintf(fp, "waitchain = %d\n", (chkWaitChain->isChecked() ? 1 : 0));
fprintf(fp, "mute_opponent = %d\n", (chkIgnore1->isChecked() ? 1 : 0));
fprintf(fp, "mute_spectators = %d\n", (chkIgnore2->isChecked() ? 1 : 0));
fprintf(fp, "default_rule = %d\n", gameConf.default_rule == DEFAULT_DUEL_RULE ? 0 : gameConf.default_rule);
fprintf(fp, "hide_setname = %d\n", gameConf.hide_setname);
fprintf(fp, "hide_hint_button = %d\n", gameConf.hide_hint_button);
fprintf(fp, "#control_mode = 0: Key A/S/D/R Chain Buttons. control_mode = 1: MouseLeft/MouseRight/NULL/F9 Without Chain Buttons\n");
......
......@@ -37,6 +37,7 @@ struct Config {
int chkWaitChain;
int chkIgnore1;
int chkIgnore2;
int default_rule;
int hide_setname;
int hide_hint_button;
int control_mode;
......@@ -109,6 +110,7 @@ struct BotInfo {
wchar_t desc[256];
bool support_master_rule_3;
bool support_new_master_rule;
bool support_master_rule_2020;
};
struct FadingUnit {
......@@ -398,7 +400,7 @@ public:
irr::gui::IGUIStaticText* stBotInfo;
irr::gui::IGUIButton* btnStartBot;
irr::gui::IGUIButton* btnBotCancel;
irr::gui::IGUICheckBox* chkBotOldRule;
irr::gui::IGUIComboBox* cbBotRule;
irr::gui::IGUICheckBox* chkBotHand;
irr::gui::IGUICheckBox* chkBotNoCheckDeck;
irr::gui::IGUICheckBox* chkBotNoShuffleDeck;
......@@ -673,7 +675,7 @@ extern Game* mainGame;
#define BUTTON_CANCEL_SINGLEPLAY 152
#define LISTBOX_BOT_LIST 153
#define BUTTON_BOT_START 154
#define CHECKBOX_BOT_OLD_RULE 155
#define COMBOBOX_BOT_RULE 155
#define EDITBOX_CHAT 199
#define BUTTON_MSG_OK 200
......
......@@ -606,7 +606,12 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
break;
}
case CHECKBOX_BOT_OLD_RULE: {
}
break;
}
case irr::gui::EGET_COMBO_BOX_CHANGED: {
switch(id) {
case COMBOBOX_BOT_RULE: {
mainGame->RefreshBot();
break;
}
......
Subproject commit eb2739d92a629f477a77c6ec2fc5f71535b315d9
Subproject commit 619209b086897d3995324bb4c4ae9743a470ab88
Subproject commit a15e0304ffa16cb1c7547df2d3c8c08b31c58398
Subproject commit a9ab2c75c09d13898900a0814f761d760853b8fc
......@@ -311,6 +311,7 @@
!system 1261 大师规则2
!system 1262 大师规则3
!system 1263 新大师规则
!system 1264 大师规则2020
!system 1270 卡片信息
!system 1271 消息记录
!system 1272 清除记录
......@@ -417,7 +418,6 @@
!system 1380 人机模式
!system 1381 残局模式
!system 1382 人机信息:
!system 1383 使用旧规则(大师规则3)
!system 1384 电脑锁定出剪刀
!system 1385 列表为空,可能未安装合适的人机
!system 1386 使用正则表达式搜索卡片
......
......@@ -20,6 +20,7 @@ autochain = 0
waitchain = 0
mute_opponent = 0
mute_spectators = 0
default_rule = 0
hide_setname = 0
hide_hint_button = 0
#control_mode = 0: Key A/S/D/R Chain Buttons. control_mode = 1: MouseLeft/MouseRight/NULL/F9 Without Chain Buttons
......
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