Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro
Commits
433f5c0a
Commit
433f5c0a
authored
Dec 26, 2023
by
salix5
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revert to
fc4518b2
parent
334ba77e
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
81 additions
and
82 deletions
+81
-82
gframe/client_card.h
gframe/client_card.h
+2
-14
gframe/client_field.h
gframe/client_field.h
+7
-7
gframe/data_manager.cpp
gframe/data_manager.cpp
+19
-6
gframe/data_manager.h
gframe/data_manager.h
+3
-3
gframe/duelclient.cpp
gframe/duelclient.cpp
+1
-1
gframe/game.cpp
gframe/game.cpp
+4
-4
gframe/game.h
gframe/game.h
+25
-27
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+4
-4
gframe/replay_mode.h
gframe/replay_mode.h
+1
-1
gframe/single_duel.cpp
gframe/single_duel.cpp
+4
-4
gframe/single_duel.h
gframe/single_duel.h
+1
-1
gframe/single_mode.cpp
gframe/single_mode.cpp
+4
-4
gframe/single_mode.h
gframe/single_mode.h
+1
-1
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+4
-4
gframe/tag_duel.h
gframe/tag_duel.h
+1
-1
No files found.
gframe/client_card.h
View file @
433f5c0a
...
...
@@ -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
;
...
...
gframe/client_field.h
View file @
433f5c0a
...
...
@@ -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
;
};
...
...
gframe/data_manager.cpp
View file @
433f5c0a
...
...
@@ -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 @
433f5c0a
...
...
@@ -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/duelclient.cpp
View file @
433f5c0a
...
...
@@ -611,7 +611,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned 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
);
...
...
gframe/game.cpp
View file @
433f5c0a
...
...
@@ -49,8 +49,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
);
...
...
@@ -1541,8 +1542,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 @
433f5c0a
...
...
@@ -66,31 +66,31 @@ 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_l
eft
[
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_l
imit
{
0
}
;
unsigned
short
time_left
[
2
]{
0
}
;
};
struct
BotInfo
{
...
...
@@ -593,8 +593,6 @@ extern Game* mainGame;
}
#define SIZE_QUERY_BUFFER 0x4000
#define CARD_IMG_WIDTH 177
#define CARD_IMG_HEIGHT 254
#define CARD_THUMB_WIDTH 44
...
...
gframe/replay_mode.cpp
View file @
433f5c0a
...
...
@@ -62,9 +62,9 @@ int ReplayMode::ReplayThread() {
mainGame
->
dInfo
.
isSingleMode
=
!!
(
rh
.
flag
&
REPLAY_SINGLE_MODE
);
mainGame
->
dInfo
.
tag_player
[
0
]
=
false
;
mainGame
->
dInfo
.
tag_player
[
1
]
=
false
;
set_script_reader
(
(
script_reader
)
DataManager
::
ScriptReaderEx
);
set_card_reader
(
(
card_reader
)
DataManager
::
CardReader
);
set_message_handler
(
(
message_handler
)
MessageHandler
);
set_script_reader
(
DataManager
::
ScriptReaderEx
);
set_card_reader
(
DataManager
::
CardReader
);
set_message_handler
(
ReplayMode
::
MessageHandler
);
if
(
!
StartDuel
())
{
EndDuel
();
return
0
;
...
...
@@ -929,7 +929,7 @@ void ReplayMode::ReplayReload() {
ReloadLocation
(
0
,
LOCATION_REMOVED
,
flag
,
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_REMOVED
,
flag
,
queryBuffer
);
}
int
ReplayMode
::
MessageHandler
(
intptr_t
fduel
,
int
type
)
{
uint32
ReplayMode
::
MessageHandler
(
intptr_t
fduel
,
uint32
type
)
{
if
(
!
enable_log
)
return
0
;
char
msgbuf
[
1024
];
...
...
gframe/replay_mode.h
View file @
433f5c0a
...
...
@@ -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 @
433f5c0a
...
...
@@ -428,9 +428,9 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
}
time_limit
[
0
]
=
host_info
.
time_limit
;
time_limit
[
1
]
=
host_info
.
time_limit
;
set_script_reader
(
(
script_reader
)
DataManager
::
ScriptReaderEx
);
set_card_reader
(
(
card_reader
)
DataManager
::
CardReader
);
set_message_handler
(
(
message_handler
)
SingleDuel
::
MessageHandler
);
set_script_reader
(
DataManager
::
ScriptReaderEx
);
set_card_reader
(
DataManager
::
CardReader
);
set_message_handler
(
SingleDuel
::
MessageHandler
);
pduel
=
create_duel
(
duel_seed
);
set_player_info
(
pduel
,
0
,
host_info
.
start_lp
,
host_info
.
start_hand
,
host_info
.
draw_count
);
set_player_info
(
pduel
,
1
,
host_info
.
start_lp
,
host_info
.
start_hand
,
host_info
.
draw_count
);
...
...
@@ -1577,7 +1577,7 @@ void SingleDuel::RefreshSingle(int player, int location, int sequence, int flag)
NetServer
::
ReSendToPlayer
(
*
pit
);
}
}
int
SingleDuel
::
MessageHandler
(
intptr_t
fduel
,
int
type
)
{
uint32
SingleDuel
::
MessageHandler
(
intptr_t
fduel
,
uint32
type
)
{
if
(
!
enable_log
)
return
0
;
char
msgbuf
[
1024
];
...
...
gframe/single_duel.h
View file @
433f5c0a
...
...
@@ -38,7 +38,7 @@ 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:
...
...
gframe/single_mode.cpp
View file @
433f5c0a
...
...
@@ -36,9 +36,9 @@ int SingleMode::SinglePlayThread() {
std
::
random_device
rd
;
unsigned
int
seed
=
rd
();
mt19937
rnd
((
uint_fast32_t
)
seed
);
set_script_reader
(
(
script_reader
)
DataManager
::
ScriptReaderEx
);
set_card_reader
(
(
card_reader
)
DataManager
::
CardReader
);
set_message_handler
(
(
message_handler
)
MessageHandler
);
set_script_reader
(
DataManager
::
ScriptReaderEx
);
set_card_reader
(
DataManager
::
CardReader
);
set_message_handler
(
SingleMode
::
MessageHandler
);
pduel
=
create_duel
(
rnd
.
rand
());
set_player_info
(
pduel
,
0
,
start_lp
,
start_hand
,
draw_count
);
set_player_info
(
pduel
,
1
,
start_lp
,
start_hand
,
draw_count
);
...
...
@@ -830,7 +830,7 @@ void SingleMode::SinglePlayReload() {
ReloadLocation
(
0
,
LOCATION_REMOVED
,
flag
,
queryBuffer
);
ReloadLocation
(
1
,
LOCATION_REMOVED
,
flag
,
queryBuffer
);
}
int
SingleMode
::
MessageHandler
(
intptr_t
fduel
,
int
type
)
{
uint32
SingleMode
::
MessageHandler
(
intptr_t
fduel
,
uint32
type
)
{
if
(
!
enable_log
)
return
0
;
char
msgbuf
[
1024
];
...
...
gframe/single_mode.h
View file @
433f5c0a
...
...
@@ -30,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 @
433f5c0a
...
...
@@ -397,9 +397,9 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
}
time_limit
[
0
]
=
host_info
.
time_limit
;
time_limit
[
1
]
=
host_info
.
time_limit
;
set_script_reader
(
(
script_reader
)
DataManager
::
ScriptReaderEx
);
set_card_reader
(
(
card_reader
)
DataManager
::
CardReader
);
set_message_handler
(
(
message_handler
)
TagDuel
::
MessageHandler
);
set_script_reader
(
DataManager
::
ScriptReaderEx
);
set_card_reader
(
DataManager
::
CardReader
);
set_message_handler
(
TagDuel
::
MessageHandler
);
pduel
=
create_duel
(
duel_seed
);
set_player_info
(
pduel
,
0
,
host_info
.
start_lp
,
host_info
.
start_hand
,
host_info
.
draw_count
);
set_player_info
(
pduel
,
1
,
host_info
.
start_lp
,
host_info
.
start_hand
,
host_info
.
draw_count
);
...
...
@@ -1690,7 +1690,7 @@ void TagDuel::RefreshSingle(int player, int location, int sequence, int flag) {
}
}
}
int
TagDuel
::
MessageHandler
(
intptr_t
fduel
,
int
type
)
{
uint32
TagDuel
::
MessageHandler
(
intptr_t
fduel
,
uint32
type
)
{
if
(
!
enable_log
)
return
0
;
char
msgbuf
[
1024
];
...
...
gframe/tag_duel.h
View file @
433f5c0a
...
...
@@ -38,7 +38,7 @@ 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:
...
...
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