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
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
MyCard
ygopro
Commits
23c372bd
Commit
23c372bd
authored
Oct 21, 2024
by
wind2009
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop-202410' into develop
parents
c99d3dcc
599a3d2c
Pipeline
#30613
failed with stages
in 4 minutes and 12 seconds
Changes
25
Pipelines
1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
683 additions
and
3186 deletions
+683
-3186
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/client_field.cpp
gframe/client_field.cpp
+2
-2
gframe/data_manager.cpp
gframe/data_manager.cpp
+86
-99
gframe/data_manager.h
gframe/data_manager.h
+14
-22
gframe/deck_con.cpp
gframe/deck_con.cpp
+12
-12
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
+10
-7
gframe/game.cpp
gframe/game.cpp
+70
-68
gframe/game.h
gframe/game.h
+11
-8
gframe/gframe.cpp
gframe/gframe.cpp
+7
-14
gframe/irrUString.h
gframe/irrUString.h
+273
-2767
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+19
-19
gframe/myfilesystem.h
gframe/myfilesystem.h
+7
-10
gframe/network.h
gframe/network.h
+19
-20
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+1
-1
gframe/single_duel.h
gframe/single_duel.h
+18
-18
gframe/single_mode.cpp
gframe/single_mode.cpp
+3
-3
gframe/sound_manager.cpp
gframe/sound_manager.cpp
+1
-1
gframe/tag_duel.h
gframe/tag_duel.h
+18
-18
ocgcore
ocgcore
+1
-1
No files found.
gframe/CGUITTFont.cpp
View file @
23c372bd
...
@@ -269,7 +269,7 @@ bool CGUITTFont::load(const io::path& filename, const u32 size, const bool antia
...
@@ -269,7 +269,7 @@ bool CGUITTFont::load(const io::path& filename, const u32 size, const bool antia
// Log.
// Log.
if
(
logger
)
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.
// Grab the face.
SGUITTFace
*
face
=
0
;
SGUITTFace
*
face
=
0
;
...
@@ -304,8 +304,6 @@ bool CGUITTFont::load(const io::path& filename, const u32 size, const bool antia
...
@@ -304,8 +304,6 @@ bool CGUITTFont::load(const io::path& filename, const u32 size, const bool antia
return
false
;
return
false
;
}
}
}
else
{
}
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
);
c_faces
.
remove
(
filename
);
...
@@ -313,7 +311,6 @@ bool CGUITTFont::load(const io::path& filename, const u32 size, const bool antia
...
@@ -313,7 +311,6 @@ bool CGUITTFont::load(const io::path& filename, const u32 size, const bool antia
face
=
0
;
face
=
0
;
return
false
;
return
false
;
}
}
}
}
else
{
}
else
{
// Using another instance of this face.
// Using another instance of this face.
face
=
node
->
getValue
();
face
=
node
->
getValue
();
...
@@ -491,6 +488,12 @@ void CGUITTFont::setFontHinting(const bool enable, const bool enable_auto_hintin
...
@@ -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
)
{
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
)
if
(
!
Driver
)
return
;
return
;
...
@@ -506,7 +509,7 @@ void CGUITTFont::draw(const core::stringw& text, const core::rect<s32>& position
...
@@ -506,7 +509,7 @@ void CGUITTFont::draw(const core::stringw& text, const core::rect<s32>& position
// Determine offset positions.
// Determine offset positions.
if
(
hcenter
||
vcenter
)
{
if
(
hcenter
||
vcenter
)
{
textDimension
=
getDimension
(
text
.
c_str
()
);
textDimension
=
getDimension
(
utext
);
if
(
hcenter
)
if
(
hcenter
)
offset
.
X
=
((
position
.
getWidth
()
-
textDimension
.
Width
)
>>
1
)
+
offset
.
X
;
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
...
@@ -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
;
offset
.
Y
=
((
position
.
getHeight
()
-
textDimension
.
Height
)
>>
1
)
+
offset
.
Y
;
}
}
// Convert to a unicode string.
core
::
ustring
utext
(
text
);
// Set up our render map.
// Set up our render map.
core
::
map
<
u32
,
CGUITTGlyphPage
*>
Render_Map
;
core
::
map
<
u32
,
CGUITTGlyphPage
*>
Render_Map
;
...
...
gframe/CGUITTFont.h
View file @
23c372bd
...
@@ -54,7 +54,7 @@ public:
...
@@ -54,7 +54,7 @@ public:
//! Structure representing a single TrueType glyph.
//! Structure representing a single TrueType glyph.
struct
SGUITTGlyph
{
struct
SGUITTGlyph
{
//! Constructor.
//! Constructor.
SGUITTGlyph
()
:
isLoaded
(
false
),
glyph_page
(
0
),
surface
(
0
),
parent
(
0
)
{}
SGUITTGlyph
()
:
isLoaded
(
false
),
glyph_page
(
0
),
advance
({}),
surface
(
0
),
parent
(
0
)
{}
//! Destructor.
//! Destructor.
~
SGUITTGlyph
()
{
~
SGUITTGlyph
()
{
...
@@ -207,93 +207,96 @@ public:
...
@@ -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
);
static
CGUITTFont
*
create
(
IrrlichtDevice
*
device
,
const
io
::
path
&
filename
,
const
u32
size
,
const
bool
antialias
=
true
,
const
bool
transparency
=
true
);
//! Destructor
//! Destructor
virtual
~
CGUITTFont
()
;
~
CGUITTFont
()
override
;
//! Sets the amount of glyphs to batch load.
//! 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
;
batch_load_size
=
batch_size
;
}
}
//! Sets the maximum texture size for a page of glyphs.
//! 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
;
max_page_texture_size
=
texture_size
;
}
}
//! Get the font size.
//! Get the font size.
virtual
u32
getFontSize
()
const
{
u32
getFontSize
()
const
{
return
size
;
return
size
;
}
}
//! Check the font's transparency.
//! Check the font's transparency.
virtual
bool
isTransparent
()
const
{
bool
isTransparent
()
const
{
return
use_transparency
;
return
use_transparency
;
}
}
//! Check if the font auto-hinting is enabled.
//! Check if the font auto-hinting is enabled.
//! Auto-hinting is FreeType's built-in font hinting engine.
//! Auto-hinting is FreeType's built-in font hinting engine.
virtual
bool
useAutoHinting
()
const
{
bool
useAutoHinting
()
const
{
return
use_auto_hinting
;
return
use_auto_hinting
;
}
}
//! Check if the font hinting is enabled.
//! Check if the font hinting is enabled.
virtual
bool
useHinting
()
const
{
bool
useHinting
()
const
{
return
use_hinting
;
return
use_hinting
;
}
}
//! Check if the font is being loaded as a monochrome font.
//! 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.
//! 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
;
return
use_monochrome
;
}
}
//! Tells the font to allow transparency when rendering.
//! Tells the font to allow transparency when rendering.
//! Default: true.
//! Default: true.
//! \param flag If true, the font draws using transparency.
//! \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.
//! Tells the font to use monochrome rendering.
//! Default: false.
//! Default: false.
//! \param flag If true, the font draws using a monochrome image. If false, the font uses a grayscale image.
//! \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.
//! Enables or disables font hinting.
//! Default: Hinting and auto-hinting true.
//! Default: Hinting and auto-hinting true.
//! \param enable If false, font hinting is turned off. If true, font hinting is turned on.
//! \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.
//! \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.
//! Draws some text and clips it to the specified rectangle if wanted.
virtual
void
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
)
override
;
void
drawUstring
(
const
core
::
ustring
&
text
,
const
core
::
rect
<
s32
>&
position
,
video
::
SColor
color
,
bool
hcenter
=
false
,
bool
vcenter
=
false
,
video
::
SColor
color
,
bool
hcenter
=
false
,
bool
vcenter
=
false
,
const
core
::
rect
<
s32
>*
clip
=
0
);
const
core
::
rect
<
s32
>*
clip
=
0
);
//! Returns the dimension of a character produced by this font.
//! 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.
//! Returns the dimension of a text string.
virtual
core
::
dimension2d
<
u32
>
getDimension
(
const
wchar_t
*
text
)
const
;
core
::
dimension2d
<
u32
>
getDimension
(
const
wchar_t
*
text
)
const
override
;
virtual
core
::
dimension2d
<
u32
>
getDimension
(
const
core
::
ustring
&
text
)
const
;
core
::
dimension2d
<
u32
>
getDimension
(
const
core
::
ustring
&
text
)
const
;
//! Calculates the index of the character in the text which is on a specific position.
//! 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
;
s32
getCharacterFromPos
(
const
wchar_t
*
text
,
s32
pixel_x
)
const
override
;
virtual
s32
getCharacterFromPos
(
const
core
::
ustring
&
text
,
s32
pixel_x
)
const
;
s32
getCharacterFromPos
(
const
core
::
ustring
&
text
,
s32
pixel_x
)
const
;
//! Sets global kerning width for the font.
//! 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.
//! 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,
//! 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
;
s32
getKerningWidth
(
const
wchar_t
*
thisLetter
=
0
,
const
wchar_t
*
previousLetter
=
0
)
const
override
;
virtual
s32
getKerningWidth
(
const
uchar32_t
thisLetter
=
0
,
const
uchar32_t
previousLetter
=
0
)
const
;
s32
getKerningWidth
(
const
uchar32_t
thisLetter
=
0
,
const
uchar32_t
previousLetter
=
0
)
const
;
//! Returns the distance between letters
//! Returns the distance between letters
virtual
s32
getKerningHeight
()
const
;
s32
getKerningHeight
()
const
override
;
//! Define which characters should not be drawn by the font.
//! Define which characters should not be drawn by the font.
v
irtual
void
setInvisibleCharacters
(
const
wchar_t
*
s
)
;
v
oid
setInvisibleCharacters
(
const
wchar_t
*
s
)
override
;
v
irtual
v
oid
setInvisibleCharacters
(
const
core
::
ustring
&
s
);
void
setInvisibleCharacters
(
const
core
::
ustring
&
s
);
//! Get the last glyph page if there's still available slots.
//! Get the last glyph page if there's still available slots.
//! If not, it will return zero.
//! If not, it will return zero.
...
@@ -312,14 +315,14 @@ public:
...
@@ -312,14 +315,14 @@ public:
//! Create corresponding character's software image copy from the font,
//! Create corresponding character's software image copy from the font,
//! so you can use this data just like any ordinary video::IImage.
//! so you can use this data just like any ordinary video::IImage.
//! \param ch The character you need
//! \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.
//! 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.
//! \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.
//! 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
wchar_t
*
text
,
scene
::
ISceneManager
*
smgr
,
scene
::
ISceneNode
*
parent
=
0
,
const
video
::
SColor
&
color
=
video
::
SColor
(
255
,
0
,
0
,
0
),
bool
center
=
false
);
const
video
::
SColor
&
color
=
video
::
SColor
(
255
,
0
,
0
,
0
),
bool
center
=
false
);
...
@@ -340,7 +343,7 @@ private:
...
@@ -340,7 +343,7 @@ private:
static
scene
::
IMesh
*
shared_plane_ptr_
;
static
scene
::
IMesh
*
shared_plane_ptr_
;
static
scene
::
SMesh
shared_plane_
;
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
);
bool
load
(
const
io
::
path
&
filename
,
const
u32
size
,
const
bool
antialias
,
const
bool
transparency
);
void
reset_images
();
void
reset_images
();
void
update_glyph_pages
()
const
;
void
update_glyph_pages
()
const
;
...
...
gframe/bufferio.h
View file @
23c372bd
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define BUFFERIO_H
#define BUFFERIO_H
#include <cstdint>
#include <cstdint>
#include <cwchar>
#include "../ocgcore/buffer.h"
#include "../ocgcore/buffer.h"
class
BufferIO
{
class
BufferIO
{
...
@@ -49,6 +50,16 @@ public:
...
@@ -49,6 +50,16 @@ public:
*
pstr
=
0
;
*
pstr
=
0
;
return
l
;
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
>
template
<
typename
T
>
static
bool
CheckUTF8Byte
(
const
T
*
str
,
int
len
)
{
static
bool
CheckUTF8Byte
(
const
T
*
str
,
int
len
)
{
for
(
int
i
=
1
;
i
<
len
;
++
i
)
{
for
(
int
i
=
1
;
i
<
len
;
++
i
)
{
...
...
gframe/client_field.cpp
View file @
23c372bd
...
@@ -1548,10 +1548,10 @@ void ClientField::UpdateDeclarableList() {
...
@@ -1548,10 +1548,10 @@ void ClientField::UpdateDeclarableList() {
}
}
mainGame
->
lstANCard
->
clear
();
mainGame
->
lstANCard
->
clear
();
ancard
.
clear
();
ancard
.
clear
();
for
(
auto
cit
=
dataManager
.
strings_begin
;
cit
!=
dataManager
.
strings_end
;
++
cit
)
{
for
(
auto
cit
=
dataManager
.
strings_begin
();
cit
!=
dataManager
.
strings_end
()
;
++
cit
)
{
if
(
cit
->
second
.
name
.
find
(
pname
)
!=
std
::
wstring
::
npos
)
{
if
(
cit
->
second
.
name
.
find
(
pname
)
!=
std
::
wstring
::
npos
)
{
auto
cp
=
dataManager
.
GetCodePointer
(
cit
->
first
);
auto
cp
=
dataManager
.
GetCodePointer
(
cit
->
first
);
if
(
cp
==
dataManager
.
datas_end
)
if
(
cp
==
dataManager
.
datas_end
()
)
continue
;
continue
;
//datas.alias can be double card names or alias
//datas.alias can be double card names or alias
if
(
is_declarable
(
cp
->
second
,
declare_opcodes
))
{
if
(
is_declarable
(
cp
->
second
,
declare_opcodes
))
{
...
...
gframe/data_manager.cpp
View file @
23c372bd
#include "data_manager.h"
#include "data_manager.h"
#include "game.h"
#include "game.h"
#include <stdio.h>
#include <stdio.h>
#include "spmemvfs/spmemvfs.h"
namespace
ygo
{
namespace
ygo
{
...
@@ -9,11 +10,7 @@ byte DataManager::scriptBuffer[0x20000];
...
@@ -9,11 +10,7 @@ byte DataManager::scriptBuffer[0x20000];
IFileSystem
*
DataManager
::
FileSystem
;
IFileSystem
*
DataManager
::
FileSystem
;
DataManager
dataManager
;
DataManager
dataManager
;
DataManager
::
DataManager
()
:
_datas
(
16384
),
_strings
(
16384
)
{
DataManager
::
DataManager
()
:
_datas
(
32768
),
_strings
(
32768
)
{
datas_begin
=
_datas
.
begin
();
datas_end
=
_datas
.
end
();
strings_begin
=
_strings
.
begin
();
strings_end
=
_strings
.
end
();
extra_setcode
=
{
{
8512558u
,
{
0x8f
,
0x54
,
0x59
,
0x82
,
0x13a
}},
};
extra_setcode
=
{
{
8512558u
,
{
0x8f
,
0x54
,
0x59
,
0x82
,
0x13a
}},
};
}
}
bool
DataManager
::
ReadDB
(
sqlite3
*
pDB
)
{
bool
DataManager
::
ReadDB
(
sqlite3
*
pDB
)
{
...
@@ -80,10 +77,6 @@ bool DataManager::ReadDB(sqlite3* pDB) {
...
@@ -80,10 +77,6 @@ bool DataManager::ReadDB(sqlite3* pDB) {
_strings
[
cd
.
code
]
=
cs
;
_strings
[
cd
.
code
]
=
cs
;
}
}
}
while
(
step
!=
SQLITE_DONE
);
}
while
(
step
!=
SQLITE_DONE
);
datas_begin
=
_datas
.
begin
();
datas_end
=
_datas
.
end
();
strings_begin
=
_strings
.
begin
();
strings_end
=
_strings
.
end
();
sqlite3_finalize
(
pStmt
);
sqlite3_finalize
(
pStmt
);
return
true
;
return
true
;
}
}
...
@@ -123,8 +116,6 @@ bool DataManager::LoadStrings(const char* file) {
...
@@ -123,8 +116,6 @@ bool DataManager::LoadStrings(const char* file) {
ReadStringConfLine
(
linebuf
);
ReadStringConfLine
(
linebuf
);
}
}
fclose
(
fp
);
fclose
(
fp
);
for
(
int
i
=
0
;
i
<
301
;
++
i
)
myswprintf
(
numStrings
[
i
],
L"%d"
,
i
);
return
true
;
return
true
;
}
}
bool
DataManager
::
LoadStrings
(
IReadFile
*
reader
)
{
bool
DataManager
::
LoadStrings
(
IReadFile
*
reader
)
{
...
@@ -174,12 +165,30 @@ void DataManager::ReadStringConfLine(const char* linebuf) {
...
@@ -174,12 +165,30 @@ void DataManager::ReadStringConfLine(const char* linebuf) {
}
}
}
}
bool
DataManager
::
Error
(
sqlite3
*
pDB
,
sqlite3_stmt
*
pStmt
)
{
bool
DataManager
::
Error
(
sqlite3
*
pDB
,
sqlite3_stmt
*
pStmt
)
{
std
::
strncpy
(
errmsg
,
sqlite3_errmsg
(
pDB
),
sizeof
errmsg
)
;
errmsg
[
0
]
=
'\0'
;
BufferIO
::
NullTerminate
(
errmsg
);
std
::
strncat
(
errmsg
,
sqlite3_errmsg
(
pDB
),
sizeof
errmsg
-
1
);
if
(
pStmt
)
if
(
pStmt
)
sqlite3_finalize
(
pStmt
);
sqlite3_finalize
(
pStmt
);
return
false
;
return
false
;
}
}
code_pointer
DataManager
::
GetCodePointer
(
unsigned
int
code
)
const
{
return
_datas
.
find
(
code
);
}
string_pointer
DataManager
::
GetStringPointer
(
unsigned
int
code
)
const
{
return
_strings
.
find
(
code
);
}
code_pointer
DataManager
::
datas_begin
()
{
return
_datas
.
cbegin
();
}
code_pointer
DataManager
::
datas_end
()
{
return
_datas
.
cend
();
}
string_pointer
DataManager
::
strings_begin
()
{
return
_strings
.
cbegin
();
}
string_pointer
DataManager
::
strings_end
()
{
return
_strings
.
cend
();
}
bool
DataManager
::
GetData
(
unsigned
int
code
,
CardData
*
pData
)
const
{
bool
DataManager
::
GetData
(
unsigned
int
code
,
CardData
*
pData
)
const
{
auto
cdit
=
_datas
.
find
(
code
);
auto
cdit
=
_datas
.
find
(
code
);
if
(
cdit
==
_datas
.
end
())
if
(
cdit
==
_datas
.
end
())
...
@@ -189,12 +198,6 @@ bool DataManager::GetData(unsigned int code, CardData* pData) const {
...
@@ -189,12 +198,6 @@ bool DataManager::GetData(unsigned int code, CardData* pData) const {
}
}
return
true
;
return
true
;
}
}
code_pointer
DataManager
::
GetCodePointer
(
unsigned
int
code
)
const
{
return
_datas
.
find
(
code
);
}
string_pointer
DataManager
::
GetStringPointer
(
unsigned
int
code
)
const
{
return
_strings
.
find
(
code
);
}
bool
DataManager
::
GetString
(
unsigned
int
code
,
CardString
*
pStr
)
const
{
bool
DataManager
::
GetString
(
unsigned
int
code
,
CardString
*
pStr
)
const
{
auto
csit
=
_strings
.
find
(
code
);
auto
csit
=
_strings
.
find
(
code
);
if
(
csit
==
_strings
.
end
())
{
if
(
csit
==
_strings
.
end
())
{
...
@@ -276,14 +279,12 @@ std::vector<unsigned int> DataManager::GetSetCodes(std::wstring setname) const {
...
@@ -276,14 +279,12 @@ std::vector<unsigned int> DataManager::GetSetCodes(std::wstring setname) const {
}
}
return
matchingCodes
;
return
matchingCodes
;
}
}
const
wchar_t
*
DataManager
::
GetNumString
(
int
num
,
bool
bracket
)
{
std
::
wstring
DataManager
::
GetNumString
(
int
num
,
bool
bracket
)
const
{
if
(
!
bracket
)
if
(
!
bracket
)
return
numStrings
[
num
];
return
std
::
to_wstring
(
num
);
wchar_t
*
p
=
numBuffer
;
std
::
wstring
numBuffer
{
L"("
};
*
p
++
=
L'('
;
numBuffer
.
append
(
std
::
to_wstring
(
num
));
BufferIO
::
CopyWStrRef
(
numStrings
[
num
],
p
,
4
);
numBuffer
.
push_back
(
L')'
);
*
p
=
L')'
;
*++
p
=
0
;
return
numBuffer
;
return
numBuffer
;
}
}
const
wchar_t
*
DataManager
::
FormatLocation
(
int
location
,
int
sequence
)
const
{
const
wchar_t
*
DataManager
::
FormatLocation
(
int
location
,
int
sequence
)
const
{
...
@@ -308,95 +309,81 @@ const wchar_t* DataManager::FormatLocation(int location, int sequence) const {
...
@@ -308,95 +309,81 @@ const wchar_t* DataManager::FormatLocation(int location, int sequence) const {
else
else
return
unknown_string
;
return
unknown_string
;
}
}
const
wchar_t
*
DataManager
::
FormatAttribute
(
int
attribute
)
{
std
::
wstring
DataManager
::
FormatAttribute
(
unsigned
int
attribute
)
const
{
wchar_t
*
p
=
attBuffer
;
std
::
wstring
buffer
;
unsigned
filter
=
1
;
for
(
int
i
=
0
;
i
<
ATTRIBUTES_COUNT
;
++
i
)
{
int
i
=
1010
;
if
(
attribute
&
(
0x1U
<<
i
))
{
for
(;
filter
!=
0x80
;
filter
<<=
1
,
++
i
)
{
if
(
!
buffer
.
empty
())
if
(
attribute
&
filter
)
{
buffer
.
push_back
(
L'|'
);
BufferIO
::
CopyWStrRef
(
GetSysString
(
i
),
p
,
16
);
buffer
.
append
(
GetSysString
(
1010
+
i
));
*
p
=
L'|'
;
*++
p
=
0
;
}
}
}
}
if
(
p
!=
attBuffer
)
if
(
buffer
.
empty
())
*
(
p
-
1
)
=
0
;
return
std
::
wstring
(
unknown_string
);
else
return
buffer
;
return
unknown_string
;
}
return
attBuffer
;
std
::
wstring
DataManager
::
FormatRace
(
unsigned
int
race
)
const
{
}
std
::
wstring
buffer
;
const
wchar_t
*
DataManager
::
FormatRace
(
int
race
)
{
for
(
int
i
=
0
;
i
<
RACES_COUNT
;
++
i
)
{
wchar_t
*
p
=
racBuffer
;
if
(
race
&
(
0x1U
<<
i
))
{
unsigned
filter
=
1
;
if
(
!
buffer
.
empty
())
int
i
=
1020
;
buffer
.
push_back
(
L'|'
);
for
(;
filter
<
(
1
<<
RACES_COUNT
);
filter
<<=
1
,
++
i
)
{
buffer
.
append
(
GetSysString
(
1020
+
i
));
if
(
race
&
filter
)
{
BufferIO
::
CopyWStrRef
(
GetSysString
(
i
),
p
,
16
);
*
p
=
L'|'
;
*++
p
=
0
;
}
}
}
}
if
(
p
!=
racBuffer
)
if
(
buffer
.
empty
())
*
(
p
-
1
)
=
0
;
return
std
::
wstring
(
unknown_string
);
else
return
buffer
;
return
unknown_string
;
return
racBuffer
;
}
}
const
wchar_t
*
DataManager
::
FormatType
(
int
type
)
{
std
::
wstring
DataManager
::
FormatType
(
unsigned
int
type
)
const
{
wchar_t
*
p
=
tpBuffer
;
std
::
wstring
buffer
;
unsigned
filter
=
1
;
int
i
=
1050
;
int
i
=
1050
;
for
(;
filter
!=
0x8000000
;
filter
<<=
1
,
++
i
)
{
for
(
unsigned
filter
=
TYPE_MONSTER
;
filter
<=
TYPE_LINK
;
filter
<<=
1
,
++
i
)
{
if
(
type
&
filter
)
{
if
(
type
&
filter
)
{
BufferIO
::
CopyWStrRef
(
GetSysString
(
i
),
p
,
16
);
if
(
!
buffer
.
empty
())
*
p
=
L'|'
;
buffer
.
push_back
(
L'|'
)
;
*++
p
=
0
;
buffer
.
append
(
GetSysString
(
i
))
;
}
}
}
}
if
(
p
!=
tpBuffer
)
if
(
buffer
.
empty
())
*
(
p
-
1
)
=
0
;
return
std
::
wstring
(
unknown_string
);
else
return
buffer
;
return
unknown_string
;
return
tpBuffer
;
}
}
const
wchar_t
*
DataManager
::
FormatSetName
(
const
uint16_t
setcode
[])
{
std
::
wstring
DataManager
::
FormatSetName
(
const
uint16_t
setcode
[])
const
{
wchar_t
*
p
=
scB
uffer
;
std
::
wstring
b
uffer
;
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
if
(
!
setcode
[
i
])
if
(
!
setcode
[
i
])
break
;
break
;
const
wchar_t
*
setname
=
GetSetName
(
setcode
[
i
]);
const
wchar_t
*
setname
=
GetSetName
(
setcode
[
i
]);
if
(
setname
)
{
if
(
setname
)
{
BufferIO
::
CopyWStrRef
(
setname
,
p
,
32
);
if
(
!
buffer
.
empty
())
*
p
=
L'|'
;
buffer
.
push_back
(
L'|'
)
;
*++
p
=
0
;
buffer
.
append
(
setname
)
;
}
}
}
}
if
(
p
!=
scBuffer
)
if
(
buffer
.
empty
())
*
(
p
-
1
)
=
0
;
return
std
::
wstring
(
unknown_string
);
else
return
buffer
;
return
unknown_string
;
}
return
scBuffer
;
std
::
wstring
DataManager
::
FormatLinkMarker
(
unsigned
int
link_marker
)
const
{
}
std
::
wstring
buffer
;
const
wchar_t
*
DataManager
::
FormatLinkMarker
(
int
link_marker
)
{
if
(
link_marker
&
LINK_MARKER_TOP_LEFT
)
wchar_t
*
p
=
lmBuffer
;
buffer
.
append
(
L"[\u2196]"
);
*
p
=
0
;
if
(
link_marker
&
LINK_MARKER_TOP
)
if
(
link_marker
&
LINK_MARKER_TOP_LEFT
)
buffer
.
append
(
L"[\u2191]"
);
BufferIO
::
CopyWStrRef
(
L"[\u2196]"
,
p
,
4
);
if
(
link_marker
&
LINK_MARKER_TOP_RIGHT
)
if
(
link_marker
&
LINK_MARKER_TOP
)
buffer
.
append
(
L"[\u2197]"
);
BufferIO
::
CopyWStrRef
(
L"[\u2191]"
,
p
,
4
);
if
(
link_marker
&
LINK_MARKER_LEFT
)
if
(
link_marker
&
LINK_MARKER_TOP_RIGHT
)
buffer
.
append
(
L"[\u2190]"
);
BufferIO
::
CopyWStrRef
(
L"[\u2197]"
,
p
,
4
);
if
(
link_marker
&
LINK_MARKER_RIGHT
)
if
(
link_marker
&
LINK_MARKER_LEFT
)
buffer
.
append
(
L"[\u2192]"
);
BufferIO
::
CopyWStrRef
(
L"[\u2190]"
,
p
,
4
);
if
(
link_marker
&
LINK_MARKER_BOTTOM_LEFT
)
if
(
link_marker
&
LINK_MARKER_RIGHT
)
buffer
.
append
(
L"[\u2199]"
);
BufferIO
::
CopyWStrRef
(
L"[\u2192]"
,
p
,
4
);
if
(
link_marker
&
LINK_MARKER_BOTTOM
)
if
(
link_marker
&
LINK_MARKER_BOTTOM_LEFT
)
buffer
.
append
(
L"[\u2193]"
);
BufferIO
::
CopyWStrRef
(
L"[\u2199]"
,
p
,
4
);
if
(
link_marker
&
LINK_MARKER_BOTTOM_RIGHT
)
if
(
link_marker
&
LINK_MARKER_BOTTOM
)
buffer
.
append
(
L"[\u2198]"
);
BufferIO
::
CopyWStrRef
(
L"[\u2193]"
,
p
,
4
);
return
buffer
;
if
(
link_marker
&
LINK_MARKER_BOTTOM_RIGHT
)
BufferIO
::
CopyWStrRef
(
L"[\u2198]"
,
p
,
4
);
return
lmBuffer
;
}
}
uint32
DataManager
::
CardReader
(
uint32
code
,
card_data
*
pData
)
{
uint32
DataManager
::
CardReader
(
uint32
code
,
card_data
*
pData
)
{
if
(
!
dataManager
.
GetData
(
code
,
pData
))
if
(
!
dataManager
.
GetData
(
code
,
pData
))
...
...
gframe/data_manager.h
View file @
23c372bd
...
@@ -2,10 +2,9 @@
...
@@ -2,10 +2,9 @@
#define DATAMANAGER_H
#define DATAMANAGER_H
#include "config.h"
#include "config.h"
#include "sqlite3.h"
#include "spmemvfs/spmemvfs.h"
#include "client_card.h"
#include <unordered_map>
#include <unordered_map>
#include <sqlite3.h>
#include "client_card.h"
namespace
ygo
{
namespace
ygo
{
constexpr
int
MAX_STRING_ID
=
0x7ff
;
constexpr
int
MAX_STRING_ID
=
0x7ff
;
...
@@ -20,9 +19,14 @@ public:
...
@@ -20,9 +19,14 @@ public:
bool
LoadStrings
(
IReadFile
*
reader
);
bool
LoadStrings
(
IReadFile
*
reader
);
void
ReadStringConfLine
(
const
char
*
linebuf
);
void
ReadStringConfLine
(
const
char
*
linebuf
);
bool
Error
(
sqlite3
*
pDB
,
sqlite3_stmt
*
pStmt
=
nullptr
);
bool
Error
(
sqlite3
*
pDB
,
sqlite3_stmt
*
pStmt
=
nullptr
);
bool
GetData
(
unsigned
int
code
,
CardData
*
pData
)
const
;
code_pointer
GetCodePointer
(
unsigned
int
code
)
const
;
code_pointer
GetCodePointer
(
unsigned
int
code
)
const
;
string_pointer
GetStringPointer
(
unsigned
int
code
)
const
;
string_pointer
GetStringPointer
(
unsigned
int
code
)
const
;
code_pointer
datas_begin
();
code_pointer
datas_end
();
string_pointer
strings_begin
();
string_pointer
strings_end
();
bool
GetData
(
unsigned
int
code
,
CardData
*
pData
)
const
;
bool
GetString
(
unsigned
int
code
,
CardString
*
pStr
)
const
;
bool
GetString
(
unsigned
int
code
,
CardString
*
pStr
)
const
;
const
wchar_t
*
GetName
(
unsigned
int
code
)
const
;
const
wchar_t
*
GetName
(
unsigned
int
code
)
const
;
const
wchar_t
*
GetText
(
unsigned
int
code
)
const
;
const
wchar_t
*
GetText
(
unsigned
int
code
)
const
;
...
@@ -32,30 +36,18 @@ public:
...
@@ -32,30 +36,18 @@ public:
const
wchar_t
*
GetCounterName
(
int
code
)
const
;
const
wchar_t
*
GetCounterName
(
int
code
)
const
;
const
wchar_t
*
GetSetName
(
int
code
)
const
;
const
wchar_t
*
GetSetName
(
int
code
)
const
;
std
::
vector
<
unsigned
int
>
GetSetCodes
(
std
::
wstring
setname
)
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
*
FormatLocation
(
int
location
,
int
sequence
)
const
;
const
wchar_t
*
FormatAttribute
(
int
attribute
)
;
std
::
wstring
FormatAttribute
(
unsigned
int
attribute
)
const
;
const
wchar_t
*
FormatRace
(
int
race
)
;
std
::
wstring
FormatRace
(
unsigned
int
race
)
const
;
const
wchar_t
*
FormatType
(
int
type
)
;
std
::
wstring
FormatType
(
unsigned
int
type
)
const
;
const
wchar_t
*
FormatSetName
(
const
uint16_t
setcode
[])
;
std
::
wstring
FormatSetName
(
const
uint16_t
setcode
[])
const
;
const
wchar_t
*
FormatLinkMarker
(
int
link_marker
)
;
std
::
wstring
FormatLinkMarker
(
unsigned
int
link_marker
)
const
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_counterStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_counterStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_victoryStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_victoryStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_setnameStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_setnameStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_sysStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_sysStrings
;
code_pointer
datas_begin
;
code_pointer
datas_end
;
string_pointer
strings_begin
;
string_pointer
strings_end
;
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
]{};
char
errmsg
[
512
]{};
char
errmsg
[
512
]{};
static
byte
scriptBuffer
[
0x20000
];
static
byte
scriptBuffer
[
0x20000
];
...
...
gframe/deck_con.cpp
View file @
23c372bd
...
@@ -105,11 +105,11 @@ void DeckBuilder::Terminate() {
...
@@ -105,11 +105,11 @@ void DeckBuilder::Terminate() {
mainGame
->
scrPackCards
->
setVisible
(
false
);
mainGame
->
scrPackCards
->
setVisible
(
false
);
mainGame
->
scrPackCards
->
setPos
(
0
);
mainGame
->
scrPackCards
->
setPos
(
0
);
int
catesel
=
mainGame
->
cbDBCategory
->
getSelected
();
int
catesel
=
mainGame
->
cbDBCategory
->
getSelected
();
if
(
catesel
>=
0
)
if
(
catesel
>=
0
)
BufferIO
::
CopyW
Str
(
mainGame
->
cbDBCategory
->
getItem
(
catesel
),
mainGame
->
gameConf
.
lastcategory
,
64
);
BufferIO
::
CopyW
ideString
(
mainGame
->
cbDBCategory
->
getItem
(
catesel
),
mainGame
->
gameConf
.
lastcategory
);
int
decksel
=
mainGame
->
cbDBDecks
->
getSelected
();
int
decksel
=
mainGame
->
cbDBDecks
->
getSelected
();
if
(
decksel
>=
0
)
if
(
decksel
>=
0
)
BufferIO
::
CopyW
Str
(
mainGame
->
cbDBDecks
->
getItem
(
decksel
),
mainGame
->
gameConf
.
lastdeck
,
64
);
BufferIO
::
CopyW
ideString
(
mainGame
->
cbDBDecks
->
getItem
(
decksel
),
mainGame
->
gameConf
.
lastdeck
);
if
(
exit_on_return
)
if
(
exit_on_return
)
mainGame
->
device
->
closeDevice
();
mainGame
->
device
->
closeDevice
();
}
}
...
@@ -540,7 +540,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -540,7 +540,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
const
wchar_t
*
newcatename
=
mainGame
->
cbDMCategory
->
getText
();
const
wchar_t
*
newcatename
=
mainGame
->
cbDMCategory
->
getText
();
const
wchar_t
*
olddeckname
=
mainGame
->
lstDecks
->
getListItem
(
decksel
);
const
wchar_t
*
olddeckname
=
mainGame
->
lstDecks
->
getListItem
(
decksel
);
wchar_t
deckname
[
256
];
wchar_t
deckname
[
256
];
BufferIO
::
CopyW
Str
(
olddeckname
,
deckname
,
256
);
BufferIO
::
CopyW
ideString
(
olddeckname
,
deckname
);
wchar_t
oldfilepath
[
256
];
wchar_t
oldfilepath
[
256
];
deckManager
.
GetDeckFile
(
oldfilepath
,
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
deckManager
.
GetDeckFile
(
oldfilepath
,
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
wchar_t
newfilepath
[
256
];
wchar_t
newfilepath
[
256
];
...
@@ -580,7 +580,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -580,7 +580,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
const
wchar_t
*
newcatename
=
mainGame
->
cbDMCategory
->
getText
();
const
wchar_t
*
newcatename
=
mainGame
->
cbDMCategory
->
getText
();
const
wchar_t
*
olddeckname
=
mainGame
->
lstDecks
->
getListItem
(
decksel
);
const
wchar_t
*
olddeckname
=
mainGame
->
lstDecks
->
getListItem
(
decksel
);
wchar_t
deckname
[
256
];
wchar_t
deckname
[
256
];
BufferIO
::
CopyW
Str
(
olddeckname
,
deckname
,
256
);
BufferIO
::
CopyW
ideString
(
olddeckname
,
deckname
);
wchar_t
newfilepath
[
256
];
wchar_t
newfilepath
[
256
];
if
(
oldcatesel
!=
2
&&
newcatesel
==
0
)
{
if
(
oldcatesel
!=
2
&&
newcatesel
==
0
)
{
myswprintf
(
newfilepath
,
L"./deck/%ls.ydk"
,
deckname
);
myswprintf
(
newfilepath
,
L"./deck/%ls.ydk"
,
deckname
);
...
@@ -1015,7 +1015,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -1015,7 +1015,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
dragx
=
event
.
MouseInput
.
X
;
dragx
=
event
.
MouseInput
.
X
;
dragy
=
event
.
MouseInput
.
Y
;
dragy
=
event
.
MouseInput
.
Y
;
draging_pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
draging_pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
if
(
draging_pointer
==
dataManager
.
datas_end
)
if
(
draging_pointer
==
dataManager
.
datas_end
()
)
break
;
break
;
if
(
hovered_pos
==
4
)
{
if
(
hovered_pos
==
4
)
{
if
(
!
check_limit
(
draging_pointer
))
if
(
!
check_limit
(
draging_pointer
))
...
@@ -1069,7 +1069,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -1069,7 +1069,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if
(
hovered_pos
==
0
||
hovered_seq
==
-
1
)
if
(
hovered_pos
==
0
||
hovered_seq
==
-
1
)
break
;
break
;
auto
pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
auto
pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
if
(
pointer
==
dataManager
.
datas_end
)
if
(
pointer
==
dataManager
.
datas_end
()
)
break
;
break
;
soundManager
.
PlaySoundEffect
(
SOUND_CARD_DROP
);
soundManager
.
PlaySoundEffect
(
SOUND_CARD_DROP
);
if
(
hovered_pos
==
1
)
{
if
(
hovered_pos
==
1
)
{
...
@@ -1104,7 +1104,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -1104,7 +1104,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
pop_side
(
hovered_seq
);
pop_side
(
hovered_seq
);
}
else
{
}
else
{
auto
pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
auto
pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
if
(
pointer
==
dataManager
.
datas_end
)
if
(
pointer
==
dataManager
.
datas_end
()
)
break
;
break
;
if
(
!
check_limit
(
pointer
))
if
(
!
check_limit
(
pointer
))
break
;
break
;
...
@@ -1139,7 +1139,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -1139,7 +1139,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if
(
is_draging
)
if
(
is_draging
)
break
;
break
;
auto
pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
auto
pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
if
(
pointer
==
dataManager
.
datas_end
)
if
(
pointer
==
dataManager
.
datas_end
()
)
break
;
break
;
if
(
!
check_limit
(
pointer
))
if
(
!
check_limit
(
pointer
))
break
;
break
;
...
@@ -1409,10 +1409,10 @@ void DeckBuilder::FilterCards() {
...
@@ -1409,10 +1409,10 @@ void DeckBuilder::FilterCards() {
query_elements
.
push_back
(
element
);
query_elements
.
push_back
(
element
);
}
}
}
}
for
(
code_pointer
ptr
=
dataManager
.
datas_begin
;
ptr
!=
dataManager
.
datas_end
;
++
ptr
)
{
for
(
code_pointer
ptr
=
dataManager
.
datas_begin
();
ptr
!=
dataManager
.
datas_end
()
;
++
ptr
)
{
const
CardDataC
&
data
=
ptr
->
second
;
const
CardDataC
&
data
=
ptr
->
second
;
auto
strpointer
=
dataManager
.
GetStringPointer
(
ptr
->
first
);
auto
strpointer
=
dataManager
.
GetStringPointer
(
ptr
->
first
);
if
(
strpointer
==
dataManager
.
strings_end
)
if
(
strpointer
==
dataManager
.
strings_end
()
)
continue
;
continue
;
const
CardString
&
text
=
strpointer
->
second
;
const
CardString
&
text
=
strpointer
->
second
;
if
(
data
.
type
&
TYPE_TOKEN
)
if
(
data
.
type
&
TYPE_TOKEN
)
...
...
gframe/deck_manager.cpp
View file @
23c372bd
...
@@ -186,7 +186,7 @@ int DeckManager::LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec, bool is_p
...
@@ -186,7 +186,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
DeckManager
::
LoadDeck
(
Deck
&
deck
,
std
::
istringstream
&
deckStream
,
bool
is_packlist
)
{
int
ct
=
0
,
mainc
=
0
,
sidec
=
0
,
code
=
0
;
int
ct
=
0
,
mainc
=
0
,
sidec
=
0
,
code
=
0
;
int
cardlist
[
300
]{};
int
cardlist
[
PACK_MAX_SIZE
]{};
bool
is_side
=
false
;
bool
is_side
=
false
;
std
::
string
linebuf
;
std
::
string
linebuf
;
while
(
std
::
getline
(
deckStream
,
linebuf
,
'\n'
)
&&
ct
<
(
int
)(
sizeof
cardlist
/
sizeof
cardlist
[
0
]))
{
while
(
std
::
getline
(
deckStream
,
linebuf
,
'\n'
)
&&
ct
<
(
int
)(
sizeof
cardlist
/
sizeof
cardlist
[
0
]))
{
...
@@ -237,7 +237,7 @@ void DeckManager::GetCategoryPath(wchar_t* ret, int index, const wchar_t* text)
...
@@ -237,7 +237,7 @@ void DeckManager::GetCategoryPath(wchar_t* ret, int index, const wchar_t* text)
myswprintf
(
catepath
,
L"./pack"
);
myswprintf
(
catepath
,
L"./pack"
);
break
;
break
;
case
1
:
case
1
:
myswprintf
(
catepath
,
mainGame
->
gameConf
.
bot_deck_
path
);
BufferIO
::
CopyWideString
(
mainGame
->
gameConf
.
bot_deck_path
,
cate
path
);
break
;
break
;
case
-
1
:
case
-
1
:
case
2
:
case
2
:
...
...
gframe/deck_manager.h
View file @
23c372bd
...
@@ -12,6 +12,7 @@ namespace ygo {
...
@@ -12,6 +12,7 @@ namespace ygo {
constexpr
int
DECK_MIN_SIZE
=
40
;
constexpr
int
DECK_MIN_SIZE
=
40
;
constexpr
int
EXTRA_MAX_SIZE
=
15
;
constexpr
int
EXTRA_MAX_SIZE
=
15
;
constexpr
int
SIDE_MAX_SIZE
=
15
;
constexpr
int
SIDE_MAX_SIZE
=
15
;
constexpr
int
PACK_MAX_SIZE
=
1000
;
struct
LFList
{
struct
LFList
{
unsigned
int
hash
{};
unsigned
int
hash
{};
...
...
gframe/drawing.cpp
View file @
23c372bd
This diff is collapsed.
Click to expand it.
gframe/duelclient.cpp
View file @
23c372bd
...
@@ -1104,7 +1104,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
...
@@ -1104,7 +1104,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
break
;
break
;
}
}
case
HINT_RACE
:
{
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
->
AddLog
(
textBuffer
);
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
guiFont
,
textBuffer
);
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
guiFont
,
textBuffer
);
...
@@ -1114,7 +1114,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
...
@@ -1114,7 +1114,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
break
;
break
;
}
}
case
HINT_ATTRIB
:
{
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
->
AddLog
(
textBuffer
);
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
guiFont
,
textBuffer
);
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
guiFont
,
textBuffer
);
...
@@ -1201,7 +1201,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
...
@@ -1201,7 +1201,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
int
type
=
BufferIO
::
ReadUInt8
(
pbuf
);
int
type
=
BufferIO
::
ReadUInt8
(
pbuf
);
mainGame
->
showcarddif
=
110
;
mainGame
->
showcarddif
=
110
;
mainGame
->
showcardp
=
0
;
mainGame
->
showcardp
=
0
;
mainGame
->
dInfo
.
vic_string
=
0
;
mainGame
->
dInfo
.
vic_string
=
L""
;
wchar_t
vic_buf
[
256
];
wchar_t
vic_buf
[
256
];
if
(
player
==
2
)
if
(
player
==
2
)
mainGame
->
showcardcode
=
3
;
mainGame
->
showcardcode
=
3
;
...
@@ -1227,7 +1227,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
...
@@ -1227,7 +1227,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
}
}
mainGame
->
showcard
=
101
;
mainGame
->
showcard
=
101
;
mainGame
->
WaitFrameSignal
(
120
);
mainGame
->
WaitFrameSignal
(
120
);
mainGame
->
dInfo
.
vic_string
=
0
;
mainGame
->
dInfo
.
vic_string
=
L""
;
mainGame
->
showcard
=
0
;
mainGame
->
showcard
=
0
;
break
;
break
;
}
}
...
@@ -3184,7 +3184,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
...
@@ -3184,7 +3184,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
mainGame
->
WaitFrameSignal
(
30
);
mainGame
->
WaitFrameSignal
(
30
);
mainGame
->
lpframe
=
10
;
mainGame
->
lpframe
=
10
;
mainGame
->
WaitFrameSignal
(
11
);
mainGame
->
WaitFrameSignal
(
11
);
mainGame
->
lpcstring
=
0
;
mainGame
->
lpcstring
=
L""
;
mainGame
->
dInfo
.
lp
[
player
]
=
final
;
mainGame
->
dInfo
.
lp
[
player
]
=
final
;
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
...
@@ -3213,7 +3213,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
...
@@ -3213,7 +3213,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
mainGame
->
WaitFrameSignal
(
30
);
mainGame
->
WaitFrameSignal
(
30
);
mainGame
->
lpframe
=
10
;
mainGame
->
lpframe
=
10
;
mainGame
->
WaitFrameSignal
(
11
);
mainGame
->
WaitFrameSignal
(
11
);
mainGame
->
lpcstring
=
0
;
mainGame
->
lpcstring
=
L""
;
mainGame
->
dInfo
.
lp
[
player
]
=
final
;
mainGame
->
dInfo
.
lp
[
player
]
=
final
;
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
...
@@ -3365,7 +3365,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
...
@@ -3365,7 +3365,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
mainGame
->
WaitFrameSignal
(
30
);
mainGame
->
WaitFrameSignal
(
30
);
mainGame
->
lpframe
=
10
;
mainGame
->
lpframe
=
10
;
mainGame
->
WaitFrameSignal
(
11
);
mainGame
->
WaitFrameSignal
(
11
);
mainGame
->
lpcstring
=
0
;
mainGame
->
lpcstring
=
L""
;
mainGame
->
dInfo
.
lp
[
player
]
=
final
;
mainGame
->
dInfo
.
lp
[
player
]
=
final
;
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
...
...
gframe/event_handler.cpp
View file @
23c372bd
...
@@ -1600,7 +1600,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -1600,7 +1600,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
myswprintf
(
formatBuffer
,
L"
\n
LINK-%d"
,
mcard
->
link
);
myswprintf
(
formatBuffer
,
L"
\n
LINK-%d"
,
mcard
->
link
);
str
.
append
(
formatBuffer
);
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
);
str
.
append
(
formatBuffer
);
if
(
mcard
->
location
==
LOCATION_HAND
&&
(
mcard
->
type
&
TYPE_PENDULUM
))
{
if
(
mcard
->
location
==
LOCATION_HAND
&&
(
mcard
->
type
&
TYPE_PENDULUM
))
{
myswprintf
(
formatBuffer
,
L"
\n
%d/%d"
,
mcard
->
lscale
,
mcard
->
rscale
);
myswprintf
(
formatBuffer
,
L"
\n
%d/%d"
,
mcard
->
lscale
,
mcard
->
rscale
);
...
@@ -1626,9 +1626,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -1626,9 +1626,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
else
if
(
mcard
->
cHint
==
CHINT_CARD
)
else
if
(
mcard
->
cHint
==
CHINT_CARD
)
myswprintf
(
formatBuffer
,
L"
\n
%ls%ls"
,
dataManager
.
GetSysString
(
212
),
dataManager
.
GetName
(
mcard
->
chValue
));
myswprintf
(
formatBuffer
,
L"
\n
%ls%ls"
,
dataManager
.
GetSysString
(
212
),
dataManager
.
GetName
(
mcard
->
chValue
));
else
if
(
mcard
->
cHint
==
CHINT_RACE
)
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
)
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
)
else
if
(
mcard
->
cHint
==
CHINT_NUMBER
)
myswprintf
(
formatBuffer
,
L"
\n
%ls%d"
,
dataManager
.
GetSysString
(
215
),
mcard
->
chValue
);
myswprintf
(
formatBuffer
,
L"
\n
%ls%d"
,
dataManager
.
GetSysString
(
215
),
mcard
->
chValue
);
str
.
append
(
formatBuffer
);
str
.
append
(
formatBuffer
);
...
@@ -2480,11 +2480,14 @@ void ClientField::ShowCardInfoInList(ClientCard* pcard, irr::gui::IGUIElement* e
...
@@ -2480,11 +2480,14 @@ void ClientField::ShowCardInfoInList(ClientCard* pcard, irr::gui::IGUIElement* e
}
}
}
}
void
ClientField
::
SetResponseSelectedCards
()
const
{
void
ClientField
::
SetResponseSelectedCards
()
const
{
unsigned
char
respbuf
[
SIZE_RETURN_VALUE
];
unsigned
char
respbuf
[
SIZE_RETURN_VALUE
]{};
respbuf
[
0
]
=
selected_cards
.
size
();
int
len
=
(
int
)
selected_cards
.
size
();
for
(
size_t
i
=
0
;
i
<
selected_cards
.
size
();
++
i
)
if
(
len
>
UINT8_MAX
)
len
=
UINT8_MAX
;
respbuf
[
0
]
=
(
unsigned
char
)
len
;
for
(
int
i
=
0
;
i
<
len
;
++
i
)
respbuf
[
i
+
1
]
=
selected_cards
[
i
]
->
select_seq
;
respbuf
[
i
+
1
]
=
selected_cards
[
i
]
->
select_seq
;
DuelClient
::
SetResponseB
(
respbuf
,
selected_cards
.
size
()
+
1
);
DuelClient
::
SetResponseB
(
respbuf
,
len
+
1
);
}
}
void
ClientField
::
SetResponseSelectedOption
()
const
{
void
ClientField
::
SetResponseSelectedOption
()
const
{
if
(
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_OPTION
)
{
if
(
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_OPTION
)
{
...
...
gframe/game.cpp
View file @
23c372bd
This diff is collapsed.
Click to expand it.
gframe/game.h
View file @
23c372bd
...
@@ -22,10 +22,13 @@
...
@@ -22,10 +22,13 @@
#include <mutex>
#include <mutex>
#include <functional>
#include <functional>
#define DEFAULT_DUEL_RULE 5
constexpr
int
DEFAULT_DUEL_RULE
=
5
;
constexpr
int
CONFIG_LINE_SIZE
=
1024
;
namespace
ygo
{
namespace
ygo
{
bool
IsExtension
(
const
wchar_t
*
filename
,
const
wchar_t
*
extension
);
struct
Config
{
struct
Config
{
bool
use_d3d
{
false
};
bool
use_d3d
{
false
};
bool
use_image_scale
{
true
};
bool
use_image_scale
{
true
};
...
@@ -36,12 +39,13 @@ struct Config {
...
@@ -36,12 +39,13 @@ struct Config {
wchar_t
lastport
[
10
]{};
wchar_t
lastport
[
10
]{};
wchar_t
nickname
[
20
]{};
wchar_t
nickname
[
20
]{};
wchar_t
gamename
[
20
]{};
wchar_t
gamename
[
20
]{};
wchar_t
lastcategory
[
64
]{};
wchar_t
roompass
[
20
]{};
wchar_t
lastdeck
[
64
]{};
//path
wchar_t
lastcategory
[
256
]{};
wchar_t
lastdeck
[
256
]{};
wchar_t
textfont
[
256
]{};
wchar_t
textfont
[
256
]{};
wchar_t
numfont
[
256
]{};
wchar_t
numfont
[
256
]{};
wchar_t
roompass
[
20
]{};
wchar_t
bot_deck_path
[
256
]{};
wchar_t
bot_deck_path
[
64
]{};
//settings
//settings
int
chkMAutoPos
{
0
};
int
chkMAutoPos
{
0
};
int
chkSTAutoPos
{
1
};
int
chkSTAutoPos
{
1
};
...
@@ -102,7 +106,7 @@ struct DuelInfo {
...
@@ -102,7 +106,7 @@ struct DuelInfo {
wchar_t
hostname_tag
[
20
]{};
wchar_t
hostname_tag
[
20
]{};
wchar_t
clientname_tag
[
20
]{};
wchar_t
clientname_tag
[
20
]{};
wchar_t
strLP
[
2
][
16
]{};
wchar_t
strLP
[
2
][
16
]{};
wchar_t
*
vic_string
{
nullptr
}
;
std
::
wstring
vic_string
;
unsigned
char
player_type
{
0
};
unsigned
char
player_type
{
0
};
unsigned
char
time_player
{
0
};
unsigned
char
time_player
{
0
};
unsigned
short
time_limit
{
0
};
unsigned
short
time_limit
{
0
};
...
@@ -155,7 +159,6 @@ public:
...
@@ -155,7 +159,6 @@ public:
void
CheckMutual
(
ClientCard
*
pcard
,
int
mark
);
void
CheckMutual
(
ClientCard
*
pcard
,
int
mark
);
void
DrawCards
();
void
DrawCards
();
void
DrawCard
(
ClientCard
*
pcard
);
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
DrawMisc
();
void
DrawStatus
(
ClientCard
*
pcard
,
int
x1
,
int
y1
,
int
x2
,
int
y2
);
void
DrawStatus
(
ClientCard
*
pcard
,
int
x1
,
int
y1
,
int
x2
,
int
y2
);
void
DrawGUI
();
void
DrawGUI
();
...
@@ -256,7 +259,7 @@ public:
...
@@ -256,7 +259,7 @@ public:
int
lpd
;
int
lpd
;
int
lpplayer
;
int
lpplayer
;
int
lpccolor
;
int
lpccolor
;
wchar_t
*
lpcstring
;
std
::
wstring
lpcstring
;
bool
always_chain
;
bool
always_chain
;
bool
ignore_chain
;
bool
ignore_chain
;
bool
chain_when_avail
;
bool
chain_when_avail
;
...
...
gframe/gframe.cpp
View file @
23c372bd
...
@@ -115,16 +115,14 @@ int main(int argc, char* argv[]) {
...
@@ -115,16 +115,14 @@ int main(int argc, char* argv[]) {
++
i
;
++
i
;
if
(
i
<
wargc
)
{
if
(
i
<
wargc
)
{
deckCategorySpecified
=
true
;
deckCategorySpecified
=
true
;
wcsncpy
(
ygo
::
mainGame
->
gameConf
.
lastcategory
,
wargv
[
i
],
sizeof
ygo
::
mainGame
->
gameConf
.
lastcategory
/
sizeof
ygo
::
mainGame
->
gameConf
.
lastcategory
[
0
]);
BufferIO
::
CopyWideString
(
wargv
[
i
],
ygo
::
mainGame
->
gameConf
.
lastcategory
);
BufferIO
::
NullTerminate
(
ygo
::
mainGame
->
gameConf
.
lastcategory
);
}
}
}
else
if
(
!
wcscmp
(
wargv
[
i
],
L"-d"
))
{
// Deck
}
else
if
(
!
wcscmp
(
wargv
[
i
],
L"-d"
))
{
// Deck
++
i
;
++
i
;
if
(
!
deckCategorySpecified
)
if
(
!
deckCategorySpecified
)
ygo
::
mainGame
->
gameConf
.
lastcategory
[
0
]
=
0
;
ygo
::
mainGame
->
gameConf
.
lastcategory
[
0
]
=
0
;
if
(
i
+
1
<
wargc
)
{
// select deck
if
(
i
+
1
<
wargc
)
{
// select deck
wcsncpy
(
ygo
::
mainGame
->
gameConf
.
lastdeck
,
wargv
[
i
],
sizeof
ygo
::
mainGame
->
gameConf
.
lastdeck
/
sizeof
ygo
::
mainGame
->
gameConf
.
lastdeck
[
0
]);
BufferIO
::
CopyWideString
(
wargv
[
i
],
ygo
::
mainGame
->
gameConf
.
lastdeck
);
BufferIO
::
NullTerminate
(
ygo
::
mainGame
->
gameConf
.
lastdeck
);
continue
;
continue
;
}
else
{
// open deck
}
else
{
// open deck
exit_on_return
=
!
keep_on_return
;
exit_on_return
=
!
keep_on_return
;
...
@@ -137,8 +135,7 @@ int main(int argc, char* argv[]) {
...
@@ -137,8 +135,7 @@ int main(int argc, char* argv[]) {
myswprintf
(
open_file_name
,
L"%ls/%ls"
,
ygo
::
mainGame
->
gameConf
.
lastcategory
,
wargv
[
i
]);
myswprintf
(
open_file_name
,
L"%ls/%ls"
,
ygo
::
mainGame
->
gameConf
.
lastcategory
,
wargv
[
i
]);
#endif
#endif
}
else
{
}
else
{
wcsncpy
(
open_file_name
,
wargv
[
i
],
sizeof
open_file_name
/
sizeof
open_file_name
[
0
]);
BufferIO
::
CopyWideString
(
wargv
[
i
],
open_file_name
);
BufferIO
::
NullTerminate
(
open_file_name
);
}
}
}
}
ClickButton
(
ygo
::
mainGame
->
btnDeckEdit
);
ClickButton
(
ygo
::
mainGame
->
btnDeckEdit
);
...
@@ -159,8 +156,7 @@ int main(int argc, char* argv[]) {
...
@@ -159,8 +156,7 @@ int main(int argc, char* argv[]) {
++
i
;
++
i
;
if
(
i
<
wargc
)
{
if
(
i
<
wargc
)
{
open_file
=
true
;
open_file
=
true
;
wcsncpy
(
open_file_name
,
wargv
[
i
],
sizeof
open_file_name
/
sizeof
open_file_name
[
0
]);
BufferIO
::
CopyWideString
(
wargv
[
i
],
open_file_name
);
BufferIO
::
NullTerminate
(
open_file_name
);
}
}
ClickButton
(
ygo
::
mainGame
->
btnReplayMode
);
ClickButton
(
ygo
::
mainGame
->
btnReplayMode
);
if
(
open_file
)
if
(
open_file
)
...
@@ -171,8 +167,7 @@ int main(int argc, char* argv[]) {
...
@@ -171,8 +167,7 @@ int main(int argc, char* argv[]) {
++
i
;
++
i
;
if
(
i
<
wargc
)
{
if
(
i
<
wargc
)
{
open_file
=
true
;
open_file
=
true
;
wcsncpy
(
open_file_name
,
wargv
[
i
],
sizeof
open_file_name
/
sizeof
open_file_name
[
0
]);
BufferIO
::
CopyWideString
(
wargv
[
i
],
open_file_name
);
BufferIO
::
NullTerminate
(
open_file_name
);
}
}
ClickButton
(
ygo
::
mainGame
->
btnSingleMode
);
ClickButton
(
ygo
::
mainGame
->
btnSingleMode
);
if
(
open_file
)
if
(
open_file
)
...
@@ -182,16 +177,14 @@ int main(int argc, char* argv[]) {
...
@@ -182,16 +177,14 @@ int main(int argc, char* argv[]) {
wchar_t
*
pstrext
=
wargv
[
1
]
+
wcslen
(
wargv
[
1
])
-
4
;
wchar_t
*
pstrext
=
wargv
[
1
]
+
wcslen
(
wargv
[
1
])
-
4
;
if
(
!
mywcsncasecmp
(
pstrext
,
L".ydk"
,
4
))
{
if
(
!
mywcsncasecmp
(
pstrext
,
L".ydk"
,
4
))
{
open_file
=
true
;
open_file
=
true
;
wcsncpy
(
open_file_name
,
wargv
[
i
],
sizeof
open_file_name
/
sizeof
open_file_name
[
0
]);
BufferIO
::
CopyWideString
(
wargv
[
i
],
open_file_name
);
BufferIO
::
NullTerminate
(
open_file_name
);
exit_on_return
=
!
keep_on_return
;
exit_on_return
=
!
keep_on_return
;
ClickButton
(
ygo
::
mainGame
->
btnDeckEdit
);
ClickButton
(
ygo
::
mainGame
->
btnDeckEdit
);
break
;
break
;
}
}
if
(
!
mywcsncasecmp
(
pstrext
,
L".yrp"
,
4
))
{
if
(
!
mywcsncasecmp
(
pstrext
,
L".yrp"
,
4
))
{
open_file
=
true
;
open_file
=
true
;
wcsncpy
(
open_file_name
,
wargv
[
i
],
sizeof
open_file_name
/
sizeof
open_file_name
[
0
]);
BufferIO
::
CopyWideString
(
wargv
[
i
],
open_file_name
);
BufferIO
::
NullTerminate
(
open_file_name
);
exit_on_return
=
!
keep_on_return
;
exit_on_return
=
!
keep_on_return
;
ClickButton
(
ygo
::
mainGame
->
btnReplayMode
);
ClickButton
(
ygo
::
mainGame
->
btnReplayMode
);
ClickButton
(
ygo
::
mainGame
->
btnLoadReplay
);
ClickButton
(
ygo
::
mainGame
->
btnLoadReplay
);
...
...
gframe/irrUString.h
View file @
23c372bd
This diff is collapsed.
Click to expand it.
gframe/menu_handler.cpp
View file @
23c372bd
...
@@ -13,11 +13,9 @@
...
@@ -13,11 +13,9 @@
namespace
ygo
{
namespace
ygo
{
void
UpdateDeck
()
{
void
UpdateDeck
()
{
BufferIO
::
CopyWStr
(
mainGame
->
cbCategorySelect
->
getItem
(
mainGame
->
cbCategorySelect
->
getSelected
()),
BufferIO
::
CopyWideString
(
mainGame
->
cbCategorySelect
->
getText
(),
mainGame
->
gameConf
.
lastcategory
);
mainGame
->
gameConf
.
lastcategory
,
64
);
BufferIO
::
CopyWideString
(
mainGame
->
cbDeckSelect
->
getText
(),
mainGame
->
gameConf
.
lastdeck
);
BufferIO
::
CopyWStr
(
mainGame
->
cbDeckSelect
->
getItem
(
mainGame
->
cbDeckSelect
->
getSelected
()),
unsigned
char
deckbuf
[
1024
]{};
mainGame
->
gameConf
.
lastdeck
,
64
);
unsigned
char
deckbuf
[
1024
];
auto
pdeck
=
deckbuf
;
auto
pdeck
=
deckbuf
;
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
main
.
size
()
+
deckManager
.
current_deck
.
extra
.
size
());
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
main
.
size
()
+
deckManager
.
current_deck
.
extra
.
size
());
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
side
.
size
());
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
side
.
size
());
...
@@ -68,14 +66,17 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -68,14 +66,17 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
TrimText
(
mainGame
->
ebJoinHost
);
mainGame
->
TrimText
(
mainGame
->
ebJoinHost
);
mainGame
->
TrimText
(
mainGame
->
ebJoinPort
);
mainGame
->
TrimText
(
mainGame
->
ebJoinPort
);
char
ip
[
20
];
char
ip
[
20
];
const
wchar_t
*
pstr
=
mainGame
->
ebJoinHost
->
getText
();
wchar_t
pstr
[
100
];
BufferIO
::
CopyWStr
(
pstr
,
ip
,
16
);
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
));
unsigned
int
remote_addr
=
htonl
(
inet_addr
(
ip
));
if
(
remote_addr
==
-
1
)
{
if
(
remote_addr
==
-
1
)
{
char
hostname
[
100
];
char
hostname
[
100
];
char
port
[
6
];
char
port
[
6
];
BufferIO
::
CopyWStr
(
pstr
,
hostname
,
100
);
BufferIO
::
EncodeUTF8
(
pstr
,
hostname
);
BufferIO
::
CopyWStr
(
mainGame
->
ebJoinPort
->
getText
(),
port
,
6
);
BufferIO
::
EncodeUTF8
(
portstr
,
port
);
struct
evutil_addrinfo
hints
;
struct
evutil_addrinfo
hints
;
struct
evutil_addrinfo
*
answer
=
NULL
;
struct
evutil_addrinfo
*
answer
=
NULL
;
std
::
memset
(
&
hints
,
0
,
sizeof
hints
);
std
::
memset
(
&
hints
,
0
,
sizeof
hints
);
...
@@ -97,9 +98,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -97,9 +98,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
evutil_freeaddrinfo
(
answer
);
evutil_freeaddrinfo
(
answer
);
}
}
}
}
unsigned
int
remote_port
=
wcstol
(
mainGame
->
ebJoinPort
->
getText
()
,
nullptr
,
10
);
unsigned
int
remote_port
=
wcstol
(
portstr
,
nullptr
,
10
);
BufferIO
::
CopyW
Str
(
pstr
,
mainGame
->
gameConf
.
lasthost
,
100
);
BufferIO
::
CopyW
ideString
(
pstr
,
mainGame
->
gameConf
.
lasthost
);
BufferIO
::
CopyW
Str
(
mainGame
->
ebJoinPort
->
getText
(),
mainGame
->
gameConf
.
lastport
,
20
);
BufferIO
::
CopyW
ideString
(
portstr
,
mainGame
->
gameConf
.
lastport
);
if
(
DuelClient
::
StartClient
(
remote_addr
,
remote_port
,
false
))
{
if
(
DuelClient
::
StartClient
(
remote_addr
,
remote_port
,
false
))
{
mainGame
->
btnCreateHost
->
setEnabled
(
false
);
mainGame
->
btnCreateHost
->
setEnabled
(
false
);
mainGame
->
btnJoinHost
->
setEnabled
(
false
);
mainGame
->
btnJoinHost
->
setEnabled
(
false
);
...
@@ -127,7 +128,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -127,7 +128,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
}
case
BUTTON_HOST_CONFIRM
:
{
case
BUTTON_HOST_CONFIRM
:
{
bot_mode
=
false
;
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
))
{
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
{
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1402
));
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1402
));
...
@@ -448,8 +449,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -448,8 +449,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
wcsncpy
(
deck_name
,
dash
+
1
,
256
);
wcsncpy
(
deck_name
,
dash
+
1
,
256
);
for
(
size_t
i
=
0
;
i
<
mainGame
->
cbDBDecks
->
getItemCount
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
mainGame
->
cbDBDecks
->
getItemCount
();
++
i
)
{
if
(
!
wcscmp
(
mainGame
->
cbDBDecks
->
getItem
(
i
),
deck_name
))
{
if
(
!
wcscmp
(
mainGame
->
cbDBDecks
->
getItem
(
i
),
deck_name
))
{
wcsncpy
(
mainGame
->
gameConf
.
lastdeck
,
deck_name
,
sizeof
mainGame
->
gameConf
.
lastdeck
/
sizeof
mainGame
->
gameConf
.
lastdeck
[
0
]);
BufferIO
::
CopyWideString
(
deck_name
,
mainGame
->
gameConf
.
lastdeck
);
BufferIO
::
NullTerminate
(
mainGame
->
gameConf
.
lastdeck
);
mainGame
->
cbDBDecks
->
setSelected
(
i
);
mainGame
->
cbDBDecks
->
setSelected
(
i
);
break
;
break
;
}
}
...
@@ -457,15 +457,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -457,15 +457,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
else
{
// only deck name
}
else
{
// only deck name
for
(
size_t
i
=
0
;
i
<
mainGame
->
cbDBDecks
->
getItemCount
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
mainGame
->
cbDBDecks
->
getItemCount
();
++
i
)
{
if
(
!
wcscmp
(
mainGame
->
cbDBDecks
->
getItem
(
i
),
open_file_name
))
{
if
(
!
wcscmp
(
mainGame
->
cbDBDecks
->
getItem
(
i
),
open_file_name
))
{
wcsncpy
(
mainGame
->
gameConf
.
lastdeck
,
open_file_name
,
sizeof
mainGame
->
gameConf
.
lastdeck
/
sizeof
mainGame
->
gameConf
.
lastdeck
[
0
]);
BufferIO
::
CopyWideString
(
open_file_name
,
mainGame
->
gameConf
.
lastdeck
);
BufferIO
::
NullTerminate
(
mainGame
->
gameConf
.
lastdeck
);
mainGame
->
cbDBDecks
->
setSelected
(
i
);
mainGame
->
cbDBDecks
->
setSelected
(
i
);
break
;
break
;
}
}
}
}
}
}
open_file
=
false
;
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
);
deckManager
.
LoadCurrentDeck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
mainGame
->
ebDeckname
->
setText
(
L""
);
mainGame
->
ebDeckname
->
setText
(
L""
);
}
}
...
@@ -495,7 +495,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -495,7 +495,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
HideElement
(
mainGame
->
wReplaySave
);
mainGame
->
HideElement
(
mainGame
->
wReplaySave
);
if
(
prev_operation
==
BUTTON_RENAME_REPLAY
)
{
if
(
prev_operation
==
BUTTON_RENAME_REPLAY
)
{
wchar_t
newname
[
256
];
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
))
{
if
(
mywcsncasecmp
(
newname
+
wcslen
(
newname
)
-
4
,
L".yrp"
,
4
))
{
myswprintf
(
newname
,
L"%ls.yrp"
,
mainGame
->
ebRSName
->
getText
());
myswprintf
(
newname
,
L"%ls.yrp"
,
mainGame
->
ebRSName
->
getText
());
}
}
...
...
gframe/myfilesystem.h
View file @
23c372bd
#ifndef FILESYSTEM_H
#ifndef FILESYSTEM_H
#define FILESYSTEM_H
#define FILESYSTEM_H
#include <
string.h
>
#include <
cstdio
>
#include <functional>
#include <functional>
#include "bufferio.h"
#include "bufferio.h"
...
@@ -14,14 +14,13 @@
...
@@ -14,14 +14,13 @@
#ifdef _WIN32
#ifdef _WIN32
#include <wchar.h>
#define NOMINMAX
#define NOMINMAX
#include <Windows.h>
#include <Windows.h>
class
FileSystem
{
class
FileSystem
{
public:
public:
static
void
SafeFileName
(
wchar_t
*
wfile
)
{
static
void
SafeFileName
(
wchar_t
*
wfile
)
{
while
((
wfile
=
wcspbrk
(
wfile
,
L"<>:
\"
/
\\
|?*"
))
!=
NULL
)
while
((
wfile
=
std
::
wcspbrk
(
wfile
,
L"<>:
\"
/
\\
|?*"
))
!=
nullptr
)
*
wfile
++
=
'_'
;
*
wfile
++
=
'_'
;
}
}
...
@@ -71,8 +70,8 @@ public:
...
@@ -71,8 +70,8 @@ public:
static
bool
DeleteDir
(
const
wchar_t
*
wdir
)
{
static
bool
DeleteDir
(
const
wchar_t
*
wdir
)
{
wchar_t
pdir
[
256
];
wchar_t
pdir
[
256
];
BufferIO
::
CopyWStr
(
wdir
,
pdir
,
256
);
int
len
=
BufferIO
::
CopyWStr
(
wdir
,
pdir
,
sizeof
pdir
/
sizeof
pdir
[
0
]
);
pdir
[
wcslen
(
wdir
)
+
1
]
=
0
;
pdir
[
len
+
1
]
=
0
;
SHFILEOPSTRUCTW
lpFileOp
;
SHFILEOPSTRUCTW
lpFileOp
;
lpFileOp
.
hwnd
=
NULL
;
lpFileOp
.
hwnd
=
NULL
;
lpFileOp
.
wFunc
=
FO_DELETE
;
lpFileOp
.
wFunc
=
FO_DELETE
;
...
@@ -90,7 +89,7 @@ public:
...
@@ -90,7 +89,7 @@ public:
static
void
TraversalDir
(
const
wchar_t
*
wpath
,
const
std
::
function
<
void
(
const
wchar_t
*
,
bool
)
>&
cb
)
{
static
void
TraversalDir
(
const
wchar_t
*
wpath
,
const
std
::
function
<
void
(
const
wchar_t
*
,
bool
)
>&
cb
)
{
wchar_t
findstr
[
1024
];
wchar_t
findstr
[
1024
];
s
wprintf
(
findstr
,
1024
,
L"%s/*"
,
wpath
);
s
td
::
swprintf
(
findstr
,
sizeof
findstr
/
sizeof
findstr
[
0
]
,
L"%s/*"
,
wpath
);
WIN32_FIND_DATAW
fdataw
;
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
findstr
,
&
fdataw
);
HANDLE
fh
=
FindFirstFileW
(
findstr
,
&
fdataw
);
if
(
fh
==
INVALID_HANDLE_VALUE
)
if
(
fh
==
INVALID_HANDLE_VALUE
)
...
@@ -118,7 +117,7 @@ public:
...
@@ -118,7 +117,7 @@ public:
class
FileSystem
{
class
FileSystem
{
public:
public:
static
void
SafeFileName
(
wchar_t
*
wfile
)
{
static
void
SafeFileName
(
wchar_t
*
wfile
)
{
while
((
wfile
=
wcspbrk
(
wfile
,
L"/"
))
!=
NULL
)
while
((
wfile
=
std
::
wcspbrk
(
wfile
,
L"/"
))
!=
nullptr
)
*
wfile
++
=
'_'
;
*
wfile
++
=
'_'
;
}
}
...
@@ -208,9 +207,7 @@ public:
...
@@ -208,9 +207,7 @@ public:
while
((
dirp
=
readdir
(
dir
))
!=
nullptr
)
{
while
((
dirp
=
readdir
(
dir
))
!=
nullptr
)
{
file_unit
funit
;
file_unit
funit
;
char
fname
[
1024
];
char
fname
[
1024
];
strcpy
(
fname
,
path
);
std
::
snprintf
(
fname
,
sizeof
fname
,
"%s/%s"
,
path
,
dirp
->
d_name
);
strcat
(
fname
,
"/"
);
strcat
(
fname
,
dirp
->
d_name
);
stat
(
fname
,
&
fileStat
);
stat
(
fname
,
&
fileStat
);
funit
.
filename
=
std
::
string
(
dirp
->
d_name
);
funit
.
filename
=
std
::
string
(
dirp
->
d_name
);
funit
.
is_dir
=
S_ISDIR
(
fileStat
.
st_mode
);
funit
.
is_dir
=
S_ISDIR
(
fileStat
.
st_mode
);
...
...
gframe/network.h
View file @
23c372bd
...
@@ -208,26 +208,25 @@ inline unsigned int GetPosition(unsigned char* qbuf, int offset) {
...
@@ -208,26 +208,25 @@ inline unsigned int GetPosition(unsigned char* qbuf, int offset) {
class
DuelMode
{
class
DuelMode
{
public:
public:
virtual
~
DuelMode
()
{}
DuelMode
()
=
default
;
virtual
void
Chat
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
int
len
)
{}
virtual
~
DuelMode
()
=
default
;
virtual
void
JoinGame
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
bool
is_creater
)
{}
virtual
void
Chat
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
int
len
)
=
0
;
virtual
void
LeaveGame
(
DuelPlayer
*
dp
)
{}
virtual
void
JoinGame
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
bool
is_creater
)
=
0
;
virtual
void
ToDuelist
(
DuelPlayer
*
dp
)
{}
virtual
void
LeaveGame
(
DuelPlayer
*
dp
)
=
0
;
virtual
void
ToObserver
(
DuelPlayer
*
dp
)
{}
virtual
void
ToDuelist
(
DuelPlayer
*
dp
)
=
0
;
virtual
void
PlayerReady
(
DuelPlayer
*
dp
,
bool
is_ready
)
{}
virtual
void
ToObserver
(
DuelPlayer
*
dp
)
=
0
;
virtual
void
PlayerKick
(
DuelPlayer
*
dp
,
unsigned
char
pos
)
{}
virtual
void
PlayerReady
(
DuelPlayer
*
dp
,
bool
is_ready
)
=
0
;
virtual
void
UpdateDeck
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
int
len
)
{}
virtual
void
PlayerKick
(
DuelPlayer
*
dp
,
unsigned
char
pos
)
=
0
;
virtual
void
StartDuel
(
DuelPlayer
*
dp
)
{}
virtual
void
UpdateDeck
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
int
len
)
=
0
;
virtual
void
HandResult
(
DuelPlayer
*
dp
,
unsigned
char
res
)
{}
virtual
void
StartDuel
(
DuelPlayer
*
dp
)
=
0
;
virtual
void
TPResult
(
DuelPlayer
*
dp
,
unsigned
char
tp
)
{}
virtual
void
HandResult
(
DuelPlayer
*
dp
,
unsigned
char
res
)
=
0
;
virtual
void
Process
()
{}
virtual
void
TPResult
(
DuelPlayer
*
dp
,
unsigned
char
tp
)
=
0
;
virtual
int
Analyze
(
char
*
msgbuffer
,
unsigned
int
len
)
{
virtual
void
Process
()
=
0
;
return
0
;
virtual
int
Analyze
(
unsigned
char
*
msgbuffer
,
unsigned
int
len
)
=
0
;
}
virtual
void
Surrender
(
DuelPlayer
*
dp
)
=
0
;
virtual
void
Surrender
(
DuelPlayer
*
dp
)
{}
virtual
void
GetResponse
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
unsigned
int
len
)
=
0
;
virtual
void
GetResponse
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
unsigned
int
len
)
{}
virtual
void
TimeConfirm
(
DuelPlayer
*
dp
)
=
0
;
virtual
void
TimeConfirm
(
DuelPlayer
*
dp
)
{}
virtual
void
EndDuel
()
=
0
;
virtual
void
EndDuel
()
{}
public:
public:
event
*
etimer
{
nullptr
};
event
*
etimer
{
nullptr
};
...
...
gframe/replay_mode.cpp
View file @
23c372bd
...
@@ -234,7 +234,7 @@ bool ReplayMode::StartDuel() {
...
@@ -234,7 +234,7 @@ bool ReplayMode::StartDuel() {
}
}
cur_replay
.
ReadData
(
filename
,
slen
);
cur_replay
.
ReadData
(
filename
,
slen
);
filename
[
slen
]
=
0
;
filename
[
slen
]
=
0
;
if
(
!
preload_script
(
pduel
,
filename
,
0
))
{
if
(
!
preload_script
(
pduel
,
filename
))
{
return
false
;
return
false
;
}
}
}
}
...
...
gframe/single_duel.h
View file @
23c372bd
...
@@ -10,24 +10,24 @@ namespace ygo {
...
@@ -10,24 +10,24 @@ namespace ygo {
class
SingleDuel
:
public
DuelMode
{
class
SingleDuel
:
public
DuelMode
{
public:
public:
SingleDuel
(
bool
is_match
);
SingleDuel
(
bool
is_match
);
virtual
~
SingleDuel
()
;
~
SingleDuel
()
override
;
v
irtual
void
Chat
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
int
len
)
;
v
oid
Chat
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
int
len
)
override
;
v
irtual
void
JoinGame
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
bool
is_creater
)
;
v
oid
JoinGame
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
bool
is_creater
)
override
;
v
irtual
void
LeaveGame
(
DuelPlayer
*
dp
)
;
v
oid
LeaveGame
(
DuelPlayer
*
dp
)
override
;
v
irtual
void
ToDuelist
(
DuelPlayer
*
dp
)
;
v
oid
ToDuelist
(
DuelPlayer
*
dp
)
override
;
v
irtual
void
ToObserver
(
DuelPlayer
*
dp
)
;
v
oid
ToObserver
(
DuelPlayer
*
dp
)
override
;
v
irtual
void
PlayerReady
(
DuelPlayer
*
dp
,
bool
ready
)
;
v
oid
PlayerReady
(
DuelPlayer
*
dp
,
bool
ready
)
override
;
v
irtual
void
PlayerKick
(
DuelPlayer
*
dp
,
unsigned
char
pos
)
;
v
oid
PlayerKick
(
DuelPlayer
*
dp
,
unsigned
char
pos
)
override
;
v
irtual
void
UpdateDeck
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
int
len
)
;
v
oid
UpdateDeck
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
int
len
)
override
;
v
irtual
void
StartDuel
(
DuelPlayer
*
dp
)
;
v
oid
StartDuel
(
DuelPlayer
*
dp
)
override
;
v
irtual
void
HandResult
(
DuelPlayer
*
dp
,
unsigned
char
res
)
;
v
oid
HandResult
(
DuelPlayer
*
dp
,
unsigned
char
res
)
override
;
v
irtual
void
TPResult
(
DuelPlayer
*
dp
,
unsigned
char
tp
)
;
v
oid
TPResult
(
DuelPlayer
*
dp
,
unsigned
char
tp
)
override
;
v
irtual
void
Process
()
;
v
oid
Process
()
override
;
v
irtual
void
Surrender
(
DuelPlayer
*
dp
)
;
v
oid
Surrender
(
DuelPlayer
*
dp
)
override
;
virtual
int
Analyze
(
unsigned
char
*
msgbuffer
,
unsigned
int
len
)
;
int
Analyze
(
unsigned
char
*
msgbuffer
,
unsigned
int
len
)
override
;
v
irtual
void
GetResponse
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
unsigned
int
len
)
;
v
oid
GetResponse
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
unsigned
int
len
)
override
;
v
irtual
void
TimeConfirm
(
DuelPlayer
*
dp
)
;
v
oid
TimeConfirm
(
DuelPlayer
*
dp
)
override
;
v
irtual
void
EndDuel
()
;
v
oid
EndDuel
()
override
;
void
DuelEndProc
();
void
DuelEndProc
();
void
WaitforResponse
(
int
playerid
);
void
WaitforResponse
(
int
playerid
);
...
...
gframe/single_mode.cpp
View file @
23c372bd
...
@@ -60,11 +60,11 @@ int SingleMode::SinglePlayThread() {
...
@@ -60,11 +60,11 @@ int SingleMode::SinglePlayThread() {
if
(
open_file
)
{
if
(
open_file
)
{
open_file
=
false
;
open_file
=
false
;
slen
=
BufferIO
::
EncodeUTF8
(
open_file_name
,
filename
);
slen
=
BufferIO
::
EncodeUTF8
(
open_file_name
,
filename
);
if
(
!
preload_script
(
pduel
,
filename
,
0
))
{
if
(
!
preload_script
(
pduel
,
filename
))
{
wchar_t
fname
[
256
];
wchar_t
fname
[
256
];
myswprintf
(
fname
,
L"./single/%ls"
,
open_file_name
);
myswprintf
(
fname
,
L"./single/%ls"
,
open_file_name
);
slen
=
BufferIO
::
EncodeUTF8
(
fname
,
filename
);
slen
=
BufferIO
::
EncodeUTF8
(
fname
,
filename
);
if
(
!
preload_script
(
pduel
,
filename
,
0
))
if
(
!
preload_script
(
pduel
,
filename
))
slen
=
0
;
slen
=
0
;
}
}
}
else
{
}
else
{
...
@@ -72,7 +72,7 @@ int SingleMode::SinglePlayThread() {
...
@@ -72,7 +72,7 @@ int SingleMode::SinglePlayThread() {
wchar_t
fname
[
256
];
wchar_t
fname
[
256
];
myswprintf
(
fname
,
L"./single/%ls"
,
name
);
myswprintf
(
fname
,
L"./single/%ls"
,
name
);
slen
=
BufferIO
::
EncodeUTF8
(
fname
,
filename
);
slen
=
BufferIO
::
EncodeUTF8
(
fname
,
filename
);
if
(
!
preload_script
(
pduel
,
filename
,
0
))
if
(
!
preload_script
(
pduel
,
filename
))
slen
=
0
;
slen
=
0
;
}
}
if
(
slen
==
0
)
{
if
(
slen
==
0
)
{
...
...
gframe/sound_manager.cpp
View file @
23c372bd
...
@@ -40,7 +40,7 @@ void SoundManager::RefreshBGMList() {
...
@@ -40,7 +40,7 @@ void SoundManager::RefreshBGMList() {
void
SoundManager
::
RefershBGMDir
(
std
::
wstring
path
,
int
scene
)
{
void
SoundManager
::
RefershBGMDir
(
std
::
wstring
path
,
int
scene
)
{
std
::
wstring
search
=
L"./sound/BGM/"
+
path
;
std
::
wstring
search
=
L"./sound/BGM/"
+
path
;
FileSystem
::
TraversalDir
(
search
.
c_str
(),
[
this
,
&
path
,
scene
](
const
wchar_t
*
name
,
bool
isdir
)
{
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
;
std
::
wstring
filename
=
path
+
L"/"
+
name
;
BGMList
[
BGM_ALL
].
push_back
(
filename
);
BGMList
[
BGM_ALL
].
push_back
(
filename
);
BGMList
[
scene
].
push_back
(
filename
);
BGMList
[
scene
].
push_back
(
filename
);
...
...
gframe/tag_duel.h
View file @
23c372bd
...
@@ -10,24 +10,24 @@ namespace ygo {
...
@@ -10,24 +10,24 @@ namespace ygo {
class
TagDuel
:
public
DuelMode
{
class
TagDuel
:
public
DuelMode
{
public:
public:
TagDuel
();
TagDuel
();
virtual
~
TagDuel
()
;
~
TagDuel
()
override
;
v
irtual
void
Chat
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
int
len
)
;
v
oid
Chat
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
int
len
)
override
;
v
irtual
void
JoinGame
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
bool
is_creater
)
;
v
oid
JoinGame
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
bool
is_creater
)
override
;
v
irtual
void
LeaveGame
(
DuelPlayer
*
dp
)
;
v
oid
LeaveGame
(
DuelPlayer
*
dp
)
override
;
v
irtual
void
ToDuelist
(
DuelPlayer
*
dp
)
;
v
oid
ToDuelist
(
DuelPlayer
*
dp
)
override
;
v
irtual
void
ToObserver
(
DuelPlayer
*
dp
)
;
v
oid
ToObserver
(
DuelPlayer
*
dp
)
override
;
v
irtual
void
PlayerReady
(
DuelPlayer
*
dp
,
bool
ready
)
;
v
oid
PlayerReady
(
DuelPlayer
*
dp
,
bool
ready
)
override
;
v
irtual
void
PlayerKick
(
DuelPlayer
*
dp
,
unsigned
char
pos
)
;
v
oid
PlayerKick
(
DuelPlayer
*
dp
,
unsigned
char
pos
)
override
;
v
irtual
void
UpdateDeck
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
int
len
)
;
v
oid
UpdateDeck
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
int
len
)
override
;
v
irtual
void
StartDuel
(
DuelPlayer
*
dp
)
;
v
oid
StartDuel
(
DuelPlayer
*
dp
)
override
;
v
irtual
void
HandResult
(
DuelPlayer
*
dp
,
unsigned
char
res
)
;
v
oid
HandResult
(
DuelPlayer
*
dp
,
unsigned
char
res
)
override
;
v
irtual
void
TPResult
(
DuelPlayer
*
dp
,
unsigned
char
tp
)
;
v
oid
TPResult
(
DuelPlayer
*
dp
,
unsigned
char
tp
)
override
;
v
irtual
void
Process
()
;
v
oid
Process
()
override
;
v
irtual
void
Surrender
(
DuelPlayer
*
dp
)
;
v
oid
Surrender
(
DuelPlayer
*
dp
)
override
;
virtual
int
Analyze
(
unsigned
char
*
msgbuffer
,
unsigned
int
len
)
;
int
Analyze
(
unsigned
char
*
msgbuffer
,
unsigned
int
len
)
override
;
v
irtual
void
GetResponse
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
unsigned
int
len
)
;
v
oid
GetResponse
(
DuelPlayer
*
dp
,
unsigned
char
*
pdata
,
unsigned
int
len
)
override
;
v
irtual
void
TimeConfirm
(
DuelPlayer
*
dp
)
;
v
oid
TimeConfirm
(
DuelPlayer
*
dp
)
override
;
v
irtual
void
EndDuel
()
;
v
oid
EndDuel
()
override
;
void
DuelEndProc
();
void
DuelEndProc
();
void
WaitforResponse
(
int
playerid
);
void
WaitforResponse
(
int
playerid
);
...
...
ocgcore
@
eb36d391
Subproject commit
1701452d060a740c9d9cb796b2711550f5fb517e
Subproject commit
eb36d391ec450960e526032698e97b95376b4a32
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