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
1
Merge Requests
1
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
192ac348
Commit
192ac348
authored
Nov 08, 2024
by
wind2009
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into server-develop
parents
c7d75f7d
ddef04bb
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
590 additions
and
3089 deletions
+590
-3089
gframe/CGUITTFont.cpp
gframe/CGUITTFont.cpp
+13
-13
gframe/CGUITTFont.h
gframe/CGUITTFont.h
+33
-30
gframe/bufferio.h
gframe/bufferio.h
+11
-0
gframe/data_manager.cpp
gframe/data_manager.cpp
+64
-82
gframe/data_manager.h
gframe/data_manager.h
+6
-14
gframe/deck_con.cpp
gframe/deck_con.cpp
+6
-6
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+2
-2
gframe/deck_manager.h
gframe/deck_manager.h
+1
-0
gframe/drawing.cpp
gframe/drawing.cpp
+44
-44
gframe/duelclient.cpp
gframe/duelclient.cpp
+7
-7
gframe/event_handler.cpp
gframe/event_handler.cpp
+3
-3
gframe/game.cpp
gframe/game.cpp
+69
-70
gframe/game.h
gframe/game.h
+11
-8
gframe/gframe.cpp
gframe/gframe.cpp
+7
-7
gframe/irrUString.h
gframe/irrUString.h
+274
-2767
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+19
-17
gframe/myfilesystem.h
gframe/myfilesystem.h
+7
-10
gframe/sound_manager.cpp
gframe/sound_manager.cpp
+1
-1
ocgcore
ocgcore
+1
-1
script
script
+1
-1
strings.conf
strings.conf
+10
-6
No files found.
gframe/CGUITTFont.cpp
View file @
192ac348
...
...
@@ -269,7 +269,7 @@ bool CGUITTFont::load(const io::path& filename, const u32 size, const bool antia
// Log.
if
(
logger
)
logger
->
log
(
L"CGUITTFont"
,
core
::
stringw
(
core
::
stringw
(
L"Creating new font: "
)
+
core
::
ustring
(
filename
).
toWCHAR_s
(
)
+
L" "
+
core
::
stringc
(
size
)
+
L"pt "
+
(
antialias
?
L"+antialias "
:
L"-antialias "
)
+
(
transparency
?
L"+transparency"
:
L"-transparency"
)).
c_str
(),
irr
::
ELL_INFORMATION
);
logger
->
log
(
L"CGUITTFont"
,
core
::
stringw
(
core
::
stringw
(
L"Creating new font: "
)
+
core
::
stringc
(
filename
)
+
L" "
+
core
::
stringc
(
size
)
+
L"pt "
+
(
antialias
?
L"+antialias "
:
L"-antialias "
)
+
(
transparency
?
L"+transparency"
:
L"-transparency"
)).
c_str
(),
irr
::
ELL_INFORMATION
);
// Grab the face.
SGUITTFace
*
face
=
0
;
...
...
@@ -304,15 +304,12 @@ bool CGUITTFont::load(const io::path& filename, const u32 size, const bool antia
return
false
;
}
}
else
{
core
::
ustring
converter
(
filename
);
if
(
FT_New_Face
(
c_library
,
reinterpret_cast
<
const
char
*>
(
converter
.
toUTF8_s
().
c_str
()),
0
,
&
face
->
face
))
{
if
(
logger
)
logger
->
log
(
L"CGUITTFont"
,
L"FT_New_Face failed."
,
irr
::
ELL_INFORMATION
);
if
(
logger
)
logger
->
log
(
L"CGUITTFont"
,
L"FT_New_Face failed."
,
irr
::
ELL_INFORMATION
);
c_faces
.
remove
(
filename
);
delete
face
;
face
=
0
;
return
false
;
}
c_faces
.
remove
(
filename
);
delete
face
;
face
=
0
;
return
false
;
}
}
else
{
// Using another instance of this face.
...
...
@@ -491,6 +488,12 @@ void CGUITTFont::setFontHinting(const bool enable, const bool enable_auto_hintin
}
void
CGUITTFont
::
draw
(
const
core
::
stringw
&
text
,
const
core
::
rect
<
s32
>&
position
,
video
::
SColor
color
,
bool
hcenter
,
bool
vcenter
,
const
core
::
rect
<
s32
>*
clip
)
{
if
(
!
Driver
)
return
;
drawUstring
(
text
,
position
,
color
,
hcenter
,
vcenter
,
clip
);
}
void
CGUITTFont
::
drawUstring
(
const
core
::
ustring
&
utext
,
const
core
::
rect
<
s32
>&
position
,
video
::
SColor
color
,
bool
hcenter
,
bool
vcenter
,
const
core
::
rect
<
s32
>*
clip
)
{
if
(
!
Driver
)
return
;
...
...
@@ -506,7 +509,7 @@ void CGUITTFont::draw(const core::stringw& text, const core::rect<s32>& position
// Determine offset positions.
if
(
hcenter
||
vcenter
)
{
textDimension
=
getDimension
(
text
.
c_str
()
);
textDimension
=
getDimension
(
utext
);
if
(
hcenter
)
offset
.
X
=
((
position
.
getWidth
()
-
textDimension
.
Width
)
>>
1
)
+
offset
.
X
;
...
...
@@ -515,9 +518,6 @@ void CGUITTFont::draw(const core::stringw& text, const core::rect<s32>& position
offset
.
Y
=
((
position
.
getHeight
()
-
textDimension
.
Height
)
>>
1
)
+
offset
.
Y
;
}
// Convert to a unicode string.
core
::
ustring
utext
(
text
);
// Set up our render map.
core
::
map
<
u32
,
CGUITTGlyphPage
*>
Render_Map
;
...
...
gframe/CGUITTFont.h
View file @
192ac348
...
...
@@ -54,7 +54,7 @@ public:
//! Structure representing a single TrueType glyph.
struct
SGUITTGlyph
{
//! Constructor.
SGUITTGlyph
()
:
isLoaded
(
false
),
glyph_page
(
0
),
surface
(
0
),
parent
(
0
)
{}
SGUITTGlyph
()
:
isLoaded
(
false
),
glyph_page
(
0
),
advance
({}),
surface
(
0
),
parent
(
0
)
{}
//! Destructor.
~
SGUITTGlyph
()
{
...
...
@@ -207,93 +207,96 @@ public:
static
CGUITTFont
*
create
(
IrrlichtDevice
*
device
,
const
io
::
path
&
filename
,
const
u32
size
,
const
bool
antialias
=
true
,
const
bool
transparency
=
true
);
//! Destructor
virtual
~
CGUITTFont
()
;
~
CGUITTFont
()
override
;
//! Sets the amount of glyphs to batch load.
v
irtual
v
oid
setBatchLoadSize
(
u32
batch_size
)
{
void
setBatchLoadSize
(
u32
batch_size
)
{
batch_load_size
=
batch_size
;
}
//! Sets the maximum texture size for a page of glyphs.
v
irtual
v
oid
setMaxPageTextureSize
(
const
core
::
dimension2du
&
texture_size
)
{
void
setMaxPageTextureSize
(
const
core
::
dimension2du
&
texture_size
)
{
max_page_texture_size
=
texture_size
;
}
//! Get the font size.
virtual
u32
getFontSize
()
const
{
u32
getFontSize
()
const
{
return
size
;
}
//! Check the font's transparency.
virtual
bool
isTransparent
()
const
{
bool
isTransparent
()
const
{
return
use_transparency
;
}
//! Check if the font auto-hinting is enabled.
//! Auto-hinting is FreeType's built-in font hinting engine.
virtual
bool
useAutoHinting
()
const
{
bool
useAutoHinting
()
const
{
return
use_auto_hinting
;
}
//! Check if the font hinting is enabled.
virtual
bool
useHinting
()
const
{
bool
useHinting
()
const
{
return
use_hinting
;
}
//! Check if the font is being loaded as a monochrome font.
//! The font can either be a 256 color grayscale font, or a 2 color monochrome font.
virtual
bool
useMonochrome
()
const
{
bool
useMonochrome
()
const
{
return
use_monochrome
;
}
//! Tells the font to allow transparency when rendering.
//! Default: true.
//! \param flag If true, the font draws using transparency.
v
irtual
v
oid
setTransparency
(
const
bool
flag
);
void
setTransparency
(
const
bool
flag
);
//! Tells the font to use monochrome rendering.
//! Default: false.
//! \param flag If true, the font draws using a monochrome image. If false, the font uses a grayscale image.
v
irtual
v
oid
setMonochrome
(
const
bool
flag
);
void
setMonochrome
(
const
bool
flag
);
//! Enables or disables font hinting.
//! Default: Hinting and auto-hinting true.
//! \param enable If false, font hinting is turned off. If true, font hinting is turned on.
//! \param enable_auto_hinting If true, FreeType uses its own auto-hinting algorithm. If false, it tries to use the algorithm specified by the font.
v
irtual
v
oid
setFontHinting
(
const
bool
enable
,
const
bool
enable_auto_hinting
=
true
);
void
setFontHinting
(
const
bool
enable
,
const
bool
enable_auto_hinting
=
true
);
//! Draws some text and clips it to the specified rectangle if wanted.
v
irtual
v
oid
draw
(
const
core
::
stringw
&
text
,
const
core
::
rect
<
s32
>&
position
,
void
draw
(
const
core
::
stringw
&
text
,
const
core
::
rect
<
s32
>&
position
,
video
::
SColor
color
,
bool
hcenter
=
false
,
bool
vcenter
=
false
,
const
core
::
rect
<
s32
>*
clip
=
0
);
const
core
::
rect
<
s32
>*
clip
=
0
)
override
;
void
drawUstring
(
const
core
::
ustring
&
text
,
const
core
::
rect
<
s32
>&
position
,
video
::
SColor
color
,
bool
hcenter
=
false
,
bool
vcenter
=
false
,
const
core
::
rect
<
s32
>*
clip
=
0
);
//! Returns the dimension of a character produced by this font.
virtual
core
::
dimension2d
<
u32
>
getCharDimension
(
const
wchar_t
ch
)
const
;
core
::
dimension2d
<
u32
>
getCharDimension
(
const
wchar_t
ch
)
const
;
//! Returns the dimension of a text string.
virtual
core
::
dimension2d
<
u32
>
getDimension
(
const
wchar_t
*
text
)
const
;
virtual
core
::
dimension2d
<
u32
>
getDimension
(
const
core
::
ustring
&
text
)
const
;
core
::
dimension2d
<
u32
>
getDimension
(
const
wchar_t
*
text
)
const
override
;
core
::
dimension2d
<
u32
>
getDimension
(
const
core
::
ustring
&
text
)
const
;
//! Calculates the index of the character in the text which is on a specific position.
virtual
s32
getCharacterFromPos
(
const
wchar_t
*
text
,
s32
pixel_x
)
const
;
virtual
s32
getCharacterFromPos
(
const
core
::
ustring
&
text
,
s32
pixel_x
)
const
;
s32
getCharacterFromPos
(
const
wchar_t
*
text
,
s32
pixel_x
)
const
override
;
s32
getCharacterFromPos
(
const
core
::
ustring
&
text
,
s32
pixel_x
)
const
;
//! Sets global kerning width for the font.
v
irtual
void
setKerningWidth
(
s32
kerning
)
;
v
oid
setKerningWidth
(
s32
kerning
)
override
;
//! Sets global kerning height for the font.
v
irtual
void
setKerningHeight
(
s32
kerning
)
;
v
oid
setKerningHeight
(
s32
kerning
)
override
;
//! Gets kerning values (distance between letters) for the font. If no parameters are provided,
virtual
s32
getKerningWidth
(
const
wchar_t
*
thisLetter
=
0
,
const
wchar_t
*
previousLetter
=
0
)
const
;
virtual
s32
getKerningWidth
(
const
uchar32_t
thisLetter
=
0
,
const
uchar32_t
previousLetter
=
0
)
const
;
s32
getKerningWidth
(
const
wchar_t
*
thisLetter
=
0
,
const
wchar_t
*
previousLetter
=
0
)
const
override
;
s32
getKerningWidth
(
const
uchar32_t
thisLetter
=
0
,
const
uchar32_t
previousLetter
=
0
)
const
;
//! Returns the distance between letters
virtual
s32
getKerningHeight
()
const
;
s32
getKerningHeight
()
const
override
;
//! Define which characters should not be drawn by the font.
v
irtual
void
setInvisibleCharacters
(
const
wchar_t
*
s
)
;
v
irtual
v
oid
setInvisibleCharacters
(
const
core
::
ustring
&
s
);
v
oid
setInvisibleCharacters
(
const
wchar_t
*
s
)
override
;
void
setInvisibleCharacters
(
const
core
::
ustring
&
s
);
//! Get the last glyph page if there's still available slots.
//! If not, it will return zero.
...
...
@@ -312,14 +315,14 @@ public:
//! Create corresponding character's software image copy from the font,
//! so you can use this data just like any ordinary video::IImage.
//! \param ch The character you need
vi
rtual
vi
deo
::
IImage
*
createTextureFromChar
(
const
uchar32_t
&
ch
);
video
::
IImage
*
createTextureFromChar
(
const
uchar32_t
&
ch
);
//! This function is for debugging mostly. If the page doesn't exist it returns zero.
//! \param page_index Simply return the texture handle of a given page index.
vi
rtual
vi
deo
::
ITexture
*
getPageTextureByIndex
(
const
u32
&
page_index
)
const
;
video
::
ITexture
*
getPageTextureByIndex
(
const
u32
&
page_index
)
const
;
//! Add a list of scene nodes generated by putting font textures on the 3D planes.
virtual
core
::
array
<
scene
::
ISceneNode
*>
addTextSceneNode
core
::
array
<
scene
::
ISceneNode
*>
addTextSceneNode
(
const
wchar_t
*
text
,
scene
::
ISceneManager
*
smgr
,
scene
::
ISceneNode
*
parent
=
0
,
const
video
::
SColor
&
color
=
video
::
SColor
(
255
,
0
,
0
,
0
),
bool
center
=
false
);
...
...
@@ -340,7 +343,7 @@ private:
static
scene
::
IMesh
*
shared_plane_ptr_
;
static
scene
::
SMesh
shared_plane_
;
CGUITTFont
(
IGUIEnvironment
*
env
);
explicit
CGUITTFont
(
IGUIEnvironment
*
env
);
bool
load
(
const
io
::
path
&
filename
,
const
u32
size
,
const
bool
antialias
,
const
bool
transparency
);
void
reset_images
();
void
update_glyph_pages
()
const
;
...
...
gframe/bufferio.h
View file @
192ac348
...
...
@@ -2,6 +2,7 @@
#define BUFFERIO_H
#include <cstdint>
#include <cwchar>
#include "../ocgcore/buffer.h"
class
BufferIO
{
...
...
@@ -49,6 +50,16 @@ public:
*
pstr
=
0
;
return
l
;
}
template
<
size_t
N
>
static
void
CopyString
(
const
char
*
src
,
wchar_t
(
&
dst
)[
N
])
{
dst
[
0
]
=
0
;
std
::
strncat
(
dst
,
src
,
N
-
1
);
}
template
<
size_t
N
>
static
void
CopyWideString
(
const
wchar_t
*
src
,
wchar_t
(
&
dst
)[
N
])
{
dst
[
0
]
=
0
;
std
::
wcsncat
(
dst
,
src
,
N
-
1
);
}
template
<
typename
T
>
static
bool
CheckUTF8Byte
(
const
T
*
str
,
int
len
)
{
for
(
int
i
=
1
;
i
<
len
;
++
i
)
{
...
...
gframe/data_manager.cpp
View file @
192ac348
...
...
@@ -138,8 +138,6 @@ bool DataManager::LoadStrings(const char* file) {
ReadStringConfLine
(
linebuf
);
}
fclose
(
fp
);
for
(
int
i
=
0
;
i
<
301
;
++
i
)
myswprintf
(
numStrings
[
i
],
L"%d"
,
i
);
return
true
;
}
#ifndef YGOPRO_SERVER_MODE
...
...
@@ -305,14 +303,12 @@ std::vector<unsigned int> DataManager::GetSetCodes(std::wstring setname) const {
}
return
matchingCodes
;
}
const
wchar_t
*
DataManager
::
GetNumString
(
int
num
,
bool
bracket
)
{
std
::
wstring
DataManager
::
GetNumString
(
int
num
,
bool
bracket
)
const
{
if
(
!
bracket
)
return
numStrings
[
num
];
wchar_t
*
p
=
numBuffer
;
*
p
++
=
L'('
;
BufferIO
::
CopyWStrRef
(
numStrings
[
num
],
p
,
4
);
*
p
=
L')'
;
*++
p
=
0
;
return
std
::
to_wstring
(
num
);
std
::
wstring
numBuffer
{
L"("
};
numBuffer
.
append
(
std
::
to_wstring
(
num
));
numBuffer
.
push_back
(
L')'
);
return
numBuffer
;
}
const
wchar_t
*
DataManager
::
FormatLocation
(
int
location
,
int
sequence
)
const
{
...
...
@@ -337,95 +333,81 @@ const wchar_t* DataManager::FormatLocation(int location, int sequence) const {
else
return
unknown_string
;
}
const
wchar_t
*
DataManager
::
FormatAttribute
(
int
attribute
)
{
wchar_t
*
p
=
attBuffer
;
unsigned
filter
=
1
;
int
i
=
1010
;
for
(;
filter
!=
0x80
;
filter
<<=
1
,
++
i
)
{
if
(
attribute
&
filter
)
{
BufferIO
::
CopyWStrRef
(
GetSysString
(
i
),
p
,
16
);
*
p
=
L'|'
;
*++
p
=
0
;
std
::
wstring
DataManager
::
FormatAttribute
(
unsigned
int
attribute
)
const
{
std
::
wstring
buffer
;
for
(
int
i
=
0
;
i
<
ATTRIBUTES_COUNT
;
++
i
)
{
if
(
attribute
&
(
0x1U
<<
i
))
{
if
(
!
buffer
.
empty
())
buffer
.
push_back
(
L'|'
);
buffer
.
append
(
GetSysString
(
1010
+
i
));
}
}
if
(
p
!=
attBuffer
)
*
(
p
-
1
)
=
0
;
else
return
unknown_string
;
return
attBuffer
;
}
const
wchar_t
*
DataManager
::
FormatRace
(
int
race
)
{
wchar_t
*
p
=
racBuffer
;
unsigned
filter
=
1
;
int
i
=
1020
;
for
(;
filter
<
(
1
<<
RACES_COUNT
);
filter
<<=
1
,
++
i
)
{
if
(
race
&
filter
)
{
BufferIO
::
CopyWStrRef
(
GetSysString
(
i
),
p
,
16
);
*
p
=
L'|'
;
*++
p
=
0
;
if
(
buffer
.
empty
())
return
std
::
wstring
(
unknown_string
);
return
buffer
;
}
std
::
wstring
DataManager
::
FormatRace
(
unsigned
int
race
)
const
{
std
::
wstring
buffer
;
for
(
int
i
=
0
;
i
<
RACES_COUNT
;
++
i
)
{
if
(
race
&
(
0x1U
<<
i
))
{
if
(
!
buffer
.
empty
())
buffer
.
push_back
(
L'|'
);
buffer
.
append
(
GetSysString
(
1020
+
i
));
}
}
if
(
p
!=
racBuffer
)
*
(
p
-
1
)
=
0
;
else
return
unknown_string
;
return
racBuffer
;
if
(
buffer
.
empty
())
return
std
::
wstring
(
unknown_string
);
return
buffer
;
}
const
wchar_t
*
DataManager
::
FormatType
(
int
type
)
{
wchar_t
*
p
=
tpBuffer
;
unsigned
filter
=
1
;
std
::
wstring
DataManager
::
FormatType
(
unsigned
int
type
)
const
{
std
::
wstring
buffer
;
int
i
=
1050
;
for
(;
filter
!=
0x8000000
;
filter
<<=
1
,
++
i
)
{
if
(
type
&
filter
)
{
BufferIO
::
CopyWStrRef
(
GetSysString
(
i
),
p
,
16
);
*
p
=
L'|'
;
*++
p
=
0
;
for
(
unsigned
filter
=
TYPE_MONSTER
;
filter
<=
TYPE_LINK
;
filter
<<=
1
,
++
i
)
{
if
(
type
&
filter
)
{
if
(
!
buffer
.
empty
())
buffer
.
push_back
(
L'|'
)
;
buffer
.
append
(
GetSysString
(
i
))
;
}
}
if
(
p
!=
tpBuffer
)
*
(
p
-
1
)
=
0
;
else
return
unknown_string
;
return
tpBuffer
;
if
(
buffer
.
empty
())
return
std
::
wstring
(
unknown_string
);
return
buffer
;
}
const
wchar_t
*
DataManager
::
FormatSetName
(
const
uint16_t
setcode
[])
{
wchar_t
*
p
=
scB
uffer
;
std
::
wstring
DataManager
::
FormatSetName
(
const
uint16_t
setcode
[])
const
{
std
::
wstring
b
uffer
;
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
if
(
!
setcode
[
i
])
break
;
const
wchar_t
*
setname
=
GetSetName
(
setcode
[
i
]);
if
(
setname
)
{
BufferIO
::
CopyWStrRef
(
setname
,
p
,
32
);
*
p
=
L'|'
;
*++
p
=
0
;
if
(
!
buffer
.
empty
())
buffer
.
push_back
(
L'|'
)
;
buffer
.
append
(
setname
)
;
}
}
if
(
p
!=
scBuffer
)
*
(
p
-
1
)
=
0
;
else
return
unknown_string
;
return
scBuffer
;
}
const
wchar_t
*
DataManager
::
FormatLinkMarker
(
int
link_marker
)
{
wchar_t
*
p
=
lmBuffer
;
*
p
=
0
;
if
(
link_marker
&
LINK_MARKER_TOP_LEFT
)
BufferIO
::
CopyWStrRef
(
L"[\u2196]"
,
p
,
4
);
if
(
link_marker
&
LINK_MARKER_TOP
)
BufferIO
::
CopyWStrRef
(
L"[\u2191]"
,
p
,
4
);
if
(
link_marker
&
LINK_MARKER_TOP_RIGHT
)
BufferIO
::
CopyWStrRef
(
L"[\u2197]"
,
p
,
4
);
if
(
link_marker
&
LINK_MARKER_LEFT
)
BufferIO
::
CopyWStrRef
(
L"[\u2190]"
,
p
,
4
);
if
(
link_marker
&
LINK_MARKER_RIGHT
)
BufferIO
::
CopyWStrRef
(
L"[\u2192]"
,
p
,
4
);
if
(
link_marker
&
LINK_MARKER_BOTTOM_LEFT
)
BufferIO
::
CopyWStrRef
(
L"[\u2199]"
,
p
,
4
);
if
(
link_marker
&
LINK_MARKER_BOTTOM
)
BufferIO
::
CopyWStrRef
(
L"[\u2193]"
,
p
,
4
);
if
(
link_marker
&
LINK_MARKER_BOTTOM_RIGHT
)
BufferIO
::
CopyWStrRef
(
L"[\u2198]"
,
p
,
4
);
return
lmBuffer
;
if
(
buffer
.
empty
())
return
std
::
wstring
(
unknown_string
);
return
buffer
;
}
std
::
wstring
DataManager
::
FormatLinkMarker
(
unsigned
int
link_marker
)
const
{
std
::
wstring
buffer
;
if
(
link_marker
&
LINK_MARKER_TOP_LEFT
)
buffer
.
append
(
L"[\u2196]"
);
if
(
link_marker
&
LINK_MARKER_TOP
)
buffer
.
append
(
L"[\u2191]"
);
if
(
link_marker
&
LINK_MARKER_TOP_RIGHT
)
buffer
.
append
(
L"[\u2197]"
);
if
(
link_marker
&
LINK_MARKER_LEFT
)
buffer
.
append
(
L"[\u2190]"
);
if
(
link_marker
&
LINK_MARKER_RIGHT
)
buffer
.
append
(
L"[\u2192]"
);
if
(
link_marker
&
LINK_MARKER_BOTTOM_LEFT
)
buffer
.
append
(
L"[\u2199]"
);
if
(
link_marker
&
LINK_MARKER_BOTTOM
)
buffer
.
append
(
L"[\u2193]"
);
if
(
link_marker
&
LINK_MARKER_BOTTOM_RIGHT
)
buffer
.
append
(
L"[\u2198]"
);
return
buffer
;
}
uint32
DataManager
::
CardReader
(
uint32
code
,
card_data
*
pData
)
{
if
(
!
dataManager
.
GetData
(
code
,
pData
))
...
...
gframe/data_manager.h
View file @
192ac348
...
...
@@ -38,13 +38,13 @@ public:
const
wchar_t
*
GetCounterName
(
int
code
)
const
;
const
wchar_t
*
GetSetName
(
int
code
)
const
;
std
::
vector
<
unsigned
int
>
GetSetCodes
(
std
::
wstring
setname
)
const
;
const
wchar_t
*
GetNumString
(
int
num
,
bool
bracket
=
false
)
;
std
::
wstring
GetNumString
(
int
num
,
bool
bracket
=
false
)
const
;
const
wchar_t
*
FormatLocation
(
int
location
,
int
sequence
)
const
;
const
wchar_t
*
FormatAttribute
(
int
attribute
)
;
const
wchar_t
*
FormatRace
(
int
race
)
;
const
wchar_t
*
FormatType
(
int
type
)
;
const
wchar_t
*
FormatSetName
(
const
uint16_t
setcode
[])
;
const
wchar_t
*
FormatLinkMarker
(
int
link_marker
)
;
std
::
wstring
FormatAttribute
(
unsigned
int
attribute
)
const
;
std
::
wstring
FormatRace
(
unsigned
int
race
)
const
;
std
::
wstring
FormatType
(
unsigned
int
type
)
const
;
std
::
wstring
FormatSetName
(
const
uint16_t
setcode
[])
const
;
std
::
wstring
FormatLinkMarker
(
unsigned
int
link_marker
)
const
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_counterStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_victoryStrings
;
...
...
@@ -52,14 +52,6 @@ public:
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_sysStrings
;
char
errmsg
[
512
]{};
wchar_t
numStrings
[
301
][
4
]{};
wchar_t
numBuffer
[
6
]{};
wchar_t
attBuffer
[
128
]{};
wchar_t
racBuffer
[
128
]{};
wchar_t
tpBuffer
[
128
]{};
wchar_t
scBuffer
[
128
]{};
wchar_t
lmBuffer
[
32
]{};
static
byte
scriptBuffer
[
0x20000
];
static
const
wchar_t
*
unknown_string
;
static
uint32
CardReader
(
uint32
,
card_data
*
);
...
...
gframe/deck_con.cpp
View file @
192ac348
...
...
@@ -105,11 +105,11 @@ void DeckBuilder::Terminate() {
mainGame
->
scrPackCards
->
setVisible
(
false
);
mainGame
->
scrPackCards
->
setPos
(
0
);
int
catesel
=
mainGame
->
cbDBCategory
->
getSelected
();
if
(
catesel
>=
0
)
BufferIO
::
CopyW
Str
(
mainGame
->
cbDBCategory
->
getItem
(
catesel
),
mainGame
->
gameConf
.
lastcategory
,
64
);
if
(
catesel
>=
0
)
BufferIO
::
CopyW
ideString
(
mainGame
->
cbDBCategory
->
getItem
(
catesel
),
mainGame
->
gameConf
.
lastcategory
);
int
decksel
=
mainGame
->
cbDBDecks
->
getSelected
();
if
(
decksel
>=
0
)
BufferIO
::
CopyW
Str
(
mainGame
->
cbDBDecks
->
getItem
(
decksel
),
mainGame
->
gameConf
.
lastdeck
,
64
);
if
(
decksel
>=
0
)
BufferIO
::
CopyW
ideString
(
mainGame
->
cbDBDecks
->
getItem
(
decksel
),
mainGame
->
gameConf
.
lastdeck
);
if
(
exit_on_return
)
mainGame
->
device
->
closeDevice
();
}
...
...
@@ -540,7 +540,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
const
wchar_t
*
newcatename
=
mainGame
->
cbDMCategory
->
getText
();
const
wchar_t
*
olddeckname
=
mainGame
->
lstDecks
->
getListItem
(
decksel
);
wchar_t
deckname
[
256
];
BufferIO
::
CopyW
Str
(
olddeckname
,
deckname
,
256
);
BufferIO
::
CopyW
ideString
(
olddeckname
,
deckname
);
wchar_t
oldfilepath
[
256
];
deckManager
.
GetDeckFile
(
oldfilepath
,
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
wchar_t
newfilepath
[
256
];
...
...
@@ -580,7 +580,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
const
wchar_t
*
newcatename
=
mainGame
->
cbDMCategory
->
getText
();
const
wchar_t
*
olddeckname
=
mainGame
->
lstDecks
->
getListItem
(
decksel
);
wchar_t
deckname
[
256
];
BufferIO
::
CopyW
Str
(
olddeckname
,
deckname
,
256
);
BufferIO
::
CopyW
ideString
(
olddeckname
,
deckname
);
wchar_t
newfilepath
[
256
];
if
(
oldcatesel
!=
2
&&
newcatesel
==
0
)
{
myswprintf
(
newfilepath
,
L"./deck/%ls.ydk"
,
deckname
);
...
...
gframe/deck_manager.cpp
View file @
192ac348
...
...
@@ -191,7 +191,7 @@ int DeckManager::LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec, bool is_p
}
int
DeckManager
::
LoadDeck
(
Deck
&
deck
,
std
::
istringstream
&
deckStream
,
bool
is_packlist
)
{
int
ct
=
0
,
mainc
=
0
,
sidec
=
0
,
code
=
0
;
int
cardlist
[
300
]{};
int
cardlist
[
PACK_MAX_SIZE
]{};
bool
is_side
=
false
;
std
::
string
linebuf
;
while
(
std
::
getline
(
deckStream
,
linebuf
,
'\n'
)
&&
ct
<
(
int
)(
sizeof
cardlist
/
sizeof
cardlist
[
0
]))
{
...
...
@@ -247,7 +247,7 @@ void DeckManager::GetCategoryPath(wchar_t* ret, int index, const wchar_t* text)
myswprintf
(
catepath
,
L"./pack"
);
break
;
case
1
:
myswprintf
(
catepath
,
mainGame
->
gameConf
.
bot_deck_
path
);
BufferIO
::
CopyWideString
(
mainGame
->
gameConf
.
bot_deck_path
,
cate
path
);
break
;
case
-
1
:
case
2
:
...
...
gframe/deck_manager.h
View file @
192ac348
...
...
@@ -28,6 +28,7 @@ namespace ygo {
constexpr
int
DECK_MIN_SIZE
=
YGOPRO_MIN_DECK
;
constexpr
int
EXTRA_MAX_SIZE
=
YGOPRO_MAX_EXTRA
;
constexpr
int
SIDE_MAX_SIZE
=
YGOPRO_MAX_SIDE
;
constexpr
int
PACK_MAX_SIZE
=
1000
;
struct
LFList
{
unsigned
int
hash
{};
...
...
gframe/drawing.cpp
View file @
192ac348
This diff is collapsed.
Click to expand it.
gframe/duelclient.cpp
View file @
192ac348
...
...
@@ -1104,7 +1104,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
HINT_RACE
:
{
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
1511
),
dataManager
.
FormatRace
(
data
));
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
1511
),
dataManager
.
FormatRace
(
data
)
.
c_str
()
);
mainGame
->
AddLog
(
textBuffer
);
mainGame
->
gMutex
.
lock
();
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
guiFont
,
textBuffer
);
...
...
@@ -1114,7 +1114,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
break
;
}
case
HINT_ATTRIB
:
{
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
1511
),
dataManager
.
FormatAttribute
(
data
));
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
1511
),
dataManager
.
FormatAttribute
(
data
)
.
c_str
()
);
mainGame
->
AddLog
(
textBuffer
);
mainGame
->
gMutex
.
lock
();
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
guiFont
,
textBuffer
);
...
...
@@ -1201,7 +1201,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
int
type
=
BufferIO
::
ReadUInt8
(
pbuf
);
mainGame
->
showcarddif
=
110
;
mainGame
->
showcardp
=
0
;
mainGame
->
dInfo
.
vic_string
=
0
;
mainGame
->
dInfo
.
vic_string
=
L""
;
wchar_t
vic_buf
[
256
];
if
(
player
==
2
)
mainGame
->
showcardcode
=
3
;
...
...
@@ -1227,7 +1227,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
}
mainGame
->
showcard
=
101
;
mainGame
->
WaitFrameSignal
(
120
);
mainGame
->
dInfo
.
vic_string
=
0
;
mainGame
->
dInfo
.
vic_string
=
L""
;
mainGame
->
showcard
=
0
;
break
;
}
...
...
@@ -3184,7 +3184,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
mainGame
->
WaitFrameSignal
(
30
);
mainGame
->
lpframe
=
10
;
mainGame
->
WaitFrameSignal
(
11
);
mainGame
->
lpcstring
=
0
;
mainGame
->
lpcstring
=
L""
;
mainGame
->
dInfo
.
lp
[
player
]
=
final
;
mainGame
->
gMutex
.
lock
();
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
...
...
@@ -3213,7 +3213,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
mainGame
->
WaitFrameSignal
(
30
);
mainGame
->
lpframe
=
10
;
mainGame
->
WaitFrameSignal
(
11
);
mainGame
->
lpcstring
=
0
;
mainGame
->
lpcstring
=
L""
;
mainGame
->
dInfo
.
lp
[
player
]
=
final
;
mainGame
->
gMutex
.
lock
();
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
...
...
@@ -3365,7 +3365,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
mainGame
->
WaitFrameSignal
(
30
);
mainGame
->
lpframe
=
10
;
mainGame
->
WaitFrameSignal
(
11
);
mainGame
->
lpcstring
=
0
;
mainGame
->
lpcstring
=
L""
;
mainGame
->
dInfo
.
lp
[
player
]
=
final
;
mainGame
->
gMutex
.
lock
();
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
...
...
gframe/event_handler.cpp
View file @
192ac348
...
...
@@ -1600,7 +1600,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
myswprintf
(
formatBuffer
,
L"
\n
LINK-%d"
,
mcard
->
link
);
str
.
append
(
formatBuffer
);
}
myswprintf
(
formatBuffer
,
L" %ls/%ls"
,
dataManager
.
FormatRace
(
mcard
->
race
)
,
dataManager
.
FormatAttribute
(
mcard
->
attribute
));
myswprintf
(
formatBuffer
,
L" %ls/%ls"
,
dataManager
.
FormatRace
(
mcard
->
race
)
.
c_str
(),
dataManager
.
FormatAttribute
(
mcard
->
attribute
).
c_str
(
));
str
.
append
(
formatBuffer
);
if
(
mcard
->
location
==
LOCATION_HAND
&&
(
mcard
->
type
&
TYPE_PENDULUM
))
{
myswprintf
(
formatBuffer
,
L"
\n
%d/%d"
,
mcard
->
lscale
,
mcard
->
rscale
);
...
...
@@ -1626,9 +1626,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
else
if
(
mcard
->
cHint
==
CHINT_CARD
)
myswprintf
(
formatBuffer
,
L"
\n
%ls%ls"
,
dataManager
.
GetSysString
(
212
),
dataManager
.
GetName
(
mcard
->
chValue
));
else
if
(
mcard
->
cHint
==
CHINT_RACE
)
myswprintf
(
formatBuffer
,
L"
\n
%ls%ls"
,
dataManager
.
GetSysString
(
213
),
dataManager
.
FormatRace
(
mcard
->
chValue
));
myswprintf
(
formatBuffer
,
L"
\n
%ls%ls"
,
dataManager
.
GetSysString
(
213
),
dataManager
.
FormatRace
(
mcard
->
chValue
)
.
c_str
()
);
else
if
(
mcard
->
cHint
==
CHINT_ATTRIBUTE
)
myswprintf
(
formatBuffer
,
L"
\n
%ls%ls"
,
dataManager
.
GetSysString
(
214
),
dataManager
.
FormatAttribute
(
mcard
->
chValue
));
myswprintf
(
formatBuffer
,
L"
\n
%ls%ls"
,
dataManager
.
GetSysString
(
214
),
dataManager
.
FormatAttribute
(
mcard
->
chValue
)
.
c_str
()
);
else
if
(
mcard
->
cHint
==
CHINT_NUMBER
)
myswprintf
(
formatBuffer
,
L"
\n
%ls%d"
,
dataManager
.
GetSysString
(
215
),
mcard
->
chValue
);
str
.
append
(
formatBuffer
);
...
...
gframe/game.cpp
View file @
192ac348
This diff is collapsed.
Click to expand it.
gframe/game.h
View file @
192ac348
...
...
@@ -30,10 +30,13 @@
#define YGOPRO_DEFAULT_DUEL_RULE 5
#endif
#define DEFAULT_DUEL_RULE YGOPRO_DEFAULT_DUEL_RULE
constexpr
int
DEFAULT_DUEL_RULE
=
YGOPRO_DEFAULT_DUEL_RULE
;
constexpr
int
CONFIG_LINE_SIZE
=
1024
;
namespace
ygo
{
bool
IsExtension
(
const
wchar_t
*
filename
,
const
wchar_t
*
extension
);
#ifndef YGOPRO_SERVER_MODE
struct
Config
{
bool
use_d3d
{
false
};
...
...
@@ -45,12 +48,13 @@ struct Config {
wchar_t
lastport
[
10
]{};
wchar_t
nickname
[
20
]{};
wchar_t
gamename
[
20
]{};
wchar_t
lastcategory
[
64
]{};
wchar_t
lastdeck
[
64
]{};
wchar_t
roompass
[
20
]{};
//path
wchar_t
lastcategory
[
256
]{};
wchar_t
lastdeck
[
256
]{};
wchar_t
textfont
[
256
]{};
wchar_t
numfont
[
256
]{};
wchar_t
roompass
[
20
]{};
wchar_t
bot_deck_path
[
64
]{};
wchar_t
bot_deck_path
[
256
]{};
//settings
int
chkMAutoPos
{
0
};
int
chkSTAutoPos
{
1
};
...
...
@@ -111,7 +115,7 @@ struct DuelInfo {
wchar_t
hostname_tag
[
20
]{};
wchar_t
clientname_tag
[
20
]{};
wchar_t
strLP
[
2
][
16
]{};
wchar_t
*
vic_string
{
nullptr
}
;
std
::
wstring
vic_string
;
unsigned
char
player_type
{
0
};
unsigned
char
time_player
{
0
};
unsigned
short
time_limit
{
0
};
...
...
@@ -170,7 +174,6 @@ public:
void
CheckMutual
(
ClientCard
*
pcard
,
int
mark
);
void
DrawCards
();
void
DrawCard
(
ClientCard
*
pcard
);
void
DrawShadowText
(
irr
::
gui
::
CGUITTFont
*
font
,
const
core
::
stringw
&
text
,
const
core
::
rect
<
s32
>&
position
,
const
core
::
rect
<
s32
>&
padding
,
video
::
SColor
color
=
0xffffffff
,
video
::
SColor
shadowcolor
=
0xff000000
,
bool
hcenter
=
false
,
bool
vcenter
=
false
,
const
core
::
rect
<
s32
>*
clip
=
0
);
void
DrawMisc
();
void
DrawStatus
(
ClientCard
*
pcard
,
int
x1
,
int
y1
,
int
x2
,
int
y2
);
void
DrawGUI
();
...
...
@@ -271,7 +274,7 @@ public:
int
lpd
;
int
lpplayer
;
int
lpccolor
;
wchar_t
*
lpcstring
;
std
::
wstring
lpcstring
;
bool
always_chain
;
bool
ignore_chain
;
bool
chain_when_avail
;
...
...
gframe/gframe.cpp
View file @
192ac348
...
...
@@ -177,14 +177,14 @@ int main(int argc, char* argv[]) {
++
i
;
if
(
i
<
wargc
)
{
deckCategorySpecified
=
true
;
wcscpy
(
ygo
::
mainGame
->
gameConf
.
lastcategory
,
wargv
[
i
]
);
BufferIO
::
CopyWideString
(
wargv
[
i
],
ygo
::
mainGame
->
gameConf
.
lastcategory
);
}
}
else
if
(
!
wcscmp
(
wargv
[
i
],
L"-d"
))
{
// Deck
++
i
;
if
(
!
deckCategorySpecified
)
ygo
::
mainGame
->
gameConf
.
lastcategory
[
0
]
=
0
;
if
(
i
+
1
<
wargc
)
{
// select deck
wcscpy
(
ygo
::
mainGame
->
gameConf
.
lastdeck
,
wargv
[
i
]
);
BufferIO
::
CopyWideString
(
wargv
[
i
],
ygo
::
mainGame
->
gameConf
.
lastdeck
);
continue
;
}
else
{
// open deck
exit_on_return
=
!
keep_on_return
;
...
...
@@ -197,7 +197,7 @@ int main(int argc, char* argv[]) {
myswprintf
(
open_file_name
,
L"%ls/%ls"
,
ygo
::
mainGame
->
gameConf
.
lastcategory
,
wargv
[
i
]);
#endif
}
else
{
wcscpy
(
open_file_name
,
wargv
[
i
]
);
BufferIO
::
CopyWideString
(
wargv
[
i
],
open_file_name
);
}
}
ClickButton
(
ygo
::
mainGame
->
btnDeckEdit
);
...
...
@@ -218,7 +218,7 @@ int main(int argc, char* argv[]) {
++
i
;
if
(
i
<
wargc
)
{
open_file
=
true
;
wcscpy
(
open_file_name
,
wargv
[
i
]
);
BufferIO
::
CopyWideString
(
wargv
[
i
],
open_file_name
);
}
ClickButton
(
ygo
::
mainGame
->
btnReplayMode
);
if
(
open_file
)
...
...
@@ -229,7 +229,7 @@ int main(int argc, char* argv[]) {
++
i
;
if
(
i
<
wargc
)
{
open_file
=
true
;
wcscpy
(
open_file_name
,
wargv
[
i
]
);
BufferIO
::
CopyWideString
(
wargv
[
i
],
open_file_name
);
}
ClickButton
(
ygo
::
mainGame
->
btnSingleMode
);
if
(
open_file
)
...
...
@@ -239,14 +239,14 @@ int main(int argc, char* argv[]) {
wchar_t
*
pstrext
=
wargv
[
1
]
+
wcslen
(
wargv
[
1
])
-
4
;
if
(
!
mywcsncasecmp
(
pstrext
,
L".ydk"
,
4
))
{
open_file
=
true
;
wcscpy
(
open_file_name
,
wargv
[
i
]
);
BufferIO
::
CopyWideString
(
wargv
[
i
],
open_file_name
);
exit_on_return
=
!
keep_on_return
;
ClickButton
(
ygo
::
mainGame
->
btnDeckEdit
);
break
;
}
if
(
!
mywcsncasecmp
(
pstrext
,
L".yrp"
,
4
))
{
open_file
=
true
;
wcscpy
(
open_file_name
,
wargv
[
i
]
);
BufferIO
::
CopyWideString
(
wargv
[
i
],
open_file_name
);
exit_on_return
=
!
keep_on_return
;
ClickButton
(
ygo
::
mainGame
->
btnReplayMode
);
ClickButton
(
ygo
::
mainGame
->
btnLoadReplay
);
...
...
gframe/irrUString.h
View file @
192ac348
This diff is collapsed.
Click to expand it.
gframe/menu_handler.cpp
View file @
192ac348
...
...
@@ -13,11 +13,9 @@
namespace
ygo
{
void
UpdateDeck
()
{
BufferIO
::
CopyWStr
(
mainGame
->
cbCategorySelect
->
getItem
(
mainGame
->
cbCategorySelect
->
getSelected
()),
mainGame
->
gameConf
.
lastcategory
,
64
);
BufferIO
::
CopyWStr
(
mainGame
->
cbDeckSelect
->
getItem
(
mainGame
->
cbDeckSelect
->
getSelected
()),
mainGame
->
gameConf
.
lastdeck
,
64
);
unsigned
char
deckbuf
[
1024
];
BufferIO
::
CopyWideString
(
mainGame
->
cbCategorySelect
->
getText
(),
mainGame
->
gameConf
.
lastcategory
);
BufferIO
::
CopyWideString
(
mainGame
->
cbDeckSelect
->
getText
(),
mainGame
->
gameConf
.
lastdeck
);
unsigned
char
deckbuf
[
1024
]{};
auto
pdeck
=
deckbuf
;
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
main
.
size
()
+
deckManager
.
current_deck
.
extra
.
size
());
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
side
.
size
());
...
...
@@ -68,14 +66,17 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
TrimText
(
mainGame
->
ebJoinHost
);
mainGame
->
TrimText
(
mainGame
->
ebJoinPort
);
char
ip
[
20
];
const
wchar_t
*
pstr
=
mainGame
->
ebJoinHost
->
getText
();
BufferIO
::
CopyWStr
(
pstr
,
ip
,
16
);
wchar_t
pstr
[
100
];
wchar_t
portstr
[
10
];
BufferIO
::
CopyWideString
(
mainGame
->
ebJoinHost
->
getText
(),
pstr
);
BufferIO
::
CopyWideString
(
mainGame
->
ebJoinPort
->
getText
(),
portstr
);
BufferIO
::
EncodeUTF8
(
pstr
,
ip
);
unsigned
int
remote_addr
=
htonl
(
inet_addr
(
ip
));
if
(
remote_addr
==
-
1
)
{
char
hostname
[
100
];
char
port
[
6
];
BufferIO
::
CopyWStr
(
pstr
,
hostname
,
100
);
BufferIO
::
CopyWStr
(
mainGame
->
ebJoinPort
->
getText
(),
port
,
6
);
BufferIO
::
EncodeUTF8
(
pstr
,
hostname
);
BufferIO
::
EncodeUTF8
(
portstr
,
port
);
struct
evutil_addrinfo
hints
;
struct
evutil_addrinfo
*
answer
=
NULL
;
std
::
memset
(
&
hints
,
0
,
sizeof
hints
);
...
...
@@ -97,9 +98,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
evutil_freeaddrinfo
(
answer
);
}
}
unsigned
int
remote_port
=
wcstol
(
mainGame
->
ebJoinPort
->
getText
()
,
nullptr
,
10
);
BufferIO
::
CopyW
Str
(
pstr
,
mainGame
->
gameConf
.
lasthost
,
100
);
BufferIO
::
CopyW
Str
(
mainGame
->
ebJoinPort
->
getText
(),
mainGame
->
gameConf
.
lastport
,
20
);
unsigned
int
remote_port
=
wcstol
(
portstr
,
nullptr
,
10
);
BufferIO
::
CopyW
ideString
(
pstr
,
mainGame
->
gameConf
.
lasthost
);
BufferIO
::
CopyW
ideString
(
portstr
,
mainGame
->
gameConf
.
lastport
);
if
(
DuelClient
::
StartClient
(
remote_addr
,
remote_port
,
false
))
{
mainGame
->
btnCreateHost
->
setEnabled
(
false
);
mainGame
->
btnJoinHost
->
setEnabled
(
false
);
...
...
@@ -127,7 +128,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
case
BUTTON_HOST_CONFIRM
:
{
bot_mode
=
false
;
BufferIO
::
CopyW
Str
(
mainGame
->
ebServerName
->
getText
(),
mainGame
->
gameConf
.
gamename
,
20
);
BufferIO
::
CopyW
ideString
(
mainGame
->
ebServerName
->
getText
(),
mainGame
->
gameConf
.
gamename
);
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
{
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1402
));
...
...
@@ -448,7 +449,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
wcsncpy
(
deck_name
,
dash
+
1
,
256
);
for
(
size_t
i
=
0
;
i
<
mainGame
->
cbDBDecks
->
getItemCount
();
++
i
)
{
if
(
!
wcscmp
(
mainGame
->
cbDBDecks
->
getItem
(
i
),
deck_name
))
{
wcscpy
(
mainGame
->
gameConf
.
lastdeck
,
deck_name
);
BufferIO
::
CopyWideString
(
deck_name
,
mainGame
->
gameConf
.
lastdeck
);
mainGame
->
cbDBDecks
->
setSelected
(
i
);
break
;
}
...
...
@@ -456,14 +457,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
else
{
// only deck name
for
(
size_t
i
=
0
;
i
<
mainGame
->
cbDBDecks
->
getItemCount
();
++
i
)
{
if
(
!
wcscmp
(
mainGame
->
cbDBDecks
->
getItem
(
i
),
open_file_name
))
{
wcscpy
(
mainGame
->
gameConf
.
lastdeck
,
open_file_name
);
BufferIO
::
CopyWideString
(
open_file_name
,
mainGame
->
gameConf
.
lastdeck
);
mainGame
->
cbDBDecks
->
setSelected
(
i
);
break
;
}
}
}
open_file
=
false
;
}
else
if
(
mainGame
->
cbDBCategory
->
getSelected
()
!=
-
1
&&
mainGame
->
cbDBDecks
->
getSelected
()
!=
-
1
)
{
}
else
if
(
mainGame
->
cbDBCategory
->
getSelected
()
!=
-
1
&&
mainGame
->
cbDBDecks
->
getSelected
()
!=
-
1
)
{
deckManager
.
LoadCurrentDeck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
mainGame
->
ebDeckname
->
setText
(
L""
);
}
...
...
@@ -493,7 +495,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
HideElement
(
mainGame
->
wReplaySave
);
if
(
prev_operation
==
BUTTON_RENAME_REPLAY
)
{
wchar_t
newname
[
256
];
BufferIO
::
CopyW
Str
(
mainGame
->
ebRSName
->
getText
(),
newname
,
256
);
BufferIO
::
CopyW
ideString
(
mainGame
->
ebRSName
->
getText
(),
newname
);
if
(
mywcsncasecmp
(
newname
+
wcslen
(
newname
)
-
4
,
L".yrp"
,
4
))
{
myswprintf
(
newname
,
L"%ls.yrp"
,
mainGame
->
ebRSName
->
getText
());
}
...
...
gframe/myfilesystem.h
View file @
192ac348
#ifndef FILESYSTEM_H
#define FILESYSTEM_H
#include <
string.h
>
#include <
cstdio
>
#include <functional>
#include "bufferio.h"
...
...
@@ -20,7 +20,7 @@
class
FileSystem
{
public:
static
void
SafeFileName
(
wchar_t
*
wfile
)
{
while
((
wfile
=
wcspbrk
(
wfile
,
L"<>:
\"
/
\\
|?*"
))
!=
NULL
)
while
((
wfile
=
std
::
wcspbrk
(
wfile
,
L"<>:
\"
/
\\
|?*"
))
!=
nullptr
)
*
wfile
++
=
'_'
;
}
...
...
@@ -70,8 +70,8 @@ public:
static
bool
DeleteDir
(
const
wchar_t
*
wdir
)
{
wchar_t
pdir
[
256
];
BufferIO
::
CopyWStr
(
wdir
,
pdir
,
256
);
pdir
[
wcslen
(
wdir
)
+
1
]
=
0
;
int
len
=
BufferIO
::
CopyWStr
(
wdir
,
pdir
,
sizeof
pdir
/
sizeof
pdir
[
0
]
);
pdir
[
len
+
1
]
=
0
;
SHFILEOPSTRUCTW
lpFileOp
;
lpFileOp
.
hwnd
=
NULL
;
lpFileOp
.
wFunc
=
FO_DELETE
;
...
...
@@ -89,8 +89,7 @@ public:
static
void
TraversalDir
(
const
wchar_t
*
wpath
,
const
std
::
function
<
void
(
const
wchar_t
*
,
bool
)
>&
cb
)
{
wchar_t
findstr
[
1024
];
wcscpy
(
findstr
,
wpath
);
wcscat
(
findstr
,
L"/*"
);
std
::
swprintf
(
findstr
,
sizeof
findstr
/
sizeof
findstr
[
0
],
L"%s/*"
,
wpath
);
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
findstr
,
&
fdataw
);
if
(
fh
==
INVALID_HANDLE_VALUE
)
...
...
@@ -118,7 +117,7 @@ public:
class
FileSystem
{
public:
static
void
SafeFileName
(
wchar_t
*
wfile
)
{
while
((
wfile
=
wcspbrk
(
wfile
,
L"/"
))
!=
NULL
)
while
((
wfile
=
std
::
wcspbrk
(
wfile
,
L"/"
))
!=
nullptr
)
*
wfile
++
=
'_'
;
}
...
...
@@ -214,9 +213,7 @@ public:
file_unit
funit
;
#endif
char
fname
[
1024
];
strcpy
(
fname
,
path
);
strcat
(
fname
,
"/"
);
strcat
(
fname
,
dirp
->
d_name
);
std
::
snprintf
(
fname
,
sizeof
fname
,
"%s/%s"
,
path
,
dirp
->
d_name
);
stat
(
fname
,
&
fileStat
);
#ifdef YGOPRO_SERVER_MODE
bool
is_dir
=
S_ISDIR
(
fileStat
.
st_mode
);
...
...
gframe/sound_manager.cpp
View file @
192ac348
...
...
@@ -40,7 +40,7 @@ void SoundManager::RefreshBGMList() {
void
SoundManager
::
RefershBGMDir
(
std
::
wstring
path
,
int
scene
)
{
std
::
wstring
search
=
L"./sound/BGM/"
+
path
;
FileSystem
::
TraversalDir
(
search
.
c_str
(),
[
this
,
&
path
,
scene
](
const
wchar_t
*
name
,
bool
isdir
)
{
if
(
!
isdir
&&
wcsrchr
(
name
,
'.'
)
&&
(
!
mywcsncasecmp
(
wcsrchr
(
name
,
'.'
),
L".mp3"
,
4
)
||
!
mywcsncasecmp
(
wcsrchr
(
name
,
'.'
),
L".ogg"
,
4
)))
{
if
(
!
isdir
&&
(
IsExtension
(
name
,
L".mp3"
)
||
IsExtension
(
name
,
L".ogg"
)))
{
std
::
wstring
filename
=
path
+
L"/"
+
name
;
BGMList
[
BGM_ALL
].
push_back
(
filename
);
BGMList
[
scene
].
push_back
(
filename
);
...
...
ocgcore
@
ad168b75
Subproject commit
eb36d391ec450960e526032698e97b95376b4a32
Subproject commit
ad168b754b268ac36a3966296c8de04e19bf84eb
script
@
44ca00ed
Subproject commit
a852e8e7d21eb61d043838fdd86170bef911871d
Subproject commit
44ca00ed13e229e57ccedc0c1be6a7c5636c8f6c
strings.conf
View file @
192ac348
...
...
@@ -660,7 +660,7 @@
!
counter
0
x68
指示物(图腾柱)
!
counter
0
x69
指示物(吠陀-优婆尼沙昙)
!
counter
0
x6a
响鸣指示物
!
counter
0
x6b
狂
乱
指示物
!
counter
0
x6b
狂
爱
指示物
!
counter
0
x6c
访问指示物
!
counter
0
x6d
祝台指示物
#setnames, using tab for comment
...
...
@@ -706,7 +706,8 @@
!
setname
0
x1017
同调士 シンクロン
!
setname
0
x2017
同调龙 シンクロ・ドラゴン
!
setname
0
x18
云魔物 雲魔物
!
setname
0
x19
剑斗兽 剣闘獣
!
setname
0
x19
剑斗 グラディアル
!
setname
0
x1019
剑斗兽 剣闘獣
!
setname
0
x1a
黑蝎 黒蠍
!
setname
0
x1b
幻兽 幻獣
!
setname
0
x101b
幻兽机 幻獣機
...
...
@@ -1201,7 +1202,8 @@
!
setname
0
x198
维萨斯 ヴィサス
!
setname
0
x199
反击 カウンター
!
setname
0
x19a
吠陀 ヴェーダ
!
setname
0
x19b
迪亚贝尔斯塔尔 ディアベルスター
!
setname
0
x19b
迪亚贝尔 ディアベル
!
setname
0
x119b
迪亚贝尔斯塔尔 ディアベルスター
!
setname
0
x19c
蛇眼 スネークアイ
!
setname
0
x19d
荷鲁斯 ホルス
!
setname
0
x119d
荷鲁斯之黑炎龙 ホルスの黒炎竜
...
...
@@ -1211,7 +1213,7 @@
!
setname
0
x1a1
莫忘 メメント
!
setname
0
x1a2
百夫长骑士 センチュリオン
!
setname
0
x1a3
异响鸣 ヴァルモニカ
!
setname
0
x1a4
蒂斯蒂娜
Tistina
!
setname
0
x1a4
提斯蒂娜 ティスティナ
!
setname
0
x1a5
于贝尔 ユベル
!
setname
0
x1a6
肃声 粛声
!
setname
0
x1a7
白斗气 ホワイト・オーラ
...
...
@@ -1219,8 +1221,8 @@
!
setname
0
x1a9
灿幻 燦幻
!
setname
0
x1aa
天杯龙 天盃龍
!
setname
0
x1ab
蕾祸 蕾禍
!
setname
0
x1ac
飞龙炎
Salamandra
!
setname
0
x1ad
灰
尽
Ashened
!
setname
0
x1ac
飞龙炎
サラマンドラ
!
setname
0
x1ad
灰
灭 灰滅
!
setname
0
x1ae
千年 千年/ミレニアム
!
setname
0
x1af
艾格佐德 エグゾード
!
setname
0
x1b0
刻魔 デモンスミス
...
...
@@ -1241,3 +1243,5 @@
!
setname
0
x1be
雷火沸动 ライゼオル
!
setname
0
x1bf
码丽丝
M
∀
LICE
!
setname
0
x1c0
龙华 竜華
!
setname
0
x1c1
阿耳戈视☆将星
ARG
☆
S
!
setname
0
x1c2
喷水引擎 アクア・ジェット
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