Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赤子奈落
ygopro
Commits
1865f9a0
Commit
1865f9a0
authored
Jan 20, 2012
by
argon.sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
recon
parent
2b9d65a0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
57 additions
and
24 deletions
+57
-24
gframe/duelclient.cpp
gframe/duelclient.cpp
+12
-5
gframe/duelclient.h
gframe/duelclient.h
+3
-0
gframe/event_handler.cpp
gframe/event_handler.cpp
+17
-0
gframe/game.cpp
gframe/game.cpp
+20
-0
gframe/game.h
gframe/game.h
+1
-0
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+0
-17
gframe/single_duel.cpp
gframe/single_duel.cpp
+4
-2
No files found.
gframe/duelclient.cpp
View file @
1865f9a0
...
...
@@ -10,6 +10,9 @@ namespace ygo {
unsigned
DuelClient
::
connect_state
=
0
;
unsigned
char
DuelClient
::
response_buf
[
64
];
unsigned
char
DuelClient
::
response_len
=
0
;
unsigned
int
DuelClient
::
watching
=
0
;
unsigned
char
DuelClient
::
selftype
=
0
;
bool
DuelClient
::
is_host
=
false
;
event_base
*
DuelClient
::
client_base
=
0
;
bufferevent
*
DuelClient
::
client_bev
=
0
;
char
DuelClient
::
duel_client_read
[
0x2000
];
...
...
@@ -139,9 +142,6 @@ int DuelClient::ClientThread(void* param) {
}
void
DuelClient
::
HandleSTOCPacketLan
(
char
*
data
,
unsigned
int
len
)
{
char
*
pdata
=
data
;
static
unsigned
int
watching
=
0
;
static
unsigned
char
selftype
=
0
;
static
bool
is_host
=
false
;
unsigned
char
pktType
=
BufferIO
::
ReadUInt8
(
pdata
);
switch
(
pktType
)
{
case
STOC_GAME_MSG
:
{
...
...
@@ -191,10 +191,10 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
}
case
STOC_HAND_RESULT
:
{
STOC_HandResult
*
pkt
=
(
STOC_HandResult
*
)
pdata
;
mainGame
->
showcard
=
100
;
mainGame
->
showcardcode
=
pkt
->
res1
+
(
pkt
->
res2
<<
16
);
mainGame
->
showcarddif
=
50
;
mainGame
->
showcardp
=
0
;
mainGame
->
showcard
=
100
;
mainGame
->
WaitFrameSignal
(
60
);
break
;
}
...
...
@@ -272,13 +272,20 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
}
case
STOC_DUEL_START
:
{
mainGame
->
HideElement
(
mainGame
->
wHostSingle
);
mainGame
->
WaitFrameSignal
(
1
0
);
mainGame
->
WaitFrameSignal
(
1
1
);
mainGame
->
gMutex
.
Lock
();
mainGame
->
dField
.
Clear
();
mainGame
->
dInfo
.
isStarted
=
true
;
mainGame
->
wCardImg
->
setVisible
(
true
);
mainGame
->
wInfos
->
setVisible
(
true
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
dField
);
if
(
selftype
!=
1
)
{
BufferIO
::
CopyWStr
(
mainGame
->
stHostSingleDuelist
[
0
]
->
getText
(),
mainGame
->
dInfo
.
hostname
,
20
);
BufferIO
::
CopyWStr
(
mainGame
->
stHostSingleDuelist
[
1
]
->
getText
(),
mainGame
->
dInfo
.
hostname
,
20
);
}
else
{
BufferIO
::
CopyWStr
(
mainGame
->
stHostSingleDuelist
[
1
]
->
getText
(),
mainGame
->
dInfo
.
hostname
,
20
);
BufferIO
::
CopyWStr
(
mainGame
->
stHostSingleDuelist
[
0
]
->
getText
(),
mainGame
->
dInfo
.
hostname
,
20
);
}
mainGame
->
gMutex
.
Unlock
();
break
;
}
...
...
gframe/duelclient.h
View file @
1865f9a0
...
...
@@ -19,6 +19,9 @@ private:
static
unsigned
int
connect_state
;
static
unsigned
char
response_buf
[
64
];
static
unsigned
char
response_len
;
static
unsigned
int
watching
;
static
unsigned
char
selftype
;
static
bool
is_host
;
static
event_base
*
client_base
;
static
bufferevent
*
client_bev
;
static
char
duel_client_read
[
0x2000
];
...
...
gframe/event_handler.cpp
View file @
1865f9a0
...
...
@@ -22,6 +22,23 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame
->
logParam
.
clear
();
break
;
}
case
BUTTON_HAND1
:
case
BUTTON_HAND2
:
case
BUTTON_HAND3
:
{
mainGame
->
HideElement
(
mainGame
->
wHand
);
CTOS_HandResult
cshr
;
cshr
.
res
=
id
-
BUTTON_HAND1
;
DuelClient
::
SendPacketToServer
(
CTOS_HAND_RESULT
,
cshr
);
break
;
}
case
BUTTON_FIRST
:
case
BUTTON_SECOND
:
{
mainGame
->
HideElement
(
mainGame
->
wFTSelect
);
CTOS_TPResult
cstr
;
cstr
.
res
=
BUTTON_SECOND
-
id
;
DuelClient
::
SendPacketToServer
(
CTOS_TP_RESULT
,
cstr
);
break
;
}
case
BUTTON_REPLAY_START
:
{
if
(
!
mainGame
->
dField
.
is_replaying
)
break
;
...
...
gframe/game.cpp
View file @
1865f9a0
...
...
@@ -733,5 +733,25 @@ void Game::ClearTextures() {
mainGame
->
btnCardSelect
[
4
]
->
setImage
();
imageManager
.
ClearTexture
();
}
void
Game
::
CloseDuelWindow
()
{
wACMessage
->
setVisible
(
false
);
wANAttribute
->
setVisible
(
false
);
wANCard
->
setVisible
(
false
);
wANNumber
->
setVisible
(
false
);
wANRace
->
setVisible
(
false
);
wCardImg
->
setVisible
(
false
);
wCardSelect
->
setVisible
(
false
);
wCmdMenu
->
setVisible
(
false
);
wFTSelect
->
setVisible
(
false
);
wHand
->
setVisible
(
false
);
wInfos
->
setVisible
(
false
);
wMessage
->
setVisible
(
false
);
wOptions
->
setVisible
(
false
);
wPhase
->
setVisible
(
false
);
wPosSelect
->
setVisible
(
false
);
wQuery
->
setVisible
(
false
);
wSelectOption
->
setVisible
(
false
);
wSelectYesNo
->
setVisible
(
false
);
}
}
gframe/game.h
View file @
1865f9a0
...
...
@@ -60,6 +60,7 @@ public:
void
SaveConfig
();
void
ShowCardInfo
(
int
code
);
void
ClearTextures
();
void
CloseDuelWindow
();
int
LocalPlayer
(
int
player
);
const
wchar_t
*
LocalName
(
int
local_player
);
...
...
gframe/menu_handler.cpp
View file @
1865f9a0
...
...
@@ -106,23 +106,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
HideElement
(
mainGame
->
wHostSingle
,
false
,
mainGame
->
wLanWindow
);
break
;
}
case
BUTTON_HAND1
:
case
BUTTON_HAND2
:
case
BUTTON_HAND3
:
{
mainGame
->
HideElement
(
mainGame
->
wHand
);
CTOS_HandResult
cshr
;
cshr
.
res
=
id
-
BUTTON_HAND1
;
DuelClient
::
SendPacketToServer
(
CTOS_HAND_RESULT
,
cshr
);
break
;
}
case
BUTTON_FIRST
:
case
BUTTON_SECOND
:
{
mainGame
->
HideElement
(
mainGame
->
wFTSelect
);
CTOS_TPResult
cstr
;
cstr
.
res
=
BUTTON_SECOND
-
id
;
DuelClient
::
SendPacketToServer
(
CTOS_TP_RESULT
,
cstr
);
break
;
}
case
BUTTON_DECK_EDIT
:
{
mainGame
->
RefreshDeck
(
mainGame
->
cbDBDecks
);
if
(
mainGame
->
cbDBDecks
->
getSelected
()
!=
-
1
)
...
...
gframe/single_duel.cpp
View file @
1865f9a0
...
...
@@ -254,10 +254,12 @@ void SingleDuel::HandResult(DuelPlayer* dp, unsigned char res) {
if
(
hand_result
[
0
]
&&
hand_result
[
1
])
{
STOC_HandResult
schr
;
schr
.
res1
=
hand_result
[
0
];
schr
.
res
1
=
hand_result
[
1
];
schr
.
res
2
=
hand_result
[
1
];
NetServer
::
SendPacketToPlayer
(
players
[
0
],
STOC_HAND_RESULT
,
schr
);
for
(
auto
oit
=
observers
.
begin
();
oit
!=
observers
.
end
();
++
oit
)
NetServer
::
ReSendToPlayer
(
*
oit
);
schr
.
res1
=
hand_result
[
1
];
schr
.
res
1
=
hand_result
[
0
];
schr
.
res
2
=
hand_result
[
0
];
NetServer
::
SendPacketToPlayer
(
players
[
1
],
STOC_HAND_RESULT
,
schr
);
if
(
hand_result
[
0
]
==
hand_result
[
1
])
{
NetServer
::
SendPacketToPlayer
(
players
[
0
],
STOC_SELECT_HAND
);
...
...
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