Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YGOPRO-520DIY
ygopro
Commits
c829f3ad
Commit
c829f3ad
authored
May 11, 2024
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Fluorohydride/ygopro into develop
parents
19e75eaf
b7dcae4e
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
213 additions
and
145 deletions
+213
-145
gframe/CGUITTFont.cpp
gframe/CGUITTFont.cpp
+19
-20
gframe/config.h
gframe/config.h
+1
-3
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
+22
-2
gframe/event_handler.cpp
gframe/event_handler.cpp
+1
-1
gframe/game.cpp
gframe/game.cpp
+100
-76
gframe/game.h
gframe/game.h
+1
-0
gframe/gframe.cpp
gframe/gframe.cpp
+1
-1
ocgcore
ocgcore
+1
-1
No files found.
gframe/CGUITTFont.cpp
View file @
c829f3ad
...
@@ -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 @
c829f3ad
...
@@ -86,10 +86,8 @@ using namespace video;
...
@@ -86,10 +86,8 @@ using namespace video;
using
namespace
io
;
using
namespace
io
;
using
namespace
gui
;
using
namespace
gui
;
typedef
int
BOOL
;
extern
unsigned
short
PRO_VERSION
;
extern
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
auto_watch_mode
;
extern
bool
auto_watch_mode
;
extern
bool
open_file
;
extern
bool
open_file
;
...
...
gframe/data_manager.cpp
View file @
c829f3ad
...
@@ -139,24 +139,30 @@ bool DataManager::LoadStrings(IReadFile* reader) {
...
@@ -139,24 +139,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 @
c829f3ad
...
@@ -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 @
c829f3ad
...
@@ -12,15 +12,16 @@ DeckManager deckManager;
...
@@ -12,15 +12,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
);
...
@@ -29,20 +30,18 @@ void DeckManager::LoadLFListSingle(const char* path) {
...
@@ -29,20 +30,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 @
c829f3ad
...
@@ -1065,26 +1065,40 @@ void Game::DrawSpec() {
...
@@ -1065,26 +1065,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
;
}
}
}
}
}
}
...
@@ -1366,13 +1380,19 @@ void Game::DrawDeckBd() {
...
@@ -1366,13 +1380,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 @
c829f3ad
...
@@ -242,6 +242,7 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
...
@@ -242,6 +242,7 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
mainGame
->
dInfo
.
isInDuel
=
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
);
...
@@ -478,7 +479,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
...
@@ -478,7 +479,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
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
);
...
@@ -596,6 +597,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
...
@@ -596,6 +597,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
();
...
@@ -709,7 +711,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
...
@@ -709,7 +711,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
);
//
if(!mainGame->chkIgnore1->isChecked())
if
(
!
mainGame
->
chkIgnore1
->
isChecked
())
mainGame
->
wChat
->
setVisible
(
true
);
mainGame
->
wChat
->
setVisible
(
true
);
if
(
mainGame
->
chkDefaultShowChain
->
isChecked
())
{
if
(
mainGame
->
chkDefaultShowChain
->
isChecked
())
{
mainGame
->
always_chain
=
true
;
mainGame
->
always_chain
=
true
;
...
@@ -790,6 +792,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
...
@@ -790,6 +792,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
);
...
@@ -870,6 +873,23 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
...
@@ -870,6 +873,23 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
play_sound
=
true
;
play_sound
=
true
;
if
(
play_sound
&&
mainGame
->
chkIgnore1
->
isChecked
())
if
(
play_sound
&&
mainGame
->
chkIgnore1
->
isChecked
())
break
;
break
;
if
(
!
mainGame
->
dInfo
.
isTag
)
{
if
(
mainGame
->
dInfo
.
isStarted
)
player
=
mainGame
->
LocalPlayer
(
player
);
}
else
{
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
;
play_sound
=
true
;
...
...
gframe/event_handler.cpp
View file @
c829f3ad
...
@@ -1948,7 +1948,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
...
@@ -1948,7 +1948,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
}
}
#endif
#endif
case
CHECKBOX_DISABLE_CHAT
:
{
case
CHECKBOX_DISABLE_CHAT
:
{
bool
show
=
!
mainGame
->
is_building
;
bool
show
=
(
mainGame
->
is_building
&&
!
mainGame
->
is_siding
)
?
false
:
true
;
mainGame
->
wChat
->
setVisible
(
show
);
mainGame
->
wChat
->
setVisible
(
show
);
/*
/*
if(!show)
if(!show)
...
...
gframe/game.cpp
View file @
c829f3ad
...
@@ -755,7 +755,7 @@ bool Game::Initialize() {
...
@@ -755,7 +755,7 @@ bool Game::Initialize() {
btnShuffleDeck
=
env
->
addButton
(
rect
<
s32
>
(
5
,
99
,
55
,
120
),
wDeckEdit
,
BUTTON_SHUFFLE_DECK
,
dataManager
.
GetSysString
(
1307
));
btnShuffleDeck
=
env
->
addButton
(
rect
<
s32
>
(
5
,
99
,
55
,
120
),
wDeckEdit
,
BUTTON_SHUFFLE_DECK
,
dataManager
.
GetSysString
(
1307
));
btnSortDeck
=
env
->
addButton
(
rect
<
s32
>
(
60
,
99
,
110
,
120
),
wDeckEdit
,
BUTTON_SORT_DECK
,
dataManager
.
GetSysString
(
1305
));
btnSortDeck
=
env
->
addButton
(
rect
<
s32
>
(
60
,
99
,
110
,
120
),
wDeckEdit
,
BUTTON_SORT_DECK
,
dataManager
.
GetSysString
(
1305
));
btnClearDeck
=
env
->
addButton
(
rect
<
s32
>
(
115
,
99
,
165
,
120
),
wDeckEdit
,
BUTTON_CLEAR_DECK
,
dataManager
.
GetSysString
(
1304
));
btnClearDeck
=
env
->
addButton
(
rect
<
s32
>
(
115
,
99
,
165
,
120
),
wDeckEdit
,
BUTTON_CLEAR_DECK
,
dataManager
.
GetSysString
(
1304
));
btnSideOK
=
env
->
addButton
(
rect
<
s32
>
(
510
,
40
,
82
0
,
80
),
0
,
BUTTON_SIDE_OK
,
dataManager
.
GetSysString
(
1334
));
btnSideOK
=
env
->
addButton
(
rect
<
s32
>
(
400
,
40
,
71
0
,
80
),
0
,
BUTTON_SIDE_OK
,
dataManager
.
GetSysString
(
1334
));
btnSideOK
->
setVisible
(
false
);
btnSideOK
->
setVisible
(
false
);
btnSideShuffle
=
env
->
addButton
(
rect
<
s32
>
(
310
,
100
,
370
,
130
),
0
,
BUTTON_SHUFFLE_DECK
,
dataManager
.
GetSysString
(
1307
));
btnSideShuffle
=
env
->
addButton
(
rect
<
s32
>
(
310
,
100
,
370
,
130
),
0
,
BUTTON_SHUFFLE_DECK
,
dataManager
.
GetSysString
(
1307
));
btnSideShuffle
->
setVisible
(
false
);
btnSideShuffle
->
setVisible
(
false
);
...
@@ -1220,7 +1220,7 @@ std::wstring Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth,
...
@@ -1220,7 +1220,7 @@ std::wstring Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth,
strBuffer
[
pbuffer
++
]
=
c
;
strBuffer
[
pbuffer
++
]
=
c
;
}
}
strBuffer
[
pbuffer
]
=
0
;
strBuffer
[
pbuffer
]
=
0
;
pControl
->
setText
(
strBuffer
);
if
(
pControl
)
pControl
->
setText
(
strBuffer
);
ret
.
assign
(
strBuffer
);
ret
.
assign
(
strBuffer
);
return
ret
;
return
ret
;
}
}
...
@@ -1365,26 +1365,32 @@ void Game::RefreshBot() {
...
@@ -1365,26 +1365,32 @@ void Game::RefreshBot() {
FILE
*
fp
=
fopen
(
GetLocaleDir
(
"bot.conf"
),
"r"
);
FILE
*
fp
=
fopen
(
GetLocaleDir
(
"bot.conf"
),
"r"
);
if
(
!
fp
)
if
(
!
fp
)
fp
=
fopen
(
"bot.conf"
,
"r"
);
fp
=
fopen
(
"bot.conf"
,
"r"
);
char
linebuf
[
256
];
char
linebuf
[
256
]
{}
;
char
strbuf
[
256
];
char
strbuf
[
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
]
==
'!'
)
{
BotInfo
newinfo
;
BotInfo
newinfo
;
sscanf
(
linebuf
,
"!%240[^
\n
]"
,
strbuf
);
if
(
sscanf
(
linebuf
,
"!%240[^
\n
]"
,
strbuf
)
!=
1
)
continue
;
BufferIO
::
DecodeUTF8
(
strbuf
,
newinfo
.
name
);
BufferIO
::
DecodeUTF8
(
strbuf
,
newinfo
.
name
);
fgets
(
linebuf
,
256
,
fp
);
if
(
!
fgets
(
linebuf
,
256
,
fp
))
sscanf
(
linebuf
,
"%240[^
\n
]"
,
strbuf
);
break
;
if
(
sscanf
(
linebuf
,
"%240[^
\n
]"
,
strbuf
)
!=
1
)
continue
;
#ifndef _WIN32
#ifndef _WIN32
bool
skipRandom
=
!!
strstr
(
strbuf
,
"Random="
);
bool
skipRandom
=
!!
strstr
(
strbuf
,
"Random="
);
#endif
#endif
BufferIO
::
DecodeUTF8
(
strbuf
,
newinfo
.
command
);
BufferIO
::
DecodeUTF8
(
strbuf
,
newinfo
.
command
);
fgets
(
linebuf
,
256
,
fp
);
if
(
!
fgets
(
linebuf
,
256
,
fp
))
sscanf
(
linebuf
,
"%240[^
\n
]"
,
strbuf
);
break
;
if
(
sscanf
(
linebuf
,
"%240[^
\n
]"
,
strbuf
)
!=
1
)
continue
;
BufferIO
::
DecodeUTF8
(
strbuf
,
newinfo
.
desc
);
BufferIO
::
DecodeUTF8
(
strbuf
,
newinfo
.
desc
);
fgets
(
linebuf
,
256
,
fp
);
if
(
!
fgets
(
linebuf
,
256
,
fp
))
break
;
#ifndef _WIN32
#ifndef _WIN32
if
(
skipRandom
)
{
if
(
skipRandom
)
{
continue
;
continue
;
...
@@ -1423,126 +1429,140 @@ bool Game::LoadConfigFromFile(const char* file) {
...
@@ -1423,126 +1429,140 @@ bool Game::LoadConfigFromFile(const char* file) {
if
(
!
fp
){
if
(
!
fp
){
return
false
;
return
false
;
}
}
char
linebuf
[
256
];
char
linebuf
[
256
]
{}
;
char
strbuf
[
32
]
;
char
strbuf
[
64
]{}
;
char
valbuf
[
256
];
char
valbuf
[
256
]
{}
;
wchar_t
wstr
[
256
];
wchar_t
wstr
[
256
]
{}
;
while
(
fgets
(
linebuf
,
256
,
fp
))
{
while
(
fgets
(
linebuf
,
256
,
fp
))
{
sscanf
(
linebuf
,
"%s = %s"
,
strbuf
,
valbuf
);
if
(
sscanf
(
linebuf
,
"%63s = %255s"
,
strbuf
,
valbuf
)
!=
2
)
continue
;
if
(
!
strcmp
(
strbuf
,
"antialias"
))
{
if
(
!
strcmp
(
strbuf
,
"antialias"
))
{
gameConf
.
antialias
=
atoi
(
valbuf
);
gameConf
.
antialias
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"use_d3d"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"use_d3d"
))
{
gameConf
.
use_d3d
=
atoi
(
valbuf
)
>
0
;
gameConf
.
use_d3d
=
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
}
else
if
(
!
strcmp
(
strbuf
,
"use_image_scale"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"use_image_scale"
))
{
gameConf
.
use_image_scale
=
atoi
(
valbuf
)
>
0
;
gameConf
.
use_image_scale
=
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
}
else
if
(
!
strcmp
(
strbuf
,
"pro_version"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"pro_version"
))
{
PRO_VERSION
=
atoi
(
valbuf
);
PRO_VERSION
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"errorlog"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"errorlog"
))
{
enable_log
=
atoi
(
valbuf
);
unsigned
int
val
=
strtol
(
valbuf
,
nullptr
,
10
);
enable_log
=
val
&
0xff
;
}
else
if
(
!
strcmp
(
strbuf
,
"textfont"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"textfont"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
)
;
int
textfontsize
=
0
;
i
nt
textfontsize
=
gameConf
.
textfontsize
;
i
f
(
sscanf
(
linebuf
,
"%63s = %255s %d"
,
strbuf
,
valbuf
,
&
textfontsize
)
!=
3
)
sscanf
(
linebuf
,
"%s = %s %d"
,
strbuf
,
valbuf
,
&
textfontsize
)
;
continue
;
gameConf
.
textfontsize
=
textfontsize
;
gameConf
.
textfontsize
=
textfontsize
;
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
textfont
,
256
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
textfont
,
256
);
}
else
if
(
!
strcmp
(
strbuf
,
"numfont"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"numfont"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
numfont
,
256
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
numfont
,
256
);
}
else
if
(
!
strcmp
(
strbuf
,
"serverport"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"serverport"
))
{
gameConf
.
serverport
=
atoi
(
valbuf
);
gameConf
.
serverport
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"lasthost"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"lasthost"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
lasthost
,
100
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
lasthost
,
100
);
}
else
if
(
!
strcmp
(
strbuf
,
"lastport"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"lastport"
))
{
gameConf
.
lastport
=
(
unsigned
short
)
atoi
(
valbuf
);
gameConf
.
lastport
=
(
unsigned
short
)
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"roompass"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"roompass"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
roompass
,
20
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
roompass
,
20
);
}
else
if
(
!
strcmp
(
strbuf
,
"automonsterpos"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"automonsterpos"
))
{
gameConf
.
chkMAutoPos
=
atoi
(
valbuf
);
gameConf
.
chkMAutoPos
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"autospellpos"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"autospellpos"
))
{
gameConf
.
chkSTAutoPos
=
atoi
(
valbuf
);
gameConf
.
chkSTAutoPos
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"randompos"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"randompos"
))
{
gameConf
.
chkRandomPos
=
atoi
(
valbuf
);
gameConf
.
chkRandomPos
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"autochain"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"autochain"
))
{
gameConf
.
chkAutoChain
=
atoi
(
valbuf
);
gameConf
.
chkAutoChain
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"waitchain"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"waitchain"
))
{
gameConf
.
chkWaitChain
=
atoi
(
valbuf
);
gameConf
.
chkWaitChain
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"showchain"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"showchain"
))
{
gameConf
.
chkDefaultShowChain
=
atoi
(
valbuf
);
gameConf
.
chkDefaultShowChain
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"mute_opponent"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"mute_opponent"
))
{
gameConf
.
chkIgnore1
=
atoi
(
valbuf
);
gameConf
.
chkIgnore1
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"mute_spectators"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"mute_spectators"
))
{
gameConf
.
chkIgnore2
=
atoi
(
valbuf
);
gameConf
.
chkIgnore2
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"use_lflist"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"use_lflist"
))
{
gameConf
.
use_lflist
=
atoi
(
valbuf
);
gameConf
.
use_lflist
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"default_lflist"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"default_lflist"
))
{
gameConf
.
default_lflist
=
atoi
(
valbuf
);
gameConf
.
default_lflist
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"default_rule"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"default_rule"
))
{
gameConf
.
default_rule
=
atoi
(
valbuf
);
gameConf
.
default_rule
=
strtol
(
valbuf
,
nullptr
,
10
);
if
(
gameConf
.
default_rule
<=
0
)
if
(
gameConf
.
default_rule
<=
0
)
gameConf
.
default_rule
=
YGOPRO_DEFAULT_DUEL_RULE
;
gameConf
.
default_rule
=
YGOPRO_DEFAULT_DUEL_RULE
;
}
else
if
(
!
strcmp
(
strbuf
,
"hide_setname"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"hide_setname"
))
{
gameConf
.
hide_setname
=
atoi
(
valbuf
);
gameConf
.
hide_setname
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"hide_hint_button"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"hide_hint_button"
))
{
gameConf
.
hide_hint_button
=
atoi
(
valbuf
);
gameConf
.
hide_hint_button
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"control_mode"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"control_mode"
))
{
gameConf
.
control_mode
=
atoi
(
valbuf
);
gameConf
.
control_mode
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"draw_field_spell"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"draw_field_spell"
))
{
gameConf
.
draw_field_spell
=
atoi
(
valbuf
);
gameConf
.
draw_field_spell
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"separate_clear_button"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"separate_clear_button"
))
{
gameConf
.
separate_clear_button
=
atoi
(
valbuf
);
gameConf
.
separate_clear_button
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"auto_search_limit"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"auto_search_limit"
))
{
gameConf
.
auto_search_limit
=
atoi
(
valbuf
);
gameConf
.
auto_search_limit
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"search_multiple_keywords"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"search_multiple_keywords"
))
{
gameConf
.
search_multiple_keywords
=
atoi
(
valbuf
);
gameConf
.
search_multiple_keywords
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"search_regex"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"search_regex"
))
{
gameConf
.
search_regex
=
atoi
(
valbuf
);
gameConf
.
search_regex
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"ignore_deck_changes"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"ignore_deck_changes"
))
{
gameConf
.
chkIgnoreDeckChanges
=
atoi
(
valbuf
);
gameConf
.
chkIgnoreDeckChanges
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"default_ot"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"default_ot"
))
{
gameConf
.
defaultOT
=
atoi
(
valbuf
);
gameConf
.
defaultOT
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"enable_bot_mode"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"enable_bot_mode"
))
{
gameConf
.
enable_bot_mode
=
atoi
(
valbuf
);
gameConf
.
enable_bot_mode
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"quick_animation"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"quick_animation"
))
{
gameConf
.
quick_animation
=
atoi
(
valbuf
);
gameConf
.
quick_animation
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"auto_save_replay"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"auto_save_replay"
))
{
gameConf
.
auto_save_replay
=
atoi
(
valbuf
);
gameConf
.
auto_save_replay
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"draw_single_chain"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"draw_single_chain"
))
{
gameConf
.
draw_single_chain
=
atoi
(
valbuf
);
gameConf
.
draw_single_chain
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"hide_player_name"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"hide_player_name"
))
{
gameConf
.
hide_player_name
=
atoi
(
valbuf
);
gameConf
.
hide_player_name
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"prefer_expansion_script"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"prefer_expansion_script"
))
{
gameConf
.
prefer_expansion_script
=
atoi
(
valbuf
);
gameConf
.
prefer_expansion_script
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"ask_mset"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"ask_mset"
))
{
gameConf
.
ask_mset
=
atoi
(
valbuf
);
gameConf
.
ask_mset
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"window_maximized"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"window_maximized"
))
{
gameConf
.
window_maximized
=
atoi
(
valbuf
)
>
0
;
gameConf
.
window_maximized
=
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
}
else
if
(
!
strcmp
(
strbuf
,
"window_width"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"window_width"
))
{
gameConf
.
window_width
=
atoi
(
valbuf
);
gameConf
.
window_width
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"window_height"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"window_height"
))
{
gameConf
.
window_height
=
atoi
(
valbuf
);
gameConf
.
window_height
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"resize_popup_menu"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"resize_popup_menu"
))
{
gameConf
.
resize_popup_menu
=
atoi
(
valbuf
)
>
0
;
gameConf
.
resize_popup_menu
=
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
}
else
if
(
!
strcmp
(
strbuf
,
"enable_sound"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"enable_sound"
))
{
gameConf
.
enable_sound
=
atoi
(
valbuf
)
>
0
;
gameConf
.
enable_sound
=
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
}
else
if
(
!
strcmp
(
strbuf
,
"sound_volume"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"sound_volume"
))
{
gameConf
.
sound_volume
=
atof
(
valbuf
)
/
100
;
int
vol
=
strtol
(
valbuf
,
nullptr
,
10
);
if
(
vol
<
0
)
vol
=
0
;
else
if
(
vol
>
100
)
vol
=
100
;
gameConf
.
sound_volume
=
(
double
)
vol
/
100
;
}
else
if
(
!
strcmp
(
strbuf
,
"enable_music"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"enable_music"
))
{
gameConf
.
enable_music
=
atoi
(
valbuf
)
>
0
;
gameConf
.
enable_music
=
strtol
(
valbuf
,
nullptr
,
10
)
>
0
;
}
else
if
(
!
strcmp
(
strbuf
,
"music_volume"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"music_volume"
))
{
gameConf
.
music_volume
=
atof
(
valbuf
)
/
100
;
int
vol
=
strtol
(
valbuf
,
nullptr
,
10
);
if
(
vol
<
0
)
vol
=
0
;
else
if
(
vol
>
100
)
vol
=
100
;
gameConf
.
music_volume
=
(
double
)
vol
/
100
;
}
else
if
(
!
strcmp
(
strbuf
,
"music_mode"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"music_mode"
))
{
gameConf
.
music_mode
=
atoi
(
valbuf
);
gameConf
.
music_mode
=
strtol
(
valbuf
,
nullptr
,
10
);
#endif
#endif
}
else
if
(
!
strcmp
(
strbuf
,
"enable_pendulum_scale"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"enable_pendulum_scale"
))
{
gameConf
.
chkEnablePScale
=
atoi
(
valbuf
);
gameConf
.
chkEnablePScale
=
strtol
(
valbuf
,
nullptr
,
10
);
}
else
if
(
!
strcmp
(
strbuf
,
"skin_index"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"skin_index"
))
{
gameConf
.
skin_index
=
atoi
(
valbuf
);
gameConf
.
skin_index
=
atoi
(
valbuf
);
}
else
{
}
else
{
// options allowing multiple words
// options allowing multiple words
sscanf
(
linebuf
,
"%s = %240[^
\n
]"
,
strbuf
,
valbuf
);
if
(
sscanf
(
linebuf
,
"%63s = %240[^
\n
]"
,
strbuf
,
valbuf
)
!=
2
)
continue
;
if
(
!
strcmp
(
strbuf
,
"nickname"
))
{
if
(
!
strcmp
(
strbuf
,
"nickname"
))
{
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
DecodeUTF8
(
valbuf
,
wstr
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
nickname
,
20
);
BufferIO
::
CopyWStr
(
wstr
,
gameConf
.
nickname
,
20
);
...
@@ -1699,7 +1719,7 @@ void Game::SaveConfig() {
...
@@ -1699,7 +1719,7 @@ void Game::SaveConfig() {
fprintf
(
fp
,
"use_image_scale = %d
\n
"
,
gameConf
.
use_image_scale
?
1
:
0
);
fprintf
(
fp
,
"use_image_scale = %d
\n
"
,
gameConf
.
use_image_scale
?
1
:
0
);
fprintf
(
fp
,
"pro_version = %d
\n
"
,
PRO_VERSION
);
fprintf
(
fp
,
"pro_version = %d
\n
"
,
PRO_VERSION
);
fprintf
(
fp
,
"antialias = %d
\n
"
,
gameConf
.
antialias
);
fprintf
(
fp
,
"antialias = %d
\n
"
,
gameConf
.
antialias
);
fprintf
(
fp
,
"errorlog = %
d
\n
"
,
enable_log
);
fprintf
(
fp
,
"errorlog = %
u
\n
"
,
enable_log
);
BufferIO
::
CopyWStr
(
ebNickName
->
getText
(),
gameConf
.
nickname
,
20
);
BufferIO
::
CopyWStr
(
ebNickName
->
getText
(),
gameConf
.
nickname
,
20
);
BufferIO
::
EncodeUTF8
(
gameConf
.
nickname
,
linebuf
);
BufferIO
::
EncodeUTF8
(
gameConf
.
nickname
,
linebuf
);
fprintf
(
fp
,
"nickname = %s
\n
"
,
linebuf
);
fprintf
(
fp
,
"nickname = %s
\n
"
,
linebuf
);
...
@@ -1760,10 +1780,8 @@ void Game::SaveConfig() {
...
@@ -1760,10 +1780,8 @@ void Game::SaveConfig() {
fprintf
(
fp
,
"enable_music = %d
\n
"
,
(
chkEnableMusic
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"enable_music = %d
\n
"
,
(
chkEnableMusic
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"#Volume of sound and music, between 0 and 100
\n
"
);
fprintf
(
fp
,
"#Volume of sound and music, between 0 and 100
\n
"
);
int
vol
=
gameConf
.
sound_volume
*
100
;
int
vol
=
gameConf
.
sound_volume
*
100
;
if
(
vol
<
0
)
vol
=
0
;
else
if
(
vol
>
100
)
vol
=
100
;
fprintf
(
fp
,
"sound_volume = %d
\n
"
,
vol
);
fprintf
(
fp
,
"sound_volume = %d
\n
"
,
vol
);
vol
=
gameConf
.
music_volume
*
100
;
vol
=
gameConf
.
music_volume
*
100
;
if
(
vol
<
0
)
vol
=
0
;
else
if
(
vol
>
100
)
vol
=
100
;
fprintf
(
fp
,
"music_volume = %d
\n
"
,
vol
);
fprintf
(
fp
,
"music_volume = %d
\n
"
,
vol
);
fprintf
(
fp
,
"music_mode = %d
\n
"
,
(
chkMusicMode
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"music_mode = %d
\n
"
,
(
chkMusicMode
->
isChecked
()
?
1
:
0
));
#endif
#endif
...
@@ -2075,6 +2093,7 @@ void Game::CloseDuelWindow() {
...
@@ -2075,6 +2093,7 @@ void Game::CloseDuelWindow() {
lstHostList
->
clear
();
lstHostList
->
clear
();
DuelClient
::
hosts
.
clear
();
DuelClient
::
hosts
.
clear
();
ClearTextures
();
ClearTextures
();
ResizeChatInputWindow
();
closeDoneSignal
.
Set
();
closeDoneSignal
.
Set
();
}
}
int
Game
::
LocalPlayer
(
int
player
)
const
{
int
Game
::
LocalPlayer
(
int
player
)
const
{
...
@@ -2082,10 +2101,8 @@ int Game::LocalPlayer(int player) const {
...
@@ -2082,10 +2101,8 @@ int Game::LocalPlayer(int player) const {
return
dInfo
.
isFirst
?
pid
:
1
-
pid
;
return
dInfo
.
isFirst
?
pid
:
1
-
pid
;
}
}
int
Game
::
OppositePlayer
(
int
player
)
{
int
Game
::
OppositePlayer
(
int
player
)
{
if
(
dInfo
.
isTag
)
auto
player_side_bit
=
dInfo
.
isTag
?
0x2
:
0x1
;
return
(
player
&
0x2
)
|
(
1
-
(
player
&
0x1
));
return
player
^
player_side_bit
;
else
return
1
-
player
;
}
}
int
Game
::
ChatLocalPlayer
(
int
player
)
{
int
Game
::
ChatLocalPlayer
(
int
player
)
{
if
(
player
>
3
)
if
(
player
>
3
)
...
@@ -2101,8 +2118,10 @@ int Game::ChatLocalPlayer(int player) {
...
@@ -2101,8 +2118,10 @@ int Game::ChatLocalPlayer(int player) {
if
(
DuelClient
::
selftype
>=
selftype_boundary
&&
DuelClient
::
selftype
<
4
)
if
(
DuelClient
::
selftype
>=
selftype_boundary
&&
DuelClient
::
selftype
<
4
)
player
=
OppositePlayer
(
player
);
player
=
OppositePlayer
(
player
);
}
}
if
(
dInfo
.
isTag
)
{
if
(
DuelClient
::
selftype
>=
4
)
{
is_self
=
(
player
&
0x2
)
==
0
&&
(
player
&
0x1
)
==
(
DuelClient
::
selftype
&
0x1
);
is_self
=
false
;
}
else
if
(
dInfo
.
isTag
)
{
is_self
=
(
player
&
0x2
)
==
0
&&
(
player
&
0x1
)
==
(
DuelClient
::
selftype
&
0x1
);
}
else
{
}
else
{
is_self
=
player
==
0
;
is_self
=
player
==
0
;
}
}
...
@@ -2199,7 +2218,7 @@ void Game::OnResize() {
...
@@ -2199,7 +2218,7 @@ void Game::OnResize() {
stStar
->
setRelativePosition
(
Resize
(
10
,
62
+
100
/
6
,
70
,
82
+
100
/
6
));
stStar
->
setRelativePosition
(
Resize
(
10
,
62
+
100
/
6
,
70
,
82
+
100
/
6
));
stSearch
->
setRelativePosition
(
Resize
(
205
,
62
+
100
/
6
,
280
,
82
+
100
/
6
));
stSearch
->
setRelativePosition
(
Resize
(
205
,
62
+
100
/
6
,
280
,
82
+
100
/
6
));
stScale
->
setRelativePosition
(
Resize
(
105
,
62
+
100
/
6
,
165
,
82
+
100
/
6
));
stScale
->
setRelativePosition
(
Resize
(
105
,
62
+
100
/
6
,
165
,
82
+
100
/
6
));
btnSideOK
->
setRelativePosition
(
Resize
(
510
,
40
,
82
0
,
80
));
btnSideOK
->
setRelativePosition
(
Resize
(
400
,
40
,
71
0
,
80
));
btnSideShuffle
->
setRelativePosition
(
Resize
(
310
,
100
,
370
,
130
));
btnSideShuffle
->
setRelativePosition
(
Resize
(
310
,
100
,
370
,
130
));
btnSideSort
->
setRelativePosition
(
Resize
(
375
,
100
,
435
,
130
));
btnSideSort
->
setRelativePosition
(
Resize
(
375
,
100
,
435
,
130
));
btnSideReload
->
setRelativePosition
(
Resize
(
440
,
100
,
500
,
130
));
btnSideReload
->
setRelativePosition
(
Resize
(
440
,
100
,
500
,
130
));
...
@@ -2293,8 +2312,7 @@ void Game::OnResize() {
...
@@ -2293,8 +2312,7 @@ void Game::OnResize() {
btnM2
->
setRelativePosition
(
Resize
(
160
,
0
,
210
,
20
));
btnM2
->
setRelativePosition
(
Resize
(
160
,
0
,
210
,
20
));
btnEP
->
setRelativePosition
(
Resize
(
320
,
0
,
370
,
20
));
btnEP
->
setRelativePosition
(
Resize
(
320
,
0
,
370
,
20
));
wChat
->
setRelativePosition
(
recti
(
wInfos
->
getRelativePosition
().
LowerRightCorner
.
X
+
6
,
window_size
.
Height
-
25
,
window_size
.
Width
,
window_size
.
Height
));
ResizeChatInputWindow
();
ebChatInput
->
setRelativePosition
(
recti
(
3
,
2
,
window_size
.
Width
-
wChat
->
getRelativePosition
().
UpperLeftCorner
.
X
-
6
,
22
));
btnLeaveGame
->
setRelativePosition
(
Resize
(
205
,
5
,
295
,
80
));
btnLeaveGame
->
setRelativePosition
(
Resize
(
205
,
5
,
295
,
80
));
wReplayControl
->
setRelativePosition
(
Resize
(
205
,
143
,
295
,
273
));
wReplayControl
->
setRelativePosition
(
Resize
(
205
,
143
,
295
,
273
));
...
@@ -2317,6 +2335,12 @@ void Game::OnResize() {
...
@@ -2317,6 +2335,12 @@ void Game::OnResize() {
btnBigCardZoomOut
->
setRelativePosition
(
Resize
(
205
,
180
,
295
,
215
));
btnBigCardZoomOut
->
setRelativePosition
(
Resize
(
205
,
180
,
295
,
215
));
btnBigCardClose
->
setRelativePosition
(
Resize
(
205
,
230
,
295
,
265
));
btnBigCardClose
->
setRelativePosition
(
Resize
(
205
,
230
,
295
,
265
));
}
}
void
Game
::
ResizeChatInputWindow
()
{
s32
x
=
wInfos
->
getRelativePosition
().
LowerRightCorner
.
X
+
6
;
if
(
is_building
)
x
=
802
*
xScale
;
wChat
->
setRelativePosition
(
recti
(
x
,
window_size
.
Height
-
25
,
window_size
.
Width
,
window_size
.
Height
));
ebChatInput
->
setRelativePosition
(
recti
(
3
,
2
,
window_size
.
Width
-
wChat
->
getRelativePosition
().
UpperLeftCorner
.
X
-
6
,
22
));
}
recti
Game
::
Resize
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
)
{
recti
Game
::
Resize
(
s32
x
,
s32
y
,
s32
x2
,
s32
y2
)
{
x
=
x
*
xScale
;
x
=
x
*
xScale
;
y
=
y
*
yScale
;
y
=
y
*
yScale
;
...
...
gframe/game.h
View file @
c829f3ad
...
@@ -227,6 +227,7 @@ public:
...
@@ -227,6 +227,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 @
c829f3ad
...
@@ -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
;
bool
exit_on_return
=
false
;
bool
exit_on_return
=
false
;
bool
auto_watch_mode
=
false
;
bool
auto_watch_mode
=
false
;
bool
open_file
=
false
;
bool
open_file
=
false
;
...
...
ocgcore
@
5fe666ff
Subproject commit
4d72fdb3395fcce97c79954d789d033a1fd5175e
Subproject commit
5fe666ffe616a46010059560997f9525732c5457
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