Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
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-2pick
Commits
75889e7b
Commit
75889e7b
authored
Jan 17, 2012
by
argon.sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client
parent
339d756b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1874 additions
and
1891 deletions
+1874
-1891
gframe/client_field.cpp
gframe/client_field.cpp
+0
-1
gframe/duelclient.cpp
gframe/duelclient.cpp
+1870
-1888
gframe/duelclient.h
gframe/duelclient.h
+4
-2
No files found.
gframe/client_field.cpp
View file @
75889e7b
...
@@ -454,7 +454,6 @@ void ClientField::ReplaySwap() {
...
@@ -454,7 +454,6 @@ void ClientField::ReplaySwap() {
(
*
cit
)
->
is_moving
=
false
;
(
*
cit
)
->
is_moving
=
false
;
}
}
mainGame
->
dInfo
.
is_first_turn
=
!
mainGame
->
dInfo
.
is_first_turn
;
mainGame
->
dInfo
.
is_first_turn
=
!
mainGame
->
dInfo
.
is_first_turn
;
std
::
swap
(
mainGame
->
dInfo
.
is_host_player
[
0
],
mainGame
->
dInfo
.
is_host_player
[
1
]);
std
::
swap
(
mainGame
->
dInfo
.
lp
[
0
],
mainGame
->
dInfo
.
lp
[
1
]);
std
::
swap
(
mainGame
->
dInfo
.
lp
[
0
],
mainGame
->
dInfo
.
lp
[
1
]);
for
(
int
i
=
0
;
i
<
16
;
++
i
)
for
(
int
i
=
0
;
i
<
16
;
++
i
)
std
::
swap
(
mainGame
->
dInfo
.
strLP
[
0
][
i
],
mainGame
->
dInfo
.
strLP
[
1
][
i
]);
std
::
swap
(
mainGame
->
dInfo
.
strLP
[
0
][
i
],
mainGame
->
dInfo
.
strLP
[
1
][
i
]);
...
...
gframe/duelclient.cpp
View file @
75889e7b
#include "duelclient.h"
#include "duelclient.h"
#include client_card.h"
#include "client_card.h"
#include "materials.h"
#include "../ocgcore/field.h"
#include "../ocgcore/duel.h"
#include "game.h"
#include "game.h"
namespace
ygo
{
namespace
ygo
{
unsigned
DuelClient
::
connect_state
=
0
;
unsigned
DuelClient
::
connect_state
=
0
;
unsigned
char
DuelClient
::
response_buf
[
64
];
unsigned
char
DuelClient
::
response_buf
[
64
];
bool
DuelClient
::
is_responseB
;
unsigned
char
DuelClient
::
response_len
=
0
;
unsigned
char
DuelClient
::
response_len
;
event_base
*
DuelClient
::
client_base
=
0
;
event_base
*
DuelClient
::
client_base
=
0
;
bufferevent
*
DuelClient
::
client_bev
=
0
;
bufferevent
*
DuelClient
::
client_bev
=
0
;
char
DuelClient
::
duel_client_read
[
0x2000
];
char
DuelClient
::
duel_client_read
[
0x2000
];
char
DuelClient
::
duel_client_write
[
0x2000
];
char
DuelClient
::
duel_client_write
[
0x2000
];
bool
DuelClient
::
is_closing
=
false
;
bool
DuelClient
::
is_closing
=
false
;
int
DuelClient
::
select_hint
=
0
;
wchar_t
DuelClient
::
event_string
[
256
];
mtrandom
DuelClient
::
rnd
;
bool
DuelClient
::
StartClient
(
unsigned
int
ip
,
unsigned
short
port
,
bool
create_game
)
{
bool
DuelClient
::
StartClient
(
unsigned
int
ip
,
unsigned
short
port
,
bool
create_game
)
{
if
(
connect_state
)
if
(
connect_state
)
...
@@ -35,6 +40,7 @@ bool DuelClient::StartClient(unsigned int ip, unsigned short port, bool create_g
...
@@ -35,6 +40,7 @@ bool DuelClient::StartClient(unsigned int ip, unsigned short port, bool create_g
return
false
;
return
false
;
}
}
connect_state
=
1
;
connect_state
=
1
;
rnd
.
reset
(
time
(
0
));
Thread
::
NewThread
(
ClientThread
,
0
);
Thread
::
NewThread
(
ClientThread
,
0
);
return
true
;
return
true
;
}
}
...
@@ -192,29 +198,29 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
...
@@ -192,29 +198,29 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
STOC_JoinGame
*
pkt
=
(
STOC_JoinGame
*
)
pdata
;
STOC_JoinGame
*
pkt
=
(
STOC_JoinGame
*
)
pdata
;
std
::
wstring
str
;
std
::
wstring
str
;
wchar_t
msgbuf
[
256
];
wchar_t
msgbuf
[
256
];
myswprintf
(
msgbuf
,
L" % ls %
ls
\n
"
,
dataManager
.
GetSysString
(
1226
),
deckManager
.
GetLFListName
(
pkt
->
info
.
lflist
));
myswprintf
(
msgbuf
,
L"%ls%
ls
\n
"
,
dataManager
.
GetSysString
(
1226
),
deckManager
.
GetLFListName
(
pkt
->
info
.
lflist
));
str
.
append
(
msgbuf
);
str
.
append
(
msgbuf
);
myswprintf
(
msgbuf
,
L" % ls %
ls
\n
"
,
dataManager
.
GetSysString
(
1225
),
dataManager
.
GetSysString
(
1240
+
pkt
->
info
.
rule
));
myswprintf
(
msgbuf
,
L"%ls%
ls
\n
"
,
dataManager
.
GetSysString
(
1225
),
dataManager
.
GetSysString
(
1240
+
pkt
->
info
.
rule
));
str
.
append
(
msgbuf
);
str
.
append
(
msgbuf
);
myswprintf
(
msgbuf
,
L" % ls %
ls
\n
"
,
dataManager
.
GetSysString
(
1227
),
dataManager
.
GetSysString
(
1244
+
pkt
->
info
.
mode
));
myswprintf
(
msgbuf
,
L"%ls%
ls
\n
"
,
dataManager
.
GetSysString
(
1227
),
dataManager
.
GetSysString
(
1244
+
pkt
->
info
.
mode
));
str
.
append
(
msgbuf
);
str
.
append
(
msgbuf
);
if
(
pkt
->
info
.
enable_priority
)
{
if
(
pkt
->
info
.
enable_priority
)
{
myswprintf
(
msgbuf
,
L"* %
ls
\n
"
,
dataManager
.
GetSysString
(
1236
));
myswprintf
(
msgbuf
,
L"*%
ls
\n
"
,
dataManager
.
GetSysString
(
1236
));
str
.
append
(
msgbuf
);
str
.
append
(
msgbuf
);
}
}
str
.
append
(
L" == == == == ==
\n
"
);
str
.
append
(
L" == == == == ==
\n
"
);
myswprintf
(
msgbuf
,
L" % ls %
d
\n
"
,
dataManager
.
GetSysString
(
1231
),
pkt
->
info
.
start_lp
);
myswprintf
(
msgbuf
,
L"%ls%
d
\n
"
,
dataManager
.
GetSysString
(
1231
),
pkt
->
info
.
start_lp
);
str
.
append
(
msgbuf
);
str
.
append
(
msgbuf
);
myswprintf
(
msgbuf
,
L" % ls %
d
\n
"
,
dataManager
.
GetSysString
(
1232
),
pkt
->
info
.
start_hand
);
myswprintf
(
msgbuf
,
L"%ls%
d
\n
"
,
dataManager
.
GetSysString
(
1232
),
pkt
->
info
.
start_hand
);
str
.
append
(
msgbuf
);
str
.
append
(
msgbuf
);
myswprintf
(
msgbuf
,
L" % ls %
d
\n
"
,
dataManager
.
GetSysString
(
1233
),
pkt
->
info
.
draw_count
);
myswprintf
(
msgbuf
,
L"%ls%
d
\n
"
,
dataManager
.
GetSysString
(
1233
),
pkt
->
info
.
draw_count
);
str
.
append
(
msgbuf
);
str
.
append
(
msgbuf
);
if
(
pkt
->
info
.
no_check_deck
)
{
if
(
pkt
->
info
.
no_check_deck
)
{
myswprintf
(
msgbuf
,
L"* %
ls
\n
"
,
dataManager
.
GetSysString
(
1229
));
myswprintf
(
msgbuf
,
L"*%
ls
\n
"
,
dataManager
.
GetSysString
(
1229
));
str
.
append
(
msgbuf
);
str
.
append
(
msgbuf
);
}
}
if
(
pkt
->
info
.
no_shuffle_deck
)
{
if
(
pkt
->
info
.
no_shuffle_deck
)
{
myswprintf
(
msgbuf
,
L"* %
ls
\n
"
,
dataManager
.
GetSysString
(
1230
));
myswprintf
(
msgbuf
,
L"*%
ls
\n
"
,
dataManager
.
GetSysString
(
1230
));
str
.
append
(
msgbuf
);
str
.
append
(
msgbuf
);
}
}
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
...
@@ -305,7 +311,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
...
@@ -305,7 +311,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
}
else
if
(
state
==
PLAYERCHANGE_OBSERVE
)
{
}
else
if
(
state
==
PLAYERCHANGE_OBSERVE
)
{
watching
++
;
watching
++
;
wchar_t
watchbuf
[
32
];
wchar_t
watchbuf
[
32
];
myswprintf
(
watchbuf
,
L" % ls %
d"
,
dataManager
.
GetSysString
(
1253
),
watching
);
myswprintf
(
watchbuf
,
L"%ls%
d"
,
dataManager
.
GetSysString
(
1253
),
watching
);
mainGame
->
stHostSingleDuelist
[
pos
]
->
setText
(
L""
);
mainGame
->
stHostSingleDuelist
[
pos
]
->
setText
(
L""
);
mainGame
->
chkHostSingleReady
[
pos
]
->
setChecked
(
false
);
mainGame
->
chkHostSingleReady
[
pos
]
->
setChecked
(
false
);
mainGame
->
stHostSingleOB
->
setText
(
watchbuf
);
mainGame
->
stHostSingleOB
->
setText
(
watchbuf
);
...
@@ -313,16 +319,17 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
...
@@ -313,16 +319,17 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
break
;
break
;
}
}
case
STOC_HS_WATCH_CHANGE
:
case
STOC_HS_WATCH_CHANGE
:
{
STOC_HS_WatchChange
*
pkt
=
(
STOC_HS_WatchChange
*
)
pdata
;
STOC_HS_WatchChange
*
pkt
=
(
STOC_HS_WatchChange
*
)
pdata
;
watching
=
pkt
->
watch_count
;
watching
=
pkt
->
watch_count
;
wchar_t
watchbuf
[
32
];
wchar_t
watchbuf
[
32
];
myswprintf
(
watchbuf
,
L"
% ls %
d"
,
dataManager
.
GetSysString
(
1253
),
watching
);
myswprintf
(
watchbuf
,
L"
%ls%
d"
,
dataManager
.
GetSysString
(
1253
),
watching
);
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
stHostSingleOB
->
setText
(
watchbuf
);
mainGame
->
stHostSingleOB
->
setText
(
watchbuf
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
break
;
break
;
}
}
}
}
}
int
DuelClient
::
ClientAnalyze
(
char
*
msg
,
unsigned
int
len
)
{
int
DuelClient
::
ClientAnalyze
(
char
*
msg
,
unsigned
int
len
)
{
char
*
pbuf
=
msg
;
char
*
pbuf
=
msg
;
...
@@ -343,8 +350,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -343,8 +350,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
100
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
100
);
mainGame
->
WaitFrameSignal
(
120
);
mainGame
->
WaitFrameSignal
(
120
);
if
(
!
mainGame
->
dField
.
is_replaying
)
{
if
(
!
mainGame
->
dField
.
is_replaying
)
{
pdInfo
->
isStarted
=
false
;
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
localResponse
.
Set
();
}
}
return
false
;
return
false
;
}
}
...
@@ -354,7 +360,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -354,7 +360,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
int
data
=
BufferIO
::
ReadInt32
(
pbuf
);
int
data
=
BufferIO
::
ReadInt32
(
pbuf
);
switch
(
type
)
{
switch
(
type
)
{
case
HINT_EVENT
:
{
case
HINT_EVENT
:
{
myswprintf
(
pdInfo
->
strEvent
,
L" %
ls"
,
dataManager
.
GetDesc
(
data
));
myswprintf
(
event_string
,
L"%
ls"
,
dataManager
.
GetDesc
(
data
));
break
;
break
;
}
}
case
HINT_MESSAGE
:
{
case
HINT_MESSAGE
:
{
...
@@ -365,11 +371,11 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -365,11 +371,11 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
break
;
break
;
}
}
case
HINT_SELECTMSG
:
{
case
HINT_SELECTMSG
:
{
mainGame
->
dInfo
.
selectH
int
=
data
;
select_h
int
=
data
;
break
;
break
;
}
}
case
HINT_OPSELECTED
:
{
case
HINT_OPSELECTED
:
{
myswprintf
(
textBuffer
,
L"对方选择了:[ %
ls]"
,
dataManager
.
GetDesc
(
data
));
myswprintf
(
textBuffer
,
L"对方选择了:[%
ls]"
,
dataManager
.
GetDesc
(
data
));
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
logParam
.
push_back
(
0
);
mainGame
->
logParam
.
push_back
(
0
);
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
textFont
,
textBuffer
);
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
textFont
,
textBuffer
);
...
@@ -385,7 +391,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -385,7 +391,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
break
;
break
;
}
}
case
HINT_RACE
:
{
case
HINT_RACE
:
{
myswprintf
(
textBuffer
,
L"对方宣言了:[ %
ls]"
,
dataManager
.
FormatRace
(
data
));
myswprintf
(
textBuffer
,
L"对方宣言了:[%
ls]"
,
dataManager
.
FormatRace
(
data
));
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
logParam
.
push_back
(
0
);
mainGame
->
logParam
.
push_back
(
0
);
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
textFont
,
textBuffer
);
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
textFont
,
textBuffer
);
...
@@ -394,7 +400,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -394,7 +400,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
break
;
break
;
}
}
case
HINT_ATTRIB
:
{
case
HINT_ATTRIB
:
{
myswprintf
(
textBuffer
,
L"对方宣言了:[ %
ls]"
,
dataManager
.
FormatAttribute
(
data
));
myswprintf
(
textBuffer
,
L"对方宣言了:[%
ls]"
,
dataManager
.
FormatAttribute
(
data
));
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
logParam
.
push_back
(
0
);
mainGame
->
logParam
.
push_back
(
0
);
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
textFont
,
textBuffer
);
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
textFont
,
textBuffer
);
...
@@ -403,7 +409,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -403,7 +409,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
break
;
break
;
}
}
case
HINT_CODE
:
{
case
HINT_CODE
:
{
myswprintf
(
textBuffer
,
L"对方宣言了:[ %
ls]"
,
dataManager
.
GetName
(
data
));
myswprintf
(
textBuffer
,
L"对方宣言了:[%
ls]"
,
dataManager
.
GetName
(
data
));
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
logParam
.
push_back
(
data
);
mainGame
->
logParam
.
push_back
(
data
);
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
textFont
,
textBuffer
);
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
textFont
,
textBuffer
);
...
@@ -412,7 +418,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -412,7 +418,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
break
;
break
;
}
}
case
HINT_NUMBER
:
{
case
HINT_NUMBER
:
{
myswprintf
(
textBuffer
,
L"对方选择了:[ %
d]"
,
data
);
myswprintf
(
textBuffer
,
L"对方选择了:[%
d]"
,
data
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
logParam
.
push_back
(
0
);
mainGame
->
logParam
.
push_back
(
0
);
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
textFont
,
textBuffer
);
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
textFont
,
textBuffer
);
...
@@ -434,51 +440,31 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -434,51 +440,31 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
int
player
=
BufferIO
::
ReadInt8
(
pbuf
);
int
player
=
BufferIO
::
ReadInt8
(
pbuf
);
int
type
=
BufferIO
::
ReadInt8
(
pbuf
);
int
type
=
BufferIO
::
ReadInt8
(
pbuf
);
if
(
player
==
2
)
if
(
player
==
2
)
myswprintf
(
textBuffer
,
L"Draw Game.
\n
原因: %
ls"
,
dataManager
.
GetVictoryString
(
type
));
myswprintf
(
textBuffer
,
L"Draw Game.
\n
原因:%
ls"
,
dataManager
.
GetVictoryString
(
type
));
else
if
(
mainGame
->
LocalPlayer
(
player
)
==
0
)
{
else
if
(
mainGame
->
LocalPlayer
(
player
)
==
0
)
{
if
(
!
mainGame
->
dField
.
is_replaying
)
{
if
(
!
mainGame
->
dField
.
is_replaying
)
{
if
(
type
==
1
||
type
==
2
)
if
(
type
==
1
||
type
==
2
)
myswprintf
(
textBuffer
,
L"You Win!
\n
原因: % ls %
ls"
,
mainGame
->
LocalName
(
1
),
dataManager
.
GetVictoryString
(
type
));
myswprintf
(
textBuffer
,
L"You Win!
\n
原因:%ls%
ls"
,
mainGame
->
LocalName
(
1
),
dataManager
.
GetVictoryString
(
type
));
else
myswprintf
(
textBuffer
,
L"You Win!
\n
原因: %
ls"
,
dataManager
.
GetVictoryString
(
type
));
else
myswprintf
(
textBuffer
,
L"You Win!
\n
原因:%
ls"
,
dataManager
.
GetVictoryString
(
type
));
}
else
{
}
else
{
if
(
type
==
1
||
type
==
2
)
if
(
type
==
1
||
type
==
2
)
myswprintf
(
textBuffer
,
L" % ls Win!
\n
原因: % ls %
ls"
,
mainGame
->
LocalName
(
0
),
mainGame
->
LocalName
(
1
),
dataManager
.
GetVictoryString
(
type
));
myswprintf
(
textBuffer
,
L"%ls Win!
\n
原因:%ls%
ls"
,
mainGame
->
LocalName
(
0
),
mainGame
->
LocalName
(
1
),
dataManager
.
GetVictoryString
(
type
));
else
myswprintf
(
textBuffer
,
L" % ls Win!
\n
原因: %
ls"
,
mainGame
->
LocalName
(
0
),
dataManager
.
GetVictoryString
(
type
));
else
myswprintf
(
textBuffer
,
L"%ls Win!
\n
原因:%
ls"
,
mainGame
->
LocalName
(
0
),
dataManager
.
GetVictoryString
(
type
));
}
}
}
else
{
}
else
{
if
(
!
mainGame
->
dField
.
is_replaying
)
{
if
(
!
mainGame
->
dField
.
is_replaying
)
{
if
(
type
==
1
||
type
==
2
)
if
(
type
==
1
||
type
==
2
)
myswprintf
(
textBuffer
,
L"You Lose!
\n
原因: % ls %
ls"
,
mainGame
->
LocalName
(
0
),
dataManager
.
GetVictoryString
(
type
));
myswprintf
(
textBuffer
,
L"You Lose!
\n
原因:%ls%
ls"
,
mainGame
->
LocalName
(
0
),
dataManager
.
GetVictoryString
(
type
));
else
myswprintf
(
textBuffer
,
L"You Lose!
\n
原因: %
ls"
,
dataManager
.
GetVictoryString
(
type
));
else
myswprintf
(
textBuffer
,
L"You Lose!
\n
原因:%
ls"
,
dataManager
.
GetVictoryString
(
type
));
}
else
{
}
else
{
if
(
type
==
1
||
type
==
2
)
if
(
type
==
1
||
type
==
2
)
myswprintf
(
textBuffer
,
L" % ls Win!
\n
原因: % ls %
ls"
,
mainGame
->
LocalName
(
1
),
mainGame
->
LocalName
(
0
),
dataManager
.
GetVictoryString
(
type
));
myswprintf
(
textBuffer
,
L"%ls Win!
\n
原因:%ls%
ls"
,
mainGame
->
LocalName
(
1
),
mainGame
->
LocalName
(
0
),
dataManager
.
GetVictoryString
(
type
));
else
myswprintf
(
textBuffer
,
L" % ls Win!
\n
原因: %
ls"
,
mainGame
->
LocalName
(
1
),
dataManager
.
GetVictoryString
(
type
));
else
myswprintf
(
textBuffer
,
L"%ls Win!
\n
原因:%
ls"
,
mainGame
->
LocalName
(
1
),
dataManager
.
GetVictoryString
(
type
));
}
}
}
}
mainGame
->
stACMessage
->
setText
(
textBuffer
);
mainGame
->
stACMessage
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
100
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
100
);
mainGame
->
WaitFrameSignal
(
120
);
mainGame
->
WaitFrameSignal
(
120
);
if
(
mainGame
->
dInfo
.
is_local_host
)
mainGame
->
localResponse
.
Set
();
break
;
}
case
MSG_DUEL_END
:
{
pdInfo
->
isStarted
=
false
;
mainGame
->
localResponse
.
Set
();
return
false
;
}
case
MSG_REPLAY
:
{
pbuf
-=
3
;
int
size
=
BufferIO
::
ReadInt16
(
pbuf
);
pbuf
++
;
memcpy
(
&
mainGame
->
lastReplay
.
pheader
,
pbuf
,
sizeof
(
ReplayHeader
));
pbuf
+=
sizeof
(
ReplayHeader
);
memcpy
(
mainGame
->
lastReplay
.
comp_data
,
pbuf
,
size
-
sizeof
(
ReplayHeader
)
-
1
);
mainGame
->
lastReplay
.
comp_size
=
size
-
sizeof
(
ReplayHeader
)
-
1
;
mainGame
->
PopupElement
(
mainGame
->
wReplaySave
);
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Wait
();
break
;
break
;
}
}
case
MSG_WAITING
:
{
case
MSG_WAITING
:
{
...
@@ -491,20 +477,20 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -491,20 +477,20 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
}
}
case
MSG_START
:
{
case
MSG_START
:
{
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
pdInfo
->
is_first_turn
=
BufferIO
::
ReadInt32
(
pbuf
)
?
false
:
true
;
mainGame
->
dInfo
.
is_first_turn
=
BufferIO
::
ReadInt8
(
pbuf
)
?
false
:
true
;
pdInfo
->
lp
[
mainGame
->
LocalPlayer
(
0
)]
=
BufferIO
::
ReadInt32
(
pbuf
);
mainGame
->
dInfo
.
lp
[
mainGame
->
LocalPlayer
(
0
)]
=
BufferIO
::
ReadInt32
(
pbuf
);
pdInfo
->
lp
[
mainGame
->
LocalPlayer
(
1
)]
=
BufferIO
::
ReadInt32
(
pbuf
);
mainGame
->
dInfo
.
lp
[
mainGame
->
LocalPlayer
(
1
)]
=
BufferIO
::
ReadInt32
(
pbuf
);
myswprintf
(
pdInfo
->
strLP
[
0
],
L" % d"
,
pdInfo
->
lp
[
0
]);
myswprintf
(
mainGame
->
dInfo
.
strLP
[
0
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
0
]);
myswprintf
(
pdInfo
->
strLP
[
1
],
L" % d"
,
pdInfo
->
lp
[
1
]);
myswprintf
(
mainGame
->
dInfo
.
strLP
[
1
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
1
]);
int
deckc
=
BufferIO
::
ReadInt32
(
pbuf
);
int
deckc
=
BufferIO
::
ReadInt16
(
pbuf
);
int
extrac
=
BufferIO
::
ReadInt32
(
pbuf
);
int
extrac
=
BufferIO
::
ReadInt16
(
pbuf
);
mainGame
->
dField
.
Initial
(
mainGame
->
LocalPlayer
(
0
),
deckc
,
extrac
);
mainGame
->
dField
.
Initial
(
mainGame
->
LocalPlayer
(
0
),
deckc
,
extrac
);
deckc
=
BufferIO
::
ReadInt32
(
pbuf
);
deckc
=
BufferIO
::
ReadInt16
(
pbuf
);
extrac
=
BufferIO
::
ReadInt32
(
pbuf
);
extrac
=
BufferIO
::
ReadInt16
(
pbuf
);
mainGame
->
dField
.
Initial
(
mainGame
->
LocalPlayer
(
1
),
deckc
,
extrac
);
mainGame
->
dField
.
Initial
(
mainGame
->
LocalPlayer
(
1
),
deckc
,
extrac
);
pdInfo
->
turn
=
0
;
mainGame
->
dInfo
.
turn
=
0
;
pdInfo
->
strTurn
[
0
]
=
0
;
mainGame
->
dInfo
.
strTurn
[
0
]
=
0
;
pdInfo
->
is_shuffling
=
false
;
mainGame
->
dInfo
.
is_shuffling
=
false
;
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
return
true
;
return
true
;
}
}
...
@@ -514,8 +500,8 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -514,8 +500,8 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
dField
.
UpdateFieldCard
(
player
,
location
,
pbuf
);
mainGame
->
dField
.
UpdateFieldCard
(
player
,
location
,
pbuf
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
if
(
location
==
LOCATION_HAND
&&
pdInfo
->
is_shuffling
)
{
if
(
location
==
LOCATION_HAND
&&
mainGame
->
dInfo
.
is_shuffling
)
{
pdInfo
->
is_shuffling
=
false
;
mainGame
->
dInfo
.
is_shuffling
=
false
;
for
(
int
i
=
0
;
i
<
mainGame
->
dField
.
hand
[
0
].
size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
mainGame
->
dField
.
hand
[
0
].
size
();
++
i
)
{
mainGame
->
dField
.
hand
[
0
][
i
]
->
is_hovered
=
false
;
mainGame
->
dField
.
hand
[
0
][
i
]
->
is_hovered
=
false
;
mainGame
->
dField
.
MoveCard
(
mainGame
->
dField
.
hand
[
0
][
i
],
5
);
mainGame
->
dField
.
MoveCard
(
mainGame
->
dField
.
hand
[
0
][
i
],
5
);
...
@@ -584,7 +570,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -584,7 +570,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
dField
.
ClearCommandFlag
();
mainGame
->
dField
.
ClearCommandFlag
();
mainGame
->
btnM2
->
setVisible
(
false
);
mainGame
->
btnM2
->
setVisible
(
false
);
mainGame
->
btnEP
->
setVisible
(
false
);
mainGame
->
btnEP
->
setVisible
(
false
);
mainGame
->
localResponse
.
Set
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
}
}
case
MSG_SELECT_IDLECMD
:
{
case
MSG_SELECT_IDLECMD
:
{
...
@@ -689,7 +675,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -689,7 +675,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
dField
.
ClearCommandFlag
();
mainGame
->
dField
.
ClearCommandFlag
();
mainGame
->
btnBP
->
setVisible
(
false
);
mainGame
->
btnBP
->
setVisible
(
false
);
mainGame
->
btnEP
->
setVisible
(
false
);
mainGame
->
btnEP
->
setVisible
(
false
);
mainGame
->
localResponse
.
Set
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
}
}
case
MSG_SELECT_EFFECTYN
:
{
case
MSG_SELECT_EFFECTYN
:
{
...
@@ -702,14 +688,14 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -702,14 +688,14 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
if
(
pcard
->
code
!=
code
)
if
(
pcard
->
code
!=
code
)
pcard
->
SetCode
(
code
);
pcard
->
SetCode
(
code
);
BufferIO
::
ReadInt8
(
pbuf
);
BufferIO
::
ReadInt8
(
pbuf
);
myswprintf
(
textBuffer
,
L"是否在[ % ls]发动[ %
ls]的效果?"
,
dataManager
.
FormatLocation
(
l
),
dataManager
.
GetName
(
code
));
myswprintf
(
textBuffer
,
L"是否在[%ls]发动[%
ls]的效果?"
,
dataManager
.
FormatLocation
(
l
),
dataManager
.
GetName
(
code
));
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
textBuffer
);
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localResponse
.
Set
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
}
}
case
MSG_SELECT_YESNO
:
{
case
MSG_SELECT_YESNO
:
{
...
@@ -721,7 +707,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -721,7 +707,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localResponse
.
Set
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
}
}
case
MSG_SELECT_OPTION
:
{
case
MSG_SELECT_OPTION
:
{
...
@@ -738,16 +724,16 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -738,16 +724,16 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
btnOptionn
->
setVisible
(
true
);
mainGame
->
btnOptionn
->
setVisible
(
true
);
else
mainGame
->
btnOptionn
->
setVisible
(
false
);
else
mainGame
->
btnOptionn
->
setVisible
(
false
);
mainGame
->
dField
.
selected_option
=
0
;
mainGame
->
dField
.
selected_option
=
0
;
if
(
mainGame
->
dInfo
.
selectH
int
)
if
(
select_h
int
)
myswprintf
(
textBuffer
,
L" % ls"
,
dataManager
.
GetDesc
(
mainGame
->
dInfo
.
selectH
int
));
myswprintf
(
textBuffer
,
L"%ls"
,
dataManager
.
GetDesc
(
select_h
int
));
else
myswprintf
(
textBuffer
,
L"请选择一个选项:"
);
else
myswprintf
(
textBuffer
,
L"请选择一个选项:"
);
mainGame
->
dInfo
.
selectH
int
=
0
;
select_h
int
=
0
;
mainGame
->
wOptions
->
setText
(
textBuffer
);
mainGame
->
wOptions
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wOptions
);
mainGame
->
PopupElement
(
mainGame
->
wOptions
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localResponse
.
Set
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
}
}
case
MSG_SELECT_CARD
:
{
case
MSG_SELECT_CARD
:
{
...
@@ -782,11 +768,11 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -782,11 +768,11 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
panelmode
=
true
;
panelmode
=
true
;
}
}
std
::
sort
(
mainGame
->
dField
.
selectable_cards
.
begin
(),
mainGame
->
dField
.
selectable_cards
.
end
(),
ClientCard
::
client_card_sort
);
std
::
sort
(
mainGame
->
dField
.
selectable_cards
.
begin
(),
mainGame
->
dField
.
selectable_cards
.
end
(),
ClientCard
::
client_card_sort
);
if
(
mainGame
->
dInfo
.
selectH
int
)
if
(
select_h
int
)
myswprintf
(
textBuffer
,
L" % ls( % d - % d)"
,
dataManager
.
GetDesc
(
mainGame
->
dInfo
.
selectH
int
),
myswprintf
(
textBuffer
,
L"%ls(%d-%d)"
,
dataManager
.
GetDesc
(
select_h
int
),
mainGame
->
dField
.
select_min
,
mainGame
->
dField
.
select_max
);
mainGame
->
dField
.
select_min
,
mainGame
->
dField
.
select_max
);
else
myswprintf
(
textBuffer
,
L"请选择卡:( % d - %
d)"
,
mainGame
->
dField
.
select_min
,
mainGame
->
dField
.
select_max
);
else
myswprintf
(
textBuffer
,
L"请选择卡:(%d-%
d)"
,
mainGame
->
dField
.
select_min
,
mainGame
->
dField
.
select_max
);
mainGame
->
dInfo
.
selectH
int
=
0
;
select_h
int
=
0
;
if
(
panelmode
)
{
if
(
panelmode
)
{
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
wCardSelect
->
setText
(
textBuffer
);
mainGame
->
wCardSelect
->
setText
(
textBuffer
);
...
@@ -799,7 +785,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -799,7 +785,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localAction
.
Wait
();
mainGame
->
dField
.
ClearSelect
();
mainGame
->
dField
.
ClearSelect
();
mainGame
->
localResponse
.
Set
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
}
}
case
MSG_SELECT_CHAIN
:
{
case
MSG_SELECT_CHAIN
:
{
...
@@ -830,27 +816,26 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -830,27 +816,26 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
dField
.
remove_act
=
true
;
mainGame
->
dField
.
remove_act
=
true
;
}
}
if
(
mainGame
->
ignore_chain
||
((
count
==
0
||
specount
==
0
)
&&
!
mainGame
->
always_chain
))
{
if
(
mainGame
->
ignore_chain
||
((
count
==
0
||
specount
==
0
)
&&
!
mainGame
->
always_chain
))
{
mainGame
->
dInfo
.
responseI
=
-
1
;
SetResponseI
(
-
1
);
mainGame
->
SetResponseI
();
mainGame
->
dField
.
ClearChainSelect
();
mainGame
->
dField
.
ClearChainSelect
();
if
(
mainGame
->
chkWaitChain
->
isChecked
())
{
if
(
mainGame
->
chkWaitChain
->
isChecked
())
{
mainGame
->
WaitFrameSignal
(
mainGame
->
rnd
.
real
()
*
20
+
20
);
mainGame
->
WaitFrameSignal
(
rnd
.
real
()
*
20
+
20
);
}
}
mainGame
->
localResponse
.
Set
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
}
}
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
if
(
count
==
0
)
if
(
count
==
0
)
myswprintf
(
textBuffer
,
L"此时没有可以发动的效果
\n
是否要确认场上的情况?"
);
myswprintf
(
textBuffer
,
L"此时没有可以发动的效果
\n
是否要确认场上的情况?"
);
else
else
myswprintf
(
textBuffer
,
L" % ls
\n
是否进行连锁?"
,
pdInfo
->
strEvent
);
myswprintf
(
textBuffer
,
L"%ls
\n
是否进行连锁?"
,
event_string
);
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
textBuffer
);
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localAction
.
Wait
();
mainGame
->
dField
.
ClearChainSelect
();
mainGame
->
dField
.
ClearChainSelect
();
mainGame
->
localResponse
.
Set
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
}
}
case
MSG_SELECT_PLACE
:
case
MSG_SELECT_PLACE
:
...
@@ -859,44 +844,45 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -859,44 +844,45 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
dField
.
select_min
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame
->
dField
.
select_min
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame
->
dField
.
selectable_field
=
~
BufferIO
::
ReadInt32
(
pbuf
);
mainGame
->
dField
.
selectable_field
=
~
BufferIO
::
ReadInt32
(
pbuf
);
mainGame
->
dField
.
selected_field
=
0
;
mainGame
->
dField
.
selected_field
=
0
;
unsigned
char
respbuf
[
64
];
if
(
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_PLACE
&&
mainGame
->
chkAutoPos
->
isChecked
())
{
if
(
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_PLACE
&&
mainGame
->
chkAutoPos
->
isChecked
())
{
int
filter
;
int
filter
;
if
(
mainGame
->
dField
.
selectable_field
&
0x1f
)
{
if
(
mainGame
->
dField
.
selectable_field
&
0x1f
)
{
mainGame
->
dInfo
.
responseB
[
0
]
=
mainGame
->
dInfo
.
is_first_turn
?
0
:
1
;
respbuf
[
0
]
=
mainGame
->
dInfo
.
is_first_turn
?
0
:
1
;
mainGame
->
dInfo
.
responseB
[
1
]
=
0x4
;
respbuf
[
1
]
=
0x4
;
filter
=
mainGame
->
dField
.
selectable_field
&
0x1f
;
filter
=
mainGame
->
dField
.
selectable_field
&
0x1f
;
}
else
if
(
mainGame
->
dField
.
selectable_field
&
0x1f00
)
{
}
else
if
(
mainGame
->
dField
.
selectable_field
&
0x1f00
)
{
mainGame
->
dInfo
.
responseB
[
0
]
=
mainGame
->
dInfo
.
is_first_turn
?
0
:
1
;
respbuf
[
0
]
=
mainGame
->
dInfo
.
is_first_turn
?
0
:
1
;
mainGame
->
dInfo
.
responseB
[
1
]
=
0x8
;
respbuf
[
1
]
=
0x8
;
filter
=
(
mainGame
->
dField
.
selectable_field
>>
8
)
&
0x1f
;
filter
=
(
mainGame
->
dField
.
selectable_field
>>
8
)
&
0x1f
;
}
else
if
(
mainGame
->
dField
.
selectable_field
&
0x1f0000
)
{
}
else
if
(
mainGame
->
dField
.
selectable_field
&
0x1f0000
)
{
mainGame
->
dInfo
.
responseB
[
0
]
=
mainGame
->
dInfo
.
is_first_turn
?
1
:
0
;
respbuf
[
0
]
=
mainGame
->
dInfo
.
is_first_turn
?
1
:
0
;
mainGame
->
dInfo
.
responseB
[
1
]
=
0x4
;
respbuf
[
1
]
=
0x4
;
filter
=
(
mainGame
->
dField
.
selectable_field
>>
16
)
&
0x1f
;
filter
=
(
mainGame
->
dField
.
selectable_field
>>
16
)
&
0x1f
;
}
else
{
}
else
{
mainGame
->
dInfo
.
responseB
[
0
]
=
mainGame
->
dInfo
.
is_first_turn
?
1
:
0
;
respbuf
[
0
]
=
mainGame
->
dInfo
.
is_first_turn
?
1
:
0
;
mainGame
->
dInfo
.
responseB
[
1
]
=
0x8
;
respbuf
[
1
]
=
0x8
;
filter
=
(
mainGame
->
dField
.
selectable_field
>>
24
)
&
0x1f
;
filter
=
(
mainGame
->
dField
.
selectable_field
>>
24
)
&
0x1f
;
}
}
if
(
mainGame
->
chkRandomPos
->
isChecked
())
{
if
(
mainGame
->
chkRandomPos
->
isChecked
())
{
mainGame
->
dInfo
.
responseB
[
2
]
=
mainGame
->
rnd
.
real
()
*
5
;
respbuf
[
2
]
=
rnd
.
real
()
*
5
;
while
(
!
(
filter
&
(
1
<<
mainGame
->
dInfo
.
responseB
[
2
])))
while
(
!
(
filter
&
(
1
<<
respbuf
[
2
])))
mainGame
->
dInfo
.
responseB
[
2
]
=
mainGame
->
rnd
.
real
()
*
5
;
respbuf
[
2
]
=
rnd
.
real
()
*
5
;
}
else
{
}
else
{
if
(
filter
&
0x4
)
mainGame
->
dInfo
.
responseB
[
2
]
=
2
;
if
(
filter
&
0x4
)
respbuf
[
2
]
=
2
;
else
if
(
filter
&
0x2
)
mainGame
->
dInfo
.
responseB
[
2
]
=
1
;
else
if
(
filter
&
0x2
)
respbuf
[
2
]
=
1
;
else
if
(
filter
&
0x8
)
mainGame
->
dInfo
.
responseB
[
2
]
=
3
;
else
if
(
filter
&
0x8
)
respbuf
[
2
]
=
3
;
else
if
(
filter
&
0x1
)
mainGame
->
dInfo
.
responseB
[
2
]
=
0
;
else
if
(
filter
&
0x1
)
respbuf
[
2
]
=
0
;
else
if
(
filter
&
0x10
)
mainGame
->
dInfo
.
responseB
[
2
]
=
4
;
else
if
(
filter
&
0x10
)
respbuf
[
2
]
=
4
;
}
}
mainGame
->
dField
.
selectable_field
=
0
;
mainGame
->
dField
.
selectable_field
=
0
;
mainGame
->
SetResponseB
(
3
);
SetResponseB
(
respbuf
,
3
);
mainGame
->
localResponse
.
Set
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
}
}
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localResponse
.
Set
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
}
}
case
MSG_SELECT_POSITION
:
{
case
MSG_SELECT_POSITION
:
{
...
@@ -904,8 +890,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -904,8 +890,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
int
code
=
BufferIO
::
ReadInt32
(
pbuf
);
int
code
=
BufferIO
::
ReadInt32
(
pbuf
);
int
positions
=
BufferIO
::
ReadInt8
(
pbuf
);
int
positions
=
BufferIO
::
ReadInt8
(
pbuf
);
if
(
positions
==
0x1
||
positions
==
0x2
||
positions
==
0x4
||
positions
==
0x8
)
{
if
(
positions
==
0x1
||
positions
==
0x2
||
positions
==
0x4
||
positions
==
0x8
)
{
mainGame
->
dInfo
.
responseI
=
positions
;
SetResponseI
(
positions
);
mainGame
->
SetResponseI
();
return
true
;
return
true
;
}
}
int
count
=
0
,
filter
=
0x1
,
startpos
;
int
count
=
0
,
filter
=
0x1
,
startpos
;
...
@@ -941,7 +926,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -941,7 +926,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
PopupElement
(
mainGame
->
wPosSelect
);
mainGame
->
PopupElement
(
mainGame
->
wPosSelect
);
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localResponse
.
Set
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
}
}
case
MSG_SELECT_TRIBUTE
:
{
case
MSG_SELECT_TRIBUTE
:
{
...
@@ -974,7 +959,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -974,7 +959,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localAction
.
Wait
();
mainGame
->
dField
.
ClearSelect
();
mainGame
->
dField
.
ClearSelect
();
mainGame
->
localResponse
.
Set
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
}
}
case
MSG_SELECT_COUNTER
:
{
case
MSG_SELECT_COUNTER
:
{
...
@@ -993,12 +978,11 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -993,12 +978,11 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
t
=
BufferIO
::
ReadInt8
(
pbuf
);
t
=
BufferIO
::
ReadInt8
(
pbuf
);
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
mainGame
->
dField
.
selectable_cards
.
push_back
(
pcard
);
mainGame
->
dField
.
selectable_cards
.
push_back
(
pcard
);
pcard
->
opParam
=
t
;
pcard
->
opParam
=
(
t
<<
16
)
|
t
;
pcard
->
select_seq
=
i
;
pcard
->
select_seq
=
i
;
pcard
->
is_selectable
=
true
;
pcard
->
is_selectable
=
true
;
mainGame
->
dInfo
.
responseB
[
i
]
=
0
;
}
}
myswprintf
(
textBuffer
,
L"请移除 % d个[ %
ls]: "
,
mainGame
->
dField
.
select_counter_count
,
dataManager
.
GetCounterName
(
mainGame
->
dField
.
select_counter_type
));
myswprintf
(
textBuffer
,
L"请移除%d个[%
ls]: "
,
mainGame
->
dField
.
select_counter_count
,
dataManager
.
GetCounterName
(
mainGame
->
dField
.
select_counter_type
));
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
stHintMsg
->
setText
(
textBuffer
);
mainGame
->
stHintMsg
->
setText
(
textBuffer
);
mainGame
->
stHintMsg
->
setVisible
(
true
);
mainGame
->
stHintMsg
->
setVisible
(
true
);
...
@@ -1006,7 +990,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1006,7 +990,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localAction
.
Wait
();
mainGame
->
dField
.
ClearSelect
();
mainGame
->
dField
.
ClearSelect
();
mainGame
->
localResponse
.
Set
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
}
}
case
MSG_SELECT_SUM
:
{
case
MSG_SELECT_SUM
:
{
...
@@ -1037,11 +1021,10 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1037,11 +1021,10 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
}
}
std
::
sort
(
mainGame
->
dField
.
selectsum_all
.
begin
(),
mainGame
->
dField
.
selectsum_all
.
end
(),
ClientCard
::
client_card_sort
);
std
::
sort
(
mainGame
->
dField
.
selectsum_all
.
begin
(),
mainGame
->
dField
.
selectsum_all
.
end
(),
ClientCard
::
client_card_sort
);
mainGame
->
dField
.
CheckSelectSum
();
mainGame
->
dField
.
CheckSelectSum
();
if
(
mainGame
->
dInfo
.
selectHint
)
if
(
select_hint
)
myswprintf
(
textBuffer
,
L"
myswprintf
(
textBuffer
,
L"%ls(%d)"
,
dataManager
.
GetDesc
(
select_hint
),
mainGame
->
dField
.
select_max
);
% ls( % d)"
,
dataManager
.
GetDesc
(
mainGame
->
dInfo
.
selectHint
),
mainGame
->
dField
.
select_max
);
else
myswprintf
(
textBuffer
,
L"请选择卡:(%d)"
,
mainGame
->
dField
.
select_max
);
else
myswprintf
(
textBuffer
,
L"请选择卡:( % d)"
,
mainGame
->
dField
.
select_max
);
select_hint
=
0
;
mainGame
->
dInfo
.
selectHint
=
0
;
if
(
panelmode
)
{
if
(
panelmode
)
{
mainGame
->
wCardSelect
->
setText
(
textBuffer
);
mainGame
->
wCardSelect
->
setText
(
textBuffer
);
mainGame
->
dField
.
ShowSelectCard
();
mainGame
->
dField
.
ShowSelectCard
();
...
@@ -1052,7 +1035,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1052,7 +1035,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localAction
.
Wait
();
mainGame
->
dField
.
ClearSelect
();
mainGame
->
dField
.
ClearSelect
();
mainGame
->
localResponse
.
Set
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
}
}
case
MSG_SORT_CARD
:
case
MSG_SORT_CARD
:
...
@@ -1076,13 +1059,12 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1076,13 +1059,12 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
pcard
->
select_seq
=
i
;
pcard
->
select_seq
=
i
;
mainGame
->
dField
.
sort_list
.
push_back
(
0
);
mainGame
->
dField
.
sort_list
.
push_back
(
0
);
}
}
if
(
mainGame
->
chkAutoChain
->
isChecked
()
&&
pdInfo
->
curMsg
==
MSG_SORT_CHAIN
)
{
if
(
mainGame
->
chkAutoChain
->
isChecked
()
&&
mainGame
->
dInfo
.
curMsg
==
MSG_SORT_CHAIN
)
{
mainGame
->
dInfo
.
responseI
=
-
1
;
SetResponseI
(
-
1
);
mainGame
->
SetResponseI
();
DuelClient
::
SendResponse
();
mainGame
->
localResponse
.
Set
();
return
true
;
return
true
;
}
}
if
(
pdInfo
->
curMsg
==
MSG_SORT_CHAIN
)
if
(
mainGame
->
dInfo
.
curMsg
==
MSG_SORT_CHAIN
)
mainGame
->
wCardSelect
->
setText
(
L"请选择连锁顺序:"
);
mainGame
->
wCardSelect
->
setText
(
L"请选择连锁顺序:"
);
else
else
mainGame
->
wCardSelect
->
setText
(
L"请选择排列顺序:"
);
mainGame
->
wCardSelect
->
setText
(
L"请选择排列顺序:"
);
...
@@ -1091,7 +1073,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1091,7 +1073,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
dField
.
ShowSelectCard
();
mainGame
->
dField
.
ShowSelectCard
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localResponse
.
Set
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
}
}
case
MSG_CONFIRM_DECKTOP
:
{
case
MSG_CONFIRM_DECKTOP
:
{
...
@@ -1099,7 +1081,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1099,7 +1081,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
int
count
=
BufferIO
::
ReadInt8
(
pbuf
);
int
count
=
BufferIO
::
ReadInt8
(
pbuf
);
int
code
,
c
,
l
,
s
;
int
code
,
c
,
l
,
s
;
ClientCard
*
pcard
;
ClientCard
*
pcard
;
myswprintf
(
textBuffer
,
L"翻开卡组上方 %
d张卡:"
,
count
);
myswprintf
(
textBuffer
,
L"翻开卡组上方%
d张卡:"
,
count
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
logParam
.
push_back
(
0
);
mainGame
->
logParam
.
push_back
(
0
);
mainGame
->
dField
.
selectable_cards
.
clear
();
mainGame
->
dField
.
selectable_cards
.
clear
();
...
@@ -1111,7 +1093,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1111,7 +1093,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
if
(
code
!=
0
)
if
(
code
!=
0
)
pcard
->
SetCode
(
code
);
pcard
->
SetCode
(
code
);
myswprintf
(
textBuffer
,
L" % d [ %
ls]"
,
i
,
dataManager
.
GetName
(
code
));
myswprintf
(
textBuffer
,
L"%d[%
ls]"
,
i
,
dataManager
.
GetName
(
code
));
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
logParam
.
push_back
(
code
);
mainGame
->
logParam
.
push_back
(
code
);
float
shift
=
-
0.15
f
;
float
shift
=
-
0.15
f
;
...
@@ -1132,7 +1114,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1132,7 +1114,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
int
code
,
c
,
l
,
s
;
int
code
,
c
,
l
,
s
;
std
::
vector
<
ClientCard
*>
field_confirm
;
std
::
vector
<
ClientCard
*>
field_confirm
;
ClientCard
*
pcard
;
ClientCard
*
pcard
;
myswprintf
(
textBuffer
,
L"确认 %
d张卡:"
,
count
);
myswprintf
(
textBuffer
,
L"确认%
d张卡:"
,
count
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
logParam
.
push_back
(
0
);
mainGame
->
logParam
.
push_back
(
0
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
...
@@ -1143,7 +1125,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1143,7 +1125,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
if
(
code
!=
0
)
if
(
code
!=
0
)
pcard
->
SetCode
(
code
);
pcard
->
SetCode
(
code
);
myswprintf
(
textBuffer
,
L" % d [ %
ls]"
,
i
,
dataManager
.
GetName
(
code
));
myswprintf
(
textBuffer
,
L"%d[%
ls]"
,
i
,
dataManager
.
GetName
(
code
));
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
logParam
.
push_back
(
code
);
mainGame
->
logParam
.
push_back
(
code
);
if
(
l
&
0x41
)
{
if
(
l
&
0x41
)
{
...
@@ -1316,9 +1298,8 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1316,9 +1298,8 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
case
MSG_NEW_TURN
:
{
case
MSG_NEW_TURN
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
mainGame
->
dInfo
.
turn
++
;
mainGame
->
dInfo
.
turn
++
;
myswprintf
(
mainGame
->
dInfo
.
strTurn
,
L"Turn:
myswprintf
(
mainGame
->
dInfo
.
strTurn
,
L"Turn:%d"
,
mainGame
->
dInfo
.
turn
);
% d"
,
mainGame
->
dInfo
.
turn
);
myswprintf
(
textBuffer
,
L"%ls的回合"
,
mainGame
->
LocalName
(
player
));
myswprintf
(
textBuffer
,
L" % ls的回合"
,
mainGame
->
LocalName
(
player
));
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
stACMessage
->
setText
(
textBuffer
);
mainGame
->
stACMessage
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
...
@@ -1537,7 +1518,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1537,7 +1518,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
if
(
code
!=
0
&&
pcard
->
code
!=
code
)
if
(
code
!=
0
&&
pcard
->
code
!=
code
)
pcard
->
SetCode
(
code
);
pcard
->
SetCode
(
code
);
pcard
->
position
=
cp
;
pcard
->
position
=
cp
;
myswprintf
(
pdInfo
->
strEvent
,
L"卡片改变了表示形式"
);
myswprintf
(
event_string
,
L"卡片改变了表示形式"
);
mainGame
->
dField
.
MoveCard
(
pcard
,
10
);
mainGame
->
dField
.
MoveCard
(
pcard
,
10
);
mainGame
->
WaitFrameSignal
(
10
);
mainGame
->
WaitFrameSignal
(
10
);
return
true
;
return
true
;
...
@@ -1548,7 +1529,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1548,7 +1529,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
int
cl
=
BufferIO
::
ReadInt8
(
pbuf
);
int
cl
=
BufferIO
::
ReadInt8
(
pbuf
);
int
cs
=
BufferIO
::
ReadInt8
(
pbuf
);
int
cs
=
BufferIO
::
ReadInt8
(
pbuf
);
int
cp
=
BufferIO
::
ReadInt8
(
pbuf
);
int
cp
=
BufferIO
::
ReadInt8
(
pbuf
);
myswprintf
(
pdInfo
->
strEvent
,
L"放置了卡片"
);
myswprintf
(
event_string
,
L"放置了卡片"
);
return
true
;
return
true
;
}
}
case
MSG_SWAP
:
{
case
MSG_SWAP
:
{
...
@@ -1562,7 +1543,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1562,7 +1543,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
int
l2
=
BufferIO
::
ReadInt8
(
pbuf
);
int
l2
=
BufferIO
::
ReadInt8
(
pbuf
);
int
s2
=
BufferIO
::
ReadInt8
(
pbuf
);
int
s2
=
BufferIO
::
ReadInt8
(
pbuf
);
int
p2
=
BufferIO
::
ReadInt8
(
pbuf
);
int
p2
=
BufferIO
::
ReadInt8
(
pbuf
);
myswprintf
(
pdInfo
->
strEvent
,
L"卡的控制权改变了"
);
myswprintf
(
event_string
,
L"卡的控制权改变了"
);
ClientCard
*
pc1
=
mainGame
->
dField
.
GetCard
(
c1
,
l1
,
s1
);
ClientCard
*
pc1
=
mainGame
->
dField
.
GetCard
(
c1
,
l1
,
s1
);
ClientCard
*
pc2
=
mainGame
->
dField
.
GetCard
(
c2
,
l2
,
s2
);
ClientCard
*
pc2
=
mainGame
->
dField
.
GetCard
(
c2
,
l2
,
s2
);
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
...
@@ -1593,7 +1574,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1593,7 +1574,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
int
cl
=
BufferIO
::
ReadInt8
(
pbuf
);
int
cl
=
BufferIO
::
ReadInt8
(
pbuf
);
int
cs
=
BufferIO
::
ReadInt8
(
pbuf
);
int
cs
=
BufferIO
::
ReadInt8
(
pbuf
);
int
cp
=
BufferIO
::
ReadInt8
(
pbuf
);
int
cp
=
BufferIO
::
ReadInt8
(
pbuf
);
myswprintf
(
pdInfo
->
strEvent
,
L"[ %
ls]召唤中..."
,
dataManager
.
GetName
(
code
));
myswprintf
(
event_string
,
L"[%
ls]召唤中..."
,
dataManager
.
GetName
(
code
));
mainGame
->
showcardcode
=
code
;
mainGame
->
showcardcode
=
code
;
mainGame
->
showcarddif
=
0
;
mainGame
->
showcarddif
=
0
;
mainGame
->
showcard
=
4
;
mainGame
->
showcard
=
4
;
...
@@ -1603,7 +1584,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1603,7 +1584,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
return
true
;
return
true
;
}
}
case
MSG_SUMMONED
:
{
case
MSG_SUMMONED
:
{
myswprintf
(
pdInfo
->
strEvent
,
L"怪兽召唤成功"
);
myswprintf
(
event_string
,
L"怪兽召唤成功"
);
return
true
;
return
true
;
}
}
case
MSG_SPSUMMONING
:
{
case
MSG_SPSUMMONING
:
{
...
@@ -1612,8 +1593,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1612,8 +1593,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
int
cl
=
BufferIO
::
ReadInt8
(
pbuf
);
int
cl
=
BufferIO
::
ReadInt8
(
pbuf
);
int
cs
=
BufferIO
::
ReadInt8
(
pbuf
);
int
cs
=
BufferIO
::
ReadInt8
(
pbuf
);
int
cp
=
BufferIO
::
ReadInt8
(
pbuf
);
int
cp
=
BufferIO
::
ReadInt8
(
pbuf
);
myswprintf
(
pdInfo
->
strEvent
,
L"[ % ls]特殊召唤中..."
,
dataManager
.
GetName
(
code
));
myswprintf
(
event_string
,
L"[%ls]特殊召唤中..."
,
dataManager
.
GetName
(
code
));
myswprintf
(
pdInfo
->
strEvent
,
L"[ % ls]召唤中..."
,
dataManager
.
GetName
(
code
));
mainGame
->
showcardcode
=
code
;
mainGame
->
showcardcode
=
code
;
mainGame
->
showcarddif
=
1
;
mainGame
->
showcarddif
=
1
;
mainGame
->
showcard
=
5
;
mainGame
->
showcard
=
5
;
...
@@ -1623,7 +1603,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1623,7 +1603,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
return
true
;
return
true
;
}
}
case
MSG_SPSUMMONED
:
{
case
MSG_SPSUMMONED
:
{
myswprintf
(
pdInfo
->
strEvent
,
L"怪兽特殊召唤成功"
);
myswprintf
(
event_string
,
L"怪兽特殊召唤成功"
);
return
true
;
return
true
;
}
}
case
MSG_FLIPSUMMONING
:
{
case
MSG_FLIPSUMMONING
:
{
...
@@ -1635,7 +1615,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1635,7 +1615,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
ClientCard
*
pcard
=
mainGame
->
dField
.
GetCard
(
cc
,
cl
,
cs
);
ClientCard
*
pcard
=
mainGame
->
dField
.
GetCard
(
cc
,
cl
,
cs
);
pcard
->
SetCode
(
code
);
pcard
->
SetCode
(
code
);
pcard
->
position
=
cp
;
pcard
->
position
=
cp
;
myswprintf
(
pdInfo
->
strEvent
,
L"[ %
ls]反转召唤中..."
,
dataManager
.
GetName
(
code
));
myswprintf
(
event_string
,
L"[%
ls]反转召唤中..."
,
dataManager
.
GetName
(
code
));
mainGame
->
dField
.
MoveCard
(
pcard
,
10
);
mainGame
->
dField
.
MoveCard
(
pcard
,
10
);
mainGame
->
WaitFrameSignal
(
10
);
mainGame
->
WaitFrameSignal
(
10
);
mainGame
->
showcardcode
=
code
;
mainGame
->
showcardcode
=
code
;
...
@@ -1647,7 +1627,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1647,7 +1627,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
return
true
;
return
true
;
}
}
case
MSG_FLIPSUMMONED
:
{
case
MSG_FLIPSUMMONED
:
{
myswprintf
(
pdInfo
->
strEvent
,
L"怪兽反转召唤成功"
);
myswprintf
(
event_string
,
L"怪兽反转召唤成功"
);
return
true
;
return
true
;
}
}
case
MSG_CHAINING
:
{
case
MSG_CHAINING
:
{
...
@@ -1694,7 +1674,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1694,7 +1674,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
}
}
case
MSG_CHAINED
:
{
case
MSG_CHAINED
:
{
int
ct
=
BufferIO
::
ReadInt8
(
pbuf
);
int
ct
=
BufferIO
::
ReadInt8
(
pbuf
);
myswprintf
(
mainGame
->
dInfo
.
strEvent
,
L"[ %
ls]的效果发动"
,
dataManager
.
GetName
(
mainGame
->
dField
.
current_chain
.
code
));
myswprintf
(
event_string
,
L"[%
ls]的效果发动"
,
dataManager
.
GetName
(
mainGame
->
dField
.
current_chain
.
code
));
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
dField
.
chains
.
push_back
(
mainGame
->
dField
.
current_chain
);
mainGame
->
dField
.
chains
.
push_back
(
mainGame
->
dField
.
current_chain
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
...
@@ -1778,7 +1758,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1778,7 +1758,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
}
}
}
else
}
else
mainGame
->
WaitFrameSignal
(
30
);
mainGame
->
WaitFrameSignal
(
30
);
myswprintf
(
textBuffer
,
L"[ % ls]( % ls, %
d)成为对象"
,
dataManager
.
GetName
(
pcard
->
code
),
dataManager
.
FormatLocation
(
l
),
s
);
myswprintf
(
textBuffer
,
L"[%ls](%ls,%
d)成为对象"
,
dataManager
.
GetName
(
pcard
->
code
),
dataManager
.
FormatLocation
(
l
),
s
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
logParam
.
push_back
(
pcard
->
code
);
mainGame
->
logParam
.
push_back
(
pcard
->
code
);
pcard
->
is_highlighting
=
false
;
pcard
->
is_highlighting
=
false
;
...
@@ -1802,8 +1782,8 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1802,8 +1782,8 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
WaitFrameSignal
(
5
);
mainGame
->
WaitFrameSignal
(
5
);
}
}
if
(
player
==
0
)
if
(
player
==
0
)
myswprintf
(
pdInfo
->
strEvent
,
L"我方抽了 %
d张卡"
,
count
);
myswprintf
(
event_string
,
L"我方抽了%
d张卡"
,
count
);
else
myswprintf
(
pdInfo
->
strEvent
,
L"对手抽了 %
d张卡"
,
count
);
else
myswprintf
(
event_string
,
L"对手抽了%
d张卡"
,
count
);
return
true
;
return
true
;
}
}
case
MSG_DAMAGE
:
{
case
MSG_DAMAGE
:
{
...
@@ -1814,9 +1794,9 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1814,9 +1794,9 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
final
=
0
;
final
=
0
;
mainGame
->
lpd
=
(
mainGame
->
dInfo
.
lp
[
player
]
-
final
)
/
10
;
mainGame
->
lpd
=
(
mainGame
->
dInfo
.
lp
[
player
]
-
final
)
/
10
;
if
(
player
==
0
)
if
(
player
==
0
)
myswprintf
(
pdInfo
->
strEvent
,
L"我方受到 %
d伤害"
,
val
);
myswprintf
(
event_string
,
L"我方受到%
d伤害"
,
val
);
else
else
myswprintf
(
pdInfo
->
strEvent
,
L"对方受到 %
d伤害"
,
val
);
myswprintf
(
event_string
,
L"对方受到%
d伤害"
,
val
);
mainGame
->
lpccolor
=
0xffff0000
;
mainGame
->
lpccolor
=
0xffff0000
;
mainGame
->
lpplayer
=
player
;
mainGame
->
lpplayer
=
player
;
myswprintf
(
textBuffer
,
L" - % d"
,
val
);
myswprintf
(
textBuffer
,
L" - % d"
,
val
);
...
@@ -1827,7 +1807,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1827,7 +1807,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
lpcstring
=
0
;
mainGame
->
lpcstring
=
0
;
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
]);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
return
true
;
return
true
;
}
}
...
@@ -1837,9 +1817,9 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1837,9 +1817,9 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
int
final
=
mainGame
->
dInfo
.
lp
[
player
]
+
val
;
int
final
=
mainGame
->
dInfo
.
lp
[
player
]
+
val
;
mainGame
->
lpd
=
(
mainGame
->
dInfo
.
lp
[
player
]
-
final
)
/
10
;
mainGame
->
lpd
=
(
mainGame
->
dInfo
.
lp
[
player
]
-
final
)
/
10
;
if
(
player
==
0
)
if
(
player
==
0
)
myswprintf
(
pdInfo
->
strEvent
,
L"我方回复 %
dLP"
,
val
);
myswprintf
(
event_string
,
L"我方回复%
dLP"
,
val
);
else
else
myswprintf
(
pdInfo
->
strEvent
,
L"对方回复 %
dLP"
,
val
);
myswprintf
(
event_string
,
L"对方回复%
dLP"
,
val
);
mainGame
->
lpccolor
=
0xff00ff00
;
mainGame
->
lpccolor
=
0xff00ff00
;
mainGame
->
lpplayer
=
player
;
mainGame
->
lpplayer
=
player
;
myswprintf
(
textBuffer
,
L" + % d"
,
val
);
myswprintf
(
textBuffer
,
L" + % d"
,
val
);
...
@@ -1884,7 +1864,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1884,7 +1864,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
WaitFrameSignal
(
10
);
mainGame
->
WaitFrameSignal
(
10
);
mainGame
->
dInfo
.
lp
[
player
]
=
val
;
mainGame
->
dInfo
.
lp
[
player
]
=
val
;
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
]);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
return
true
;
return
true
;
}
}
...
@@ -1955,7 +1935,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1955,7 +1935,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
lpd
=
(
mainGame
->
dInfo
.
lp
[
player
]
-
final
)
/
10
;
mainGame
->
lpd
=
(
mainGame
->
dInfo
.
lp
[
player
]
-
final
)
/
10
;
mainGame
->
lpccolor
=
0xff0000ff
;
mainGame
->
lpccolor
=
0xff0000ff
;
mainGame
->
lpplayer
=
player
;
mainGame
->
lpplayer
=
player
;
myswprintf
(
textBuffer
,
L" - %
d"
,
cost
);
myswprintf
(
textBuffer
,
L"-%
d"
,
cost
);
mainGame
->
lpcstring
=
textBuffer
;
mainGame
->
lpcstring
=
textBuffer
;
mainGame
->
WaitFrameSignal
(
30
);
mainGame
->
WaitFrameSignal
(
30
);
mainGame
->
lpframe
=
10
;
mainGame
->
lpframe
=
10
;
...
@@ -1963,7 +1943,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1963,7 +1943,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
lpcstring
=
0
;
mainGame
->
lpcstring
=
0
;
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
]);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
return
true
;
return
true
;
}
}
...
@@ -1977,7 +1957,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1977,7 +1957,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
if
(
pc
->
counters
.
count
(
type
))
if
(
pc
->
counters
.
count
(
type
))
pc
->
counters
[
type
]
+=
count
;
pc
->
counters
[
type
]
+=
count
;
else
pc
->
counters
[
type
]
=
count
;
else
pc
->
counters
[
type
]
=
count
;
myswprintf
(
textBuffer
,
L"[ % ls]放置了 % d个[ %
ls]"
,
dataManager
.
GetName
(
pc
->
code
),
count
,
dataManager
.
GetCounterName
(
type
));
myswprintf
(
textBuffer
,
L"[%ls]放置了%d个[%
ls]"
,
dataManager
.
GetName
(
pc
->
code
),
count
,
dataManager
.
GetCounterName
(
type
));
pc
->
is_highlighting
=
true
;
pc
->
is_highlighting
=
true
;
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
stACMessage
->
setText
(
textBuffer
);
mainGame
->
stACMessage
->
setText
(
textBuffer
);
...
@@ -1997,7 +1977,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -1997,7 +1977,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
pc
->
counters
[
type
]
-=
count
;
pc
->
counters
[
type
]
-=
count
;
if
(
pc
->
counters
[
type
]
<=
0
)
if
(
pc
->
counters
[
type
]
<=
0
)
pc
->
counters
.
erase
(
type
);
pc
->
counters
.
erase
(
type
);
myswprintf
(
textBuffer
,
L"[ % ls]移除了 % d个[ %
ls]"
,
dataManager
.
GetName
(
pc
->
code
),
count
,
dataManager
.
GetCounterName
(
type
));
myswprintf
(
textBuffer
,
L"[%ls]移除了%d个[%
ls]"
,
dataManager
.
GetName
(
pc
->
code
),
count
,
dataManager
.
GetCounterName
(
type
));
pc
->
is_highlighting
=
true
;
pc
->
is_highlighting
=
true
;
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
stACMessage
->
setText
(
textBuffer
);
mainGame
->
stACMessage
->
setText
(
textBuffer
);
...
@@ -2020,7 +2000,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -2020,7 +2000,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
float
sy
;
float
sy
;
if
(
ld
!=
0
)
{
if
(
ld
!=
0
)
{
mainGame
->
dField
.
attack_target
=
mainGame
->
dField
.
GetCard
(
cd
,
ld
,
sd
);
mainGame
->
dField
.
attack_target
=
mainGame
->
dField
.
GetCard
(
cd
,
ld
,
sd
);
myswprintf
(
pdInfo
->
strEvent
,
L"[ % ls]攻击[ %
ls]"
,
dataManager
.
GetName
(
mainGame
->
dField
.
attacker
->
code
),
myswprintf
(
event_string
,
L"[%ls]攻击[%
ls]"
,
dataManager
.
GetName
(
mainGame
->
dField
.
attacker
->
code
),
dataManager
.
GetName
(
mainGame
->
dField
.
attack_target
->
code
));
dataManager
.
GetName
(
mainGame
->
dField
.
attack_target
->
code
));
float
xa
=
mainGame
->
dField
.
attacker
->
curPos
.
X
;
float
xa
=
mainGame
->
dField
.
attacker
->
curPos
.
X
;
float
ya
=
mainGame
->
dField
.
attacker
->
curPos
.
Y
;
float
ya
=
mainGame
->
dField
.
attacker
->
curPos
.
Y
;
...
@@ -2033,7 +2013,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -2033,7 +2013,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
else
else
mainGame
->
atk_r
=
vector3df
(
0
,
0
,
3.1415926
-
atan
((
xd
-
xa
)
/
(
yd
-
ya
)));
mainGame
->
atk_r
=
vector3df
(
0
,
0
,
3.1415926
-
atan
((
xd
-
xa
)
/
(
yd
-
ya
)));
}
else
{
}
else
{
myswprintf
(
pdInfo
->
strEvent
,
L"[ %
ls]直接攻击"
,
dataManager
.
GetName
(
mainGame
->
dField
.
attacker
->
code
));
myswprintf
(
event_string
,
L"[%
ls]直接攻击"
,
dataManager
.
GetName
(
mainGame
->
dField
.
attacker
->
code
));
float
xa
=
mainGame
->
dField
.
attacker
->
curPos
.
X
;
float
xa
=
mainGame
->
dField
.
attacker
->
curPos
.
X
;
float
ya
=
mainGame
->
dField
.
attacker
->
curPos
.
Y
;
float
ya
=
mainGame
->
dField
.
attacker
->
curPos
.
Y
;
float
xd
=
3.95
f
;
float
xd
=
3.95
f
;
...
@@ -2047,7 +2027,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -2047,7 +2027,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
else
else
mainGame
->
atk_r
=
vector3df
(
0
,
0
,
3.1415926
-
atan
((
xd
-
xa
)
/
(
yd
-
ya
)));
mainGame
->
atk_r
=
vector3df
(
0
,
0
,
3.1415926
-
atan
((
xd
-
xa
)
/
(
yd
-
ya
)));
}
}
mainGame
->
matManager
.
GenArrow
(
sy
);
matManager
.
GenArrow
(
sy
);
mainGame
->
attack_sv
=
0
;
mainGame
->
attack_sv
=
0
;
mainGame
->
is_attacking
=
true
;
mainGame
->
is_attacking
=
true
;
mainGame
->
WaitFrameSignal
(
40
);
mainGame
->
WaitFrameSignal
(
40
);
...
@@ -2070,7 +2050,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -2070,7 +2050,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
return
true
;
return
true
;
}
}
case
MSG_ATTACK_DISABLED
:
{
case
MSG_ATTACK_DISABLED
:
{
myswprintf
(
pdInfo
->
strEvent
,
L"攻击被无效"
,
dataManager
.
GetName
(
mainGame
->
dField
.
attacker
->
code
));
myswprintf
(
event_string
,
L"攻击被无效"
,
dataManager
.
GetName
(
mainGame
->
dField
.
attacker
->
code
));
return
true
;
return
true
;
}
}
case
MSG_DAMAGE_STEP_START
:
{
case
MSG_DAMAGE_STEP_START
:
{
...
@@ -2082,7 +2062,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -2082,7 +2062,7 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
case
MSG_MISSED_EFFECT
:
{
case
MSG_MISSED_EFFECT
:
{
BufferIO
::
ReadInt32
(
pbuf
);
BufferIO
::
ReadInt32
(
pbuf
);
int
code
=
BufferIO
::
ReadInt32
(
pbuf
);
int
code
=
BufferIO
::
ReadInt32
(
pbuf
);
myswprintf
(
textBuffer
,
L"[ %
ls]错过时点"
,
dataManager
.
GetName
(
code
));
myswprintf
(
textBuffer
,
L"[%
ls]错过时点"
,
dataManager
.
GetName
(
code
));
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
logParam
.
push_back
(
code
);
mainGame
->
logParam
.
push_back
(
code
);
return
true
;
return
true
;
...
@@ -2133,15 +2113,15 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -2133,15 +2113,15 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
chkRace
[
i
]
->
setVisible
(
true
);
mainGame
->
chkRace
[
i
]
->
setVisible
(
true
);
else
mainGame
->
chkRace
[
i
]
->
setVisible
(
false
);
else
mainGame
->
chkRace
[
i
]
->
setVisible
(
false
);
}
}
if
(
mainGame
->
dInfo
.
selectH
int
)
if
(
select_h
int
)
myswprintf
(
textBuffer
,
L" % ls"
,
dataManager
.
GetDesc
(
mainGame
->
dInfo
.
selectH
int
));
myswprintf
(
textBuffer
,
L"%ls"
,
dataManager
.
GetDesc
(
select_h
int
));
else
myswprintf
(
textBuffer
,
L"请宣言种族"
);
else
myswprintf
(
textBuffer
,
L"请宣言种族"
);
mainGame
->
dInfo
.
selectH
int
=
0
;
select_h
int
=
0
;
mainGame
->
wANRace
->
setText
(
textBuffer
);
mainGame
->
wANRace
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wANRace
);
mainGame
->
PopupElement
(
mainGame
->
wANRace
);
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localResponse
.
Set
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
}
}
case
MSG_ANNOUNCE_ATTRIB
:
{
case
MSG_ANNOUNCE_ATTRIB
:
{
...
@@ -2154,29 +2134,29 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -2154,29 +2134,29 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
chkAttribute
[
i
]
->
setVisible
(
true
);
mainGame
->
chkAttribute
[
i
]
->
setVisible
(
true
);
else
mainGame
->
chkAttribute
[
i
]
->
setVisible
(
false
);
else
mainGame
->
chkAttribute
[
i
]
->
setVisible
(
false
);
}
}
if
(
mainGame
->
dInfo
.
selectH
int
)
if
(
select_h
int
)
myswprintf
(
textBuffer
,
L" % ls"
,
dataManager
.
GetDesc
(
mainGame
->
dInfo
.
selectH
int
));
myswprintf
(
textBuffer
,
L"%ls"
,
dataManager
.
GetDesc
(
select_h
int
));
else
myswprintf
(
textBuffer
,
L"请宣言属性"
);
else
myswprintf
(
textBuffer
,
L"请宣言属性"
);
mainGame
->
dInfo
.
selectH
int
=
0
;
select_h
int
=
0
;
mainGame
->
wANAttribute
->
setText
(
textBuffer
);
mainGame
->
wANAttribute
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wANAttribute
);
mainGame
->
PopupElement
(
mainGame
->
wANAttribute
);
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localResponse
.
Set
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
}
}
case
MSG_ANNOUNCE_CARD
:
{
case
MSG_ANNOUNCE_CARD
:
{
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
mainGame
->
ebANCard
->
setText
(
L""
);
mainGame
->
ebANCard
->
setText
(
L""
);
if
(
mainGame
->
dInfo
.
selectH
int
)
if
(
select_h
int
)
myswprintf
(
textBuffer
,
L" % ls"
,
dataManager
.
GetDesc
(
mainGame
->
dInfo
.
selectH
int
));
myswprintf
(
textBuffer
,
L"%ls"
,
dataManager
.
GetDesc
(
select_h
int
));
else
myswprintf
(
textBuffer
,
L"请宣言卡名"
);
else
myswprintf
(
textBuffer
,
L"请宣言卡名"
);
mainGame
->
dInfo
.
selectH
int
=
0
;
select_h
int
=
0
;
mainGame
->
wANCard
->
setText
(
textBuffer
);
mainGame
->
wANCard
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wANCard
);
mainGame
->
PopupElement
(
mainGame
->
wANCard
);
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localResponse
.
Set
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
}
}
case
MSG_ANNOUNCE_NUMBER
:
{
case
MSG_ANNOUNCE_NUMBER
:
{
...
@@ -2190,16 +2170,16 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -2190,16 +2170,16 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
mainGame
->
cbANNumber
->
addItem
(
textBuffer
,
value
);
mainGame
->
cbANNumber
->
addItem
(
textBuffer
,
value
);
}
}
mainGame
->
cbANNumber
->
setSelected
(
0
);
mainGame
->
cbANNumber
->
setSelected
(
0
);
if
(
mainGame
->
dInfo
.
selectH
int
)
if
(
select_h
int
)
myswprintf
(
textBuffer
,
L" % ls"
,
dataManager
.
GetDesc
(
mainGame
->
dInfo
.
selectH
int
));
myswprintf
(
textBuffer
,
L"%ls"
,
dataManager
.
GetDesc
(
select_h
int
));
else
myswprintf
(
textBuffer
,
L"请宣言数字"
);
else
myswprintf
(
textBuffer
,
L"请宣言数字"
);
mainGame
->
dInfo
.
selectH
int
=
0
;
select_h
int
=
0
;
mainGame
->
wANNumber
->
setText
(
textBuffer
);
mainGame
->
wANNumber
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wANNumber
);
mainGame
->
PopupElement
(
mainGame
->
wANNumber
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Reset
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localAction
.
Wait
();
mainGame
->
localResponse
.
Set
();
DuelClient
::
SendResponse
();
return
true
;
return
true
;
}
}
case
MSG_COUNT_TURN
:
{
case
MSG_COUNT_TURN
:
{
...
@@ -2228,12 +2208,14 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
...
@@ -2228,12 +2208,14 @@ int DuelClient::ClientAnalyze(char* msg, unsigned int len) {
}
}
void
DuelClient
::
SetResponseI
(
int
respI
)
{
void
DuelClient
::
SetResponseI
(
int
respI
)
{
*
((
int
*
)
response_buf
)
=
respI
;
*
((
int
*
)
response_buf
)
=
respI
;
is_responseB
=
false
;
response_len
=
4
;
}
}
void
DuelClient
::
SetResponseB
(
unsigned
char
*
respB
,
unsigned
char
len
)
{
void
DuelClient
::
SetResponseB
(
unsigned
char
*
respB
,
unsigned
char
len
)
{
memcpy
(
response_buf
,
respB
,
len
);
memcpy
(
response_buf
,
respB
,
len
);
is_responseB
=
true
;
response_len
=
len
;
response_len
=
len
;
}
}
void
DuelClient
::
SendResponse
()
{
SendBufferToServer
(
CTOS_RESPONSE
,
response_buf
,
response_len
);
}
}
}
gframe/duelclient.h
View file @
75889e7b
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include "network.h"
#include "network.h"
#include "data_manager.h"
#include "data_manager.h"
#include "deck_manager.h"
#include "deck_manager.h"
#include "../ocgcore/mtrandom.h"
namespace
ygo
{
namespace
ygo
{
...
@@ -17,7 +18,6 @@ class DuelClient {
...
@@ -17,7 +18,6 @@ class DuelClient {
private:
private:
static
unsigned
int
connect_state
;
static
unsigned
int
connect_state
;
static
unsigned
char
response_buf
[
64
];
static
unsigned
char
response_buf
[
64
];
static
bool
is_responseB
;
static
unsigned
char
response_len
;
static
unsigned
char
response_len
;
static
event_base
*
client_base
;
static
event_base
*
client_base
;
static
bufferevent
*
client_bev
;
static
bufferevent
*
client_bev
;
...
@@ -25,7 +25,8 @@ private:
...
@@ -25,7 +25,8 @@ private:
static
char
duel_client_write
[
0x2000
];
static
char
duel_client_write
[
0x2000
];
static
bool
is_closing
;
static
bool
is_closing
;
static
int
select_hint
;
static
int
select_hint
;
static
wchar_t
event_string
[
128
];
static
wchar_t
event_string
[
256
];
static
mtrandom
rnd
;
public:
public:
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
StopClient
(
bool
is_exiting
=
false
);
static
void
StopClient
(
bool
is_exiting
=
false
);
...
@@ -36,6 +37,7 @@ public:
...
@@ -36,6 +37,7 @@ public:
static
int
ClientAnalyze
(
char
*
msg
,
unsigned
int
len
);
static
int
ClientAnalyze
(
char
*
msg
,
unsigned
int
len
);
static
void
SetResponseI
(
int
respI
);
static
void
SetResponseI
(
int
respI
);
static
void
SetResponseB
(
unsigned
char
*
respB
,
unsigned
char
len
);
static
void
SetResponseB
(
unsigned
char
*
respB
,
unsigned
char
len
);
static
void
SendResponse
();
static
void
SendPacketToServer
(
unsigned
char
proto
)
{
static
void
SendPacketToServer
(
unsigned
char
proto
)
{
char
*
p
=
duel_client_write
;
char
*
p
=
duel_client_write
;
BufferIO
::
WriteInt16
(
p
,
1
);
BufferIO
::
WriteInt16
(
p
,
1
);
...
...
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