Commit e21e3f8f authored by mercury233's avatar mercury233

Merge branch 'master' of https://github.com/Fluorohydride/ygopro

parents e3fd7656 3e2be30d
...@@ -518,12 +518,29 @@ void Game::DrawMisc() { ...@@ -518,12 +518,29 @@ void Game::DrawMisc() {
driver->draw2DImage(imageManager.tLPFrame, Resize(330, 10, 629, 30), recti(0, 0, 200, 20), 0, 0, true); driver->draw2DImage(imageManager.tLPFrame, Resize(330, 10, 629, 30), recti(0, 0, 200, 20), 0, 0, true);
driver->draw2DImage(imageManager.tLPFrame, Resize(691, 10, 990, 30), recti(0, 0, 200, 20), 0, 0, true); driver->draw2DImage(imageManager.tLPFrame, Resize(691, 10, 990, 30), recti(0, 0, 200, 20), 0, 0, true);
if(dInfo.start_lp) { if(dInfo.start_lp) {
if(dInfo.lp[0] >= dInfo.start_lp) auto maxLP = dInfo.isTag ? dInfo.start_lp / 2 : dInfo.start_lp;
driver->draw2DImage(imageManager.tLPBar, Resize(335, 12, 625, 28), recti(0, 0, 16, 16), 0, 0, true); if(dInfo.lp[0] >= maxLP) {
else driver->draw2DImage(imageManager.tLPBar, Resize(335, 12, 335 + 290 * dInfo.lp[0] / dInfo.start_lp, 28), recti(0, 0, 16, 16), 0, 0, true); auto layerCount = dInfo.lp[0] / maxLP;
if(dInfo.lp[1] >= dInfo.start_lp) auto partialLP = dInfo.lp[0] % maxLP;
driver->draw2DImage(imageManager.tLPBar, Resize(696, 12, 986, 28), recti(0, 0, 16, 16), 0, 0, true); auto bgColorPos = (layerCount - 1) % 5;
else driver->draw2DImage(imageManager.tLPBar, Resize(986 - 290 * dInfo.lp[1] / dInfo.start_lp, 12, 986, 28), recti(0, 0, 16, 16), 0, 0, true); auto fgColorPos = layerCount % 5;
driver->draw2DImage(imageManager.tLPBar, Resize(335 + 290 * partialLP / maxLP, 12, 625, 28), recti(0, bgColorPos * 16, 16, (bgColorPos + 1) * 16), 0, 0, true);
if(partialLP > 0) {
driver->draw2DImage(imageManager.tLPBar, Resize(335, 12, 335 + 290 * partialLP / maxLP, 28), recti(0, fgColorPos * 16, 16, (fgColorPos + 1) * 16), 0, 0, true);
}
}
else driver->draw2DImage(imageManager.tLPBar, Resize(335, 12, 335 + 290 * dInfo.lp[0] / maxLP, 28), recti(0, 0, 16, 16), 0, 0, true);
if(dInfo.lp[1] >= maxLP) {
auto layerCount = dInfo.lp[1] / maxLP;
auto partialLP = dInfo.lp[1] % maxLP;
auto bgColorPos = (layerCount - 1) % 5;
auto fgColorPos = layerCount % 5;
driver->draw2DImage(imageManager.tLPBar, Resize(696, 12, 986 - 290 * partialLP / maxLP, 28), recti(0, bgColorPos * 16, 16, (bgColorPos + 1) * 16), 0, 0, true);
if(partialLP > 0) {
driver->draw2DImage(imageManager.tLPBar, Resize(986 - 290 * partialLP / maxLP, 12, 986, 28), recti(0, fgColorPos * 16, 16, (fgColorPos + 1) * 16), 0, 0, true);
}
}
else driver->draw2DImage(imageManager.tLPBar, Resize(986 - 290 * dInfo.lp[1] / maxLP, 12, 986, 28), recti(0, 0, 16, 16), 0, 0, true);
} }
if(lpframe) { if(lpframe) {
dInfo.lp[lpplayer] -= lpd; dInfo.lp[lpplayer] -= lpd;
......
...@@ -2164,7 +2164,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2164,7 +2164,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
mainGame->WaitFrameSignal(5); mainGame->WaitFrameSignal(5);
} }
if (panel_confirm.size()) { if (panel_confirm.size() && mainGame->dInfo.player_type != 7) {
std::sort(panel_confirm.begin(), panel_confirm.end(), ClientCard::client_card_sort); std::sort(panel_confirm.begin(), panel_confirm.end(), ClientCard::client_card_sort);
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->dField.selectable_cards = panel_confirm; mainGame->dField.selectable_cards = panel_confirm;
......
...@@ -93,6 +93,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -93,6 +93,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
sockaddr_in * sin = ((struct sockaddr_in *)answer->ai_addr); sockaddr_in * sin = ((struct sockaddr_in *)answer->ai_addr);
evutil_inet_ntop(AF_INET, &(sin->sin_addr), ip, 20); evutil_inet_ntop(AF_INET, &(sin->sin_addr), ip, 20);
remote_addr = htonl(inet_addr(ip)); remote_addr = htonl(inet_addr(ip));
evutil_freeaddrinfo(answer);
} }
} }
unsigned int remote_port = _wtoi(mainGame->ebJoinPort->getText()); unsigned int remote_port = _wtoi(mainGame->ebJoinPort->getText());
...@@ -126,10 +127,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -126,10 +127,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
case BUTTON_HOST_CONFIRM: { case BUTTON_HOST_CONFIRM: {
bot_mode = false; bot_mode = false;
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)) {
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1402));
break; break;
}
if(!DuelClient::StartClient(0x7f000001, mainGame->gameConf.serverport)) { if(!DuelClient::StartClient(0x7f000001, mainGame->gameConf.serverport)) {
NetServer::StopServer(); NetServer::StopServer();
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1402));
break; break;
} }
mainGame->btnHostConfirm->setEnabled(false); mainGame->btnHostConfirm->setEnabled(false);
...@@ -169,6 +175,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -169,6 +175,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
case BUTTON_HP_READY: { case BUTTON_HP_READY: {
if(mainGame->cbCategorySelect->getSelected() == -1 || mainGame->cbDeckSelect->getSelected() == -1 || if(mainGame->cbCategorySelect->getSelected() == -1 || mainGame->cbDeckSelect->getSelected() == -1 ||
!deckManager.LoadDeck(mainGame->cbCategorySelect, mainGame->cbDeckSelect)) { !deckManager.LoadDeck(mainGame->cbCategorySelect, mainGame->cbDeckSelect)) {
mainGame->gMutex.lock();
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1406));
mainGame->gMutex.unlock();
break; break;
} }
UpdateDeck(); UpdateDeck();
...@@ -323,10 +333,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -323,10 +333,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
bot_mode = true; bot_mode = true;
#ifdef _WIN32 #ifdef _WIN32
if(!NetServer::StartServer(mainGame->gameConf.serverport)) if(!NetServer::StartServer(mainGame->gameConf.serverport)) {
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1402));
break; break;
}
if(!DuelClient::StartClient(0x7f000001, mainGame->gameConf.serverport)) { if(!DuelClient::StartClient(0x7f000001, mainGame->gameConf.serverport)) {
NetServer::StopServer(); NetServer::StopServer();
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1402));
break; break;
} }
STARTUPINFOW si; STARTUPINFOW si;
...@@ -373,10 +388,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -373,10 +388,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
execl("./bot", "bot", arg1, arg2, arg3, NULL); execl("./bot", "bot", arg1, arg2, arg3, NULL);
exit(0); exit(0);
} else { } else {
if(!NetServer::StartServer(mainGame->gameConf.serverport)) if(!NetServer::StartServer(mainGame->gameConf.serverport)) {
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1402));
break; break;
}
if(!DuelClient::StartClient(0x7f000001, mainGame->gameConf.serverport)) { if(!DuelClient::StartClient(0x7f000001, mainGame->gameConf.serverport)) {
NetServer::StopServer(); NetServer::StopServer();
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1402));
break; break;
} }
} }
...@@ -607,7 +627,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -607,7 +627,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
if(static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) { if(static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) {
if(mainGame->cbCategorySelect->getSelected() == -1 || mainGame->cbDeckSelect->getSelected() == -1 || if(mainGame->cbCategorySelect->getSelected() == -1 || mainGame->cbDeckSelect->getSelected() == -1 ||
!deckManager.LoadDeck(mainGame->cbCategorySelect, mainGame->cbDeckSelect)) { !deckManager.LoadDeck(mainGame->cbCategorySelect, mainGame->cbDeckSelect)) {
mainGame->gMutex.lock();
static_cast<irr::gui::IGUICheckBox*>(caller)->setChecked(false); static_cast<irr::gui::IGUICheckBox*>(caller)->setChecked(false);
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1406));
mainGame->gMutex.unlock();
break; break;
} }
UpdateDeck(); UpdateDeck();
......
This diff is collapsed.
textures/lp.png

967 Bytes | W: | H:

textures/lp.png

2.05 KB | W: | H:

textures/lp.png
textures/lp.png
textures/lp.png
textures/lp.png
  • 2-up
  • Swipe
  • Onion skin
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