Commit de3fe3f2 authored by nanahira's avatar nanahira

merge subdir

parents 5884e5a2 e80b7d6c
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
/freetype /freetype
/sqlite3 /sqlite3
/irrklang /irrklang
/irrlicht /irrlicht*
# gframe additionals # gframe additionals
/gframe/ygopro.ico /gframe/ygopro.ico
......
...@@ -13,7 +13,6 @@ addons: ...@@ -13,7 +13,6 @@ addons:
- libfreetype6-dev - libfreetype6-dev
- libevent-dev - libevent-dev
- libsqlite3-dev - libsqlite3-dev
- libirrlicht-dev
- libgl1-mesa-dev - libgl1-mesa-dev
- libglu-dev - libglu-dev
- p7zip-full - p7zip-full
...@@ -30,6 +29,7 @@ before_install: ...@@ -30,6 +29,7 @@ before_install:
curl --location --retry 5 https://github.com/premake/premake-core/releases/download/v5.0.0-alpha13/premake-5.0.0-alpha13-macosx.tar.gz | tar zfx -; curl --location --retry 5 https://github.com/premake/premake-core/releases/download/v5.0.0-alpha13/premake-5.0.0-alpha13-macosx.tar.gz | tar zfx -;
fi fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
git clone https://github.com/DailyShana/irrlicht irrlicht_linux;
curl --location --retry 5 https://github.com/premake/premake-core/releases/download/v5.0.0-alpha13/premake-5.0.0-alpha13-linux.tar.gz | tar zfx -; curl --location --retry 5 https://github.com/premake/premake-core/releases/download/v5.0.0-alpha13/premake-5.0.0-alpha13-linux.tar.gz | tar zfx -;
fi fi
......
No preview for this file type
...@@ -125,6 +125,8 @@ void ClientCard::UpdateInfo(char* buf) { ...@@ -125,6 +125,8 @@ void ClientCard::UpdateInfo(char* buf) {
base_defense = BufferIO::ReadInt32(buf); base_defense = BufferIO::ReadInt32(buf);
if(flag & QUERY_REASON) if(flag & QUERY_REASON)
reason = BufferIO::ReadInt32(buf); reason = BufferIO::ReadInt32(buf);
if(flag & QUERY_REASON_CARD)
BufferIO::ReadInt32(buf);
if(flag & QUERY_EQUIP_CARD) { if(flag & QUERY_EQUIP_CARD) {
int c = BufferIO::ReadInt8(buf); int c = BufferIO::ReadInt8(buf);
int l = BufferIO::ReadInt8(buf); int l = BufferIO::ReadInt8(buf);
......
...@@ -1549,6 +1549,7 @@ void ClientField::RefreshCardCountDisplay() { ...@@ -1549,6 +1549,7 @@ void ClientField::RefreshCardCountDisplay() {
ClientCard* pcard; ClientCard* pcard;
for(int p = 0; p < 2; ++p) { for(int p = 0; p < 2; ++p) {
mainGame->dInfo.card_count[p] = hand[p].size(); mainGame->dInfo.card_count[p] = hand[p].size();
mainGame->dInfo.total_attack[p] = 0;
for(auto it = mzone[p].begin(); it != mzone[p].end(); ++it) { for(auto it = mzone[p].begin(); it != mzone[p].end(); ++it) {
pcard = *it; pcard = *it;
if(pcard) { if(pcard) {
...@@ -1556,6 +1557,8 @@ void ClientField::RefreshCardCountDisplay() { ...@@ -1556,6 +1557,8 @@ void ClientField::RefreshCardCountDisplay() {
mainGame->dInfo.card_count[p] += pcard->link; mainGame->dInfo.card_count[p] += pcard->link;
else else
mainGame->dInfo.card_count[p]++; mainGame->dInfo.card_count[p]++;
if(pcard->position == POS_FACEUP_ATTACK && pcard->attack > 0 && (p == 1 || mainGame->dInfo.curMsg != MSG_SELECT_BATTLECMD || pcard->cmdFlag & COMMAND_ATTACK))
mainGame->dInfo.total_attack[p] += pcard->attack;
} }
} }
for(auto it = szone[p].begin(); it != szone[p].end(); ++it) { for(auto it = szone[p].begin(); it != szone[p].end(); ++it) {
...@@ -1564,6 +1567,7 @@ void ClientField::RefreshCardCountDisplay() { ...@@ -1564,6 +1567,7 @@ void ClientField::RefreshCardCountDisplay() {
mainGame->dInfo.card_count[p]++; mainGame->dInfo.card_count[p]++;
} }
myswprintf(mainGame->dInfo.str_card_count[p], L"%d", mainGame->dInfo.card_count[p]); myswprintf(mainGame->dInfo.str_card_count[p], L"%d", mainGame->dInfo.card_count[p]);
myswprintf(mainGame->dInfo.str_total_attack[p], L"%d", mainGame->dInfo.total_attack[p]);
} }
if(mainGame->dInfo.card_count[0] > mainGame->dInfo.card_count[1]) { if(mainGame->dInfo.card_count[0] > mainGame->dInfo.card_count[1]) {
mainGame->dInfo.card_count_color[0] = 0xffffff00; mainGame->dInfo.card_count_color[0] = 0xffffff00;
...@@ -1575,5 +1579,15 @@ void ClientField::RefreshCardCountDisplay() { ...@@ -1575,5 +1579,15 @@ void ClientField::RefreshCardCountDisplay() {
mainGame->dInfo.card_count_color[0] = 0xffffffff; mainGame->dInfo.card_count_color[0] = 0xffffffff;
mainGame->dInfo.card_count_color[1] = 0xffffffff; mainGame->dInfo.card_count_color[1] = 0xffffffff;
} }
if(mainGame->dInfo.total_attack[0] > mainGame->dInfo.total_attack[1]) {
mainGame->dInfo.total_attack_color[0] = 0xffffff00;
mainGame->dInfo.total_attack_color[1] = 0xffff0000;
} else if(mainGame->dInfo.total_attack[1] > mainGame->dInfo.total_attack[0]) {
mainGame->dInfo.total_attack_color[1] = 0xffffff00;
mainGame->dInfo.total_attack_color[0] = 0xffff0000;
} else {
mainGame->dInfo.total_attack_color[0] = 0xffffffff;
mainGame->dInfo.total_attack_color[1] = 0xffffffff;
}
} }
} }
...@@ -567,6 +567,12 @@ void Game::DrawMisc() { ...@@ -567,6 +567,12 @@ void Game::DrawMisc() {
DrawShadowText(numFont, dInfo.str_card_count[0], Resize(550, 31, 575, 50), Resize(0, 1, 2, 0), dInfo.card_count_color[0], 0xff000000, true, false, 0); DrawShadowText(numFont, dInfo.str_card_count[0], Resize(550, 31, 575, 50), Resize(0, 1, 2, 0), dInfo.card_count_color[0], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_card_count[1], Resize(757, 31, 782, 50), Resize(0, 1, 2, 0), dInfo.card_count_color[1], 0xff000000, true, false, 0); DrawShadowText(numFont, dInfo.str_card_count[1], Resize(757, 31, 782, 50), Resize(0, 1, 2, 0), dInfo.card_count_color[1], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_total_attack[0], Resize(486, 31, 536, 50), Resize(0, 1, 2, 0), dInfo.total_attack_color[0], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_total_attack[1], Resize(793, 31, 843, 50), Resize(0, 1, 2, 0), dInfo.total_attack_color[1], 0xff000000, true, false, 0);
driver->draw2DImage(imageManager.tAttack, ResizeCardMid(477, 32, 486, 50, 486, 41), recti(32, 0, 96, 128), 0, 0, true);
driver->draw2DImage(imageManager.tAttack, ResizeCardMid(784, 32, 793, 50, 793, 41), recti(32, 0, 96, 128), 0, 0, true);
/* /*
driver->draw2DRectangle(Resize(525, 34, 525 + dInfo.time_left[0] * 100 / dInfo.time_limit, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0); driver->draw2DRectangle(Resize(525, 34, 525 + dInfo.time_left[0] * 100 / dInfo.time_limit, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0);
driver->draw2DRectangleOutline(Resize(525, 34, 625, 44), 0xffffffff); driver->draw2DRectangleOutline(Resize(525, 34, 625, 44), 0xffffffff);
...@@ -580,6 +586,12 @@ void Game::DrawMisc() { ...@@ -580,6 +586,12 @@ void Game::DrawMisc() {
DrawShadowText(numFont, dInfo.str_card_count[0], Resize(600, 31, 625, 50), Resize(0, 1, 2, 0), dInfo.card_count_color[0], 0xff000000, true, false, 0); DrawShadowText(numFont, dInfo.str_card_count[0], Resize(600, 31, 625, 50), Resize(0, 1, 2, 0), dInfo.card_count_color[0], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_card_count[1], Resize(707, 31, 732, 50), Resize(0, 1, 2, 0), dInfo.card_count_color[1], 0xff000000, true, false, 0); DrawShadowText(numFont, dInfo.str_card_count[1], Resize(707, 31, 732, 50), Resize(0, 1, 2, 0), dInfo.card_count_color[1], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_total_attack[0], Resize(536, 31, 586, 50), Resize(0, 1, 2, 0), dInfo.total_attack_color[0], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_total_attack[1], Resize(743, 31, 793, 50), Resize(0, 1, 2, 0), dInfo.total_attack_color[1], 0xff000000, true, false, 0);
driver->draw2DImage(imageManager.tAttack, ResizeCardMid(527, 32, 536, 50, 536, 41), recti(32, 0, 96, 128), 0, 0, true);
driver->draw2DImage(imageManager.tAttack, ResizeCardMid(734, 32, 743, 50, 743, 41), recti(32, 0, 96, 128), 0, 0, true);
} }
DrawShadowText(numFont, dInfo.strLP[0], Resize(330, 12, 631, 30), Resize(0, 1, 2, 0), 0xffffff00, 0xff000000, true, false, 0); DrawShadowText(numFont, dInfo.strLP[0], Resize(330, 12, 631, 30), Resize(0, 1, 2, 0), 0xffffff00, 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.strLP[1], Resize(691, 12, 992, 30), Resize(0, 1, 2, 0), 0xffffff00, 0xff000000, true, false, 0); DrawShadowText(numFont, dInfo.strLP[1], Resize(691, 12, 992, 30), Resize(0, 1, 2, 0), 0xffffff00, 0xff000000, true, false, 0);
......
...@@ -730,7 +730,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -730,7 +730,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->actionParam = 1; mainGame->actionParam = 1;
wchar_t msgbuf[256]; wchar_t msgbuf[256];
myswprintf(msgbuf, dataManager.GetSysString(1376), timetext); myswprintf(msgbuf, dataManager.GetSysString(1376), timetext);
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, msgbuf); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, msgbuf);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(30); mainGame->WaitFrameSignal(30);
...@@ -977,7 +977,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -977,7 +977,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0); mainGame->logParam.push_back(0);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
...@@ -995,7 +995,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -995,7 +995,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0); mainGame->logParam.push_back(0);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
...@@ -1006,7 +1006,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1006,7 +1006,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0); mainGame->logParam.push_back(0);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
...@@ -1017,7 +1017,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1017,7 +1017,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(data); mainGame->logParam.push_back(data);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
...@@ -1028,7 +1028,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1028,7 +1028,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->lstLog->addItem(textBuffer); mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0); mainGame->logParam.push_back(0);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
...@@ -1234,6 +1234,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1234,6 +1234,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.attackable_cards.push_back(pcard); mainGame->dField.attackable_cards.push_back(pcard);
pcard->cmdFlag |= COMMAND_ATTACK; pcard->cmdFlag |= COMMAND_ATTACK;
} }
mainGame->dField.RefreshCardCountDisplay();
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
if(BufferIO::ReadInt8(pbuf)) { if(BufferIO::ReadInt8(pbuf)) {
mainGame->btnM2->setVisible(true); mainGame->btnM2->setVisible(true);
...@@ -2405,6 +2406,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2405,6 +2406,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->btnShuffle->setVisible(false); mainGame->btnShuffle->setVisible(false);
mainGame->showcarddif = 30; mainGame->showcarddif = 30;
mainGame->showcardp = 0; mainGame->showcardp = 0;
mainGame->dField.RefreshCardCountDisplay();
switch (phase) { switch (phase) {
case PHASE_DRAW: case PHASE_DRAW:
mainGame->btnPhaseStatus->setText(L"\xff24\xff30"); mainGame->btnPhaseStatus->setText(L"\xff24\xff30");
......
...@@ -1633,7 +1633,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1633,7 +1633,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
str.append(formatBuffer); str.append(formatBuffer);
} }
should_show_tip = true; should_show_tip = true;
irr::core::dimension2d<unsigned int> dtip = mainGame->textFont->getDimension(str.c_str()) + irr::core::dimension2d<unsigned int>(10, 10); irr::core::dimension2d<unsigned int> dtip = mainGame->guiFont->getDimension(str.c_str()) + irr::core::dimension2d<unsigned int>(10, 10);
mainGame->stTip->setRelativePosition(recti(mousepos.X - 10 - dtip.Width, mousepos.Y + 10, mousepos.X - 10, mousepos.Y + 10 + dtip.Height)); mainGame->stTip->setRelativePosition(recti(mousepos.X - 10 - dtip.Width, mousepos.Y + 10, mousepos.X - 10, mousepos.Y + 10 + dtip.Height));
mainGame->stTip->setText(str.c_str()); mainGame->stTip->setText(str.c_str());
} }
...@@ -1989,15 +1989,19 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1989,15 +1989,19 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
switch(event.KeyInput.Key) { switch(event.KeyInput.Key) {
case irr::KEY_KEY_R: { case irr::KEY_KEY_R: {
if(mainGame->gameConf.control_mode == 0 if(mainGame->gameConf.control_mode == 0
&& !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX)) && !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX)) {
mainGame->textFont->setTransparency(true); mainGame->textFont->setTransparency(true);
mainGame->guiFont->setTransparency(true);
}
return true; return true;
break; break;
} }
case irr::KEY_F9: { case irr::KEY_F9: {
if(mainGame->gameConf.control_mode == 1 if(mainGame->gameConf.control_mode == 1
&& !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX)) && !event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX)) {
mainGame->textFont->setTransparency(true); mainGame->textFont->setTransparency(true);
mainGame->guiFont->setTransparency(true);
}
return true; return true;
break; break;
} }
......
...@@ -19,6 +19,7 @@ Game* mainGame; ...@@ -19,6 +19,7 @@ Game* mainGame;
bool Game::Initialize() { bool Game::Initialize() {
srand(time(0)); srand(time(0));
initUtils();
LoadConfig(); LoadConfig();
irr::SIrrlichtCreationParameters params = irr::SIrrlichtCreationParameters(); irr::SIrrlichtCreationParameters params = irr::SIrrlichtCreationParameters();
params.AntiAlias = gameConf.antialias; params.AntiAlias = gameConf.antialias;
...@@ -982,7 +983,7 @@ void Game::LoadExpansionDB() { ...@@ -982,7 +983,7 @@ void Game::LoadExpansionDB() {
} }
void Game::LoadExpansionDBDirectry(const char* path) { void Game::LoadExpansionDBDirectry(const char* path) {
FileSystem::TraversalDir(path, [path](const char* name, bool isdir) { FileSystem::TraversalDir(path, [path](const char* name, bool isdir) {
if(!isdir && !mystrncasecmp(strrchr(name, '.'), ".cdb", 4)) { if(!isdir && strrchr(name, '.') && !mystrncasecmp(strrchr(name, '.'), ".cdb", 4)) {
char fpath[1024]; char fpath[1024];
sprintf(fpath, "%s/%s", path, name); sprintf(fpath, "%s/%s", path, name);
dataManager.LoadDB(fpath); dataManager.LoadDB(fpath);
...@@ -1002,7 +1003,7 @@ void Game::LoadExpansionStrings() { ...@@ -1002,7 +1003,7 @@ void Game::LoadExpansionStrings() {
void Game::RefreshDeck(irr::gui::IGUIComboBox* cbDeck) { void Game::RefreshDeck(irr::gui::IGUIComboBox* cbDeck) {
cbDeck->clear(); cbDeck->clear();
FileSystem::TraversalDir(L"./deck", [cbDeck](const wchar_t* name, bool isdir) { FileSystem::TraversalDir(L"./deck", [cbDeck](const wchar_t* name, bool isdir) {
if(!isdir && !mywcsncasecmp(wcsrchr(name, '.'), L".ydk", 4)) { if(!isdir && wcsrchr(name, '.') && !mywcsncasecmp(wcsrchr(name, '.'), L".ydk", 4)) {
size_t len = wcslen(name); size_t len = wcslen(name);
wchar_t deckname[256]; wchar_t deckname[256];
wcsncpy(deckname, name, len - 4); wcsncpy(deckname, name, len - 4);
...@@ -1020,45 +1021,24 @@ void Game::RefreshDeck(irr::gui::IGUIComboBox* cbDeck) { ...@@ -1020,45 +1021,24 @@ void Game::RefreshDeck(irr::gui::IGUIComboBox* cbDeck) {
void Game::RefreshReplay() { void Game::RefreshReplay() {
lstReplayList->clear(); lstReplayList->clear();
FileSystem::TraversalDir(L"./replay", [this](const wchar_t* name, bool isdir) { FileSystem::TraversalDir(L"./replay", [this](const wchar_t* name, bool isdir) {
if(!isdir && !mywcsncasecmp(wcsrchr(name, '.'), L".yrp", 4) && Replay::CheckReplay(name)) if(!isdir && wcsrchr(name, '.') && !mywcsncasecmp(wcsrchr(name, '.'), L".yrp", 4) && Replay::CheckReplay(name))
lstReplayList->addItem(name); lstReplayList->addItem(name);
}); });
} }
void Game::RefreshSingleplay() { void Game::RefreshSingleplay() {
lstSinglePlayList->clear(); lstSinglePlayList->clear();
FileSystem::TraversalDir(L"./single", [this](const wchar_t* name, bool isdir) { FileSystem::TraversalDir(L"./single", [this](const wchar_t* name, bool isdir) {
if(!isdir && !mywcsncasecmp(wcsrchr(name, '.'), L".lua", 4)) if(!isdir && wcsrchr(name, '.') && !mywcsncasecmp(wcsrchr(name, '.'), L".lua", 4))
lstSinglePlayList->addItem(name); lstSinglePlayList->addItem(name);
}); });
} }
void Game::RefreshLocales() { void Game::RefreshLocales() {
cbLocale->clear(); cbLocale->clear();
cbLocale->addItem(L"default"); cbLocale->addItem(L"default");
#ifdef _WIN32 FileSystem::TraversalDir(L"./locales", [this](const wchar_t* name, bool isdir) {
WIN32_FIND_DATAW fdataw; if(isdir && wcscmp(name, L".") && wcscmp(name, L".."))
HANDLE fh = FindFirstFileW(L"./locales/*", &fdataw); cbLocale->addItem(name);
if(fh == INVALID_HANDLE_VALUE) });
return;
do {
if((fdataw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && wcscmp(fdataw.cFileName, L".") && wcscmp(fdataw.cFileName, L".."))
cbLocale->addItem(fdataw.cFileName);
} while(FindNextFileW(fh, &fdataw));
FindClose(fh);
#else
DIR * dir;
struct dirent * dirp;
if((dir = opendir("./locales/")) == NULL)
return;
while((dirp = readdir(dir)) != NULL) {
size_t len = strlen(dirp->d_name);
wchar_t wname[256];
BufferIO::DecodeUTF8(dirp->d_name, wname);
if(!wcscmp(wname, L".") || !wcscmp(wname, L".."))
continue;
cbLocale->addItem(wname);
}
closedir(dir);
#endif
for(size_t i = 0; i < cbLocale->getItemCount(); ++i) { for(size_t i = 0; i < cbLocale->getItemCount(); ++i) {
if(!wcscmp(cbLocale->getItem(i), gameConf.locale)) { if(!wcscmp(cbLocale->getItem(i), gameConf.locale)) {
cbLocale->setSelected(i); cbLocale->setSelected(i);
...@@ -2086,6 +2066,8 @@ void Game::FlashWindow() { ...@@ -2086,6 +2066,8 @@ void Game::FlashWindow() {
#endif #endif
} }
void Game::takeScreenshot() { void Game::takeScreenshot() {
if(!FileSystem::IsDirExists(L"./screenshots") && !FileSystem::MakeDir(L"./screenshots"))
return;
irr::video::IImage* const image = driver->createScreenShot(); irr::video::IImage* const image = driver->createScreenShot();
if(image) { if(image) {
irr::c8 filename[64]; irr::c8 filename[64];
......
...@@ -74,6 +74,7 @@ struct DuelInfo { ...@@ -74,6 +74,7 @@ struct DuelInfo {
int lp[2]; int lp[2];
int start_lp[2]; int start_lp[2];
int card_count[2]; int card_count[2];
int total_attack[2];
int duel_rule; int duel_rule;
int turn; int turn;
short curMsg; short curMsg;
...@@ -90,7 +91,9 @@ struct DuelInfo { ...@@ -90,7 +91,9 @@ struct DuelInfo {
wchar_t str_time_left[2][16]; wchar_t str_time_left[2][16];
video::SColor time_color[2]; video::SColor time_color[2];
wchar_t str_card_count[2][16]; wchar_t str_card_count[2][16];
wchar_t str_total_attack[2][16];
video::SColor card_count_color[2]; video::SColor card_count_color[2];
video::SColor total_attack_color[2];
bool isReplaySwapped; bool isReplaySwapped;
std::vector<unsigned int> announce_cache; std::vector<unsigned int> announce_cache;
}; };
...@@ -160,6 +163,7 @@ public: ...@@ -160,6 +163,7 @@ public:
void ClearChatMsg(); void ClearChatMsg();
void AddDebugMsg(const char* msgbuf); void AddDebugMsg(const char* msgbuf);
void ErrorLog(const char* msgbuf); void ErrorLog(const char* msgbuf);
void initUtils();
void ClearTextures(); void ClearTextures();
void CloseDuelWindow(); void CloseDuelWindow();
......
#include "image_manager.h" #include "image_manager.h"
#include "game.h" #include "game.h"
#ifndef _WIN32
#include <dirent.h>
#endif
namespace ygo { namespace ygo {
...@@ -95,54 +92,27 @@ irr::video::ITexture* ImageManager::GetRandomImage(int image_type, s32 width, s3 ...@@ -95,54 +92,27 @@ irr::video::ITexture* ImageManager::GetRandomImage(int image_type, s32 width, s3
return GetTextureFromFile(ImageName, width, height); return GetTextureFromFile(ImageName, width, height);
} }
void ImageManager::RefreshRandomImageList() { void ImageManager::RefreshRandomImageList() {
RefreshImageDir(L"bg/", TEXTURE_DUEL); RefreshImageDir(L"bg", TEXTURE_DUEL);
RefreshImageDir(L"bg_duel/", TEXTURE_DUEL); RefreshImageDir(L"bg_duel", TEXTURE_DUEL);
RefreshImageDir(L"bg_deck/", TEXTURE_DECK); RefreshImageDir(L"bg_deck", TEXTURE_DECK);
RefreshImageDir(L"bg_menu/", TEXTURE_MENU); RefreshImageDir(L"bg_menu", TEXTURE_MENU);
RefreshImageDir(L"cover/", TEXTURE_COVER_S); RefreshImageDir(L"cover", TEXTURE_COVER_S);
RefreshImageDir(L"cover2/", TEXTURE_COVER_O); RefreshImageDir(L"cover2", TEXTURE_COVER_O);
RefreshImageDir(L"attack/", TEXTURE_ATTACK); RefreshImageDir(L"attack", TEXTURE_ATTACK);
RefreshImageDir(L"act/", TEXTURE_ACTIVATE); RefreshImageDir(L"act", TEXTURE_ACTIVATE);
for(int i = 0; i < 7; ++ i) { for(int i = 0; i < 7; ++ i) {
saved_image_id[i] = -1; saved_image_id[i] = -1;
} }
} }
void ImageManager::RefreshImageDir(std::wstring path, int image_type) { void ImageManager::RefreshImageDir(std::wstring path, int image_type) {
#ifdef _WIN32 std::wstring search = L"./textures/" + path;
WIN32_FIND_DATAW fdataw; FileSystem::TraversalDir(search.c_str(), [this, &path, image_type](const wchar_t* name, bool isdir) {
std::wstring search = L"./textures/" + path + L"*.*"; if(!isdir && wcsrchr(name, '.') && (!mywcsncasecmp(wcsrchr(name, '.'), L".jpg", 4) || !mywcsncasecmp(wcsrchr(name, '.'), L".png", 4))) {
HANDLE fh = FindFirstFileW(search.c_str(), &fdataw); std::wstring filename = path + L"/" + name;
if(fh == INVALID_HANDLE_VALUE) ImageList[image_type].push_back(filename);
return; }
do { });
size_t len = wcslen(fdataw.cFileName);
if((fdataw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || len < 5
|| !(_wcsicmp(fdataw.cFileName + len - 4, L".jpg") == 0 || _wcsicmp(fdataw.cFileName + len - 4, L".png") == 0))
continue;
std::wstring filename = path + (std::wstring)fdataw.cFileName;
ImageList[image_type].push_back(filename);
} while(FindNextFileW(fh, &fdataw));
FindClose(fh);
#else
DIR * dir;
struct dirent * dirp;
std::wstring wsearchpath = L"./textures/" + path;
char searchpath[256];
BufferIO::EncodeUTF8(wsearchpath.c_str(), searchpath);
if((dir = opendir(searchpath)) == NULL)
return;
while((dirp = readdir(dir)) != NULL) {
size_t len = strlen(dirp->d_name);
if(len < 5 || !(strcasecmp(dirp->d_name + len - 4, ".jpg") == 0 || strcasecmp(dirp->d_name + len - 4, ".png")))
continue;
wchar_t wname[256];
BufferIO::DecodeUTF8(dirp->d_name, wname);
std::wstring filename = path + (std::wstring)wname;
ImageList[image_type].push_back(filename);
}
closedir(dir);
#endif
} }
void ImageManager::SetDevice(irr::IrrlichtDevice* dev) { void ImageManager::SetDevice(irr::IrrlichtDevice* dev) {
device = dev; device = dev;
......
...@@ -33,16 +33,19 @@ project "ygopro" ...@@ -33,16 +33,19 @@ project "ygopro"
configuration "not vs*" configuration "not vs*"
buildoptions { "-std=c++14", "-fno-rtti" } buildoptions { "-std=c++14", "-fno-rtti" }
configuration "not windows" configuration "not windows"
includedirs { "/usr/include/irrlicht", "/usr/include/freetype2" } includedirs { "/usr/include/freetype2" }
excludes { "COSOperator.*" } excludes { "COSOperator.*" }
links { "event_pthreads", "GL", "dl", "pthread" } links { "event_pthreads", "GL", "dl", "pthread" }
configuration "linux" configuration "linux"
includedirs { "../irrlicht_linux/include" }
links { "X11", "Xxf86vm" }
if USE_IRRKLANG then if USE_IRRKLANG then
links { "IrrKlang" } links { "IrrKlang" }
linkoptions{ "-Wl,-rpath=./" } linkoptions{ "-Wl,-rpath=./" }
libdirs { "../irrklang/bin/linux-gcc-64" } libdirs { "../irrklang/bin/linux-gcc-64" }
end end
configuration "macosx" configuration "macosx"
includedirs { "/usr/include/irrlicht" }
if USE_IRRKLANG then if USE_IRRKLANG then
links { "irrklang" } links { "irrklang" }
libdirs { "../irrklang/bin/macosx-gcc" } libdirs { "../irrklang/bin/macosx-gcc" }
......
...@@ -153,7 +153,7 @@ int SingleMode::SinglePlayThread(void* param) { ...@@ -153,7 +153,7 @@ int SingleMode::SinglePlayThread(void* param) {
mainGame->actionParam = 1; mainGame->actionParam = 1;
wchar_t msgbuf[256]; wchar_t msgbuf[256];
myswprintf(msgbuf, dataManager.GetSysString(1376), timetext); myswprintf(msgbuf, dataManager.GetSysString(1376), timetext);
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, msgbuf); mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->guiFont, msgbuf);
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->WaitFrameSignal(30); mainGame->WaitFrameSignal(30);
...@@ -780,7 +780,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) { ...@@ -780,7 +780,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
memcpy(msgbuf, begin, len + 1); memcpy(msgbuf, begin, len + 1);
BufferIO::DecodeUTF8(msgbuf, msg); BufferIO::DecodeUTF8(msgbuf, msg);
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stMessage, 310, mainGame->textFont, msg); mainGame->SetStaticText(mainGame->stMessage, 310, mainGame->guiFont, msg);
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
......
...@@ -35,13 +35,13 @@ void SoundManager::RefreshBGMList() { ...@@ -35,13 +35,13 @@ void SoundManager::RefreshBGMList() {
RefershBGMDir(L"disadvantage", BGM_DISADVANTAGE); RefershBGMDir(L"disadvantage", BGM_DISADVANTAGE);
RefershBGMDir(L"win", BGM_WIN); RefershBGMDir(L"win", BGM_WIN);
RefershBGMDir(L"lose", BGM_LOSE); RefershBGMDir(L"lose", BGM_LOSE);
RefershBGMDir(L"custom/", BGM_CUSTOM); RefershBGMDir(L"custom", BGM_CUSTOM);
#endif #endif
} }
void SoundManager::RefershBGMDir(std::wstring path, int scene) { void SoundManager::RefershBGMDir(std::wstring path, int scene) {
std::wstring search = L"./sound/BGM/" + path; std::wstring search = L"./sound/BGM/" + path;
FileSystem::TraversalDir(search.c_str(), [this, &path, scene](const wchar_t* name, bool isdir) { FileSystem::TraversalDir(search.c_str(), [this, &path, scene](const wchar_t* name, bool isdir) {
if(!isdir && (!mywcsncasecmp(wcsrchr(name, '.'), L".mp3", 4) || !mywcsncasecmp(wcsrchr(name, '.'), L".ogg", 4))) { if(!isdir && wcsrchr(name, '.') && (!mywcsncasecmp(wcsrchr(name, '.'), L".mp3", 4) || !mywcsncasecmp(wcsrchr(name, '.'), L".ogg", 4))) {
std::wstring filename = path + L"/" + name; std::wstring filename = path + L"/" + name;
BGMList[BGM_ALL].push_back(filename); BGMList[BGM_ALL].push_back(filename);
BGMList[scene].push_back(filename); BGMList[scene].push_back(filename);
......
...@@ -46,7 +46,7 @@ solution "ygo" ...@@ -46,7 +46,7 @@ solution "ygo"
configuration { "Release", "vs*" } configuration { "Release", "vs*" }
flags { "LinkTimeOptimization" } flags { "LinkTimeOptimization" }
staticruntime "On" staticruntime "On"
disablewarnings { "4244", "4267", "4838", "4577", "4819", "4018", "4996", "4477", "4091", "4305", "4828" } disablewarnings { "4244", "4267", "4838", "4577", "4819", "4018", "4996", "4477", "4091", "4305", "4828", "4800" }
configuration { "Release", "not vs*" } configuration { "Release", "not vs*" }
symbols "On" symbols "On"
...@@ -77,6 +77,9 @@ solution "ygo" ...@@ -77,6 +77,9 @@ solution "ygo"
include "irrlicht" include "irrlicht"
include "sqlite3" include "sqlite3"
end end
if os.ishost("linux") then
include "irrlicht_linux"
end
if USE_IRRKLANG then if USE_IRRKLANG then
include "ikpmp3" include "ikpmp3"
end end
...@@ -939,3 +939,4 @@ ...@@ -939,3 +939,4 @@
!setname 0x121 魔妖 !setname 0x121 魔妖
!setname 0x122 女武神 Valkyrie !setname 0x122 女武神 Valkyrie
!setname 0x123 蔷薇龙 ローズ・ドラゴン !setname 0x123 蔷薇龙 ローズ・ドラゴン
!setname 0x124 机械天使 機械天使
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