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
nanahira
ygopro
Commits
c72bd674
Commit
c72bd674
authored
Sep 23, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Fluorohydride/ygopro
parents
e26dd391
fed41b69
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
329 additions
and
128 deletions
+329
-128
gframe/data_manager.cpp
gframe/data_manager.cpp
+1
-1
gframe/data_manager.h
gframe/data_manager.h
+1
-1
gframe/deck_con.cpp
gframe/deck_con.cpp
+58
-13
gframe/deck_con.h
gframe/deck_con.h
+3
-0
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+50
-15
gframe/deck_manager.h
gframe/deck_manager.h
+8
-3
gframe/drawing.cpp
gframe/drawing.cpp
+107
-89
gframe/duelclient.cpp
gframe/duelclient.cpp
+7
-0
gframe/game.cpp
gframe/game.cpp
+30
-5
gframe/game.h
gframe/game.h
+4
-1
strings.conf
strings.conf
+2
-0
system.conf
system.conf
+58
-0
No files found.
gframe/data_manager.cpp
View file @
c72bd674
...
...
@@ -94,7 +94,7 @@ bool DataManager::LoadStrings(const char* file) {
ReadStringConfLine
(
linebuf
);
}
fclose
(
fp
);
for
(
int
i
=
0
;
i
<
255
;
++
i
)
for
(
int
i
=
0
;
i
<
301
;
++
i
)
myswprintf
(
numStrings
[
i
],
L"%d"
,
i
);
return
true
;
}
...
...
gframe/data_manager.h
View file @
c72bd674
...
...
@@ -43,7 +43,7 @@ public:
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_setnameStrings
;
std
::
unordered_map
<
unsigned
int
,
std
::
wstring
>
_sysStrings
;
wchar_t
numStrings
[
256
][
4
];
wchar_t
numStrings
[
301
][
4
];
wchar_t
numBuffer
[
6
];
wchar_t
attBuffer
[
128
];
wchar_t
racBuffer
[
128
];
...
...
gframe/deck_con.cpp
View file @
c72bd674
...
...
@@ -90,6 +90,7 @@ void DeckBuilder::Initialize() {
prev_deck
=
mainGame
->
cbDBDecks
->
getSelected
();
prev_category
=
mainGame
->
cbDBCategory
->
getSelected
();
RefreshReadonly
(
prev_category
);
RefreshPackListScroll
();
prev_operation
=
0
;
prev_sel
=
-
1
;
is_modified
=
false
;
...
...
@@ -116,6 +117,7 @@ void DeckBuilder::Terminate() {
mainGame
->
ClearTextures
();
mainGame
->
showingcode
=
0
;
mainGame
->
scrFilter
->
setVisible
(
false
);
mainGame
->
scrPackCards
->
setVisible
(
false
);
int
catesel
=
mainGame
->
cbDBCategory
->
getSelected
();
if
(
catesel
>=
0
)
BufferIO
::
CopyWStr
(
mainGame
->
cbDBCategory
->
getItem
(
catesel
),
mainGame
->
gameConf
.
lastcategory
,
64
);
...
...
@@ -1040,7 +1042,8 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
wchar_t
catepath
[
256
];
deckManager
.
GetCategoryPath
(
catepath
,
mainGame
->
lstCategories
->
getSelected
(),
mainGame
->
lstCategories
->
getListItem
(
mainGame
->
lstCategories
->
getSelected
()));
myswprintf
(
filepath
,
L"%ls/%ls.ydk"
,
catepath
,
mainGame
->
lstDecks
->
getListItem
(
decksel
));
deckManager
.
LoadDeck
(
filepath
);
deckManager
.
LoadDeck
(
filepath
,
showing_pack
);
RefreshPackListScroll
();
prev_deck
=
decksel
;
break
;
}
...
...
@@ -1062,6 +1065,8 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if
(
hovered_pos
==
0
||
hovered_seq
==
-
1
)
break
;
click_pos
=
hovered_pos
;
if
(
readonly
)
break
;
dragx
=
event
.
MouseInput
.
X
;
dragy
=
event
.
MouseInput
.
Y
;
draging_pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
...
...
@@ -1143,6 +1148,8 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if
(
!
is_draging
)
{
if
(
hovered_pos
==
0
||
hovered_seq
==
-
1
)
break
;
if
(
readonly
)
break
;
soundManager
.
PlaySoundEffect
(
SOUND_CARD_DROP
);
if
(
hovered_pos
==
1
)
{
pop_main
(
hovered_seq
);
...
...
@@ -1182,6 +1189,8 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
if
(
hovered_pos
==
0
||
hovered_seq
==
-
1
)
break
;
if
(
readonly
)
break
;
if
(
is_draging
)
break
;
auto
pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
...
...
@@ -1265,7 +1274,33 @@ void DeckBuilder::GetHoveredCard() {
int
y
=
pos
.
Y
;
is_lastcard
=
0
;
if
(
x
>=
314
&&
x
<=
794
)
{
if
(
y
>=
164
&&
y
<=
435
)
{
if
(
showing_pack
)
{
if
((
x
<=
772
||
!
mainGame
->
scrPackCards
->
isVisible
())
&&
y
>=
164
&&
y
<=
624
)
{
int
mainsize
=
deckManager
.
current_deck
.
main
.
size
();
int
lx
=
10
;
int
dy
=
68
;
if
(
mainsize
>
10
*
7
)
lx
=
11
;
if
(
mainsize
>
11
*
7
)
lx
=
12
;
if
(
mainsize
>
60
)
dy
=
66
;
int
px
;
int
py
=
(
y
-
164
)
/
dy
;
hovered_pos
=
1
;
if
(
x
>=
750
)
px
=
lx
-
1
;
else
px
=
(
x
-
314
)
*
(
lx
-
1
)
/
(
mainGame
->
scrPackCards
->
isVisible
()
?
414.0
f
:
436.0
f
);
hovered_seq
=
py
*
lx
+
px
+
mainGame
->
scrPackCards
->
getPos
()
*
lx
;
if
(
hovered_seq
>=
mainsize
)
{
hovered_seq
=
-
1
;
hovered_code
=
0
;
}
else
{
hovered_code
=
deckManager
.
current_deck
.
main
[
hovered_seq
]
->
first
;
}
}
}
else
if
(
y
>=
164
&&
y
<=
435
)
{
int
lx
=
10
,
px
,
py
=
(
y
-
164
)
/
68
;
hovered_pos
=
1
;
if
(
deckManager
.
current_deck
.
main
.
size
()
>
40
)
...
...
@@ -1612,21 +1647,17 @@ void DeckBuilder::RefreshDeckList() {
wchar_t
catepath
[
256
];
deckManager
.
GetCategoryPath
(
catepath
,
lstCategories
->
getSelected
(),
lstCategories
->
getListItem
(
lstCategories
->
getSelected
()));
lstDecks
->
clear
();
FileSystem
::
TraversalDir
(
catepath
,
[
lstDecks
](
const
wchar_t
*
name
,
bool
isdir
)
{
if
(
!
isdir
&&
wcsrchr
(
name
,
'.'
)
&&
!
mywcsncasecmp
(
wcsrchr
(
name
,
'.'
),
L".ydk"
,
4
))
{
size_t
len
=
wcslen
(
name
);
wchar_t
deckname
[
256
];
wcsncpy
(
deckname
,
name
,
len
-
4
);
deckname
[
len
-
4
]
=
0
;
lstDecks
->
addItem
(
deckname
);
}
});
mainGame
->
RefreshDeck
(
catepath
,
[
lstDecks
](
const
wchar_t
*
item
)
{
lstDecks
->
addItem
(
item
);
});
}
void
DeckBuilder
::
RefreshReadonly
(
int
catesel
)
{
bool
hasDeck
=
mainGame
->
cbDBDecks
->
getItemCount
()
!=
0
;
readonly
=
catesel
<
2
;
showing_pack
=
catesel
==
0
;
mainGame
->
btnSaveDeck
->
setEnabled
(
!
readonly
);
mainGame
->
btnSaveDeckAs
->
setEnabled
(
!
readonly
);
mainGame
->
btnClearDeck
->
setEnabled
(
!
readonly
);
mainGame
->
btnShuffleDeck
->
setEnabled
(
!
readonly
);
mainGame
->
btnSortDeck
->
setEnabled
(
!
readonly
);
mainGame
->
btnDeleteDeck
->
setEnabled
(
hasDeck
&&
!
readonly
);
mainGame
->
btnRenameCategory
->
setEnabled
(
catesel
>
3
);
mainGame
->
btnDeleteCategory
->
setEnabled
(
catesel
>
3
);
...
...
@@ -1636,11 +1667,25 @@ void DeckBuilder::RefreshReadonly(int catesel) {
mainGame
->
btnMoveDeck
->
setEnabled
(
hasDeck
&&
!
readonly
);
mainGame
->
btnCopyDeck
->
setEnabled
(
hasDeck
);
}
void
DeckBuilder
::
RefreshPackListScroll
()
{
if
(
showing_pack
)
{
mainGame
->
scrPackCards
->
setPos
(
0
);
int
mainsize
=
deckManager
.
current_deck
.
main
.
size
();
if
(
mainsize
<=
7
*
12
)
{
mainGame
->
scrPackCards
->
setVisible
(
false
);
}
else
{
mainGame
->
scrPackCards
->
setVisible
(
true
);
mainGame
->
scrPackCards
->
setMax
((
int
)
ceil
(((
float
)
mainsize
-
7
*
12
)
/
12.0
f
));
}
}
else
{
mainGame
->
scrPackCards
->
setVisible
(
false
);
}
}
void
DeckBuilder
::
ChangeCategory
(
int
catesel
)
{
mainGame
->
RefreshDeck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
mainGame
->
cbDBDecks
->
setSelected
(
0
);
deckManager
.
LoadDeck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
RefreshReadonly
(
catesel
);
deckManager
.
LoadDeck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
is_modified
=
false
;
prev_category
=
catesel
;
prev_deck
=
0
;
...
...
@@ -1660,7 +1705,7 @@ void DeckBuilder::ShowDeckManage() {
if
(
isdir
)
{
lstCategories
->
addItem
(
name
);
}
});
});
lstCategories
->
setSelected
(
prev_category
);
RefreshDeckList
();
RefreshReadonly
(
prev_category
);
...
...
gframe/deck_con.h
View file @
c72bd674
...
...
@@ -24,6 +24,7 @@ public:
void
RefreshDeckList
();
void
RefreshReadonly
(
int
catesel
);
void
RefreshPackListScroll
();
void
ChangeCategory
(
int
catesel
);
void
ShowDeckManage
();
void
ShowBigCard
(
int
code
,
float
zoom
);
...
...
@@ -77,11 +78,13 @@ public:
int
prev_sel
;
bool
is_modified
;
bool
readonly
;
bool
showing_pack
;
mt19937
rnd
;
const
std
::
unordered_map
<
int
,
int
>*
filterList
;
std
::
vector
<
code_pointer
>
results
;
wchar_t
result_string
[
8
];
std
::
vector
<
std
::
wstring
>
expansionPacks
;
};
}
...
...
gframe/deck_manager.cpp
View file @
c72bd674
...
...
@@ -6,6 +6,7 @@
namespace
ygo
{
char
DeckManager
::
deckBuffer
[
0x10000
];
DeckManager
deckManager
;
void
DeckManager
::
LoadLFListSingle
(
const
char
*
path
)
{
...
...
@@ -143,7 +144,7 @@ int DeckManager::CheckDeck(Deck& deck, int lfhash, int rule) {
}
return
0
;
}
int
DeckManager
::
LoadDeck
(
Deck
&
deck
,
int
*
dbuf
,
int
mainc
,
int
sidec
)
{
int
DeckManager
::
LoadDeck
(
Deck
&
deck
,
int
*
dbuf
,
int
mainc
,
int
sidec
,
bool
is_packlist
)
{
deck
.
clear
();
int
code
;
int
errorcode
=
0
;
...
...
@@ -156,6 +157,10 @@ int DeckManager::LoadDeck(Deck& deck, int* dbuf, int mainc, int sidec) {
}
if
(
cd
.
type
&
TYPE_TOKEN
)
continue
;
else
if
(
is_packlist
)
{
deck
.
main
.
push_back
(
dataManager
.
GetCodePointer
(
code
));
continue
;
}
else
if
(
cd
.
type
&
(
TYPE_FUSION
|
TYPE_SYNCHRO
|
TYPE_XYZ
|
TYPE_LINK
))
{
if
(
deck
.
extra
.
size
()
>=
YGOPRO_MAX_EXTRA
)
continue
;
...
...
@@ -241,7 +246,11 @@ void DeckManager::GetDeckFile(wchar_t* ret, irr::gui::IGUIComboBox* cbCategory,
bool
DeckManager
::
LoadDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
wchar_t
filepath
[
256
];
GetDeckFile
(
filepath
,
cbCategory
,
cbDeck
);
return
LoadDeck
(
filepath
);
bool
is_packlist
=
cbCategory
->
getSelected
()
==
0
;
bool
res
=
LoadDeck
(
filepath
,
is_packlist
);
if
(
res
&&
mainGame
->
is_building
)
mainGame
->
deckBuilder
.
RefreshPackListScroll
();
return
res
;
}
FILE
*
DeckManager
::
OpenDeckFile
(
const
wchar_t
*
file
,
const
char
*
mode
)
{
#ifdef WIN32
...
...
@@ -253,20 +262,47 @@ FILE* DeckManager::OpenDeckFile(const wchar_t* file, const char* mode) {
#endif
return
fp
;
}
bool
DeckManager
::
LoadDeck
(
const
wchar_t
*
file
)
{
int
sp
=
0
,
ct
=
0
,
mainc
=
0
,
sidec
=
0
,
code
;
FILE
*
fp
=
OpenDeckFile
(
file
,
"r"
);
if
(
!
fp
)
{
IReadFile
*
DeckManager
::
OpenDeckReader
(
const
wchar_t
*
file
)
{
#ifdef WIN32
IReadFile
*
reader
=
dataManager
.
FileSystem
->
createAndOpenFile
(
file
);
#else
char
file2
[
256
];
BufferIO
::
EncodeUTF8
(
file
,
file2
);
IReadFile
*
reader
=
dataManager
.
FileSystem
->
createAndOpenFile
(
file2
);
#endif
return
reader
;
}
bool
DeckManager
::
LoadDeck
(
const
wchar_t
*
file
,
bool
is_packlist
)
{
IReadFile
*
reader
=
OpenDeckReader
(
file
);
if
(
!
reader
)
{
wchar_t
localfile
[
64
];
myswprintf
(
localfile
,
L"./deck/%ls.ydk"
,
file
);
fp
=
OpenDeckFile
(
localfile
,
"r"
);
reader
=
OpenDeckReader
(
localfile
);
}
if
(
!
fp
)
if
(
!
reader
&&
!
mywcsncasecmp
(
file
,
L"./pack"
,
6
))
{
wchar_t
zipfile
[
64
];
myswprintf
(
zipfile
,
L"%ls"
,
file
+
2
);
reader
=
OpenDeckReader
(
zipfile
);
}
if
(
!
reader
)
return
false
;
int
cardlist
[
128
];
size_t
size
=
reader
->
getSize
();
if
(
size
>=
0x20000
)
{
reader
->
drop
();
return
false
;
}
memset
(
deckBuffer
,
0
,
sizeof
(
deckBuffer
));
reader
->
read
(
deckBuffer
,
size
);
reader
->
drop
();
std
::
istringstream
deckStream
(
deckBuffer
);
return
LoadDeck
(
&
deckStream
,
is_packlist
);
}
bool
DeckManager
::
LoadDeck
(
std
::
istringstream
*
deckStream
,
bool
is_packlist
)
{
int
sp
=
0
,
ct
=
0
,
mainc
=
0
,
sidec
=
0
,
code
;
int
cardlist
[
300
];
bool
is_side
=
false
;
char
linebuf
[
256
]
;
while
(
fgets
(
linebuf
,
256
,
fp
)
&&
ct
<
128
)
{
std
::
string
linebuf
;
while
(
std
::
getline
(
*
deckStream
,
linebuf
)
&&
ct
<
300
)
{
if
(
linebuf
[
0
]
==
'!'
)
{
is_side
=
true
;
continue
;
...
...
@@ -276,14 +312,13 @@ bool DeckManager::LoadDeck(const wchar_t* file) {
sp
=
0
;
while
(
linebuf
[
sp
]
>=
'0'
&&
linebuf
[
sp
]
<=
'9'
)
sp
++
;
linebuf
[
sp
]
=
0
;
code
=
a
toi
(
linebuf
);
code
=
std
::
s
toi
(
linebuf
);
cardlist
[
ct
++
]
=
code
;
if
(
is_side
)
sidec
++
;
else
mainc
++
;
}
fclose
(
fp
);
LoadDeck
(
current_deck
,
cardlist
,
mainc
,
sidec
);
return
true
;
LoadDeck
(
current_deck
,
cardlist
,
mainc
,
sidec
,
is_packlist
);
return
true
;
// the above LoadDeck has return value but we ignore it here for now
}
bool
DeckManager
::
SaveDeck
(
Deck
&
deck
,
const
wchar_t
*
file
)
{
if
(
!
FileSystem
::
IsDirExists
(
L"./deck"
)
&&
!
FileSystem
::
MakeDir
(
L"./deck"
))
...
...
gframe/deck_manager.h
View file @
c72bd674
...
...
@@ -5,6 +5,7 @@
#include "client_card.h"
#include <unordered_map>
#include <vector>
#include <sstream>
namespace
ygo
{
...
...
@@ -35,18 +36,22 @@ public:
Deck
current_deck
;
std
::
vector
<
LFList
>
_lfList
;
static
char
deckBuffer
[
0x10000
];
void
LoadLFListSingle
(
const
char
*
path
);
void
LoadLFList
();
const
wchar_t
*
GetLFListName
(
int
lfhash
);
const
std
::
unordered_map
<
int
,
int
>*
GetLFListContent
(
int
lfhash
);
int
CheckDeck
(
Deck
&
deck
,
int
lfhash
,
int
rule
);
int
LoadDeck
(
Deck
&
deck
,
int
*
dbuf
,
int
mainc
,
int
sidec
);
int
LoadDeck
(
Deck
&
deck
,
int
*
dbuf
,
int
mainc
,
int
sidec
,
bool
is_packlist
=
false
);
bool
LoadSide
(
Deck
&
deck
,
int
*
dbuf
,
int
mainc
,
int
sidec
);
void
GetCategoryPath
(
wchar_t
*
ret
,
int
index
,
const
wchar_t
*
text
);
void
GetDeckFile
(
wchar_t
*
ret
,
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
bool
LoadDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
FILE
*
OpenDeckFile
(
const
wchar_t
*
file
,
const
char
*
mode
);
bool
LoadDeck
(
const
wchar_t
*
file
);
FILE
*
OpenDeckFile
(
const
wchar_t
*
file
,
const
char
*
mode
);
IReadFile
*
OpenDeckReader
(
const
wchar_t
*
file
);
bool
LoadDeck
(
const
wchar_t
*
file
,
bool
is_packlist
=
false
);
bool
LoadDeck
(
std
::
istringstream
*
deckStream
,
bool
is_packlist
=
false
);
bool
SaveDeck
(
Deck
&
deck
,
const
wchar_t
*
file
);
bool
DeleteDeck
(
const
wchar_t
*
file
);
wchar_t
DeckFormatBuffer
[
128
];
...
...
gframe/drawing.cpp
View file @
c72bd674
This diff is collapsed.
Click to expand it.
gframe/duelclient.cpp
View file @
c72bd674
...
...
@@ -492,6 +492,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
deckBuilder
.
hovered_code
=
0
;
mainGame
->
deckBuilder
.
is_draging
=
false
;
mainGame
->
deckBuilder
.
is_starting_dragging
=
false
;
mainGame
->
deckBuilder
.
readonly
=
false
;
mainGame
->
deckBuilder
.
showing_pack
=
false
;
mainGame
->
deckBuilder
.
pre_mainc
=
deckManager
.
current_deck
.
main
.
size
();
mainGame
->
deckBuilder
.
pre_extrac
=
deckManager
.
current_deck
.
extra
.
size
();
mainGame
->
deckBuilder
.
pre_sidec
=
deckManager
.
current_deck
.
side
.
size
();
...
...
@@ -708,6 +710,11 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
btnShuffle
->
setVisible
(
false
);
//if(!mainGame->chkIgnore1->isChecked())
mainGame
->
wChat
->
setVisible
(
true
);
if
(
mainGame
->
chkDefaultShowChain
->
isChecked
())
{
mainGame
->
always_chain
=
true
;
mainGame
->
ignore_chain
=
false
;
mainGame
->
chain_when_avail
=
false
;
}
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
dField
);
if
(
!
mainGame
->
dInfo
.
isTag
)
{
if
(
selftype
>
1
)
{
...
...
gframe/game.cpp
View file @
c72bd674
...
...
@@ -390,6 +390,9 @@ bool Game::Initialize() {
chkWaitChain
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
posX
,
posY
,
posX
+
260
,
posY
+
25
),
tabHelper
,
-
1
,
dataManager
.
GetSysString
(
1277
));
chkWaitChain
->
setChecked
(
gameConf
.
chkWaitChain
!=
0
);
posY
+=
30
;
chkDefaultShowChain
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
posX
,
posY
,
posX
+
260
,
posY
+
25
),
tabHelper
,
-
1
,
dataManager
.
GetSysString
(
1354
));
chkDefaultShowChain
->
setChecked
(
gameConf
.
chkDefaultShowChain
!=
0
);
posY
+=
30
;
chkQuickAnimation
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
posX
,
posY
,
posX
+
260
,
posY
+
25
),
tabHelper
,
CHECKBOX_QUICK_ANIMATION
,
dataManager
.
GetSysString
(
1299
));
chkQuickAnimation
->
setChecked
(
gameConf
.
quick_animation
!=
0
);
posY
+=
30
;
...
...
@@ -679,6 +682,10 @@ bool Game::Initialize() {
cbDMCategory
->
setMaxSelectionRows
(
10
);
btnDMOK
=
env
->
addButton
(
rect
<
s32
>
(
70
,
80
,
140
,
105
),
wDMQuery
,
BUTTON_DM_OK
,
dataManager
.
GetSysString
(
1211
));
btnDMCancel
=
env
->
addButton
(
rect
<
s32
>
(
170
,
80
,
240
,
105
),
wDMQuery
,
BUTTON_DM_CANCEL
,
dataManager
.
GetSysString
(
1212
));
scrPackCards
=
env
->
addScrollBar
(
false
,
recti
(
775
,
161
,
795
,
629
),
0
,
SCROLL_FILTER
);
scrPackCards
->
setLargeStep
(
1
);
scrPackCards
->
setSmallStep
(
1
);
scrPackCards
->
setVisible
(
false
);
stDBCategory
=
env
->
addStaticText
(
dataManager
.
GetSysString
(
1300
),
rect
<
s32
>
(
10
,
9
,
100
,
29
),
false
,
false
,
wDeckEdit
);
cbDBCategory
=
env
->
addComboBox
(
rect
<
s32
>
(
80
,
5
,
220
,
30
),
wDeckEdit
,
COMBOBOX_DBCATEGORY
);
...
...
@@ -1205,6 +1212,9 @@ void Game::LoadExpansions() {
#endif
dataManager
.
LoadStrings
(
reader
);
}
if
(
wcsrchr
(
fname
,
'.'
)
&&
!
mywcsncasecmp
(
wcsrchr
(
fname
,
'.'
),
L".ydk"
,
4
))
{
deckBuilder
.
expansionPacks
.
push_back
(
fname
);
}
}
}
}
...
...
@@ -1239,19 +1249,29 @@ void Game::RefreshCategoryDeck(irr::gui::IGUIComboBox* cbCategory, irr::gui::IGU
}
}
void
Game
::
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
if
(
cbCategory
!=
cbDBCategory
&&
cbCategory
->
getSelected
()
==
0
)
{
// can't use pack list in duel
cbDeck
->
clear
();
return
;
}
wchar_t
catepath
[
256
];
deckManager
.
GetCategoryPath
(
catepath
,
cbCategory
->
getSelected
(),
cbCategory
->
getText
());
RefreshDeck
(
catepath
,
cbDeck
);
}
void
Game
::
RefreshDeck
(
const
wchar_t
*
deckpath
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
cbDeck
->
clear
();
FileSystem
::
TraversalDir
(
deckpath
,
[
cbDeck
](
const
wchar_t
*
name
,
bool
isdir
)
{
RefreshDeck
(
catepath
,
[
cbDeck
](
const
wchar_t
*
item
)
{
cbDeck
->
addItem
(
item
);
});
}
void
Game
::
RefreshDeck
(
const
wchar_t
*
deckpath
,
const
std
::
function
<
void
(
const
wchar_t
*
)
>&
additem
)
{
if
(
!
mywcsncasecmp
(
deckpath
,
L"./pack"
,
6
))
{
for
(
auto
pack
:
deckBuilder
.
expansionPacks
)
{
additem
(
pack
.
substr
(
5
,
pack
.
size
()
-
9
).
c_str
());
}
}
FileSystem
::
TraversalDir
(
deckpath
,
[
additem
](
const
wchar_t
*
name
,
bool
isdir
)
{
if
(
!
isdir
&&
wcsrchr
(
name
,
'.'
)
&&
!
mywcsncasecmp
(
wcsrchr
(
name
,
'.'
),
L".ydk"
,
4
))
{
size_t
len
=
wcslen
(
name
);
wchar_t
deckname
[
256
];
wcsncpy
(
deckname
,
name
,
len
-
4
);
deckname
[
len
-
4
]
=
0
;
cbDeck
->
addI
tem
(
deckname
);
addi
tem
(
deckname
);
}
});
}
...
...
@@ -1392,6 +1412,8 @@ bool Game::LoadConfigFromFile(const char* file) {
gameConf
.
chkAutoChain
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"waitchain"
))
{
gameConf
.
chkWaitChain
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"showchain"
))
{
gameConf
.
chkDefaultShowChain
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"mute_opponent"
))
{
gameConf
.
chkIgnore1
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"mute_spectators"
))
{
...
...
@@ -1507,6 +1529,7 @@ void Game::LoadConfig() {
gameConf
.
chkRandomPos
=
0
;
gameConf
.
chkAutoChain
=
0
;
gameConf
.
chkWaitChain
=
0
;
gameConf
.
chkDefaultShowChain
=
0
;
gameConf
.
chkIgnore1
=
0
;
gameConf
.
chkIgnore2
=
0
;
gameConf
.
use_lflist
=
1
;
...
...
@@ -1639,6 +1662,7 @@ void Game::SaveConfig() {
fprintf
(
fp
,
"randompos = %d
\n
"
,
(
chkRandomPos
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"autochain = %d
\n
"
,
(
chkAutoChain
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"waitchain = %d
\n
"
,
(
chkWaitChain
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"showchain = %d
\n
"
,
(
chkDefaultShowChain
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"mute_opponent = %d
\n
"
,
(
chkIgnore1
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"mute_spectators = %d
\n
"
,
(
chkIgnore2
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"use_lflist = %d
\n
"
,
gameConf
.
use_lflist
);
...
...
@@ -2022,6 +2046,7 @@ void Game::OnResize() {
cbDBCategory
->
setRelativePosition
(
Resize
(
80
,
5
,
220
,
30
));
btnManageDeck
->
setRelativePosition
(
Resize
(
225
,
5
,
290
,
30
));
wDeckManage
->
setRelativePosition
(
ResizeWin
(
310
,
135
,
800
,
465
));
scrPackCards
->
setRelativePosition
(
Resize
(
775
,
161
,
795
,
629
));
wSort
->
setRelativePosition
(
Resize
(
930
,
132
,
1020
,
156
));
cbSortType
->
setRelativePosition
(
Resize
(
10
,
2
,
85
,
22
));
...
...
gframe/game.h
View file @
c72bd674
...
...
@@ -34,6 +34,7 @@ struct Config {
int
chkRandomPos
;
int
chkAutoChain
;
int
chkWaitChain
;
int
chkDefaultShowChain
;
int
chkIgnore1
;
int
chkIgnore2
;
int
use_lflist
;
...
...
@@ -140,7 +141,7 @@ public:
void
LoadExpansions
();
void
RefreshCategoryDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
,
bool
selectlastused
=
true
);
void
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbCategory
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshDeck
(
const
wchar_t
*
deckpath
,
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshDeck
(
const
wchar_t
*
deckpath
,
const
std
::
function
<
void
(
const
wchar_t
*
)
>&
additem
);
void
RefreshReplay
();
void
RefreshSingleplay
();
void
RefreshBot
();
...
...
@@ -320,6 +321,7 @@ public:
irr
::
gui
::
IGUICheckBox
*
chkRandomPos
;
irr
::
gui
::
IGUICheckBox
*
chkAutoChain
;
irr
::
gui
::
IGUICheckBox
*
chkWaitChain
;
irr
::
gui
::
IGUICheckBox
*
chkDefaultShowChain
;
irr
::
gui
::
IGUICheckBox
*
chkQuickAnimation
;
irr
::
gui
::
IGUICheckBox
*
chkAutoSaveReplay
;
irr
::
gui
::
IGUICheckBox
*
chkDrawSingleChain
;
...
...
@@ -570,6 +572,7 @@ public:
irr
::
gui
::
IGUIComboBox
*
cbDMCategory
;
irr
::
gui
::
IGUIButton
*
btnDMOK
;
irr
::
gui
::
IGUIButton
*
btnDMCancel
;
irr
::
gui
::
IGUIScrollBar
*
scrPackCards
;
//filter
irr
::
gui
::
IGUIStaticText
*
wFilter
;
irr
::
gui
::
IGUIScrollBar
*
scrFilter
;
...
...
strings.conf
View file @
c72bd674
...
...
@@ -404,6 +404,7 @@
!
system
1351
投降
!
system
1352
主要信息:
!
system
1353
播放起始于回合:
!
system
1354
开局默认显示所有时点
!
system
1355
是否确定盖放[%
ls
]?
!
system
1356
此操作将放弃对当前卡组的修改,是否继续?
!
system
1357
不提示保留对卡组的修改
...
...
@@ -495,6 +496,7 @@
!
system
1474
已存在同名分类
!
system
1475
已存在同名卡组
!
system
1476
删除失败
!
system
1477
卡片数:
!
system
1481
OCG
!
system
1482
TCG
!
system
1483
简体中文
...
...
system.conf
View file @
c72bd674
<<<<<<<
HEAD
#config file
#nickname & gamename should be less than 20 characters
use_d3d
=
0
...
...
@@ -56,3 +57,60 @@ music_mode = 1
enable_pendulum_scale
=
1
skin_index
= -
1
locale
=
default
=======
#config file
#nickname & gamename should be less than 20 characters
use_d3d
=
0
use_image_scale
=
1
pro_version
=
4947
antialias
=
2
errorlog
=
3
nickname
=
Komeiji
Koishi
gamename
=
Game
lastcategory
= 未分类卡组
lastdeck
=
new
textfont
= ./
fonts
/
simhei
.
ttf
14
numfont
= ./
fonts
/
arial
.
ttf
serverport
=
7911
lasthost
=
127
.
0
.
0
.
1
:
7911
automonsterpos
=
0
autospellpos
=
0
randompos
=
0
autochain
=
0
waitchain
=
0
showchain
=
0
mute_opponent
=
0
mute_spectators
=
0
use_lflist
=
1
default_lflist
=
0
default_rule
=
0
hide_setname
=
0
hide_hint_button
=
0
#control_mode = 0: Key A/S/D/R Chain Buttons. control_mode = 1: MouseLeft/MouseRight/NULL/F9 Without Chain Buttons
control_mode
=
0
draw_field_spell
=
1
separate_clear_button
=
1
#auto_search_limit >= 0: Start search automatically when the user enters N chars
auto_search_limit
= -
1
#search_multiple_keywords = 0: Disable. 1: Search mutiple keywords with separator " ". 2: with separator "+"
search_multiple_keywords
=
1
ignore_deck_changes
=
0
default_ot
=
1
enable_bot_mode
=
1
bot_deck_path
= ./
windbot
/
Decks
quick_animation
=
0
auto_save_replay
=
0
draw_single_chain
=
0
prefer_expansion_script
=
1
ask_mset
=
0
window_maximized
=
0
window_width
=
1280
window_height
=
800
resize_popup_menu
=
0
auto_save_replay
=
0
enable_sound
=
1
enable_music
=
1
#Volume of sound and music, between 0 and 100
sound_volume
=
50
music_volume
=
50
music_mode
=
1
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