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
nanahira
ygopro
Commits
641822c4
Commit
641822c4
authored
Nov 03, 2018
by
nekrozar
Committed by
GitHub
Nov 03, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1 from purerosefallen/subdir_pics
Subdir pics
parents
50e01d78
b464f1c4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
52 deletions
+64
-52
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+7
-39
gframe/deck_manager.h
gframe/deck_manager.h
+1
-0
gframe/image_manager.cpp
gframe/image_manager.cpp
+54
-13
gframe/image_manager.h
gframe/image_manager.h
+2
-0
No files found.
gframe/deck_manager.cpp
View file @
641822c4
...
@@ -8,47 +8,11 @@ namespace ygo {
...
@@ -8,47 +8,11 @@ namespace ygo {
DeckManager
deckManager
;
DeckManager
deckManager
;
void
DeckManager
::
LoadLFList
(
)
{
void
DeckManager
::
LoadLFList
Single
(
const
char
*
path
)
{
LFList
*
cur
=
NULL
;
LFList
*
cur
=
NULL
;
FILE
*
fp
=
fopen
(
"lflist.conf"
,
"r"
);
FILE
*
fp
=
fopen
(
path
,
"r"
);
FILE
*
fp_custom
=
fopen
(
"expansions/lflist.conf"
,
"r"
);
char
linebuf
[
256
];
char
linebuf
[
256
];
wchar_t
strBuffer
[
256
];
wchar_t
strBuffer
[
256
];
if
(
fp_custom
)
{
while
(
fgets
(
linebuf
,
256
,
fp_custom
))
{
if
(
linebuf
[
0
]
==
'#'
)
continue
;
int
p
=
0
,
sa
=
0
,
code
,
count
;
if
(
linebuf
[
0
]
==
'!'
)
{
sa
=
BufferIO
::
DecodeUTF8
((
const
char
*
)(
&
linebuf
[
1
]),
strBuffer
);
while
(
strBuffer
[
sa
-
1
]
==
L'\r'
||
strBuffer
[
sa
-
1
]
==
L'\n'
)
sa
--
;
LFList
newlist
;
_lfList
.
push_back
(
newlist
);
cur
=
&
_lfList
[
_lfList
.
size
()
-
1
];
memcpy
(
cur
->
listName
,
(
const
void
*
)
strBuffer
,
40
);
cur
->
listName
[
sa
]
=
0
;
cur
->
content
=
new
std
::
unordered_map
<
int
,
int
>
;
cur
->
hash
=
0x7dfcee6a
;
continue
;
}
while
(
linebuf
[
p
]
!=
' '
&&
linebuf
[
p
]
!=
'\t'
&&
linebuf
[
p
]
!=
0
)
p
++
;
if
(
linebuf
[
p
]
==
0
)
continue
;
linebuf
[
p
++
]
=
0
;
sa
=
p
;
code
=
atoi
(
linebuf
);
if
(
code
==
0
)
continue
;
while
(
linebuf
[
p
]
==
' '
||
linebuf
[
p
]
==
'\t'
)
p
++
;
while
(
linebuf
[
p
]
!=
' '
&&
linebuf
[
p
]
!=
'\t'
&&
linebuf
[
p
]
!=
0
)
p
++
;
linebuf
[
p
]
=
0
;
count
=
atoi
(
&
linebuf
[
sa
]);
if
(
cur
==
NULL
)
continue
;
(
*
cur
->
content
)[
code
]
=
count
;
cur
->
hash
=
cur
->
hash
^
((
code
<<
18
)
|
(
code
>>
14
))
^
((
code
<<
(
27
+
count
))
|
(
code
>>
(
5
-
count
)));
}
fclose
(
fp_custom
);
}
if
(
fp
)
{
if
(
fp
)
{
while
(
fgets
(
linebuf
,
256
,
fp
))
{
while
(
fgets
(
linebuf
,
256
,
fp
))
{
if
(
linebuf
[
0
]
==
'#'
)
if
(
linebuf
[
0
]
==
'#'
)
...
@@ -60,7 +24,7 @@ void DeckManager::LoadLFList() {
...
@@ -60,7 +24,7 @@ void DeckManager::LoadLFList() {
LFList
newlist
;
LFList
newlist
;
_lfList
.
push_back
(
newlist
);
_lfList
.
push_back
(
newlist
);
cur
=
&
_lfList
[
_lfList
.
size
()
-
1
];
cur
=
&
_lfList
[
_lfList
.
size
()
-
1
];
memcpy
(
cur
->
listName
,
(
const
void
*
)
strBuffer
,
40
);
memcpy
(
cur
->
listName
,
(
const
void
*
)
strBuffer
,
20
*
sizeof
(
wchar_t
)
);
cur
->
listName
[
sa
]
=
0
;
cur
->
listName
[
sa
]
=
0
;
cur
->
content
=
new
std
::
unordered_map
<
int
,
int
>
;
cur
->
content
=
new
std
::
unordered_map
<
int
,
int
>
;
cur
->
hash
=
0x7dfcee6a
;
cur
->
hash
=
0x7dfcee6a
;
...
@@ -84,6 +48,10 @@ void DeckManager::LoadLFList() {
...
@@ -84,6 +48,10 @@ void DeckManager::LoadLFList() {
}
}
fclose
(
fp
);
fclose
(
fp
);
}
}
}
void
DeckManager
::
LoadLFList
()
{
LoadLFListSingle
(
"expansions/lflist.conf"
);
LoadLFListSingle
(
"lflist.conf"
);
LFList
nolimit
;
LFList
nolimit
;
myswprintf
(
nolimit
.
listName
,
L"N/A"
);
myswprintf
(
nolimit
.
listName
,
L"N/A"
);
nolimit
.
hash
=
0
;
nolimit
.
hash
=
0
;
...
...
gframe/deck_manager.h
View file @
641822c4
...
@@ -35,6 +35,7 @@ public:
...
@@ -35,6 +35,7 @@ public:
Deck
current_deck
;
Deck
current_deck
;
std
::
vector
<
LFList
>
_lfList
;
std
::
vector
<
LFList
>
_lfList
;
void
LoadLFListSingle
(
const
char
*
path
);
void
LoadLFList
();
void
LoadLFList
();
wchar_t
*
GetLFListName
(
int
lfhash
);
wchar_t
*
GetLFListName
(
int
lfhash
);
int
CheckDeck
(
Deck
&
deck
,
int
lfhash
,
bool
allow_ocg
,
bool
allow_tcg
);
int
CheckDeck
(
Deck
&
deck
,
int
lfhash
,
bool
allow_ocg
,
bool
allow_tcg
);
...
...
gframe/image_manager.cpp
View file @
641822c4
...
@@ -158,16 +158,59 @@ irr::video::ITexture* ImageManager::GetTextureFromFile(char* file, s32 width, s3
...
@@ -158,16 +158,59 @@ irr::video::ITexture* ImageManager::GetTextureFromFile(char* file, s32 width, s3
return
driver
->
getTexture
(
file
);
return
driver
->
getTexture
(
file
);
}
}
}
}
irr
::
video
::
ITexture
*
ImageManager
::
GetTextureExpansions
(
char
*
file
,
s32
width
,
s32
height
)
{
irr
::
video
::
ITexture
*
img
=
GetTextureExpansionsDirectry
(
"./expansions"
,
file
,
width
,
height
);
if
(
img
!=
NULL
)
return
img
;
#ifdef _WIN32
char
fpath
[
1000
];
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
L"./expansions/*"
,
&
fdataw
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
do
{
if
(
wcscmp
(
L"."
,
fdataw
.
cFileName
)
!=
0
&&
wcscmp
(
L".."
,
fdataw
.
cFileName
)
!=
0
&&
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"./expansions/%s"
,
fname
);
img
=
GetTextureExpansionsDirectry
(
fpath
,
file
,
width
,
height
);
if
(
img
!=
NULL
)
return
img
;
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./expansions/"
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
if
(
strcmp
(
"."
,
dirp
->
d_name
)
==
0
||
strcmp
(
".."
,
dirp
->
d_name
)
==
0
||
dirp
->
d_type
!=
DT_DIR
)
continue
;
char
filepath
[
1000
];
sprintf
(
filepath
,
"./expansions/%s/"
,
dirp
->
d_name
);
img
=
GetTextureExpansionsDirectry
(
filepath
,
file
,
width
,
height
);
if
(
img
!=
NULL
)
return
img
;
}
closedir
(
dir
);
}
#endif
return
img
;
}
irr
::
video
::
ITexture
*
ImageManager
::
GetTextureExpansionsDirectry
(
const
char
*
path
,
char
*
file
,
s32
width
,
s32
height
)
{
char
fpath
[
1000
];
sprintf
(
fpath
,
"%s/%s"
,
path
,
file
);
return
GetTextureFromFile
(
fpath
,
width
,
height
);
}
irr
::
video
::
ITexture
*
ImageManager
::
GetTexture
(
int
code
)
{
irr
::
video
::
ITexture
*
ImageManager
::
GetTexture
(
int
code
)
{
if
(
code
==
0
)
if
(
code
==
0
)
return
tUnknown
;
return
tUnknown
;
auto
tit
=
tMap
.
find
(
code
);
auto
tit
=
tMap
.
find
(
code
);
if
(
tit
==
tMap
.
end
())
{
if
(
tit
==
tMap
.
end
())
{
char
file
[
256
];
char
file
[
256
];
sprintf
(
file
,
"
expansions/
pics/%d.jpg"
,
code
);
sprintf
(
file
,
"pics/%d.jpg"
,
code
);
irr
::
video
::
ITexture
*
img
=
GetTexture
FromFile
(
file
,
CARD_IMG_WIDTH
,
CARD_IMG_HEIGHT
);
irr
::
video
::
ITexture
*
img
=
GetTexture
Expansions
(
file
,
CARD_IMG_WIDTH
,
CARD_IMG_HEIGHT
);
if
(
img
==
NULL
)
{
if
(
img
==
NULL
)
{
sprintf
(
file
,
"pics/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
CARD_IMG_WIDTH
,
CARD_IMG_HEIGHT
);
img
=
GetTextureFromFile
(
file
,
CARD_IMG_WIDTH
,
CARD_IMG_HEIGHT
);
}
}
if
(
img
==
NULL
&&
!
mainGame
->
gameConf
.
use_image_scale
)
{
if
(
img
==
NULL
&&
!
mainGame
->
gameConf
.
use_image_scale
)
{
...
@@ -188,17 +231,15 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
...
@@ -188,17 +231,15 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
auto
tit
=
tThumb
.
find
(
code
);
auto
tit
=
tThumb
.
find
(
code
);
if
(
tit
==
tThumb
.
end
())
{
if
(
tit
==
tThumb
.
end
())
{
char
file
[
256
];
char
file
[
256
];
sprintf
(
file
,
"
expansions/
pics/thumbnail/%d.jpg"
,
code
);
sprintf
(
file
,
"pics/thumbnail/%d.jpg"
,
code
);
irr
::
video
::
ITexture
*
img
=
GetTexture
FromFile
(
file
,
CARD_THUMB_WIDTH
,
CARD_THUMB_HEIGHT
);
irr
::
video
::
ITexture
*
img
=
GetTexture
Expansions
(
file
,
CARD_THUMB_WIDTH
,
CARD_THUMB_HEIGHT
);
if
(
img
==
NULL
)
{
if
(
img
==
NULL
)
{
sprintf
(
file
,
"pics/thumbnail/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
CARD_THUMB_WIDTH
,
CARD_THUMB_HEIGHT
);
img
=
GetTextureFromFile
(
file
,
CARD_THUMB_WIDTH
,
CARD_THUMB_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
,
"pics/%d.jpg"
,
code
);
img
=
GetTexture
FromFile
(
file
,
CARD_THUMB_WIDTH
,
CARD_THUMB_HEIGHT
);
img
=
GetTexture
Expansions
(
file
,
CARD_THUMB_WIDTH
,
CARD_THUMB_HEIGHT
);
if
(
img
==
NULL
)
{
if
(
img
==
NULL
)
{
sprintf
(
file
,
"pics/%d.jpg"
,
code
);
img
=
GetTextureFromFile
(
file
,
CARD_THUMB_WIDTH
,
CARD_THUMB_HEIGHT
);
img
=
GetTextureFromFile
(
file
,
CARD_THUMB_WIDTH
,
CARD_THUMB_HEIGHT
);
}
}
}
}
...
@@ -216,11 +257,11 @@ irr::video::ITexture* ImageManager::GetTextureField(int code) {
...
@@ -216,11 +257,11 @@ 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
];
sprintf
(
file
,
"
expansions/
pics/field/%d.png"
,
code
);
sprintf
(
file
,
"pics/field/%d.png"
,
code
);
irr
::
video
::
ITexture
*
img
=
GetTexture
FromFile
(
file
,
512
,
512
);
irr
::
video
::
ITexture
*
img
=
GetTexture
Expansions
(
file
,
512
,
512
);
if
(
img
==
NULL
)
{
if
(
img
==
NULL
)
{
sprintf
(
file
,
"
expansions/
pics/field/%d.jpg"
,
code
);
sprintf
(
file
,
"pics/field/%d.jpg"
,
code
);
img
=
GetTexture
FromFile
(
file
,
512
,
512
);
img
=
GetTexture
Expansions
(
file
,
512
,
512
);
}
}
if
(
img
==
NULL
)
{
if
(
img
==
NULL
)
{
sprintf
(
file
,
"pics/field/%d.png"
,
code
);
sprintf
(
file
,
"pics/field/%d.png"
,
code
);
...
...
gframe/image_manager.h
View file @
641822c4
...
@@ -14,6 +14,8 @@ public:
...
@@ -14,6 +14,8 @@ public:
void
ClearTexture
();
void
ClearTexture
();
void
RemoveTexture
(
int
code
);
void
RemoveTexture
(
int
code
);
irr
::
video
::
ITexture
*
GetTextureFromFile
(
char
*
file
,
s32
width
,
s32
height
);
irr
::
video
::
ITexture
*
GetTextureFromFile
(
char
*
file
,
s32
width
,
s32
height
);
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
);
irr
::
video
::
ITexture
*
GetTexture
(
int
code
);
irr
::
video
::
ITexture
*
GetTextureThumb
(
int
code
);
irr
::
video
::
ITexture
*
GetTextureThumb
(
int
code
);
irr
::
video
::
ITexture
*
GetTextureField
(
int
code
);
irr
::
video
::
ITexture
*
GetTextureField
(
int
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