Skip to content

Commit e48406e

Browse files
committed
Merge branch 'master' of https://github.com/Fluorohydride/ygopro
2 parents b156ec3 + 2f3ef6a commit e48406e

File tree

4 files changed

+78
-13
lines changed

4 files changed

+78
-13
lines changed

gframe/client_field.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,8 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
445445
mainGame->stCardPos[i]->setOverrideColor(0xff0000ff);
446446
if(selectable_cards[i]->overlayTarget->controler)
447447
mainGame->stCardPos[i]->setBackgroundColor(0xffd0d0d0);
448-
else mainGame->stCardPos[i]->setBackgroundColor(0xffffffff);
448+
else
449+
mainGame->stCardPos[i]->setBackgroundColor(0xffffffff);
449450
} else if(selectable_cards[i]->location == LOCATION_DECK || selectable_cards[i]->location == LOCATION_EXTRA || selectable_cards[i]->location == LOCATION_REMOVED) {
450451
if(selectable_cards[i]->position & POS_FACEDOWN)
451452
mainGame->stCardPos[i]->setOverrideColor(0xff0000ff);
@@ -465,7 +466,8 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
465466
wchar_t formatBuffer[2048];
466467
myswprintf(formatBuffer, L"%d", sort_list[i]);
467468
mainGame->stCardPos[i]->setText(formatBuffer);
468-
} else mainGame->stCardPos[i]->setText(L"");
469+
} else
470+
mainGame->stCardPos[i]->setText(L"");
469471
mainGame->stCardPos[i]->setBackgroundColor(0xffffffff);
470472
}
471473
mainGame->stCardPos[i]->setVisible(true);

gframe/event_handler.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -881,8 +881,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
881881
mainGame->btnCardSelect[i]->setRelativePosition(rect<s32>(30 + i * 125, 55, 30 + 120 + i * 125, 225));
882882
// text
883883
wchar_t formatBuffer[2048];
884-
if(sort_list.size()) {
885-
if(sort_list[pos + i] > 0)
884+
if(mainGame->dInfo.curMsg == MSG_SORT_CARD) {
885+
if(sort_list[pos + i])
886886
myswprintf(formatBuffer, L"%d", sort_list[pos + i]);
887887
else
888888
myswprintf(formatBuffer, L"");
@@ -2541,6 +2541,7 @@ void ClientField::CancelOrFinish() {
25412541
if(mainGame->wCardSelect->isVisible()) {
25422542
DuelClient::SetResponseI(-1);
25432543
mainGame->HideElement(mainGame->wCardSelect, true);
2544+
sort_list.clear();
25442545
}
25452546
break;
25462547
}

gframe/game.cpp

Lines changed: 63 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,70 @@ bool Game::Initialize() {
7171
dataManager.LoadStrings("./expansions/strings.conf");
7272
env = device->getGUIEnvironment();
7373
numFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 16);
74-
adFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 12);
75-
lpcFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 48);
76-
guiFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize);
74+
if(!numFont) {
75+
const wchar_t* numFontPaths[] = {
76+
L"C:/Windows/Fonts/arialbd.ttf",
77+
L"/usr/share/fonts/truetype/DroidSansFallbackFull.ttf",
78+
L"/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc",
79+
L"/usr/share/fonts/google-noto-cjk/NotoSansCJK-Bold.ttc",
80+
L"/System/Library/Fonts/SFNSTextCondensed-Bold.otf",
81+
L"/System/Library/Fonts/SFNS.ttf",
82+
L"./fonts/numFont.ttf",
83+
L"./fonts/numFont.ttc",
84+
L"./fonts/numFont.otf"
85+
};
86+
for(const wchar_t* path : numFontPaths) {
87+
myswprintf(gameConf.numfont, path);
88+
numFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 16);
89+
if(numFont)
90+
break;
91+
}
92+
}
7793
textFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize);
94+
if(!textFont) {
95+
const wchar_t* textFontPaths[] = {
96+
L"C:/Windows/Fonts/msyh.ttc",
97+
L"C:/Windows/Fonts/msyh.ttf",
98+
L"C:/Windows/Fonts/simsun.ttc",
99+
L"/usr/share/fonts/truetype/DroidSansFallbackFull.ttf",
100+
L"/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc",
101+
L"/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc",
102+
L"/System/Library/Fonts/PingFang.ttc",
103+
L"./fonts/textFont.ttf",
104+
L"./fonts/textFont.ttc",
105+
L"./fonts/textFont.otf"
106+
};
107+
for(const wchar_t* path : textFontPaths) {
108+
myswprintf(gameConf.textfont, path);
109+
textFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize);
110+
if(textFont)
111+
break;
112+
}
113+
}
78114
if(!numFont || !textFont) {
79-
ErrorLog("Failed to load font(s)!");
80-
return false;
115+
wchar_t fpath[1024];
116+
fpath[0] = 0;
117+
FileSystem::TraversalDir(L"./fonts", [&fpath](const wchar_t* name, bool isdir) {
118+
if(!isdir && wcsrchr(name, '.') && (!mywcsncasecmp(wcsrchr(name, '.'), L".ttf", 4) || !mywcsncasecmp(wcsrchr(name, '.'), L".ttc", 4) || !mywcsncasecmp(wcsrchr(name, '.'), L".otf", 4))) {
119+
myswprintf(fpath, L"./fonts/%ls", name);
120+
}
121+
});
122+
if(fpath[0] == 0) {
123+
ErrorLog("Failed to load font(s)!");
124+
return false;
125+
}
126+
if(!numFont) {
127+
myswprintf(gameConf.numfont, fpath);
128+
numFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 16);
129+
}
130+
if(!textFont) {
131+
myswprintf(gameConf.textfont, fpath);
132+
textFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize);
133+
}
81134
}
135+
adFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 12);
136+
lpcFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 48);
137+
guiFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize);
82138
smgr = device->getSceneManager();
83139
device->setWindowCaption(L"YGOPro");
84140
device->setResizable(true);
@@ -762,7 +818,6 @@ bool Game::Initialize() {
762818
stCardListTip->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
763819
stCardListTip->setVisible(false);
764820
device->setEventReceiver(&menuHandler);
765-
LoadConfig();
766821
if(!soundManager.Init()) {
767822
chkEnableSound->setChecked(false);
768823
chkEnableSound->setEnabled(false);
@@ -1080,7 +1135,7 @@ void Game::LoadConfig() {
10801135
gameConf.use_image_scale = 1;
10811136
gameConf.antialias = 0;
10821137
gameConf.serverport = 7911;
1083-
gameConf.textfontsize = 12;
1138+
gameConf.textfontsize = 14;
10841139
gameConf.nickname[0] = 0;
10851140
gameConf.gamename[0] = 0;
10861141
gameConf.lastdeck[0] = 0;
@@ -1133,7 +1188,7 @@ void Game::LoadConfig() {
11331188
enable_log = atoi(valbuf);
11341189
} else if(!strcmp(strbuf, "textfont")) {
11351190
BufferIO::DecodeUTF8(valbuf, wstr);
1136-
int textfontsize;
1191+
int textfontsize = gameConf.textfontsize;
11371192
sscanf(linebuf, "%s = %s %d", strbuf, valbuf, &textfontsize);
11381193
gameConf.textfontsize = textfontsize;
11391194
BufferIO::CopyWStr(wstr, gameConf.textfont, 256);

strings.conf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@
601601
!counter 0x56 炎星指示物
602602
!counter 0x57 幻魔指示物
603603
!counter 0x58 指示物(祢须三破鸣比)
604+
!counter 0x59 落魂指示物
604605
#setnames, using tab for comment
605606
!setname 0x1 正义盟军 A・O・J
606607
!setname 0x2 次世代 ジェネクス
@@ -776,7 +777,9 @@
776777
!setname 0x7c 炎舞
777778
!setname 0x7d 阳炎 ヘイズ
778779
!setname 0x107d 阳炎兽 陽炎獣
779-
!setname 0x7e 异热同心武器 ZW(ゼアル・ウェポン)
780+
!setname 0x7e 异热同心 ゼアル
781+
!setname 0x107e 异热同心武器 ZW(ゼアル・ウェポン)
782+
!setname 0x207e 异热同心从者 ZS(ゼアル・サーバス)
780783
!setname 0x7f 霍普 ホープ
781784
!setname 0x107f 希望皇 霍普 希望皇ホープ
782785
!setname 0x207f 未来皇 霍普 未来皇ホープ
@@ -1053,3 +1056,7 @@
10531056
!setname 0x2158 圣天树 サンアバロン
10541057
!setname 0x159 圣夜骑士 ホーリーナイツ
10551058
!setname 0x15a 人偶怪兽 ドール・モンスター
1059+
!setname 0x15b 惊乐 アメイズメント
1060+
!setname 0x15c 游乐设施 アトラクション
1061+
!setname 0x15d 烙印
1062+
!setname 0x15e 降阶魔法 RDM

0 commit comments

Comments
 (0)