Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
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
Commits
68582e00
Commit
68582e00
authored
6 years ago
by
edo9300
Committed by
mercury233
6 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added SelectUnselet related messages and functions (#1963)
parent
c9cf6703
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
230 additions
and
20 deletions
+230
-20
gframe/client_field.cpp
gframe/client_field.cpp
+23
-19
gframe/duelclient.cpp
gframe/duelclient.cpp
+80
-1
gframe/event_handler.cpp
gframe/event_handler.cpp
+49
-0
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+9
-0
gframe/single_duel.cpp
gframe/single_duel.cpp
+28
-0
gframe/single_mode.cpp
gframe/single_mode.cpp
+13
-0
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+28
-0
No files found.
gframe/client_field.cpp
View file @
68582e00
...
...
@@ -420,26 +420,30 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
selectable_cards
[
i
]
->
sequence
+
1
);
mainGame
->
stCardPos
[
i
]
->
setText
(
formatBuffer
);
// color
if
(
conti_selecting
)
mainGame
->
stCardPos
[
i
]
->
setBackgroundColor
(
0xffffffff
);
else
if
(
selectable_cards
[
i
]
->
location
==
LOCATION_OVERLAY
)
{
if
(
selectable_cards
[
i
]
->
owner
!=
selectable_cards
[
i
]
->
overlayTarget
->
controler
)
mainGame
->
stCardPos
[
i
]
->
setOverrideColor
(
0xff0000ff
);
if
(
selectable_cards
[
i
]
->
overlayTarget
->
controler
)
mainGame
->
stCardPos
[
i
]
->
setBackgroundColor
(
0xffd0d0d0
);
else
mainGame
->
stCardPos
[
i
]
->
setBackgroundColor
(
0xffffffff
);
}
else
if
(
selectable_cards
[
i
]
->
location
==
LOCATION_DECK
||
selectable_cards
[
i
]
->
location
==
LOCATION_EXTRA
||
selectable_cards
[
i
]
->
location
==
LOCATION_REMOVED
)
{
if
(
selectable_cards
[
i
]
->
position
&
POS_FACEDOWN
)
mainGame
->
stCardPos
[
i
]
->
setOverrideColor
(
0xff0000ff
);
if
(
selectable_cards
[
i
]
->
controler
)
mainGame
->
stCardPos
[
i
]
->
setBackgroundColor
(
0xffd0d0d0
);
else
mainGame
->
stCardPos
[
i
]
->
setBackgroundColor
(
0xffffffff
);
}
else
{
if
(
selectable_cards
[
i
]
->
controler
)
mainGame
->
stCardPos
[
i
]
->
setBackgroundColor
(
0xffd0d0d0
);
else
if
(
selectable_cards
[
i
]
->
is_selected
)
mainGame
->
stCardPos
[
i
]
->
setBackgroundColor
(
0xffffff00
);
else
{
if
(
conti_selecting
)
mainGame
->
stCardPos
[
i
]
->
setBackgroundColor
(
0xffffffff
);
else
if
(
selectable_cards
[
i
]
->
location
==
LOCATION_OVERLAY
)
{
if
(
selectable_cards
[
i
]
->
owner
!=
selectable_cards
[
i
]
->
overlayTarget
->
controler
)
mainGame
->
stCardPos
[
i
]
->
setOverrideColor
(
0xff0000ff
);
if
(
selectable_cards
[
i
]
->
overlayTarget
->
controler
)
mainGame
->
stCardPos
[
i
]
->
setBackgroundColor
(
0xffd0d0d0
);
else
mainGame
->
stCardPos
[
i
]
->
setBackgroundColor
(
0xffffffff
);
}
else
if
(
selectable_cards
[
i
]
->
location
==
LOCATION_DECK
||
selectable_cards
[
i
]
->
location
==
LOCATION_EXTRA
||
selectable_cards
[
i
]
->
location
==
LOCATION_REMOVED
)
{
if
(
selectable_cards
[
i
]
->
position
&
POS_FACEDOWN
)
mainGame
->
stCardPos
[
i
]
->
setOverrideColor
(
0xff0000ff
);
if
(
selectable_cards
[
i
]
->
controler
)
mainGame
->
stCardPos
[
i
]
->
setBackgroundColor
(
0xffd0d0d0
);
else
mainGame
->
stCardPos
[
i
]
->
setBackgroundColor
(
0xffffffff
);
}
else
{
if
(
selectable_cards
[
i
]
->
controler
)
mainGame
->
stCardPos
[
i
]
->
setBackgroundColor
(
0xffd0d0d0
);
else
mainGame
->
stCardPos
[
i
]
->
setBackgroundColor
(
0xffffffff
);
}
}
}
else
{
if
(
sort_list
[
i
])
{
...
...
This diff is collapsed.
Click to expand it.
gframe/duelclient.cpp
View file @
68582e00
...
...
@@ -1395,6 +1395,84 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
return
false
;
}
case
MSG_SELECT_UNSELECT_CARD
:
{
/*int selecting_player = */
BufferIO
::
ReadInt8
(
pbuf
);
bool
buttonok
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame
->
dField
.
select_cancelable
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame
->
dField
.
select_min
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame
->
dField
.
select_max
=
BufferIO
::
ReadInt8
(
pbuf
);
int
count1
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame
->
dField
.
selectable_cards
.
clear
();
mainGame
->
dField
.
selected_cards
.
clear
();
int
c
,
l
,
s
,
ss
;
unsigned
int
code
;
bool
panelmode
=
false
;
mainGame
->
dField
.
select_ready
=
false
;
ClientCard
*
pcard
;
for
(
int
i
=
0
;
i
<
count1
;
++
i
)
{
code
=
(
unsigned
int
)
BufferIO
::
ReadInt32
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
l
=
BufferIO
::
ReadInt8
(
pbuf
);
s
=
BufferIO
::
ReadInt8
(
pbuf
);
ss
=
BufferIO
::
ReadInt8
(
pbuf
);
if
((
l
&
LOCATION_OVERLAY
)
>
0
)
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
&
0x7f
,
s
)
->
overlayed
[
ss
];
else
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
if
(
code
!=
0
&&
pcard
->
code
!=
code
)
pcard
->
SetCode
(
code
);
pcard
->
select_seq
=
i
;
mainGame
->
dField
.
selectable_cards
.
push_back
(
pcard
);
pcard
->
is_selectable
=
true
;
pcard
->
is_selected
=
false
;
if
(
l
&
0xf1
)
panelmode
=
true
;
}
int
count2
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
i
=
count1
;
i
<
count1
+
count2
;
++
i
)
{
code
=
(
unsigned
int
)
BufferIO
::
ReadInt32
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
l
=
BufferIO
::
ReadInt8
(
pbuf
);
s
=
BufferIO
::
ReadInt8
(
pbuf
);
ss
=
BufferIO
::
ReadInt8
(
pbuf
);
if
((
l
&
LOCATION_OVERLAY
)
>
0
)
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
&
0x7f
,
s
)
->
overlayed
[
ss
];
else
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
if
(
code
!=
0
&&
pcard
->
code
!=
code
)
pcard
->
SetCode
(
code
);
pcard
->
select_seq
=
i
;
mainGame
->
dField
.
selectable_cards
.
push_back
(
pcard
);
pcard
->
is_selectable
=
true
;
pcard
->
is_selected
=
true
;
if
(
l
&
0xf1
)
panelmode
=
true
;
}
std
::
sort
(
mainGame
->
dField
.
selectable_cards
.
begin
(),
mainGame
->
dField
.
selectable_cards
.
end
(),
ClientCard
::
client_card_sort
);
if
(
select_hint
)
myswprintf
(
textBuffer
,
L"%ls(%d-%d)"
,
dataManager
.
GetDesc
(
select_hint
),
mainGame
->
dField
.
select_min
,
mainGame
->
dField
.
select_max
);
else
myswprintf
(
textBuffer
,
L"%ls(%d-%d)"
,
dataManager
.
GetSysString
(
560
),
mainGame
->
dField
.
select_min
,
mainGame
->
dField
.
select_max
);
select_hint
=
0
;
if
(
panelmode
)
{
mainGame
->
gMutex
.
Lock
();
mainGame
->
wCardSelect
->
setText
(
textBuffer
);
mainGame
->
dField
.
ShowSelectCard
(
buttonok
);
mainGame
->
gMutex
.
Unlock
();
}
else
{
mainGame
->
stHintMsg
->
setText
(
textBuffer
);
mainGame
->
stHintMsg
->
setVisible
(
true
);
}
if
(
mainGame
->
dField
.
select_cancelable
)
{
if
(
count2
==
0
)
mainGame
->
dField
.
ShowCancelOrFinishButton
(
1
);
else
mainGame
->
dField
.
ShowCancelOrFinishButton
(
2
);
}
else
mainGame
->
dField
.
ShowCancelOrFinishButton
(
0
);
return
false
;
}
case
MSG_SELECT_CHAIN
:
{
/*int selecting_player = */
BufferIO
::
ReadInt8
(
pbuf
);
int
count
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -3662,7 +3740,8 @@ void DuelClient::SendResponse() {
mainGame
->
btnShuffle
->
setVisible
(
false
);
break
;
}
case
MSG_SELECT_CARD
:
{
case
MSG_SELECT_CARD
:
case
MSG_SELECT_UNSELECT_CARD
:
{
mainGame
->
dField
.
ClearSelect
();
break
;
}
...
...
This diff is collapsed.
Click to expand it.
gframe/event_handler.cpp
View file @
68582e00
...
...
@@ -686,6 +686,24 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
break
;
}
case
MSG_SELECT_UNSELECT_CARD
:
{
command_card
=
selectable_cards
[
id
-
BUTTON_CARD_0
+
mainGame
->
scrCardList
->
getPos
()
/
10
];
if
(
command_card
->
is_selected
)
{
command_card
->
is_selected
=
false
;
if
(
command_card
->
controler
)
mainGame
->
stCardPos
[
id
-
BUTTON_CARD_0
]
->
setBackgroundColor
(
0xffd0d0d0
);
else
mainGame
->
stCardPos
[
id
-
BUTTON_CARD_0
]
->
setBackgroundColor
(
0xffffffff
);
}
else
{
command_card
->
is_selected
=
true
;
mainGame
->
stCardPos
[
id
-
BUTTON_CARD_0
]
->
setBackgroundColor
(
0xffffff00
);
}
selected_cards
.
push_back
(
command_card
);
if
(
selected_cards
.
size
()
>
0
)
{
SetResponseSelectedCards
();
ShowCancelOrFinishButton
(
0
);
mainGame
->
HideElement
(
mainGame
->
wCardSelect
,
true
);}
break
;
}
case
MSG_SELECT_SUM
:
{
command_card
=
selectable_cards
[
id
-
BUTTON_CARD_0
+
mainGame
->
scrCardList
->
getPos
()
/
10
];
selected_cards
.
push_back
(
command_card
);
...
...
@@ -747,6 +765,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame
->
HideElement
(
mainGame
->
wCardSelect
);
mainGame
->
actionSignal
.
Set
();
break
;
}
else
if
(
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_UNSELECT_CARD
){
DuelClient
::
SetResponseI
(
-
1
);
ShowCancelOrFinishButton
(
0
);
mainGame
->
HideElement
(
mainGame
->
wCardSelect
,
true
);
}
else
{
mainGame
->
HideElement
(
mainGame
->
wCardSelect
);
if
(
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_CHAIN
&&
!
chain_forced
)
...
...
@@ -1331,6 +1353,22 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
break
;
}
case
MSG_SELECT_UNSELECT_CARD
:
{
if
(
!
(
hovered_location
&
0xe
)
||
!
clicked_card
||
!
clicked_card
->
is_selectable
)
break
;
if
(
clicked_card
->
is_selected
)
{
clicked_card
->
is_selected
=
false
;
}
else
{
clicked_card
->
is_selected
=
true
;
}
selected_cards
.
push_back
(
clicked_card
);
if
(
selected_cards
.
size
()
>
0
)
{
ShowCancelOrFinishButton
(
0
);
SetResponseSelectedCards
();
DuelClient
::
SendResponse
();
}
break
;
}
case
MSG_SELECT_COUNTER
:
{
if
(
!
clicked_card
||
!
clicked_card
->
is_selectable
)
break
;
...
...
@@ -2220,6 +2258,17 @@ void ClientField::CancelOrFinish() {
}
break
;
}
case
MSG_SELECT_UNSELECT_CARD
:
{
if
(
select_cancelable
)
{
DuelClient
::
SetResponseI
(
-
1
);
ShowCancelOrFinishButton
(
0
);
if
(
mainGame
->
wCardSelect
->
isVisible
())
mainGame
->
HideElement
(
mainGame
->
wCardSelect
,
true
);
else
DuelClient
::
SendResponse
();
}
break
;
}
case
MSG_SELECT_TRIBUTE
:
{
if
(
selected_cards
.
size
()
==
0
)
{
if
(
select_cancelable
)
{
...
...
This diff is collapsed.
Click to expand it.
gframe/replay_mode.cpp
View file @
68582e00
...
...
@@ -383,6 +383,15 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
pbuf
+=
count
*
8
;
return
ReadReplayResponse
();
}
case
MSG_SELECT_UNSELECT_CARD
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
4
;
count
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
count
*
8
;
count
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
count
*
8
;
return
ReadReplayResponse
();
}
case
MSG_SELECT_CHAIN
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
This diff is collapsed.
Click to expand it.
gframe/single_duel.cpp
View file @
68582e00
...
...
@@ -693,6 +693,34 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SELECT_UNSELECT_CARD
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
4
;
count
=
BufferIO
::
ReadInt8
(
pbuf
);
int
c
/*, l, s, ss, code*/
;
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
pbufw
=
pbuf
;
/*code = */
BufferIO
::
ReadInt32
(
pbuf
);
c
=
BufferIO
::
ReadInt8
(
pbuf
);
/*l = */
BufferIO
::
ReadInt8
(
pbuf
);
/*s = */
BufferIO
::
ReadInt8
(
pbuf
);
/*ss = */
BufferIO
::
ReadInt8
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
WriteInt32
(
pbufw
,
0
);
}
count
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
pbufw
=
pbuf
;
/*code = */
BufferIO
::
ReadInt32
(
pbuf
);
c
=
BufferIO
::
ReadInt8
(
pbuf
);
/*l = */
BufferIO
::
ReadInt8
(
pbuf
);
/*s = */
BufferIO
::
ReadInt8
(
pbuf
);
/*ss = */
BufferIO
::
ReadInt8
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
WriteInt32
(
pbufw
,
0
);
}
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SELECT_CHAIN
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
This diff is collapsed.
Click to expand it.
gframe/single_mode.cpp
View file @
68582e00
...
...
@@ -273,6 +273,19 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
}
break
;
}
case
MSG_SELECT_UNSELECT_CARD
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
4
;
count
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
count
*
8
;
count
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
count
*
8
;
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
mainGame
->
singleSignal
.
Reset
();
mainGame
->
singleSignal
.
Wait
();
}
break
;
}
case
MSG_SELECT_CHAIN
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
This diff is collapsed.
Click to expand it.
gframe/tag_duel.cpp
View file @
68582e00
...
...
@@ -631,6 +631,34 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SELECT_UNSELECT_CARD
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
4
;
count
=
BufferIO
::
ReadInt8
(
pbuf
);
int
c
/*, l, s, ss, code*/
;
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
pbufw
=
pbuf
;
/*code = */
BufferIO
::
ReadInt32
(
pbuf
);
c
=
BufferIO
::
ReadInt8
(
pbuf
);
/*l = */
BufferIO
::
ReadInt8
(
pbuf
);
/*s = */
BufferIO
::
ReadInt8
(
pbuf
);
/*ss = */
BufferIO
::
ReadInt8
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
WriteInt32
(
pbufw
,
0
);
}
count
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
pbufw
=
pbuf
;
/*code = */
BufferIO
::
ReadInt32
(
pbuf
);
c
=
BufferIO
::
ReadInt8
(
pbuf
);
/*l = */
BufferIO
::
ReadInt8
(
pbuf
);
/*s = */
BufferIO
::
ReadInt8
(
pbuf
);
/*ss = */
BufferIO
::
ReadInt8
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
WriteInt32
(
pbufw
,
0
);
}
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SELECT_CHAIN
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment