Commit 3d34ed80 authored by nanahira's avatar nanahira

Merge branch 'master' into another

parents 0e6124c7 4aec391b
......@@ -16,13 +16,14 @@ addons:
- libgl1-mesa-dev
- libglu-dev
- p7zip-full
- liblua5.3-dev
env:
- USE_IRRKLANG=1
before_install:
- git submodule update --init --recursive
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update;
brew install freetype libevent sqlite dylibbundler p7zip;
brew install freetype libevent sqlite dylibbundler p7zip lua;
sudo cp -r /usr/local/include/freetype2 ./freetype2;
sudo cp -r /usr/local/include/event2 ./event2;
sudo cp -r /usr/local/include/lua ./lua;
......
......@@ -32,7 +32,7 @@ install:
- tar xf lua-5.3.5.tar.gz
- move lua-5.3.5\src lua
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.sqlite.org/2018/sqlite-amalgamation-3310100.zip ; exit 0"
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.sqlite.org/2020/sqlite-amalgamation-3310100.zip ; exit 0"
- 7z x -y sqlite-amalgamation-3310100.zip
- move sqlite-amalgamation-3310100 sqlite3
......@@ -103,6 +103,7 @@ artifacts:
cache:
- premake-5.0.0-alpha14-windows.zip
- libevent-2.0.22-stable.tar.gz
- freetype-2.9.1.tar.bz2
- freetype-2.10.1.tar.gz
- lua-5.3.5.tar.gz
- irrlicht-1.8.4.zip
- sqlite-amalgamation-3310100.zip
No preview for this file type
......@@ -856,6 +856,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
}
case irr::gui::EGET_EDITBOX_ENTER: {
switch(id) {
case EDITBOX_INPUTS:
case EDITBOX_KEYWORD: {
StartFilter();
break;
......@@ -1012,6 +1013,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break;
}
}
mainGame->env->setFocus(0);
InstantSearch();
break;
}
......@@ -1029,13 +1031,16 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->ebDefense->setEnabled(true);
}
}
mainGame->env->setFocus(0);
InstantSearch();
break;
}
case COMBOBOX_ATTRIBUTE:
case COMBOBOX_RACE:
case COMBOBOX_LIMIT:
mainGame->env->setFocus(0);
InstantSearch();
break;
}
}
case irr::gui::EGET_LISTBOX_CHANGED: {
......@@ -1653,6 +1658,7 @@ bool DeckBuilder::CardNameContains(const wchar_t *haystack, const wchar_t *needl
return true;
}
} else {
i -= j;
j = 0;
}
i++;
......
......@@ -415,7 +415,8 @@ void Game::DrawCard(ClientCard* pcard) {
matManager.mTexture.setTexture(0, imageManager.tAttack);
driver->setMaterial(matManager.mTexture);
irr::core::matrix4 atk;
atk.setTranslation(pcard->curPos + vector3df(0, -atkdy / 4.0f - 0.35f, 0.05f));
atk.setTranslation(pcard->curPos + vector3df(0, (pcard->controler == 0 ? -1 : 1) * (atkdy / 4.0f + 0.35f), 0.05f));
atk.setRotationRadians(vector3df(0, 0, pcard->controler == 0 ? 0 : 3.1415926f));
driver->setTransform(irr::video::ETS_WORLD, atk);
driver->drawVertexPrimitiveList(matManager.vSymbol, 4, matManager.iRectangle, 2);
}
......
......@@ -77,9 +77,6 @@ bool DuelClient::StartClient(unsigned int ip, unsigned short port, bool create_g
return true;
}
void DuelClient::ConnectTimeout(evutil_socket_t fd, short events, void* arg) {
if (auto_watch_mode) {
mainGame->device->closeDevice();
}
if(connect_state == 0x7)
return;
if(!is_closing) {
......@@ -1674,6 +1671,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int c, l, s, ss;
unsigned int code;
bool panelmode = false;
int handcount = 0;
bool select_ready = mainGame->dField.select_min == 0;
mainGame->dField.select_ready = select_ready;
ClientCard* pcard;
......@@ -1699,6 +1697,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->is_selected = false;
if (l & 0xf1)
panelmode = true;
if(l & LOCATION_HAND) {
handcount++;
if(handcount >= 10)
panelmode = true;
}
}
std::sort(mainGame->dField.selectable_cards.begin(), mainGame->dField.selectable_cards.end(), ClientCard::client_card_sort);
if(select_hint)
......@@ -1913,9 +1916,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
case MSG_SELECT_PLACE:
case MSG_SELECT_DISFIELD: {
/*int selecting_player = */BufferIO::ReadInt8(pbuf);
int selecting_player = BufferIO::ReadInt8(pbuf);
mainGame->dField.select_min = BufferIO::ReadInt8(pbuf);
mainGame->dField.selectable_field = ~BufferIO::ReadInt32(pbuf);
if(selecting_player == mainGame->LocalPlayer(1))
mainGame->dField.selectable_field = (mainGame->dField.selectable_field >> 16) | (mainGame->dField.selectable_field << 16);
mainGame->dField.selected_field = 0;
unsigned char respbuf[64];
int pzone = 0;
......@@ -2188,12 +2193,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard = *(mainGame->dField.deck[player].rbegin() + i);
if (code != 0)
pcard->SetCode(code);
if (auto_watch_mode && code > 0) {
mainGame->showcardcode = code;
mainGame->showcarddif = 0;
mainGame->showcardp = 0;
mainGame->showcard = 4;
}
}
if(mainGame->dInfo.isReplaySkiping)
return true;
......@@ -2214,8 +2213,17 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
else pcard->dRot = irr::core::vector3df(0, 0, 0);
pcard->is_moving = true;
pcard->aniFrame = 5;
if (auto_watch_mode && code > 0) {
mainGame->showcardcode = pcard->code;
mainGame->showcarddif = 0;
mainGame->showcardp = 0;
mainGame->showcard = 4;
}
mainGame->WaitFrameSignal(45);
mainGame->dField.MoveCard(pcard, 5);
if (auto_watch_mode) {
mainGame->showcard = 0;
}
mainGame->WaitFrameSignal(5);
}
return true;
......@@ -2232,12 +2240,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard = *(mainGame->dField.extra[player].rbegin() + i + mainGame->dField.extra_p_count[player]);
if (code != 0)
pcard->SetCode(code);
if (auto_watch_mode && code > 0) {
mainGame->showcardcode = code;
mainGame->showcarddif = 0;
mainGame->showcardp = 0;
mainGame->showcard = 4;
}
}
if(mainGame->dInfo.isReplaySkiping)
return true;
......@@ -2257,8 +2259,17 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->dRot = irr::core::vector3df(0, 3.14159f / 5.0f, 0);
pcard->is_moving = true;
pcard->aniFrame = 5;
if (auto_watch_mode && pcard->code > 0) {
mainGame->showcardcode = pcard->code;
mainGame->showcarddif = 0;
mainGame->showcardp = 0;
mainGame->showcard = 4;
}
mainGame->WaitFrameSignal(45);
mainGame->dField.MoveCard(pcard, 5);
if (auto_watch_mode) {
mainGame->showcard = 0;
}
mainGame->WaitFrameSignal(5);
}
return true;
......@@ -2289,12 +2300,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard = mainGame->dField.GetCard(c, l, s);
if (code != 0)
pcard->SetCode(code);
if (auto_watch_mode && code > 0) {
mainGame->showcardcode = code;
mainGame->showcarddif = 0;
mainGame->showcardp = 0;
mainGame->showcard = 4;
}
mainGame->gMutex.lock();
myswprintf(textBuffer, L"*[%ls]", dataManager.GetName(code));
mainGame->AddLog(textBuffer, code);
......@@ -2309,7 +2314,16 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
else pcard->dRot = irr::core::vector3df(0, 3.14159f / 5.0f, 0);
pcard->is_moving = true;
pcard->aniFrame = 5;
if (auto_watch_mode && pcard->code > 0) {
mainGame->showcardcode = pcard->code;
mainGame->showcarddif = 0;
mainGame->showcardp = 0;
mainGame->showcard = 4;
}
mainGame->WaitFrameSignal(45);
if (auto_watch_mode) {
mainGame->showcard = 0;
}
mainGame->dField.MoveCard(pcard, 5);
mainGame->WaitFrameSignal(5);
} else {
......@@ -2349,10 +2363,19 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard->aniFrame = 5;
}
}
if (auto_watch_mode && pcard->code > 0) {
mainGame->showcardcode = pcard->code;
mainGame->showcarddif = 0;
mainGame->showcardp = 0;
mainGame->showcard = 4;
}
if (mainGame->dInfo.isReplay)
mainGame->WaitFrameSignal(30);
else
mainGame->WaitFrameSignal(90);
if (auto_watch_mode) {
mainGame->showcard = 0;
}
for(size_t i = 0; i < field_confirm.size(); ++i) {
pcard = field_confirm[i];
mainGame->dField.MoveCard(pcard, 5);
......@@ -3516,12 +3539,6 @@ 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) {
mainGame->showcardcode = pc->code;
mainGame->showcarddif = 0;
mainGame->showcardp = 0;
mainGame->showcard = 2;
}
if (pc->counters.count(type))
pc->counters[type] += count;
else pc->counters[type] = count;
......
......@@ -668,16 +668,16 @@ bool Game::Initialize() {
for(int filter = 0x1; filter != 0x2000000; filter <<= 1)
cbRace->addItem(dataManager.FormatRace(filter), filter);
stAttack = env->addStaticText(dataManager.GetSysString(1322), rect<s32>(205, 22 + 50 / 6, 280, 42 + 50 / 6), false, false, wFilter);
ebAttack = env->addEditBox(L"", rect<s32>(260, 20 + 50 / 6, 340, 40 + 50 / 6), true, wFilter);
ebAttack = env->addEditBox(L"", rect<s32>(260, 20 + 50 / 6, 340, 40 + 50 / 6), true, wFilter, EDITBOX_INPUTS);
ebAttack->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
stDefense = env->addStaticText(dataManager.GetSysString(1323), rect<s32>(205, 42 + 75 / 6, 280, 62 + 75 / 6), false, false, wFilter);
ebDefense = env->addEditBox(L"", rect<s32>(260, 40 + 75 / 6, 340, 60 + 75 / 6), true, wFilter);
ebDefense = env->addEditBox(L"", rect<s32>(260, 40 + 75 / 6, 340, 60 + 75 / 6), true, wFilter, EDITBOX_INPUTS);
ebDefense->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
stStar = env->addStaticText(dataManager.GetSysString(1324), rect<s32>(10, 62 + 100 / 6, 80, 82 + 100 / 6), false, false, wFilter);
ebStar = env->addEditBox(L"", rect<s32>(60, 60 + 100 / 6, 100, 80 + 100 / 6), true, wFilter);
ebStar = env->addEditBox(L"", rect<s32>(60, 60 + 100 / 6, 100, 80 + 100 / 6), true, wFilter, EDITBOX_INPUTS);
ebStar->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
stScale = env->addStaticText(dataManager.GetSysString(1336), rect<s32>(101, 62 + 100 / 6, 150, 82 + 100 / 6), false, false, wFilter);
ebScale = env->addEditBox(L"", rect<s32>(150, 60 + 100 / 6, 190, 80 + 100 / 6), true, wFilter);
ebScale = env->addEditBox(L"", rect<s32>(150, 60 + 100 / 6, 190, 80 + 100 / 6), true, wFilter, EDITBOX_INPUTS);
ebScale->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
stSearch = env->addStaticText(dataManager.GetSysString(1325), rect<s32>(205, 62 + 100 / 6, 280, 82 + 100 / 6), false, false, wFilter);
ebCardName = env->addEditBox(L"", rect<s32>(260, 60 + 100 / 6, 390, 80 + 100 / 6), true, wFilter, EDITBOX_KEYWORD);
......@@ -1017,7 +1017,9 @@ void Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gu
wchar_t c = text[i];
u32 w = font->getCharDimension(c).Width + font->getKerningWidth(c, prev);
prev = c;
if(text[i] == L'\n') {
if(text[i] == L'\r') {
continue;
} else if(text[i] == L'\n') {
dataManager.strBuffer[pbuffer++] = L'\n';
_width = 0;
_height++;
......@@ -1046,15 +1048,15 @@ void Game::LoadExpansions() {
myswprintf(fpath, L"./expansions/%ls", name);
dataManager.LoadDB(fpath);
}
if(!isdir && wcsrchr(name, '.') && !mywcsncasecmp(wcsrchr(name, '.'), L".zip", 4)) {
if(!isdir && wcsrchr(name, '.') && (!mywcsncasecmp(wcsrchr(name, '.'), L".zip", 4) || !mywcsncasecmp(wcsrchr(name, '.'), L".ypk", 4))) {
wchar_t fpath[1024];
myswprintf(fpath, L"./expansions/%ls", name);
#ifdef _WIN32
dataManager.FileSystem->addFileArchive(fpath, true, false);
dataManager.FileSystem->addFileArchive(fpath, true, false, EFAT_ZIP);
#else
char upath[1024];
BufferIO::EncodeUTF8(fpath, upath);
dataManager.FileSystem->addFileArchive(upath, true, false);
dataManager.FileSystem->addFileArchive(upath, true, false, EFAT_ZIP);
#endif
}
});
......
......@@ -186,6 +186,12 @@ public:
return focus && focus->hasType(type);
}
void TrimText(irr::gui::IGUIElement* editbox) const {
irr::core::stringw text(editbox->getText());
text.trim();
editbox->setText(text.c_str());
}
void OnResize();
recti Resize(s32 x, s32 y, s32 x2, s32 y2);
recti Resize(s32 x, s32 y, s32 x2, s32 y2, s32 dx, s32 dy, s32 dx2, s32 dy2);
......@@ -780,6 +786,7 @@ extern Game* mainGame;
#define BUTTON_MARKS_FILTER 322
#define BUTTON_MARKERS_OK 323
#define COMBOBOX_SORTTYPE 324
#define EDITBOX_INPUTS 325
#define WINDOW_DECK_MANAGE 330
#define BUTTON_NEW_CATEGORY 331
#define BUTTON_RENAME_CATEGORY 332
......
......@@ -64,6 +64,8 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
case BUTTON_JOIN_HOST: {
bot_mode = false;
mainGame->TrimText(mainGame->ebJoinHost);
mainGame->TrimText(mainGame->ebJoinPort);
char ip[20];
const wchar_t* pstr = mainGame->ebJoinHost->getText();
BufferIO::CopyWStr(pstr, ip, 16);
......
......@@ -249,6 +249,7 @@ void ReplayMode::EndDuel() {
mainGame->dInfo.isStarted = false;
mainGame->dInfo.isFinished = true;
mainGame->dInfo.isReplay = false;
mainGame->dInfo.isSingleMode = false;
mainGame->gMutex.unlock();
mainGame->closeDoneSignal.Reset();
mainGame->closeSignal.Set();
......
Subproject commit 3b89b5b5c6490f61f5f24a18afb42e36382f9879
Subproject commit c48f5e5f179bfda57a0da32d0e1a0f14bcdd8884
......@@ -10,7 +10,7 @@ solution "ygo"
end
configurations { "Release", "Debug" }
if os.getenv("YGOPRO_LUA_SAVE") then
if os.getenv("YGOPRO_LUA_SAFE") then
defines { "LUA_COMPAT_5_2", "YGOPRO_LUA_SAFE" }
else
defines { "LUA_COMPAT_5_2" }
......
Subproject commit 15b39359eb08b50a695536752fe813c33f1d0445
Subproject commit 8fb7f95a65d6b7ccb5ec565e95df34139ca9439a
......@@ -1038,3 +1038,7 @@
!setname 0x2142 黄金国永生药 エルドリクシル
!setname 0x143 黄金乡 黄金郷
!setname 0x144 幻魔
!setname 0x145 教导 ドラグマ
!setname 0x146 童话动物 メルフィー
!setname 0x147 波波 ポータン
!setname 0x148 罗兰 ローラン
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