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
aa18536c
Commit
aa18536c
authored
Oct 29, 2018
by
nekrozar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
2047a67a
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
233 additions
and
22 deletions
+233
-22
gframe/game.cpp
gframe/game.cpp
+78
-5
gframe/game.h
gframe/game.h
+3
-0
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+35
-2
gframe/replay_mode.h
gframe/replay_mode.h
+3
-2
gframe/single_duel.cpp
gframe/single_duel.cpp
+35
-2
gframe/single_duel.h
gframe/single_duel.h
+3
-3
gframe/single_mode.cpp
gframe/single_mode.cpp
+35
-2
gframe/single_mode.h
gframe/single_mode.h
+2
-1
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+36
-2
gframe/tag_duel.h
gframe/tag_duel.h
+3
-3
No files found.
gframe/game.cpp
View file @
aa18536c
...
...
@@ -66,9 +66,9 @@ bool Game::Initialize() {
LoadExpansionDB
();
if
(
!
dataManager
.
LoadDB
(
"cards.cdb"
))
return
false
;
LoadExpansionStrings
();
if
(
!
dataManager
.
LoadStrings
(
"strings.conf"
))
return
false
;
dataManager
.
LoadStrings
(
"./expansions/strings.conf"
);
env
=
device
->
getGUIEnvironment
();
numFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
16
);
adFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
12
);
...
...
@@ -861,17 +861,18 @@ void Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gu
pControl
->
setText
(
dataManager
.
strBuffer
);
}
void
Game
::
LoadExpansionDB
()
{
LoadExpansionDBDirectry
(
"./expansions"
)
#ifdef _WIN32
char
fpath
[
1000
];
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
L"./expansions/*
.cdb
"
,
&
fdataw
);
HANDLE
fh
=
FindFirstFileW
(
L"./expansions/*"
,
&
fdataw
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
do
{
if
(
!
(
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
{
if
((
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"./expansions/%s"
,
fname
);
dataManager
.
LoadDB
(
fpath
);
LoadExpansionDBDirectry
(
fpath
)
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
...
...
@@ -880,18 +881,90 @@ void Game::LoadExpansionDB() {
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./expansions/"
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
if
(
f
->
d_type
!=
DT_DIR
)
continue
;
char
filepath
[
1000
];
sprintf
(
filepath
,
"./expansions/%s/"
,
dirp
->
d_name
);
LoadExpansionDBDirectry
(
filepath
)
}
closedir
(
dir
);
}
#endif
}
void
Game
::
LoadExpansionDBDirectry
(
const
char
*
path
)
{
#ifdef _WIN32
char
fpath
[
1000
];
wchar_t
wpath1
[
1000
];
wchar_t
wpath2
[
1000
];
BufferIO
::
DecodeUTF8
(
path
,
wpath1
);
myswprintf
(
wpath2
,
L"%ls/*.cdb"
,
wpath1
);
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
wpath2
,
&
fdataw
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
do
{
if
(
!
(
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"%s/%s"
,
path
,
fname
);
dataManager
.
LoadDB
(
fpath
);
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
path
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
size_t
len
=
strlen
(
dirp
->
d_name
);
if
(
len
<
5
||
strcasecmp
(
dirp
->
d_name
+
len
-
4
,
".cdb"
)
!=
0
)
continue
;
char
filepath
[
1000
];
sprintf
(
filepath
,
"
./expansions/%s"
,
dirp
->
d_name
);
sprintf
(
filepath
,
"
%s/%s"
,
path
,
dirp
->
d_name
);
dataManager
.
LoadDB
(
filepath
);
}
closedir
(
dir
);
}
#endif
}
void
Game
::
LoadExpansionStrings
()
{
LoadExpansionStringsDirectry
(
"./expansions"
)
#ifdef _WIN32
char
fpath
[
1000
];
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
L"./expansions/*"
,
&
fdataw
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
do
{
if
((
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"./expansions/%s"
,
fname
);
LoadExpansionStringsDirectry
(
fpath
)
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./expansions/"
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
if
(
f
->
d_type
!=
DT_DIR
)
continue
;
char
filepath
[
1000
];
sprintf
(
filepath
,
"./expansions/%s/"
,
dirp
->
d_name
);
LoadExpansionStringsDirectry
(
filepath
)
}
closedir
(
dir
);
}
#endif
}
void
Game
::
LoadExpansionStringsDirectry
(
const
char
*
path
)
{
char
fpath
[
1000
];
sprintf
(
fpath
,
"%s/strings.conf"
,
path
);
dataManager
.
LoadStrings
(
fpath
)
}
void
Game
::
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
cbDeck
->
clear
();
#ifdef _WIN32
...
...
gframe/game.h
View file @
aa18536c
...
...
@@ -106,6 +106,9 @@ public:
void
InitStaticText
(
irr
::
gui
::
IGUIStaticText
*
pControl
,
u32
cWidth
,
u32
cHeight
,
irr
::
gui
::
CGUITTFont
*
font
,
const
wchar_t
*
text
);
void
SetStaticText
(
irr
::
gui
::
IGUIStaticText
*
pControl
,
u32
cWidth
,
irr
::
gui
::
CGUITTFont
*
font
,
const
wchar_t
*
text
,
u32
pos
=
0
);
void
LoadExpansionDB
();
void
LoadExpansionDBDirectry
(
const
char
*
path
);
void
LoadExpansionStrings
();
void
LoadExpansionStringsDirectry
(
const
char
*
path
);
void
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshReplay
();
void
RefreshSingleplay
();
...
...
gframe/replay_mode.cpp
View file @
aa18536c
...
...
@@ -935,8 +935,41 @@ void ReplayMode::ReplayReload() {
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_REMOVED
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_REMOVED
,
(
char
*
)
queryBuffer
);
}
byte
*
ReplayMode
::
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
)
{
char
sname
[
256
]
=
"./expansions"
;
byte
*
ReplayMode
::::
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
)
{
ScriptReaderExDirectry
(
"./expansions"
,
script_name
,
slen
)
#ifdef _WIN32
char
fpath
[
1000
];
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
L"./expansions/*"
,
&
fdataw
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
do
{
if
((
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"./expansions/%s"
,
fname
);
return
ScriptReaderExDirectry
(
fpath
,
script_name
,
slen
)
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./expansions/"
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
if
(
f
->
d_type
!=
DT_DIR
)
continue
;
char
filepath
[
1000
];
sprintf
(
filepath
,
"./expansions/%s/"
,
dirp
->
d_name
);
return
ScriptReaderExDirectry
(
filepath
,
script_name
,
slen
)
}
closedir
(
dir
);
}
#endif
return
default_script_reader
(
script_name
,
slen
);
}
byte
*
ReplayMode
::
ScriptReaderExDirectry
(
const
char
*
path
,
const
char
*
script_name
,
int
*
slen
)
{
char
sname
[
256
]
=
path
;
strcat
(
sname
,
script_name
+
1
);
//default script name: ./script/c%d.lua
byte
*
buffer
=
default_script_reader
(
sname
,
slen
);
if
(
buffer
)
...
...
gframe/replay_mode.h
View file @
aa18536c
...
...
@@ -25,7 +25,7 @@ private:
public:
static
Replay
cur_replay
;
public:
static
bool
StartReplay
(
int
skipturn
);
static
void
StopReplay
(
bool
is_exiting
=
false
);
...
...
@@ -38,7 +38,7 @@ public:
static
void
Restart
(
bool
refresh
);
static
void
Undo
();
static
bool
ReplayAnalyze
(
char
*
msg
,
unsigned
int
len
);
static
void
ReplayRefresh
(
int
flag
=
0xf81fff
);
static
void
ReplayRefreshHand
(
int
player
,
int
flag
=
0x781fff
);
static
void
ReplayRefreshGrave
(
int
player
,
int
flag
=
0x181fff
);
...
...
@@ -48,6 +48,7 @@ public:
static
void
ReplayReload
();
static
byte
*
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
);
static
byte
*
ScriptReaderExDirectry
(
const
char
*
path
,
const
char
*
script_name
,
int
*
slen
);
static
int
MessageHandler
(
long
fduel
,
int
type
);
};
...
...
gframe/single_duel.cpp
View file @
aa18536c
...
...
@@ -1545,8 +1545,41 @@ void SingleDuel::RefreshSingle(int player, int location, int sequence, int flag)
NetServer
::
ReSendToPlayer
(
*
pit
);
}
}
byte
*
SingleDuel
::
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
)
{
char
sname
[
256
]
=
"./expansions"
;
byte
*
SingleDuel
::::
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
)
{
ScriptReaderExDirectry
(
"./expansions"
,
script_name
,
slen
)
#ifdef _WIN32
char
fpath
[
1000
];
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
L"./expansions/*"
,
&
fdataw
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
do
{
if
((
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"./expansions/%s"
,
fname
);
return
ScriptReaderExDirectry
(
fpath
,
script_name
,
slen
)
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./expansions/"
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
if
(
f
->
d_type
!=
DT_DIR
)
continue
;
char
filepath
[
1000
];
sprintf
(
filepath
,
"./expansions/%s/"
,
dirp
->
d_name
);
return
ScriptReaderExDirectry
(
filepath
,
script_name
,
slen
)
}
closedir
(
dir
);
}
#endif
return
default_script_reader
(
script_name
,
slen
);
}
byte
*
SingleDuel
::
ScriptReaderExDirectry
(
const
char
*
path
,
const
char
*
script_name
,
int
*
slen
)
{
char
sname
[
256
]
=
path
;
strcat
(
sname
,
script_name
+
1
);
//default script name: ./script/c%d.lua
byte
*
buffer
=
default_script_reader
(
sname
,
slen
);
if
(
buffer
)
...
...
gframe/single_duel.h
View file @
aa18536c
...
...
@@ -28,7 +28,7 @@ public:
virtual
void
GetResponse
(
DuelPlayer
*
dp
,
void
*
pdata
,
unsigned
int
len
);
virtual
void
TimeConfirm
(
DuelPlayer
*
dp
);
virtual
void
EndDuel
();
void
DuelEndProc
();
void
WaitforResponse
(
int
playerid
);
void
RefreshMzone
(
int
player
,
int
flag
=
0x881fff
,
int
use_cache
=
1
);
...
...
@@ -39,9 +39,10 @@ public:
void
RefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
=
0xf81fff
);
static
byte
*
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
);
static
byte
*
ScriptReaderExDirectry
(
const
char
*
path
,
const
char
*
script_name
,
int
*
slen
);
static
int
MessageHandler
(
long
fduel
,
int
type
);
static
void
SingleTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
);
protected:
DuelPlayer
*
players
[
2
];
DuelPlayer
*
pplayer
[
2
];
...
...
@@ -65,4 +66,3 @@ protected:
}
#endif //SINGLE_DUEL_H
gframe/single_mode.cpp
View file @
aa18536c
...
...
@@ -845,8 +845,41 @@ void SingleMode::SinglePlayReload() {
/*len = */
query_field_card
(
pduel
,
1
,
LOCATION_REMOVED
,
flag
,
queryBuffer
,
0
);
mainGame
->
dField
.
UpdateFieldCard
(
mainGame
->
LocalPlayer
(
1
),
LOCATION_REMOVED
,
(
char
*
)
queryBuffer
);
}
byte
*
SingleMode
::
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
)
{
char
sname
[
256
]
=
"./expansions"
;
byte
*
SingleMode
::::
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
)
{
ScriptReaderExDirectry
(
"./expansions"
,
script_name
,
slen
)
#ifdef _WIN32
char
fpath
[
1000
];
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
L"./expansions/*"
,
&
fdataw
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
do
{
if
((
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"./expansions/%s"
,
fname
);
return
ScriptReaderExDirectry
(
fpath
,
script_name
,
slen
)
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./expansions/"
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
if
(
f
->
d_type
!=
DT_DIR
)
continue
;
char
filepath
[
1000
];
sprintf
(
filepath
,
"./expansions/%s/"
,
dirp
->
d_name
);
return
ScriptReaderExDirectry
(
filepath
,
script_name
,
slen
)
}
closedir
(
dir
);
}
#endif
return
ScriptReader
(
script_name
,
slen
);
}
byte
*
SingleMode
::
ScriptReaderExDirectry
(
const
char
*
path
,
const
char
*
script_name
,
int
*
slen
)
{
char
sname
[
256
]
=
path
;
strcat
(
sname
,
script_name
+
1
);
//default script name: ./script/c%d.lua
if
(
ScriptReader
(
sname
,
slen
))
return
buffer
;
...
...
gframe/single_mode.h
View file @
aa18536c
...
...
@@ -17,7 +17,7 @@ public:
static
void
SetResponse
(
unsigned
char
*
resp
,
unsigned
int
len
);
static
int
SinglePlayThread
(
void
*
param
);
static
bool
SinglePlayAnalyze
(
char
*
msg
,
unsigned
int
len
);
static
void
SinglePlayRefresh
(
int
flag
=
0xf81fff
);
static
void
SinglePlayRefreshHand
(
int
player
,
int
flag
=
0x781fff
);
static
void
SinglePlayRefreshGrave
(
int
player
,
int
flag
=
0x181fff
);
...
...
@@ -27,6 +27,7 @@ public:
static
void
SinglePlayReload
();
static
byte
*
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
);
static
byte
*
ScriptReaderExDirectry
(
const
char
*
path
,
const
char
*
script_name
,
int
*
slen
);
static
byte
*
ScriptReader
(
const
char
*
script_name
,
int
*
slen
);
static
int
MessageHandler
(
long
fduel
,
int
type
);
...
...
gframe/tag_duel.cpp
View file @
aa18536c
...
...
@@ -1662,8 +1662,42 @@ void TagDuel::RefreshSingle(int player, int location, int sequence, int flag) {
}
}
}
byte
*
TagDuel
::
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
)
{
char
sname
[
256
]
=
"./expansions"
;
byte
*
TagDuel
::::
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
)
{
ScriptReaderExDirectry
(
"./expansions"
,
script_name
,
slen
)
#ifdef _WIN32
char
fpath
[
1000
];
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
L"./expansions/*"
,
&
fdataw
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
do
{
if
((
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"./expansions/%s"
,
fname
);
return
ScriptReaderExDirectry
(
fpath
,
script_name
,
slen
)
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./expansions/"
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
if
(
f
->
d_type
!=
DT_DIR
)
continue
;
char
filepath
[
1000
];
sprintf
(
filepath
,
"./expansions/%s/"
,
dirp
->
d_name
);
return
ScriptReaderExDirectry
(
filepath
,
script_name
,
slen
)
}
closedir
(
dir
);
}
#endif
return
default_script_reader
(
script_name
,
slen
);
}
byte
*
TagDuel
::
ScriptReaderExDirectry
(
const
char
*
path
,
const
char
*
script_name
,
int
*
slen
)
{
char
sname
[
256
]
=
path
;
strcat
(
sname
,
script_name
+
1
);
//default script name: ./script/c%d.lua
byte
*
buffer
=
default_script_reader
(
sname
,
slen
);
if
(
buffer
)
...
...
gframe/tag_duel.h
View file @
aa18536c
...
...
@@ -28,7 +28,7 @@ public:
virtual
void
GetResponse
(
DuelPlayer
*
dp
,
void
*
pdata
,
unsigned
int
len
);
virtual
void
TimeConfirm
(
DuelPlayer
*
dp
);
virtual
void
EndDuel
();
void
DuelEndProc
();
void
WaitforResponse
(
int
playerid
);
void
RefreshMzone
(
int
player
,
int
flag
=
0x881fff
,
int
use_cache
=
1
);
...
...
@@ -39,9 +39,10 @@ public:
void
RefreshSingle
(
int
player
,
int
location
,
int
sequence
,
int
flag
=
0xf81fff
);
static
byte
*
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
);
static
byte
*
ScriptReaderExDirectry
(
const
char
*
path
,
const
char
*
script_name
,
int
*
slen
);
static
int
MessageHandler
(
long
fduel
,
int
type
);
static
void
TagTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
);
protected:
DuelPlayer
*
players
[
4
];
DuelPlayer
*
pplayer
[
4
];
...
...
@@ -62,4 +63,3 @@ protected:
}
#endif //TAG_DUEL_H
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