Commit 3a335d91 authored by nanahira's avatar nanahira

Merge branch 'master' into side

parents 2405d8b7 34a65de1
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
/fonts /fonts
/replay /replay
/single /single
/screenshots
/sound/*.wav /sound/*.wav
/sound/custom /sound/custom
/sound/BGM /sound/BGM
......
...@@ -103,13 +103,18 @@ before_deploy: ...@@ -103,13 +103,18 @@ before_deploy:
- rm -rf pics/thumbnail pics/*.db - rm -rf pics/thumbnail pics/*.db
- mkdir replay - mkdir replay
- mkdir screenshots
- git clone --depth=1 https://$NANAHIRA@github.com/purerosefallen/fonts
- sed -i "s/c:\/windows/./g" system.conf
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
zip -q -r KoishiPro-$TRAVIS_OS_NAME-full-$TRAVIS_TAG.zip ygopro libirrKlang.so LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures skin deck single pics replay; zip -q -r KoishiPro-$TRAVIS_OS_NAME-full-$TRAVIS_TAG.zip ygopro libirrKlang.so LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures fonts skin deck single pics replay screenshots;
zip -q -r KoishiPro-$TRAVIS_OS_NAME-full-with-sound-$TRAVIS_TAG.zip ygopro libirrKlang.so LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures skin deck single pics replay sound; zip -q -r KoishiPro-$TRAVIS_OS_NAME-full-with-sound-$TRAVIS_TAG.zip ygopro libirrKlang.so LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures fonts skin deck single pics replay sound screenshots;
fi fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
zip -q -r KoishiPro-$TRAVIS_OS_NAME-full-$TRAVIS_TAG.zip ygopro.app LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures skin deck single pics replay; zip -q -r KoishiPro-$TRAVIS_OS_NAME-full-$TRAVIS_TAG.zip ygopro.app LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures fonts skin deck single pics replay screenshots;
zip -q -r KoishiPro-$TRAVIS_OS_NAME-full-with-sound-$TRAVIS_TAG.zip ygopro.app LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures skin deck single pics replay sound; zip -q -r KoishiPro-$TRAVIS_OS_NAME-full-with-sound-$TRAVIS_TAG.zip ygopro.app LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures fonts skin deck single pics replay screenshots sound;
fi fi
deploy: deploy:
......
...@@ -86,8 +86,9 @@ after_build: ...@@ -86,8 +86,9 @@ after_build:
- rm -rf pics/thumbnail pics/*.db - rm -rf pics/thumbnail pics/*.db
- mkdir replay - mkdir replay
- mkdir screenshots
- 7z a -mx9 -xr!.git* KoishiPro-%APPVEYOR_REPO_TAG_NAME%.7z ygopro.exe LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures skin deck single pics update-koishipro replay WindBot Bot.exe bot.conf - 7z a -mx9 -xr!.git* KoishiPro-%APPVEYOR_REPO_TAG_NAME%.7z ygopro.exe LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures skin deck single pics update-koishipro replay screenshots WindBot Bot.exe bot.conf
- cp -rf KoishiPro-%APPVEYOR_REPO_TAG_NAME%.7z KoishiPro-with-sound-%APPVEYOR_REPO_TAG_NAME%.7z - cp -rf KoishiPro-%APPVEYOR_REPO_TAG_NAME%.7z KoishiPro-with-sound-%APPVEYOR_REPO_TAG_NAME%.7z
- 7z a -mx9 -xr!.git* KoishiPro-with-sound-%APPVEYOR_REPO_TAG_NAME%.7z sound - 7z a -mx9 -xr!.git* KoishiPro-with-sound-%APPVEYOR_REPO_TAG_NAME%.7z sound
......
No preview for this file type
...@@ -65,7 +65,6 @@ public: ...@@ -65,7 +65,6 @@ public:
int select_counter_type; int select_counter_type;
std::vector<ClientCard*> selectable_cards; std::vector<ClientCard*> selectable_cards;
std::vector<ClientCard*> selected_cards; std::vector<ClientCard*> selected_cards;
std::vector<ClientCard*> unselected_cards;
std::set<ClientCard*> selectsum_cards; std::set<ClientCard*> selectsum_cards;
std::vector<ClientCard*> selectsum_all; std::vector<ClientCard*> selectsum_all;
std::vector<int> opcode; std::vector<int> opcode;
......
...@@ -832,9 +832,9 @@ void DeckBuilder::FilterCards() { ...@@ -832,9 +832,9 @@ void DeckBuilder::FilterCards() {
std::vector<std::wstring> query_elements; std::vector<std::wstring> query_elements;
std::vector<std::vector<std::wstring>::iterator> query_elements_track; std::vector<std::vector<std::wstring>::iterator> query_elements_track;
size_t element_start = 0; size_t element_start = 0;
while (1) { while(1) {
size_t element_end = str.find_first_of(L' ', element_start); size_t element_end = str.find_first_of(L' ', element_start);
if (element_end == std::wstring::npos) if(element_end == std::wstring::npos)
break; break;
size_t length = element_end - element_start; size_t length = element_end - element_start;
if(length > 0) { if(length > 0) {
...@@ -845,18 +845,17 @@ void DeckBuilder::FilterCards() { ...@@ -845,18 +845,17 @@ void DeckBuilder::FilterCards() {
} }
query_elements.push_back(str.substr(element_start)); query_elements.push_back(str.substr(element_start));
std::unordered_map<std::wstring, unsigned int> set_code_map; std::unordered_map<std::wstring, unsigned int> set_code_map;
for (auto elements_iterator = query_elements.begin(); elements_iterator != query_elements.end(); elements_iterator++) { for(auto elements_iterator = query_elements.begin(); elements_iterator != query_elements.end(); elements_iterator++) {
const wchar_t* element_pointer = elements_iterator->c_str(); const wchar_t* element_pointer = elements_iterator->c_str();
if (element_pointer[0] == L'@') if(element_pointer[0] == L'@')
set_code_map[*elements_iterator] = dataManager.GetSetCode(&element_pointer[1]); set_code_map[*elements_iterator] = dataManager.GetSetCode(&element_pointer[1]);
else else
set_code_map[*elements_iterator] = dataManager.GetSetCode(&element_pointer[0]); set_code_map[*elements_iterator] = dataManager.GetSetCode(&element_pointer[0]);
if (element_pointer[0] == 0 || (element_pointer[0] == L'$' && element_pointer[1] == 0) || (element_pointer[0] == L'@' && element_pointer[1] == 0)) if(element_pointer[0] == 0 || (element_pointer[0] == L'$' && element_pointer[1] == 0) || (element_pointer[0] == L'@' && element_pointer[1] == 0))
query_elements_track.push_back(elements_iterator); query_elements_track.push_back(elements_iterator);
} }
for (auto elements_track_iterator = query_elements_track.begin(); elements_track_iterator != query_elements_track.end(); elements_track_iterator++) { for(auto elements_track_iterator = query_elements_track.begin(); elements_track_iterator != query_elements_track.end(); elements_track_iterator++)
query_elements.erase(*elements_track_iterator); query_elements.erase(*elements_track_iterator);
}
auto strpointer = dataManager._strings.begin(); auto strpointer = dataManager._strings.begin();
for(code_pointer ptr = dataManager._datas.begin(); ptr != dataManager._datas.end(); ++ptr, ++strpointer) { for(code_pointer ptr = dataManager._datas.begin(); ptr != dataManager._datas.end(); ++ptr, ++strpointer) {
const CardDataC& data = ptr->second; const CardDataC& data = ptr->second;
...@@ -945,14 +944,14 @@ void DeckBuilder::FilterCards() { ...@@ -945,14 +944,14 @@ void DeckBuilder::FilterCards() {
break; break;
} }
} else { } else {
if (!CardNameContains(text.name.c_str(), elements_iterator->c_str()) && text.text.find(elements_iterator->c_str()) == std::wstring::npos if(!CardNameContains(text.name.c_str(), elements_iterator->c_str()) && text.text.find(elements_iterator->c_str()) == std::wstring::npos
&& (!set_code_map[*elements_iterator] || !check_set_code(data, set_code_map[*elements_iterator]))) { && (!set_code_map[*elements_iterator] || !check_set_code(data, set_code_map[*elements_iterator]))) {
is_target = false; is_target = false;
break; break;
} }
} }
} }
if (is_target) if(is_target)
results.push_back(ptr); results.push_back(ptr);
else else
continue; continue;
......
...@@ -773,11 +773,13 @@ void Game::DrawGUI() { ...@@ -773,11 +773,13 @@ void Game::DrawGUI() {
env->drawAll(); env->drawAll();
} }
void Game::DrawSpec() { void Game::DrawSpec() {
s32 midx = 574 + (CARD_IMG_WIDTH * 0.5);
s32 midy = 150 + (CARD_IMG_HEIGHT * 0.5);
if(showcard) { if(showcard) {
switch(showcard) { switch(showcard) {
case 1: { case 1: {
driver->draw2DImage(imageManager.GetTexture(showcardcode, true), Resize(574, 150)); driver->draw2DImage(imageManager.GetTexture(showcardcode, true), ResizeCardHint(574, 150));
driver->draw2DImage(imageManager.tMask, Resize(574, 150, 574 + (showcarddif > CARD_IMG_WIDTH ? CARD_IMG_WIDTH : showcarddif), 150 + CARD_IMG_HEIGHT), driver->draw2DImage(imageManager.tMask, ResizeCardMid(574, 150, 574 + (showcarddif > CARD_IMG_WIDTH ? CARD_IMG_WIDTH : showcarddif), 150 + CARD_IMG_HEIGHT, midx, midy),
recti(CARD_IMG_HEIGHT - showcarddif, 0, CARD_IMG_HEIGHT - (showcarddif > CARD_IMG_WIDTH ? showcarddif - CARD_IMG_WIDTH : 0), CARD_IMG_HEIGHT), 0, 0, true); recti(CARD_IMG_HEIGHT - showcarddif, 0, CARD_IMG_HEIGHT - (showcarddif > CARD_IMG_WIDTH ? showcarddif - CARD_IMG_WIDTH : 0), CARD_IMG_HEIGHT), 0, 0, true);
showcarddif += 15; showcarddif += 15;
if(showcarddif >= CARD_IMG_HEIGHT) { if(showcarddif >= CARD_IMG_HEIGHT) {
...@@ -787,8 +789,8 @@ void Game::DrawSpec() { ...@@ -787,8 +789,8 @@ void Game::DrawSpec() {
break; break;
} }
case 2: { case 2: {
driver->draw2DImage(imageManager.GetTexture(showcardcode, true), Resize(574, 150)); driver->draw2DImage(imageManager.GetTexture(showcardcode, true), ResizeCardHint(574, 150));
driver->draw2DImage(imageManager.tMask, Resize(574 + showcarddif, 150, 574 + CARD_IMG_WIDTH, 150 + CARD_IMG_HEIGHT), driver->draw2DImage(imageManager.tMask, ResizeCardMid(574 + showcarddif, 150, 574 + CARD_IMG_WIDTH, 150 + CARD_IMG_HEIGHT, midx, midy),
recti(0, 0, CARD_IMG_WIDTH - showcarddif, CARD_IMG_HEIGHT), 0, 0, true); recti(0, 0, CARD_IMG_WIDTH - showcarddif, CARD_IMG_HEIGHT), 0, 0, true);
showcarddif += 15; showcarddif += 15;
if(showcarddif >= CARD_IMG_WIDTH) { if(showcarddif >= CARD_IMG_WIDTH) {
...@@ -797,8 +799,8 @@ void Game::DrawSpec() { ...@@ -797,8 +799,8 @@ void Game::DrawSpec() {
break; break;
} }
case 3: { case 3: {
driver->draw2DImage(imageManager.GetTexture(showcardcode, true), Resize(574, 150)); driver->draw2DImage(imageManager.GetTexture(showcardcode, true), ResizeCardHint(574, 150));
driver->draw2DImage(imageManager.tNegated, Resize(536 + showcarddif, 141 + showcarddif, 792 - showcarddif, 397 - showcarddif), recti(0, 0, 128, 128), 0, 0, true); driver->draw2DImage(imageManager.tNegated, ResizeCardMid(536 + showcarddif, 141 + showcarddif, 792 - showcarddif, 397 - showcarddif, midx, midy), recti(0, 0, 128, 128), 0, 0, true);
if(showcarddif < 64) if(showcarddif < 64)
showcarddif += 4; showcarddif += 4;
break; break;
...@@ -808,8 +810,8 @@ void Game::DrawSpec() { ...@@ -808,8 +810,8 @@ void Game::DrawSpec() {
matManager.c2d[1] = (showcarddif << 24) | 0xffffff; matManager.c2d[1] = (showcarddif << 24) | 0xffffff;
matManager.c2d[2] = (showcarddif << 24) | 0xffffff; matManager.c2d[2] = (showcarddif << 24) | 0xffffff;
matManager.c2d[3] = (showcarddif << 24) | 0xffffff; matManager.c2d[3] = (showcarddif << 24) | 0xffffff;
driver->draw2DImage(imageManager.GetTexture(showcardcode, true), Resize(574, 150, 574 + CARD_IMG_WIDTH, 150 + CARD_IMG_HEIGHT), driver->draw2DImage(imageManager.GetTexture(showcardcode, true), ResizeCardHint(574, 150, 574 + CARD_IMG_WIDTH, 150 + CARD_IMG_HEIGHT),
Resize(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, matManager.c2d, true); ResizeFit(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, matManager.c2d, true);
if(showcarddif < 255) if(showcarddif < 255)
showcarddif += 17; showcarddif += 17;
break; break;
...@@ -819,28 +821,34 @@ void Game::DrawSpec() { ...@@ -819,28 +821,34 @@ void Game::DrawSpec() {
matManager.c2d[1] = (showcarddif << 25) | 0xffffff; matManager.c2d[1] = (showcarddif << 25) | 0xffffff;
matManager.c2d[2] = (showcarddif << 25) | 0xffffff; matManager.c2d[2] = (showcarddif << 25) | 0xffffff;
matManager.c2d[3] = (showcarddif << 25) | 0xffffff; matManager.c2d[3] = (showcarddif << 25) | 0xffffff;
driver->draw2DImage(imageManager.GetTexture(showcardcode, true), Resize(662 - showcarddif * 0.69685f, 277 - showcarddif, 662 + showcarddif * 0.69685f, 277 + showcarddif), driver->draw2DImage(imageManager.GetTexture(showcardcode, true), ResizeCardMid(662 - showcarddif * 0.69685f, 277 - showcarddif, 662 + showcarddif * 0.69685f, 277 + showcarddif, midx, midy),
Resize(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, matManager.c2d, true); ResizeFit(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, matManager.c2d, true);
if(showcarddif < 127) if(showcarddif < 127)
showcarddif += 9; showcarddif += 9;
break; break;
} }
case 6: { case 6: {
driver->draw2DImage(imageManager.GetTexture(showcardcode, true), Resize(574, 150)); driver->draw2DImage(imageManager.GetTexture(showcardcode, true), ResizeCardHint(574, 150));
driver->draw2DImage(imageManager.tNumber, Resize(536 + showcarddif, 141 + showcarddif, 792 - showcarddif, 397 - showcarddif), driver->draw2DImage(imageManager.tNumber, ResizeCardMid(536 + showcarddif, 141 + showcarddif, 792 - showcarddif, 397 - showcarddif, midx, midy),
recti((showcardp % 5) * 64, (showcardp / 5) * 64, (showcardp % 5 + 1) * 64, (showcardp / 5 + 1) * 64), 0, 0, true); recti((showcardp % 5) * 64, (showcardp / 5) * 64, (showcardp % 5 + 1) * 64, (showcardp / 5 + 1) * 64), 0, 0, true);
if(showcarddif < 64) if(showcarddif < 64)
showcarddif += 4; showcarddif += 4;
break; break;
} }
case 7: { case 7: {
float mul = xScale;
if(xScale > yScale)
mul = yScale;
core::position2d<s32> corner[4]; core::position2d<s32> corner[4];
float y = sin(showcarddif * 3.1415926f / 180.0f) * CARD_IMG_HEIGHT * yScale; float y = sin(showcarddif * 3.1415926f / 180.0f) * CARD_IMG_HEIGHT * mul;
corner[0] = core::position2d<s32>(574 * xScale - (CARD_IMG_HEIGHT * yScale - y) * 0.3f, 404 * yScale - y); s32 winx = midx * xScale + (574 - midx) * mul;
corner[1] = core::position2d<s32>(751 * xScale + (CARD_IMG_HEIGHT * yScale - y) * 0.3f, 404 * yScale - y); s32 winx2 = midx * xScale + (751 - midx) * mul;
corner[2] = core::position2d<s32>(574 * xScale, 404 * yScale); s32 winy = midy * yScale + (404 - midy) * mul;
corner[3] = core::position2d<s32>(751 * xScale, 404 * yScale); corner[0] = core::position2d<s32>(winx - (CARD_IMG_HEIGHT * mul - y) * 0.3f, winy - y);
irr::gui::Draw2DImageQuad(driver, imageManager.GetTexture(showcardcode, true), Resize(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), corner); corner[1] = core::position2d<s32>(winx2 + (CARD_IMG_HEIGHT * mul - y) * 0.3f, winy - y);
corner[2] = core::position2d<s32>(winx, winy);
corner[3] = core::position2d<s32>(winx2, winy);
irr::gui::Draw2DImageQuad(driver, imageManager.GetTexture(showcardcode, true), ResizeFit(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), corner);
showcardp++; showcardp++;
showcarddif += 9; showcarddif += 9;
if(showcarddif >= 90) if(showcarddif >= 90)
...@@ -918,7 +926,7 @@ void Game::DrawSpec() { ...@@ -918,7 +926,7 @@ void Game::DrawSpec() {
DrawShadowText(lpcFont, lstr, ResizeElem(650 - pos.Width / 2, 290, 950, 370), Resize(-1, -1, 0, 0), 0xffffffff); DrawShadowText(lpcFont, lstr, ResizeElem(650 - pos.Width / 2, 290, 950, 370), Resize(-1, -1, 0, 0), 0xffffffff);
if(dInfo.vic_string && (showcardcode == 1 || showcardcode == 2)) { if(dInfo.vic_string && (showcardcode == 1 || showcardcode == 2)) {
driver->draw2DRectangle(0xa0000000, ResizeElem(540, 320, 800, 340)); driver->draw2DRectangle(0xa0000000, ResizeElem(540, 320, 800, 340));
DrawShadowText(textFont, dInfo.vic_string, ResizeElem(500, 320, 840, 340), Resize(-2, -1, 0, 0), 0xffffffff, 0xff000000, true, true, 0); DrawShadowText(guiFont, dInfo.vic_string, ResizeElem(500, 320, 840, 340), Resize(-2, -1, 0, 0), 0xffffffff, 0xff000000, true, true, 0);
} }
} else if(showcardp < showcarddif + 10) { } else if(showcardp < showcarddif + 10) {
int alpha = ((showcarddif + 10 - showcardp) * 25) << 24; int alpha = ((showcarddif + 10 - showcardp) * 25) << 24;
...@@ -957,7 +965,7 @@ void Game::DrawSpec() { ...@@ -957,7 +965,7 @@ void Game::DrawSpec() {
continue; continue;
if(!showChat && i > 2) if(!showChat && i > 2)
continue; continue;
int w = textFont->getDimension(chatMsg[i].c_str()).Width; int w = guiFont->getDimension(chatMsg[i].c_str()).Width;
recti rectloc(mainGame->wChat->getRelativePosition().UpperLeftCorner.X, mainGame->window_size.Height - 45, mainGame->wChat->getRelativePosition().UpperLeftCorner.X + 2 + w, mainGame->window_size.Height - 25); recti rectloc(mainGame->wChat->getRelativePosition().UpperLeftCorner.X, mainGame->window_size.Height - 45, mainGame->wChat->getRelativePosition().UpperLeftCorner.X + 2 + w, mainGame->window_size.Height - 25);
rectloc -= position2di(0, i * 20); rectloc -= position2di(0, i * 20);
...@@ -966,8 +974,8 @@ void Game::DrawSpec() { ...@@ -966,8 +974,8 @@ void Game::DrawSpec() {
recti shadowloc = msgloc + position2di(1, 1); recti shadowloc = msgloc + position2di(1, 1);
driver->draw2DRectangle(rectloc, 0xa0000000, 0xa0000000, 0xa0000000, 0xa0000000); driver->draw2DRectangle(rectloc, 0xa0000000, 0xa0000000, 0xa0000000, 0xa0000000);
textFont->draw(chatMsg[i].c_str(), msgloc, 0xff000000, false, false); guiFont->draw(chatMsg[i].c_str(), msgloc, 0xff000000, false, false);
textFont->draw(chatMsg[i].c_str(), shadowloc, chatColor[chatType[i]], false, false); guiFont->draw(chatMsg[i].c_str(), shadowloc, chatColor[chatType[i]], false, false);
} }
} }
} }
......
...@@ -1438,7 +1438,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1438,7 +1438,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
should_show_tip = true; should_show_tip = true;
myswprintf(formatBuffer, dataManager.GetSysString(1700), mainGame->btnCancelOrFinish->getText()); myswprintf(formatBuffer, dataManager.GetSysString(1700), mainGame->btnCancelOrFinish->getText());
mainGame->stTip->setText(formatBuffer); mainGame->stTip->setText(formatBuffer);
irr::core::dimension2d<unsigned int> dtip = mainGame->textFont->getDimension(formatBuffer) + irr::core::dimension2d<unsigned int>(10, 10); irr::core::dimension2d<unsigned int> dtip = mainGame->guiFont->getDimension(formatBuffer) + irr::core::dimension2d<unsigned int>(10, 10);
mainGame->stTip->setRelativePosition(mainGame->Resize(x - 10 - dtip.Width, y - 10 - dtip.Height, x - 10, y - 10)); mainGame->stTip->setRelativePosition(mainGame->Resize(x - 10 - dtip.Width, y - 10 - dtip.Height, x - 10, y - 10));
} }
mainGame->stTip->setVisible(should_show_tip); mainGame->stTip->setVisible(should_show_tip);
...@@ -1562,7 +1562,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1562,7 +1562,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 - dtip.Height, mousepos.X - 10, mousepos.Y - 10)); mainGame->stTip->setRelativePosition(recti(mousepos.X - 10 - dtip.Width, mousepos.Y - 10 - dtip.Height, mousepos.X - 10, mousepos.Y - 10));
mainGame->stTip->setText(str.c_str()); mainGame->stTip->setText(str.c_str());
} }
...@@ -1919,6 +1919,13 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1919,6 +1919,13 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true; return true;
break; break;
} }
case irr::KEY_KEY_X:
case irr::KEY_F12: {
if(!event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX))
mainGame->takeScreenshot();
return true;
break;
}
default: break; default: break;
} }
break; break;
......
...@@ -13,7 +13,12 @@ ...@@ -13,7 +13,12 @@
#ifndef _WIN32 #ifndef _WIN32
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h> #include <dirent.h>
#include <unistd.h>
#else
#include <direct.h>
#include <io.h>
#endif #endif
unsigned short PRO_VERSION = 0x1343; unsigned short PRO_VERSION = 0x1343;
...@@ -24,6 +29,7 @@ Game* mainGame; ...@@ -24,6 +29,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;
...@@ -36,7 +42,7 @@ bool Game::Initialize() { ...@@ -36,7 +42,7 @@ bool Game::Initialize() {
if(!device) if(!device)
return false; return false;
// Apply skin // Apply skin
if(gameConf.skin_index) { if(gameConf.skin_index && gameConf.use_d3d) {
wchar_t skin_dir[16]; wchar_t skin_dir[16];
myswprintf(skin_dir, L"skin"); myswprintf(skin_dir, L"skin");
skinSystem = new CGUISkinSystem(skin_dir, device); skinSystem = new CGUISkinSystem(skin_dir, device);
...@@ -86,7 +92,7 @@ bool Game::Initialize() { ...@@ -86,7 +92,7 @@ bool Game::Initialize() {
adFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 12); adFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 12);
lpcFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 48); lpcFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 48);
guiFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize); guiFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize);
textFont = guiFont; textFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize);
smgr = device->getSceneManager(); smgr = device->getSceneManager();
device->setWindowCaption(L"KoishiPro"); device->setWindowCaption(L"KoishiPro");
device->setResizable(true); device->setResizable(true);
...@@ -521,7 +527,7 @@ bool Game::Initialize() { ...@@ -521,7 +527,7 @@ bool Game::Initialize() {
//filters //filters
wFilter = env->addStaticText(L"", rect<s32>(610, 5, 1020, 130), true, false, 0, -1, true); wFilter = env->addStaticText(L"", rect<s32>(610, 5, 1020, 130), true, false, 0, -1, true);
wFilter->setVisible(false); wFilter->setVisible(false);
stCategory = env->addStaticText(dataManager.GetSysString(1311), rect<s32>(10, 25 / 6 + 2, 70, 22 + 25 / 6), false, false, wFilter); stCategory = env->addStaticText(dataManager.GetSysString(1311), rect<s32>(10, 2 + 25 / 6, 70, 22 + 25 / 6), false, false, wFilter);
cbCardType = env->addComboBox(rect<s32>(60, 25 / 6, 120, 20 + 25 / 6), wFilter, COMBOBOX_MAINTYPE); cbCardType = env->addComboBox(rect<s32>(60, 25 / 6, 120, 20 + 25 / 6), wFilter, COMBOBOX_MAINTYPE);
cbCardType->addItem(dataManager.GetSysString(1310)); cbCardType->addItem(dataManager.GetSysString(1310));
cbCardType->addItem(dataManager.GetSysString(1312)); cbCardType->addItem(dataManager.GetSysString(1312));
...@@ -1429,7 +1435,7 @@ void Game::ShowCardInfo(int code, bool resize) { ...@@ -1429,7 +1435,7 @@ void Game::ShowCardInfo(int code, bool resize) {
sc = aptr->second.setcode; sc = aptr->second.setcode;
} }
if(sc) { if(sc) {
offset = 23; offset = 23 * yScale;
myswprintf(formatBuffer, L"%ls%ls", dataManager.GetSysString(1329), dataManager.FormatSetName(sc)); myswprintf(formatBuffer, L"%ls%ls", dataManager.GetSysString(1329), dataManager.FormatSetName(sc));
stSetName->setText(formatBuffer); stSetName->setText(formatBuffer);
} else } else
...@@ -1470,29 +1476,30 @@ void Game::ShowCardInfo(int code, bool resize) { ...@@ -1470,29 +1476,30 @@ void Game::ShowCardInfo(int code, bool resize) {
wcscat(formatBuffer, scaleBuffer); wcscat(formatBuffer, scaleBuffer);
} }
stDataInfo->setText(formatBuffer); stDataInfo->setText(formatBuffer);
if ((cd.type & TYPE_LINK) && (cd.level > 5)) { if (cd.type & TYPE_LINK && cd.level > 5 && window_size.Width < 1220.0) {
stDataInfo->setRelativePosition(rect<s32>(15, 60, 296, 98)); stDataInfo->setRelativePosition(recti(15, 60 * yScale, 300 * xScale - 13, (83 + 15) * yScale));
stSetName->setRelativePosition(rect<s32>(15, 98, 296 * xScale, 121)); stSetName->setRelativePosition(rect<s32>(15, (83 + 15) * yScale, 296 * xScale, (83 + 15) * yScale + offset));
stText->setRelativePosition(rect<s32>(15, 98 + offset, 287 * xScale, 324 * yScale)); stText->setRelativePosition(rect<s32>(15, (83 + 15) * yScale + offset, 287 * xScale, 324 * yScale));
scrCardText->setRelativePosition(rect<s32>(287 * xScale - 20, 98 + offset, 287 * xScale, 324 * yScale)); scrCardText->setRelativePosition(rect<s32>(287 * xScale - 20, (83 + 15) + offset, 287 * xScale, 324 * yScale));
} else { } else {
stDataInfo->setRelativePosition(rect<s32>(15, 60, 296, 83)); stDataInfo->setRelativePosition(recti(15, 60 * yScale, 300 * xScale - 13, 83 * yScale));
stSetName->setRelativePosition(rect<s32>(15, 83, 296 * xScale, 106)); stSetName->setRelativePosition(rect<s32>(15, 83 * yScale, 296 * xScale, 83 * yScale + offset));
stText->setRelativePosition(rect<s32>(15, 83 + offset, 287 * xScale, 324 * yScale)); stText->setRelativePosition(rect<s32>(15, 83 * yScale + offset, 287 * xScale, 324 * yScale));
scrCardText->setRelativePosition(rect<s32>(287 * xScale - 20, 83 + offset, 287 * xScale, 324 * yScale)); scrCardText->setRelativePosition(rect<s32>(287 * xScale - 20, 83 + offset, 287 * xScale, 324 * yScale));
} }
} else { } else {
myswprintf(formatBuffer, L"[%ls]", dataManager.FormatType(cd.type)); myswprintf(formatBuffer, L"[%ls]", dataManager.FormatType(cd.type));
stInfo->setText(formatBuffer); stInfo->setText(formatBuffer);
stDataInfo->setRelativePosition(recti(15, 60 * yScale, 300 * xScale - 13, 83 * yScale));
stDataInfo->setText(L""); stDataInfo->setText(L"");
stSetName->setRelativePosition(rect<s32>(15, 60, 296 * xScale, 83)); stSetName->setRelativePosition(rect<s32>(15, 60 * yScale, 296 * xScale, 60 * yScale + offset));
stText->setRelativePosition(rect<s32>(15, 60 + offset, 287 * xScale, 324 * yScale)); stText->setRelativePosition(rect<s32>(15, 60 * yScale + offset, 287 * xScale, 324 * yScale));
scrCardText->setRelativePosition(rect<s32>(287 * xScale - 20, 60 + offset, 287 * xScale, 324 * yScale)); scrCardText->setRelativePosition(rect<s32>(287 * xScale - 20, 60 + offset, 287 * xScale, 324 * yScale));
} }
showingcode = code; showingcode = code;
showingtext = dataManager.GetText(code); showingtext = dataManager.GetText(code);
const auto& tsize = stText->getRelativePosition(); const auto& tsize = stText->getRelativePosition();
InitStaticText(stText, tsize.getWidth(), tsize.getHeight(), textFont, showingtext); InitStaticText(stText, tsize.getWidth(), tsize.getHeight(), guiFont, showingtext);
} }
void Game::AddChatMsg(wchar_t* msg, int player) { void Game::AddChatMsg(wchar_t* msg, int player) {
for(int i = 7; i > 0; --i) { for(int i = 7; i > 0; --i) {
...@@ -1539,6 +1546,9 @@ void Game::AddChatMsg(wchar_t* msg, int player) { ...@@ -1539,6 +1546,9 @@ void Game::AddChatMsg(wchar_t* msg, int player) {
chatMsg[0].append(L"[---]: "); chatMsg[0].append(L"[---]: ");
} }
chatMsg[0].append(msg); chatMsg[0].append(msg);
wchar_t msg_front[256];
myswprintf(msg_front, L"[Chat]%ls", chatMsg[0].c_str());
lstLog->addItem(msg_front);
} }
void Game::ClearChatMsg() { void Game::ClearChatMsg() {
for(int i = 7; i >= 0; --i) { for(int i = 7; i >= 0; --i) {
...@@ -1564,6 +1574,66 @@ void Game::AddDebugMsg(char* msg) ...@@ -1564,6 +1574,66 @@ void Game::AddDebugMsg(char* msg)
fclose(fp); fclose(fp);
} }
} }
bool Game::MakeDirectory(const std::string folder) {
std::string folder_builder;
std::string sub;
sub.reserve(folder.size());
for(auto it = folder.begin(); it != folder.end(); ++it) {
const char c = *it;
sub.push_back(c);
if(c == '/' || it == folder.end() - 1) {
folder_builder.append(sub);
if(access(folder_builder.c_str(), 0) != 0)
#ifdef _WIN32
if(mkdir(folder_builder.c_str()) != 0)
#else
if(mkdir(folder_builder.c_str(), 0777) != 0)
#endif
return false;
sub.clear();
}
}
return true;
}
void Game::initUtils() {
//user files
MakeDirectory("replay");
MakeDirectory("screenshots");
//cards from extra pack
MakeDirectory("expansions");
//files in ygopro-starter-pack
MakeDirectory("deck");
MakeDirectory("single");
//original files
MakeDirectory("script");
MakeDirectory("skin");
MakeDirectory("textures");
//subdirs in textures
MakeDirectory("textures/act");
MakeDirectory("textures/attack");
MakeDirectory("textures/bg");
MakeDirectory("textures/bg_deck");
MakeDirectory("textures/bg_menu");
MakeDirectory("textures/cover");
MakeDirectory("textures/cover2");
MakeDirectory("textures/pscale");
//sound
MakeDirectory("sound");
MakeDirectory("sound/BGM");
MakeDirectory("sound/BGM/advantage");
MakeDirectory("sound/BGM/deck");
MakeDirectory("sound/BGM/disadvantage");
MakeDirectory("sound/BGM/duel");
MakeDirectory("sound/BGM/lose");
MakeDirectory("sound/BGM/menu");
MakeDirectory("sound/BGM/win");
//custom sound
MakeDirectory("sound/custom");
MakeDirectory("sound/BGM/custom");
//pics
MakeDirectory("pics");
MakeDirectory("pics/field");
}
void Game::ClearTextures() { void Game::ClearTextures() {
matManager.mCard.setTexture(0, 0); matManager.mCard.setTexture(0, 0);
imgCard->setImage(imageManager.tCover[0]); imgCard->setImage(imageManager.tCover[0]);
...@@ -1639,17 +1709,22 @@ void Game::OnResize() { ...@@ -1639,17 +1709,22 @@ void Game::OnResize() {
irr::gui::CGUITTFont* old_numFont = numFont; irr::gui::CGUITTFont* old_numFont = numFont;
irr::gui::CGUITTFont* old_adFont = adFont; irr::gui::CGUITTFont* old_adFont = adFont;
irr::gui::CGUITTFont* old_lpcFont = lpcFont; irr::gui::CGUITTFont* old_lpcFont = lpcFont;
//irr::gui::CGUITTFont* old_guiFont = guiFont;
irr::gui::CGUITTFont* old_textFont = textFont;
numFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, (yScale > 0.5 ? 16 * yScale : 8)); numFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, (yScale > 0.5 ? 16 * yScale : 8));
adFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, (yScale > 0.75 ? 12 * yScale : 9)); adFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, (yScale > 0.75 ? 12 * yScale : 9));
lpcFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 48 * yScale); lpcFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 48 * yScale);
//guiFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize * yScale);
//env->getSkin()->setFont(guiFont);
textFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize * yScale);
old_numFont->drop(); old_numFont->drop();
old_adFont->drop(); old_adFont->drop();
old_lpcFont->drop(); old_lpcFont->drop();
//guiFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize * yScale); //old_guiFont->drop();
//env->getSkin()->setFont(guiFont); old_textFont->drop();
wMainMenu->setRelativePosition(ResizeWin(370, 200, 650, 415)); wMainMenu->setRelativePosition(ResizeWin(370, 200, 650, 415));
wDeckEdit->setRelativePosition(Resize(309, 8, 605, 130)); wDeckEdit->setRelativePosition(Resize(309, 5, 605, 130));
cbDBLFList->setRelativePosition(Resize(80, 5, 220, 30)); cbDBLFList->setRelativePosition(Resize(80, 5, 220, 30));
cbDBDecks->setRelativePosition(Resize(80, 35, 220, 60)); cbDBDecks->setRelativePosition(Resize(80, 35, 220, 60));
btnClearDeck->setRelativePosition(Resize(115, 99, 165, 120)); btnClearDeck->setRelativePosition(Resize(115, 99, 165, 120));
...@@ -1661,19 +1736,19 @@ void Game::OnResize() { ...@@ -1661,19 +1736,19 @@ void Game::OnResize() {
wSort->setRelativePosition(Resize(930, 132, 1020, 156)); wSort->setRelativePosition(Resize(930, 132, 1020, 156));
cbSortType->setRelativePosition(Resize(10, 2, 85, 22)); cbSortType->setRelativePosition(Resize(10, 2, 85, 22));
wFilter->setRelativePosition(Resize(610, 8, 1020, 130)); wFilter->setRelativePosition(Resize(610, 5, 1020, 130));
scrFilter->setRelativePosition(Resize(999, 161, 1019, 629)); scrFilter->setRelativePosition(Resize(999, 161, 1019, 629));
cbCardType->setRelativePosition(Resize(60, 3, 120, 23)); cbCardType->setRelativePosition(Resize(60, 25 / 6, 120, 20 + 25 / 6));
cbCardType2->setRelativePosition(Resize(130, 3, 190, 23)); cbCardType2->setRelativePosition(Resize(130, 25 / 6, 190, 20 + 25 / 6));
cbRace->setRelativePosition(Resize(60, 49, 190, 69)); cbRace->setRelativePosition(Resize(60, 40 + 75 / 6, 190, 60 + 75 / 6));
cbAttribute->setRelativePosition(Resize(60, 26, 190, 46)); cbAttribute->setRelativePosition(Resize(60, 20 + 50 / 6, 190, 40 + 50 / 6));
cbLimit->setRelativePosition(Resize(260, 3, 390, 23)); cbLimit->setRelativePosition(Resize(260, 25 / 6, 390, 20 + 25 / 6));
ebStar->setRelativePosition(Resize(60, 72, 100, 92)); ebStar->setRelativePosition(Resize(60, 60 + 100 / 6, 95, 80 + 100 / 6));
ebScale->setRelativePosition(Resize(150, 72, 190, 92)); ebScale->setRelativePosition(Resize(155, 60 + 100 / 6, 190, 80 + 100 / 6));
ebAttack->setRelativePosition(Resize(260, 26, 340, 46)); ebAttack->setRelativePosition(Resize(260, 20 + 50 / 6, 340, 40 + 50 / 6));
ebDefense->setRelativePosition(Resize(260, 49, 340, 69)); ebDefense->setRelativePosition(Resize(260, 40 + 75 / 6, 340, 60 + 75 / 6));
ebCardName->setRelativePosition(Resize(260, 72, 390, 92)); ebCardName->setRelativePosition(Resize(260, 60 + 100 / 6, 390, 80 + 100 / 6));
btnEffectFilter->setRelativePosition(Resize(345, 28, 390, 69)); btnEffectFilter->setRelativePosition(Resize(345, 20 + 50 / 6, 390, 60 + 75 / 6));
btnStartFilter->setRelativePosition(Resize(260, 80 + 125 / 6, 390, 100 + 125 / 6)); btnStartFilter->setRelativePosition(Resize(260, 80 + 125 / 6, 390, 100 + 125 / 6));
if(btnClearFilter) if(btnClearFilter)
btnClearFilter->setRelativePosition(Resize(205, 80 + 125 / 6, 255, 100 + 125 / 6)); btnClearFilter->setRelativePosition(Resize(205, 80 + 125 / 6, 255, 100 + 125 / 6));
...@@ -1681,17 +1756,17 @@ void Game::OnResize() { ...@@ -1681,17 +1756,17 @@ void Game::OnResize() {
wCategories->setRelativePosition(ResizeWin(450, 60, 1000, 270)); wCategories->setRelativePosition(ResizeWin(450, 60, 1000, 270));
wLinkMarks->setRelativePosition(ResizeWin(700, 30, 820, 150)); wLinkMarks->setRelativePosition(ResizeWin(700, 30, 820, 150));
stBanlist->setRelativePosition(ResizeWin(10, 9, 100, 29)); stBanlist->setRelativePosition(Resize(10, 9, 100, 29));
stDeck->setRelativePosition(ResizeWin(10, 39, 100, 59)); stDeck->setRelativePosition(Resize(10, 39, 100, 59));
stCategory->setRelativePosition(ResizeWin(10, 5, 70, 25)); stCategory->setRelativePosition(Resize(10, 2 + 25 / 6, 70, 22 + 25 / 6));
stLimit->setRelativePosition(ResizeWin(205, 5, 280, 25)); stLimit->setRelativePosition(Resize(205, 2 + 25 / 6, 280, 22 + 25 / 6));
stAttribute->setRelativePosition(ResizeWin(10, 28, 70, 48)); stAttribute->setRelativePosition(Resize(10, 22 + 50 / 6, 70, 42 + 50 / 6));
stRace->setRelativePosition(ResizeWin(10, 51, 70, 71)); stRace->setRelativePosition(Resize(10, 42 + 75 / 6, 70, 62 + 75 / 6));
stAttack->setRelativePosition(ResizeWin(205, 28, 280, 48)); stAttack->setRelativePosition(Resize(205, 22 + 50 / 6, 280, 42 + 50 / 6));
stDefense->setRelativePosition(ResizeWin(205, 51, 280, 71)); stDefense->setRelativePosition(Resize(205, 42 + 75 / 6, 280, 62 + 75 / 6));
stStar->setRelativePosition(ResizeWin(10, 74, 80, 94)); stStar->setRelativePosition(Resize(10, 62 + 100 / 6, 70, 82 + 100 / 6));
stSearch->setRelativePosition(ResizeWin(205, 74, 280, 94)); stSearch->setRelativePosition(Resize(205, 62 + 100 / 6, 280, 82 + 100 / 6));
stScale->setRelativePosition(ResizeWin(110, 74, 150, 94)); stScale->setRelativePosition(Resize(105, 62 + 100 / 6, 165, 82 + 100 / 6));
btnSideOK->setRelativePosition(Resize(510, 40, 820, 80)); btnSideOK->setRelativePosition(Resize(510, 40, 820, 80));
btnSideShuffle->setRelativePosition(Resize(310, 100, 370, 130)); btnSideShuffle->setRelativePosition(Resize(310, 100, 370, 130));
btnSideSort->setRelativePosition(Resize(375, 100, 435, 130)); btnSideSort->setRelativePosition(Resize(375, 100, 435, 130));
...@@ -1744,7 +1819,9 @@ void Game::OnResize() { ...@@ -1744,7 +1819,9 @@ void Game::OnResize() {
wCardImg->setRelativePosition(ResizeCard(1, 1, 20, 18)); wCardImg->setRelativePosition(ResizeCard(1, 1, 20, 18));
imgCard->setRelativePosition(ResizeCard(10, 9, 0, 0)); imgCard->setRelativePosition(ResizeCard(10, 9, 0, 0));
wInfos->setRelativePosition(Resize(1, 275, 301, 639)); wInfos->setRelativePosition(Resize(1, 275, 301, 639));
stName->setRelativePosition(recti(10, 10, 287 * xScale, 32)); stName->setRelativePosition(recti(10, 10, 300 * xScale - 13, 10 + 22 * yScale));
stInfo->setRelativePosition(recti(15, 37 * yScale, 300 * xScale - 13, 60 * yScale));
//stDataInfo->setRelativePosition(recti(15, 60 * yScale, 300 * xScale - 13, 83 * yScale));
lstLog->setRelativePosition(Resize(10, 10, 290, 290)); lstLog->setRelativePosition(Resize(10, 10, 290, 290));
//const auto& tsize = stText->getRelativePosition(); //const auto& tsize = stText->getRelativePosition();
if(showingcode) if(showingcode)
...@@ -1838,6 +1915,44 @@ recti Game::ResizeCard(s32 x, s32 y, s32 x2, s32 y2) { ...@@ -1838,6 +1915,44 @@ recti Game::ResizeCard(s32 x, s32 y, s32 x2, s32 y2) {
y2 = sy + y; y2 = sy + y;
return recti(x, y, x2, y2); return recti(x, y, x2, y2);
} }
recti Game::ResizeCardHint(s32 x, s32 y, s32 x2, s32 y2) {
return ResizeCardMid(x, y, x2, y2, (x + x2) * 0.5, (y + y2) * 0.5);
}
position2di Game::ResizeCardHint(s32 x, s32 y) {
return ResizeCardMid(x, y, x + CARD_IMG_WIDTH * 0.5, y + CARD_IMG_HEIGHT * 0.5);
}
recti Game::ResizeCardMid(s32 x, s32 y, s32 x2, s32 y2, s32 midx, s32 midy) {
float mul = xScale;
if(xScale > yScale)
mul = yScale;
s32 cx = midx * xScale;
s32 cy = midy * yScale;
x = cx + (x - midx) * mul;
y = cy + (y - midy) * mul;
x2 = cx + (x2 - midx) * mul;
y2 = cy + (y2 - midy) * mul;
return recti(x, y, x2, y2);
}
position2di Game::ResizeCardMid(s32 x, s32 y, s32 midx, s32 midy) {
float mul = xScale;
if(xScale > yScale)
mul = yScale;
s32 cx = midx * xScale;
s32 cy = midy * yScale;
x = cx + (x - midx) * mul;
y = cy + (y - midy) * mul;
return position2di(x, y);
}
recti Game::ResizeFit(s32 x, s32 y, s32 x2, s32 y2) {
float mul = xScale;
if(xScale > yScale)
mul = yScale;
x = x * mul;
y = y * mul;
x2 = x2 * mul;
y2 = y2 * mul;
return recti(x, y, x2, y2);
}
void Game::SetWindowsIcon() { void Game::SetWindowsIcon() {
#ifdef _WIN32 #ifdef _WIN32
HINSTANCE hInstance = (HINSTANCE)GetModuleHandleW(NULL); HINSTANCE hInstance = (HINSTANCE)GetModuleHandleW(NULL);
...@@ -1858,6 +1973,17 @@ void Game::FlashWindow() { ...@@ -1858,6 +1973,17 @@ void Game::FlashWindow() {
FlashWindowEx(&fi); FlashWindowEx(&fi);
#endif #endif
} }
void Game::takeScreenshot() {
irr::video::IImage* const image = driver->createScreenShot();
if(image) {
irr::c8 filename[64];
snprintf(filename, 64, "screenshots/ygopro_%u.png", device->getTimer()->getRealTime());
if (!driver->writeImageToFile(image, filename))
device->getLogger()->log(L"Failed to take screenshot.", irr::ELL_WARNING);
image->drop();
} else
device->getLogger()->log(L"Failed to take screenshot.", irr::ELL_WARNING);
}
void Game::SetCursor(ECURSOR_ICON icon) { void Game::SetCursor(ECURSOR_ICON icon) {
ICursorControl* cursor = mainGame->device->getCursorControl(); ICursorControl* cursor = mainGame->device->getCursorControl();
if(cursor->getActiveIcon() != icon) { if(cursor->getActiveIcon() != icon) {
......
...@@ -147,6 +147,8 @@ public: ...@@ -147,6 +147,8 @@ public:
void AddChatMsg(wchar_t* msg, int player); void AddChatMsg(wchar_t* msg, int player);
void ClearChatMsg(); void ClearChatMsg();
void AddDebugMsg(char* msgbuf); void AddDebugMsg(char* msgbuf);
bool MakeDirectory(const std::string folder);
void initUtils();
void ClearTextures(); void ClearTextures();
void CloseDuelWindow(); void CloseDuelWindow();
...@@ -166,9 +168,15 @@ public: ...@@ -166,9 +168,15 @@ public:
recti ResizeElem(s32 x, s32 y, s32 x2, s32 y2); recti ResizeElem(s32 x, s32 y, s32 x2, s32 y2);
recti ResizeWin(s32 x, s32 y, s32 x2, s32 y2, bool chat = false); recti ResizeWin(s32 x, s32 y, s32 x2, s32 y2, bool chat = false);
recti ResizeCard(s32 x, s32 y, s32 x2, s32 y2); recti ResizeCard(s32 x, s32 y, s32 x2, s32 y2);
recti ResizeCardHint(s32 x, s32 y, s32 x2, s32 y2);
position2di ResizeCardHint(s32 x, s32 y);
recti ResizeCardMid(s32 x, s32 y, s32 x2, s32 y2, s32 midx, s32 midy);
position2di ResizeCardMid(s32 x, s32 y, s32 midx, s32 midy);
recti ResizeFit(s32 x, s32 y, s32 x2, s32 y2);
void SetWindowsIcon(); void SetWindowsIcon();
void FlashWindow(); void FlashWindow();
void takeScreenshot();
void SetCursor(ECURSOR_ICON icon); void SetCursor(ECURSOR_ICON icon);
Mutex gMutex; Mutex gMutex;
......
...@@ -268,14 +268,25 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) { ...@@ -268,14 +268,25 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
int width = CARD_IMG_WIDTH; int width = CARD_IMG_WIDTH;
int height = CARD_IMG_HEIGHT; int height = CARD_IMG_HEIGHT;
if(fit) { if(fit) {
width = width * mainGame->xScale; float mul = mainGame->xScale;
height = height * mainGame->yScale; if(mainGame->xScale > mainGame->yScale)
mul = mainGame->yScale;
width = width * mul;
height = height * mul;
} }
auto tit = tMap[fit ? 1 : 0].find(code); auto tit = tMap[fit ? 1 : 0].find(code);
if(tit == tMap[fit ? 1 : 0].end()) { if(tit == tMap[fit ? 1 : 0].end()) {
char file[256]; char file[256];
sprintf(file, "expansions/pics/%d.jpg", code); sprintf(file, "expansions/pics/%d.png", code);
irr::video::ITexture* img = GetTextureFromFile(file, width, height); irr::video::ITexture* img = GetTextureFromFile(file, width, height);
if(img == NULL) {
sprintf(file, "expansions/pics/%d.jpg", code);
img = GetTextureFromFile(file, width, height);
}
if(img == NULL) {
sprintf(file, "pics/%d.png", code);
img = GetTextureFromFile(file, width, height);
}
if(img == NULL) { if(img == NULL) {
sprintf(file, "pics/%d.jpg", code); sprintf(file, "pics/%d.jpg", code);
img = GetTextureFromFile(file, width, height); img = GetTextureFromFile(file, width, height);
...@@ -300,15 +311,31 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) { ...@@ -300,15 +311,31 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
int height = CARD_THUMB_HEIGHT * mainGame->yScale; int height = CARD_THUMB_HEIGHT * mainGame->yScale;
if(tit == tThumb.end()) { if(tit == tThumb.end()) {
char file[256]; char file[256];
sprintf(file, "expansions/pics/thumbnail/%d.jpg", code); sprintf(file, "expansions/pics/thumbnail/%d.png", code);
irr::video::ITexture* img = GetTextureFromFile(file, width, height); irr::video::ITexture* img = GetTextureFromFile(file, width, height);
if(img == NULL) {
sprintf(file, "expansions/pics/thumbnail/%d.jpg", code);
img = GetTextureFromFile(file, width, height);
}
if(img == NULL) {
sprintf(file, "pics/thumbnail/%d.png", code);
img = GetTextureFromFile(file, width, height);
}
if(img == NULL) { if(img == NULL) {
sprintf(file, "pics/thumbnail/%d.jpg", code); sprintf(file, "pics/thumbnail/%d.jpg", code);
img = GetTextureFromFile(file, width, height); img = GetTextureFromFile(file, width, height);
} }
if(img == NULL && mainGame->gameConf.use_image_scale) { if(img == NULL && mainGame->gameConf.use_image_scale) {
sprintf(file, "expansions/pics/%d.jpg", code); sprintf(file, "expansions/pics/%d.png", code);
img = GetTextureFromFile(file, width, height); img = GetTextureFromFile(file, width, height);
if(img == NULL) {
sprintf(file, "expansions/pics/%d.jpg", code);
img = GetTextureFromFile(file, width, height);
}
if(img == NULL) {
sprintf(file, "pics/%d.png", code);
img = GetTextureFromFile(file, width, height);
}
if(img == NULL) { if(img == NULL) {
sprintf(file, "pics/%d.jpg", code); sprintf(file, "pics/%d.jpg", code);
img = GetTextureFromFile(file, width, height); img = GetTextureFromFile(file, width, height);
......
Subproject commit 482e002181d7a007ffe04d4bb8cb4a8b5e4d2e28 Subproject commit 92ad9db2a69bbaf4a07ef0173fe3ee03615b1f24
...@@ -9,7 +9,7 @@ solution "ygo" ...@@ -9,7 +9,7 @@ solution "ygo"
end end
end end
configurations { "Debug", "Release" } configurations { "Release", "Debug" }
defines { "LUA_COMPAT_5_2" } defines { "LUA_COMPAT_5_2" }
configuration "windows" configuration "windows"
defines { "WIN32", "_WIN32", "WINVER=0x0501" } defines { "WIN32", "_WIN32", "WINVER=0x0501" }
...@@ -44,7 +44,7 @@ solution "ygo" ...@@ -44,7 +44,7 @@ solution "ygo"
configuration { "Release", "vs*" } configuration { "Release", "vs*" }
flags { "StaticRuntime", "LinkTimeOptimization" } flags { "StaticRuntime", "LinkTimeOptimization" }
disablewarnings { "4244", "4267", "4838", "4577", "4819", "4018", "4996", "4477", "4091" } disablewarnings { "4244", "4267", "4838", "4577", "4819", "4018", "4996", "4477", "4091", "4305" }
configuration { "Release", "not vs*" } configuration { "Release", "not vs*" }
symbols "On" symbols "On"
......
Subproject commit 63aa6c77dae13e742d43f92528ca7a84ec80b7d8 Subproject commit be6d9d319603f81d44d73d86d93804bb290f9bda
...@@ -240,6 +240,9 @@ ...@@ -240,6 +240,9 @@
!system 1161 效果处理 !system 1161 效果处理
!system 1162 效果重置 !system 1162 效果重置
!system 1163 灵摆召唤 !system 1163 灵摆召唤
!system 1164 同调召唤
!system 1165 超量召唤
!system 1166 连接召唤
#menu #menu
!system 1200 联机模式 !system 1200 联机模式
!system 1201 单人模式 !system 1201 单人模式
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#nickname & gamename should be less than 20 characters #nickname & gamename should be less than 20 characters
use_d3d = 0 use_d3d = 0
use_image_scale = 1 use_image_scale = 1
pro_version = 4930 pro_version = 4931
antialias = 2 antialias = 2
errorlog = 3 errorlog = 3
nickname = Komeiji Koishi nickname = Komeiji Koishi
......
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