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
baichixing
ygopro
Commits
71e967d8
Commit
71e967d8
authored
Dec 23, 2023
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Fluorohydride/ygopro
parents
3ae502e1
0220053e
Changes
29
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
835 additions
and
706 deletions
+835
-706
gframe/bufferio.h
gframe/bufferio.h
+7
-7
gframe/client_card.cpp
gframe/client_card.cpp
+69
-56
gframe/client_card.h
gframe/client_card.h
+57
-66
gframe/client_field.cpp
gframe/client_field.cpp
+60
-36
gframe/client_field.h
gframe/client_field.h
+54
-52
gframe/config.h
gframe/config.h
+3
-2
gframe/data_manager.cpp
gframe/data_manager.cpp
+19
-6
gframe/data_manager.h
gframe/data_manager.h
+3
-3
gframe/deck_con.cpp
gframe/deck_con.cpp
+3
-3
gframe/drawing.cpp
gframe/drawing.cpp
+15
-2
gframe/duelclient.cpp
gframe/duelclient.cpp
+17
-16
gframe/duelclient.h
gframe/duelclient.h
+8
-8
gframe/event_handler.cpp
gframe/event_handler.cpp
+42
-5
gframe/game.cpp
gframe/game.cpp
+36
-5
gframe/game.h
gframe/game.h
+44
-26
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+2
-2
gframe/netserver.cpp
gframe/netserver.cpp
+4
-4
gframe/netserver.h
gframe/netserver.h
+6
-6
gframe/network.h
gframe/network.h
+17
-22
gframe/replay.h
gframe/replay.h
+1
-2
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+71
-81
gframe/replay_mode.h
gframe/replay_mode.h
+6
-6
gframe/single_duel.cpp
gframe/single_duel.cpp
+112
-122
gframe/single_duel.h
gframe/single_duel.h
+17
-15
gframe/single_mode.cpp
gframe/single_mode.cpp
+64
-77
gframe/single_mode.h
gframe/single_mode.h
+6
-2
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+81
-72
gframe/tag_duel.h
gframe/tag_duel.h
+5
-2
strings.conf
strings.conf
+6
-0
No files found.
gframe/bufferio.h
View file @
71e967d8
...
...
@@ -7,35 +7,35 @@
class
BufferIO
{
public:
inline
static
int
ReadInt32
(
char
*&
p
)
{
inline
static
int
ReadInt32
(
unsigned
char
*&
p
)
{
int
ret
=
*
(
int
*
)
p
;
p
+=
4
;
return
ret
;
}
inline
static
short
ReadInt16
(
char
*&
p
)
{
inline
static
short
ReadInt16
(
unsigned
char
*&
p
)
{
short
ret
=
*
(
short
*
)
p
;
p
+=
2
;
return
ret
;
}
inline
static
char
ReadInt8
(
char
*&
p
)
{
inline
static
char
ReadInt8
(
unsigned
char
*&
p
)
{
char
ret
=
*
(
char
*
)
p
;
p
++
;
return
ret
;
}
inline
static
unsigned
char
ReadUInt8
(
char
*&
p
)
{
inline
static
unsigned
char
ReadUInt8
(
unsigned
char
*&
p
)
{
unsigned
char
ret
=
*
(
unsigned
char
*
)
p
;
p
++
;
return
ret
;
}
inline
static
void
WriteInt32
(
char
*&
p
,
int
val
)
{
inline
static
void
WriteInt32
(
unsigned
char
*&
p
,
int
val
)
{
(
*
(
int
*
)
p
)
=
val
;
p
+=
4
;
}
inline
static
void
WriteInt16
(
char
*&
p
,
short
val
)
{
inline
static
void
WriteInt16
(
unsigned
char
*&
p
,
short
val
)
{
(
*
(
short
*
)
p
)
=
val
;
p
+=
2
;
}
inline
static
void
WriteInt8
(
char
*&
p
,
char
val
)
{
inline
static
void
WriteInt8
(
unsigned
char
*&
p
,
char
val
)
{
*
p
=
val
;
p
++
;
}
...
...
gframe/client_card.cpp
View file @
71e967d8
...
...
@@ -5,50 +5,27 @@
namespace
ygo
{
ClientCard
::
ClientCard
()
{
curAlpha
=
255
;
dAlpha
=
0
;
aniFrame
=
0
;
is_moving
=
false
;
is_fading
=
false
;
is_hovered
=
false
;
is_selectable
=
false
;
is_selected
=
false
;
is_showequip
=
false
;
is_showtarget
=
false
;
is_showchaintarget
=
false
;
is_highlighting
=
false
;
status
=
0
;
is_reversed
=
false
;
cmdFlag
=
0
;
code
=
0
;
chain_code
=
0
;
location
=
0
;
type
=
0
;
alias
=
0
;
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
;
ClientCard
::~
ClientCard
()
{
ClearTarget
();
if
(
equipTarget
)
equipTarget
->
equipped
.
erase
(
this
);
for
(
auto
card
:
equipped
)
{
card
->
equipTarget
=
nullptr
;
}
equipped
.
clear
();
if
(
overlayTarget
)
{
for
(
auto
it
=
overlayTarget
->
overlayed
.
begin
();
it
!=
overlayTarget
->
overlayed
.
end
();
)
{
if
(
*
it
==
this
)
{
it
=
overlayTarget
->
overlayed
.
erase
(
it
);
}
else
++
it
;
}
}
for
(
auto
card
:
overlayed
)
{
card
->
overlayTarget
=
nullptr
;
}
overlayed
.
clear
();
}
void
ClientCard
::
SetCode
(
int
code
)
{
if
((
location
==
LOCATION_HAND
)
&&
(
this
->
code
!=
(
unsigned
int
)
code
))
{
...
...
@@ -57,13 +34,16 @@ void ClientCard::SetCode(int code) {
}
else
this
->
code
=
code
;
}
void
ClientCard
::
UpdateInfo
(
char
*
buf
)
{
void
ClientCard
::
UpdateInfo
(
unsigned
char
*
buf
)
{
int
flag
=
BufferIO
::
ReadInt32
(
buf
);
if
(
flag
==
0
)
if
(
flag
==
0
)
{
ClearData
();
return
;
int
pdata
;
}
if
(
flag
&
QUERY_CODE
)
{
pdata
=
BufferIO
::
ReadInt32
(
buf
);
int
pdata
=
BufferIO
::
ReadInt32
(
buf
);
if
(
!
pdata
)
ClearData
();
if
((
location
==
LOCATION_HAND
)
&&
((
unsigned
int
)
pdata
!=
code
))
{
code
=
pdata
;
mainGame
->
dField
.
MoveCard
(
this
,
5
);
...
...
@@ -71,7 +51,7 @@ void ClientCard::UpdateInfo(char* buf) {
code
=
pdata
;
}
if
(
flag
&
QUERY_POSITION
)
{
pdata
=
(
BufferIO
::
ReadInt32
(
buf
)
>>
24
)
&
0xff
;
int
pdata
=
(
BufferIO
::
ReadInt32
(
buf
)
>>
24
)
&
0xff
;
if
((
location
&
(
LOCATION_EXTRA
|
LOCATION_REMOVED
))
&&
(
u8
)
pdata
!=
position
)
{
position
=
pdata
;
mainGame
->
dField
.
MoveCard
(
this
,
1
);
...
...
@@ -83,14 +63,14 @@ void ClientCard::UpdateInfo(char* buf) {
if
(
flag
&
QUERY_TYPE
)
type
=
BufferIO
::
ReadInt32
(
buf
);
if
(
flag
&
QUERY_LEVEL
)
{
pdata
=
BufferIO
::
ReadInt32
(
buf
);
int
pdata
=
BufferIO
::
ReadInt32
(
buf
);
if
(
level
!=
(
unsigned
int
)
pdata
)
{
level
=
pdata
;
myswprintf
(
lvstring
,
L"L%d"
,
level
);
}
}
if
(
flag
&
QUERY_RANK
)
{
pdata
=
BufferIO
::
ReadInt32
(
buf
);
int
pdata
=
BufferIO
::
ReadInt32
(
buf
);
if
(
pdata
&&
rank
!=
(
unsigned
int
)
pdata
)
{
rank
=
pdata
;
myswprintf
(
lvstring
,
L"R%d"
,
rank
);
...
...
@@ -133,8 +113,10 @@ void ClientCard::UpdateInfo(char* buf) {
int
s
=
BufferIO
::
ReadInt8
(
buf
);
BufferIO
::
ReadInt8
(
buf
);
ClientCard
*
ecard
=
mainGame
->
dField
.
GetCard
(
mainGame
->
LocalPlayer
(
c
),
l
,
s
);
equipTarget
=
ecard
;
ecard
->
equipped
.
insert
(
this
);
if
(
ecard
)
{
equipTarget
=
ecard
;
ecard
->
equipped
.
insert
(
this
);
}
}
if
(
flag
&
QUERY_TARGET_CARD
)
{
int
count
=
BufferIO
::
ReadInt32
(
buf
);
...
...
@@ -144,8 +126,10 @@ void ClientCard::UpdateInfo(char* buf) {
int
s
=
BufferIO
::
ReadInt8
(
buf
);
BufferIO
::
ReadInt8
(
buf
);
ClientCard
*
tcard
=
mainGame
->
dField
.
GetCard
(
mainGame
->
LocalPlayer
(
c
),
l
,
s
);
cardTarget
.
insert
(
tcard
);
tcard
->
ownerTarget
.
insert
(
this
);
if
(
tcard
)
{
cardTarget
.
insert
(
tcard
);
tcard
->
ownerTarget
.
insert
(
this
);
}
}
}
if
(
flag
&
QUERY_OVERLAY_CARD
)
{
...
...
@@ -175,7 +159,7 @@ void ClientCard::UpdateInfo(char* buf) {
myswprintf
(
rscstring
,
L"%d"
,
rscale
);
}
if
(
flag
&
QUERY_LINK
)
{
pdata
=
BufferIO
::
ReadInt32
(
buf
);
int
pdata
=
BufferIO
::
ReadInt32
(
buf
);
if
(
link
!=
(
unsigned
int
)
pdata
)
{
link
=
pdata
;
}
...
...
@@ -198,6 +182,35 @@ void ClientCard::ClearTarget() {
cardTarget
.
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
)
{
if
(
c1
->
is_selected
!=
c2
->
is_selected
)
return
c1
->
is_selected
<
c2
->
is_selected
;
...
...
gframe/client_card.h
View file @
71e967d8
...
...
@@ -2,6 +2,7 @@
#define CLIENT_CARD_H
#include "config.h"
#include "../ocgcore/card_data.h"
#include <vector>
#include <set>
#include <map>
...
...
@@ -9,20 +10,7 @@
namespace
ygo
{
struct
CardData
{
unsigned
int
code
;
unsigned
int
alias
;
unsigned
long
long
setcode
;
unsigned
int
type
;
unsigned
int
level
;
unsigned
int
attribute
;
unsigned
int
race
;
int
attack
;
int
defense
;
unsigned
int
lscale
;
unsigned
int
rscale
;
unsigned
int
link_marker
;
};
using
CardData
=
card_data
;
struct
CardDataC
{
unsigned
int
code
;
unsigned
int
alias
;
...
...
@@ -53,67 +41,70 @@ public:
irr
::
core
::
vector3df
curRot
;
irr
::
core
::
vector3df
dPos
;
irr
::
core
::
vector3df
dRot
;
u32
curAlpha
;
u32
dAlpha
;
u32
aniFrame
;
bool
is_moving
;
bool
is_fading
;
bool
is_hovered
;
bool
is_selectable
;
bool
is_selected
;
bool
is_showequip
;
bool
is_showtarget
;
bool
is_showchaintarget
;
bool
is_highlighting
;
bool
is_reversed
;
u32
code
;
u32
chain_code
;
u32
alias
;
u32
type
;
u32
level
;
u32
rank
;
u32
link
;
u32
attribute
;
u32
race
;
s32
attack
;
s32
defense
;
s32
base_attack
;
s32
base_defense
;
u32
lscale
;
u32
rscale
;
u32
link_marker
;
u32
reason
;
u32
select_seq
;
u8
owner
;
u8
controler
;
u8
location
;
u8
sequence
;
u8
position
;
u32
status
;
u8
cHint
;
u32
chValue
;
u32
opParam
;
u32
symbol
;
u32
cmdFlag
;
ClientCard
*
overlayTarget
;
u32
curAlpha
{
255
};
u32
dAlpha
{
0
};
u32
aniFrame
{
0
};
bool
is_moving
{
false
};
bool
is_fading
{
false
};
bool
is_hovered
{
false
};
bool
is_selectable
{
false
};
bool
is_selected
{
false
};
bool
is_showequip
{
false
};
bool
is_showtarget
{
false
};
bool
is_showchaintarget
{
false
};
bool
is_highlighting
{
false
};
bool
is_reversed
{
false
};
unsigned
int
code
{
0
};
unsigned
int
chain_code
{
0
};
unsigned
int
alias
{
0
};
unsigned
int
type
{
0
};
unsigned
int
level
{
0
};
unsigned
int
rank
{
0
};
unsigned
int
link
{
0
};
unsigned
int
attribute
{
0
};
unsigned
int
race
{
0
};
int
attack
{
0
};
int
defense
{
0
};
int
base_attack
{
0
};
int
base_defense
{
0
};
unsigned
int
lscale
{
0
};
unsigned
int
rscale
{
0
};
unsigned
int
link_marker
{
0
};
unsigned
int
reason
{
0
};
unsigned
int
select_seq
{
0
};
unsigned
char
owner
{
PLAYER_NONE
};
unsigned
char
controler
{
PLAYER_NONE
};
unsigned
char
location
{
0
};
unsigned
char
sequence
{
0
};
unsigned
char
position
{
0
};
unsigned
int
status
{
0
};
unsigned
char
cHint
{
0
};
unsigned
int
chValue
{
0
};
unsigned
int
opParam
{
0
};
unsigned
int
symbol
{
0
};
unsigned
int
cmdFlag
{
0
};
ClientCard
*
overlayTarget
{
nullptr
};
std
::
vector
<
ClientCard
*>
overlayed
;
ClientCard
*
equipTarget
;
ClientCard
*
equipTarget
{
nullptr
}
;
std
::
set
<
ClientCard
*>
equipped
;
std
::
set
<
ClientCard
*>
cardTarget
;
std
::
set
<
ClientCard
*>
ownerTarget
;
std
::
map
<
int
,
int
>
counters
;
std
::
map
<
int
,
int
>
desc_hints
;
wchar_t
atkstring
[
16
];
wchar_t
defstring
[
16
];
wchar_t
lvstring
[
16
];
wchar_t
linkstring
[
16
];
wchar_t
lscstring
[
16
];
wchar_t
rscstring
[
16
];
wchar_t
atkstring
[
16
]
{
0
}
;
wchar_t
defstring
[
16
]
{
0
}
;
wchar_t
lvstring
[
16
]
{
0
}
;
wchar_t
linkstring
[
16
]
{
0
}
;
wchar_t
lscstring
[
16
]
{
0
}
;
wchar_t
rscstring
[
16
]
{
0
}
;
ClientCard
();
ClientCard
()
=
default
;
~
ClientCard
();
void
SetCode
(
int
code
);
void
UpdateInfo
(
char
*
buf
);
void
UpdateInfo
(
unsigned
char
*
buf
);
void
ClearTarget
();
void
ClearData
();
static
bool
client_card_sort
(
ClientCard
*
c1
,
ClientCard
*
c2
);
static
bool
deck_sort_lv
(
code_pointer
l1
,
code_pointer
l2
);
static
bool
deck_sort_atk
(
code_pointer
l1
,
code_pointer
l2
);
...
...
gframe/client_field.cpp
View file @
71e967d8
...
...
@@ -11,31 +11,50 @@
namespace
ygo
{
ClientField
::
ClientField
()
{
panel
=
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
)
{
mzone
[
p
].
resize
(
7
,
0
);
szone
[
p
].
resize
(
8
,
0
);
}
rnd
.
reset
(
std
::
random_device
()());
rnd
.
reset
((
uint_fast32_t
)
std
::
random_device
()());
}
ClientField
::~
ClientField
()
{
for
(
int
i
=
0
;
i
<
2
;
++
i
)
{
for
(
auto
card
:
deck
[
i
])
{
delete
card
;
}
deck
[
i
].
clear
();
for
(
auto
card
:
hand
[
i
])
{
delete
card
;
}
hand
[
i
].
clear
();
for
(
auto
card
:
mzone
[
i
])
{
if
(
card
)
delete
card
;
card
=
nullptr
;
}
for
(
auto
card
:
szone
[
i
])
{
if
(
card
)
delete
card
;
card
=
nullptr
;
}
for
(
auto
card
:
grave
[
i
])
{
delete
card
;
}
grave
[
i
].
clear
();
for
(
auto
card
:
remove
[
i
])
{
delete
card
;
}
remove
[
i
].
clear
();
for
(
auto
card
:
extra
[
i
])
{
delete
card
;
}
extra
[
i
].
clear
();
}
for
(
auto
card
:
overlay_cards
)
{
delete
card
;
}
overlay_cards
.
clear
();
}
void
ClientField
::
Clear
()
{
for
(
int
i
=
0
;
i
<
2
;
++
i
)
{
...
...
@@ -303,12 +322,13 @@ ClientCard* ClientField::RemoveCard(int controler, int location, int sequence) {
pcard
->
location
=
0
;
return
pcard
;
}
void
ClientField
::
UpdateCard
(
int
controler
,
int
location
,
int
sequence
,
char
*
data
)
{
void
ClientField
::
UpdateCard
(
int
controler
,
int
location
,
int
sequence
,
unsigned
char
*
data
)
{
ClientCard
*
pcard
=
GetCard
(
controler
,
location
,
sequence
);
if
(
pcard
)
pcard
->
UpdateInfo
(
data
+
4
);
int
len
=
BufferIO
::
ReadInt32
(
data
);
if
(
pcard
&&
len
>
LEN_HEADER
)
pcard
->
UpdateInfo
(
data
);
}
void
ClientField
::
UpdateFieldCard
(
int
controler
,
int
location
,
char
*
data
)
{
void
ClientField
::
UpdateFieldCard
(
int
controler
,
int
location
,
unsigned
char
*
data
)
{
std
::
vector
<
ClientCard
*>*
lst
=
0
;
switch
(
location
)
{
case
LOCATION_DECK
:
...
...
@@ -338,7 +358,7 @@ void ClientField::UpdateFieldCard(int controler, int location, char* data) {
int
len
;
for
(
auto
cit
=
lst
->
begin
();
cit
!=
lst
->
end
();
++
cit
)
{
len
=
BufferIO
::
ReadInt32
(
data
);
if
(
len
>
8
)
if
(
len
>
LEN_HEADER
)
(
*
cit
)
->
UpdateInfo
(
data
);
data
+=
len
-
4
;
}
...
...
@@ -595,11 +615,11 @@ void ClientField::ShowLocationCard() {
mainGame
->
stDisplayPos
[
i
]
->
setBackgroundColor
(
0xffffffff
);
}
else
if
(
display_cards
[
i
]
->
location
==
LOCATION_EXTRA
||
display_cards
[
i
]
->
location
==
LOCATION_REMOVED
)
{
if
(
display_cards
[
i
]
->
position
&
POS_FACEDOWN
)
mainGame
->
st
Card
Pos
[
i
]
->
setOverrideColor
(
0xff0000ff
);
mainGame
->
st
Display
Pos
[
i
]
->
setOverrideColor
(
0xff0000ff
);
if
(
display_cards
[
i
]
->
controler
)
mainGame
->
st
Card
Pos
[
i
]
->
setBackgroundColor
(
0xffd0d0d0
);
else
mainGame
->
st
Card
Pos
[
i
]
->
setBackgroundColor
(
0xffffffff
);
mainGame
->
st
Display
Pos
[
i
]
->
setBackgroundColor
(
0xffd0d0d0
);
else
mainGame
->
st
Display
Pos
[
i
]
->
setBackgroundColor
(
0xffffffff
);
}
else
{
if
(
display_cards
[
i
]
->
controler
)
mainGame
->
stDisplayPos
[
i
]
->
setBackgroundColor
(
0xffd0d0d0
);
...
...
@@ -848,6 +868,9 @@ void ClientField::GetCardLocation(ClientCard* pcard, irr::core::vector3df* t, ir
int
sequence
=
pcard
->
sequence
;
int
location
=
pcard
->
location
;
int
rule
=
(
mainGame
->
dInfo
.
duel_rule
>=
4
)
?
1
:
0
;
const
float
overlay_buttom
=
0.0
f
;
const
float
material_height
=
0.003
f
;
const
float
mzone_buttom
=
0.020
f
;
switch
(
location
)
{
case
LOCATION_DECK
:
{
t
->
X
=
(
matManager
.
vFieldDeck
[
controler
][
0
].
Pos
.
X
+
matManager
.
vFieldDeck
[
controler
][
1
].
Pos
.
X
)
/
2
;
...
...
@@ -927,7 +950,7 @@ void ClientField::GetCardLocation(ClientCard* pcard, irr::core::vector3df* t, ir
case
LOCATION_MZONE
:
{
t
->
X
=
(
matManager
.
vFieldMzone
[
controler
][
sequence
][
0
].
Pos
.
X
+
matManager
.
vFieldMzone
[
controler
][
sequence
][
1
].
Pos
.
X
)
/
2
;
t
->
Y
=
(
matManager
.
vFieldMzone
[
controler
][
sequence
][
0
].
Pos
.
Y
+
matManager
.
vFieldMzone
[
controler
][
sequence
][
2
].
Pos
.
Y
)
/
2
;
t
->
Z
=
0.01
f
;
t
->
Z
=
mzone_buttom
;
if
(
controler
==
0
)
{
if
(
pcard
->
position
&
POS_DEFENSE
)
{
r
->
X
=
0.0
f
;
...
...
@@ -1040,21 +1063,22 @@ void ClientField::GetCardLocation(ClientCard* pcard, irr::core::vector3df* t, ir
break
;
}
case
LOCATION_OVERLAY
:
{
if
(
pcard
->
overlayTarget
->
location
!=
0x4
)
{
if
(
pcard
->
overlayTarget
->
location
!=
LOCATION_MZONE
)
{
return
;
}
int
oseq
=
pcard
->
overlayTarget
->
sequence
;
int
mseq
=
(
sequence
<
MAX_LAYER_COUNT
)
?
sequence
:
(
MAX_LAYER_COUNT
-
1
);
if
(
pcard
->
overlayTarget
->
controler
==
0
)
{
t
->
X
=
(
matManager
.
vFieldMzone
[
0
][
oseq
][
0
].
Pos
.
X
+
matManager
.
vFieldMzone
[
0
][
oseq
][
1
].
Pos
.
X
)
/
2
-
0.12
f
+
0.06
f
*
sequence
;
t
->
X
=
(
matManager
.
vFieldMzone
[
0
][
oseq
][
0
].
Pos
.
X
+
matManager
.
vFieldMzone
[
0
][
oseq
][
1
].
Pos
.
X
)
/
2
-
0.12
f
+
0.06
f
*
mseq
;
t
->
Y
=
(
matManager
.
vFieldMzone
[
0
][
oseq
][
0
].
Pos
.
Y
+
matManager
.
vFieldMzone
[
0
][
oseq
][
2
].
Pos
.
Y
)
/
2
+
0.05
f
;
t
->
Z
=
0.005
f
+
pcard
->
sequence
*
0.0001
f
;
t
->
Z
=
overlay_buttom
+
mseq
*
material_height
;
r
->
X
=
0.0
f
;
r
->
Y
=
0.0
f
;
r
->
Z
=
0.0
f
;
}
else
{
t
->
X
=
(
matManager
.
vFieldMzone
[
1
][
oseq
][
0
].
Pos
.
X
+
matManager
.
vFieldMzone
[
1
][
oseq
][
1
].
Pos
.
X
)
/
2
+
0.12
f
-
0.06
f
*
sequence
;
t
->
X
=
(
matManager
.
vFieldMzone
[
1
][
oseq
][
0
].
Pos
.
X
+
matManager
.
vFieldMzone
[
1
][
oseq
][
1
].
Pos
.
X
)
/
2
+
0.12
f
-
0.06
f
*
mseq
;
t
->
Y
=
(
matManager
.
vFieldMzone
[
1
][
oseq
][
0
].
Pos
.
Y
+
matManager
.
vFieldMzone
[
1
][
oseq
][
2
].
Pos
.
Y
)
/
2
-
0.05
f
;
t
->
Z
=
0.005
f
+
pcard
->
sequence
*
0.0001
f
;
t
->
Z
=
overlay_buttom
+
mseq
*
material_height
;
r
->
X
=
0.0
f
;
r
->
Y
=
0.0
f
;
r
->
Z
=
3.1415926
f
;
...
...
gframe/client_field.h
View file @
71e967d8
...
...
@@ -13,13 +13,13 @@ class ClientCard;
struct
ChainInfo
{
irr
::
core
::
vector3df
chain_pos
;
ClientCard
*
chain_card
;
int
code
;
int
desc
;
int
controler
;
int
location
;
int
sequence
;
bool
solved
;
ClientCard
*
chain_card
{
nullptr
}
;
int
code
{
0
}
;
int
desc
{
0
}
;
int
controler
{
0
}
;
int
location
{
0
}
;
int
sequence
{
0
}
;
bool
solved
{
false
}
;
std
::
set
<
ClientCard
*>
target
;
};
...
...
@@ -33,6 +33,7 @@ public:
std
::
vector
<
ClientCard
*>
remove
[
2
];
std
::
vector
<
ClientCard
*>
extra
[
2
];
std
::
set
<
ClientCard
*>
overlay_cards
;
std
::
vector
<
ClientCard
*>
summonable_cards
;
std
::
vector
<
ClientCard
*>
spsummonable_cards
;
std
::
vector
<
ClientCard
*>
msetable_cards
;
...
...
@@ -45,25 +46,25 @@ public:
std
::
vector
<
int
>
select_options
;
std
::
vector
<
int
>
select_options_index
;
std
::
vector
<
ChainInfo
>
chains
;
int
extra_p_count
[
2
];
int
extra_p_count
[
2
]
{
0
}
;
size_t
selected_option
;
ClientCard
*
attacker
;
ClientCard
*
attack_target
;
unsigned
int
disabled_field
;
unsigned
int
selectable_field
;
unsigned
int
selected_field
;
int
select_min
;
int
select_max
;
int
must_select_count
;
int
select_sumval
;
int
select_mode
;
bool
select_cancelable
;
bool
select_panalmode
;
bool
select_ready
;
int
announce_count
;
int
select_counter_count
;
int
select_counter_type
;
size_t
selected_option
{
0
}
;
ClientCard
*
attacker
{
nullptr
}
;
ClientCard
*
attack_target
{
nullptr
}
;
unsigned
int
disabled_field
{
0
}
;
unsigned
int
selectable_field
{
0
}
;
unsigned
int
selected_field
{
0
}
;
int
select_min
{
0
}
;
int
select_max
{
0
}
;
int
must_select_count
{
0
}
;
int
select_sumval
{
0
}
;
int
select_mode
{
0
}
;
bool
select_cancelable
{
false
}
;
bool
select_panalmode
{
false
}
;
bool
select_ready
{
false
}
;
int
announce_count
{
0
}
;
int
select_counter_count
{
0
}
;
int
select_counter_type
{
0
}
;
std
::
vector
<
ClientCard
*>
selectable_cards
;
std
::
vector
<
ClientCard
*>
selected_cards
;
std
::
set
<
ClientCard
*>
selectsum_cards
;
...
...
@@ -72,28 +73,29 @@ public:
std
::
vector
<
ClientCard
*>
display_cards
;
std
::
vector
<
int
>
sort_list
;
std
::
map
<
int
,
int
>
player_desc_hints
[
2
];
bool
grave_act
;
bool
remove_act
;
bool
deck_act
;
bool
extra_act
;
bool
pzone_act
[
2
];
bool
conti_act
;
bool
chain_forced
;
bool
grave_act
{
false
}
;
bool
remove_act
{
false
}
;
bool
deck_act
{
false
}
;
bool
extra_act
{
false
}
;
bool
pzone_act
[
2
]
{
false
}
;
bool
conti_act
{
false
}
;
bool
chain_forced
{
false
}
;
ChainInfo
current_chain
;
bool
last_chain
;
bool
deck_reversed
;
bool
conti_selecting
;
bool
cant_check_grave
;
bool
last_chain
{
false
}
;
bool
deck_reversed
{
false
}
;
bool
conti_selecting
{
false
}
;
bool
cant_check_grave
{
false
}
;
mt19937
rnd
;
ClientField
();
~
ClientField
();
void
Clear
();
void
Initial
(
int
player
,
int
deckc
,
int
extrac
);
ClientCard
*
GetCard
(
int
controler
,
int
location
,
int
sequence
,
int
sub_seq
=
0
);
void
AddCard
(
ClientCard
*
pcard
,
int
controler
,
int
location
,
int
sequence
);
ClientCard
*
RemoveCard
(
int
controler
,
int
location
,
int
sequence
);
void
UpdateCard
(
int
controler
,
int
location
,
int
sequence
,
char
*
data
);
void
UpdateFieldCard
(
int
controler
,
int
location
,
char
*
data
);
void
UpdateCard
(
int
controler
,
int
location
,
int
sequence
,
unsigned
char
*
data
);
void
UpdateFieldCard
(
int
controler
,
int
location
,
unsigned
char
*
data
);
void
ClearCommandFlag
();
void
ClearSelect
();
void
ClearChainSelect
();
...
...
@@ -121,21 +123,21 @@ public:
void
UpdateDeclarableList
();
irr
::
gui
::
IGUIElement
*
panel
;
irr
::
gui
::
IGUIElement
*
panel
{
nullptr
}
;
std
::
vector
<
int
>
ancard
;
int
hovered_controler
;
int
hovered_location
;
size_t
hovered_sequence
;
int
command_controler
;
int
command_location
;
size_t
command_sequence
;
ClientCard
*
hovered_card
;
int
hovered_player
;
ClientCard
*
clicked_card
;
ClientCard
*
command_card
;
ClientCard
*
highlighting_card
;
ClientCard
*
menu_card
;
int
list_command
;
int
hovered_controler
{
0
}
;
int
hovered_location
{
0
}
;
size_t
hovered_sequence
{
0
}
;
int
command_controler
{
0
}
;
int
command_location
{
0
}
;
size_t
command_sequence
{
0
}
;
ClientCard
*
hovered_card
{
nullptr
}
;
int
hovered_player
{
0
}
;
ClientCard
*
clicked_card
{
nullptr
}
;
ClientCard
*
command_card
{
nullptr
}
;
ClientCard
*
highlighting_card
{
nullptr
}
;
ClientCard
*
menu_card
{
nullptr
}
;
int
list_command
{
0
}
;
virtual
bool
OnEvent
(
const
irr
::
SEvent
&
event
);
virtual
bool
OnCommonEvent
(
const
irr
::
SEvent
&
event
);
...
...
gframe/config.h
View file @
71e967d8
...
...
@@ -7,8 +7,8 @@
#define IRR_COMPILE_WITH_DX9_DEV_PACK
#ifdef _WIN32
#include <WinSock2.h>
#define NOMINMAX
#include <WinSock2.h>
#include <windows.h>
#include <ws2tcpip.h>
...
...
@@ -69,7 +69,6 @@ inline int myswprintf(wchar_t(&buf)[N], const wchar_t* fmt, TR... args) {
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <time.h>
#include <thread>
#include <mutex>
...
...
@@ -87,6 +86,8 @@ using namespace video;
using
namespace
io
;
using
namespace
gui
;
typedef
int
BOOL
;
extern
const
unsigned
short
PRO_VERSION
;
extern
int
enable_log
;
extern
bool
exit_on_return
;
...
...
gframe/data_manager.cpp
View file @
71e967d8
...
...
@@ -147,12 +147,25 @@ bool DataManager::Error(spmemvfs_db_t* pDB, sqlite3_stmt* pStmt) {
spmemvfs_env_fini
();
return
false
;
}
bool
DataManager
::
GetData
(
int
code
,
CardData
*
pData
)
{
bool
DataManager
::
GetData
(
unsigned
int
code
,
CardData
*
pData
)
{
auto
cdit
=
_datas
.
find
(
code
);
if
(
cdit
==
_datas
.
end
())
return
false
;
if
(
pData
)
*
pData
=
*
((
CardData
*
)
&
cdit
->
second
);
auto
data
=
cdit
->
second
;
if
(
pData
)
{
pData
->
code
=
data
.
code
;
pData
->
alias
=
data
.
alias
;
pData
->
setcode
=
data
.
setcode
;
pData
->
type
=
data
.
type
;
pData
->
level
=
data
.
level
;
pData
->
attribute
=
data
.
attribute
;
pData
->
race
=
data
.
race
;
pData
->
attack
=
data
.
attack
;
pData
->
defense
=
data
.
defense
;
pData
->
lscale
=
data
.
lscale
;
pData
->
rscale
=
data
.
rscale
;
pData
->
link_marker
=
data
.
link_marker
;
}
return
true
;
}
code_pointer
DataManager
::
GetCodePointer
(
int
code
)
{
...
...
@@ -346,9 +359,9 @@ const wchar_t* DataManager::FormatLinkMarker(int link_marker) {
BufferIO
::
CopyWStrRef
(
L"[\u2198]"
,
p
,
4
);
return
lmBuffer
;
}
int
DataManager
::
CardReader
(
int
code
,
void
*
pData
)
{
if
(
!
dataManager
.
GetData
(
code
,
(
CardData
*
)
pData
))
memset
(
pData
,
0
,
sizeof
(
CardData
)
);
uint32
DataManager
::
CardReader
(
uint32
code
,
card_data
*
pData
)
{
if
(
!
dataManager
.
GetData
(
code
,
pData
))
pData
->
clear
(
);
return
0
;
}
byte
*
DataManager
::
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
)
{
...
...
gframe/data_manager.h
View file @
71e967d8
...
...
@@ -11,13 +11,13 @@ namespace ygo {
class
DataManager
{
public:
DataManager
()
:
_datas
(
8192
),
_strings
(
8192
)
{}
DataManager
()
:
_datas
(
16384
),
_strings
(
16384
)
{}
bool
LoadDB
(
const
wchar_t
*
wfile
);
bool
LoadStrings
(
const
char
*
file
);
bool
LoadStrings
(
IReadFile
*
reader
);
void
ReadStringConfLine
(
const
char
*
linebuf
);
bool
Error
(
spmemvfs_db_t
*
pDB
,
sqlite3_stmt
*
pStmt
=
0
);
bool
GetData
(
int
code
,
CardData
*
pData
);
bool
GetData
(
unsigned
int
code
,
CardData
*
pData
);
code_pointer
GetCodePointer
(
int
code
);
bool
GetString
(
int
code
,
CardString
*
pStr
);
const
wchar_t
*
GetName
(
int
code
);
...
...
@@ -53,7 +53,7 @@ public:
static
byte
scriptBuffer
[
0x20000
];
static
const
wchar_t
*
unknown_string
;
static
int
CardReader
(
int
,
void
*
);
static
uint32
CardReader
(
uint32
,
card_data
*
);
static
byte
*
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
);
static
byte
*
ScriptReader
(
const
char
*
script_name
,
int
*
slen
);
static
IFileSystem
*
FileSystem
;
...
...
gframe/deck_con.cpp
View file @
71e967d8
...
...
@@ -79,7 +79,7 @@ void DeckBuilder::Initialize() {
mainGame
->
btnSideReload
->
setVisible
(
false
);
filterList
=
&
deckManager
.
_lfList
[
mainGame
->
gameConf
.
use_lflist
?
mainGame
->
gameConf
.
default_lflist
:
deckManager
.
_lfList
.
size
()
-
1
].
content
;
ClearSearch
();
rnd
.
reset
((
u
nsigned
in
t
)
time
(
nullptr
));
rnd
.
reset
((
u
int_fast32_
t
)
time
(
nullptr
));
mouse_pos
.
set
(
0
,
0
);
hovered_code
=
0
;
hovered_pos
=
0
;
...
...
@@ -652,8 +652,8 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
mainGame
->
ClearCardInfo
();
char
deckbuf
[
1024
];
char
*
pdeck
=
deckbuf
;
unsigned
char
deckbuf
[
1024
];
auto
pdeck
=
deckbuf
;
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
main
.
size
()
+
deckManager
.
current_deck
.
extra
.
size
());
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
side
.
size
());
for
(
size_t
i
=
0
;
i
<
deckManager
.
current_deck
.
main
.
size
();
++
i
)
...
...
gframe/drawing.cpp
View file @
71e967d8
...
...
@@ -318,8 +318,21 @@ void Game::DrawCards() {
for
(
auto
it
=
dField
.
extra
[
p
].
begin
();
it
!=
dField
.
extra
[
p
].
end
();
++
it
)
DrawCard
(
*
it
);
}
for
(
auto
cit
=
dField
.
overlay_cards
.
begin
();
cit
!=
dField
.
overlay_cards
.
end
();
++
cit
)
DrawCard
(
*
cit
);
for
(
auto
cit
=
dField
.
overlay_cards
.
begin
();
cit
!=
dField
.
overlay_cards
.
end
();
++
cit
)
{
auto
pcard
=
(
*
cit
);
auto
olcard
=
pcard
->
overlayTarget
;
if
(
pcard
->
aniFrame
)
{
DrawCard
(
pcard
);
}
else
if
(
olcard
&&
olcard
->
location
==
LOCATION_MZONE
)
{
if
(
pcard
->
sequence
<
MAX_LAYER_COUNT
)
{
DrawCard
(
pcard
);
}
}
else
{
DrawCard
(
pcard
);
}
}
}
void
Game
::
DrawCard
(
ClientCard
*
pcard
)
{
if
(
pcard
->
aniFrame
)
{
...
...
gframe/duelclient.cpp
View file @
71e967d8
...
...
@@ -19,14 +19,14 @@ 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
];
char
DuelClient
::
duel_client_write
[
0x2000
];
unsigned
char
DuelClient
::
duel_client_read
[
0x2000
];
unsigned
char
DuelClient
::
duel_client_write
[
0x2000
];
bool
DuelClient
::
is_closing
=
false
;
bool
DuelClient
::
is_swapping
=
false
;
int
DuelClient
::
select_hint
=
0
;
int
DuelClient
::
select_unselect_hint
=
0
;
int
DuelClient
::
last_select_hint
=
0
;
char
DuelClient
::
last_successful_msg
[
0x2000
];
unsigned
char
DuelClient
::
last_successful_msg
[
0x2000
];
unsigned
int
DuelClient
::
last_successful_msg_length
=
0
;
wchar_t
DuelClient
::
event_string
[
256
];
mt19937
DuelClient
::
rnd
;
...
...
@@ -58,7 +58,7 @@ bool DuelClient::StartClient(unsigned int ip, unsigned short port, bool create_g
return
false
;
}
connect_state
=
0x1
;
rnd
.
reset
((
u
nsigned
int
)
time
(
nullptr
));
rnd
.
reset
((
u
int_fast32_t
)
std
::
random_device
()(
));
if
(
!
create_game
)
{
timeval
timeout
=
{
5
,
0
};
event
*
resp_event
=
event_new
(
client_base
,
0
,
EV_TIMEOUT
,
ConnectTimeout
,
0
);
...
...
@@ -233,8 +233,8 @@ int DuelClient::ClientThread() {
connect_state
=
0
;
return
0
;
}
void
DuelClient
::
HandleSTOCPacketLan
(
char
*
data
,
unsigned
int
len
)
{
char
*
pdata
=
data
;
void
DuelClient
::
HandleSTOCPacketLan
(
unsigned
char
*
data
,
unsigned
int
len
)
{
unsigned
char
*
pdata
=
data
;
unsigned
char
pktType
=
BufferIO
::
ReadUInt8
(
pdata
);
switch
(
pktType
)
{
case
STOC_GAME_MSG
:
{
...
...
@@ -611,7 +611,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
dField
);
if
(
!
mainGame
->
dInfo
.
isTag
)
{
if
(
selftype
>
1
)
{
mainGame
->
dInfo
.
player_type
=
7
;
mainGame
->
dInfo
.
player_type
=
NETPLAYER_TYPE_OBSERVER
;
mainGame
->
btnLeaveGame
->
setText
(
dataManager
.
GetSysString
(
1350
));
mainGame
->
btnLeaveGame
->
setVisible
(
true
);
mainGame
->
btnSpectatorSwap
->
setVisible
(
true
);
...
...
@@ -689,7 +689,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
if
(
mainGame
->
dInfo
.
player_type
<
7
)
mainGame
->
btnLeaveGame
->
setVisible
(
false
);
mainGame
->
CloseGameButtons
();
char
*
prep
=
pdata
;
auto
prep
=
pdata
;
Replay
new_replay
;
memcpy
(
&
new_replay
.
pheader
,
prep
,
sizeof
(
ReplayHeader
));
time_t
starttime
;
...
...
@@ -882,8 +882,9 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
}
}
}
int
DuelClient
::
ClientAnalyze
(
char
*
msg
,
unsigned
int
len
)
{
char
*
pbuf
=
msg
;
// Analyze STOC_GAME_MSG packet
int
DuelClient
::
ClientAnalyze
(
unsigned
char
*
msg
,
unsigned
int
len
)
{
unsigned
char
*
pbuf
=
msg
;
wchar_t
textBuffer
[
256
];
mainGame
->
dInfo
.
curMsg
=
BufferIO
::
ReadUInt8
(
pbuf
);
if
(
mainGame
->
dInfo
.
curMsg
!=
MSG_RETRY
)
{
...
...
@@ -918,7 +919,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
switch
(
mainGame
->
dInfo
.
curMsg
)
{
case
MSG_RETRY
:
{
if
(
last_successful_msg_length
)
{
char
*
p
=
last_successful_msg
;
auto
p
=
last_successful_msg
;
auto
last_msg
=
BufferIO
::
ReadUInt8
(
p
);
int
err_desc
=
1421
;
switch
(
last_msg
)
{
...
...
@@ -2524,7 +2525,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
int
appear
=
mainGame
->
gameConf
.
quick_animation
?
12
:
20
;
if
(
pl
==
0
)
{
ClientCard
*
pcard
=
new
ClientCard
()
;
ClientCard
*
pcard
=
new
ClientCard
;
pcard
->
position
=
cp
;
pcard
->
SetCode
(
code
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
...
...
@@ -2650,7 +2651,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard
->
overlayTarget
=
olcard
;
pcard
->
location
=
LOCATION_OVERLAY
;
pcard
->
sequence
=
olcard
->
overlayed
.
size
()
-
1
;
if
(
olcard
->
location
==
0x4
)
{
if
(
olcard
->
location
==
LOCATION_MZONE
)
{
mainGame
->
gMutex
.
lock
();
mainGame
->
dField
.
MoveCard
(
pcard
,
10
);
if
(
pl
==
0x2
)
...
...
@@ -3743,7 +3744,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
}
else
{
while
(
mainGame
->
dField
.
deck
[
player
].
size
()
<
mcount
)
{
ClientCard
*
ccard
=
new
ClientCard
()
;
ClientCard
*
ccard
=
new
ClientCard
;
ccard
->
controler
=
player
;
ccard
->
location
=
LOCATION_DECK
;
ccard
->
sequence
=
mainGame
->
dField
.
deck
[
player
].
size
();
...
...
@@ -3758,7 +3759,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
}
else
{
while
(
mainGame
->
dField
.
hand
[
player
].
size
()
<
hcount
)
{
ClientCard
*
ccard
=
new
ClientCard
()
;
ClientCard
*
ccard
=
new
ClientCard
;
ccard
->
controler
=
player
;
ccard
->
location
=
LOCATION_HAND
;
ccard
->
sequence
=
mainGame
->
dField
.
hand
[
player
].
size
();
...
...
@@ -3773,7 +3774,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
}
else
{
while
(
mainGame
->
dField
.
extra
[
player
].
size
()
<
ecount
)
{
ClientCard
*
ccard
=
new
ClientCard
()
;
ClientCard
*
ccard
=
new
ClientCard
;
ccard
->
controler
=
player
;
ccard
->
location
=
LOCATION_EXTRA
;
ccard
->
sequence
=
mainGame
->
dField
.
extra
[
player
].
size
();
...
...
gframe/duelclient.h
View file @
71e967d8
...
...
@@ -27,14 +27,14 @@ private:
static
bool
is_host
;
static
event_base
*
client_base
;
static
bufferevent
*
client_bev
;
static
char
duel_client_read
[
0x2000
];
static
char
duel_client_write
[
0x2000
];
static
unsigned
char
duel_client_read
[
0x2000
];
static
unsigned
char
duel_client_write
[
0x2000
];
static
bool
is_closing
;
static
bool
is_swapping
;
static
int
select_hint
;
static
int
select_unselect_hint
;
static
int
last_select_hint
;
static
char
last_successful_msg
[
0x2000
];
static
unsigned
char
last_successful_msg
[
0x2000
];
static
unsigned
int
last_successful_msg_length
;
static
wchar_t
event_string
[
256
];
static
mt19937
rnd
;
...
...
@@ -45,28 +45,28 @@ public:
static
void
ClientRead
(
bufferevent
*
bev
,
void
*
ctx
);
static
void
ClientEvent
(
bufferevent
*
bev
,
short
events
,
void
*
ctx
);
static
int
ClientThread
();
static
void
HandleSTOCPacketLan
(
char
*
data
,
unsigned
int
len
);
static
int
ClientAnalyze
(
char
*
msg
,
unsigned
int
len
);
static
void
HandleSTOCPacketLan
(
unsigned
char
*
data
,
unsigned
int
len
);
static
int
ClientAnalyze
(
unsigned
char
*
msg
,
unsigned
int
len
);
static
void
SwapField
();
static
void
SetResponseI
(
int
respI
);
static
void
SetResponseB
(
void
*
respB
,
unsigned
char
len
);
static
void
SendResponse
();
static
void
SendPacketToServer
(
unsigned
char
proto
)
{
char
*
p
=
duel_client_write
;
auto
p
=
duel_client_write
;
BufferIO
::
WriteInt16
(
p
,
1
);
BufferIO
::
WriteInt8
(
p
,
proto
);
bufferevent_write
(
client_bev
,
duel_client_write
,
3
);
}
template
<
typename
ST
>
static
void
SendPacketToServer
(
unsigned
char
proto
,
ST
&
st
)
{
char
*
p
=
duel_client_write
;
auto
p
=
duel_client_write
;
BufferIO
::
WriteInt16
(
p
,
1
+
sizeof
(
ST
));
BufferIO
::
WriteInt8
(
p
,
proto
);
memcpy
(
p
,
&
st
,
sizeof
(
ST
));
bufferevent_write
(
client_bev
,
duel_client_write
,
sizeof
(
ST
)
+
3
);
}
static
void
SendBufferToServer
(
unsigned
char
proto
,
void
*
buffer
,
size_t
len
)
{
char
*
p
=
duel_client_write
;
auto
p
=
duel_client_write
;
BufferIO
::
WriteInt16
(
p
,
1
+
len
);
BufferIO
::
WriteInt8
(
p
,
proto
);
memcpy
(
p
,
buffer
,
len
);
...
...
gframe/event_handler.cpp
View file @
71e967d8
...
...
@@ -2232,25 +2232,62 @@ void ClientField::GetHoverField(int x, int y) {
hovered_sequence
=
sequence
;
}
else
if
(
boardy
>=
matManager
.
vFieldMzone
[
0
][
5
][
0
].
Pos
.
Y
&&
boardy
<=
matManager
.
vFieldMzone
[
0
][
5
][
2
].
Pos
.
Y
)
{
if
(
sequence
==
1
)
{
if
(
!
mzone
[
1
][
6
])
{
if
(
mzone
[
0
][
5
])
{
hovered_controler
=
0
;
hovered_location
=
LOCATION_MZONE
;
hovered_sequence
=
5
;
}
else
{
}
else
if
(
mzone
[
1
][
6
])
{
hovered_controler
=
1
;
hovered_location
=
LOCATION_MZONE
;
hovered_sequence
=
6
;
}
}
else
if
(
sequence
==
3
)
{
if
(
!
mzone
[
1
][
5
])
{
else
if
((
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_PLACE
||
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_DISFIELD
))
{
if
(
mainGame
->
dField
.
selectable_field
&
(
0x1
<<
(
16
+
6
)))
{
hovered_controler
=
1
;
hovered_location
=
LOCATION_MZONE
;
hovered_sequence
=
6
;
}
else
{
hovered_controler
=
0
;
hovered_location
=
LOCATION_MZONE
;
hovered_sequence
=
5
;
}
}
else
{
hovered_controler
=
0
;
hovered_location
=
LOCATION_MZONE
;
hovered_sequence
=
5
;
}
}
else
if
(
sequence
==
3
)
{
if
(
mzone
[
0
][
6
])
{
hovered_controler
=
0
;
hovered_location
=
LOCATION_MZONE
;
hovered_sequence
=
6
;
}
else
{
}
else
if
(
mzone
[
1
][
5
])
{
hovered_controler
=
1
;
hovered_location
=
LOCATION_MZONE
;
hovered_sequence
=
5
;
}
else
if
((
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_PLACE
||
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_DISFIELD
))
{
if
(
mainGame
->
dField
.
selectable_field
&
(
0x1
<<
(
16
+
5
)))
{
hovered_controler
=
1
;
hovered_location
=
LOCATION_MZONE
;
hovered_sequence
=
5
;
}
else
{
hovered_controler
=
0
;
hovered_location
=
LOCATION_MZONE
;
hovered_sequence
=
6
;
}
}
else
{
hovered_controler
=
0
;
hovered_location
=
LOCATION_MZONE
;
hovered_sequence
=
6
;
}
}
}
else
if
(
boardy
>=
matManager
.
vFieldMzone
[
1
][
0
][
2
].
Pos
.
Y
&&
boardy
<=
matManager
.
vFieldMzone
[
1
][
0
][
0
].
Pos
.
Y
)
{
hovered_controler
=
1
;
...
...
gframe/game.cpp
View file @
71e967d8
...
...
@@ -16,8 +16,39 @@ namespace ygo {
Game
*
mainGame
;
void
DuelInfo
::
Clear
()
{
isStarted
=
false
;
isFinished
=
false
;
isReplay
=
false
;
isReplaySkiping
=
false
;
isFirst
=
false
;
isTag
=
false
;
isSingleMode
=
false
;
is_shuffling
=
false
;
tag_player
[
0
]
=
false
;
tag_player
[
1
]
=
false
;
isReplaySwapped
=
false
;
lp
[
0
]
=
0
;
lp
[
1
]
=
0
;
start_lp
=
0
;
duel_rule
=
0
;
turn
=
0
;
curMsg
=
0
;
hostname
[
0
]
=
0
;
clientname
[
0
]
=
0
;
hostname_tag
[
0
]
=
0
;
clientname_tag
[
0
]
=
0
;
strLP
[
0
][
0
]
=
0
;
strLP
[
1
][
0
]
=
0
;
vic_string
=
0
;
player_type
=
0
;
time_player
=
0
;
time_limit
=
0
;
time_left
[
0
]
=
0
;
time_left
[
1
]
=
0
;
}
bool
Game
::
Initialize
()
{
srand
(
time
(
0
));
LoadConfig
();
irr
::
SIrrlichtCreationParameters
params
=
irr
::
SIrrlichtCreationParameters
();
params
.
AntiAlias
=
gameConf
.
antialias
;
...
...
@@ -50,8 +81,9 @@ bool Game::Initialize() {
is_building
=
false
;
menuHandler
.
prev_operation
=
0
;
menuHandler
.
prev_sel
=
-
1
;
memset
(
&
dInfo
,
0
,
sizeof
(
DuelInfo
));
memset
(
chatTiming
,
0
,
sizeof
(
chatTiming
));
for
(
auto
i
:
chatTiming
)
{
i
=
0
;
}
deckManager
.
LoadLFList
();
driver
=
device
->
getVideoDriver
();
driver
->
setTextureCreationFlag
(
irr
::
video
::
ETCF_CREATE_MIP_MAPS
,
false
);
...
...
@@ -1542,8 +1574,7 @@ void Game::ShowCardInfo(int code, bool resize) {
return
;
CardData
cd
;
wchar_t
formatBuffer
[
256
];
if
(
!
dataManager
.
GetData
(
code
,
&
cd
))
memset
(
&
cd
,
0
,
sizeof
(
CardData
));
dataManager
.
GetData
(
code
,
&
cd
);
imgCard
->
setImage
(
imageManager
.
GetTexture
(
code
,
true
));
if
(
cd
.
alias
!=
0
&&
(
cd
.
alias
-
code
<
CARD_ARTWORK_VERSIONS_OFFSET
||
code
-
cd
.
alias
<
CARD_ARTWORK_VERSIONS_OFFSET
))
myswprintf
(
formatBuffer
,
L"%ls[%08d]"
,
dataManager
.
GetName
(
cd
.
alias
),
cd
.
alias
);
...
...
gframe/game.h
View file @
71e967d8
...
...
@@ -66,31 +66,33 @@ struct Config {
};
struct
DuelInfo
{
bool
isStarted
;
bool
isFinished
;
bool
isReplay
;
bool
isReplaySkiping
;
bool
isFirst
;
bool
isTag
;
bool
isSingleMode
;
bool
is_shuffling
;
bool
tag_player
[
2
];
int
lp
[
2
];
int
start_lp
;
int
duel_rule
;
int
turn
;
short
curMsg
;
wchar_t
hostname
[
20
];
wchar_t
clientname
[
20
];
wchar_t
hostname_tag
[
20
];
wchar_t
clientname_tag
[
20
];
wchar_t
strLP
[
2
][
16
];
wchar_t
*
vic_string
;
unsigned
char
player_type
;
unsigned
char
time_player
;
unsigned
short
time_limit
;
unsigned
short
time_left
[
2
];
bool
isReplaySwapped
;
bool
isStarted
{
false
};
bool
isFinished
{
false
};
bool
isReplay
{
false
};
bool
isReplaySkiping
{
false
};
bool
isFirst
{
false
};
bool
isTag
{
false
};
bool
isSingleMode
{
false
};
bool
is_shuffling
{
false
};
bool
tag_player
[
2
]{
false
};
bool
isReplaySwapped
{
false
};
int
lp
[
2
]{
0
};
int
start_lp
{
0
};
int
duel_rule
{
0
};
int
turn
{
0
};
short
curMsg
{
0
};
wchar_t
hostname
[
20
]{
0
};
wchar_t
clientname
[
20
]{
0
};
wchar_t
hostname_tag
[
20
]{
0
};
wchar_t
clientname_tag
[
20
]{
0
};
wchar_t
strLP
[
2
][
16
]{
0
};
wchar_t
*
vic_string
{
0
};
unsigned
char
player_type
{
0
};
unsigned
char
time_player
{
0
};
unsigned
short
time_limit
{
0
};
unsigned
short
time_left
[
2
]{
0
};
void
Clear
();
};
struct
BotInfo
{
...
...
@@ -593,6 +595,8 @@ extern Game* mainGame;
}
#define SIZE_QUERY_BUFFER 0x4000
#define CARD_IMG_WIDTH 177
#define CARD_IMG_HEIGHT 254
#define CARD_THUMB_WIDTH 44
...
...
@@ -801,13 +805,27 @@ extern Game* mainGame;
#define BUTTON_BIG_CARD_ZOOM_OUT 382
#define BUTTON_BIG_CARD_ORIG_SIZE 383
//STOC_GAME_MSG messages
#define MSG_WAITING 3
#define MSG_START 4
#define MSG_UPDATE_DATA 6 // flag=0: clear
#define MSG_UPDATE_CARD 7 // flag=QUERY_CODE, code=0: clear
#define MSG_REQUEST_DECK 8
#define MSG_REFRESH_DECK 34
#define MSG_CARD_SELECTED 80
#define MSG_UNEQUIP 95
#define MSG_BE_CHAIN_TARGET 121
#define MSG_CREATE_RELATION 122
#define MSG_RELEASE_RELATION 123
#define AVAIL_OCG 0x1
#define AVAIL_TCG 0x2
#define AVAIL_CUSTOM 0x4
#define AVAIL_SC 0x8
#define AVAIL_OCGTCG (AVAIL_OCG|AVAIL_TCG)
#define DEFAULT_DUEL_RULE
5
#define DEFAULT_DUEL_RULE 5
#define CARD_ARTWORK_VERSIONS_OFFSET 10
#define MAX_LAYER_COUNT 6
#endif // GAME_H
gframe/menu_handler.cpp
View file @
71e967d8
...
...
@@ -16,8 +16,8 @@ void UpdateDeck() {
mainGame
->
gameConf
.
lastcategory
,
64
);
BufferIO
::
CopyWStr
(
mainGame
->
cbDeckSelect
->
getItem
(
mainGame
->
cbDeckSelect
->
getSelected
()),
mainGame
->
gameConf
.
lastdeck
,
64
);
char
deckbuf
[
1024
];
char
*
pdeck
=
deckbuf
;
unsigned
char
deckbuf
[
1024
];
auto
pdeck
=
deckbuf
;
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
main
.
size
()
+
deckManager
.
current_deck
.
extra
.
size
());
BufferIO
::
WriteInt32
(
pdeck
,
deckManager
.
current_deck
.
side
.
size
());
for
(
size_t
i
=
0
;
i
<
deckManager
.
current_deck
.
main
.
size
();
++
i
)
...
...
gframe/netserver.cpp
View file @
71e967d8
...
...
@@ -9,8 +9,8 @@ event_base* NetServer::net_evbase = 0;
event
*
NetServer
::
broadcast_ev
=
0
;
evconnlistener
*
NetServer
::
listener
=
0
;
DuelMode
*
NetServer
::
duel_mode
=
0
;
char
NetServer
::
net_server_read
[
0x2000
];
char
NetServer
::
net_server_write
[
0x2000
];
unsigned
char
NetServer
::
net_server_read
[
0x2000
];
unsigned
char
NetServer
::
net_server_write
[
0x2000
];
unsigned
short
NetServer
::
last_sent
=
0
;
bool
NetServer
::
StartServer
(
unsigned
short
port
)
{
...
...
@@ -171,8 +171,8 @@ void NetServer::DisconnectPlayer(DuelPlayer* dp) {
users
.
erase
(
bit
);
}
}
void
NetServer
::
HandleCTOSPacket
(
DuelPlayer
*
dp
,
char
*
data
,
unsigned
int
len
)
{
char
*
pdata
=
data
;
void
NetServer
::
HandleCTOSPacket
(
DuelPlayer
*
dp
,
unsigned
char
*
data
,
unsigned
int
len
)
{
auto
pdata
=
data
;
unsigned
char
pktType
=
BufferIO
::
ReadUInt8
(
pdata
);
if
((
pktType
!=
CTOS_SURRENDER
)
&&
(
pktType
!=
CTOS_CHAT
)
&&
(
dp
->
state
==
0xff
||
(
dp
->
state
&&
dp
->
state
!=
pktType
)))
return
;
...
...
gframe/netserver.h
View file @
71e967d8
...
...
@@ -18,8 +18,8 @@ private:
static
event
*
broadcast_ev
;
static
evconnlistener
*
listener
;
static
DuelMode
*
duel_mode
;
static
char
net_server_read
[
0x2000
];
static
char
net_server_write
[
0x2000
];
static
unsigned
char
net_server_read
[
0x2000
];
static
unsigned
char
net_server_write
[
0x2000
];
static
unsigned
short
last_sent
;
public:
...
...
@@ -35,9 +35,9 @@ public:
static
void
ServerEchoEvent
(
bufferevent
*
bev
,
short
events
,
void
*
ctx
);
static
int
ServerThread
();
static
void
DisconnectPlayer
(
DuelPlayer
*
dp
);
static
void
HandleCTOSPacket
(
DuelPlayer
*
dp
,
char
*
data
,
unsigned
int
len
);
static
void
HandleCTOSPacket
(
DuelPlayer
*
dp
,
unsigned
char
*
data
,
unsigned
int
len
);
static
void
SendPacketToPlayer
(
DuelPlayer
*
dp
,
unsigned
char
proto
)
{
char
*
p
=
net_server_write
;
auto
p
=
net_server_write
;
BufferIO
::
WriteInt16
(
p
,
1
);
BufferIO
::
WriteInt8
(
p
,
proto
);
last_sent
=
3
;
...
...
@@ -47,7 +47,7 @@ public:
}
template
<
typename
ST
>
static
void
SendPacketToPlayer
(
DuelPlayer
*
dp
,
unsigned
char
proto
,
ST
&
st
)
{
char
*
p
=
net_server_write
;
auto
p
=
net_server_write
;
BufferIO
::
WriteInt16
(
p
,
1
+
sizeof
(
ST
));
BufferIO
::
WriteInt8
(
p
,
proto
);
memcpy
(
p
,
&
st
,
sizeof
(
ST
));
...
...
@@ -56,7 +56,7 @@ public:
bufferevent_write
(
dp
->
bev
,
net_server_write
,
last_sent
);
}
static
void
SendBufferToPlayer
(
DuelPlayer
*
dp
,
unsigned
char
proto
,
void
*
buffer
,
size_t
len
)
{
char
*
p
=
net_server_write
;
auto
p
=
net_server_write
;
BufferIO
::
WriteInt16
(
p
,
1
+
len
);
BufferIO
::
WriteInt8
(
p
,
proto
);
memcpy
(
p
,
buffer
,
len
);
...
...
gframe/network.h
View file @
71e967d8
...
...
@@ -12,16 +12,16 @@
namespace
ygo
{
struct
HostInfo
{
unsigned
int
lflist
;
unsigned
char
rule
;
unsigned
char
mode
;
unsigned
char
duel_rule
;
bool
no_check_deck
;
bool
no_shuffle_deck
;
unsigned
int
start_lp
;
unsigned
char
start_hand
;
unsigned
char
draw_count
;
unsigned
short
time_limit
;
unsigned
int
lflist
{
0
}
;
unsigned
char
rule
{
0
}
;
unsigned
char
mode
{
0
}
;
unsigned
char
duel_rule
{
0
}
;
bool
no_check_deck
{
false
}
;
bool
no_shuffle_deck
{
false
}
;
unsigned
int
start_lp
{
0
}
;
unsigned
char
start_hand
{
0
}
;
unsigned
char
draw_count
{
0
}
;
unsigned
short
time_limit
{
0
}
;
};
struct
HostPacket
{
unsigned
short
identifier
;
...
...
@@ -99,22 +99,17 @@ struct STOC_HS_WatchChange {
class
DuelMode
;
struct
DuelPlayer
{
unsigned
short
name
[
20
];
DuelMode
*
game
;
unsigned
char
type
;
unsigned
char
state
;
bufferevent
*
bev
;
DuelPlayer
()
{
game
=
0
;
type
=
0
;
state
=
0
;
bev
=
0
;
}
unsigned
short
name
[
20
]{
0
};
DuelMode
*
game
{
nullptr
};
unsigned
char
player_id
{
0xff
};
unsigned
char
type
{
0
};
unsigned
char
state
{
0
};
bufferevent
*
bev
{
0
};
};
class
DuelMode
{
public:
DuelMode
()
:
host_player
(
0
),
pduel
(
0
),
duel_stage
(
0
)
{}
DuelMode
()
:
host_player
(
nullptr
),
pduel
(
0
),
duel_stage
(
0
)
{}
virtual
~
DuelMode
()
{}
virtual
void
Chat
(
DuelPlayer
*
dp
,
void
*
pdata
,
int
len
)
{}
virtual
void
JoinGame
(
DuelPlayer
*
dp
,
void
*
pdata
,
bool
is_creater
)
{}
...
...
gframe/replay.h
View file @
71e967d8
...
...
@@ -2,7 +2,6 @@
#define REPLAY_H
#include "config.h"
#include <time.h>
namespace
ygo
{
...
...
@@ -53,7 +52,7 @@ public:
static
bool
RenameReplay
(
const
wchar_t
*
oldname
,
const
wchar_t
*
newname
);
bool
ReadNextResponse
(
unsigned
char
resp
[
64
]);
void
ReadName
(
wchar_t
*
data
);
void
ReadHeader
(
ReplayHeader
&
header
);
//
void ReadHeader(ReplayHeader& header);
void
ReadData
(
void
*
data
,
int
length
);
int
ReadInt32
();
short
ReadInt16
();
...
...
gframe/replay_mode.cpp
View file @
71e967d8
This diff is collapsed.
Click to expand it.
gframe/replay_mode.h
View file @
71e967d8
#ifndef REPLAY_MODE_H
#define REPLAY_MODE_H
#include "config.h"
#include "data_manager.h"
#include "deck_manager.h"
#include <stdint.h>
#include <vector>
#include "replay.h"
#include "../ocgcore/mtrandom.h"
namespace
ygo
{
...
...
@@ -22,6 +20,7 @@ private:
static
int
skip_turn
;
static
int
current_step
;
static
int
skip_step
;
static
void
ReloadLocation
(
int
player
,
int
location
,
int
flag
,
std
::
vector
<
unsigned
char
>&
queryBuffer
);
public:
static
Replay
cur_replay
;
...
...
@@ -37,9 +36,10 @@ public:
static
void
EndDuel
();
static
void
Restart
(
bool
refresh
);
static
void
Undo
();
static
bool
ReplayAnalyze
(
char
*
msg
,
unsigned
int
len
);
static
bool
ReplayAnalyze
(
unsigned
char
*
msg
,
unsigned
int
len
);
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
ReplayRefreshGrave
(
int
player
,
int
flag
=
0x181fff
);
static
void
ReplayRefreshDeck
(
int
player
,
int
flag
=
0x181fff
);
...
...
@@ -47,7 +47,7 @@ public:
static
void
ReplayRefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
=
0xf81fff
);
static
void
ReplayReload
();
static
int
MessageHandler
(
intptr_t
fduel
,
int
type
);
static
uint32
MessageHandler
(
intptr_t
fduel
,
uint32
type
);
};
}
...
...
gframe/single_duel.cpp
View file @
71e967d8
This diff is collapsed.
Click to expand it.
gframe/single_duel.h
View file @
71e967d8
...
...
@@ -24,7 +24,7 @@ public:
virtual
void
TPResult
(
DuelPlayer
*
dp
,
unsigned
char
tp
);
virtual
void
Process
();
virtual
void
Surrender
(
DuelPlayer
*
dp
);
virtual
int
Analyze
(
char
*
msgbuffer
,
unsigned
int
len
);
virtual
int
Analyze
(
unsigned
char
*
msgbuffer
,
unsigned
int
len
);
virtual
void
GetResponse
(
DuelPlayer
*
dp
,
void
*
pdata
,
unsigned
int
len
);
virtual
void
TimeConfirm
(
DuelPlayer
*
dp
);
virtual
void
EndDuel
();
...
...
@@ -38,26 +38,28 @@ public:
void
RefreshExtra
(
int
player
,
int
flag
=
0xe81fff
,
int
use_cache
=
1
);
void
RefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
=
0xf81fff
);
static
int
MessageHandler
(
intptr_t
fduel
,
int
type
);
static
uint32
MessageHandler
(
intptr_t
fduel
,
uint32
type
);
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:
DuelPlayer
*
players
[
2
];
DuelPlayer
*
pplayer
[
2
];
bool
ready
[
2
];
DuelPlayer
*
players
[
2
]{
nullptr
};
bool
ready
[
2
]{
false
};
Deck
pdeck
[
2
];
int
deck_error
[
2
];
unsigned
char
hand_result
[
2
];
unsigned
char
last_response
;
int
deck_error
[
2
]
{
0
}
;
unsigned
char
hand_result
[
2
]
{
0
}
;
unsigned
char
last_response
{
0
}
;
std
::
set
<
DuelPlayer
*>
observers
;
Replay
last_replay
;
bool
match_mode
;
int
match_kill
;
unsigned
char
duel_count
;
unsigned
char
tp_player
;
unsigned
char
match_result
[
3
];
short
time_limit
[
2
];
short
time_elapsed
;
bool
match_mode
{
false
}
;
int
match_kill
{
0
}
;
unsigned
char
duel_count
{
0
}
;
unsigned
char
tp_player
{
0
}
;
unsigned
char
match_result
[
3
]
{
0
}
;
short
time_limit
[
2
]
{
0
}
;
short
time_elapsed
{
0
}
;
};
}
...
...
gframe/single_mode.cpp
View file @
71e967d8
This diff is collapsed.
Click to expand it.
gframe/single_mode.h
View file @
71e967d8
#ifndef SINGLE_MODE_H
#define SINGLE_MODE_H
#include <stdint.h>
#include <vector>
#include "replay.h"
namespace
ygo
{
...
...
@@ -10,15 +12,17 @@ private:
static
intptr_t
pduel
;
static
bool
is_closing
;
static
bool
is_continuing
;
static
void
ReloadLocation
(
int
player
,
int
location
,
int
flag
,
std
::
vector
<
unsigned
char
>&
queryBuffer
);
public:
static
bool
StartPlay
();
static
void
StopPlay
(
bool
is_exiting
=
false
);
static
void
SetResponse
(
unsigned
char
*
resp
,
unsigned
int
len
);
static
int
SinglePlayThread
();
static
bool
SinglePlayAnalyze
(
char
*
msg
,
unsigned
int
len
);
static
bool
SinglePlayAnalyze
(
unsigned
char
*
msg
,
unsigned
int
len
);
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
SinglePlayRefreshGrave
(
int
player
,
int
flag
=
0x181fff
);
static
void
SinglePlayRefreshDeck
(
int
player
,
int
flag
=
0x181fff
);
...
...
@@ -26,7 +30,7 @@ public:
static
void
SinglePlayRefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
=
0xf81fff
);
static
void
SinglePlayReload
();
static
int
MessageHandler
(
intptr_t
fduel
,
int
type
);
static
uint32
MessageHandler
(
intptr_t
fduel
,
uint32
type
);
protected:
static
Replay
last_replay
;
...
...
gframe/tag_duel.cpp
View file @
71e967d8
This diff is collapsed.
Click to expand it.
gframe/tag_duel.h
View file @
71e967d8
...
...
@@ -24,7 +24,7 @@ public:
virtual
void
TPResult
(
DuelPlayer
*
dp
,
unsigned
char
tp
);
virtual
void
Process
();
virtual
void
Surrender
(
DuelPlayer
*
dp
);
virtual
int
Analyze
(
char
*
msgbuffer
,
unsigned
int
len
);
virtual
int
Analyze
(
unsigned
char
*
msgbuffer
,
unsigned
int
len
);
virtual
void
GetResponse
(
DuelPlayer
*
dp
,
void
*
pdata
,
unsigned
int
len
);
virtual
void
TimeConfirm
(
DuelPlayer
*
dp
);
virtual
void
EndDuel
();
...
...
@@ -38,8 +38,11 @@ public:
void
RefreshExtra
(
int
player
,
int
flag
=
0xe81fff
,
int
use_cache
=
1
);
void
RefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
=
0xf81fff
);
static
int
MessageHandler
(
intptr_t
fduel
,
int
type
);
static
uint32
MessageHandler
(
intptr_t
fduel
,
uint32
type
);
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:
DuelPlayer
*
players
[
4
];
...
...
strings.conf
View file @
71e967d8
...
...
@@ -779,6 +779,7 @@
!
setname
0
x51
零件 ガジェット
!
setname
0
x52
守护者 ガーディアン
!
setname
0
x1052
门之守护神|守护者 ゲート・ガーディアン
!
setname
0
x2052
法理守护者 ローガーディアン
!
setname
0
x53
星圣 セイクリッド
!
setname
0
x54
我我我 ガガガ
!
setname
0
x55
光子 フォトン
...
...
@@ -905,6 +906,7 @@
!
setname
0
x10aa
隐藏的机壳 アポクリフォート
!
setname
0
xab
文具电子人|非「电子」 ブンボーグ
!
setname
0
xac
哥布林 ゴブリン
!
setname
0
x10ac
哥布林骑手 ゴブリンライダー
!
setname
0
xad
魔玩具 デストーイ
!
setname
0
xae
契约书 契約書
!
setname
0
xaf
DD
...
...
@@ -1193,6 +1195,7 @@
!
setname
0
x19b
迪亚贝尔斯塔尔 ディアベルスター
!
setname
0
x19c
蛇眼 スネークアイ
!
setname
0
x19d
荷鲁斯 ホルス
!
setname
0
x119d
荷鲁斯之黑炎龙 ホルスの黒炎竜
!
setname
0
x19e
罪宝
!
setname
0
x19f
圣菓使 聖菓使
!
setname
0
x1a0
哈特 ハート
...
...
@@ -1200,3 +1203,6 @@
!
setname
0
x1a2
百夫长骑士 センチュリオン
!
setname
0
x1a3
异响鸣 ヴァルモニカ
!
setname
0
x1a4
蒂斯蒂娜
Tistina
!
setname
0
x1a5
于贝尔 ユベル
!
setname
0
x1a6
肃声 粛声
!
setname
0
x1a7
白斗气 ホワイト・オーラ
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