Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
R
rd-ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
苍蓝
rd-ygopro
Commits
98180a64
Commit
98180a64
authored
May 11, 2024
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/Fluorohydride/ygopro
into server
parents
4a7147f3
7f95e8f8
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
458 additions
and
169 deletions
+458
-169
gframe/CGUITTFont.cpp
gframe/CGUITTFont.cpp
+19
-20
gframe/config.h
gframe/config.h
+1
-1
gframe/data_manager.cpp
gframe/data_manager.cpp
+14
-8
gframe/deck_con.cpp
gframe/deck_con.cpp
+1
-0
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+14
-15
gframe/drawing.cpp
gframe/drawing.cpp
+38
-18
gframe/duelclient.cpp
gframe/duelclient.cpp
+18
-19
gframe/duelclient.h
gframe/duelclient.h
+1
-1
gframe/event_handler.cpp
gframe/event_handler.cpp
+2
-1
gframe/game.cpp
gframe/game.cpp
+127
-70
gframe/game.h
gframe/game.h
+6
-2
gframe/gframe.cpp
gframe/gframe.cpp
+1
-1
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+2
-0
gframe/single_mode.cpp
gframe/single_mode.cpp
+1
-0
lflist.conf
lflist.conf
+213
-13
No files found.
gframe/CGUITTFont.cpp
View file @
98180a64
...
@@ -527,29 +527,28 @@ void CGUITTFont::draw(const core::stringw& text, const core::rect<s32>& position
...
@@ -527,29 +527,28 @@ void CGUITTFont::draw(const core::stringw& text, const core::rect<s32>& position
core
::
ustring
::
const_iterator
iter
(
utext
);
core
::
ustring
::
const_iterator
iter
(
utext
);
while
(
!
iter
.
atEnd
())
{
while
(
!
iter
.
atEnd
())
{
uchar32_t
currentChar
=
*
iter
;
uchar32_t
currentChar
=
*
iter
;
bool
lineBreak
=
false
;
if
(
currentChar
==
L'\r'
)
{
// Mac or Windows breaks
lineBreak
=
true
;
if
(
*
(
iter
+
1
)
==
L'\n'
)
// Windows line breaks.
currentChar
=
*
(
++
iter
);
}
else
if
(
currentChar
==
L'\n'
)
{
// Unix breaks
lineBreak
=
true
;
}
if
(
lineBreak
)
{
previousChar
=
0
;
offset
.
Y
+=
supposed_line_height
;
//font_metrics.ascender / 64;
offset
.
X
=
position
.
UpperLeftCorner
.
X
;
if
(
hcenter
)
offset
.
X
+=
(
position
.
getWidth
()
-
textDimension
.
Width
)
>>
1
;
++
iter
;
continue
;
}
n
=
getGlyphIndexByChar
(
currentChar
);
n
=
getGlyphIndexByChar
(
currentChar
);
bool
visible
=
(
Invisible
.
findFirst
(
currentChar
)
==
-
1
);
bool
visible
=
(
Invisible
.
findFirst
(
currentChar
)
==
-
1
);
if
(
n
>
0
&&
visible
)
{
if
(
n
>
0
&&
visible
)
{
bool
lineBreak
=
false
;
if
(
currentChar
==
L'\r'
)
{
// Mac or Windows breaks
lineBreak
=
true
;
if
(
*
(
iter
+
1
)
==
(
uchar32_t
)
'\n'
)
// Windows line breaks.
currentChar
=
*
(
++
iter
);
}
else
if
(
currentChar
==
(
uchar32_t
)
'\n'
)
{
// Unix breaks
lineBreak
=
true
;
}
if
(
lineBreak
)
{
previousChar
=
0
;
offset
.
Y
+=
supposed_line_height
;
//font_metrics.ascender / 64;
offset
.
X
=
position
.
UpperLeftCorner
.
X
;
if
(
hcenter
)
offset
.
X
+=
(
position
.
getWidth
()
-
textDimension
.
Width
)
>>
1
;
++
iter
;
continue
;
}
// Calculate the glyph offset.
// Calculate the glyph offset.
s32
offx
=
Glyphs
[
n
-
1
].
offset
.
X
;
s32
offx
=
Glyphs
[
n
-
1
].
offset
.
X
;
s32
offy
=
(
font_metrics
.
ascender
/
64
)
-
Glyphs
[
n
-
1
].
offset
.
Y
;
s32
offy
=
(
font_metrics
.
ascender
/
64
)
-
Glyphs
[
n
-
1
].
offset
.
Y
;
...
...
gframe/config.h
View file @
98180a64
...
@@ -97,7 +97,7 @@ using namespace io;
...
@@ -97,7 +97,7 @@ using namespace io;
#endif
#endif
extern
const
unsigned
short
PRO_VERSION
;
extern
const
unsigned
short
PRO_VERSION
;
extern
int
enable_log
;
extern
unsigned
int
enable_log
;
extern
bool
exit_on_return
;
extern
bool
exit_on_return
;
extern
bool
open_file
;
extern
bool
open_file
;
extern
wchar_t
open_file_name
[
256
];
extern
wchar_t
open_file_name
[
256
];
...
...
gframe/data_manager.cpp
View file @
98180a64
...
@@ -169,24 +169,30 @@ bool DataManager::LoadStrings(IReadFile* reader) {
...
@@ -169,24 +169,30 @@ bool DataManager::LoadStrings(IReadFile* reader) {
void
DataManager
::
ReadStringConfLine
(
const
char
*
linebuf
)
{
void
DataManager
::
ReadStringConfLine
(
const
char
*
linebuf
)
{
if
(
linebuf
[
0
]
!=
'!'
)
if
(
linebuf
[
0
]
!=
'!'
)
return
;
return
;
char
strbuf
[
256
];
char
strbuf
[
256
]{};
int
value
;
int
value
{};
wchar_t
strBuffer
[
4096
];
wchar_t
strBuffer
[
4096
]{};
sscanf
(
linebuf
,
"!%s"
,
strbuf
);
if
(
sscanf
(
linebuf
,
"!%63s"
,
strbuf
)
!=
1
)
return
;
if
(
!
strcmp
(
strbuf
,
"system"
))
{
if
(
!
strcmp
(
strbuf
,
"system"
))
{
sscanf
(
&
linebuf
[
7
],
"%d %240[^
\n
]"
,
&
value
,
strbuf
);
if
(
sscanf
(
&
linebuf
[
7
],
"%d %240[^
\n
]"
,
&
value
,
strbuf
)
!=
2
)
return
;
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_sysStrings
[
value
]
=
strBuffer
;
_sysStrings
[
value
]
=
strBuffer
;
}
else
if
(
!
strcmp
(
strbuf
,
"victory"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"victory"
))
{
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\n
]"
,
&
value
,
strbuf
);
if
(
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\n
]"
,
&
value
,
strbuf
)
!=
2
)
return
;
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_victoryStrings
[
value
]
=
strBuffer
;
_victoryStrings
[
value
]
=
strBuffer
;
}
else
if
(
!
strcmp
(
strbuf
,
"counter"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"counter"
))
{
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\n
]"
,
&
value
,
strbuf
);
if
(
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\n
]"
,
&
value
,
strbuf
)
!=
2
)
return
;
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_counterStrings
[
value
]
=
strBuffer
;
_counterStrings
[
value
]
=
strBuffer
;
}
else
if
(
!
strcmp
(
strbuf
,
"setname"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"setname"
))
{
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\t\n
]"
,
&
value
,
strbuf
);
//using tab for comment
//using tab for comment
if
(
sscanf
(
&
linebuf
[
8
],
"%x %240[^
\t\n
]"
,
&
value
,
strbuf
)
!=
2
)
return
;
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
BufferIO
::
DecodeUTF8
(
strbuf
,
strBuffer
);
_setnameStrings
[
value
]
=
strBuffer
;
_setnameStrings
[
value
]
=
strBuffer
;
}
}
...
...
gframe/deck_con.cpp
View file @
98180a64
...
@@ -94,6 +94,7 @@ void DeckBuilder::Terminate() {
...
@@ -94,6 +94,7 @@ void DeckBuilder::Terminate() {
mainGame
->
btnBigCardZoomIn
->
setVisible
(
false
);
mainGame
->
btnBigCardZoomIn
->
setVisible
(
false
);
mainGame
->
btnBigCardZoomOut
->
setVisible
(
false
);
mainGame
->
btnBigCardZoomOut
->
setVisible
(
false
);
mainGame
->
btnBigCardClose
->
setVisible
(
false
);
mainGame
->
btnBigCardClose
->
setVisible
(
false
);
mainGame
->
ResizeChatInputWindow
();
mainGame
->
PopupElement
(
mainGame
->
wMainMenu
);
mainGame
->
PopupElement
(
mainGame
->
wMainMenu
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
wACMessage
->
setVisible
(
false
);
mainGame
->
wACMessage
->
setVisible
(
false
);
...
...
gframe/deck_manager.cpp
View file @
98180a64
...
@@ -13,15 +13,16 @@ DeckManager deckManager;
...
@@ -13,15 +13,16 @@ DeckManager deckManager;
void
DeckManager
::
LoadLFListSingle
(
const
char
*
path
)
{
void
DeckManager
::
LoadLFListSingle
(
const
char
*
path
)
{
LFList
*
cur
=
nullptr
;
LFList
*
cur
=
nullptr
;
FILE
*
fp
=
fopen
(
path
,
"r"
);
FILE
*
fp
=
fopen
(
path
,
"r"
);
char
linebuf
[
256
];
char
linebuf
[
256
]
{}
;
wchar_t
strBuffer
[
256
];
wchar_t
strBuffer
[
256
]
{}
;
if
(
fp
)
{
if
(
fp
)
{
while
(
fgets
(
linebuf
,
256
,
fp
))
{
while
(
fgets
(
linebuf
,
256
,
fp
))
{
if
(
linebuf
[
0
]
==
'#'
)
if
(
linebuf
[
0
]
==
'#'
)
continue
;
continue
;
if
(
linebuf
[
0
]
==
'!'
)
{
if
(
linebuf
[
0
]
==
'!'
)
{
int
sa
=
BufferIO
::
DecodeUTF8
(
&
linebuf
[
1
],
strBuffer
);
int
sa
=
BufferIO
::
DecodeUTF8
(
&
linebuf
[
1
],
strBuffer
);
while
(
strBuffer
[
sa
-
1
]
==
L'\r'
||
strBuffer
[
sa
-
1
]
==
L'\n'
)
sa
--
;
while
(
strBuffer
[
sa
-
1
]
==
L'\r'
||
strBuffer
[
sa
-
1
]
==
L'\n'
)
sa
--
;
strBuffer
[
sa
]
=
0
;
strBuffer
[
sa
]
=
0
;
LFList
newlist
;
LFList
newlist
;
_lfList
.
push_back
(
newlist
);
_lfList
.
push_back
(
newlist
);
...
@@ -30,20 +31,18 @@ void DeckManager::LoadLFListSingle(const char* path) {
...
@@ -30,20 +31,18 @@ void DeckManager::LoadLFListSingle(const char* path) {
cur
->
hash
=
0x7dfcee6a
;
cur
->
hash
=
0x7dfcee6a
;
continue
;
continue
;
}
}
int
p
=
0
;
if
(
linebuf
[
0
]
==
0
)
while
(
linebuf
[
p
]
!=
' '
&&
linebuf
[
p
]
!=
'\t'
&&
linebuf
[
p
]
!=
0
)
p
++
;
if
(
linebuf
[
p
]
==
0
)
continue
;
continue
;
linebuf
[
p
++
]
=
0
;
int
code
=
0
;
int
sa
=
p
;
int
count
=
-
1
;
int
code
=
atoi
(
linebuf
);
if
(
sscanf
(
linebuf
,
"%d %d"
,
&
code
,
&
count
)
!=
2
)
if
(
code
==
0
)
continue
;
if
(
code
<=
0
||
code
>
99999999
)
continue
;
if
(
count
<
0
||
count
>
2
)
continue
;
if
(
!
cur
)
continue
;
continue
;
while
(
linebuf
[
p
]
==
' '
||
linebuf
[
p
]
==
'\t'
)
p
++
;
while
(
linebuf
[
p
]
!=
' '
&&
linebuf
[
p
]
!=
'\t'
&&
linebuf
[
p
]
!=
0
)
p
++
;
linebuf
[
p
]
=
0
;
int
count
=
atoi
(
&
linebuf
[
sa
]);
if
(
!
cur
)
continue
;
cur
->
content
[
code
]
=
count
;
cur
->
content
[
code
]
=
count
;
cur
->
hash
=
cur
->
hash
^
((
code
<<
18
)
|
(
code
>>
14
))
^
((
code
<<
(
27
+
count
))
|
(
code
>>
(
5
-
count
)));
cur
->
hash
=
cur
->
hash
^
((
code
<<
18
)
|
(
code
>>
14
))
^
((
code
<<
(
27
+
count
))
|
(
code
>>
(
5
-
count
)));
}
}
...
...
gframe/drawing.cpp
View file @
98180a64
...
@@ -989,26 +989,40 @@ void Game::DrawSpec() {
...
@@ -989,26 +989,40 @@ void Game::DrawSpec() {
showChat
=
false
;
showChat
=
false
;
hideChatTimer
--
;
hideChatTimer
--
;
}
}
int
chatRectY
=
0
;
for
(
int
i
=
0
;
i
<
8
;
++
i
)
{
for
(
int
i
=
0
;
i
<
8
;
++
i
)
{
static
unsigned
int
chatColor
[]
=
{
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xff8080ff
,
0xffff4040
,
0xffff4040
,
static
unsigned
int
chatColor
[]
=
{
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xffffffff
,
0xff8080ff
,
0xffff4040
,
0xffff4040
,
0xffff4040
,
0xff40ff40
,
0xff4040ff
,
0xff40ffff
,
0xffff40ff
,
0xffffff40
,
0xffffffff
,
0xff808080
,
0xff404040
};
0xffff4040
,
0xff40ff40
,
0xff4040ff
,
0xff40ffff
,
0xffff40ff
,
0xffffff40
,
0xffffffff
,
0xff808080
,
0xff404040
};
if
(
chatTiming
[
i
])
{
if
(
chatTiming
[
i
])
{
chatTiming
[
i
]
--
;
chatTiming
[
i
]
--
;
if
(
mainGame
->
dInfo
.
isStarted
&&
i
>=
5
)
if
(
!
is_building
)
{
continue
;
if
(
dInfo
.
isStarted
&&
i
>=
5
)
if
(
!
showChat
&&
i
>
2
)
continue
;
continue
;
if
(
!
showChat
&&
i
>
2
)
int
w
=
guiFont
->
getDimension
(
chatMsg
[
i
].
c_str
()).
Width
;
continue
;
}
int
x
=
wChat
->
getRelativePosition
().
UpperLeftCorner
.
X
;
int
y
=
window_size
.
Height
-
25
;
int
maxwidth
=
705
*
xScale
;
if
(
is_building
)
{
x
=
810
*
xScale
;
maxwidth
=
205
*
xScale
;
}
std
::
wstring
msg
=
SetStaticText
(
nullptr
,
maxwidth
,
guiFont
,
chatMsg
[
i
].
c_str
());
int
w
=
guiFont
->
getDimension
(
msg
).
Width
;
int
h
=
guiFont
->
getDimension
(
msg
).
Height
+
2
;
recti
rectloc
(
mainGame
->
wChat
->
getRelativePosition
().
UpperLeftCorner
.
X
,
mainGame
->
window_size
.
Height
-
45
,
mainGame
->
wChat
->
getRelativePosition
().
UpperLeftCorner
.
X
+
2
+
w
,
mainGame
->
window_size
.
Height
-
25
);
recti
rectloc
(
x
,
y
-
chatRectY
-
h
,
x
+
2
+
w
,
y
-
chatRectY
);
rectloc
-=
position2di
(
0
,
i
*
20
);
recti
msgloc
(
x
,
y
-
chatRectY
-
h
,
x
-
4
,
y
-
chatRectY
);
recti
msgloc
(
mainGame
->
wChat
->
getRelativePosition
().
UpperLeftCorner
.
X
,
mainGame
->
window_size
.
Height
-
45
,
mainGame
->
wChat
->
getRelativePosition
().
UpperLeftCorner
.
X
-
4
,
mainGame
->
window_size
.
Height
-
25
);
msgloc
-=
position2di
(
0
,
i
*
20
);
recti
shadowloc
=
msgloc
+
position2di
(
1
,
1
);
recti
shadowloc
=
msgloc
+
position2di
(
1
,
1
);
driver
->
draw2DRectangle
(
rectloc
,
0xa0000000
,
0xa0000000
,
0xa0000000
,
0xa0000000
);
driver
->
draw2DRectangle
(
rectloc
,
0xa0000000
,
0xa0000000
,
0xa0000000
,
0xa0000000
);
guiFont
->
draw
(
chatMsg
[
i
].
c_str
(),
msgloc
,
0xff000000
,
false
,
false
);
guiFont
->
draw
(
msg
.
c_str
(),
msgloc
,
0xff000000
,
false
,
false
);
guiFont
->
draw
(
chatMsg
[
i
].
c_str
(),
shadowloc
,
chatColor
[
chatType
[
i
]],
false
,
false
);
guiFont
->
draw
(
msg
.
c_str
(),
shadowloc
,
chatColor
[
chatType
[
i
]],
false
,
false
);
chatRectY
+=
h
;
}
}
}
}
}
}
...
@@ -1235,13 +1249,19 @@ void Game::DrawDeckBd() {
...
@@ -1235,13 +1249,19 @@ void Game::DrawDeckBd() {
driver
->
draw2DRectangleOutline
(
Resize
(
313
+
i
*
dx
,
563
,
359
+
i
*
dx
,
629
));
driver
->
draw2DRectangleOutline
(
Resize
(
313
+
i
*
dx
,
563
,
359
+
i
*
dx
,
629
));
}
}
}
}
//search result
if
(
is_siding
)
{
driver
->
draw2DRectangle
(
Resize
(
805
,
137
,
926
,
157
),
0x400000ff
,
0x400000ff
,
0x40000000
,
0x40000000
);
// side chat background
driver
->
draw2DRectangleOutline
(
Resize
(
804
,
136
,
926
,
157
));
driver
->
draw2DRectangle
(
Resize
(
805
,
10
,
1020
,
630
),
0x400000ff
,
0x400000ff
,
0x40000000
,
0x40000000
);
DrawShadowText
(
textFont
,
dataManager
.
GetSysString
(
1333
),
Resize
(
810
,
137
,
915
,
157
),
Resize
(
1
,
1
,
1
,
1
),
0xffffffff
,
0xff000000
,
false
,
true
);
driver
->
draw2DRectangleOutline
(
Resize
(
804
,
9
,
1020
,
630
));
DrawShadowText
(
numFont
,
deckBuilder
.
result_string
,
Resize
(
875
,
137
,
935
,
157
),
Resize
(
1
,
1
,
1
,
1
),
0xffffffff
,
0xff000000
,
false
,
true
);
}
else
{
driver
->
draw2DRectangle
(
Resize
(
805
,
160
,
1020
,
630
),
0x400000ff
,
0x400000ff
,
0x40000000
,
0x40000000
);
//search result
driver
->
draw2DRectangleOutline
(
Resize
(
804
,
159
,
1020
,
630
));
driver
->
draw2DRectangle
(
Resize
(
805
,
137
,
926
,
157
),
0x400000ff
,
0x400000ff
,
0x40000000
,
0x40000000
);
driver
->
draw2DRectangleOutline
(
Resize
(
804
,
136
,
926
,
157
));
DrawShadowText
(
textFont
,
dataManager
.
GetSysString
(
1333
),
Resize
(
810
,
137
,
915
,
157
),
Resize
(
1
,
1
,
1
,
1
),
0xffffffff
,
0xff000000
,
false
,
true
);
DrawShadowText
(
numFont
,
deckBuilder
.
result_string
,
Resize
(
875
,
137
,
935
,
157
),
Resize
(
1
,
1
,
1
,
1
),
0xffffffff
,
0xff000000
,
false
,
true
);
driver
->
draw2DRectangle
(
Resize
(
805
,
160
,
1020
,
630
),
0x400000ff
,
0x400000ff
,
0x40000000
,
0x40000000
);
driver
->
draw2DRectangleOutline
(
Resize
(
804
,
159
,
1020
,
630
));
}
for
(
size_t
i
=
0
;
i
<
9
&&
i
+
scrFilter
->
getPos
()
<
deckBuilder
.
results
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
9
&&
i
+
scrFilter
->
getPos
()
<
deckBuilder
.
results
.
size
();
++
i
)
{
code_pointer
ptr
=
deckBuilder
.
results
[
i
+
scrFilter
->
getPos
()];
code_pointer
ptr
=
deckBuilder
.
results
[
i
+
scrFilter
->
getPos
()];
if
(
i
>=
7
)
if
(
i
>=
7
)
...
...
gframe/duelclient.cpp
View file @
98180a64
...
@@ -210,8 +210,10 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
...
@@ -210,8 +210,10 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
mainGame
->
closeDoneSignal
.
Wait
();
mainGame
->
closeDoneSignal
.
Wait
();
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isInDuel
=
false
;
mainGame
->
dInfo
.
isFinished
=
false
;
mainGame
->
dInfo
.
isFinished
=
false
;
mainGame
->
is_building
=
false
;
mainGame
->
is_building
=
false
;
mainGame
->
ResizeChatInputWindow
();
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
if
(
bot_mode
)
if
(
bot_mode
)
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
...
@@ -371,11 +373,12 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
...
@@ -371,11 +373,12 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
case
STOC_CHANGE_SIDE
:
{
case
STOC_CHANGE_SIDE
:
{
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isInDuel
=
false
;
mainGame
->
dField
.
Clear
();
mainGame
->
dField
.
Clear
();
mainGame
->
is_building
=
true
;
mainGame
->
is_building
=
true
;
mainGame
->
is_siding
=
true
;
mainGame
->
is_siding
=
true
;
mainGame
->
CloseGameWindow
();
mainGame
->
CloseGameWindow
();
mainGame
->
wChat
->
setVisible
(
false
);
mainGame
->
ResizeChatInputWindow
(
);
mainGame
->
wDeckEdit
->
setVisible
(
false
);
mainGame
->
wDeckEdit
->
setVisible
(
false
);
mainGame
->
wFilter
->
setVisible
(
false
);
mainGame
->
wFilter
->
setVisible
(
false
);
mainGame
->
wSort
->
setVisible
(
false
);
mainGame
->
wSort
->
setVisible
(
false
);
...
@@ -401,6 +404,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
...
@@ -401,6 +404,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
break
;
break
;
}
}
case
STOC_WAITING_SIDE
:
{
case
STOC_WAITING_SIDE
:
{
mainGame
->
dInfo
.
isInDuel
=
false
;
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
mainGame
->
dField
.
Clear
();
mainGame
->
dField
.
Clear
();
mainGame
->
stHintMsg
->
setText
(
dataManager
.
GetSysString
(
1409
));
mainGame
->
stHintMsg
->
setText
(
dataManager
.
GetSysString
(
1409
));
...
@@ -490,6 +494,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
...
@@ -490,6 +494,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
mainGame
->
HideElement
(
mainGame
->
wLanWindow
);
mainGame
->
HideElement
(
mainGame
->
wLanWindow
);
mainGame
->
HideElement
(
mainGame
->
wSinglePlay
);
mainGame
->
HideElement
(
mainGame
->
wSinglePlay
);
mainGame
->
ShowElement
(
mainGame
->
wHostPrepare
);
mainGame
->
ShowElement
(
mainGame
->
wHostPrepare
);
mainGame
->
ResizeChatInputWindow
();
if
(
!
mainGame
->
chkIgnore1
->
isChecked
())
if
(
!
mainGame
->
chkIgnore1
->
isChecked
())
mainGame
->
wChat
->
setVisible
(
true
);
mainGame
->
wChat
->
setVisible
(
true
);
mainGame
->
gMutex
.
unlock
();
mainGame
->
gMutex
.
unlock
();
...
@@ -601,6 +606,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
...
@@ -601,6 +606,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
mainGame
->
btnM2
->
setVisible
(
false
);
mainGame
->
btnM2
->
setVisible
(
false
);
mainGame
->
btnEP
->
setVisible
(
false
);
mainGame
->
btnEP
->
setVisible
(
false
);
mainGame
->
btnShuffle
->
setVisible
(
false
);
mainGame
->
btnShuffle
->
setVisible
(
false
);
mainGame
->
ResizeChatInputWindow
();
if
(
!
mainGame
->
chkIgnore1
->
isChecked
())
if
(
!
mainGame
->
chkIgnore1
->
isChecked
())
mainGame
->
wChat
->
setVisible
(
true
);
mainGame
->
wChat
->
setVisible
(
true
);
if
(
mainGame
->
chkDefaultShowChain
->
isChecked
())
{
if
(
mainGame
->
chkDefaultShowChain
->
isChecked
())
{
...
@@ -663,6 +669,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
...
@@ -663,6 +669,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
mainGame
->
closeDoneSignal
.
Wait
();
mainGame
->
closeDoneSignal
.
Wait
();
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isInDuel
=
false
;
mainGame
->
dInfo
.
isFinished
=
true
;
mainGame
->
dInfo
.
isFinished
=
true
;
mainGame
->
is_building
=
false
;
mainGame
->
is_building
=
false
;
mainGame
->
wDeckEdit
->
setVisible
(
false
);
mainGame
->
wDeckEdit
->
setVisible
(
false
);
...
@@ -672,6 +679,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
...
@@ -672,6 +679,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
mainGame
->
btnStartBot
->
setEnabled
(
true
);
mainGame
->
btnStartBot
->
setEnabled
(
true
);
mainGame
->
btnBotCancel
->
setEnabled
(
true
);
mainGame
->
btnBotCancel
->
setEnabled
(
true
);
mainGame
->
stTip
->
setVisible
(
false
);
mainGame
->
stTip
->
setVisible
(
false
);
mainGame
->
ResizeChatInputWindow
();
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
if
(
bot_mode
)
if
(
bot_mode
)
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
...
@@ -741,28 +749,17 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
...
@@ -741,28 +749,17 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
case
STOC_CHAT
:
{
case
STOC_CHAT
:
{
STOC_Chat
*
pkt
=
(
STOC_Chat
*
)
pdata
;
STOC_Chat
*
pkt
=
(
STOC_Chat
*
)
pdata
;
int
player
=
pkt
->
player
;
int
player
=
pkt
->
player
;
auto
play_sound
=
false
;
if
(
player
<
4
)
{
if
(
player
<
4
)
{
if
(
mainGame
->
chkIgnore1
->
isChecked
())
if
(
mainGame
->
chkIgnore1
->
isChecked
())
break
;
break
;
if
(
!
mainGame
->
dInfo
.
isTag
)
{
auto
localplayer
=
mainGame
->
ChatLocalPlayer
(
player
);
if
(
mainGame
->
dInfo
.
isStarted
)
player
=
localplayer
&
0xf
;
player
=
mainGame
->
LocalPlayer
(
player
);
if
(
!
(
localplayer
&
0x10
))
}
else
{
play_sound
=
true
;
if
(
mainGame
->
dInfo
.
isStarted
&&
!
mainGame
->
dInfo
.
isFirst
)
player
^=
2
;
if
(
player
==
0
)
player
=
0
;
else
if
(
player
==
1
)
player
=
2
;
else
if
(
player
==
2
)
player
=
1
;
else
if
(
player
==
3
)
player
=
3
;
else
player
=
10
;
}
}
else
{
}
else
{
if
(
player
==
8
)
{
//system custom message.
if
(
player
==
8
)
{
//system custom message.
play_sound
=
true
;
if
(
mainGame
->
chkIgnore1
->
isChecked
())
if
(
mainGame
->
chkIgnore1
->
isChecked
())
break
;
break
;
}
else
if
(
player
<
11
||
player
>
19
)
{
}
else
if
(
player
<
11
||
player
>
19
)
{
...
@@ -774,7 +771,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
...
@@ -774,7 +771,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
wchar_t
msg
[
256
];
wchar_t
msg
[
256
];
BufferIO
::
CopyWStr
(
pkt
->
msg
,
msg
,
256
);
BufferIO
::
CopyWStr
(
pkt
->
msg
,
msg
,
256
);
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
mainGame
->
AddChatMsg
(
msg
,
player
);
mainGame
->
AddChatMsg
(
msg
,
player
,
play_sound
);
mainGame
->
gMutex
.
unlock
();
mainGame
->
gMutex
.
unlock
();
break
;
break
;
}
}
...
@@ -984,6 +981,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
...
@@ -984,6 +981,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
mainGame
->
closeDoneSignal
.
Wait
();
mainGame
->
closeDoneSignal
.
Wait
();
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isInDuel
=
false
;
mainGame
->
dInfo
.
isFinished
=
false
;
mainGame
->
dInfo
.
isFinished
=
false
;
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
...
@@ -1190,6 +1188,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
...
@@ -1190,6 +1188,7 @@ int DuelClient::ClientAnalyze(unsigned char* msg, unsigned int len) {
mainGame
->
showcard
=
0
;
mainGame
->
showcard
=
0
;
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
mainGame
->
dField
.
Clear
();
mainGame
->
dField
.
Clear
();
mainGame
->
dInfo
.
isInDuel
=
true
;
int
playertype
=
BufferIO
::
ReadUInt8
(
pbuf
);
int
playertype
=
BufferIO
::
ReadUInt8
(
pbuf
);
mainGame
->
dInfo
.
isFirst
=
(
playertype
&
0xf
)
?
false
:
true
;
mainGame
->
dInfo
.
isFirst
=
(
playertype
&
0xf
)
?
false
:
true
;
if
(
playertype
&
0xf0
)
if
(
playertype
&
0xf0
)
...
...
gframe/duelclient.h
View file @
98180a64
...
@@ -23,7 +23,6 @@ private:
...
@@ -23,7 +23,6 @@ private:
static
unsigned
char
response_buf
[
SIZE_RETURN_VALUE
];
static
unsigned
char
response_buf
[
SIZE_RETURN_VALUE
];
static
unsigned
int
response_len
;
static
unsigned
int
response_len
;
static
unsigned
int
watching
;
static
unsigned
int
watching
;
static
unsigned
char
selftype
;
static
bool
is_host
;
static
bool
is_host
;
static
event_base
*
client_base
;
static
event_base
*
client_base
;
static
bufferevent
*
client_bev
;
static
bufferevent
*
client_bev
;
...
@@ -39,6 +38,7 @@ private:
...
@@ -39,6 +38,7 @@ private:
static
wchar_t
event_string
[
256
];
static
wchar_t
event_string
[
256
];
static
mt19937
rnd
;
static
mt19937
rnd
;
public:
public:
static
unsigned
char
selftype
;
static
bool
StartClient
(
unsigned
int
ip
,
unsigned
short
port
,
bool
create_game
=
true
);
static
bool
StartClient
(
unsigned
int
ip
,
unsigned
short
port
,
bool
create_game
=
true
);
static
void
ConnectTimeout
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
);
static
void
ConnectTimeout
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
);
static
void
StopClient
(
bool
is_exiting
=
false
);
static
void
StopClient
(
bool
is_exiting
=
false
);
...
...
gframe/event_handler.cpp
View file @
98180a64
...
@@ -127,6 +127,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -127,6 +127,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if
(
mainGame
->
dInfo
.
player_type
==
7
)
{
if
(
mainGame
->
dInfo
.
player_type
==
7
)
{
DuelClient
::
StopClient
();
DuelClient
::
StopClient
();
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isInDuel
=
false
;
mainGame
->
dInfo
.
isFinished
=
false
;
mainGame
->
dInfo
.
isFinished
=
false
;
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
CloseDuelWindow
();
mainGame
->
CloseDuelWindow
();
...
@@ -1903,7 +1904,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
...
@@ -1903,7 +1904,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
CHECKBOX_DISABLE_CHAT
:
{
case
CHECKBOX_DISABLE_CHAT
:
{
bool
show
=
mainGame
->
is_building
?
false
:
!
mainGame
->
chkIgnore1
->
isChecked
();
bool
show
=
(
mainGame
->
is_building
&&
!
mainGame
->
is_siding
)
?
false
:
!
mainGame
->
chkIgnore1
->
isChecked
();
mainGame
->
wChat
->
setVisible
(
show
);
mainGame
->
wChat
->
setVisible
(
show
);
if
(
!
show
)
if
(
!
show
)
mainGame
->
ClearChatMsg
();
mainGame
->
ClearChatMsg
();
...
...
gframe/game.cpp
View file @
98180a64
This diff is collapsed.
Click to expand it.
gframe/game.h
View file @
98180a64
...
@@ -74,7 +74,8 @@ struct Config {
...
@@ -74,7 +74,8 @@ struct Config {
struct
DuelInfo
{
struct
DuelInfo
{
bool
isStarted
{
false
};
bool
isStarted
{
false
};
bool
isFinished
{
false
};
bool
isInDuel
{
false
};
bool
isFinished
{
false
};
bool
isReplay
{
false
};
bool
isReplay
{
false
};
bool
isReplaySkiping
{
false
};
bool
isReplaySkiping
{
false
};
bool
isFirst
{
false
};
bool
isFirst
{
false
};
...
@@ -169,7 +170,7 @@ public:
...
@@ -169,7 +170,7 @@ public:
void
ShowCardInfo
(
int
code
,
bool
resize
=
false
);
void
ShowCardInfo
(
int
code
,
bool
resize
=
false
);
void
ClearCardInfo
(
int
player
=
0
);
void
ClearCardInfo
(
int
player
=
0
);
void
AddLog
(
const
wchar_t
*
msg
,
int
param
=
0
);
void
AddLog
(
const
wchar_t
*
msg
,
int
param
=
0
);
void
AddChatMsg
(
const
wchar_t
*
msg
,
int
player
);
void
AddChatMsg
(
const
wchar_t
*
msg
,
int
player
,
bool
play_sound
=
false
);
void
ClearChatMsg
();
void
ClearChatMsg
();
void
AddDebugMsg
(
const
char
*
msgbuf
);
void
AddDebugMsg
(
const
char
*
msgbuf
);
void
ErrorLog
(
const
char
*
msgbuf
);
void
ErrorLog
(
const
char
*
msgbuf
);
...
@@ -179,6 +180,8 @@ public:
...
@@ -179,6 +180,8 @@ public:
void
CloseDuelWindow
();
void
CloseDuelWindow
();
int
LocalPlayer
(
int
player
)
const
;
int
LocalPlayer
(
int
player
)
const
;
int
OppositePlayer
(
int
player
);
int
ChatLocalPlayer
(
int
player
);
const
wchar_t
*
LocalName
(
int
local_player
);
const
wchar_t
*
LocalName
(
int
local_player
);
bool
HasFocus
(
EGUI_ELEMENT_TYPE
type
)
const
{
bool
HasFocus
(
EGUI_ELEMENT_TYPE
type
)
const
{
...
@@ -193,6 +196,7 @@ public:
...
@@ -193,6 +196,7 @@ public:
}
}
void
OnResize
();
void
OnResize
();
void
ResizeChatInputWindow
();
recti
Resize
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
);
recti
Resize
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
);
recti
Resize
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
,
s32
dx
,
s32
dy
,
s32
dx2
,
s32
dy2
);
recti
Resize
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
,
s32
dx
,
s32
dy
,
s32
dx2
,
s32
dy2
);
position2di
Resize
(
s32
x
,
s32
y
);
position2di
Resize
(
s32
x
,
s32
y
);
...
...
gframe/gframe.cpp
View file @
98180a64
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
#import <CoreFoundation/CoreFoundation.h>
#import <CoreFoundation/CoreFoundation.h>
#endif
#endif
int
enable_log
=
0
;
unsigned
int
enable_log
=
0x3
;
#ifndef YGOPRO_SERVER_MODE
#ifndef YGOPRO_SERVER_MODE
bool
exit_on_return
=
false
;
bool
exit_on_return
=
false
;
bool
open_file
=
false
;
bool
open_file
=
false
;
...
...
gframe/replay_mode.cpp
View file @
98180a64
...
@@ -254,6 +254,7 @@ void ReplayMode::EndDuel() {
...
@@ -254,6 +254,7 @@ void ReplayMode::EndDuel() {
mainGame
->
actionSignal
.
Wait
();
mainGame
->
actionSignal
.
Wait
();
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isInDuel
=
false
;
mainGame
->
dInfo
.
isFinished
=
true
;
mainGame
->
dInfo
.
isFinished
=
true
;
mainGame
->
dInfo
.
isReplay
=
false
;
mainGame
->
dInfo
.
isReplay
=
false
;
mainGame
->
dInfo
.
isSingleMode
=
false
;
mainGame
->
dInfo
.
isSingleMode
=
false
;
...
@@ -273,6 +274,7 @@ void ReplayMode::EndDuel() {
...
@@ -273,6 +274,7 @@ void ReplayMode::EndDuel() {
void
ReplayMode
::
Restart
(
bool
refresh
)
{
void
ReplayMode
::
Restart
(
bool
refresh
)
{
end_duel
(
pduel
);
end_duel
(
pduel
);
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isInDuel
=
false
;
mainGame
->
dInfo
.
isFinished
=
true
;
mainGame
->
dInfo
.
isFinished
=
true
;
mainGame
->
dField
.
Clear
();
mainGame
->
dField
.
Clear
();
//mainGame->device->setEventReceiver(&mainGame->dField);
//mainGame->device->setEventReceiver(&mainGame->dField);
...
...
gframe/single_mode.cpp
View file @
98180a64
...
@@ -159,6 +159,7 @@ int SingleMode::SinglePlayThread() {
...
@@ -159,6 +159,7 @@ int SingleMode::SinglePlayThread() {
if
(
!
is_closing
)
{
if
(
!
is_closing
)
{
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isInDuel
=
false
;
mainGame
->
dInfo
.
isFinished
=
true
;
mainGame
->
dInfo
.
isFinished
=
true
;
mainGame
->
dInfo
.
isSingleMode
=
false
;
mainGame
->
dInfo
.
isSingleMode
=
false
;
mainGame
->
gMutex
.
unlock
();
mainGame
->
gMutex
.
unlock
();
...
...
lflist.conf
View file @
98180a64
This diff is collapsed.
Click to expand it.
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