Commit a7e421df authored by DailyShana's avatar DailyShana

mouse control

parent 506c0076
...@@ -892,6 +892,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -892,6 +892,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
irr::core::position2di pos(x, y); irr::core::position2di pos(x, y);
if(x < 300) if(x < 300)
break; break;
if(mainGame->gameConf.control_mode == 1)
mainGame->always_chain = event.MouseInput.isLeftPressed();
if(mainGame->wCmdMenu->isVisible() && !mainGame->wCmdMenu->getRelativePosition().isPointInside(pos)) if(mainGame->wCmdMenu->isVisible() && !mainGame->wCmdMenu->getRelativePosition().isPointInside(pos))
mainGame->wCmdMenu->setVisible(false); mainGame->wCmdMenu->setVisible(false);
if(panel && panel->isVisible()) if(panel && panel->isVisible())
...@@ -1239,6 +1241,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1239,6 +1241,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case irr::EMIE_RMOUSE_LEFT_UP: { case irr::EMIE_RMOUSE_LEFT_UP: {
if(mainGame->dInfo.isReplay) if(mainGame->dInfo.isReplay)
break; break;
if(mainGame->gameConf.control_mode == 1 && event.MouseInput.X > 300)
mainGame->ignore_chain = event.MouseInput.isRightPressed();
mainGame->wCmdMenu->setVisible(false); mainGame->wCmdMenu->setVisible(false);
if(mainGame->fadingList.size()) if(mainGame->fadingList.size())
break; break;
...@@ -1531,6 +1535,20 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1531,6 +1535,20 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case irr::EMIE_MOUSE_WHEEL: { case irr::EMIE_MOUSE_WHEEL: {
break; break;
} }
case irr::EMIE_LMOUSE_PRESSED_DOWN: {
if(!mainGame->dInfo.isStarted)
break;
if(mainGame->gameConf.control_mode == 1 && event.MouseInput.X > 300)
mainGame->always_chain = event.MouseInput.isLeftPressed();
break;
}
case irr::EMIE_RMOUSE_PRESSED_DOWN: {
if(!mainGame->dInfo.isStarted)
break;
if(mainGame->gameConf.control_mode == 1 && event.MouseInput.X > 300)
mainGame->ignore_chain = event.MouseInput.isRightPressed();
break;
}
default: default:
break; break;
} }
...@@ -1539,15 +1557,18 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1539,15 +1557,18 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case irr::EET_KEY_INPUT_EVENT: { case irr::EET_KEY_INPUT_EVENT: {
switch(event.KeyInput.Key) { switch(event.KeyInput.Key) {
case irr::KEY_KEY_A: { case irr::KEY_KEY_A: {
if(mainGame->gameConf.control_mode == 0)
mainGame->always_chain = event.KeyInput.PressedDown; mainGame->always_chain = event.KeyInput.PressedDown;
break; break;
} }
case irr::KEY_KEY_S: { case irr::KEY_KEY_S: {
if(mainGame->gameConf.control_mode == 0)
mainGame->ignore_chain = event.KeyInput.PressedDown; mainGame->ignore_chain = event.KeyInput.PressedDown;
break; break;
} }
case irr::KEY_KEY_R: { case irr::KEY_KEY_R: {
if(!event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX)) if(mainGame->gameConf.control_mode == 0
&& !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX))
mainGame->textFont->setTransparency(true); mainGame->textFont->setTransparency(true);
break; break;
} }
...@@ -1621,6 +1642,12 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1621,6 +1642,12 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
break; break;
} }
case irr::KEY_F9: {
if(mainGame->gameConf.control_mode == 1
&& !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX))
mainGame->textFont->setTransparency(true);
break;
}
case irr::KEY_ESCAPE: { case irr::KEY_ESCAPE: {
if(!mainGame->HasFocus(EGUIET_EDIT_BOX)) if(!mainGame->HasFocus(EGUIET_EDIT_BOX))
mainGame->device->minimizeWindow(); mainGame->device->minimizeWindow();
......
...@@ -814,6 +814,7 @@ void Game::LoadConfig() { ...@@ -814,6 +814,7 @@ void Game::LoadConfig() {
gameConf.chkIgnore1 = 0; gameConf.chkIgnore1 = 0;
gameConf.chkIgnore2 = 0; gameConf.chkIgnore2 = 0;
gameConf.chkHideSetname = 0; gameConf.chkHideSetname = 0;
gameConf.control_mode = 0;
fseek(fp, 0, SEEK_END); fseek(fp, 0, SEEK_END);
int fsize = ftell(fp); int fsize = ftell(fp);
fseek(fp, 0, SEEK_SET); fseek(fp, 0, SEEK_SET);
...@@ -860,6 +861,8 @@ void Game::LoadConfig() { ...@@ -860,6 +861,8 @@ void Game::LoadConfig() {
gameConf.chkIgnore2 = atoi(valbuf); gameConf.chkIgnore2 = atoi(valbuf);
} else if(!strcmp(strbuf, "hide_setname")) { } else if(!strcmp(strbuf, "hide_setname")) {
gameConf.chkHideSetname = atoi(valbuf); gameConf.chkHideSetname = atoi(valbuf);
} else if(!strcmp(strbuf, "control_mode")) {
gameConf.control_mode = atoi(valbuf);
} else { } else {
// options allowing multiple words // options allowing multiple words
sscanf(linebuf, "%s = %240[^\n]", strbuf, valbuf); sscanf(linebuf, "%s = %240[^\n]", strbuf, valbuf);
...@@ -910,6 +913,8 @@ void Game::SaveConfig() { ...@@ -910,6 +913,8 @@ void Game::SaveConfig() {
fprintf(fp, "ignore1 = %d\n", ((mainGame->chkIgnore1->isChecked()) ? 1 : 0)); fprintf(fp, "ignore1 = %d\n", ((mainGame->chkIgnore1->isChecked()) ? 1 : 0));
fprintf(fp, "ignore2 = %d\n", ((mainGame->chkIgnore2->isChecked()) ? 1 : 0)); fprintf(fp, "ignore2 = %d\n", ((mainGame->chkIgnore2->isChecked()) ? 1 : 0));
fprintf(fp, "hide_setname = %d\n", ((mainGame->chkHideSetname->isChecked()) ? 1 : 0)); fprintf(fp, "hide_setname = %d\n", ((mainGame->chkHideSetname->isChecked()) ? 1 : 0));
fprintf(fp, "#control_mode = 0: Key A/S/R. control_mode = 1: MouseLeft/MouseRight/F9\n");
fprintf(fp, "control_mode = %d\n", gameConf.control_mode);
fclose(fp); fclose(fp);
} }
void Game::ShowCardInfo(int code) { void Game::ShowCardInfo(int code) {
......
...@@ -32,6 +32,7 @@ struct Config { ...@@ -32,6 +32,7 @@ struct Config {
int chkIgnore1; int chkIgnore1;
int chkIgnore2; int chkIgnore2;
int chkHideSetname; int chkHideSetname;
int control_mode;
}; };
struct DuelInfo { struct DuelInfo {
......
...@@ -18,3 +18,5 @@ waitchain = 0 ...@@ -18,3 +18,5 @@ waitchain = 0
ignore1 = 0 ignore1 = 0
ignore2 = 0 ignore2 = 0
hide_setname = 0 hide_setname = 0
#control_mode = 0: Key A/S/R. control_mode = 1: MouseLeft/MouseRight/F9
control_mode = 0
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