Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
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
fallenstardust
YGOMobile
Commits
0ea148e4
Commit
0ea148e4
authored
Dec 16, 2023
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update gframe
parent
2a964126
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
329 additions
and
311 deletions
+329
-311
Classes/gframe/client_card.cpp
Classes/gframe/client_card.cpp
+61
-49
Classes/gframe/client_card.h
Classes/gframe/client_card.h
+54
-51
Classes/gframe/client_field.cpp
Classes/gframe/client_field.cpp
+5
-24
Classes/gframe/client_field.h
Classes/gframe/client_field.h
+45
-44
Classes/gframe/deck_con.cpp
Classes/gframe/deck_con.cpp
+1
-1
Classes/gframe/duelclient.cpp
Classes/gframe/duelclient.cpp
+4
-4
Classes/gframe/replay.h
Classes/gframe/replay.h
+1
-1
Classes/gframe/replay_mode.cpp
Classes/gframe/replay_mode.cpp
+14
-14
Classes/gframe/replay_mode.h
Classes/gframe/replay_mode.h
+4
-2
Classes/gframe/single_duel.cpp
Classes/gframe/single_duel.cpp
+61
-54
Classes/gframe/single_duel.h
Classes/gframe/single_duel.h
+3
-0
Classes/gframe/single_mode.cpp
Classes/gframe/single_mode.cpp
+14
-14
Classes/gframe/single_mode.h
Classes/gframe/single_mode.h
+4
-2
Classes/gframe/tag_duel.cpp
Classes/gframe/tag_duel.cpp
+55
-51
Classes/gframe/tag_duel.h
Classes/gframe/tag_duel.h
+3
-0
No files found.
Classes/gframe/client_card.cpp
View file @
0ea148e4
...
@@ -5,50 +5,27 @@
...
@@ -5,50 +5,27 @@
namespace
ygo
{
namespace
ygo
{
ClientCard
::
ClientCard
()
{
ClientCard
::~
ClientCard
()
{
curAlpha
=
255
;
ClearTarget
();
dAlpha
=
0
;
if
(
equipTarget
)
aniFrame
=
0
;
equipTarget
->
equipped
.
erase
(
this
);
is_moving
=
false
;
for
(
auto
card
:
equipped
)
{
is_fading
=
false
;
card
->
equipTarget
=
nullptr
;
is_hovered
=
false
;
}
is_selectable
=
false
;
equipped
.
clear
();
is_selected
=
false
;
if
(
overlayTarget
)
{
is_showequip
=
false
;
for
(
auto
it
=
overlayTarget
->
overlayed
.
begin
();
it
!=
overlayTarget
->
overlayed
.
end
();
)
{
is_showtarget
=
false
;
if
(
*
it
==
this
)
{
is_showchaintarget
=
false
;
it
=
overlayTarget
->
overlayed
.
erase
(
it
);
is_highlighting
=
false
;
}
status
=
0
;
else
is_reversed
=
false
;
++
it
;
cmdFlag
=
0
;
}
code
=
0
;
}
chain_code
=
0
;
for
(
auto
card
:
overlayed
)
{
location
=
0
;
card
->
overlayTarget
=
nullptr
;
type
=
0
;
}
alias
=
0
;
overlayed
.
clear
();
level
=
0
;
rank
=
0
;
link
=
0
;
race
=
0
;
attribute
=
0
;
attack
=
0
;
defense
=
0
;
base_attack
=
0
;
base_defense
=
0
;
lscale
=
0
;
rscale
=
0
;
link_marker
=
0
;
position
=
0
;
cHint
=
0
;
chValue
=
0
;
atkstring
[
0
]
=
0
;
defstring
[
0
]
=
0
;
lvstring
[
0
]
=
0
;
linkstring
[
0
]
=
0
;
rscstring
[
0
]
=
0
;
lscstring
[
0
]
=
0
;
overlayTarget
=
0
;
equipTarget
=
0
;
}
}
void
ClientCard
::
SetCode
(
int
code
)
{
void
ClientCard
::
SetCode
(
int
code
)
{
if
((
location
==
LOCATION_HAND
)
&&
(
this
->
code
!=
(
unsigned
int
)
code
))
{
if
((
location
==
LOCATION_HAND
)
&&
(
this
->
code
!=
(
unsigned
int
)
code
))
{
...
@@ -59,8 +36,10 @@ void ClientCard::SetCode(int code) {
...
@@ -59,8 +36,10 @@ void ClientCard::SetCode(int code) {
}
}
void
ClientCard
::
UpdateInfo
(
unsigned
char
*
buf
)
{
void
ClientCard
::
UpdateInfo
(
unsigned
char
*
buf
)
{
int
flag
=
BufferIO
::
ReadInt32
(
buf
);
int
flag
=
BufferIO
::
ReadInt32
(
buf
);
if
(
flag
==
0
)
if
(
flag
==
0
)
{
ClearData
();
return
;
return
;
}
int
pdata
;
int
pdata
;
if
(
flag
&
QUERY_CODE
)
{
if
(
flag
&
QUERY_CODE
)
{
pdata
=
BufferIO
::
ReadInt32
(
buf
);
pdata
=
BufferIO
::
ReadInt32
(
buf
);
...
@@ -133,8 +112,10 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
...
@@ -133,8 +112,10 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
int
s
=
BufferIO
::
ReadInt8
(
buf
);
int
s
=
BufferIO
::
ReadInt8
(
buf
);
BufferIO
::
ReadInt8
(
buf
);
BufferIO
::
ReadInt8
(
buf
);
ClientCard
*
ecard
=
mainGame
->
dField
.
GetCard
(
mainGame
->
LocalPlayer
(
c
),
l
,
s
);
ClientCard
*
ecard
=
mainGame
->
dField
.
GetCard
(
mainGame
->
LocalPlayer
(
c
),
l
,
s
);
equipTarget
=
ecard
;
if
(
ecard
)
{
ecard
->
equipped
.
insert
(
this
);
equipTarget
=
ecard
;
ecard
->
equipped
.
insert
(
this
);
}
}
}
if
(
flag
&
QUERY_TARGET_CARD
)
{
if
(
flag
&
QUERY_TARGET_CARD
)
{
int
count
=
BufferIO
::
ReadInt32
(
buf
);
int
count
=
BufferIO
::
ReadInt32
(
buf
);
...
@@ -144,8 +125,10 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
...
@@ -144,8 +125,10 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
int
s
=
BufferIO
::
ReadInt8
(
buf
);
int
s
=
BufferIO
::
ReadInt8
(
buf
);
BufferIO
::
ReadInt8
(
buf
);
BufferIO
::
ReadInt8
(
buf
);
ClientCard
*
tcard
=
mainGame
->
dField
.
GetCard
(
mainGame
->
LocalPlayer
(
c
),
l
,
s
);
ClientCard
*
tcard
=
mainGame
->
dField
.
GetCard
(
mainGame
->
LocalPlayer
(
c
),
l
,
s
);
cardTarget
.
insert
(
tcard
);
if
(
tcard
)
{
tcard
->
ownerTarget
.
insert
(
this
);
cardTarget
.
insert
(
tcard
);
tcard
->
ownerTarget
.
insert
(
this
);
}
}
}
}
}
if
(
flag
&
QUERY_OVERLAY_CARD
)
{
if
(
flag
&
QUERY_OVERLAY_CARD
)
{
...
@@ -198,6 +181,35 @@ void ClientCard::ClearTarget() {
...
@@ -198,6 +181,35 @@ void ClientCard::ClearTarget() {
cardTarget
.
clear
();
cardTarget
.
clear
();
ownerTarget
.
clear
();
ownerTarget
.
clear
();
}
}
void
ClientCard
::
ClearData
()
{
alias
=
0
;
type
=
0
;
level
=
0
;
rank
=
0
;
race
=
0
;
attribute
=
0
;
attack
=
0
;
defense
=
0
;
base_attack
=
0
;
base_defense
=
0
;
lscale
=
0
;
rscale
=
0
;
link
=
0
;
link_marker
=
0
;
status
=
0
;
atkstring
[
0
]
=
0
;
defstring
[
0
]
=
0
;
lvstring
[
0
]
=
0
;
linkstring
[
0
]
=
0
;
rscstring
[
0
]
=
0
;
lscstring
[
0
]
=
0
;
counters
.
clear
();
for
(
auto
card
:
equipped
)
{
card
->
equipTarget
=
nullptr
;
}
equipped
.
clear
();
}
bool
ClientCard
::
client_card_sort
(
ClientCard
*
c1
,
ClientCard
*
c2
)
{
bool
ClientCard
::
client_card_sort
(
ClientCard
*
c1
,
ClientCard
*
c2
)
{
if
(
c1
->
is_selected
!=
c2
->
is_selected
)
if
(
c1
->
is_selected
!=
c2
->
is_selected
)
return
c1
->
is_selected
<
c2
->
is_selected
;
return
c1
->
is_selected
<
c2
->
is_selected
;
...
...
Classes/gframe/client_card.h
View file @
0ea148e4
...
@@ -53,67 +53,70 @@ public:
...
@@ -53,67 +53,70 @@ public:
irr
::
core
::
vector3df
curRot
;
irr
::
core
::
vector3df
curRot
;
irr
::
core
::
vector3df
dPos
;
irr
::
core
::
vector3df
dPos
;
irr
::
core
::
vector3df
dRot
;
irr
::
core
::
vector3df
dRot
;
u32
curAlpha
;
u32
curAlpha
{
255
};
u32
dAlpha
;
u32
dAlpha
{
0
};
u32
aniFrame
;
u32
aniFrame
{
0
};
bool
is_moving
;
bool
is_moving
{
false
};
bool
is_fading
;
bool
is_fading
{
false
};
bool
is_hovered
;
bool
is_hovered
{
false
};
bool
is_selectable
;
bool
is_selectable
{
false
};
bool
is_selected
;
bool
is_selected
{
false
};
bool
is_showequip
;
bool
is_showequip
{
false
};
bool
is_showtarget
;
bool
is_showtarget
{
false
};
bool
is_showchaintarget
;
bool
is_showchaintarget
{
false
};
bool
is_highlighting
;
bool
is_highlighting
{
false
};
bool
is_reversed
;
bool
is_reversed
{
false
};
u32
code
;
u32
chain_code
;
unsigned
int
code
{
0
};
u32
alias
;
unsigned
int
chain_code
{
0
};
u32
type
;
unsigned
int
alias
{
0
};
u32
level
;
unsigned
int
type
{
0
};
u32
rank
;
unsigned
int
level
{
0
};
u32
link
;
unsigned
int
rank
{
0
};
u32
attribute
;
unsigned
int
link
{
0
};
u32
race
;
unsigned
int
attribute
{
0
};
s32
attack
;
unsigned
int
race
{
0
};
s32
defense
;
int
attack
{
0
};
s32
base_attack
;
int
defense
{
0
};
s32
base_defense
;
int
base_attack
{
0
};
u32
lscale
;
int
base_defense
{
0
};
u32
rscale
;
unsigned
int
lscale
{
0
};
u32
link_marker
;
unsigned
int
rscale
{
0
};
u32
reason
;
unsigned
int
link_marker
{
0
};
u32
select_seq
;
unsigned
int
reason
{
0
};
u8
owner
;
unsigned
int
select_seq
{
0
};
u8
controler
;
unsigned
char
owner
{
PLAYER_NONE
};
u8
location
;
unsigned
char
controler
{
PLAYER_NONE
};
u8
sequence
;
unsigned
char
location
{
0
};
u8
position
;
unsigned
char
sequence
{
0
};
u32
status
;
unsigned
char
position
{
0
};
u8
cHint
;
unsigned
int
status
{
0
};
u32
chValue
;
unsigned
char
cHint
{
0
};
u32
opParam
;
unsigned
int
chValue
{
0
};
u32
symbol
;
unsigned
int
opParam
{
0
};
u32
cmdFlag
;
unsigned
int
symbol
{
0
};
ClientCard
*
overlayTarget
;
unsigned
int
cmdFlag
{
0
};
ClientCard
*
overlayTarget
{
nullptr
};
std
::
vector
<
ClientCard
*>
overlayed
;
std
::
vector
<
ClientCard
*>
overlayed
;
ClientCard
*
equipTarget
;
ClientCard
*
equipTarget
{
nullptr
}
;
std
::
set
<
ClientCard
*>
equipped
;
std
::
set
<
ClientCard
*>
equipped
;
std
::
set
<
ClientCard
*>
cardTarget
;
std
::
set
<
ClientCard
*>
cardTarget
;
std
::
set
<
ClientCard
*>
ownerTarget
;
std
::
set
<
ClientCard
*>
ownerTarget
;
std
::
map
<
int
,
int
>
counters
;
std
::
map
<
int
,
int
>
counters
;
std
::
map
<
int
,
int
>
desc_hints
;
std
::
map
<
int
,
int
>
desc_hints
;
wchar_t
atkstring
[
16
];
wchar_t
atkstring
[
16
]
{
0
}
;
wchar_t
defstring
[
16
];
wchar_t
defstring
[
16
]
{
0
}
;
wchar_t
lvstring
[
16
];
wchar_t
lvstring
[
16
]
{
0
}
;
wchar_t
linkstring
[
16
];
wchar_t
linkstring
[
16
]
{
0
}
;
wchar_t
lscstring
[
16
];
wchar_t
lscstring
[
16
]
{
0
}
;
wchar_t
rscstring
[
16
];
wchar_t
rscstring
[
16
]
{
0
}
;
ClientCard
();
ClientCard
()
=
default
;
~
ClientCard
();
void
SetCode
(
int
code
);
void
SetCode
(
int
code
);
void
UpdateInfo
(
unsigned
char
*
buf
);
void
UpdateInfo
(
unsigned
char
*
buf
);
void
ClearTarget
();
void
ClearTarget
();
void
ClearData
();
static
bool
client_card_sort
(
ClientCard
*
c1
,
ClientCard
*
c2
);
static
bool
client_card_sort
(
ClientCard
*
c1
,
ClientCard
*
c2
);
static
bool
deck_sort_lv
(
code_pointer
l1
,
code_pointer
l2
);
static
bool
deck_sort_lv
(
code_pointer
l1
,
code_pointer
l2
);
static
bool
deck_sort_atk
(
code_pointer
l1
,
code_pointer
l2
);
static
bool
deck_sort_atk
(
code_pointer
l1
,
code_pointer
l2
);
...
...
Classes/gframe/client_field.cpp
View file @
0ea148e4
...
@@ -11,7 +11,6 @@
...
@@ -11,7 +11,6 @@
namespace
ygo
{
namespace
ygo
{
ClientField
::
ClientField
()
{
ClientField
::
ClientField
()
{
panel
=
0
;
//drag cardtext and lists
//drag cardtext and lists
is_dragging_cardtext
=
false
;
is_dragging_cardtext
=
false
;
is_dragging_lstLog
=
false
;
is_dragging_lstLog
=
false
;
...
@@ -24,25 +23,6 @@ ClientField::ClientField() {
...
@@ -24,25 +23,6 @@ ClientField::ClientField() {
dragging_tab_start_pos
=
0
;
dragging_tab_start_pos
=
0
;
dragging_tab_start_y
=
0
;
dragging_tab_start_y
=
0
;
hovered_card
=
0
;
clicked_card
=
0
;
highlighting_card
=
0
;
menu_card
=
0
;
hovered_controler
=
0
;
hovered_location
=
0
;
hovered_sequence
=
0
;
selectable_field
=
0
;
selected_field
=
0
;
deck_act
=
false
;
grave_act
=
false
;
remove_act
=
false
;
extra_act
=
false
;
pzone_act
[
0
]
=
false
;
pzone_act
[
1
]
=
false
;
conti_act
=
false
;
deck_reversed
=
false
;
conti_selecting
=
false
;
cant_check_grave
=
false
;
for
(
int
p
=
0
;
p
<
2
;
++
p
)
{
for
(
int
p
=
0
;
p
<
2
;
++
p
)
{
mzone
[
p
].
resize
(
7
,
0
);
mzone
[
p
].
resize
(
7
,
0
);
szone
[
p
].
resize
(
8
,
0
);
szone
[
p
].
resize
(
8
,
0
);
...
@@ -320,8 +300,9 @@ ClientCard* ClientField::RemoveCard(int controler, int location, int sequence) {
...
@@ -320,8 +300,9 @@ ClientCard* ClientField::RemoveCard(int controler, int location, int sequence) {
}
}
void
ClientField
::
UpdateCard
(
int
controler
,
int
location
,
int
sequence
,
unsigned
char
*
data
)
{
void
ClientField
::
UpdateCard
(
int
controler
,
int
location
,
int
sequence
,
unsigned
char
*
data
)
{
ClientCard
*
pcard
=
GetCard
(
controler
,
location
,
sequence
);
ClientCard
*
pcard
=
GetCard
(
controler
,
location
,
sequence
);
if
(
pcard
)
int
len
=
BufferIO
::
ReadInt32
(
data
);
pcard
->
UpdateInfo
(
data
+
4
);
if
(
pcard
&&
len
>
LEN_HEADER
)
pcard
->
UpdateInfo
(
data
);
RefreshCardCountDisplay
();
RefreshCardCountDisplay
();
}
}
void
ClientField
::
UpdateFieldCard
(
int
controler
,
int
location
,
unsigned
char
*
data
)
{
void
ClientField
::
UpdateFieldCard
(
int
controler
,
int
location
,
unsigned
char
*
data
)
{
...
@@ -354,7 +335,7 @@ void ClientField::UpdateFieldCard(int controler, int location, unsigned char* da
...
@@ -354,7 +335,7 @@ void ClientField::UpdateFieldCard(int controler, int location, unsigned char* da
int
len
;
int
len
;
for
(
auto
cit
=
lst
->
begin
();
cit
!=
lst
->
end
();
++
cit
)
{
for
(
auto
cit
=
lst
->
begin
();
cit
!=
lst
->
end
();
++
cit
)
{
len
=
BufferIO
::
ReadInt32
(
data
);
len
=
BufferIO
::
ReadInt32
(
data
);
if
(
len
>
8
)
if
(
len
>
LEN_HEADER
)
(
*
cit
)
->
UpdateInfo
(
data
);
(
*
cit
)
->
UpdateInfo
(
data
);
data
+=
len
-
4
;
data
+=
len
-
4
;
}
}
...
@@ -447,7 +428,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
...
@@ -447,7 +428,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
else
if
(
conti_selecting
)
else
if
(
conti_selecting
)
mainGame
->
imageLoading
.
insert
(
std
::
make_pair
(
mainGame
->
btnCardSelect
[
i
],
selectable_cards
[
i
]
->
chain_code
));
mainGame
->
imageLoading
.
insert
(
std
::
make_pair
(
mainGame
->
btnCardSelect
[
i
],
selectable_cards
[
i
]
->
chain_code
));
else
else
mainGame
->
btnCardSelect
[
i
]
->
setImage
(
imageManager
.
tCover
[
selectable_cards
[
i
]
->
controler
]);
mainGame
->
btnCardSelect
[
i
]
->
setImage
(
imageManager
.
tCover
[
selectable_cards
[
i
]
->
controler
+
2
]);
mainGame
->
btnCardSelect
[
i
]
->
setRelativePosition
(
rect
<
s32
>
((
startpos
+
i
*
125
)
*
mainGame
->
xScale
,
65
*
mainGame
->
yScale
,
(
startpos
+
120
+
i
*
125
)
*
mainGame
->
xScale
,
235
*
mainGame
->
yScale
));
mainGame
->
btnCardSelect
[
i
]
->
setRelativePosition
(
rect
<
s32
>
((
startpos
+
i
*
125
)
*
mainGame
->
xScale
,
65
*
mainGame
->
yScale
,
(
startpos
+
120
+
i
*
125
)
*
mainGame
->
xScale
,
235
*
mainGame
->
yScale
));
mainGame
->
btnCardSelect
[
i
]
->
setPressed
(
false
);
mainGame
->
btnCardSelect
[
i
]
->
setPressed
(
false
);
mainGame
->
btnCardSelect
[
i
]
->
setVisible
(
true
);
mainGame
->
btnCardSelect
[
i
]
->
setVisible
(
true
);
...
...
Classes/gframe/client_field.h
View file @
0ea148e4
...
@@ -37,6 +37,7 @@ public:
...
@@ -37,6 +37,7 @@ public:
std
::
vector
<
ClientCard
*>
remove
[
2
];
std
::
vector
<
ClientCard
*>
remove
[
2
];
std
::
vector
<
ClientCard
*>
extra
[
2
];
std
::
vector
<
ClientCard
*>
extra
[
2
];
std
::
set
<
ClientCard
*>
overlay_cards
;
std
::
set
<
ClientCard
*>
overlay_cards
;
std
::
vector
<
ClientCard
*>
summonable_cards
;
std
::
vector
<
ClientCard
*>
summonable_cards
;
std
::
vector
<
ClientCard
*>
spsummonable_cards
;
std
::
vector
<
ClientCard
*>
spsummonable_cards
;
std
::
vector
<
ClientCard
*>
msetable_cards
;
std
::
vector
<
ClientCard
*>
msetable_cards
;
...
@@ -49,25 +50,25 @@ public:
...
@@ -49,25 +50,25 @@ public:
std
::
vector
<
int
>
select_options
;
std
::
vector
<
int
>
select_options
;
std
::
vector
<
int
>
select_options_index
;
std
::
vector
<
int
>
select_options_index
;
std
::
vector
<
ChainInfo
>
chains
;
std
::
vector
<
ChainInfo
>
chains
;
int
extra_p_count
[
2
];
int
extra_p_count
[
2
]
{
0
}
;
size_t
selected_option
;
size_t
selected_option
{
0
}
;
ClientCard
*
attacker
;
ClientCard
*
attacker
{
nullptr
}
;
ClientCard
*
attack_target
;
ClientCard
*
attack_target
{
nullptr
}
;
unsigned
int
disabled_field
;
unsigned
int
disabled_field
{
0
}
;
unsigned
int
selectable_field
;
unsigned
int
selectable_field
{
0
}
;
unsigned
int
selected_field
;
unsigned
int
selected_field
{
0
}
;
int
select_min
;
int
select_min
{
0
}
;
int
select_max
;
int
select_max
{
0
}
;
int
must_select_count
;
int
must_select_count
{
0
}
;
int
select_sumval
;
int
select_sumval
{
0
}
;
int
select_mode
;
int
select_mode
{
0
}
;
bool
select_cancelable
;
bool
select_cancelable
{
false
}
;
bool
select_panalmode
;
bool
select_panalmode
{
false
}
;
bool
select_ready
;
bool
select_ready
{
false
}
;
int
announce_count
;
int
announce_count
{
0
}
;
int
select_counter_count
;
int
select_counter_count
{
0
}
;
int
select_counter_type
;
int
select_counter_type
{
0
}
;
std
::
vector
<
ClientCard
*>
selectable_cards
;
std
::
vector
<
ClientCard
*>
selectable_cards
;
std
::
vector
<
ClientCard
*>
selected_cards
;
std
::
vector
<
ClientCard
*>
selected_cards
;
std
::
set
<
ClientCard
*>
selectsum_cards
;
std
::
set
<
ClientCard
*>
selectsum_cards
;
...
@@ -76,18 +77,18 @@ public:
...
@@ -76,18 +77,18 @@ public:
std
::
vector
<
ClientCard
*>
display_cards
;
std
::
vector
<
ClientCard
*>
display_cards
;
std
::
vector
<
int
>
sort_list
;
std
::
vector
<
int
>
sort_list
;
std
::
map
<
int
,
int
>
player_desc_hints
[
2
];
std
::
map
<
int
,
int
>
player_desc_hints
[
2
];
bool
grave_act
;
bool
grave_act
{
false
}
;
bool
remove_act
;
bool
remove_act
{
false
}
;
bool
deck_act
;
bool
deck_act
{
false
}
;
bool
extra_act
;
bool
extra_act
{
false
}
;
bool
pzone_act
[
2
];
bool
pzone_act
[
2
]
{
false
}
;
bool
conti_act
;
bool
conti_act
{
false
}
;
bool
chain_forced
;
bool
chain_forced
{
false
}
;
ChainInfo
current_chain
;
ChainInfo
current_chain
;
bool
last_chain
;
bool
last_chain
{
false
}
;
bool
deck_reversed
;
bool
deck_reversed
{
false
}
;
bool
conti_selecting
;
bool
conti_selecting
{
false
}
;
bool
cant_check_grave
;
bool
cant_check_grave
{
false
}
;
mt19937
rnd
;
mt19937
rnd
;
ClientField
();
ClientField
();
...
@@ -126,7 +127,7 @@ public:
...
@@ -126,7 +127,7 @@ public:
void
UpdateDeclarableList
();
void
UpdateDeclarableList
();
void
RefreshCardCountDisplay
();
void
RefreshCardCountDisplay
();
irr
::
gui
::
IGUIElement
*
panel
;
irr
::
gui
::
IGUIElement
*
panel
{
nullptr
}
;
bool
is_dragging_cardtext
;
bool
is_dragging_cardtext
;
bool
is_dragging_lstLog
;
bool
is_dragging_lstLog
;
bool
is_dragging_lstReplayList
;
bool
is_dragging_lstReplayList
;
...
@@ -137,20 +138,20 @@ public:
...
@@ -137,20 +138,20 @@ public:
bool
is_selectable
;
bool
is_selectable
;
int
dragging_tab_start_pos
;
int
dragging_tab_start_pos
;
int
dragging_tab_start_y
;
int
dragging_tab_start_y
;
std
::
vector
<
int
>
ancard
;
std
::
vector
<
int
>
ancard
;
int
hovered_controler
;
int
hovered_controler
{
0
}
;
int
hovered_location
;
int
hovered_location
{
0
}
;
size_t
hovered_sequence
;
size_t
hovered_sequence
{
0
}
;
int
command_controler
;
int
command_controler
{
0
}
;
int
command_location
;
int
command_location
{
0
}
;
size_t
command_sequence
;
size_t
command_sequence
{
0
}
;
ClientCard
*
hovered_card
;
ClientCard
*
hovered_card
{
nullptr
}
;
int
hovered_player
;
int
hovered_player
{
0
}
;
ClientCard
*
clicked_card
;
ClientCard
*
clicked_card
{
nullptr
}
;
ClientCard
*
command_card
;
ClientCard
*
command_card
{
nullptr
}
;
ClientCard
*
highlighting_card
;
ClientCard
*
highlighting_card
{
nullptr
}
;
ClientCard
*
menu_card
;
ClientCard
*
menu_card
{
nullptr
}
;
int
list_command
;
int
list_command
{
0
}
;
virtual
bool
OnEvent
(
const
irr
::
SEvent
&
event
);
virtual
bool
OnEvent
(
const
irr
::
SEvent
&
event
);
virtual
bool
OnCommonEvent
(
const
irr
::
SEvent
&
event
);
virtual
bool
OnCommonEvent
(
const
irr
::
SEvent
&
event
);
...
...
Classes/gframe/deck_con.cpp
View file @
0ea148e4
...
@@ -120,7 +120,7 @@ void DeckBuilder::Terminate() {
...
@@ -120,7 +120,7 @@ void DeckBuilder::Terminate() {
mainGame
->
ClearTextures
();
mainGame
->
ClearTextures
();
mainGame
->
scrFilter
->
setVisible
(
false
);
mainGame
->
scrFilter
->
setVisible
(
false
);
mainGame
->
scrPackCards
->
setVisible
(
false
);
mainGame
->
scrPackCards
->
setVisible
(
false
);
mainGame
->
scrPackCards
->
setPos
(
0
);
mainGame
->
scrPackCards
->
setPos
(
0
);
int
catesel
=
mainGame
->
cbDBCategory
->
getSelected
();
int
catesel
=
mainGame
->
cbDBCategory
->
getSelected
();
char
linebuf
[
256
];
char
linebuf
[
256
];
if
(
catesel
>=
0
)
if
(
catesel
>=
0
)
...
...
Classes/gframe/duelclient.cpp
View file @
0ea148e4
...
@@ -2543,7 +2543,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2543,7 +2543,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
}
int
appear
=
mainGame
->
gameConf
.
quick_animation
?
12
:
20
;
int
appear
=
mainGame
->
gameConf
.
quick_animation
?
12
:
20
;
if
(
pl
==
0
)
{
if
(
pl
==
0
)
{
ClientCard
*
pcard
=
new
ClientCard
()
;
ClientCard
*
pcard
=
new
ClientCard
;
pcard
->
position
=
cp
;
pcard
->
position
=
cp
;
pcard
->
SetCode
(
code
);
pcard
->
SetCode
(
code
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
...
@@ -3836,7 +3836,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -3836,7 +3836,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
}
}
else
{
}
else
{
while
(
mainGame
->
dField
.
deck
[
player
].
size
()
<
mcount
)
{
while
(
mainGame
->
dField
.
deck
[
player
].
size
()
<
mcount
)
{
ClientCard
*
ccard
=
new
ClientCard
()
;
ClientCard
*
ccard
=
new
ClientCard
;
ccard
->
controler
=
player
;
ccard
->
controler
=
player
;
ccard
->
location
=
LOCATION_DECK
;
ccard
->
location
=
LOCATION_DECK
;
ccard
->
sequence
=
mainGame
->
dField
.
deck
[
player
].
size
();
ccard
->
sequence
=
mainGame
->
dField
.
deck
[
player
].
size
();
...
@@ -3851,7 +3851,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -3851,7 +3851,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
}
}
else
{
}
else
{
while
(
mainGame
->
dField
.
hand
[
player
].
size
()
<
hcount
)
{
while
(
mainGame
->
dField
.
hand
[
player
].
size
()
<
hcount
)
{
ClientCard
*
ccard
=
new
ClientCard
()
;
ClientCard
*
ccard
=
new
ClientCard
;
ccard
->
controler
=
player
;
ccard
->
controler
=
player
;
ccard
->
location
=
LOCATION_HAND
;
ccard
->
location
=
LOCATION_HAND
;
ccard
->
sequence
=
mainGame
->
dField
.
hand
[
player
].
size
();
ccard
->
sequence
=
mainGame
->
dField
.
hand
[
player
].
size
();
...
@@ -3866,7 +3866,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -3866,7 +3866,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
}
}
else
{
}
else
{
while
(
mainGame
->
dField
.
extra
[
player
].
size
()
<
ecount
)
{
while
(
mainGame
->
dField
.
extra
[
player
].
size
()
<
ecount
)
{
ClientCard
*
ccard
=
new
ClientCard
()
;
ClientCard
*
ccard
=
new
ClientCard
;
ccard
->
controler
=
player
;
ccard
->
controler
=
player
;
ccard
->
location
=
LOCATION_EXTRA
;
ccard
->
location
=
LOCATION_EXTRA
;
ccard
->
sequence
=
mainGame
->
dField
.
extra
[
player
].
size
();
ccard
->
sequence
=
mainGame
->
dField
.
extra
[
player
].
size
();
...
...
Classes/gframe/replay.h
View file @
0ea148e4
...
@@ -53,7 +53,7 @@ public:
...
@@ -53,7 +53,7 @@ public:
static
bool
RenameReplay
(
const
wchar_t
*
oldname
,
const
wchar_t
*
newname
);
static
bool
RenameReplay
(
const
wchar_t
*
oldname
,
const
wchar_t
*
newname
);
bool
ReadNextResponse
(
unsigned
char
resp
[
64
]);
bool
ReadNextResponse
(
unsigned
char
resp
[
64
]);
void
ReadName
(
wchar_t
*
data
);
void
ReadName
(
wchar_t
*
data
);
void
ReadHeader
(
ReplayHeader
&
header
);
//
void ReadHeader(ReplayHeader& header);
void
ReadData
(
void
*
data
,
int
length
);
void
ReadData
(
void
*
data
,
int
length
);
int
ReadInt32
();
int
ReadInt32
();
short
ReadInt16
();
short
ReadInt16
();
...
...
Classes/gframe/replay_mode.cpp
View file @
0ea148e4
...
@@ -873,15 +873,10 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
...
@@ -873,15 +873,10 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
}
}
return
true
;
return
true
;
}
}
void
ReplayMode
::
ReloadLocation
(
int
player
,
int
location
,
int
flag
,
std
::
vector
<
unsigned
char
>&
queryBuffer
)
{
inline
void
ReplayMode
::
ReloadLocation
(
int
player
,
int
location
,
int
flag
,
std
::
vector
<
unsigned
char
>&
queryBuffer
)
{
query_field_card
(
pduel
,
player
,
location
,
flag
,
queryBuffer
.
data
(),
0
);
query_field_card
(
pduel
,
player
,
location
,
flag
,
queryBuffer
.
data
(),
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
player
),
location
,
queryBuffer
.
data
());
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
player
),
location
,
queryBuffer
.
data
());
}
}
void
ReplayMode
::
RefreshLocation
(
int
player
,
int
location
,
int
flag
)
{
std
::
vector
<
unsigned
char
>
queryBuffer
;
queryBuffer
.
resize
(
SIZE_QUERY_BUFFER
);
ReloadLocation
(
player
,
location
,
flag
,
queryBuffer
);
}
void
ReplayMode
::
ReplayRefresh
(
int
flag
)
{
void
ReplayMode
::
ReplayRefresh
(
int
flag
)
{
std
::
vector
<
byte
>
queryBuffer
;
std
::
vector
<
byte
>
queryBuffer
;
queryBuffer
.
resize
(
SIZE_QUERY_BUFFER
);
queryBuffer
.
resize
(
SIZE_QUERY_BUFFER
);
...
@@ -892,17 +887,22 @@ void ReplayMode::ReplayRefresh(int flag) {
...
@@ -892,17 +887,22 @@ void ReplayMode::ReplayRefresh(int flag) {
ReloadLocation
(
0
,
LOCATION_HAND
,
flag
,
queryBuffer
);
ReloadLocation
(
0
,
LOCATION_HAND
,
flag
,
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_HAND
,
flag
,
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_HAND
,
flag
,
queryBuffer
);
}
}
void
ReplayMode
::
ReplayRefreshHand
(
int
player
,
int
flag
)
{
void
ReplayMode
::
ReplayRefreshLocation
(
int
player
,
int
location
,
int
flag
)
{
RefreshLocation
(
player
,
LOCATION_HAND
,
flag
);
std
::
vector
<
unsigned
char
>
queryBuffer
;
queryBuffer
.
resize
(
SIZE_QUERY_BUFFER
);
ReloadLocation
(
player
,
location
,
flag
,
queryBuffer
);
}
inline
void
ReplayMode
::
ReplayRefreshHand
(
int
player
,
int
flag
)
{
ReplayRefreshLocation
(
player
,
LOCATION_HAND
,
flag
);
}
}
void
ReplayMode
::
ReplayRefreshGrave
(
int
player
,
int
flag
)
{
inline
void
ReplayMode
::
ReplayRefreshGrave
(
int
player
,
int
flag
)
{
RefreshLocation
(
player
,
LOCATION_GRAVE
,
flag
);
Re
playRe
freshLocation
(
player
,
LOCATION_GRAVE
,
flag
);
}
}
void
ReplayMode
::
ReplayRefreshDeck
(
int
player
,
int
flag
)
{
inline
void
ReplayMode
::
ReplayRefreshDeck
(
int
player
,
int
flag
)
{
RefreshLocation
(
player
,
LOCATION_DECK
,
flag
);
Re
playRe
freshLocation
(
player
,
LOCATION_DECK
,
flag
);
}
}
void
ReplayMode
::
ReplayRefreshExtra
(
int
player
,
int
flag
)
{
inline
void
ReplayMode
::
ReplayRefreshExtra
(
int
player
,
int
flag
)
{
RefreshLocation
(
player
,
LOCATION_EXTRA
,
flag
);
Re
playRe
freshLocation
(
player
,
LOCATION_EXTRA
,
flag
);
}
}
void
ReplayMode
::
ReplayRefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
)
{
void
ReplayMode
::
ReplayRefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
)
{
unsigned
char
queryBuffer
[
0x1000
];
unsigned
char
queryBuffer
[
0x1000
];
...
...
Classes/gframe/replay_mode.h
View file @
0ea148e4
#ifndef REPLAY_MODE_H
#ifndef REPLAY_MODE_H
#define REPLAY_MODE_H
#define REPLAY_MODE_H
#include <stdint.h>
#include <vector>
#include "config.h"
#include "config.h"
#include "data_manager.h"
#include "data_manager.h"
#include "deck_manager.h"
#include "deck_manager.h"
...
@@ -22,6 +24,7 @@ private:
...
@@ -22,6 +24,7 @@ private:
static
int
skip_turn
;
static
int
skip_turn
;
static
int
current_step
;
static
int
current_step
;
static
int
skip_step
;
static
int
skip_step
;
static
void
ReloadLocation
(
int
player
,
int
location
,
int
flag
,
std
::
vector
<
unsigned
char
>&
queryBuffer
);
public:
public:
static
Replay
cur_replay
;
static
Replay
cur_replay
;
...
@@ -39,9 +42,8 @@ public:
...
@@ -39,9 +42,8 @@ public:
static
void
Undo
();
static
void
Undo
();
static
bool
ReplayAnalyze
(
unsigned
char
*
msg
,
unsigned
int
len
);
static
bool
ReplayAnalyze
(
unsigned
char
*
msg
,
unsigned
int
len
);
inline
static
void
ReloadLocation
(
int
player
,
int
location
,
int
flag
,
std
::
vector
<
unsigned
char
>&
queryBuffer
);
inline
static
void
RefreshLocation
(
int
player
,
int
location
,
int
flag
);
static
void
ReplayRefresh
(
int
flag
=
0xf81fff
);
static
void
ReplayRefresh
(
int
flag
=
0xf81fff
);
static
void
ReplayRefreshLocation
(
int
player
,
int
location
,
int
flag
);
static
void
ReplayRefreshHand
(
int
player
,
int
flag
=
0x781fff
);
static
void
ReplayRefreshHand
(
int
player
,
int
flag
=
0x781fff
);
static
void
ReplayRefreshGrave
(
int
player
,
int
flag
=
0x181fff
);
static
void
ReplayRefreshGrave
(
int
player
,
int
flag
=
0x181fff
);
static
void
ReplayRefreshDeck
(
int
player
,
int
flag
=
0x181fff
);
static
void
ReplayRefreshDeck
(
int
player
,
int
flag
=
0x181fff
);
...
...
Classes/gframe/single_duel.cpp
View file @
0ea148e4
...
@@ -579,6 +579,7 @@ void SingleDuel::Surrender(DuelPlayer* dp) {
...
@@ -579,6 +579,7 @@ void SingleDuel::Surrender(DuelPlayer* dp) {
DuelEndProc
();
DuelEndProc
();
event_del
(
etimer
);
event_del
(
etimer
);
}
}
// Analyze ocgcore message
int
SingleDuel
::
Analyze
(
unsigned
char
*
msgbuffer
,
unsigned
int
len
)
{
int
SingleDuel
::
Analyze
(
unsigned
char
*
msgbuffer
,
unsigned
int
len
)
{
unsigned
char
*
offset
,
*
pbufw
,
*
pbuf
=
msgbuffer
;
unsigned
char
*
offset
,
*
pbufw
,
*
pbuf
=
msgbuffer
;
int
player
,
count
,
type
;
int
player
,
count
,
type
;
...
@@ -1463,108 +1464,114 @@ void SingleDuel::TimeConfirm(DuelPlayer* dp) {
...
@@ -1463,108 +1464,114 @@ void SingleDuel::TimeConfirm(DuelPlayer* dp) {
if
(
time_elapsed
<
10
)
if
(
time_elapsed
<
10
)
time_elapsed
=
0
;
time_elapsed
=
0
;
}
}
void
SingleDuel
::
RefreshMzone
(
int
player
,
int
flag
,
int
use_cache
)
{
inline
int
SingleDuel
::
WriteUpdateData
(
int
&
player
,
int
location
,
int
&
flag
,
unsigned
char
*&
qbuf
,
int
&
use_cache
)
{
unsigned
char
query_buffer
[
0x2000
];
flag
|=
(
QUERY_CODE
|
QUERY_POSITION
);
auto
qbuf
=
query_buffer
;
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
BufferIO
::
WriteInt8
(
qbuf
,
player
);
BufferIO
::
WriteInt8
(
qbuf
,
player
);
BufferIO
::
WriteInt8
(
qbuf
,
LOCATION_MZONE
);
BufferIO
::
WriteInt8
(
qbuf
,
location
);
int
len
=
query_field_card
(
pduel
,
player
,
LOCATION_MZONE
,
flag
,
(
unsigned
char
*
)
qbuf
,
use_cache
);
int
len
=
query_field_card
(
pduel
,
player
,
location
,
flag
,
qbuf
,
use_cache
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
return
len
;
}
inline
unsigned
int
GetPosition
(
unsigned
char
*&
qbuf
,
int
offset
)
{
unsigned
int
info
=
*
(
unsigned
int
*
)(
qbuf
+
offset
);
return
info
>>
24
;
}
void
SingleDuel
::
RefreshMzone
(
int
player
,
int
flag
,
int
use_cache
)
{
std
::
vector
<
unsigned
char
>
query_buffer
;
query_buffer
.
resize
(
SIZE_QUERY_BUFFER
);
auto
qbuf
=
query_buffer
.
data
();
auto
len
=
WriteUpdateData
(
player
,
LOCATION_MZONE
,
flag
,
qbuf
,
use_cache
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
.
data
(),
len
+
3
);
int
qlen
=
0
;
int
qlen
=
0
;
while
(
qlen
<
len
)
{
while
(
qlen
<
len
)
{
int
clen
=
BufferIO
::
ReadInt32
(
qbuf
);
const
int
clen
=
BufferIO
::
ReadInt32
(
qbuf
);
qlen
+=
clen
;
qlen
+=
clen
;
if
(
clen
==
4
)
if
(
clen
<=
LEN_HEADER
)
continue
;
continue
;
if
(
qbuf
[
11
]
&
POS_FACEDOWN
)
auto
position
=
GetPosition
(
qbuf
,
8
);
if
(
position
&
POS_FACEDOWN
)
memset
(
qbuf
,
0
,
clen
-
4
);
memset
(
qbuf
,
0
,
clen
-
4
);
qbuf
+=
clen
-
4
;
qbuf
+=
clen
-
4
;
}
}
NetServer
::
SendBufferToPlayer
(
players
[
1
-
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
NetServer
::
SendBufferToPlayer
(
players
[
1
-
player
],
STOC_GAME_MSG
,
query_buffer
.
data
()
,
len
+
3
);
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
NetServer
::
ReSendToPlayer
(
*
pit
);
NetServer
::
ReSendToPlayer
(
*
pit
);
}
}
void
SingleDuel
::
RefreshSzone
(
int
player
,
int
flag
,
int
use_cache
)
{
void
SingleDuel
::
RefreshSzone
(
int
player
,
int
flag
,
int
use_cache
)
{
unsigned
char
query_buffer
[
0x2000
];
std
::
vector
<
unsigned
char
>
query_buffer
;
auto
qbuf
=
query_buffer
;
query_buffer
.
resize
(
SIZE_QUERY_BUFFER
);
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
auto
qbuf
=
query_buffer
.
data
();
BufferIO
::
WriteInt8
(
qbuf
,
player
);
auto
len
=
WriteUpdateData
(
player
,
LOCATION_SZONE
,
flag
,
qbuf
,
use_cache
);
BufferIO
::
WriteInt8
(
qbuf
,
LOCATION_SZONE
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
.
data
(),
len
+
3
);
int
len
=
query_field_card
(
pduel
,
player
,
LOCATION_SZONE
,
flag
,
qbuf
,
use_cache
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
int
qlen
=
0
;
int
qlen
=
0
;
while
(
qlen
<
len
)
{
while
(
qlen
<
len
)
{
int
clen
=
BufferIO
::
ReadInt32
(
qbuf
);
const
int
clen
=
BufferIO
::
ReadInt32
(
qbuf
);
qlen
+=
clen
;
qlen
+=
clen
;
if
(
clen
==
4
)
if
(
clen
<=
LEN_HEADER
)
continue
;
continue
;
if
(
qbuf
[
11
]
&
POS_FACEDOWN
)
auto
position
=
GetPosition
(
qbuf
,
8
);
if
(
position
&
POS_FACEDOWN
)
memset
(
qbuf
,
0
,
clen
-
4
);
memset
(
qbuf
,
0
,
clen
-
4
);
qbuf
+=
clen
-
4
;
qbuf
+=
clen
-
4
;
}
}
NetServer
::
SendBufferToPlayer
(
players
[
1
-
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
NetServer
::
SendBufferToPlayer
(
players
[
1
-
player
],
STOC_GAME_MSG
,
query_buffer
.
data
()
,
len
+
3
);
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
NetServer
::
ReSendToPlayer
(
*
pit
);
NetServer
::
ReSendToPlayer
(
*
pit
);
}
}
void
SingleDuel
::
RefreshHand
(
int
player
,
int
flag
,
int
use_cache
)
{
void
SingleDuel
::
RefreshHand
(
int
player
,
int
flag
,
int
use_cache
)
{
unsigned
char
query_buffer
[
0x2000
];
std
::
vector
<
unsigned
char
>
query_buffer
;
auto
qbuf
=
query_buffer
;
query_buffer
.
resize
(
SIZE_QUERY_BUFFER
);
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
auto
qbuf
=
query_buffer
.
data
();
BufferIO
::
WriteInt8
(
qbuf
,
player
);
auto
len
=
WriteUpdateData
(
player
,
LOCATION_HAND
,
flag
,
qbuf
,
use_cache
);
BufferIO
::
WriteInt8
(
qbuf
,
LOCATION_HAND
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
.
data
(),
len
+
3
);
int
len
=
query_field_card
(
pduel
,
player
,
LOCATION_HAND
,
flag
|
QUERY_POSITION
,
(
unsigned
char
*
)
qbuf
,
use_cache
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
int
qlen
=
0
;
int
qlen
=
0
;
while
(
qlen
<
len
)
{
while
(
qlen
<
len
)
{
int
slen
=
BufferIO
::
ReadInt32
(
qbuf
);
const
int
slen
=
BufferIO
::
ReadInt32
(
qbuf
);
int
qflag
=
*
(
int
*
)
qbuf
;
qlen
+=
slen
;
int
offset
=
8
;
if
(
slen
<=
LEN_HEADER
)
if
(
!
(
qflag
&
QUERY_CODE
))
continue
;
offset
-=
4
;
auto
position
=
GetPosition
(
qbuf
,
8
);
unsigned
position
=
((
*
(
int
*
)(
qbuf
+
offset
))
>>
24
)
&
0xff
;
if
(
!
(
position
&
POS_FACEUP
))
if
(
!
(
position
&
POS_FACEUP
))
memset
(
qbuf
,
0
,
slen
-
4
);
memset
(
qbuf
,
0
,
slen
-
4
);
qbuf
+=
slen
-
4
;
qbuf
+=
slen
-
4
;
qlen
+=
slen
;
}
}
NetServer
::
SendBufferToPlayer
(
players
[
1
-
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
NetServer
::
SendBufferToPlayer
(
players
[
1
-
player
],
STOC_GAME_MSG
,
query_buffer
.
data
()
,
len
+
3
);
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
NetServer
::
ReSendToPlayer
(
*
pit
);
NetServer
::
ReSendToPlayer
(
*
pit
);
}
}
void
SingleDuel
::
RefreshGrave
(
int
player
,
int
flag
,
int
use_cache
)
{
void
SingleDuel
::
RefreshGrave
(
int
player
,
int
flag
,
int
use_cache
)
{
unsigned
char
query_buffer
[
0x2000
];
std
::
vector
<
unsigned
char
>
query_buffer
;
auto
qbuf
=
query_buffer
;
query_buffer
.
resize
(
SIZE_QUERY_BUFFER
);
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
auto
qbuf
=
query_buffer
.
data
();
BufferIO
::
WriteInt8
(
qbuf
,
player
);
auto
len
=
WriteUpdateData
(
player
,
LOCATION_GRAVE
,
flag
,
qbuf
,
use_cache
);
BufferIO
::
WriteInt8
(
qbuf
,
LOCATION_GRAVE
);
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
query_buffer
.
data
(),
len
+
3
);
int
len
=
query_field_card
(
pduel
,
player
,
LOCATION_GRAVE
,
flag
,
(
unsigned
char
*
)
qbuf
,
use_cache
);
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
NetServer
::
ReSendToPlayer
(
*
pit
);
NetServer
::
ReSendToPlayer
(
*
pit
);
}
}
void
SingleDuel
::
RefreshExtra
(
int
player
,
int
flag
,
int
use_cache
)
{
void
SingleDuel
::
RefreshExtra
(
int
player
,
int
flag
,
int
use_cache
)
{
unsigned
char
query_buffer
[
0x2000
];
std
::
vector
<
unsigned
char
>
query_buffer
;
auto
qbuf
=
query_buffer
;
query_buffer
.
resize
(
SIZE_QUERY_BUFFER
);
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
auto
qbuf
=
query_buffer
.
data
();
BufferIO
::
WriteInt8
(
qbuf
,
player
);
auto
len
=
WriteUpdateData
(
player
,
LOCATION_EXTRA
,
flag
,
qbuf
,
use_cache
);
BufferIO
::
WriteInt8
(
qbuf
,
LOCATION_EXTRA
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
.
data
(),
len
+
3
);
int
len
=
query_field_card
(
pduel
,
player
,
LOCATION_EXTRA
,
flag
,
(
unsigned
char
*
)
qbuf
,
use_cache
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
}
}
void
SingleDuel
::
RefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
)
{
void
SingleDuel
::
RefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
)
{
unsigned
char
query_buffer
[
0x2000
];
flag
|=
(
QUERY_CODE
|
QUERY_POSITION
);
unsigned
char
query_buffer
[
0x1000
];
auto
qbuf
=
query_buffer
;
auto
qbuf
=
query_buffer
;
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_CARD
);
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_CARD
);
BufferIO
::
WriteInt8
(
qbuf
,
player
);
BufferIO
::
WriteInt8
(
qbuf
,
player
);
BufferIO
::
WriteInt8
(
qbuf
,
location
);
BufferIO
::
WriteInt8
(
qbuf
,
location
);
BufferIO
::
WriteInt8
(
qbuf
,
sequence
);
BufferIO
::
WriteInt8
(
qbuf
,
sequence
);
int
len
=
query_card
(
pduel
,
player
,
location
,
sequence
,
flag
,
(
unsigned
char
*
)
qbuf
,
0
);
int
len
=
query_card
(
pduel
,
player
,
location
,
sequence
,
flag
,
qbuf
,
0
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
4
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
4
);
if
(
location
==
LOCATION_REMOVED
&&
(
qbuf
[
15
]
&
POS_FACEDOWN
))
if
(
len
<=
LEN_HEADER
)
return
;
auto
position
=
GetPosition
(
qbuf
,
12
);
if
(
location
==
LOCATION_REMOVED
&&
(
position
&
POS_FACEDOWN
))
return
;
return
;
if
((
location
&
0x90
)
||
((
location
&
0x2c
)
&&
(
qbuf
[
15
]
&
POS_FACEUP
)))
{
if
((
location
&
0x90
)
||
((
location
&
0x2c
)
&&
(
position
&
POS_FACEUP
)))
{
NetServer
::
ReSendToPlayer
(
players
[
1
-
player
]);
NetServer
::
ReSendToPlayer
(
players
[
1
-
player
]);
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
NetServer
::
ReSendToPlayer
(
*
pit
);
NetServer
::
ReSendToPlayer
(
*
pit
);
...
...
Classes/gframe/single_duel.h
View file @
0ea148e4
...
@@ -40,6 +40,9 @@ public:
...
@@ -40,6 +40,9 @@ public:
static
int
MessageHandler
(
intptr_t
fduel
,
int
type
);
static
int
MessageHandler
(
intptr_t
fduel
,
int
type
);
static
void
SingleTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
);
static
void
SingleTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
);
private:
int
WriteUpdateData
(
int
&
player
,
int
location
,
int
&
flag
,
unsigned
char
*&
qbuf
,
int
&
use_cache
);
protected:
protected:
DuelPlayer
*
players
[
2
];
DuelPlayer
*
players
[
2
];
...
...
Classes/gframe/single_mode.cpp
View file @
0ea148e4
...
@@ -764,15 +764,10 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
...
@@ -764,15 +764,10 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
}
}
return
is_continuing
;
return
is_continuing
;
}
}
void
SingleMode
::
ReloadLocation
(
int
player
,
int
location
,
int
flag
,
std
::
vector
<
unsigned
char
>&
queryBuffer
)
{
inline
void
SingleMode
::
ReloadLocation
(
int
player
,
int
location
,
int
flag
,
std
::
vector
<
unsigned
char
>&
queryBuffer
)
{
query_field_card
(
pduel
,
player
,
location
,
flag
,
queryBuffer
.
data
(),
0
);
query_field_card
(
pduel
,
player
,
location
,
flag
,
queryBuffer
.
data
(),
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
player
),
location
,
queryBuffer
.
data
());
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
player
),
location
,
queryBuffer
.
data
());
}
}
void
SingleMode
::
RefreshLocation
(
int
player
,
int
location
,
int
flag
)
{
std
::
vector
<
unsigned
char
>
queryBuffer
;
queryBuffer
.
resize
(
SIZE_QUERY_BUFFER
);
ReloadLocation
(
player
,
location
,
flag
,
queryBuffer
);
}
void
SingleMode
::
SinglePlayRefresh
(
int
flag
)
{
void
SingleMode
::
SinglePlayRefresh
(
int
flag
)
{
std
::
vector
<
unsigned
char
>
queryBuffer
;
std
::
vector
<
unsigned
char
>
queryBuffer
;
queryBuffer
.
resize
(
SIZE_QUERY_BUFFER
);
queryBuffer
.
resize
(
SIZE_QUERY_BUFFER
);
...
@@ -783,17 +778,22 @@ void SingleMode::SinglePlayRefresh(int flag) {
...
@@ -783,17 +778,22 @@ void SingleMode::SinglePlayRefresh(int flag) {
ReloadLocation
(
0
,
LOCATION_HAND
,
flag
,
queryBuffer
);
ReloadLocation
(
0
,
LOCATION_HAND
,
flag
,
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_HAND
,
flag
,
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_HAND
,
flag
,
queryBuffer
);
}
}
void
SingleMode
::
SinglePlayRefreshHand
(
int
player
,
int
flag
)
{
void
SingleMode
::
SingleRefreshLocation
(
int
player
,
int
location
,
int
flag
)
{
RefreshLocation
(
player
,
LOCATION_HAND
,
flag
);
std
::
vector
<
unsigned
char
>
queryBuffer
;
queryBuffer
.
resize
(
SIZE_QUERY_BUFFER
);
ReloadLocation
(
player
,
location
,
flag
,
queryBuffer
);
}
inline
void
SingleMode
::
SinglePlayRefreshHand
(
int
player
,
int
flag
)
{
SingleRefreshLocation
(
player
,
LOCATION_HAND
,
flag
);
}
}
void
SingleMode
::
SinglePlayRefreshGrave
(
int
player
,
int
flag
)
{
inline
void
SingleMode
::
SinglePlayRefreshGrave
(
int
player
,
int
flag
)
{
RefreshLocation
(
player
,
LOCATION_GRAVE
,
flag
);
Single
RefreshLocation
(
player
,
LOCATION_GRAVE
,
flag
);
}
}
void
SingleMode
::
SinglePlayRefreshDeck
(
int
player
,
int
flag
)
{
inline
void
SingleMode
::
SinglePlayRefreshDeck
(
int
player
,
int
flag
)
{
RefreshLocation
(
player
,
LOCATION_DECK
,
flag
);
Single
RefreshLocation
(
player
,
LOCATION_DECK
,
flag
);
}
}
void
SingleMode
::
SinglePlayRefreshExtra
(
int
player
,
int
flag
)
{
inline
void
SingleMode
::
SinglePlayRefreshExtra
(
int
player
,
int
flag
)
{
RefreshLocation
(
player
,
LOCATION_EXTRA
,
flag
);
Single
RefreshLocation
(
player
,
LOCATION_EXTRA
,
flag
);
}
}
void
SingleMode
::
SinglePlayRefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
)
{
void
SingleMode
::
SinglePlayRefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
)
{
unsigned
char
queryBuffer
[
0x1000
];
unsigned
char
queryBuffer
[
0x1000
];
...
...
Classes/gframe/single_mode.h
View file @
0ea148e4
#ifndef SINGLE_MODE_H
#ifndef SINGLE_MODE_H
#define SINGLE_MODE_H
#define SINGLE_MODE_H
#include <stdint.h>
#include <vector>
#include "replay.h"
#include "replay.h"
namespace
ygo
{
namespace
ygo
{
...
@@ -10,6 +12,7 @@ private:
...
@@ -10,6 +12,7 @@ private:
static
intptr_t
pduel
;
static
intptr_t
pduel
;
static
bool
is_closing
;
static
bool
is_closing
;
static
bool
is_continuing
;
static
bool
is_continuing
;
static
void
ReloadLocation
(
int
player
,
int
location
,
int
flag
,
std
::
vector
<
unsigned
char
>&
queryBuffer
);
public:
public:
static
bool
StartPlay
();
static
bool
StartPlay
();
...
@@ -18,9 +21,8 @@ public:
...
@@ -18,9 +21,8 @@ public:
static
int
SinglePlayThread
();
static
int
SinglePlayThread
();
static
bool
SinglePlayAnalyze
(
unsigned
char
*
msg
,
unsigned
int
len
);
static
bool
SinglePlayAnalyze
(
unsigned
char
*
msg
,
unsigned
int
len
);
inline
static
void
ReloadLocation
(
int
player
,
int
location
,
int
flag
,
std
::
vector
<
unsigned
char
>&
queryBuffer
);
inline
static
void
RefreshLocation
(
int
player
,
int
location
,
int
flag
);
static
void
SinglePlayRefresh
(
int
flag
=
0xf81fff
);
static
void
SinglePlayRefresh
(
int
flag
=
0xf81fff
);
static
void
SingleRefreshLocation
(
int
player
,
int
location
,
int
flag
);
static
void
SinglePlayRefreshHand
(
int
player
,
int
flag
=
0x781fff
);
static
void
SinglePlayRefreshHand
(
int
player
,
int
flag
=
0x781fff
);
static
void
SinglePlayRefreshGrave
(
int
player
,
int
flag
=
0x181fff
);
static
void
SinglePlayRefreshGrave
(
int
player
,
int
flag
=
0x181fff
);
static
void
SinglePlayRefreshDeck
(
int
player
,
int
flag
=
0x181fff
);
static
void
SinglePlayRefreshDeck
(
int
player
,
int
flag
=
0x181fff
);
...
...
Classes/gframe/tag_duel.cpp
View file @
0ea148e4
...
@@ -1550,93 +1550,97 @@ void TagDuel::TimeConfirm(DuelPlayer* dp) {
...
@@ -1550,93 +1550,97 @@ void TagDuel::TimeConfirm(DuelPlayer* dp) {
if
(
time_elapsed
<
10
)
if
(
time_elapsed
<
10
)
time_elapsed
=
0
;
time_elapsed
=
0
;
}
}
void
TagDuel
::
RefreshMzone
(
int
player
,
int
flag
,
int
use_cache
)
{
inline
int
TagDuel
::
WriteUpdateData
(
int
&
player
,
int
location
,
int
&
flag
,
unsigned
char
*&
qbuf
,
int
&
use_cache
)
{
unsigned
char
query_buffer
[
0x4000
];
flag
|=
(
QUERY_CODE
|
QUERY_POSITION
);
auto
qbuf
=
query_buffer
;
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
BufferIO
::
WriteInt8
(
qbuf
,
player
);
BufferIO
::
WriteInt8
(
qbuf
,
player
);
BufferIO
::
WriteInt8
(
qbuf
,
LOCATION_MZONE
);
BufferIO
::
WriteInt8
(
qbuf
,
location
);
int
len
=
query_field_card
(
pduel
,
player
,
LOCATION_MZONE
,
flag
,
(
unsigned
char
*
)
qbuf
,
use_cache
);
int
len
=
query_field_card
(
pduel
,
player
,
location
,
flag
,
qbuf
,
use_cache
);
return
len
;
}
inline
unsigned
int
GetPosition
(
unsigned
char
*&
qbuf
,
int
offset
)
{
unsigned
int
info
=
*
(
unsigned
int
*
)(
qbuf
+
offset
);
return
info
>>
24
;
}
void
TagDuel
::
RefreshMzone
(
int
player
,
int
flag
,
int
use_cache
)
{
std
::
vector
<
unsigned
char
>
query_buffer
;
query_buffer
.
resize
(
SIZE_QUERY_BUFFER
);
auto
qbuf
=
query_buffer
.
data
();
auto
len
=
WriteUpdateData
(
player
,
LOCATION_MZONE
,
flag
,
qbuf
,
use_cache
);
int
pid
=
(
player
==
0
)
?
0
:
2
;
int
pid
=
(
player
==
0
)
?
0
:
2
;
NetServer
::
SendBufferToPlayer
(
players
[
pid
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
NetServer
::
SendBufferToPlayer
(
players
[
pid
],
STOC_GAME_MSG
,
query_buffer
.
data
()
,
len
+
3
);
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
int
qlen
=
0
;
int
qlen
=
0
;
while
(
qlen
<
len
)
{
while
(
qlen
<
len
)
{
int
clen
=
BufferIO
::
ReadInt32
(
qbuf
);
int
clen
=
BufferIO
::
ReadInt32
(
qbuf
);
qlen
+=
clen
;
qlen
+=
clen
;
if
(
clen
==
4
)
if
(
clen
<=
LEN_HEADER
)
continue
;
continue
;
if
(
qbuf
[
11
]
&
POS_FACEDOWN
)
auto
position
=
GetPosition
(
qbuf
,
8
);
if
(
position
&
POS_FACEDOWN
)
memset
(
qbuf
,
0
,
clen
-
4
);
memset
(
qbuf
,
0
,
clen
-
4
);
qbuf
+=
clen
-
4
;
qbuf
+=
clen
-
4
;
}
}
pid
=
2
-
pid
;
pid
=
2
-
pid
;
NetServer
::
SendBufferToPlayer
(
players
[
pid
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
NetServer
::
SendBufferToPlayer
(
players
[
pid
],
STOC_GAME_MSG
,
query_buffer
.
data
()
,
len
+
3
);
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
NetServer
::
ReSendToPlayer
(
*
pit
);
NetServer
::
ReSendToPlayer
(
*
pit
);
}
}
void
TagDuel
::
RefreshSzone
(
int
player
,
int
flag
,
int
use_cache
)
{
void
TagDuel
::
RefreshSzone
(
int
player
,
int
flag
,
int
use_cache
)
{
unsigned
char
query_buffer
[
0x4000
];
std
::
vector
<
unsigned
char
>
query_buffer
;
auto
qbuf
=
query_buffer
;
query_buffer
.
resize
(
SIZE_QUERY_BUFFER
);
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
auto
qbuf
=
query_buffer
.
data
();
BufferIO
::
WriteInt8
(
qbuf
,
player
);
auto
len
=
WriteUpdateData
(
player
,
LOCATION_SZONE
,
flag
,
qbuf
,
use_cache
);
BufferIO
::
WriteInt8
(
qbuf
,
LOCATION_SZONE
);
int
len
=
query_field_card
(
pduel
,
player
,
LOCATION_SZONE
,
flag
,
(
unsigned
char
*
)
qbuf
,
use_cache
);
int
pid
=
(
player
==
0
)
?
0
:
2
;
int
pid
=
(
player
==
0
)
?
0
:
2
;
NetServer
::
SendBufferToPlayer
(
players
[
pid
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
NetServer
::
SendBufferToPlayer
(
players
[
pid
],
STOC_GAME_MSG
,
query_buffer
.
data
()
,
len
+
3
);
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
int
qlen
=
0
;
int
qlen
=
0
;
while
(
qlen
<
len
)
{
while
(
qlen
<
len
)
{
int
clen
=
BufferIO
::
ReadInt32
(
qbuf
);
int
clen
=
BufferIO
::
ReadInt32
(
qbuf
);
qlen
+=
clen
;
qlen
+=
clen
;
if
(
clen
==
4
)
if
(
clen
<=
LEN_HEADER
)
continue
;
continue
;
if
(
qbuf
[
11
]
&
POS_FACEDOWN
)
auto
position
=
GetPosition
(
qbuf
,
8
);
if
(
position
&
POS_FACEDOWN
)
memset
(
qbuf
,
0
,
clen
-
4
);
memset
(
qbuf
,
0
,
clen
-
4
);
qbuf
+=
clen
-
4
;
qbuf
+=
clen
-
4
;
}
}
pid
=
2
-
pid
;
pid
=
2
-
pid
;
NetServer
::
SendBufferToPlayer
(
players
[
pid
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
NetServer
::
SendBufferToPlayer
(
players
[
pid
],
STOC_GAME_MSG
,
query_buffer
.
data
()
,
len
+
3
);
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
NetServer
::
ReSendToPlayer
(
*
pit
);
NetServer
::
ReSendToPlayer
(
*
pit
);
}
}
void
TagDuel
::
RefreshHand
(
int
player
,
int
flag
,
int
use_cache
)
{
void
TagDuel
::
RefreshHand
(
int
player
,
int
flag
,
int
use_cache
)
{
unsigned
char
query_buffer
[
0x4000
];
std
::
vector
<
unsigned
char
>
query_buffer
;
auto
qbuf
=
query_buffer
;
query_buffer
.
resize
(
SIZE_QUERY_BUFFER
);
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
auto
qbuf
=
query_buffer
.
data
();
BufferIO
::
WriteInt8
(
qbuf
,
player
);
auto
len
=
WriteUpdateData
(
player
,
LOCATION_HAND
,
flag
,
qbuf
,
use_cache
);
BufferIO
::
WriteInt8
(
qbuf
,
LOCATION_HAND
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
query_buffer
.
data
(),
len
+
3
);
int
len
=
query_field_card
(
pduel
,
player
,
LOCATION_HAND
,
flag
|
QUERY_POSITION
,
(
unsigned
char
*
)
qbuf
,
use_cache
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
int
qlen
=
0
;
int
qlen
=
0
;
while
(
qlen
<
len
)
{
while
(
qlen
<
len
)
{
int
slen
=
BufferIO
::
ReadInt32
(
qbuf
);
int
slen
=
BufferIO
::
ReadInt32
(
qbuf
);
int
qflag
=
*
(
int
*
)
qbuf
;
qlen
+=
slen
;
int
offset
=
8
;
if
(
slen
<=
LEN_HEADER
)
if
(
!
(
qflag
&
QUERY_CODE
))
continue
;
offset
-=
4
;
auto
position
=
GetPosition
(
qbuf
,
8
);
unsigned
position
=
((
*
(
int
*
)(
qbuf
+
offset
))
>>
24
)
&
0xff
;
if
(
!
(
position
&
POS_FACEUP
))
if
(
!
(
position
&
POS_FACEUP
))
memset
(
qbuf
,
0
,
slen
-
4
);
memset
(
qbuf
,
0
,
slen
-
4
);
qbuf
+=
slen
-
4
;
qbuf
+=
slen
-
4
;
qlen
+=
slen
;
}
}
for
(
int
i
=
0
;
i
<
4
;
++
i
)
for
(
int
i
=
0
;
i
<
4
;
++
i
)
if
(
players
[
i
]
!=
cur_player
[
player
])
if
(
players
[
i
]
!=
cur_player
[
player
])
NetServer
::
SendBufferToPlayer
(
players
[
i
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
NetServer
::
SendBufferToPlayer
(
players
[
i
],
STOC_GAME_MSG
,
query_buffer
.
data
()
,
len
+
3
);
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
for
(
auto
pit
=
observers
.
begin
();
pit
!=
observers
.
end
();
++
pit
)
NetServer
::
ReSendToPlayer
(
*
pit
);
NetServer
::
ReSendToPlayer
(
*
pit
);
}
}
void
TagDuel
::
RefreshGrave
(
int
player
,
int
flag
,
int
use_cache
)
{
void
TagDuel
::
RefreshGrave
(
int
player
,
int
flag
,
int
use_cache
)
{
unsigned
char
query_buffer
[
0x4000
];
std
::
vector
<
unsigned
char
>
query_buffer
;
auto
qbuf
=
query_buffer
;
query_buffer
.
resize
(
SIZE_QUERY_BUFFER
);
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
auto
qbuf
=
query_buffer
.
data
();
BufferIO
::
WriteInt8
(
qbuf
,
player
);
auto
len
=
WriteUpdateData
(
player
,
LOCATION_GRAVE
,
flag
,
qbuf
,
use_cache
);
BufferIO
::
WriteInt8
(
qbuf
,
LOCATION_GRAVE
);
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
query_buffer
.
data
(),
len
+
3
);
int
len
=
query_field_card
(
pduel
,
player
,
LOCATION_GRAVE
,
flag
,
(
unsigned
char
*
)
qbuf
,
use_cache
);
NetServer
::
SendBufferToPlayer
(
players
[
0
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
NetServer
::
ReSendToPlayer
(
players
[
1
]);
NetServer
::
ReSendToPlayer
(
players
[
2
]);
NetServer
::
ReSendToPlayer
(
players
[
2
]);
NetServer
::
ReSendToPlayer
(
players
[
3
]);
NetServer
::
ReSendToPlayer
(
players
[
3
]);
...
@@ -1644,27 +1648,27 @@ void TagDuel::RefreshGrave(int player, int flag, int use_cache) {
...
@@ -1644,27 +1648,27 @@ void TagDuel::RefreshGrave(int player, int flag, int use_cache) {
NetServer
::
ReSendToPlayer
(
*
pit
);
NetServer
::
ReSendToPlayer
(
*
pit
);
}
}
void
TagDuel
::
RefreshExtra
(
int
player
,
int
flag
,
int
use_cache
)
{
void
TagDuel
::
RefreshExtra
(
int
player
,
int
flag
,
int
use_cache
)
{
unsigned
char
query_buffer
[
0x4000
];
std
::
vector
<
unsigned
char
>
query_buffer
;
auto
qbuf
=
query_buffer
;
query_buffer
.
resize
(
SIZE_QUERY_BUFFER
);
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
auto
qbuf
=
query_buffer
.
data
();
BufferIO
::
WriteInt8
(
qbuf
,
player
);
auto
len
=
WriteUpdateData
(
player
,
LOCATION_EXTRA
,
flag
,
qbuf
,
use_cache
);
BufferIO
::
WriteInt8
(
qbuf
,
LOCATION_EXTRA
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
query_buffer
.
data
(),
len
+
3
);
int
len
=
query_field_card
(
pduel
,
player
,
LOCATION_EXTRA
,
flag
,
(
unsigned
char
*
)
qbuf
,
use_cache
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
}
}
void
TagDuel
::
RefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
)
{
void
TagDuel
::
RefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
)
{
unsigned
char
query_buffer
[
0x4000
];
flag
|=
(
QUERY_CODE
|
QUERY_POSITION
);
unsigned
char
query_buffer
[
0x1000
];
auto
qbuf
=
query_buffer
;
auto
qbuf
=
query_buffer
;
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_CARD
);
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_CARD
);
BufferIO
::
WriteInt8
(
qbuf
,
player
);
BufferIO
::
WriteInt8
(
qbuf
,
player
);
BufferIO
::
WriteInt8
(
qbuf
,
location
);
BufferIO
::
WriteInt8
(
qbuf
,
location
);
BufferIO
::
WriteInt8
(
qbuf
,
sequence
);
BufferIO
::
WriteInt8
(
qbuf
,
sequence
);
int
len
=
query_card
(
pduel
,
player
,
location
,
sequence
,
flag
,
(
unsigned
char
*
)
qbuf
,
0
);
int
len
=
query_card
(
pduel
,
player
,
location
,
sequence
,
flag
,
qbuf
,
0
);
auto
position
=
GetPosition
(
qbuf
,
12
);
if
(
location
&
LOCATION_ONFIELD
)
{
if
(
location
&
LOCATION_ONFIELD
)
{
int
pid
=
(
player
==
0
)
?
0
:
2
;
int
pid
=
(
player
==
0
)
?
0
:
2
;
NetServer
::
SendBufferToPlayer
(
players
[
pid
],
STOC_GAME_MSG
,
query_buffer
,
len
+
4
);
NetServer
::
SendBufferToPlayer
(
players
[
pid
],
STOC_GAME_MSG
,
query_buffer
,
len
+
4
);
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
if
(
qbuf
[
15
]
&
POS_FACEUP
)
{
if
(
position
&
POS_FACEUP
)
{
pid
=
2
-
pid
;
pid
=
2
-
pid
;
NetServer
::
SendBufferToPlayer
(
players
[
pid
],
STOC_GAME_MSG
,
query_buffer
,
len
+
4
);
NetServer
::
SendBufferToPlayer
(
players
[
pid
],
STOC_GAME_MSG
,
query_buffer
,
len
+
4
);
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
...
@@ -1675,7 +1679,7 @@ void TagDuel::RefreshSingle(int player, int location, int sequence, int flag) {
...
@@ -1675,7 +1679,7 @@ void TagDuel::RefreshSingle(int player, int location, int sequence, int flag) {
int
pid
=
(
player
==
0
)
?
0
:
2
;
int
pid
=
(
player
==
0
)
?
0
:
2
;
NetServer
::
SendBufferToPlayer
(
players
[
pid
],
STOC_GAME_MSG
,
query_buffer
,
len
+
4
);
NetServer
::
SendBufferToPlayer
(
players
[
pid
],
STOC_GAME_MSG
,
query_buffer
,
len
+
4
);
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
NetServer
::
ReSendToPlayer
(
players
[
pid
+
1
]);
if
(
location
==
LOCATION_REMOVED
&&
(
qbuf
[
15
]
&
POS_FACEDOWN
))
if
(
location
==
LOCATION_REMOVED
&&
(
position
&
POS_FACEDOWN
))
return
;
return
;
if
(
location
&
0x90
)
{
if
(
location
&
0x90
)
{
for
(
int
i
=
0
;
i
<
4
;
++
i
)
for
(
int
i
=
0
;
i
<
4
;
++
i
)
...
...
Classes/gframe/tag_duel.h
View file @
0ea148e4
...
@@ -40,6 +40,9 @@ public:
...
@@ -40,6 +40,9 @@ public:
static
int
MessageHandler
(
intptr_t
fduel
,
int
type
);
static
int
MessageHandler
(
intptr_t
fduel
,
int
type
);
static
void
TagTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
);
static
void
TagTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
);
private:
int
WriteUpdateData
(
int
&
player
,
int
location
,
int
&
flag
,
unsigned
char
*&
qbuf
,
int
&
use_cache
);
protected:
protected:
DuelPlayer
*
players
[
4
];
DuelPlayer
*
players
[
4
];
...
...
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