Commit 5751227a authored by nanahira's avatar nanahira

Merge branch 'server' of https://github.com/purerosefallen/ygopro

parents 47d865eb 1c11f84a
No preview for this file type
......@@ -92,6 +92,7 @@ using namespace gui;
extern unsigned short PRO_VERSION;
extern int enable_log;
extern bool exit_on_return;
extern bool auto_watch_mode;
extern bool open_file;
extern wchar_t open_file_name[256];
extern bool bot_mode;
......
......@@ -233,6 +233,8 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
}
}
event_base_loopexit(client_base, 0);
if(exit_on_return && auto_watch_mode)
mainGame->device->closeDevice();
}
}
int DuelClient::ClientThread(void* param) {
......@@ -728,6 +730,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->dInfo.isReplaySkiping = false;
mainGame->wSurrender->setVisible(false);
mainGame->stMessage->setText(dataManager.GetSysString(1500));
if(!auto_watch_mode) {
mainGame->PopupElement(mainGame->wMessage);
mainGame->gMutex.Unlock();
mainGame->actionSignal.Reset();
......@@ -736,6 +739,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->closeSignal.Set();
mainGame->closeDoneSignal.Wait();
mainGame->gMutex.Lock();
}
mainGame->dInfo.isStarted = false;
mainGame->dInfo.isFinished = true;
mainGame->dInfo.announce_cache.clear();
......@@ -2173,7 +2177,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
mainGame->WaitFrameSignal(5);
}
if (panel_confirm.size()) {
if (panel_confirm.size() && !auto_watch_mode) {
std::sort(panel_confirm.begin(), panel_confirm.end(), ClientCard::client_card_sort);
mainGame->gMutex.Lock();
mainGame->dField.selectable_cards = panel_confirm;
......
......@@ -10,6 +10,7 @@
int enable_log = 0;
#ifndef YGOPRO_SERVER_MODE
bool exit_on_return = false;
bool auto_watch_mode = false;
bool open_file = false;
wchar_t open_file_name[256] = L"";
bool bot_mode = false;
......@@ -168,6 +169,8 @@ int main(int argc, char* argv[]) {
} else if(!wcscmp(wargv[i], L"-k")) { // Keep on return
exit_on_return = false;
keep_on_return = true;
} else if(!wcscmp(wargv[i], L"--auto-watch")) { // Auto watch mode
auto_watch_mode = true;
} else if(!wcscmp(wargv[i], L"-d")) { // Deck
++i;
if(i + 1 < wargc) { // select deck
......
......@@ -18,10 +18,9 @@ bool ImageManager::Initial() {
tCover[3] = GetTextureFromFile("textures/cover2.jpg", CARD_IMG_WIDTH, CARD_IMG_HEIGHT);
if(!tCover[3])
tCover[3] = tCover[2];
//tUnknown = NULL;
tUnknown[0] = NULL;
tUnknown[1] = NULL;
tUnknown[2] = NULL;
tUnknown = NULL;
tUnknownFit = NULL;
tUnknownThumb = NULL;
tAct = GetRandomImage(TEXTURE_ACTIVATE);
tAttack = GetRandomImage(TEXTURE_ATTACK);
if(!tAct)
......@@ -135,11 +134,6 @@ void ImageManager::ClearTexture() {
tMap[1].clear();
tThumb.clear();
tFields.clear();
for(int i = 0; i < 3; ++i)
if(tUnknown[i] != NULL) {
driver->removeTexture(tUnknown[i]);
tUnknown[i] = NULL;
}
}
void ImageManager::RemoveTexture(int code) {
auto tit = tMap[0].find(code);
......@@ -158,6 +152,11 @@ void ImageManager::RemoveTexture(int code) {
void ImageManager::ResizeTexture() {
irr::s32 imgWidth = CARD_IMG_WIDTH * mainGame->xScale;
irr::s32 imgHeight = CARD_IMG_HEIGHT * mainGame->yScale;
irr::s32 imgWidthThumb = CARD_THUMB_WIDTH * mainGame->xScale;
irr::s32 imgHeightThumb = CARD_THUMB_HEIGHT * mainGame->yScale;
float mul = (mainGame->xScale > mainGame->yScale) ? mainGame->yScale : mainGame->xScale;
irr::s32 imgWidthFit = CARD_IMG_WIDTH * mul;
irr::s32 imgHeightFit = CARD_IMG_HEIGHT * mul;
irr::s32 bgWidth = 1024 * mainGame->xScale;
irr::s32 bgHeight = 640 * mainGame->yScale;
driver->removeTexture(tCover[0]);
......@@ -172,8 +171,12 @@ void ImageManager::ResizeTexture() {
tCover[1] = GetRandomImage(TEXTURE_COVER_S, imgWidth, imgHeight);
if(!tCover[1])
tCover[1] = tCover[0];
//driver->removeTexture(tUnknown);
//tUnknown = GetTextureFromFile("textures/unknown.jpg", imgWidth, imgHeight);
driver->removeTexture(tUnknown);
driver->removeTexture(tUnknownFit);
driver->removeTexture(tUnknownThumb);
tUnknown = GetTextureFromFile("textures/unknown.jpg", CARD_IMG_WIDTH, CARD_IMG_HEIGHT);
tUnknownFit = GetTextureFromFile("textures/unknown.jpg", imgWidthFit, imgHeightFit);
tUnknownThumb = GetTextureFromFile("textures/unknown.jpg", imgWidthThumb, imgHeightThumb);
driver->removeTexture(tBackGround);
tBackGround = GetRandomImage(TEXTURE_DUEL, bgWidth, bgHeight);
if(!tBackGround)
......@@ -297,11 +300,6 @@ irr::video::ITexture* ImageManager::GetTextureFromFile(char* file, s32 width, s3
return driver->getTexture(name);
}
}
irr::video::ITexture* ImageManager::GetTextureUnknown(s32 width, s32 height, int index) {
if(tUnknown[index] == NULL)
tUnknown[index] = GetTextureFromFile("textures/unknown.jpg", width, height);
return tUnknown[index];
}
irr::video::ITexture* ImageManager::GetTextureExpansions(char* file, s32 width, s32 height) {
irr::video::ITexture* img = GetTextureExpansionsDirectry("./expansions", file, width, height);
if(img != NULL)
......@@ -326,6 +324,8 @@ irr::video::ITexture* ImageManager::GetTextureExpansionsDirectry(const char* pat
return GetTextureFromFile(fpath, width, height);
}
irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
if(code == 0)
return fit ? tUnknownFit : tUnknown;
int width = CARD_IMG_WIDTH;
int height = CARD_IMG_HEIGHT;
if(fit) {
......@@ -335,8 +335,6 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
width = width * mul;
height = height * mul;
}
if(code == 0)
return GetTextureUnknown(width, height, fit ? 1 : 0);
auto tit = tMap[fit ? 1 : 0].find(code);
if(tit == tMap[fit ? 1 : 0].end()) {
char file[256];
......@@ -367,19 +365,19 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
return GetTextureThumb(code);
}
tMap[fit ? 1 : 0][code] = img;
return (img == NULL) ? GetTextureUnknown(width, height, fit ? 1 : 0) : img;
return (img == NULL) ? (fit ? tUnknownFit : tUnknown) : img;
}
if(tit->second)
return tit->second;
else
return mainGame->gameConf.use_image_scale ? GetTextureUnknown(width, height, fit ? 1 : 0) : GetTextureThumb(code);
return mainGame->gameConf.use_image_scale ? (fit ? tUnknownFit : tUnknown) : GetTextureThumb(code);
}
irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
if(code == 0)
return tUnknownThumb;
auto tit = tThumb.find(code);
int width = CARD_THUMB_WIDTH * mainGame->xScale;
int height = CARD_THUMB_HEIGHT * mainGame->yScale;
if(code == 0)
return GetTextureUnknown(width, height, 2);
if(tit == tThumb.end()) {
char file[256];
sprintf(file, "pics/thumbnail/%d.png", code);
......@@ -429,12 +427,53 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
}
}
tThumb[code] = img;
return (img == NULL) ? GetTextureUnknown(width, height, 2) : img;
return (img == NULL) ? tUnknownThumb : img;
}
if(tit->second)
return tit->second;
else
return GetTextureUnknown(width, height, 2);
return tUnknownThumb;
if(code == 0)
auto tit = tFields.find(code);
if(tit == tFields.end()) {
char file[256];
sprintf(file, "pics/field/%d.png", code);
irr::video::ITexture* img = GetTextureExpansions(file, 512 * mainGame->xScale, 512 * mainGame->yScale);
if(img == NULL) {
sprintf(file, "pics/field/%d.jpg", code);
img = GetTextureExpansions(file, 512 * mainGame->xScale, 512 * mainGame->yScale);
}
if(img == NULL) {
sprintf(file, mainGame->GetLocaleDir("pics/field/%d.png"), code);
img = GetTextureFromFile(file, 512 * mainGame->xScale, 512 * mainGame->yScale);
}
if(img == NULL) {
sprintf(file, mainGame->GetLocaleDir("pics/field/%d.jpg"), code);
img = GetTextureFromFile(file, 512 * mainGame->xScale, 512 * mainGame->yScale);
}
if(img == NULL) {
sprintf(file, "pics/field/%d.png", code);
img = GetTextureFromFile(file, 512 * mainGame->xScale, 512 * mainGame->yScale);
}
if(img == NULL) {
sprintf(file, "pics/field/%d.jpg", code);
img = GetTextureFromFile(file, 512 * mainGame->xScale, 512 * mainGame->yScale);
if(img == NULL) {
tFields[code] = NULL;
return NULL;
} else {
tFields[code] = img;
return img;
}
} else {
tFields[code] = img;
return img;
}
}
if(tit->second)
return tit->second;
else
return NULL;
}
irr::video::ITexture* ImageManager::GetTextureField(int code) {
if(code == 0)
......
......@@ -22,7 +22,6 @@ public:
void RemoveTexture(int code);
void ResizeTexture();
irr::video::ITexture* GetTextureFromFile(char* file, s32 width, s32 height);
irr::video::ITexture* GetTextureUnknown(s32 width, s32 height, int index);
irr::video::ITexture* GetTextureExpansions(char* file, s32 width, s32 height);
irr::video::ITexture* GetTextureExpansionsDirectry(const char* path, char* file, s32 width, s32 height);
irr::video::ITexture* GetTexture(int code, bool fit = false);
......@@ -35,7 +34,9 @@ public:
irr::IrrlichtDevice* device;
irr::video::IVideoDriver* driver;
irr::video::ITexture* tCover[4];
irr::video::ITexture* tUnknown[3];
irr::video::ITexture* tUnknown;
irr::video::ITexture* tUnknownFit;
irr::video::ITexture* tUnknownThumb;
irr::video::ITexture* tAct;
irr::video::ITexture* tAttack;
irr::video::ITexture* tNegated;
......
......@@ -543,6 +543,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
message.append(wlinebuf);
}
}
fclose(fp);
mainGame->SetStaticText(mainGame->stSinglePlayInfo, 200, mainGame->guiFont, message.c_str());
break;
}
......
This diff is collapsed.
Subproject commit e1b3239967a34da9f7bcd42a62778e785fbaf321
Subproject commit 8cb95d93c71c09a49eb56dbb9a96518bde4661a8
......@@ -4,11 +4,23 @@ solution "ygo"
objdir "obj"
configurations { "Release", "Debug" }
defines { "LUA_COMPAT_5_2", "YGOPRO_SERVER_MODE" } --, "YGOPRO_LUA_SAVE" }
if os.getenv("YGOPRO_NO_LUA_SAFE") then
defines { "LUA_COMPAT_5_2", "YGOPRO_SERVER_MODE" }
else
defines { "LUA_COMPAT_5_2", "YGOPRO_SERVER_MODE" } --, "YGOPRO_LUA_SAFE" }
end
configuration "windows"
defines { "WIN32", "_WIN32" }
startproject "ygopro"
if os.getenv("YGOPRO_USE_XP_TOOLSET") then
configuration { "windows", "vs2017" }
toolset "v141_xp"
configuration { "windows", "not vs2017" }
toolset "v140_xp"
end
configuration "bsd"
defines { "LUA_USE_POSIX" }
includedirs { "/usr/local/include" }
......
Subproject commit 2ce1259b08b57f15f636e99a6a02172cbf0dffd3
Subproject commit f3c20205858de66cd956871c3e1db1a5a62b6638
......@@ -111,6 +111,7 @@
!system 531 请选择上级召唤用需要解放的怪兽
!system 532 请选择要取除超量素材的怪兽
!system 533 请选择连接召唤的素材
!system 534 请选择要保留在场上的卡
!system 549 请选择攻击的对象
!system 550 请选择要发动的效果
!system 551 请选择效果的对象
......@@ -131,6 +132,7 @@
!system 569 请选择[%ls]的位置
!system 570 请选择要变成不能使用的卡片区域
!system 571 请选择要移动到的位置
!system 572 请选择要放置指示物的卡
!system 1000 卡组
!system 1001 手卡
!system 1002 怪兽区
......@@ -499,6 +501,7 @@
!victory 0x1c 「幻煌龙的天涡」效果胜利
!victory 0x1d 「方程式运动员胜利团队」效果胜利
!victory 0x1e 「飞行象」效果胜利
!victory 0x1f 「守护神 艾克佐迪亚」效果胜利
!victory 0x20 由于「%ls」的效果获得比赛胜利
#counters
!counter 0x1 魔力指示物
......@@ -953,3 +956,7 @@
!setname 0x124 机械天使 機械天使
!setname 0x125 笑容 スマイル
!setname 0x126 时间怪盗 Time Thief
!setname 0x127 无限起动 無限起動
!setname 0x128 魔女术 ウィッチクラフト
!setname 0x129 咒眼 呪眼
!setname 0x12a 恩底弥翁 エンディミオン
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