Commit 566a7a45 authored by nanahira's avatar nanahira

Merge branch 'master' into server

parents 77628dfc 7ff72281
...@@ -1098,7 +1098,7 @@ void Game::PopupElement(irr::gui::IGUIElement * element, int hideframe) { ...@@ -1098,7 +1098,7 @@ void Game::PopupElement(irr::gui::IGUIElement * element, int hideframe) {
} }
void Game::WaitFrameSignal(int frame) { void Game::WaitFrameSignal(int frame) {
frameSignal.Reset(); frameSignal.Reset();
signalFrame = frame; signalFrame = (gameConf.quick_animation && frame >= 12) ? 12 : frame;
frameSignal.Wait(); frameSignal.Wait();
} }
void Game::DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, int>* lflist, bool drag) { void Game::DrawThumb(code_pointer cp, position2di pos, std::unordered_map<int, int>* lflist, bool drag) {
......
...@@ -1472,6 +1472,12 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1472,6 +1472,12 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(mcard->position & POS_FACEDOWN) if(mcard->position & POS_FACEDOWN)
mcard = 0; mcard = 0;
} }
} else if(hovered_location == LOCATION_EXTRA) {
if(extra[hovered_controler].size()) {
mcard = extra[hovered_controler].back();
if(mcard->position & POS_FACEDOWN)
mcard = 0;
}
} else if(hovered_location == LOCATION_DECK) { } else if(hovered_location == LOCATION_DECK) {
if(deck[hovered_controler].size()) if(deck[hovered_controler].size())
mcard = deck[hovered_controler].back(); mcard = deck[hovered_controler].back();
...@@ -1853,6 +1859,9 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1853,6 +1859,9 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true; return true;
break; break;
} }
case CHECKBOX_QUICK_ANIMATION: {
mainGame->gameConf.quick_animation = mainGame->chkQuickAnimation->isChecked() ? 1 : 0;
}
} }
break; break;
} }
......
...@@ -361,6 +361,9 @@ bool Game::Initialize() { ...@@ -361,6 +361,9 @@ bool Game::Initialize() {
posY += 30; posY += 30;
chkWaitChain = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabHelper, -1, dataManager.GetSysString(1277)); chkWaitChain = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabHelper, -1, dataManager.GetSysString(1277));
chkWaitChain->setChecked(gameConf.chkWaitChain != 0); 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 //system
irr::gui::IGUITab* tabSystem = wInfos->addTab(dataManager.GetSysString(1273)); irr::gui::IGUITab* tabSystem = wInfos->addTab(dataManager.GetSysString(1273));
posY = 20; posY = 20;
...@@ -1244,6 +1247,7 @@ void Game::LoadConfig() { ...@@ -1244,6 +1247,7 @@ void Game::LoadConfig() {
gameConf.chkIgnoreDeckChanges = 0; gameConf.chkIgnoreDeckChanges = 0;
gameConf.defaultOT = 1; gameConf.defaultOT = 1;
gameConf.enable_bot_mode = 1; gameConf.enable_bot_mode = 1;
gameConf.quick_animation = 0;
gameConf.enable_sound = true; gameConf.enable_sound = true;
gameConf.sound_volume = 0.5; gameConf.sound_volume = 0.5;
gameConf.enable_music = true; gameConf.enable_music = true;
...@@ -1328,6 +1332,8 @@ void Game::LoadConfig() { ...@@ -1328,6 +1332,8 @@ void Game::LoadConfig() {
gameConf.window_height = atoi(valbuf); gameConf.window_height = atoi(valbuf);
} else if(!strcmp(strbuf, "resize_popup_menu")) { } else if(!strcmp(strbuf, "resize_popup_menu")) {
gameConf.resize_popup_menu = atoi(valbuf) > 0; gameConf.resize_popup_menu = atoi(valbuf) > 0;
} else if(!strcmp(strbuf, "quick_animation")) {
gameConf.quick_animation = atoi(valbuf);
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_IRRKLANG
} else if(!strcmp(strbuf, "enable_sound")) { } else if(!strcmp(strbuf, "enable_sound")) {
gameConf.enable_sound = atoi(valbuf) > 0; gameConf.enable_sound = atoi(valbuf) > 0;
...@@ -1438,6 +1444,8 @@ void Game::LoadConfig() { ...@@ -1438,6 +1444,8 @@ void Game::LoadConfig() {
gameConf.window_height = atoi(valbuf); gameConf.window_height = atoi(valbuf);
} else if(!strcmp(strbuf, "resize_popup_menu")) { } else if(!strcmp(strbuf, "resize_popup_menu")) {
gameConf.resize_popup_menu = atoi(valbuf) > 0; gameConf.resize_popup_menu = atoi(valbuf) > 0;
} else if(!strcmp(strbuf, "quick_animation")) {
gameConf.quick_animation = atoi(valbuf);
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_IRRKLANG
} else if(!strcmp(strbuf, "enable_sound")) { } else if(!strcmp(strbuf, "enable_sound")) {
gameConf.enable_sound = atoi(valbuf) > 0; gameConf.enable_sound = atoi(valbuf) > 0;
...@@ -1530,6 +1538,7 @@ void Game::SaveConfig() { ...@@ -1530,6 +1538,7 @@ void Game::SaveConfig() {
fprintf(fp, "window_width = %d\n", gameConf.window_width); fprintf(fp, "window_width = %d\n", gameConf.window_width);
fprintf(fp, "window_height = %d\n", gameConf.window_height); fprintf(fp, "window_height = %d\n", gameConf.window_height);
fprintf(fp, "resize_popup_menu = %d\n", gameConf.resize_popup_menu ? 1 : 0); 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 #ifdef YGOPRO_USE_IRRKLANG
fprintf(fp, "enable_sound = %d\n", (chkEnableSound->isChecked() ? 1 : 0)); fprintf(fp, "enable_sound = %d\n", (chkEnableSound->isChecked() ? 1 : 0));
fprintf(fp, "enable_music = %d\n", (chkEnableMusic->isChecked() ? 1 : 0)); fprintf(fp, "enable_music = %d\n", (chkEnableMusic->isChecked() ? 1 : 0));
......
...@@ -49,6 +49,7 @@ struct Config { ...@@ -49,6 +49,7 @@ struct Config {
int chkIgnoreDeckChanges; int chkIgnoreDeckChanges;
int defaultOT; int defaultOT;
int enable_bot_mode; int enable_bot_mode;
int quick_animation;
bool window_maximized; bool window_maximized;
int window_width; int window_width;
int window_height; int window_height;
...@@ -298,6 +299,7 @@ public: ...@@ -298,6 +299,7 @@ public:
irr::gui::IGUICheckBox* chkRandomPos; irr::gui::IGUICheckBox* chkRandomPos;
irr::gui::IGUICheckBox* chkAutoChain; irr::gui::IGUICheckBox* chkAutoChain;
irr::gui::IGUICheckBox* chkWaitChain; irr::gui::IGUICheckBox* chkWaitChain;
irr::gui::IGUICheckBox* chkQuickAnimation;
irr::gui::IGUICheckBox* chkHideSetname; irr::gui::IGUICheckBox* chkHideSetname;
irr::gui::IGUICheckBox* chkHideHintButton; irr::gui::IGUICheckBox* chkHideHintButton;
irr::gui::IGUICheckBox* chkIgnoreDeckChanges; irr::gui::IGUICheckBox* chkIgnoreDeckChanges;
...@@ -717,10 +719,11 @@ extern HostInfo game_info; ...@@ -717,10 +719,11 @@ extern HostInfo game_info;
#define BUTTON_WINDOW_RESIZE_M 366 #define BUTTON_WINDOW_RESIZE_M 366
#define BUTTON_WINDOW_RESIZE_L 367 #define BUTTON_WINDOW_RESIZE_L 367
#define BUTTON_WINDOW_RESIZE_XL 368 #define BUTTON_WINDOW_RESIZE_XL 368
#define COMBOBOX_LOCALE 369 #define CHECKBOX_QUICK_ANIMATION 369
#define COMBOBOX_SORTTYPE 370 #define COMBOBOX_SORTTYPE 370
#define COMBOBOX_LIMIT 371 #define COMBOBOX_LIMIT 371
#define COMBOBOX_LOCALE 372
#define BUTTON_MARKS_FILTER 380 #define BUTTON_MARKS_FILTER 380
#define BUTTON_MARKERS_OK 381 #define BUTTON_MARKERS_OK 381
......
...@@ -13,21 +13,8 @@ bool open_file = false; ...@@ -13,21 +13,8 @@ bool open_file = false;
wchar_t open_file_name[256] = L""; wchar_t open_file_name[256] = L"";
bool bot_mode = false; bool bot_mode = false;
void GetParameter(char* param, const char* arg) {
#ifdef _WIN32
wchar_t arg1[260];
MultiByteToWideChar(CP_ACP, 0, arg, -1, arg1, 260);
BufferIO::EncodeUTF8(arg1, param);
#else
strcpy(param, arg);
#endif
}
void GetParameterW(wchar_t* param, const char* arg) { void GetParameterW(wchar_t* param, const char* arg) {
#ifdef _WIN32
MultiByteToWideChar(CP_ACP, 0, arg, -1, param, 260);
#else
BufferIO::DecodeUTF8(arg, param); BufferIO::DecodeUTF8(arg, param);
#endif
} }
void ClickButton(irr::gui::IGUIElement* btn) { void ClickButton(irr::gui::IGUIElement* btn) {
irr::SEvent event; irr::SEvent event;
...@@ -127,19 +114,74 @@ int main(int argc, char* argv[]) { ...@@ -127,19 +114,74 @@ int main(int argc, char* argv[]) {
if(!ygo::mainGame->Initialize()) if(!ygo::mainGame->Initialize())
return 0; return 0;
#ifdef _WIN32
wchar_t* command = GetCommandLineW();
char buffer[2048];
BufferIO::EncodeUTF8(command, buffer);
char* ptr = buffer;
argc = 0;
int j = 0;
bool in_QM = false, in_TEXT = false, in_SPACE = true;
while(*ptr) {
if(in_QM) {
if(*ptr == '\"')
in_QM = false;
else
++j;
} else {
switch(*ptr) {
case '\"': {
in_QM = true;
in_TEXT = true;
if(in_SPACE) {
argv[argc] = ptr + 1;
j = 0;
}
in_SPACE = FALSE;
break;
}
case ' ':
case '\t':
case '\n':
case '\r': {
if(in_TEXT) {
argv[argc][j] = '\0';
++argc;
}
in_TEXT = FALSE;
in_SPACE = TRUE;
break;
}
default: {
in_TEXT = TRUE;
if(in_SPACE) {
argv[argc] = ptr;
j = 1;
} else
++j;
in_SPACE = FALSE;
break;
}
}
}
++ptr;
}
if(in_TEXT) {
argv[argc][j] = '\0';
++argc;
}
argv[argc] = NULL;
#endif // _WIN32
bool keep_on_return = false; bool keep_on_return = false;
for(int i = 1; i < argc; ++i) { for(int i = 1; i < argc; ++i) {
if(argv[i][0] == '-' && argv[i][1] == 'e') { if(argv[i][0] == '-' && argv[i][1] == 'e') {
char param[128]; ygo::dataManager.LoadDB(&argv[i][2]);
GetParameter(param, &argv[i][2]);
ygo::dataManager.LoadDB(param);
continue; continue;
} }
if(!strcmp(argv[i], "-e")) { // extra database if(!strcmp(argv[i], "-e")) { // extra database
++i; ++i;
char param[128]; ygo::dataManager.LoadDB(&argv[i][0]);
GetParameter(param, &argv[i][0]);
ygo::dataManager.LoadDB(param);
continue; continue;
} else if(!strcmp(argv[i], "-n")) { // nickName } else if(!strcmp(argv[i], "-n")) { // nickName
++i; ++i;
......
Subproject commit e4cd79bf91cc524451fbaae30009b3740966b1bb Subproject commit 9cc9bb5c2fbea7423952ee0e49befbe6ddadb0a7
Subproject commit 6d6029bc92b22fcfd151233cc4435503291511cb Subproject commit 44a8b72a59752a4d16ac2a658b4e9169b3c6b1eb
...@@ -328,6 +328,7 @@ ...@@ -328,6 +328,7 @@
!system 1296 完成选择 !system 1296 完成选择
!system 1297 切洗手卡 !system 1297 切洗手卡
!system 1298 辅助功能 !system 1298 辅助功能
!system 1299 加快动画效果
!system 1300 禁限卡表: !system 1300 禁限卡表:
!system 1301 卡组列表: !system 1301 卡组列表:
!system 1302 保存 !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