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
501db5c0
Commit
501db5c0
authored
May 04, 2024
by
wind2009
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/patch-chat-reverse' into develop
parents
1dba23da
dcf0155b
Pipeline
#26832
passed with stages
in 5 minutes and 4 seconds
Changes
5
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
26 deletions
+54
-26
gframe/duelclient.cpp
gframe/duelclient.cpp
+8
-18
gframe/duelclient.h
gframe/duelclient.h
+1
-1
gframe/game.cpp
gframe/game.cpp
+42
-5
gframe/game.h
gframe/game.h
+3
-1
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+0
-1
No files found.
gframe/duelclient.cpp
View file @
501db5c0
...
@@ -403,6 +403,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
...
@@ -403,6 +403,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
break
;
break
;
}
}
case
STOC_WAITING_SIDE
:
{
case
STOC_WAITING_SIDE
:
{
mainGame
->
dInfo
.
isInDuel
=
false
;
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
mainGame
->
dField
.
Clear
();
mainGame
->
dField
.
Clear
();
mainGame
->
stHintMsg
->
setText
(
dataManager
.
GetSysString
(
1409
));
mainGame
->
stHintMsg
->
setText
(
dataManager
.
GetSysString
(
1409
));
...
@@ -744,28 +745,17 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
...
@@ -744,28 +745,17 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
case
STOC_CHAT
:
{
case
STOC_CHAT
:
{
STOC_Chat
*
pkt
=
(
STOC_Chat
*
)
pdata
;
STOC_Chat
*
pkt
=
(
STOC_Chat
*
)
pdata
;
int
player
=
pkt
->
player
;
int
player
=
pkt
->
player
;
auto
play_sound
=
false
;
if
(
player
<
4
)
{
if
(
player
<
4
)
{
if
(
mainGame
->
chkIgnore1
->
isChecked
())
if
(
mainGame
->
chkIgnore1
->
isChecked
())
break
;
break
;
if
(
!
mainGame
->
dInfo
.
isTag
)
{
auto
localplayer
=
mainGame
->
ChatLocalPlayer
(
player
);
if
(
mainGame
->
dInfo
.
isInDuel
)
player
=
localplayer
&
0xf
;
player
=
mainGame
->
LocalPlayer
(
player
);
if
(
!
(
localplayer
&
0x10
))
}
else
{
play_sound
=
true
;
if
(
mainGame
->
dInfo
.
isInDuel
&&
!
mainGame
->
dInfo
.
isFirst
)
player
^=
2
;
if
(
player
==
0
)
player
=
0
;
else
if
(
player
==
1
)
player
=
2
;
else
if
(
player
==
2
)
player
=
1
;
else
if
(
player
==
3
)
player
=
3
;
else
player
=
10
;
}
}
else
{
}
else
{
if
(
player
==
8
)
{
//system custom message.
if
(
player
==
8
)
{
//system custom message.
play_sound
=
true
;
if
(
mainGame
->
chkIgnore1
->
isChecked
())
if
(
mainGame
->
chkIgnore1
->
isChecked
())
break
;
break
;
}
else
if
(
player
<
11
||
player
>
19
)
{
}
else
if
(
player
<
11
||
player
>
19
)
{
...
@@ -777,7 +767,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
...
@@ -777,7 +767,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, unsigned int len) {
wchar_t
msg
[
256
];
wchar_t
msg
[
256
];
BufferIO
::
CopyWStr
(
pkt
->
msg
,
msg
,
256
);
BufferIO
::
CopyWStr
(
pkt
->
msg
,
msg
,
256
);
mainGame
->
gMutex
.
lock
();
mainGame
->
gMutex
.
lock
();
mainGame
->
AddChatMsg
(
msg
,
player
);
mainGame
->
AddChatMsg
(
msg
,
player
,
play_sound
);
mainGame
->
gMutex
.
unlock
();
mainGame
->
gMutex
.
unlock
();
break
;
break
;
}
}
...
...
gframe/duelclient.h
View file @
501db5c0
...
@@ -23,7 +23,6 @@ private:
...
@@ -23,7 +23,6 @@ private:
static
unsigned
char
response_buf
[
SIZE_RETURN_VALUE
];
static
unsigned
char
response_buf
[
SIZE_RETURN_VALUE
];
static
unsigned
int
response_len
;
static
unsigned
int
response_len
;
static
unsigned
int
watching
;
static
unsigned
int
watching
;
static
unsigned
char
selftype
;
static
bool
is_host
;
static
bool
is_host
;
static
event_base
*
client_base
;
static
event_base
*
client_base
;
static
bufferevent
*
client_bev
;
static
bufferevent
*
client_bev
;
...
@@ -39,6 +38,7 @@ private:
...
@@ -39,6 +38,7 @@ private:
static
wchar_t
event_string
[
256
];
static
wchar_t
event_string
[
256
];
static
mt19937
rnd
;
static
mt19937
rnd
;
public:
public:
static
unsigned
char
selftype
;
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
ConnectTimeout
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
);
static
void
ConnectTimeout
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
);
static
void
StopClient
(
bool
is_exiting
=
false
);
static
void
StopClient
(
bool
is_exiting
=
false
);
...
...
gframe/game.cpp
View file @
501db5c0
...
@@ -1633,7 +1633,7 @@ void Game::AddLog(const wchar_t* msg, int param) {
...
@@ -1633,7 +1633,7 @@ void Game::AddLog(const wchar_t* msg, int param) {
lstLog
->
setSelected
(
-
1
);
lstLog
->
setSelected
(
-
1
);
}
}
}
}
void
Game
::
AddChatMsg
(
const
wchar_t
*
msg
,
int
player
)
{
void
Game
::
AddChatMsg
(
const
wchar_t
*
msg
,
int
player
,
bool
play_sound
)
{
for
(
int
i
=
7
;
i
>
0
;
--
i
)
{
for
(
int
i
=
7
;
i
>
0
;
--
i
)
{
chatMsg
[
i
]
=
chatMsg
[
i
-
1
];
chatMsg
[
i
]
=
chatMsg
[
i
-
1
];
chatTiming
[
i
]
=
chatTiming
[
i
-
1
];
chatTiming
[
i
]
=
chatTiming
[
i
-
1
];
...
@@ -1644,23 +1644,22 @@ void Game::AddChatMsg(const wchar_t* msg, int player) {
...
@@ -1644,23 +1644,22 @@ void Game::AddChatMsg(const wchar_t* msg, int player) {
chatType
[
0
]
=
player
;
chatType
[
0
]
=
player
;
if
(
gameConf
.
hide_player_name
&&
player
<
4
)
if
(
gameConf
.
hide_player_name
&&
player
<
4
)
player
=
10
;
player
=
10
;
if
(
play_sound
)
soundManager
.
PlaySoundEffect
(
SOUND_CHAT
);
switch
(
player
)
{
switch
(
player
)
{
case
0
:
//from host
case
0
:
//from host
chatMsg
[
0
].
append
(
dInfo
.
hostname
);
chatMsg
[
0
].
append
(
dInfo
.
hostname
);
chatMsg
[
0
].
append
(
L": "
);
chatMsg
[
0
].
append
(
L": "
);
break
;
break
;
case
1
:
//from client
case
1
:
//from client
soundManager
.
PlaySoundEffect
(
SOUND_CHAT
);
chatMsg
[
0
].
append
(
dInfo
.
clientname
);
chatMsg
[
0
].
append
(
dInfo
.
clientname
);
chatMsg
[
0
].
append
(
L": "
);
chatMsg
[
0
].
append
(
L": "
);
break
;
break
;
case
2
:
//host tag
case
2
:
//host tag
soundManager
.
PlaySoundEffect
(
SOUND_CHAT
);
chatMsg
[
0
].
append
(
dInfo
.
hostname_tag
);
chatMsg
[
0
].
append
(
dInfo
.
hostname_tag
);
chatMsg
[
0
].
append
(
L": "
);
chatMsg
[
0
].
append
(
L": "
);
break
;
break
;
case
3
:
//client tag
case
3
:
//client tag
soundManager
.
PlaySoundEffect
(
SOUND_CHAT
);
chatMsg
[
0
].
append
(
dInfo
.
clientname_tag
);
chatMsg
[
0
].
append
(
dInfo
.
clientname_tag
);
chatMsg
[
0
].
append
(
L": "
);
chatMsg
[
0
].
append
(
L": "
);
break
;
break
;
...
@@ -1669,7 +1668,6 @@ void Game::AddChatMsg(const wchar_t* msg, int player) {
...
@@ -1669,7 +1668,6 @@ void Game::AddChatMsg(const wchar_t* msg, int player) {
chatMsg
[
0
].
append
(
L": "
);
chatMsg
[
0
].
append
(
L": "
);
break
;
break
;
case
8
:
//system custom message, no prefix.
case
8
:
//system custom message, no prefix.
soundManager
.
PlaySoundEffect
(
SOUND_CHAT
);
chatMsg
[
0
].
append
(
L"[System]: "
);
chatMsg
[
0
].
append
(
L"[System]: "
);
break
;
break
;
case
9
:
//error message
case
9
:
//error message
...
@@ -1780,6 +1778,45 @@ int Game::LocalPlayer(int player) const {
...
@@ -1780,6 +1778,45 @@ int Game::LocalPlayer(int player) const {
int
pid
=
player
?
1
:
0
;
int
pid
=
player
?
1
:
0
;
return
dInfo
.
isFirst
?
pid
:
1
-
pid
;
return
dInfo
.
isFirst
?
pid
:
1
-
pid
;
}
}
int
Game
::
OppositePlayer
(
int
player
)
const
{
if
(
dInfo
.
isTag
)
{
if
(
player
==
0
)
return
2
;
if
(
player
==
1
)
return
3
;
if
(
player
==
2
)
return
0
;
if
(
player
==
3
)
return
1
;
return
player
;
}
else
return
1
-
player
;
}
int
Game
::
ChatLocalPlayer
(
int
player
)
const
{
if
(
player
>
3
)
return
player
;
bool
is_self
;
if
(
dInfo
.
isStarted
||
is_siding
)
{
if
(
dInfo
.
isInDuel
)
// when in duel
player
=
mainGame
->
dInfo
.
isFirst
?
player
:
OppositePlayer
(
player
);
else
{
// when changing side or waiting tp result
auto
selftype_boundary
=
dInfo
.
isTag
?
2
:
1
;
if
(
DuelClient
::
selftype
>=
selftype_boundary
&&
DuelClient
::
selftype
<
4
)
player
=
OppositePlayer
(
player
);
}
if
(
dInfo
.
isTag
)
{
is_self
=
(
player
&
0x2
)
==
0
&&
(
player
&
0x1
)
==
(
DuelClient
::
selftype
&
0x1
);
}
else
{
is_self
=
(
player
==
0
);
}
return
player
|
(
is_self
?
0x10
:
0
);
}
else
{
// when in lobby
return
player
|
(
player
==
DuelClient
::
selftype
?
0x10
:
0
);
}
}
const
wchar_t
*
Game
::
LocalName
(
int
local_player
)
{
const
wchar_t
*
Game
::
LocalName
(
int
local_player
)
{
return
local_player
==
0
?
dInfo
.
hostname
:
dInfo
.
clientname
;
return
local_player
==
0
?
dInfo
.
hostname
:
dInfo
.
clientname
;
}
}
...
...
gframe/game.h
View file @
501db5c0
...
@@ -159,7 +159,7 @@ public:
...
@@ -159,7 +159,7 @@ public:
void
ShowCardInfo
(
int
code
,
bool
resize
=
false
);
void
ShowCardInfo
(
int
code
,
bool
resize
=
false
);
void
ClearCardInfo
(
int
player
=
0
);
void
ClearCardInfo
(
int
player
=
0
);
void
AddLog
(
const
wchar_t
*
msg
,
int
param
=
0
);
void
AddLog
(
const
wchar_t
*
msg
,
int
param
=
0
);
void
AddChatMsg
(
const
wchar_t
*
msg
,
int
player
);
void
AddChatMsg
(
const
wchar_t
*
msg
,
int
player
,
bool
play_sound
=
false
);
void
ClearChatMsg
();
void
ClearChatMsg
();
void
AddDebugMsg
(
const
char
*
msgbuf
);
void
AddDebugMsg
(
const
char
*
msgbuf
);
void
ErrorLog
(
const
char
*
msgbuf
);
void
ErrorLog
(
const
char
*
msgbuf
);
...
@@ -169,6 +169,8 @@ public:
...
@@ -169,6 +169,8 @@ public:
void
CloseDuelWindow
();
void
CloseDuelWindow
();
int
LocalPlayer
(
int
player
)
const
;
int
LocalPlayer
(
int
player
)
const
;
int
OppositePlayer
(
int
player
)
const
;
int
ChatLocalPlayer
(
int
player
)
const
;
const
wchar_t
*
LocalName
(
int
local_player
);
const
wchar_t
*
LocalName
(
int
local_player
);
bool
HasFocus
(
EGUI_ELEMENT_TYPE
type
)
const
{
bool
HasFocus
(
EGUI_ELEMENT_TYPE
type
)
const
{
...
...
gframe/replay_mode.cpp
View file @
501db5c0
...
@@ -273,7 +273,6 @@ void ReplayMode::EndDuel() {
...
@@ -273,7 +273,6 @@ void ReplayMode::EndDuel() {
}
}
void
ReplayMode
::
Restart
(
bool
refresh
)
{
void
ReplayMode
::
Restart
(
bool
refresh
)
{
end_duel
(
pduel
);
end_duel
(
pduel
);
mainGame
->
dInfo
.
isInDuel
=
false
;
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isInDuel
=
false
;
mainGame
->
dInfo
.
isInDuel
=
false
;
mainGame
->
dInfo
.
isFinished
=
true
;
mainGame
->
dInfo
.
isFinished
=
true
;
...
...
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