Commit 24ce974c authored by mercury233's avatar mercury233

Merge branch 'quick_anim' into test

parents 430f8f1c 5aa34780
......@@ -1424,8 +1424,23 @@ void ClientField::UpdateDeclarableCodeType(bool enter) {
ancard.push_back(trycode);
return;
}
if((pname[0] == 0 || pname[1] == 0) && !enter)
return;
if((pname[0] == 0 || pname[1] == 0) && !enter) {
std::vector<int> cache;
cache.swap(ancard);
int sel = mainGame->lstANCard->getSelected();
int selcode = (sel == -1) ? 0 : cache[sel];
mainGame->lstANCard->clear();
for(const auto& trycode : cache) {
if(dataManager.GetString(trycode, &cstr) && dataManager.GetData(trycode, &cd) && is_declarable(cd, declarable_type)) {
ancard.push_back(trycode);
mainGame->lstANCard->addItem(cstr.name.c_str());
if(trycode == selcode)
mainGame->lstANCard->setSelected(cstr.name.c_str());
}
}
if(!ancard.empty())
return;
}
mainGame->lstANCard->clear();
ancard.clear();
for(auto cit = dataManager._strings.begin(); cit != dataManager._strings.end(); ++cit) {
......@@ -1456,8 +1471,23 @@ void ClientField::UpdateDeclarableCodeOpcode(bool enter) {
ancard.push_back(trycode);
return;
}
if((pname[0] == 0 || pname[1] == 0) && !enter)
return;
if((pname[0] == 0 || pname[1] == 0) && !enter) {
std::vector<int> cache;
cache.swap(ancard);
int sel = mainGame->lstANCard->getSelected();
int selcode = (sel == -1) ? 0 : cache[sel];
mainGame->lstANCard->clear();
for(const auto& trycode : cache) {
if(dataManager.GetString(trycode, &cstr) && dataManager.GetData(trycode, &cd) && is_declarable(cd, opcode)) {
ancard.push_back(trycode);
mainGame->lstANCard->addItem(cstr.name.c_str());
if(trycode == selcode)
mainGame->lstANCard->setSelected(cstr.name.c_str());
}
}
if(!ancard.empty())
return;
}
mainGame->lstANCard->clear();
ancard.clear();
for(auto cit = dataManager._strings.begin(); cit != dataManager._strings.end(); ++cit) {
......
......@@ -1033,7 +1033,7 @@ void Game::PopupElement(irr::gui::IGUIElement * element, int hideframe) {
}
void Game::WaitFrameSignal(int frame) {
frameSignal.Reset();
signalFrame = frame;
signalFrame = (gameConf.quick_animation && frame >= 12) ? 12 : frame;
frameSignal.Wait();
}
void Game::DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, int>* lflist, bool drag) {
......
......@@ -3382,7 +3382,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->gMutex.Lock();
mainGame->ebANCard->setText(L"");
mainGame->wANCard->setText(textBuffer);
mainGame->dField.UpdateDeclarableCode(true);
mainGame->dField.UpdateDeclarableCode(false);
mainGame->PopupElement(mainGame->wANCard);
mainGame->gMutex.Unlock();
return false;
......@@ -3421,7 +3421,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->gMutex.Lock();
mainGame->ebANCard->setText(L"");
mainGame->wANCard->setText(textBuffer);
mainGame->dField.UpdateDeclarableCode(true);
mainGame->dField.UpdateDeclarableCode(false);
mainGame->PopupElement(mainGame->wANCard);
mainGame->gMutex.Unlock();
return false;
......
......@@ -1836,6 +1836,9 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true;
break;
}
case CHECKBOX_QUICK_ANIMATION: {
mainGame->gameConf.quick_animation = mainGame->chkQuickAnimation->isChecked() ? 1 : 0;
}
}
break;
}
......
......@@ -287,6 +287,9 @@ bool Game::Initialize() {
posY += 30;
chkWaitChain = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabHelper, -1, dataManager.GetSysString(1277));
chkWaitChain->setChecked(gameConf.chkWaitChain != 0);
posY += 30;
chkQuickAnimation = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabHelper, CHECKBOX_QUICK_ANIMATION, dataManager.GetSysString(1299));
chkQuickAnimation->setChecked(gameConf.quick_animation != 0);
//system
irr::gui::IGUITab* tabSystem = wInfos->addTab(dataManager.GetSysString(1273));
posY = 20;
......@@ -1089,6 +1092,7 @@ void Game::LoadConfig() {
gameConf.chkIgnoreDeckChanges = 0;
gameConf.defaultOT = 1;
gameConf.enable_bot_mode = 0;
gameConf.quick_animation = 0;
gameConf.enable_sound = true;
gameConf.sound_volume = 0.5;
gameConf.enable_music = true;
......@@ -1168,6 +1172,8 @@ void Game::LoadConfig() {
gameConf.window_height = atoi(valbuf);
} else if(!strcmp(strbuf, "resize_popup_menu")) {
gameConf.resize_popup_menu = atoi(valbuf) > 0;
} else if(!strcmp(strbuf, "quick_animation")) {
gameConf.quick_animation = atoi(valbuf);
#ifdef YGOPRO_USE_IRRKLANG
} else if(!strcmp(strbuf, "enable_sound")) {
gameConf.enable_sound = atoi(valbuf) > 0;
......@@ -1244,6 +1250,7 @@ void Game::SaveConfig() {
fprintf(fp, "window_width = %d\n", gameConf.window_width);
fprintf(fp, "window_height = %d\n", gameConf.window_height);
fprintf(fp, "resize_popup_menu = %d\n", gameConf.resize_popup_menu ? 1 : 0);
fprintf(fp, "quick_animation = %d\n", gameConf.quick_animation);
#ifdef YGOPRO_USE_IRRKLANG
fprintf(fp, "enable_sound = %d\n", (chkEnableSound->isChecked() ? 1 : 0));
fprintf(fp, "enable_music = %d\n", (chkEnableMusic->isChecked() ? 1 : 0));
......
......@@ -42,6 +42,7 @@ struct Config {
int chkIgnoreDeckChanges;
int defaultOT;
int enable_bot_mode;
int quick_animation;
bool enable_sound;
bool enable_music;
double sound_volume;
......@@ -264,6 +265,7 @@ public:
irr::gui::IGUICheckBox* chkRandomPos;
irr::gui::IGUICheckBox* chkAutoChain;
irr::gui::IGUICheckBox* chkWaitChain;
irr::gui::IGUICheckBox* chkQuickAnimation;
irr::gui::IGUICheckBox* chkHideSetname;
irr::gui::IGUICheckBox* chkHideHintButton;
irr::gui::IGUICheckBox* chkIgnoreDeckChanges;
......@@ -667,6 +669,7 @@ extern Game* mainGame;
#define BUTTON_WINDOW_RESIZE_M 366
#define BUTTON_WINDOW_RESIZE_L 367
#define BUTTON_WINDOW_RESIZE_XL 368
#define CHECKBOX_QUICK_ANIMATION 369
#define COMBOBOX_SORTTYPE 370
#define COMBOBOX_LIMIT 371
......
......@@ -325,6 +325,7 @@
!system 1296 完成选择
!system 1297 切洗手卡
!system 1298 辅助功能
!system 1298 加快动画效果
!system 1300 禁限卡表:
!system 1301 卡组列表:
!system 1302 保存
......
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