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
REIKAI
ygopro
Commits
ced996f4
Commit
ced996f4
authored
Dec 13, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'server' into fullview
parents
1151300c
4965a378
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
447 additions
and
34 deletions
+447
-34
cards.cdb
cards.cdb
+0
-0
gframe/client_field.cpp
gframe/client_field.cpp
+1
-1
gframe/drawing.cpp
gframe/drawing.cpp
+1
-1
gframe/duelclient.cpp
gframe/duelclient.cpp
+10
-10
gframe/event_handler.cpp
gframe/event_handler.cpp
+7
-0
gframe/game.cpp
gframe/game.cpp
+5
-5
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+26
-3
gframe/replay.h
gframe/replay.h
+1
-0
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+1
-1
gframe/single_duel.cpp
gframe/single_duel.cpp
+3
-1
gframe/single_mode.cpp
gframe/single_mode.cpp
+1
-1
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+3
-1
lflist.conf
lflist.conf
+386
-8
ocgcore
ocgcore
+1
-1
script
script
+1
-1
No files found.
cards.cdb
View file @
ced996f4
No preview for this file type
gframe/client_field.cpp
View file @
ced996f4
...
...
@@ -132,7 +132,7 @@ void ClientField::Initial(int player, int deckc, int extrac) {
}
ClientCard
*
ClientField
::
GetCard
(
int
controler
,
int
location
,
int
sequence
,
int
sub_seq
)
{
std
::
vector
<
ClientCard
*>*
lst
=
0
;
bool
is_xyz
=
(
location
&
0x80
)
!=
0
;
bool
is_xyz
=
(
location
&
LOCATION_OVERLAY
)
!=
0
;
location
&=
0x7f
;
switch
(
location
)
{
case
LOCATION_DECK
:
...
...
gframe/drawing.cpp
View file @
ced996f4
...
...
@@ -579,7 +579,7 @@ void Game::DrawMisc() {
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
Resize
(
986
-
290
*
partialLP
/
maxLP
,
12
,
986
,
28
),
recti
(
0
,
fgColorPos
*
16
,
16
,
(
fgColorPos
+
1
)
*
16
),
0
,
0
,
true
);
}
}
else
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
Resize
(
986
-
290
*
dInfo
.
lp
[
1
]
/
dInfo
.
start_lp
,
12
,
986
,
28
),
recti
(
0
,
0
,
16
,
16
),
0
,
0
,
true
);
else
driver
->
draw2DImage
(
imageManager
.
tLPBar
,
Resize
(
986
-
290
*
dInfo
.
lp
[
1
]
/
maxLP
,
12
,
986
,
28
),
recti
(
0
,
0
,
16
,
16
),
0
,
0
,
true
);
}
if
(
lpframe
)
{
dInfo
.
lp
[
lpplayer
]
-=
lpd
;
...
...
gframe/duelclient.cpp
View file @
ced996f4
...
...
@@ -2390,7 +2390,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
mainGame
->
WaitFrameSignal
(
5
);
}
if
(
panel_confirm
.
size
()
&&
!
auto_watch_mode
)
{
if
(
panel_confirm
.
size
()
&&
mainGame
->
dInfo
.
player_type
!=
7
&&
!
auto_watch_mode
)
{
std
::
sort
(
panel_confirm
.
begin
(),
panel_confirm
.
end
(),
ClientCard
::
client_card_sort
);
mainGame
->
gMutex
.
lock
();
mainGame
->
dField
.
selectable_cards
=
panel_confirm
;
...
...
@@ -2775,7 +2775,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
dField
.
RemoveCard
(
pc
,
pl
,
ps
);
delete
pcard
;
}
else
{
if
(
!
(
pl
&
0x80
)
&&
!
(
cl
&
0x80
))
{
if
(
!
(
pl
&
LOCATION_OVERLAY
)
&&
!
(
cl
&
LOCATION_OVERLAY
))
{
ClientCard
*
pcard
=
mainGame
->
dField
.
GetCard
(
pc
,
pl
,
ps
);
if
(
pcard
->
code
!=
code
&&
(
code
!=
0
||
cl
==
0x40
))
pcard
->
SetCode
(
code
);
...
...
@@ -2838,7 +2838,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
WaitFrameSignal
(
5
);
}
}
}
else
if
(
!
(
pl
&
0x80
))
{
}
else
if
(
!
(
pl
&
LOCATION_OVERLAY
))
{
ClientCard
*
pcard
=
mainGame
->
dField
.
GetCard
(
pc
,
pl
,
ps
);
if
(
code
!=
0
&&
pcard
->
code
!=
code
)
pcard
->
SetCode
(
code
);
...
...
@@ -2858,7 +2858,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
olcard
->
overlayed
.
push_back
(
pcard
);
mainGame
->
dField
.
overlay_cards
.
insert
(
pcard
);
pcard
->
overlayTarget
=
olcard
;
pcard
->
location
=
0x80
;
pcard
->
location
=
LOCATION_OVERLAY
;
pcard
->
sequence
=
olcard
->
overlayed
.
size
()
-
1
;
}
else
{
mainGame
->
gMutex
.
lock
();
...
...
@@ -2867,7 +2867,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
dField
.
overlay_cards
.
insert
(
pcard
);
mainGame
->
gMutex
.
unlock
();
pcard
->
overlayTarget
=
olcard
;
pcard
->
location
=
0x80
;
pcard
->
location
=
LOCATION_OVERLAY
;
pcard
->
sequence
=
olcard
->
overlayed
.
size
()
-
1
;
if
(
olcard
->
location
&
0x0c
)
{
mainGame
->
gMutex
.
lock
();
...
...
@@ -2879,7 +2879,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
WaitFrameSignal
(
5
);
}
}
}
else
if
(
!
(
cl
&
0x80
))
{
}
else
if
(
!
(
cl
&
LOCATION_OVERLAY
))
{
ClientCard
*
olcard
=
mainGame
->
dField
.
GetCard
(
pc
,
pl
&
0x7f
,
ps
);
ClientCard
*
pcard
=
olcard
->
overlayed
[
pp
];
if
(
mainGame
->
dInfo
.
isReplaySkiping
)
{
...
...
@@ -2916,7 +2916,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
olcard1
->
overlayed
.
erase
(
olcard1
->
overlayed
.
begin
()
+
pcard
->
sequence
);
olcard2
->
overlayed
.
push_back
(
pcard
);
pcard
->
sequence
=
olcard2
->
overlayed
.
size
()
-
1
;
pcard
->
location
=
0x80
;
pcard
->
location
=
LOCATION_OVERLAY
;
pcard
->
overlayTarget
=
olcard2
;
for
(
size_t
i
=
0
;
i
<
olcard1
->
overlayed
.
size
();
++
i
)
{
olcard1
->
overlayed
[
i
]
->
sequence
=
i
;
...
...
@@ -2926,7 +2926,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
olcard1
->
overlayed
.
erase
(
olcard1
->
overlayed
.
begin
()
+
pcard
->
sequence
);
olcard2
->
overlayed
.
push_back
(
pcard
);
pcard
->
sequence
=
olcard2
->
overlayed
.
size
()
-
1
;
pcard
->
location
=
0x80
;
pcard
->
location
=
LOCATION_OVERLAY
;
pcard
->
overlayTarget
=
olcard2
;
for
(
size_t
i
=
0
;
i
<
olcard1
->
overlayed
.
size
();
++
i
)
{
olcard1
->
overlayed
[
i
]
->
sequence
=
i
;
...
...
@@ -3240,7 +3240,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int
l
=
BufferIO
::
ReadInt8
(
pbuf
);
int
s
=
BufferIO
::
ReadInt8
(
pbuf
);
int
ss
=
BufferIO
::
ReadInt8
(
pbuf
);
if
((
l
&
0x80
)
>
0
)
if
((
l
&
LOCATION_OVERLAY
)
>
0
)
pcards
[
i
]
=
mainGame
->
dField
.
GetCard
(
c
,
l
&
0x7f
,
s
)
->
overlayed
[
ss
];
else
pcards
[
i
]
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
...
...
@@ -4092,7 +4092,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
ccard
->
overlayed
.
push_back
(
xcard
);
mainGame
->
dField
.
overlay_cards
.
insert
(
xcard
);
xcard
->
overlayTarget
=
ccard
;
xcard
->
location
=
0x80
;
xcard
->
location
=
LOCATION_OVERLAY
;
xcard
->
sequence
=
ccard
->
overlayed
.
size
()
-
1
;
xcard
->
owner
=
p
;
xcard
->
controler
=
p
;
...
...
gframe/event_handler.cpp
View file @
ced996f4
...
...
@@ -1683,6 +1683,13 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
myswprintf
(
formatBuffer
,
L"
\n
*%ls"
,
dataManager
.
GetDesc
(
iter
->
first
));
str
.
append
(
formatBuffer
);
}
if
(
mainGame
->
dInfo
.
turn
==
1
)
{
if
(
mplayer
==
0
&&
mainGame
->
dInfo
.
isFirst
||
mplayer
!=
0
&&
!
mainGame
->
dInfo
.
isFirst
)
myswprintf
(
formatBuffer
,
L"
\n
*%ls"
,
dataManager
.
GetSysString
(
100
));
else
myswprintf
(
formatBuffer
,
L"
\n
*%ls"
,
dataManager
.
GetSysString
(
101
));
str
.
append
(
formatBuffer
);
}
should_show_tip
=
true
;
irr
::
core
::
dimension2d
<
unsigned
int
>
dtip
=
mainGame
->
guiFont
->
getDimension
(
str
.
c_str
())
+
irr
::
core
::
dimension2d
<
unsigned
int
>
(
10
,
10
);
mainGame
->
stTip
->
setRelativePosition
(
recti
(
mousepos
.
X
-
10
-
dtip
.
Width
,
mousepos
.
Y
+
10
,
mousepos
.
X
-
10
,
mousepos
.
Y
+
10
+
dtip
.
Height
));
...
...
gframe/game.cpp
View file @
ced996f4
...
...
@@ -42,15 +42,15 @@ HostInfo game_info;
void
Game
::
MainServerLoop
()
{
#ifdef SERVER_ZIP_SUPPORT
dataManager
.
FileSystem
=
new
irr
::
io
::
CFileSystem
();
#endif
#ifdef SERVER_PRO2_SUPPORT
dataManager
.
FileSystem
->
addFileArchive
(
"data/script.zip"
);
#endif
initUtils
();
deckManager
.
LoadLFList
();
dataManager
.
LoadDB
(
L"cards.cdb"
);
LoadExpansions
();
#ifdef SERVER_PRO2_SUPPORT
dataManager
.
FileSystem
->
addFileArchive
(
"data/script.zip"
,
true
,
false
,
EFAT_ZIP
);
#endif
server_port
=
NetServer
::
StartServer
(
server_port
);
NetServer
::
InitDuel
();
printf
(
"%u
\n
"
,
server_port
);
...
...
@@ -229,7 +229,7 @@ bool Game::Initialize() {
SetWindowsIcon
();
//main menu
wchar_t
strbuf
[
256
];
myswprintf
(
strbuf
,
L"KoishiPro %X.0%X.%X
Paranoia
"
,
PRO_VERSION
>>
12
,
(
PRO_VERSION
>>
4
)
&
0xff
,
PRO_VERSION
&
0xf
);
myswprintf
(
strbuf
,
L"KoishiPro %X.0%X.%X
DaydreamCafe
"
,
PRO_VERSION
>>
12
,
(
PRO_VERSION
>>
4
)
&
0xff
,
PRO_VERSION
&
0xf
);
wMainMenu
=
env
->
addWindow
(
rect
<
s32
>
(
370
,
200
,
650
,
415
),
false
,
strbuf
);
wMainMenu
->
getCloseButton
()
->
setVisible
(
false
);
btnLanMode
=
env
->
addButton
(
rect
<
s32
>
(
10
,
30
,
270
,
60
),
wMainMenu
,
BUTTON_LAN_MODE
,
dataManager
.
GetSysString
(
1200
));
...
...
gframe/menu_handler.cpp
View file @
ced996f4
...
...
@@ -111,10 +111,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
case
BUTTON_HOST_CONFIRM
:
{
bot_mode
=
false
;
BufferIO
::
CopyWStr
(
mainGame
->
ebServerName
->
getText
(),
mainGame
->
gameConf
.
gamename
,
20
);
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
{
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1402
));
break
;
}
if
(
!
DuelClient
::
StartClient
(
0x7f000001
,
mainGame
->
gameConf
.
serverport
))
{
NetServer
::
StopServer
();
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1402
));
break
;
}
mainGame
->
btnHostConfirm
->
setEnabled
(
false
);
...
...
@@ -154,6 +159,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
case
BUTTON_HP_READY
:
{
if
(
mainGame
->
cbCategorySelect
->
getSelected
()
==
-
1
||
mainGame
->
cbDeckSelect
->
getSelected
()
==
-
1
||
!
deckManager
.
LoadDeck
(
mainGame
->
cbCategorySelect
,
mainGame
->
cbDeckSelect
))
{
mainGame
->
gMutex
.
lock
();
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1406
));
mainGame
->
gMutex
.
unlock
();
break
;
}
UpdateDeck
();
...
...
@@ -308,10 +317,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
bot_mode
=
true
;
#ifdef _WIN32
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
{
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1402
));
break
;
}
if
(
!
DuelClient
::
StartClient
(
0x7f000001
,
mainGame
->
gameConf
.
serverport
))
{
NetServer
::
StopServer
();
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1402
));
break
;
}
STARTUPINFOW
si
;
...
...
@@ -358,10 +372,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
execl
(
"./bot"
,
"bot"
,
arg1
,
arg2
,
arg3
,
NULL
);
exit
(
0
);
}
else
{
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
{
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1402
));
break
;
}
if
(
!
DuelClient
::
StartClient
(
0x7f000001
,
mainGame
->
gameConf
.
serverport
))
{
NetServer
::
StopServer
();
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1402
));
break
;
}
}
...
...
@@ -596,7 +615,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
if
(
static_cast
<
irr
::
gui
::
IGUICheckBox
*>
(
caller
)
->
isChecked
())
{
if
(
mainGame
->
cbCategorySelect
->
getSelected
()
==
-
1
||
mainGame
->
cbDeckSelect
->
getSelected
()
==
-
1
||
!
deckManager
.
LoadDeck
(
mainGame
->
cbCategorySelect
,
mainGame
->
cbDeckSelect
))
{
mainGame
->
gMutex
.
lock
();
static_cast
<
irr
::
gui
::
IGUICheckBox
*>
(
caller
)
->
setChecked
(
false
);
soundManager
.
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1406
));
mainGame
->
gMutex
.
unlock
();
break
;
}
UpdateDeck
();
...
...
gframe/replay.h
View file @
ced996f4
...
...
@@ -20,6 +20,7 @@ namespace ygo {
#ifdef YGOPRO_SERVER_MODE
#define REPLAY_MODE_SAVE_IN_SERVER 0x1
#define REPLAY_MODE_WATCHER_NO_SEND 0x2
#define REPLAY_MODE_INCLUDE_CHAT 0x4
#endif // YGOPRO_SERVER_MODE
struct
ReplayHeader
{
...
...
gframe/replay_mode.cpp
View file @
ced996f4
...
...
@@ -562,7 +562,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
/*int cp = pbuf[11];*/
pbuf
+=
16
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
if
(
cl
&&
!
(
cl
&
0x80
)
&&
(
pl
!=
cl
||
pc
!=
cc
))
if
(
cl
&&
!
(
cl
&
LOCATION_OVERLAY
)
&&
(
pl
!=
cl
||
pc
!=
cc
))
ReplayRefreshSingle
(
cc
,
cl
,
cs
);
else
if
(
pl
==
cl
&&
cl
==
LOCATION_DECK
)
ReplayRefreshDeck
(
cc
);
...
...
gframe/single_duel.cpp
View file @
ced996f4
...
...
@@ -38,6 +38,8 @@ void SingleDuel::Chat(DuelPlayer* dp, void* pdata, int len) {
#ifdef YGOPRO_SERVER_MODE
if
(
cache_recorder
)
NetServer
::
ReSendToPlayer
(
cache_recorder
);
if
(
replay_recorder
&&
replay_mode
&
REPLAY_MODE_INCLUDE_CHAT
)
NetServer
::
ReSendToPlayer
(
replay_recorder
);
#endif
}
void
SingleDuel
::
JoinGame
(
DuelPlayer
*
dp
,
void
*
pdata
,
bool
is_creater
)
{
...
...
@@ -1218,7 +1220,7 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
#ifdef YGOPRO_SERVER_MODE
NetServer
::
ReSendToPlayers
(
cache_recorder
,
replay_recorder
);
#endif
if
(
cl
!=
0
&&
(
cl
&
0x80
)
==
0
&&
(
cl
!=
pl
||
pc
!=
cc
))
if
(
cl
!=
0
&&
(
cl
&
LOCATION_OVERLAY
)
==
0
&&
(
cl
!=
pl
||
pc
!=
cc
))
RefreshSingle
(
cc
,
cl
,
cs
);
break
;
}
...
...
gframe/single_mode.cpp
View file @
ced996f4
...
...
@@ -452,7 +452,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
/*int cp = pbuf[11];*/
pbuf
+=
16
;
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
);
if
(
cl
&&
!
(
cl
&
0x80
)
&&
(
pl
!=
cl
||
pc
!=
cc
))
if
(
cl
&&
!
(
cl
&
LOCATION_OVERLAY
)
&&
(
pl
!=
cl
||
pc
!=
cc
))
SinglePlayRefreshSingle
(
cc
,
cl
,
cs
);
break
;
}
...
...
gframe/tag_duel.cpp
View file @
ced996f4
...
...
@@ -34,6 +34,8 @@ void TagDuel::Chat(DuelPlayer* dp, void* pdata, int len) {
#ifdef YGOPRO_SERVER_MODE
if
(
cache_recorder
)
NetServer
::
ReSendToPlayer
(
cache_recorder
);
if
(
replay_recorder
&&
replay_mode
&
REPLAY_MODE_INCLUDE_CHAT
)
NetServer
::
ReSendToPlayer
(
replay_recorder
);
#endif
}
void
TagDuel
::
JoinGame
(
DuelPlayer
*
dp
,
void
*
pdata
,
bool
is_creater
)
{
...
...
@@ -1198,7 +1200,7 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
#ifdef YGOPRO_SERVER_MODE
NetServer
::
ReSendToPlayers
(
cache_recorder
,
replay_recorder
);
#endif
if
(
cl
!=
0
&&
(
cl
&
0x80
)
==
0
&&
(
cl
!=
pl
||
pc
!=
cc
))
if
(
cl
!=
0
&&
(
cl
&
LOCATION_OVERLAY
)
==
0
&&
(
cl
!=
pl
||
pc
!=
cc
))
RefreshSingle
(
cc
,
cl
,
cs
);
break
;
}
...
...
lflist.conf
View file @
ced996f4
This diff is collapsed.
Click to expand it.
ocgcore
@
7c047070
Subproject commit
f9cd0df0186dcf4ae75b37179e9c835f11061a16
Subproject commit
7c04707022bab65e5fb76f45637e7094476285bb
script
@
b1a22d4e
Subproject commit
861310196d509332bc25e20d12e492d48e4fa11
6
Subproject commit
b1a22d4edbc3505340cb0bbb25dcb605ec9c555
6
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