Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaoye
ygopro
Commits
c8e0b04e
Commit
c8e0b04e
authored
Jun 17, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into server-develop
parents
a2614631
bd56c1a2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
192 additions
and
83 deletions
+192
-83
gframe/config.h
gframe/config.h
+2
-0
gframe/data_manager.cpp
gframe/data_manager.cpp
+5
-10
gframe/game.cpp
gframe/game.cpp
+59
-35
gframe/game.h
gframe/game.h
+9
-3
gframe/gframe.cpp
gframe/gframe.cpp
+47
-0
gframe/image_manager.cpp
gframe/image_manager.cpp
+70
-35
No files found.
gframe/config.h
View file @
c8e0b04e
...
@@ -116,5 +116,7 @@ extern bool auto_watch_mode;
...
@@ -116,5 +116,7 @@ extern bool auto_watch_mode;
extern
bool
open_file
;
extern
bool
open_file
;
extern
wchar_t
open_file_name
[
256
];
extern
wchar_t
open_file_name
[
256
];
extern
bool
bot_mode
;
extern
bool
bot_mode
;
extern
bool
expansions_specified
;
extern
std
::
vector
<
std
::
wstring
>
expansions_list
;
#endif
#endif
gframe/data_manager.cpp
View file @
c8e0b04e
...
@@ -434,19 +434,14 @@ unsigned char* DataManager::ScriptReaderEx(const char* script_name, int* slen) {
...
@@ -434,19 +434,14 @@ unsigned char* DataManager::ScriptReaderEx(const char* script_name, int* slen) {
buffer
=
ScriptReaderExSingle
(
"specials/"
,
script_name
,
slen
,
9
);
buffer
=
ScriptReaderExSingle
(
"specials/"
,
script_name
,
slen
,
9
);
if
(
buffer
)
if
(
buffer
)
return
buffer
;
return
buffer
;
buffer
=
ScriptReaderExSingle
(
"expansions/"
,
script_name
,
slen
);
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
(
"/"
))
{
if
(
buffer
)
buffer
=
ScriptReaderExSingle
(
ex
.
c_str
(),
script_name
,
slen
);
return
buffer
;
if
(
buffer
)
#if defined(SERVER_PRO3_SUPPORT) && !defined(_WIN32)
return
buffer
;
buffer
=
ScriptReaderExSingle
(
"Expansions/"
,
script_name
,
slen
);
}
if
(
buffer
)
return
buffer
;
#endif
#if !defined(YGOPRO_SERVER_MODE) || defined(SERVER_ZIP_SUPPORT)
buffer
=
ScriptReaderExSingle
(
""
,
script_name
,
slen
,
2
,
TRUE
);
buffer
=
ScriptReaderExSingle
(
""
,
script_name
,
slen
,
2
,
TRUE
);
if
(
buffer
)
if
(
buffer
)
return
buffer
;
return
buffer
;
#endif
return
ScriptReaderExSingle
(
""
,
script_name
,
slen
);
return
ScriptReaderExSingle
(
""
,
script_name
,
slen
);
}
}
unsigned
char
*
DataManager
::
ScriptReaderExSingle
(
const
char
*
path
,
const
char
*
script_name
,
int
*
slen
,
int
pre_len
,
unsigned
int
use_irr
)
{
unsigned
char
*
DataManager
::
ScriptReaderExSingle
(
const
char
*
path
,
const
char
*
script_name
,
int
*
slen
,
int
pre_len
,
unsigned
int
use_irr
)
{
...
...
gframe/game.cpp
View file @
c8e0b04e
...
@@ -97,7 +97,7 @@ void Game::MainServerLoop() {
...
@@ -97,7 +97,7 @@ void Game::MainServerLoop() {
initUtils
();
initUtils
();
deckManager
.
LoadLFList
();
deckManager
.
LoadLFList
();
dataManager
.
LoadDB
(
L"cards.cdb"
);
dataManager
.
LoadDB
(
L"cards.cdb"
);
LoadExpansions();
LoadExpansions
All
();
#ifdef SERVER_PRO2_SUPPORT
#ifdef SERVER_PRO2_SUPPORT
DataManager
::
FileSystem
->
addFileArchive
(
"data/script.zip"
,
true
,
false
,
irr
::
io
::
EFAT_ZIP
);
DataManager
::
FileSystem
->
addFileArchive
(
"data/script.zip"
,
true
,
false
,
irr
::
io
::
EFAT_ZIP
);
#endif
#endif
...
@@ -115,7 +115,7 @@ void Game::MainServerLoop() {
...
@@ -115,7 +115,7 @@ void Game::MainServerLoop() {
}
}
}
}
void
Game
::
MainTestLoop
(
int
code
)
{
void
Game
::
MainTestLoop
(
int
code
)
{
LoadExpansions();
LoadExpansions
All
();
dataManager
.
LoadDB
(
L"cards.cdb"
);
dataManager
.
LoadDB
(
L"cards.cdb"
);
fflush
(
stdout
);
fflush
(
stdout
);
NetServer
::
InitTestCard
(
code
);
NetServer
::
InitTestCard
(
code
);
...
@@ -179,7 +179,6 @@ bool Game::Initialize() {
...
@@ -179,7 +179,6 @@ bool Game::Initialize() {
ErrorLog
(
"Failed to load strings!"
);
ErrorLog
(
"Failed to load strings!"
);
return
false
;
return
false
;
}
}
LoadExpansions();
dataManager
.
LoadDB
(
L"specials/special.cdb"
);
dataManager
.
LoadDB
(
L"specials/special.cdb"
);
env
=
device
->
getGUIEnvironment
();
env
=
device
->
getGUIEnvironment
();
numFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
16
);
numFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
16
);
...
@@ -1100,6 +1099,7 @@ bool Game::Initialize() {
...
@@ -1100,6 +1099,7 @@ bool Game::Initialize() {
return
true
;
return
true
;
}
}
void
Game
::
MainLoop
()
{
void
Game
::
MainLoop
()
{
LoadExpansionsAll
();
wchar_t
cap
[
256
];
wchar_t
cap
[
256
];
camera
=
smgr
->
addCameraSceneNode
(
0
);
camera
=
smgr
->
addCameraSceneNode
(
0
);
irr
::
core
::
matrix4
mProjection
;
irr
::
core
::
matrix4
mProjection
;
...
@@ -1286,41 +1286,12 @@ std::wstring Game::SetStaticText(irr::gui::IGUIStaticText* pControl, irr::u32 cW
...
@@ -1286,41 +1286,12 @@ std::wstring Game::SetStaticText(irr::gui::IGUIStaticText* pControl, irr::u32 cW
return
ret
;
return
ret
;
}
}
#endif //YGOPRO_SERVER_MODE
#endif //YGOPRO_SERVER_MODE
void Game::LoadExpansions() {
void
Game
::
LoadExpansions
(
const
wchar_t
*
expansions_path
)
{
#ifdef SERVER_PRO2_SUPPORT
FileSystem
::
TraversalDir
(
expansions_path
,
[
&
](
const
wchar_t
*
name
,
bool
isdir
)
{
FileSystem::TraversalDir(L"./cdb", [](const wchar_t* name, bool isdir) {
if (isdir)
return;
wchar_t fpath[1024];
myswprintf(fpath, L"./cdb/%ls", name);
if(IsExtension(name, L".cdb")) {
dataManager.LoadDB(fpath);
}
});
#endif // SERVER_PRO2_SUPPORT
#ifdef SERVER_PRO3_SUPPORT
FileSystem::TraversalDir(L"./Data/locales/zh-CN", [](const wchar_t* name, bool isdir) {
wchar_t fpath[1024];
myswprintf(fpath, L"./Data/locales/zh-CN/%ls", name);
if(!isdir && IsExtension(name, L".cdb")) {
dataManager.LoadDB(fpath);
}
});
#ifndef _WIN32
FileSystem::TraversalDir(L"./Expansions", [](const wchar_t* name, bool isdir) {
wchar_t fpath[1024];
myswprintf(fpath, L"./Expansions/%ls", name);
if(!isdir && IsExtension(name, L".cdb")) {
dataManager.LoadDB(fpath);
}
});
#endif
#endif // SERVER_PRO3_SUPPORT
FileSystem::TraversalDir(L"./expansions", [](const wchar_t* name, bool isdir) {
if
(
isdir
)
if
(
isdir
)
return
;
return
;
wchar_t
fpath
[
1024
];
wchar_t
fpath
[
1024
];
myswprintf(fpath, L"
./expansions/%ls"
, name);
myswprintf
(
fpath
,
L"
%ls/%ls"
,
expansions_path
,
name
);
if
(
IsExtension
(
name
,
L".cdb"
))
{
if
(
IsExtension
(
name
,
L".cdb"
))
{
dataManager
.
LoadDB
(
fpath
);
dataManager
.
LoadDB
(
fpath
);
return
;
return
;
...
@@ -1391,6 +1362,59 @@ void Game::LoadExpansions() {
...
@@ -1391,6 +1362,59 @@ void Game::LoadExpansions() {
}
}
#endif //SERVER_ZIP_SUPPORT
#endif //SERVER_ZIP_SUPPORT
}
}
void
Game
::
LoadExpansionsAll
()
{
#ifdef SERVER_PRO2_SUPPORT
FileSystem
::
TraversalDir
(
L"./cdb"
,
[](
const
wchar_t
*
name
,
bool
isdir
)
{
if
(
isdir
)
return
;
wchar_t
fpath
[
1024
];
myswprintf
(
fpath
,
L"./cdb/%ls"
,
name
);
if
(
IsExtension
(
name
,
L".cdb"
))
{
dataManager
.
LoadDB
(
fpath
);
}
});
#endif // SERVER_PRO2_SUPPORT
#ifdef SERVER_PRO3_SUPPORT
FileSystem
::
TraversalDir
(
L"./Data/locales/zh-CN"
,
[](
const
wchar_t
*
name
,
bool
isdir
)
{
wchar_t
fpath
[
1024
];
myswprintf
(
fpath
,
L"./Data/locales/zh-CN/%ls"
,
name
);
if
(
!
isdir
&&
IsExtension
(
name
,
L".cdb"
))
{
dataManager
.
LoadDB
(
fpath
);
}
});
#endif // SERVER_PRO3_SUPPORT
auto
list
=
GetExpansionsList
();
for
(
const
auto
&
exp
:
list
)
{
LoadExpansions
(
exp
.
c_str
());
}
}
std
::
vector
<
std
::
wstring
>
Game
::
GetExpansionsList
(
const
wchar_t
*
suffix
)
{
if
(
!
suffix
)
return
expansions_list
;
std
::
vector
<
std
::
wstring
>
list
;
wchar_t
buf
[
1024
];
for
(
const
auto
&
exp
:
expansions_list
)
{
myswprintf
(
buf
,
L"%ls%ls"
,
exp
.
c_str
(),
suffix
);
list
.
push_back
(
buf
);
}
return
list
;
}
std
::
vector
<
std
::
string
>
Game
::
GetExpansionsListU
(
const
char
*
suffix
)
{
auto
list
=
GetExpansionsList
(
nullptr
);
std
::
vector
<
std
::
string
>
expansions_list_u
;
char
exp_u
[
1024
];
char
exp_u2
[
1024
];
for
(
const
auto
&
exp
:
list
)
{
BufferIO
::
EncodeUTF8
(
exp
.
c_str
(),
exp_u
);
if
(
!
suffix
)
expansions_list_u
.
push_back
(
exp_u
);
else
{
std
::
snprintf
(
exp_u2
,
sizeof
exp_u2
,
"%s%s"
,
exp_u
,
suffix
);
expansions_list_u
.
push_back
(
exp_u2
);
}
}
return
expansions_list_u
;
}
#ifndef YGOPRO_SERVER_MODE
#ifndef YGOPRO_SERVER_MODE
void
Game
::
RefreshCategoryDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
,
bool
selectlastused
)
{
void
Game
::
RefreshCategoryDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
,
bool
selectlastused
)
{
cbCategory
->
clear
();
cbCategory
->
clear
();
...
...
gframe/game.h
View file @
c8e0b04e
...
@@ -193,7 +193,10 @@ public:
...
@@ -193,7 +193,10 @@ public:
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
void
MainServerLoop
();
void
MainServerLoop
();
void
MainTestLoop
(
int
code
);
void
MainTestLoop
(
int
code
);
void
LoadExpansions
();
void
LoadExpansions
(
const
wchar_t
*
expansions_path
);
void
LoadExpansionsAll
();
std
::
vector
<
std
::
wstring
>
GetExpansionsList
(
const
wchar_t
*
suffix
=
nullptr
);
std
::
vector
<
std
::
string
>
GetExpansionsListU
(
const
char
*
suffix
=
nullptr
);
void
AddDebugMsg
(
const
char
*
msgbuf
);
void
AddDebugMsg
(
const
char
*
msgbuf
);
void
initUtils
();
void
initUtils
();
void
InjectEnvToRegistry
(
intptr_t
pduel
);
void
InjectEnvToRegistry
(
intptr_t
pduel
);
...
@@ -203,8 +206,11 @@ public:
...
@@ -203,8 +206,11 @@ public:
void
BuildProjectionMatrix
(
irr
::
core
::
matrix4
&
mProjection
,
irr
::
f32
left
,
irr
::
f32
right
,
irr
::
f32
bottom
,
irr
::
f32
top
,
irr
::
f32
znear
,
irr
::
f32
zfar
);
void
BuildProjectionMatrix
(
irr
::
core
::
matrix4
&
mProjection
,
irr
::
f32
left
,
irr
::
f32
right
,
irr
::
f32
bottom
,
irr
::
f32
top
,
irr
::
f32
znear
,
irr
::
f32
zfar
);
void
InitStaticText
(
irr
::
gui
::
IGUIStaticText
*
pControl
,
irr
::
u32
cWidth
,
irr
::
u32
cHeight
,
irr
::
gui
::
CGUITTFont
*
font
,
const
wchar_t
*
text
);
void
InitStaticText
(
irr
::
gui
::
IGUIStaticText
*
pControl
,
irr
::
u32
cWidth
,
irr
::
u32
cHeight
,
irr
::
gui
::
CGUITTFont
*
font
,
const
wchar_t
*
text
);
std
::
wstring
SetStaticText
(
irr
::
gui
::
IGUIStaticText
*
pControl
,
irr
::
u32
cWidth
,
irr
::
gui
::
CGUITTFont
*
font
,
const
wchar_t
*
text
,
irr
::
u32
pos
=
0
);
std
::
wstring
SetStaticText
(
irr
::
gui
::
IGUIStaticText
*
pControl
,
irr
::
u32
cWidth
,
irr
::
gui
::
CGUITTFont
*
font
,
const
wchar_t
*
text
,
irr
::
u32
pos
=
0
);
void
LoadExpansions
();
void
LoadExpansions
(
const
wchar_t
*
expansions_path
);
void
RefreshCategoryDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
,
bool
selectlastused
=
true
);
void
LoadExpansionsAll
();
std
::
vector
<
std
::
wstring
>
GetExpansionsList
(
const
wchar_t
*
suffix
=
nullptr
);
std
::
vector
<
std
::
string
>
GetExpansionsListU
(
const
char
*
suffix
=
nullptr
);
void
RefreshCategoryDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
,
bool
selectlastused
=
true
);
void
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshDeck
(
const
wchar_t
*
deckpath
,
const
std
::
function
<
void
(
const
wchar_t
*
)
>&
additem
);
void
RefreshDeck
(
const
wchar_t
*
deckpath
,
const
std
::
function
<
void
(
const
wchar_t
*
)
>&
additem
);
void
RefreshReplay
();
void
RefreshReplay
();
...
...
gframe/gframe.cpp
View file @
c8e0b04e
...
@@ -9,7 +9,13 @@
...
@@ -9,7 +9,13 @@
#import <CoreFoundation/CoreFoundation.h>
#import <CoreFoundation/CoreFoundation.h>
#endif
#endif
#ifdef YGOPRO_SERVER_MODE
#include <sstream>
#endif
unsigned
int
enable_log
=
0x3
;
unsigned
int
enable_log
=
0x3
;
bool
expansions_specified
=
false
;
std
::
vector
<
std
::
wstring
>
expansions_list
;
#ifndef YGOPRO_SERVER_MODE
#ifndef YGOPRO_SERVER_MODE
bool
exit_on_return
=
false
;
bool
exit_on_return
=
false
;
bool
auto_watch_mode
=
false
;
bool
auto_watch_mode
=
false
;
...
@@ -72,6 +78,36 @@ int main(int argc, char* argv[]) {
...
@@ -72,6 +78,36 @@ int main(int argc, char* argv[]) {
ygo
::
Game
_game
;
ygo
::
Game
_game
;
#ifdef YGOPRO_SERVER_MODE
#ifdef YGOPRO_SERVER_MODE
enable_log
=
1
;
enable_log
=
1
;
bool
expansions_specified
=
false
;
wchar_t
*
expansions_env_val
=
nullptr
;
#ifdef _WIN32
expansions_env_val
=
_wgetenv
(
L"YGOPRO_EXPANSIONS"
);
#else
const
char
*
env_utf8
=
std
::
getenv
(
"YGOPRO_EXPANSIONS"
);
if
(
env_utf8
)
{
expansions_env_val
=
(
wchar_t
*
)
malloc
(
1024
*
sizeof
(
wchar_t
));
BufferIO
::
DecodeUTF8String
(
env_utf8
,
expansions_env_val
,
1024
);
}
#endif
if
(
expansions_env_val
&&
expansions_env_val
[
0
]
!=
L'\0'
)
{
expansions_specified
=
true
;
std
::
wstringstream
ss
(
expansions_env_val
);
std
::
wstring
item
;
while
(
std
::
getline
(
ss
,
item
,
L','
))
{
if
(
!
item
.
empty
())
{
expansions_list
.
push_back
(
item
);
}
}
}
else
{
expansions_specified
=
false
;
expansions_list
.
push_back
(
L"./expansions"
);
#if defined(SERVER_PRO3_SUPPORT) && !defined(_WIN32) && !defined(__APPLE__)
expansions_list
.
push_back
(
L"./Expansions"
);
#endif
}
ygo
::
server_port
=
7911
;
ygo
::
server_port
=
7911
;
ygo
::
replay_mode
=
0
;
ygo
::
replay_mode
=
0
;
ygo
::
duel_flags
=
0
;
ygo
::
duel_flags
=
0
;
...
@@ -157,6 +193,7 @@ int main(int argc, char* argv[]) {
...
@@ -157,6 +193,7 @@ int main(int argc, char* argv[]) {
bool
keep_on_return
=
false
;
bool
keep_on_return
=
false
;
bool
deckCategorySpecified
=
false
;
bool
deckCategorySpecified
=
false
;
expansions_list
.
push_back
(
L"./expansions"
);
for
(
int
i
=
1
;
i
<
wargc
;
++
i
)
{
for
(
int
i
=
1
;
i
<
wargc
;
++
i
)
{
if
(
wargc
==
2
&&
std
::
wcslen
(
wargv
[
1
])
>=
4
)
{
if
(
wargc
==
2
&&
std
::
wcslen
(
wargv
[
1
])
>=
4
)
{
wchar_t
*
pstrext
=
wargv
[
1
]
+
std
::
wcslen
(
wargv
[
1
])
-
4
;
wchar_t
*
pstrext
=
wargv
[
1
]
+
std
::
wcslen
(
wargv
[
1
])
-
4
;
...
@@ -281,6 +318,16 @@ int main(int argc, char* argv[]) {
...
@@ -281,6 +318,16 @@ int main(int argc, char* argv[]) {
if
(
open_file
)
if
(
open_file
)
ClickButton
(
ygo
::
mainGame
->
btnLoadSinglePlay
);
ClickButton
(
ygo
::
mainGame
->
btnLoadSinglePlay
);
break
;
break
;
}
else
if
(
!
std
::
wcscmp
(
wargv
[
i
],
L"--expansions"
))
{
// specify expansions
++
i
;
if
(
i
<
wargc
)
{
if
(
!
expansions_specified
)
{
expansions_list
.
clear
();
expansions_specified
=
true
;
}
expansions_list
.
push_back
(
wargv
[
i
]);
}
continue
;
}
}
}
}
ygo
::
mainGame
->
MainLoop
();
ygo
::
mainGame
->
MainLoop
();
...
...
gframe/image_manager.cpp
View file @
c8e0b04e
...
@@ -330,11 +330,16 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
...
@@ -330,11 +330,16 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
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
];
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.png"
,
code
);
irr
::
video
::
ITexture
*
img
=
nullptr
;
irr
::
video
::
ITexture
*
img
=
GetTextureFromFile
(
file
,
width
,
height
);
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
{
if
(
img
==
nullptr
)
{
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.jpg"
,
code
);
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/%d.png"
,
ex
.
c_str
(),
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/%d.jpg"
,
ex
.
c_str
(),
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
}
}
if
(
img
==
nullptr
)
{
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.png"
),
code
);
std
::
snprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.png"
),
code
);
...
@@ -373,8 +378,12 @@ irr::video::ITexture* ImageManager::GetBigPicture(int code, float zoom) {
...
@@ -373,8 +378,12 @@ irr::video::ITexture* ImageManager::GetBigPicture(int code, float zoom) {
}
}
irr
::
video
::
ITexture
*
texture
;
irr
::
video
::
ITexture
*
texture
;
char
file
[
256
];
char
file
[
256
];
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.jpg"
,
code
);
irr
::
video
::
IImage
*
srcimg
=
nullptr
;
irr
::
video
::
IImage
*
srcimg
=
driver
->
createImageFromFile
(
file
);
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
if
(
srcimg
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/%d.jpg"
,
ex
.
c_str
(),
code
);
srcimg
=
driver
->
createImageFromFile
(
file
);
}
if
(
srcimg
==
nullptr
)
{
if
(
srcimg
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"pics/%d.jpg"
,
code
);
std
::
snprintf
(
file
,
sizeof
file
,
"pics/%d.jpg"
,
code
);
srcimg
=
driver
->
createImageFromFile
(
file
);
srcimg
=
driver
->
createImageFromFile
(
file
);
...
@@ -402,11 +411,16 @@ int ImageManager::LoadThumbThread() {
...
@@ -402,11 +411,16 @@ int ImageManager::LoadThumbThread() {
imageManager
.
tThumbLoadingCodes
.
pop
();
imageManager
.
tThumbLoadingCodes
.
pop
();
imageManager
.
tThumbLoadingMutex
.
unlock
();
imageManager
.
tThumbLoadingMutex
.
unlock
();
char
file
[
256
];
char
file
[
256
];
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/thumbnail/%d.png"
,
code
);
irr
::
video
::
IImage
*
img
=
nullptr
;
irr
::
video
::
IImage
*
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
{
if
(
img
==
nullptr
)
{
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/thumbnail/%d.jpg"
,
code
);
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/thumbnail/%d.png"
,
ex
.
c_str
(),
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/thumbnail/%d.jpg"
,
ex
.
c_str
(),
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
}
}
if
(
img
==
nullptr
)
{
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/thumbnail/%d.png"
),
code
);
std
::
snprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/thumbnail/%d.png"
),
code
);
...
@@ -425,11 +439,15 @@ int ImageManager::LoadThumbThread() {
...
@@ -425,11 +439,15 @@ int ImageManager::LoadThumbThread() {
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
}
if
(
img
==
nullptr
&&
mainGame
->
gameConf
.
use_image_scale
)
{
if
(
img
==
nullptr
&&
mainGame
->
gameConf
.
use_image_scale
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.png"
,
code
);
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
{
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
if
(
img
==
nullptr
)
{
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/%d.png"
,
ex
.
c_str
(),
code
);
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.jpg"
,
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/%d.jpg"
,
ex
.
c_str
(),
code
);
img
=
imageManager
.
driver
->
createImageFromFile
(
file
);
}
}
}
if
(
img
==
nullptr
)
{
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.png"
),
code
);
std
::
snprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/%d.png"
),
code
);
...
@@ -488,24 +506,31 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
...
@@ -488,24 +506,31 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
auto
tit
=
tThumb
.
find
(
code
);
auto
tit
=
tThumb
.
find
(
code
);
if
(
tit
==
tThumb
.
end
()
&&
!
mainGame
->
gameConf
.
use_image_load_background_thread
)
{
if
(
tit
==
tThumb
.
end
()
&&
!
mainGame
->
gameConf
.
use_image_load_background_thread
)
{
char
file
[
256
];
char
file
[
256
];
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/thumbnail/%d.jpg"
,
code
);
int
width
=
CARD_THUMB_WIDTH
*
mainGame
->
xScale
;
int
width
=
CARD_THUMB_WIDTH
*
mainGame
->
xScale
;
int
height
=
CARD_THUMB_HEIGHT
*
mainGame
->
yScale
;
int
height
=
CARD_THUMB_HEIGHT
*
mainGame
->
yScale
;
irr
::
video
::
ITexture
*
img
=
GetTextureFromFile
(
file
,
width
,
height
);
irr
::
video
::
ITexture
*
img
=
nullptr
;
if
(
img
==
NULL
)
{
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/thumbnail/%d.jpg"
,
ex
.
c_str
(),
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"pics/thumbnail/%d.jpg"
,
code
);
std
::
snprintf
(
file
,
sizeof
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
==
nullptr
&&
mainGame
->
gameConf
.
use_image_scale
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/%d.jpg"
,
code
);
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
img
=
GetTextureFromFile
(
file
,
width
,
height
);
if
(
img
==
nullptr
)
{
if
(
img
==
NULL
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/%d.jpg"
,
ex
.
c_str
(),
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"pics/%d.jpg"
,
code
);
std
::
snprintf
(
file
,
sizeof
file
,
"pics/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
img
=
GetTextureFromFile
(
file
,
width
,
height
);
}
}
}
}
tThumb
[
code
]
=
img
;
tThumb
[
code
]
=
img
;
return
(
img
==
NULL
)
?
tUnknownThumb
:
img
;
return
(
img
==
nullptr
)
?
tUnknownThumb
:
img
;
}
}
if
(
tit
==
tThumb
.
end
()
||
tit
->
second
==
tLoading
)
{
if
(
tit
==
tThumb
.
end
()
||
tit
->
second
==
tLoading
)
{
imageManager
.
tThumbLoadingMutex
.
lock
();
imageManager
.
tThumbLoadingMutex
.
lock
();
...
@@ -544,11 +569,16 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
...
@@ -544,11 +569,16 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
auto
tit
=
tFields
.
find
(
code
);
auto
tit
=
tFields
.
find
(
code
);
if
(
tit
==
tFields
.
end
())
{
if
(
tit
==
tFields
.
end
())
{
char
file
[
256
];
char
file
[
256
];
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/field/%d.png"
,
code
);
irr
::
video
::
ITexture
*
img
=
nullptr
;
irr
::
video
::
ITexture
*
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
{
if
(
img
==
nullptr
)
{
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/field/%d.jpg"
,
code
);
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/field/%d.png"
,
ex
.
c_str
(),
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
irr
::
video
::
ITexture
*
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/field/%d.jpg"
,
ex
.
c_str
(),
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
}
}
if
(
img
==
nullptr
)
{
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/field/%d.png"
),
code
);
std
::
snprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/field/%d.png"
),
code
);
...
@@ -588,11 +618,16 @@ irr::video::ITexture* ImageManager::GetTextureField(int code) {
...
@@ -588,11 +618,16 @@ irr::video::ITexture* ImageManager::GetTextureField(int code) {
auto
tit
=
tFields
.
find
(
code
);
auto
tit
=
tFields
.
find
(
code
);
if
(
tit
==
tFields
.
end
())
{
if
(
tit
==
tFields
.
end
())
{
char
file
[
256
];
char
file
[
256
];
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/field/%d.png"
,
code
);
irr
::
video
::
ITexture
*
img
=
nullptr
;
irr
::
video
::
ITexture
*
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
for
(
auto
ex
:
mainGame
->
GetExpansionsListU
())
{
if
(
img
==
nullptr
)
{
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"expansions/pics/field/%d.jpg"
,
code
);
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/field/%d.png"
,
ex
.
c_str
(),
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
"%s/pics/field/%d.jpg"
,
ex
.
c_str
(),
code
);
img
=
GetTextureFromFile
(
file
,
512
*
mainGame
->
xScale
,
512
*
mainGame
->
yScale
);
}
}
}
if
(
img
==
nullptr
)
{
if
(
img
==
nullptr
)
{
std
::
snprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/field/%d.png"
),
code
);
std
::
snprintf
(
file
,
sizeof
file
,
mainGame
->
GetLocaleDir
(
"pics/field/%d.png"
),
code
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment