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
baichixing
ygopro
Commits
a6c2edba
Commit
a6c2edba
authored
Aug 07, 2018
by
DailyShana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unify treatment of MSG_RELOAD_FIELD
parent
029608bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
110 deletions
+54
-110
gframe/duelclient.cpp
gframe/duelclient.cpp
+42
-51
gframe/single_mode.cpp
gframe/single_mode.cpp
+12
-59
No files found.
gframe/duelclient.cpp
View file @
a6c2edba
...
...
@@ -3622,7 +3622,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_MZONE
,
seq
);
ccard
->
position
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame->dField.GetCardLocation(ccard, &ccard->curPos, &ccard->curRot, true);
val
=
BufferIO
::
ReadInt8
(
pbuf
);
if
(
val
)
{
for
(
int
xyz
=
0
;
xyz
<
val
;
++
xyz
)
{
...
...
@@ -3632,7 +3631,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
xcard
->
overlayTarget
=
ccard
;
xcard
->
location
=
0x80
;
xcard
->
sequence
=
ccard
->
overlayed
.
size
()
-
1
;
mainGame->dField.GetCardLocation(xcard, &xcard->curPos, &xcard->curRot, true);
xcard
->
owner
=
p
;
xcard
->
controler
=
p
;
}
}
}
...
...
@@ -3643,87 +3643,78 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_SZONE
,
seq
);
ccard
->
position
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame->dField.GetCardLocation(ccard, &ccard->curPos, &ccard->curRot, true);
}
}
val
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_DECK
,
seq
);
mainGame->dField.GetCardLocation(ccard, &ccard->curPos, &ccard->curRot, true);
}
val
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_HAND
,
seq
);
}
// Use another loop to refresh the hand locations to prevent incorrect positioning
for (int seq = 0; seq < val; ++seq) {
ClientCard* ccard = mainGame->dField.hand[p][seq];
mainGame->dField.GetCardLocation(ccard, &ccard->curPos, &ccard->curRot, true);
}
val
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_GRAVE
,
seq
);
mainGame->dField.GetCardLocation(ccard, &ccard->curPos, &ccard->curRot, true);
}
val
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_REMOVED
,
seq
);
mainGame->dField.GetCardLocation(ccard, &ccard->curPos, &ccard->curRot, true);
}
val
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_EXTRA
,
seq
);
mainGame->dField.GetCardLocation(ccard, &ccard->curPos, &ccard->curRot, true);
}
val
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame
->
dField
.
extra_p_count
[
p
]
=
val
;
}
val = BufferIO::ReadInt8(pbuf); //chains
for(int i = 0; i < val; ++i) {
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
int pcc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int pcl = BufferIO::ReadInt8(pbuf);
int pcs = BufferIO::ReadInt8(pbuf);
int subs = BufferIO::ReadInt8(pbuf);
int cc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int cl = BufferIO::ReadInt8(pbuf);
int cs = BufferIO::ReadInt8(pbuf);
int desc = BufferIO::ReadInt32(pbuf);
ClientCard* pcard = mainGame->dField.GetCard(pcc, pcl, pcs, subs);
mainGame->dField.current_chain.chain_card = pcard;
mainGame->dField.current_chain.code = code;
mainGame->dField.current_chain.desc = desc;
mainGame->dField.current_chain.controler = cc;
mainGame->dField.current_chain.location = cl;
mainGame->dField.current_chain.sequence = cs;
mainGame->dField.GetChainLocation(cc, cl, cs, &mainGame->dField.current_chain.chain_pos);
mainGame->dField.current_chain.solved = false;
int chc = 0;
for(auto chit = mainGame->dField.chains.begin(); chit != mainGame->dField.chains.end(); ++chit) {
if (cl == 0x10 || cl == 0x20) {
if (chit->controler == cc && chit->location == cl)
chc++;
} else {
if (chit->controler == cc && chit->location == cl && chit->sequence == cs)
chc++;
mainGame
->
dField
.
RefreshAllCards
();
val
=
BufferIO
::
ReadInt8
(
pbuf
);
//chains, always 0 in single mode
if
(
!
mainGame
->
dInfo
.
isSingleMode
)
{
for
(
int
i
=
0
;
i
<
val
;
++
i
)
{
unsigned
int
code
=
(
unsigned
int
)
BufferIO
::
ReadInt32
(
pbuf
);
int
pcc
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
pcl
=
BufferIO
::
ReadInt8
(
pbuf
);
int
pcs
=
BufferIO
::
ReadInt8
(
pbuf
);
int
subs
=
BufferIO
::
ReadInt8
(
pbuf
);
int
cc
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
cl
=
BufferIO
::
ReadInt8
(
pbuf
);
int
cs
=
BufferIO
::
ReadInt8
(
pbuf
);
int
desc
=
BufferIO
::
ReadInt32
(
pbuf
);
ClientCard
*
pcard
=
mainGame
->
dField
.
GetCard
(
pcc
,
pcl
,
pcs
,
subs
);
mainGame
->
dField
.
current_chain
.
chain_card
=
pcard
;
mainGame
->
dField
.
current_chain
.
code
=
code
;
mainGame
->
dField
.
current_chain
.
desc
=
desc
;
mainGame
->
dField
.
current_chain
.
controler
=
cc
;
mainGame
->
dField
.
current_chain
.
location
=
cl
;
mainGame
->
dField
.
current_chain
.
sequence
=
cs
;
mainGame
->
dField
.
GetChainLocation
(
cc
,
cl
,
cs
,
&
mainGame
->
dField
.
current_chain
.
chain_pos
);
mainGame
->
dField
.
current_chain
.
solved
=
false
;
int
chc
=
0
;
for
(
auto
chit
=
mainGame
->
dField
.
chains
.
begin
();
chit
!=
mainGame
->
dField
.
chains
.
end
();
++
chit
)
{
if
(
cl
==
0x10
||
cl
==
0x20
)
{
if
(
chit
->
controler
==
cc
&&
chit
->
location
==
cl
)
chc
++
;
}
else
{
if
(
chit
->
controler
==
cc
&&
chit
->
location
==
cl
&&
chit
->
sequence
==
cs
)
chc
++
;
}
}
if
(
cl
==
LOCATION_HAND
)
mainGame
->
dField
.
current_chain
.
chain_pos
.
X
+=
0.35
f
;
else
mainGame
->
dField
.
current_chain
.
chain_pos
.
Y
+=
chc
*
0.25
f
;
mainGame
->
dField
.
chains
.
push_back
(
mainGame
->
dField
.
current_chain
);
}
if
(
val
)
{
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1609
),
dataManager
.
GetName
(
mainGame
->
dField
.
current_chain
.
code
));
mainGame
->
dField
.
last_chain
=
true
;
}
if(cl == LOCATION_HAND)
mainGame->dField.current_chain.chain_pos.X += 0.35f;
else
mainGame->dField.current_chain.chain_pos.Y += chc * 0.25f;
mainGame->dField.chains.push_back(mainGame->dField.current_chain);
}
if(val) {
myswprintf(event_string, dataManager.GetSysString(1609), dataManager.GetName(mainGame->dField.current_chain.code));
mainGame->dField.last_chain = true;
}
mainGame
->
gMutex
.
Unlock
();
break
;
...
...
gframe/single_mode.cpp
View file @
a6c2edba
...
...
@@ -723,72 +723,25 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
break
;
}
case
MSG_RELOAD_FIELD
:
{
mainGame
->
gMutex
.
Lock
();
mainGame
->
dField
.
Clear
();
mainGame
->
dInfo
.
duel_rule
=
BufferIO
::
ReadInt8
(
pbuf
);
int
val
=
0
;
pbuf
++
;
for
(
int
p
=
0
;
p
<
2
;
++
p
)
{
mainGame
->
dInfo
.
lp
[
p
]
=
BufferIO
::
ReadInt32
(
pbuf
);
myswprintf
(
mainGame
->
dInfo
.
strLP
[
p
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
p
]);
pbuf
+=
4
;
for
(
int
seq
=
0
;
seq
<
7
;
++
seq
)
{
val
=
BufferIO
::
ReadInt8
(
pbuf
);
if
(
val
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_MZONE
,
seq
);
ccard
->
position
=
BufferIO
::
ReadInt8
(
pbuf
);
val
=
BufferIO
::
ReadInt8
(
pbuf
);
if
(
val
)
{
for
(
int
xyz
=
0
;
xyz
<
val
;
++
xyz
)
{
ClientCard
*
xcard
=
new
ClientCard
;
ccard
->
overlayed
.
push_back
(
xcard
);
mainGame
->
dField
.
overlay_cards
.
insert
(
xcard
);
xcard
->
overlayTarget
=
ccard
;
xcard
->
location
=
0x80
;
xcard
->
sequence
=
ccard
->
overlayed
.
size
()
-
1
;
xcard
->
owner
=
p
;
xcard
->
controler
=
p
;
}
}
}
int
val
=
BufferIO
::
ReadInt8
(
pbuf
);
if
(
val
)
pbuf
+=
2
;
}
for
(
int
seq
=
0
;
seq
<
8
;
++
seq
)
{
val
=
BufferIO
::
ReadInt8
(
pbuf
);
if
(
val
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_SZONE
,
seq
);
ccard
->
position
=
BufferIO
::
ReadInt8
(
pbuf
);
}
}
val
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_DECK
,
seq
);
}
val
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_HAND
,
seq
);
}
val
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_GRAVE
,
seq
);
int
val
=
BufferIO
::
ReadInt8
(
pbuf
);
if
(
val
)
pbuf
++
;
}
val
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_REMOVED
,
seq
);
}
val
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
seq
=
0
;
seq
<
val
;
++
seq
)
{
ClientCard
*
ccard
=
new
ClientCard
;
mainGame
->
dField
.
AddCard
(
ccard
,
p
,
LOCATION_EXTRA
,
seq
);
}
val
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame
->
dField
.
extra_p_count
[
p
]
=
val
;
pbuf
+=
6
;
}
BufferIO
::
ReadInt8
(
pbuf
);
//chain count, always 0
pbuf
++
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
SinglePlayReload
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
dField
.
RefreshAllCards
();
mainGame
->
gMutex
.
Unlock
();
break
;
...
...
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