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
MobiusMei
ygopro
Commits
17cdeb8c
Commit
17cdeb8c
authored
Nov 18, 2018
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/Fluorohydride/ygopro
parents
38385e58
83ad6221
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
432 additions
and
353 deletions
+432
-353
gframe/client_card.cpp
gframe/client_card.cpp
+12
-6
gframe/client_card.h
gframe/client_card.h
+1
-2
gframe/config.h
gframe/config.h
+1
-0
gframe/deck_con.cpp
gframe/deck_con.cpp
+61
-18
gframe/deck_manager.cpp
gframe/deck_manager.cpp
+9
-39
gframe/deck_manager.h
gframe/deck_manager.h
+1
-0
gframe/drawing.cpp
gframe/drawing.cpp
+2
-1
gframe/duelclient.cpp
gframe/duelclient.cpp
+28
-14
gframe/event_handler.cpp
gframe/event_handler.cpp
+28
-4
gframe/game.cpp
gframe/game.cpp
+69
-188
gframe/game.h
gframe/game.h
+9
-4
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+3
-3
gframe/myfilesystem.h
gframe/myfilesystem.h
+145
-0
gframe/replay.cpp
gframe/replay.cpp
+4
-0
gframe/single_duel.cpp
gframe/single_duel.cpp
+6
-7
gframe/single_mode.cpp
gframe/single_mode.cpp
+18
-11
gframe/sound_manager.cpp
gframe/sound_manager.cpp
+16
-47
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+6
-7
ocgcore
ocgcore
+1
-1
script
script
+1
-1
strings.conf
strings.conf
+11
-0
No files found.
gframe/client_card.cpp
View file @
17cdeb8c
...
@@ -18,7 +18,7 @@ ClientCard::ClientCard() {
...
@@ -18,7 +18,7 @@ ClientCard::ClientCard() {
is_showtarget
=
false
;
is_showtarget
=
false
;
is_showchaintarget
=
false
;
is_showchaintarget
=
false
;
is_highlighting
=
false
;
is_highlighting
=
false
;
is_disabled
=
false
;
status
=
0
;
is_reversed
=
false
;
is_reversed
=
false
;
cmdFlag
=
0
;
cmdFlag
=
0
;
code
=
0
;
code
=
0
;
...
@@ -125,6 +125,8 @@ void ClientCard::UpdateInfo(char* buf) {
...
@@ -125,6 +125,8 @@ void ClientCard::UpdateInfo(char* buf) {
base_defense
=
BufferIO
::
ReadInt32
(
buf
);
base_defense
=
BufferIO
::
ReadInt32
(
buf
);
if
(
flag
&
QUERY_REASON
)
if
(
flag
&
QUERY_REASON
)
reason
=
BufferIO
::
ReadInt32
(
buf
);
reason
=
BufferIO
::
ReadInt32
(
buf
);
if
(
flag
&
QUERY_REASON_CARD
)
buf
+=
4
;
if
(
flag
&
QUERY_EQUIP_CARD
)
{
if
(
flag
&
QUERY_EQUIP_CARD
)
{
int
c
=
BufferIO
::
ReadInt8
(
buf
);
int
c
=
BufferIO
::
ReadInt8
(
buf
);
int
l
=
BufferIO
::
ReadInt8
(
buf
);
int
l
=
BufferIO
::
ReadInt8
(
buf
);
...
@@ -162,10 +164,8 @@ void ClientCard::UpdateInfo(char* buf) {
...
@@ -162,10 +164,8 @@ void ClientCard::UpdateInfo(char* buf) {
}
}
if
(
flag
&
QUERY_OWNER
)
if
(
flag
&
QUERY_OWNER
)
owner
=
BufferIO
::
ReadInt32
(
buf
);
owner
=
BufferIO
::
ReadInt32
(
buf
);
if
(
flag
&
QUERY_IS_DISABLED
)
if
(
flag
&
QUERY_STATUS
)
is_disabled
=
BufferIO
::
ReadInt32
(
buf
);
status
=
BufferIO
::
ReadInt32
(
buf
);
if
(
flag
&
QUERY_IS_PUBLIC
)
is_public
=
BufferIO
::
ReadInt32
(
buf
);
if
(
flag
&
QUERY_LSCALE
)
{
if
(
flag
&
QUERY_LSCALE
)
{
lscale
=
BufferIO
::
ReadInt32
(
buf
);
lscale
=
BufferIO
::
ReadInt32
(
buf
);
myswprintf
(
lscstring
,
L"%d"
,
lscale
);
myswprintf
(
lscstring
,
L"%d"
,
lscale
);
...
@@ -210,8 +210,14 @@ bool ClientCard::client_card_sort(ClientCard* c1, ClientCard* c2) {
...
@@ -210,8 +210,14 @@ bool ClientCard::client_card_sort(ClientCard* c1, ClientCard* c2) {
return
c1
->
overlayTarget
->
sequence
<
c2
->
overlayTarget
->
sequence
;
return
c1
->
overlayTarget
->
sequence
<
c2
->
overlayTarget
->
sequence
;
else
return
c1
->
sequence
<
c2
->
sequence
;
else
return
c1
->
sequence
<
c2
->
sequence
;
else
{
else
{
if
(
c1
->
location
&
0x71
)
if
(
c1
->
location
&
(
LOCATION_DECK
|
LOCATION_GRAVE
|
LOCATION_REMOVED
|
LOCATION_EXTRA
))
{
for
(
size_t
i
=
0
;
i
<
mainGame
->
dField
.
chains
.
size
();
++
i
)
{
auto
chit
=
mainGame
->
dField
.
chains
[
i
];
if
(
c1
==
chit
.
chain_card
||
chit
.
target
.
find
(
c1
)
!=
chit
.
target
.
end
())
return
true
;
}
return
c1
->
sequence
>
c2
->
sequence
;
return
c1
->
sequence
>
c2
->
sequence
;
}
else
else
return
c1
->
sequence
<
c2
->
sequence
;
return
c1
->
sequence
<
c2
->
sequence
;
}
}
...
...
gframe/client_card.h
View file @
17cdeb8c
...
@@ -89,8 +89,7 @@ public:
...
@@ -89,8 +89,7 @@ public:
u8
location
;
u8
location
;
u8
sequence
;
u8
sequence
;
u8
position
;
u8
position
;
u8
is_disabled
;
u32
status
;
u8
is_public
;
u8
cHint
;
u8
cHint
;
u32
chValue
;
u32
chValue
;
u32
opParam
;
u32
opParam
;
...
...
gframe/config.h
View file @
17cdeb8c
...
@@ -71,6 +71,7 @@ inline int myswprintf(wchar_t(&buf)[N], const wchar_t* fmt, TR... args) {
...
@@ -71,6 +71,7 @@ inline int myswprintf(wchar_t(&buf)[N], const wchar_t* fmt, TR... args) {
#include <memory.h>
#include <memory.h>
#include <time.h>
#include <time.h>
#include "bufferio.h"
#include "bufferio.h"
#include "myfilesystem.h"
#include "mymutex.h"
#include "mymutex.h"
#include "mysignal.h"
#include "mysignal.h"
#include "mythread.h"
#include "mythread.h"
...
...
gframe/deck_con.cpp
View file @
17cdeb8c
...
@@ -129,7 +129,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -129,7 +129,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
switch
(
id
)
{
switch
(
id
)
{
case
BUTTON_CLEAR_DECK
:
{
case
BUTTON_CLEAR_DECK
:
{
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetSysString
(
1339
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
dataManager
.
GetSysString
(
1339
));
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
prev_operation
=
id
;
prev_operation
=
id
;
...
@@ -185,7 +185,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -185,7 +185,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
wchar_t
textBuffer
[
256
];
wchar_t
textBuffer
[
256
];
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
mainGame
->
cbDBDecks
->
getItem
(
sel
),
dataManager
.
GetSysString
(
1337
));
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
mainGame
->
cbDBDecks
->
getItem
(
sel
),
dataManager
.
GetSysString
(
1337
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
textBuffer
);
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
prev_operation
=
id
;
prev_operation
=
id
;
...
@@ -195,7 +195,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -195,7 +195,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
case
BUTTON_LEAVE_GAME
:
{
case
BUTTON_LEAVE_GAME
:
{
if
(
is_modified
&&
!
mainGame
->
chkIgnoreDeckChanges
->
isChecked
())
{
if
(
is_modified
&&
!
mainGame
->
chkIgnoreDeckChanges
->
isChecked
())
{
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetSysString
(
1356
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
dataManager
.
GetSysString
(
1356
));
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
prev_operation
=
id
;
prev_operation
=
id
;
...
@@ -362,7 +362,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -362,7 +362,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
case
COMBOBOX_DBDECKS
:
{
case
COMBOBOX_DBDECKS
:
{
if
(
is_modified
&&
!
mainGame
->
chkIgnoreDeckChanges
->
isChecked
())
{
if
(
is_modified
&&
!
mainGame
->
chkIgnoreDeckChanges
->
isChecked
())
{
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetSysString
(
1356
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
dataManager
.
GetSysString
(
1356
));
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
prev_operation
=
id
;
prev_operation
=
id
;
...
@@ -776,6 +776,34 @@ void DeckBuilder::StartFilter() {
...
@@ -776,6 +776,34 @@ void DeckBuilder::StartFilter() {
void
DeckBuilder
::
FilterCards
()
{
void
DeckBuilder
::
FilterCards
()
{
results
.
clear
();
results
.
clear
();
const
wchar_t
*
pstr
=
mainGame
->
ebCardName
->
getText
();
const
wchar_t
*
pstr
=
mainGame
->
ebCardName
->
getText
();
std
::
wstring
str
=
std
::
wstring
(
pstr
);
std
::
vector
<
std
::
wstring
>
query_elements
;
std
::
vector
<
std
::
vector
<
std
::
wstring
>::
iterator
>
query_elements_track
;
size_t
element_start
=
0
;
while
(
mainGame
->
gameConf
.
search_multiple_keywords
)
{
size_t
element_end
=
str
.
find_first_of
(
mainGame
->
gameConf
.
search_multiple_keywords
==
1
?
L' '
:
L'+'
,
element_start
);
if
(
element_end
==
std
::
wstring
::
npos
)
break
;
size_t
length
=
element_end
-
element_start
;
if
(
length
>
0
)
{
query_elements
.
push_back
(
str
.
substr
(
element_start
,
length
));
element_start
=
element_end
+
1
;
}
else
element_start
++
;
}
query_elements
.
push_back
(
str
.
substr
(
element_start
));
std
::
unordered_map
<
std
::
wstring
,
unsigned
int
>
set_code_map
;
for
(
auto
elements_iterator
=
query_elements
.
begin
();
elements_iterator
!=
query_elements
.
end
();
elements_iterator
++
)
{
const
wchar_t
*
element_pointer
=
elements_iterator
->
c_str
();
if
(
element_pointer
[
0
]
==
L'@'
)
set_code_map
[
*
elements_iterator
]
=
dataManager
.
GetSetCode
(
&
element_pointer
[
1
]);
else
set_code_map
[
*
elements_iterator
]
=
dataManager
.
GetSetCode
(
&
element_pointer
[
0
]);
if
(
element_pointer
[
0
]
==
0
||
(
element_pointer
[
0
]
==
L'$'
&&
element_pointer
[
1
]
==
0
)
||
(
element_pointer
[
0
]
==
L'@'
&&
element_pointer
[
1
]
==
0
))
query_elements_track
.
push_back
(
elements_iterator
);
}
for
(
auto
elements_track_iterator
=
query_elements_track
.
begin
();
elements_track_iterator
!=
query_elements_track
.
end
();
elements_track_iterator
++
)
query_elements
.
erase
(
*
elements_track_iterator
);
unsigned
int
set_code
=
0
;
unsigned
int
set_code
=
0
;
if
(
pstr
[
0
]
==
L'@'
)
if
(
pstr
[
0
]
==
L'@'
)
set_code
=
dataManager
.
GetSetCode
(
&
pstr
[
1
]);
set_code
=
dataManager
.
GetSetCode
(
&
pstr
[
1
]);
...
@@ -856,24 +884,39 @@ void DeckBuilder::FilterCards() {
...
@@ -856,24 +884,39 @@ void DeckBuilder::FilterCards() {
if
(
filter_lm
==
7
&&
data
.
ot
!=
4
)
if
(
filter_lm
==
7
&&
data
.
ot
!=
4
)
continue
;
continue
;
}
}
if
(
pstr
)
{
bool
is_target
=
true
;
if
(
pstr
[
0
]
==
L'$'
)
{
for
(
auto
elements_iterator
=
query_elements
.
begin
();
elements_iterator
!=
query_elements
.
end
();
elements_iterator
++
)
{
if
(
!
CardNameContains
(
text
.
name
.
c_str
(),
&
pstr
[
1
]))
const
wchar_t
*
element_pointer
=
elements_iterator
->
c_str
();
continue
;
if
(
element_pointer
[
0
]
==
L'$'
)
{
}
else
if
(
pstr
[
0
]
==
L'@'
&&
set_code
)
{
if
(
!
CardNameContains
(
text
.
name
.
c_str
(),
&
element_pointer
[
1
])){
if
(
!
check_set_code
(
data
,
set_code
))
continue
;
is_target
=
false
;
break
;
}
}
else
if
(
element_pointer
[
0
]
==
L'@'
&&
set_code_map
[
*
elements_iterator
])
{
if
(
!
check_set_code
(
data
,
set_code_map
[
*
elements_iterator
]))
{
is_target
=
false
;
break
;
}
}
else
{
}
else
{
int
trycode
=
BufferIO
::
GetVal
(
pstr
);
int
trycode
=
BufferIO
::
GetVal
(
elements_iterator
->
c_str
()
);
bool
tryresult
=
dataManager
.
GetData
(
trycode
,
0
);
bool
tryresult
=
dataManager
.
GetData
(
trycode
,
0
);
if
(
!
tryresult
&&
!
CardNameContains
(
text
.
name
.
c_str
(),
pstr
)
&&
text
.
text
.
find
(
pstr
)
==
std
::
wstring
::
npos
if
(
!
tryresult
&&
!
CardNameContains
(
text
.
name
.
c_str
(),
elements_iterator
->
c_str
())
&&
text
.
text
.
find
(
elements_iterator
->
c_str
())
==
std
::
wstring
::
npos
&&
(
!
set_code
||
!
check_set_code
(
data
,
set_code
)))
&&
(
!
set_code_map
[
*
elements_iterator
]
||
!
check_set_code
(
data
,
set_code_map
[
*
elements_iterator
])))
{
continue
;
is_target
=
false
;
if
(
tryresult
&&
data
.
code
!=
trycode
break
;
&&
!
(
data
.
alias
==
trycode
&&
(
data
.
alias
-
data
.
code
<
CARD_ARTWORK_VERSIONS_OFFSET
||
data
.
code
-
data
.
alias
<
CARD_ARTWORK_VERSIONS_OFFSET
)))
}
continue
;
if
(
tryresult
&&
data
.
code
!=
trycode
&&
!
(
data
.
alias
==
trycode
&&
(
data
.
alias
-
data
.
code
<
CARD_ARTWORK_VERSIONS_OFFSET
||
data
.
code
-
data
.
alias
<
CARD_ARTWORK_VERSIONS_OFFSET
)))
{
is_target
=
false
;
break
;
}
}
}
}
}
results
.
push_back
(
ptr
);
if
(
is_target
)
results
.
push_back
(
ptr
);
else
continue
;
}
}
myswprintf
(
result_string
,
L"%d"
,
results
.
size
());
myswprintf
(
result_string
,
L"%d"
,
results
.
size
());
if
(
results
.
size
()
>
7
)
{
if
(
results
.
size
()
>
7
)
{
...
...
gframe/deck_manager.cpp
View file @
17cdeb8c
...
@@ -8,47 +8,11 @@ namespace ygo {
...
@@ -8,47 +8,11 @@ namespace ygo {
DeckManager
deckManager
;
DeckManager
deckManager
;
void
DeckManager
::
LoadLFList
(
)
{
void
DeckManager
::
LoadLFList
Single
(
const
char
*
path
)
{
LFList
*
cur
=
NULL
;
LFList
*
cur
=
NULL
;
FILE
*
fp
=
fopen
(
"lflist.conf"
,
"r"
);
FILE
*
fp
=
fopen
(
path
,
"r"
);
FILE
*
fp_custom
=
fopen
(
"expansions/lflist.conf"
,
"r"
);
char
linebuf
[
256
];
char
linebuf
[
256
];
wchar_t
strBuffer
[
256
];
wchar_t
strBuffer
[
256
];
if
(
fp_custom
)
{
while
(
fgets
(
linebuf
,
256
,
fp_custom
))
{
if
(
linebuf
[
0
]
==
'#'
)
continue
;
int
p
=
0
,
sa
=
0
,
code
,
count
;
if
(
linebuf
[
0
]
==
'!'
)
{
sa
=
BufferIO
::
DecodeUTF8
((
const
char
*
)(
&
linebuf
[
1
]),
strBuffer
);
while
(
strBuffer
[
sa
-
1
]
==
L'\r'
||
strBuffer
[
sa
-
1
]
==
L'\n'
)
sa
--
;
LFList
newlist
;
_lfList
.
push_back
(
newlist
);
cur
=
&
_lfList
[
_lfList
.
size
()
-
1
];
memcpy
(
cur
->
listName
,
(
const
void
*
)
strBuffer
,
40
);
cur
->
listName
[
sa
]
=
0
;
cur
->
content
=
new
std
::
unordered_map
<
int
,
int
>
;
cur
->
hash
=
0x7dfcee6a
;
continue
;
}
while
(
linebuf
[
p
]
!=
' '
&&
linebuf
[
p
]
!=
'\t'
&&
linebuf
[
p
]
!=
0
)
p
++
;
if
(
linebuf
[
p
]
==
0
)
continue
;
linebuf
[
p
++
]
=
0
;
sa
=
p
;
code
=
atoi
(
linebuf
);
if
(
code
==
0
)
continue
;
while
(
linebuf
[
p
]
==
' '
||
linebuf
[
p
]
==
'\t'
)
p
++
;
while
(
linebuf
[
p
]
!=
' '
&&
linebuf
[
p
]
!=
'\t'
&&
linebuf
[
p
]
!=
0
)
p
++
;
linebuf
[
p
]
=
0
;
count
=
atoi
(
&
linebuf
[
sa
]);
if
(
cur
==
NULL
)
continue
;
(
*
cur
->
content
)[
code
]
=
count
;
cur
->
hash
=
cur
->
hash
^
((
code
<<
18
)
|
(
code
>>
14
))
^
((
code
<<
(
27
+
count
))
|
(
code
>>
(
5
-
count
)));
}
fclose
(
fp_custom
);
}
if
(
fp
)
{
if
(
fp
)
{
while
(
fgets
(
linebuf
,
256
,
fp
))
{
while
(
fgets
(
linebuf
,
256
,
fp
))
{
if
(
linebuf
[
0
]
==
'#'
)
if
(
linebuf
[
0
]
==
'#'
)
...
@@ -60,7 +24,7 @@ void DeckManager::LoadLFList() {
...
@@ -60,7 +24,7 @@ void DeckManager::LoadLFList() {
LFList
newlist
;
LFList
newlist
;
_lfList
.
push_back
(
newlist
);
_lfList
.
push_back
(
newlist
);
cur
=
&
_lfList
[
_lfList
.
size
()
-
1
];
cur
=
&
_lfList
[
_lfList
.
size
()
-
1
];
memcpy
(
cur
->
listName
,
(
const
void
*
)
strBuffer
,
40
);
memcpy
(
cur
->
listName
,
(
const
void
*
)
strBuffer
,
20
*
sizeof
(
wchar_t
)
);
cur
->
listName
[
sa
]
=
0
;
cur
->
listName
[
sa
]
=
0
;
cur
->
content
=
new
std
::
unordered_map
<
int
,
int
>
;
cur
->
content
=
new
std
::
unordered_map
<
int
,
int
>
;
cur
->
hash
=
0x7dfcee6a
;
cur
->
hash
=
0x7dfcee6a
;
...
@@ -84,6 +48,10 @@ void DeckManager::LoadLFList() {
...
@@ -84,6 +48,10 @@ void DeckManager::LoadLFList() {
}
}
fclose
(
fp
);
fclose
(
fp
);
}
}
}
void
DeckManager
::
LoadLFList
()
{
LoadLFListSingle
(
"expansions/lflist.conf"
);
LoadLFListSingle
(
"lflist.conf"
);
LFList
nolimit
;
LFList
nolimit
;
myswprintf
(
nolimit
.
listName
,
L"N/A"
);
myswprintf
(
nolimit
.
listName
,
L"N/A"
);
nolimit
.
hash
=
0
;
nolimit
.
hash
=
0
;
...
@@ -266,6 +234,8 @@ bool DeckManager::LoadDeck(const wchar_t* file) {
...
@@ -266,6 +234,8 @@ bool DeckManager::LoadDeck(const wchar_t* file) {
return
true
;
return
true
;
}
}
bool
DeckManager
::
SaveDeck
(
Deck
&
deck
,
const
wchar_t
*
name
)
{
bool
DeckManager
::
SaveDeck
(
Deck
&
deck
,
const
wchar_t
*
name
)
{
if
(
!
FileSystem
::
IsDirExists
(
L"./deck"
)
&&
!
FileSystem
::
MakeDir
(
L"./deck"
))
return
false
;
wchar_t
file
[
64
];
wchar_t
file
[
64
];
myswprintf
(
file
,
L"./deck/%ls.ydk"
,
name
);
myswprintf
(
file
,
L"./deck/%ls.ydk"
,
name
);
FILE
*
fp
=
OpenDeckFile
(
file
,
"w"
);
FILE
*
fp
=
OpenDeckFile
(
file
,
"w"
);
...
...
gframe/deck_manager.h
View file @
17cdeb8c
...
@@ -35,6 +35,7 @@ public:
...
@@ -35,6 +35,7 @@ public:
Deck
current_deck
;
Deck
current_deck
;
std
::
vector
<
LFList
>
_lfList
;
std
::
vector
<
LFList
>
_lfList
;
void
LoadLFListSingle
(
const
char
*
path
);
void
LoadLFList
();
void
LoadLFList
();
wchar_t
*
GetLFListName
(
int
lfhash
);
wchar_t
*
GetLFListName
(
int
lfhash
);
int
CheckDeck
(
Deck
&
deck
,
int
lfhash
,
bool
allow_ocg
,
bool
allow_tcg
);
int
CheckDeck
(
Deck
&
deck
,
int
lfhash
,
bool
allow_ocg
,
bool
allow_tcg
);
...
...
gframe/drawing.cpp
View file @
17cdeb8c
...
@@ -382,7 +382,8 @@ void Game::DrawCard(ClientCard* pcard) {
...
@@ -382,7 +382,8 @@ void Game::DrawCard(ClientCard* pcard) {
matManager
.
mTexture
.
setTexture
(
0
,
imageManager
.
tChainTarget
);
matManager
.
mTexture
.
setTexture
(
0
,
imageManager
.
tChainTarget
);
driver
->
setMaterial
(
matManager
.
mTexture
);
driver
->
setMaterial
(
matManager
.
mTexture
);
driver
->
drawVertexPrimitiveList
(
matManager
.
vSymbol
,
4
,
matManager
.
iRectangle
,
2
);
driver
->
drawVertexPrimitiveList
(
matManager
.
vSymbol
,
4
,
matManager
.
iRectangle
,
2
);
}
else
if
(
pcard
->
is_disabled
&&
(
pcard
->
location
&
LOCATION_ONFIELD
)
&&
(
pcard
->
position
&
POS_FACEUP
))
{
}
else
if
((
pcard
->
status
&
(
STATUS_DISABLED
|
STATUS_FORBIDDEN
))
&&
(
pcard
->
location
&
LOCATION_ONFIELD
)
&&
(
pcard
->
position
&
POS_FACEUP
))
{
matManager
.
mTexture
.
setTexture
(
0
,
imageManager
.
tNegated
);
matManager
.
mTexture
.
setTexture
(
0
,
imageManager
.
tNegated
);
driver
->
setMaterial
(
matManager
.
mTexture
);
driver
->
setMaterial
(
matManager
.
mTexture
);
driver
->
drawVertexPrimitiveList
(
matManager
.
vNegate
,
4
,
matManager
.
iRectangle
,
2
);
driver
->
drawVertexPrimitiveList
(
matManager
.
vNegate
,
4
,
matManager
.
iRectangle
,
2
);
...
...
gframe/duelclient.cpp
View file @
17cdeb8c
...
@@ -469,7 +469,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
...
@@ -469,7 +469,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
stHostPrepDuelist
[
2
]
->
setText
(
L""
);
mainGame
->
stHostPrepDuelist
[
2
]
->
setText
(
L""
);
mainGame
->
stHostPrepDuelist
[
3
]
->
setText
(
L""
);
mainGame
->
stHostPrepDuelist
[
3
]
->
setText
(
L""
);
mainGame
->
stHostPrepOB
->
setText
(
L""
);
mainGame
->
stHostPrepOB
->
setText
(
L""
);
mainGame
->
SetStaticText
(
mainGame
->
stHostPrepRule
,
180
,
mainGame
->
guiFont
,
(
wchar_t
*
)
str
.
c_str
());
mainGame
->
SetStaticText
(
mainGame
->
stHostPrepRule
,
180
,
mainGame
->
guiFont
,
str
.
c_str
());
mainGame
->
RefreshDeck
(
mainGame
->
cbDeckSelect
);
mainGame
->
RefreshDeck
(
mainGame
->
cbDeckSelect
);
mainGame
->
cbDeckSelect
->
setEnabled
(
true
);
mainGame
->
cbDeckSelect
->
setEnabled
(
true
);
if
(
mainGame
->
wCreateHost
->
isVisible
())
if
(
mainGame
->
wCreateHost
->
isVisible
())
...
@@ -681,18 +681,26 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
...
@@ -681,18 +681,26 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
btnCancelOrFinish
->
setVisible
(
false
);
mainGame
->
btnCancelOrFinish
->
setVisible
(
false
);
mainGame
->
btnShuffle
->
setVisible
(
false
);
mainGame
->
btnShuffle
->
setVisible
(
false
);
time_t
nowtime
=
time
(
NULL
);
time_t
nowtime
=
time
(
NULL
);
struct
tm
*
localedtime
=
localtime
(
&
nowtime
);
tm
*
localedtime
=
localtime
(
&
nowtime
);
char
timebuf
[
40
];
wchar_t
timetext
[
40
];
strftime
(
timebuf
,
40
,
"%Y-%m-%d %H-%M-%S"
,
localedtime
);
wcsftime
(
timetext
,
40
,
L"%Y-%m-%d %H-%M-%S"
,
localedtime
);
size_t
size
=
strlen
(
timebuf
)
+
1
;
wchar_t
timetext
[
80
];
mbstowcs
(
timetext
,
timebuf
,
size
);
mainGame
->
ebRSName
->
setText
(
timetext
);
mainGame
->
ebRSName
->
setText
(
timetext
);
mainGame
->
wReplaySave
->
setText
(
dataManager
.
GetSysString
(
1340
));
if
(
!
mainGame
->
chkAutoSaveReplay
->
isChecked
())
{
mainGame
->
PopupElement
(
mainGame
->
wReplaySave
);
mainGame
->
wReplaySave
->
setText
(
dataManager
.
GetSysString
(
1340
));
mainGame
->
gMutex
.
Unlock
();
mainGame
->
PopupElement
(
mainGame
->
wReplaySave
);
mainGame
->
replaySignal
.
Reset
();
mainGame
->
gMutex
.
Unlock
();
mainGame
->
replaySignal
.
Wait
();
mainGame
->
replaySignal
.
Reset
();
mainGame
->
replaySignal
.
Wait
();
}
else
{
mainGame
->
actionParam
=
1
;
wchar_t
msgbuf
[
256
];
myswprintf
(
msgbuf
,
dataManager
.
GetSysString
(
1367
),
timetext
);
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
guiFont
,
msgbuf
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
WaitFrameSignal
(
30
);
}
if
(
mainGame
->
actionParam
||
!
is_host
)
{
if
(
mainGame
->
actionParam
||
!
is_host
)
{
char
*
prep
=
pdata
;
char
*
prep
=
pdata
;
Replay
new_replay
;
Replay
new_replay
;
...
@@ -1296,6 +1304,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -1296,6 +1304,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
wchar_t
ynbuf
[
256
];
wchar_t
ynbuf
[
256
];
myswprintf
(
ynbuf
,
dataManager
.
GetSysString
(
200
),
dataManager
.
FormatLocation
(
l
,
s
),
dataManager
.
GetName
(
code
));
myswprintf
(
ynbuf
,
dataManager
.
GetSysString
(
200
),
dataManager
.
FormatLocation
(
l
,
s
),
dataManager
.
GetName
(
code
));
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
event_string
,
ynbuf
);
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
event_string
,
ynbuf
);
}
else
if
(
desc
==
221
)
{
wchar_t
ynbuf
[
256
];
myswprintf
(
ynbuf
,
dataManager
.
GetSysString
(
221
),
dataManager
.
FormatLocation
(
l
,
s
),
dataManager
.
GetName
(
code
));
myswprintf
(
textBuffer
,
L"%ls
\n
%ls
\n
%ls"
,
event_string
,
ynbuf
,
dataManager
.
GetSysString
(
223
));
}
else
if
(
desc
<
2048
)
{
}
else
if
(
desc
<
2048
)
{
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
desc
),
dataManager
.
GetName
(
code
));
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
desc
),
dataManager
.
GetName
(
code
));
}
else
{
}
else
{
...
@@ -1312,7 +1324,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -1312,7 +1324,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int
desc
=
BufferIO
::
ReadInt32
(
pbuf
);
int
desc
=
BufferIO
::
ReadInt32
(
pbuf
);
mainGame
->
dField
.
highlighting_card
=
0
;
mainGame
->
dField
.
highlighting_card
=
0
;
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetDesc
(
desc
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
dataManager
.
GetDesc
(
desc
));
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
return
false
;
return
false
;
...
@@ -1550,9 +1562,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -1550,9 +1562,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if
(
!
forced
)
{
if
(
!
forced
)
{
if
(
count
==
0
)
if
(
count
==
0
)
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
dataManager
.
GetSysString
(
201
),
dataManager
.
GetSysString
(
202
));
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
dataManager
.
GetSysString
(
201
),
dataManager
.
GetSysString
(
202
));
else
if
(
select_trigger
)
myswprintf
(
textBuffer
,
L"%ls
\n
%ls
\n
%ls"
,
event_string
,
dataManager
.
GetSysString
(
222
),
dataManager
.
GetSysString
(
223
));
else
else
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
event_string
,
dataManager
.
GetSysString
(
203
));
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
event_string
,
dataManager
.
GetSysString
(
203
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
textBuffer
);
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
}
}
}
}
...
...
gframe/event_handler.cpp
View file @
17cdeb8c
...
@@ -279,7 +279,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -279,7 +279,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame
->
btnOptionn
->
setVisible
(
true
);
mainGame
->
btnOptionn
->
setVisible
(
true
);
if
(
selected_option
==
0
)
if
(
selected_option
==
0
)
mainGame
->
btnOptionp
->
setVisible
(
false
);
mainGame
->
btnOptionp
->
setVisible
(
false
);
mainGame
->
SetStaticText
(
mainGame
->
stOptions
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetDesc
(
select_options
[
selected_option
]));
mainGame
->
SetStaticText
(
mainGame
->
stOptions
,
310
,
mainGame
->
textFont
,
dataManager
.
GetDesc
(
select_options
[
selected_option
]));
break
;
break
;
}
}
case
BUTTON_OPTION_NEXT
:
{
case
BUTTON_OPTION_NEXT
:
{
...
@@ -288,7 +288,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -288,7 +288,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame
->
btnOptionp
->
setVisible
(
true
);
mainGame
->
btnOptionp
->
setVisible
(
true
);
if
(
selected_option
==
select_options
.
size
()
-
1
)
if
(
selected_option
==
select_options
.
size
()
-
1
)
mainGame
->
btnOptionn
->
setVisible
(
false
);
mainGame
->
btnOptionn
->
setVisible
(
false
);
mainGame
->
SetStaticText
(
mainGame
->
stOptions
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetDesc
(
select_options
[
selected_option
]));
mainGame
->
SetStaticText
(
mainGame
->
stOptions
,
310
,
mainGame
->
textFont
,
dataManager
.
GetDesc
(
select_options
[
selected_option
]));
break
;
break
;
}
}
case
BUTTON_OPTION_0
:
{
case
BUTTON_OPTION_0
:
{
...
@@ -424,6 +424,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -424,6 +424,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame
->
wCardSelect
->
setText
(
dataManager
.
GetSysString
(
568
));
mainGame
->
wCardSelect
->
setText
(
dataManager
.
GetSysString
(
568
));
list_command
=
COMMAND_OPERATION
;
list_command
=
COMMAND_OPERATION
;
}
}
std
::
sort
(
selectable_cards
.
begin
(),
selectable_cards
.
end
(),
ClientCard
::
client_card_sort
);
ShowSelectCard
(
true
,
true
);
ShowSelectCard
(
true
,
true
);
}
}
break
;
break
;
...
@@ -580,6 +581,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -580,6 +581,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
}
}
}
list_command
=
COMMAND_LIST
;
list_command
=
COMMAND_LIST
;
std
::
sort
(
selectable_cards
.
begin
(),
selectable_cards
.
end
(),
ClientCard
::
client_card_sort
);
ShowSelectCard
(
true
);
ShowSelectCard
(
true
);
break
;
break
;
}
}
...
@@ -995,6 +997,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -995,6 +997,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame
->
ClearCardInfo
(
mcard
->
controler
);
mainGame
->
ClearCardInfo
(
mcard
->
controler
);
}
}
}
}
if
(
id
==
TEXT_CARD_LIST_TIP
)
{
mainGame
->
stCardListTip
->
setVisible
(
true
);
}
break
;
break
;
}
}
case
irr
:
:
gui
::
EGET_ELEMENT_LEFT
:
{
case
irr
:
:
gui
::
EGET_ELEMENT_LEFT
:
{
...
@@ -1010,6 +1015,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -1010,6 +1015,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
SetShowMark
(
mcard
,
false
);
SetShowMark
(
mcard
,
false
);
mainGame
->
stCardListTip
->
setVisible
(
false
);
mainGame
->
stCardListTip
->
setVisible
(
false
);
}
}
if
(
id
==
TEXT_CARD_LIST_TIP
)
{
mainGame
->
stCardListTip
->
setVisible
(
false
);
}
break
;
break
;
}
}
default:
default:
...
@@ -1789,6 +1797,15 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
...
@@ -1789,6 +1797,15 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
switch
(
id
)
{
switch
(
id
)
{
case
CHECKBOX_AUTO_SEARCH
:
{
case
CHECKBOX_AUTO_SEARCH
:
{
mainGame
->
gameConf
.
auto_search_limit
=
mainGame
->
chkAutoSearch
->
isChecked
()
?
0
:
-
1
;
mainGame
->
gameConf
.
auto_search_limit
=
mainGame
->
chkAutoSearch
->
isChecked
()
?
0
:
-
1
;
if
(
mainGame
->
is_building
&&
!
mainGame
->
is_siding
)
mainGame
->
deckBuilder
.
InstantSearch
();
return
true
;
break
;
}
case
CHECKBOX_MULTI_KEYWORDS
:
{
mainGame
->
gameConf
.
search_multiple_keywords
=
mainGame
->
chkMultiKeywords
->
isChecked
()
?
1
:
0
;
if
(
mainGame
->
is_building
&&
!
mainGame
->
is_siding
)
mainGame
->
deckBuilder
.
InstantSearch
();
return
true
;
return
true
;
break
;
break
;
}
}
...
@@ -2226,6 +2243,8 @@ void ClientField::ShowCardInfoInList(ClientCard* pcard, irr::gui::IGUIElement* e
...
@@ -2226,6 +2243,8 @@ void ClientField::ShowCardInfoInList(ClientCard* pcard, irr::gui::IGUIElement* e
if
(
pcard
->
code
)
{
if
(
pcard
->
code
)
{
str
.
append
(
dataManager
.
GetName
(
pcard
->
code
));
str
.
append
(
dataManager
.
GetName
(
pcard
->
code
));
}
}
if
(
pcard
->
status
&
STATUS_PROC_COMPLETE
)
str
.
append
(
L"
\n
"
).
append
(
dataManager
.
GetSysString
(
224
));
for
(
size_t
i
=
0
;
i
<
chains
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
chains
.
size
();
++
i
)
{
wchar_t
formatBuffer
[
2048
];
wchar_t
formatBuffer
[
2048
];
auto
chit
=
chains
[
i
];
auto
chit
=
chains
[
i
];
...
@@ -2243,9 +2262,14 @@ void ClientField::ShowCardInfoInList(ClientCard* pcard, irr::gui::IGUIElement* e
...
@@ -2243,9 +2262,14 @@ void ClientField::ShowCardInfoInList(ClientCard* pcard, irr::gui::IGUIElement* e
irr
::
core
::
rect
<
s32
>
ePos
=
element
->
getRelativePosition
();
irr
::
core
::
rect
<
s32
>
ePos
=
element
->
getRelativePosition
();
s32
x
=
(
ePos
.
UpperLeftCorner
.
X
+
ePos
.
LowerRightCorner
.
X
)
/
2
;
s32
x
=
(
ePos
.
UpperLeftCorner
.
X
+
ePos
.
LowerRightCorner
.
X
)
/
2
;
s32
y
=
ePos
.
LowerRightCorner
.
Y
;
s32
y
=
ePos
.
LowerRightCorner
.
Y
;
mainGame
->
SetStaticText
(
mainGame
->
stCardListTip
,
16
0
,
mainGame
->
guiFont
,
str
.
c_str
());
mainGame
->
SetStaticText
(
mainGame
->
stCardListTip
,
32
0
,
mainGame
->
guiFont
,
str
.
c_str
());
irr
::
core
::
dimension2d
<
unsigned
int
>
dTip
=
mainGame
->
guiFont
->
getDimension
(
mainGame
->
stCardListTip
->
getText
())
+
irr
::
core
::
dimension2d
<
unsigned
int
>
(
10
,
10
);
irr
::
core
::
dimension2d
<
unsigned
int
>
dTip
=
mainGame
->
guiFont
->
getDimension
(
mainGame
->
stCardListTip
->
getText
())
+
irr
::
core
::
dimension2d
<
unsigned
int
>
(
10
,
10
);
mainGame
->
stCardListTip
->
setRelativePosition
(
recti
(
x
-
dTip
.
Width
/
2
,
y
-
10
,
x
+
dTip
.
Width
/
2
,
y
-
10
+
dTip
.
Height
));
s32
w
=
dTip
.
Width
/
2
;
if
(
x
-
w
<
10
)
x
=
w
+
10
;
if
(
x
+
w
>
670
)
x
=
670
-
w
;
mainGame
->
stCardListTip
->
setRelativePosition
(
recti
(
x
-
w
,
y
-
10
,
x
+
w
,
y
-
10
+
dTip
.
Height
));
mainGame
->
stCardListTip
->
setVisible
(
true
);
mainGame
->
stCardListTip
->
setVisible
(
true
);
}
}
}
}
...
...
gframe/game.cpp
View file @
17cdeb8c
...
@@ -10,17 +10,7 @@
...
@@ -10,17 +10,7 @@
#include "netserver.h"
#include "netserver.h"
#include "single_mode.h"
#include "single_mode.h"
#ifndef _WIN32
const
unsigned
short
PRO_VERSION
=
0x1347
;
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
#else
#include <direct.h>
#include <io.h>
#endif
const
unsigned
short
PRO_VERSION
=
0x1346
;
namespace
ygo
{
namespace
ygo
{
...
@@ -28,7 +18,6 @@ Game* mainGame;
...
@@ -28,7 +18,6 @@ Game* mainGame;
bool
Game
::
Initialize
()
{
bool
Game
::
Initialize
()
{
srand
(
time
(
0
));
srand
(
time
(
0
));
initUtils
();
LoadConfig
();
LoadConfig
();
irr
::
SIrrlichtCreationParameters
params
=
irr
::
SIrrlichtCreationParameters
();
irr
::
SIrrlichtCreationParameters
params
=
irr
::
SIrrlichtCreationParameters
();
params
.
AntiAlias
=
gameConf
.
antialias
;
params
.
AntiAlias
=
gameConf
.
antialias
;
...
@@ -38,8 +27,10 @@ bool Game::Initialize() {
...
@@ -38,8 +27,10 @@ bool Game::Initialize() {
params
.
DriverType
=
irr
::
video
::
EDT_OPENGL
;
params
.
DriverType
=
irr
::
video
::
EDT_OPENGL
;
params
.
WindowSize
=
irr
::
core
::
dimension2d
<
u32
>
(
1024
,
640
);
params
.
WindowSize
=
irr
::
core
::
dimension2d
<
u32
>
(
1024
,
640
);
device
=
irr
::
createDeviceEx
(
params
);
device
=
irr
::
createDeviceEx
(
params
);
if
(
!
device
)
if
(
!
device
)
{
ErrorLog
(
"Failed to create Irrlicht Engine device!"
);
return
false
;
return
false
;
}
linePatternD3D
=
0
;
linePatternD3D
=
0
;
linePatternGL
=
0x0f0f
;
linePatternGL
=
0x0f0f
;
waitFrame
=
0
;
waitFrame
=
0
;
...
@@ -61,13 +52,19 @@ bool Game::Initialize() {
...
@@ -61,13 +52,19 @@ bool Game::Initialize() {
driver
->
setTextureCreationFlag
(
irr
::
video
::
ETCF_CREATE_MIP_MAPS
,
false
);
driver
->
setTextureCreationFlag
(
irr
::
video
::
ETCF_CREATE_MIP_MAPS
,
false
);
driver
->
setTextureCreationFlag
(
irr
::
video
::
ETCF_OPTIMIZED_FOR_QUALITY
,
true
);
driver
->
setTextureCreationFlag
(
irr
::
video
::
ETCF_OPTIMIZED_FOR_QUALITY
,
true
);
imageManager
.
SetDevice
(
device
);
imageManager
.
SetDevice
(
device
);
if
(
!
imageManager
.
Initial
())
if
(
!
imageManager
.
Initial
())
{
ErrorLog
(
"Failed to load textures!"
);
return
false
;
return
false
;
}
LoadExpansionDB
();
LoadExpansionDB
();
if
(
!
dataManager
.
LoadDB
(
"cards.cdb"
))
if
(
!
dataManager
.
LoadDB
(
"cards.cdb"
))
{
ErrorLog
(
"Failed to load card database (cards.cdb)!"
);
return
false
;
return
false
;
if
(
!
dataManager
.
LoadStrings
(
"strings.conf"
))
}
if
(
!
dataManager
.
LoadStrings
(
"strings.conf"
))
{
ErrorLog
(
"Failed to load strings!"
);
return
false
;
return
false
;
}
dataManager
.
LoadStrings
(
"./expansions/strings.conf"
);
dataManager
.
LoadStrings
(
"./expansions/strings.conf"
);
env
=
device
->
getGUIEnvironment
();
env
=
device
->
getGUIEnvironment
();
numFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
16
);
numFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
16
);
...
@@ -75,8 +72,10 @@ bool Game::Initialize() {
...
@@ -75,8 +72,10 @@ bool Game::Initialize() {
lpcFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
48
);
lpcFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
numfont
,
48
);
guiFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
textfont
,
gameConf
.
textfontsize
);
guiFont
=
irr
::
gui
::
CGUITTFont
::
createTTFont
(
env
,
gameConf
.
textfont
,
gameConf
.
textfontsize
);
textFont
=
guiFont
;
textFont
=
guiFont
;
if
(
!
numFont
||
!
textFont
)
if
(
!
numFont
||
!
textFont
)
{
ErrorLog
(
"Failed to load font(s)!"
);
return
false
;
return
false
;
}
smgr
=
device
->
getSceneManager
();
smgr
=
device
->
getSceneManager
();
device
->
setWindowCaption
(
L"YGOPro"
);
device
->
setWindowCaption
(
L"YGOPro"
);
device
->
setResizable
(
false
);
device
->
setResizable
(
false
);
...
@@ -274,6 +273,9 @@ bool Game::Initialize() {
...
@@ -274,6 +273,9 @@ bool Game::Initialize() {
posY
+=
30
;
posY
+=
30
;
chkQuickAnimation
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
posX
,
posY
,
posX
+
260
,
posY
+
25
),
tabHelper
,
CHECKBOX_QUICK_ANIMATION
,
dataManager
.
GetSysString
(
1299
));
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
);
chkQuickAnimation
->
setChecked
(
gameConf
.
quick_animation
!=
0
);
posY
+=
30
;
chkAutoSaveReplay
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
posX
,
posY
,
posX
+
260
,
posY
+
25
),
tabHelper
,
-
1
,
dataManager
.
GetSysString
(
1366
));
chkAutoSaveReplay
->
setChecked
(
gameConf
.
auto_save_replay
!=
0
);
//system
//system
irr
::
gui
::
IGUITab
*
tabSystem
=
wInfos
->
addTab
(
dataManager
.
GetSysString
(
1273
));
irr
::
gui
::
IGUITab
*
tabSystem
=
wInfos
->
addTab
(
dataManager
.
GetSysString
(
1273
));
posY
=
20
;
posY
=
20
;
...
@@ -295,6 +297,9 @@ bool Game::Initialize() {
...
@@ -295,6 +297,9 @@ bool Game::Initialize() {
chkAutoSearch
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
posX
,
posY
,
posX
+
260
,
posY
+
25
),
tabSystem
,
CHECKBOX_AUTO_SEARCH
,
dataManager
.
GetSysString
(
1358
));
chkAutoSearch
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
posX
,
posY
,
posX
+
260
,
posY
+
25
),
tabSystem
,
CHECKBOX_AUTO_SEARCH
,
dataManager
.
GetSysString
(
1358
));
chkAutoSearch
->
setChecked
(
gameConf
.
auto_search_limit
>=
0
);
chkAutoSearch
->
setChecked
(
gameConf
.
auto_search_limit
>=
0
);
posY
+=
30
;
posY
+=
30
;
chkMultiKeywords
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
posX
,
posY
,
posX
+
260
,
posY
+
25
),
tabSystem
,
CHECKBOX_MULTI_KEYWORDS
,
dataManager
.
GetSysString
(
1378
));
chkMultiKeywords
->
setChecked
(
gameConf
.
search_multiple_keywords
>
0
);
posY
+=
30
;
chkEnableSound
=
env
->
addCheckBox
(
gameConf
.
enable_sound
,
rect
<
s32
>
(
posX
,
posY
,
posX
+
120
,
posY
+
25
),
tabSystem
,
-
1
,
dataManager
.
GetSysString
(
1279
));
chkEnableSound
=
env
->
addCheckBox
(
gameConf
.
enable_sound
,
rect
<
s32
>
(
posX
,
posY
,
posX
+
120
,
posY
+
25
),
tabSystem
,
-
1
,
dataManager
.
GetSysString
(
1279
));
chkEnableSound
->
setChecked
(
gameConf
.
enable_sound
);
chkEnableSound
->
setChecked
(
gameConf
.
enable_sound
);
scrSoundVolume
=
env
->
addScrollBar
(
true
,
rect
<
s32
>
(
posX
+
126
,
posY
+
4
,
posX
+
260
,
posY
+
21
),
tabSystem
,
SCROLL_VOLUME
);
scrSoundVolume
=
env
->
addScrollBar
(
true
,
rect
<
s32
>
(
posX
+
126
,
posY
+
4
,
posX
+
260
,
posY
+
21
),
tabSystem
,
SCROLL_VOLUME
);
...
@@ -675,7 +680,7 @@ bool Game::Initialize() {
...
@@ -675,7 +680,7 @@ bool Game::Initialize() {
stTip
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
stTip
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
stTip
->
setVisible
(
false
);
stTip
->
setVisible
(
false
);
//tip for cards in select / display list
//tip for cards in select / display list
stCardListTip
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
0
,
0
,
150
,
150
),
false
,
true
,
wCardSelect
,
-
1
,
true
);
stCardListTip
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
0
,
0
,
150
,
150
),
false
,
true
,
wCardSelect
,
TEXT_CARD_LIST_TIP
,
true
);
stCardListTip
->
setBackgroundColor
(
0xc0ffffff
);
stCardListTip
->
setBackgroundColor
(
0xc0ffffff
);
stCardListTip
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
stCardListTip
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
stCardListTip
->
setVisible
(
false
);
stCardListTip
->
setVisible
(
false
);
...
@@ -861,70 +866,25 @@ void Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gu
...
@@ -861,70 +866,25 @@ void Game::SetStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, irr::gu
pControl
->
setText
(
dataManager
.
strBuffer
);
pControl
->
setText
(
dataManager
.
strBuffer
);
}
}
void
Game
::
LoadExpansionDB
()
{
void
Game
::
LoadExpansionDB
()
{
#ifdef _WIN32
FileSystem
::
TraversalDir
(
"./expansions"
,
[](
const
char
*
name
,
bool
isdir
)
{
char
fpath
[
1000
];
if
(
!
isdir
&&
strrchr
(
name
,
'.'
)
&&
!
mystrncasecmp
(
strrchr
(
name
,
'.'
),
".cdb"
,
4
))
{
WIN32_FIND_DATAW
fdataw
;
char
fpath
[
1024
];
HANDLE
fh
=
FindFirstFileW
(
L"./expansions/*.cdb"
,
&
fdataw
);
sprintf
(
fpath
,
"./expansions/%s"
,
name
);
if
(
fh
!=
INVALID_HANDLE_VALUE
)
{
dataManager
.
LoadDB
(
fpath
);
do
{
if
(
!
(
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
{
char
fname
[
780
];
BufferIO
::
EncodeUTF8
(
fdataw
.
cFileName
,
fname
);
sprintf
(
fpath
,
"./expansions/%s"
,
fname
);
dataManager
.
LoadDB
(
fpath
);
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./expansions/"
))
!=
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
);
dataManager
.
LoadDB
(
filepath
);
}
}
closedir
(
dir
);
});
}
#endif
}
}
void
Game
::
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
void
Game
::
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbDeck
)
{
cbDeck
->
clear
();
cbDeck
->
clear
();
#ifdef _WIN32
FileSystem
::
TraversalDir
(
L"./deck"
,
[
cbDeck
](
const
wchar_t
*
name
,
bool
isdir
)
{
WIN32_FIND_DATAW
fdataw
;
if
(
!
isdir
&&
wcsrchr
(
name
,
'.'
)
&&
!
mywcsncasecmp
(
wcsrchr
(
name
,
'.'
),
L".ydk"
,
4
))
{
HANDLE
fh
=
FindFirstFileW
(
L"./deck/*.ydk"
,
&
fdataw
);
size_t
len
=
wcslen
(
name
);
if
(
fh
==
INVALID_HANDLE_VALUE
)
wchar_t
deckname
[
256
];
return
;
wcsncpy
(
deckname
,
name
,
len
-
4
);
do
{
deckname
[
len
-
4
]
=
0
;
if
(
!
(
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
{
cbDeck
->
addItem
(
deckname
);
wchar_t
*
pf
=
fdataw
.
cFileName
;
while
(
*
pf
)
pf
++
;
while
(
*
pf
!=
L'.'
)
pf
--
;
*
pf
=
0
;
cbDeck
->
addItem
(
fdataw
.
cFileName
);
}
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
});
FindClose
(
fh
);
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./deck/"
))
==
NULL
)
return
;
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
size_t
len
=
strlen
(
dirp
->
d_name
);
if
(
len
<
5
||
strcasecmp
(
dirp
->
d_name
+
len
-
4
,
".ydk"
)
!=
0
)
continue
;
dirp
->
d_name
[
len
-
4
]
=
0
;
wchar_t
wname
[
256
];
BufferIO
::
DecodeUTF8
(
dirp
->
d_name
,
wname
);
cbDeck
->
addItem
(
wname
);
}
closedir
(
dir
);
#endif
for
(
size_t
i
=
0
;
i
<
cbDeck
->
getItemCount
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
cbDeck
->
getItemCount
();
++
i
)
{
if
(
!
wcscmp
(
cbDeck
->
getItem
(
i
),
gameConf
.
lastdeck
))
{
if
(
!
wcscmp
(
cbDeck
->
getItem
(
i
),
gameConf
.
lastdeck
))
{
cbDeck
->
setSelected
(
i
);
cbDeck
->
setSelected
(
i
);
...
@@ -934,61 +894,17 @@ void Game::RefreshDeck(irr::gui::IGUIComboBox* cbDeck) {
...
@@ -934,61 +894,17 @@ void Game::RefreshDeck(irr::gui::IGUIComboBox* cbDeck) {
}
}
void
Game
::
RefreshReplay
()
{
void
Game
::
RefreshReplay
()
{
lstReplayList
->
clear
();
lstReplayList
->
clear
();
#ifdef _WIN32
FileSystem
::
TraversalDir
(
L"./replay"
,
[
this
](
const
wchar_t
*
name
,
bool
isdir
)
{
WIN32_FIND_DATAW
fdataw
;
if
(
!
isdir
&&
wcsrchr
(
name
,
'.'
)
&&
!
mywcsncasecmp
(
wcsrchr
(
name
,
'.'
),
L".yrp"
,
4
)
&&
Replay
::
CheckReplay
(
name
))
HANDLE
fh
=
FindFirstFileW
(
L"./replay/*.yrp"
,
&
fdataw
);
lstReplayList
->
addItem
(
name
);
if
(
fh
==
INVALID_HANDLE_VALUE
)
});
return
;
do
{
if
(
!
(
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
&&
Replay
::
CheckReplay
(
fdataw
.
cFileName
))
{
lstReplayList
->
addItem
(
fdataw
.
cFileName
);
}
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./replay/"
))
==
NULL
)
return
;
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
size_t
len
=
strlen
(
dirp
->
d_name
);
if
(
len
<
5
||
strcasecmp
(
dirp
->
d_name
+
len
-
4
,
".yrp"
)
!=
0
)
continue
;
wchar_t
wname
[
256
];
BufferIO
::
DecodeUTF8
(
dirp
->
d_name
,
wname
);
if
(
Replay
::
CheckReplay
(
wname
))
lstReplayList
->
addItem
(
wname
);
}
closedir
(
dir
);
#endif
}
}
void
Game
::
RefreshSingleplay
()
{
void
Game
::
RefreshSingleplay
()
{
lstSinglePlayList
->
clear
();
lstSinglePlayList
->
clear
();
#ifdef _WIN32
FileSystem
::
TraversalDir
(
L"./single"
,
[
this
](
const
wchar_t
*
name
,
bool
isdir
)
{
WIN32_FIND_DATAW
fdataw
;
if
(
!
isdir
&&
wcsrchr
(
name
,
'.'
)
&&
!
mywcsncasecmp
(
wcsrchr
(
name
,
'.'
),
L".lua"
,
4
))
HANDLE
fh
=
FindFirstFileW
(
L"./single/*.lua"
,
&
fdataw
);
lstSinglePlayList
->
addItem
(
name
);
if
(
fh
==
INVALID_HANDLE_VALUE
)
});
return
;
do
{
if
(
!
(
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
lstSinglePlayList
->
addItem
(
fdataw
.
cFileName
);
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./single/"
))
==
NULL
)
return
;
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
size_t
len
=
strlen
(
dirp
->
d_name
);
if
(
len
<
5
||
strcasecmp
(
dirp
->
d_name
+
len
-
4
,
".lua"
)
!=
0
)
continue
;
wchar_t
wname
[
256
];
BufferIO
::
DecodeUTF8
(
dirp
->
d_name
,
wname
);
lstSinglePlayList
->
addItem
(
wname
);
}
closedir
(
dir
);
#endif
}
}
void
Game
::
RefreshBot
()
{
void
Game
::
RefreshBot
()
{
if
(
!
gameConf
.
enable_bot_mode
)
if
(
!
gameConf
.
enable_bot_mode
)
...
@@ -1065,10 +981,12 @@ void Game::LoadConfig() {
...
@@ -1065,10 +981,12 @@ void Game::LoadConfig() {
gameConf
.
draw_field_spell
=
1
;
gameConf
.
draw_field_spell
=
1
;
gameConf
.
separate_clear_button
=
1
;
gameConf
.
separate_clear_button
=
1
;
gameConf
.
auto_search_limit
=
-
1
;
gameConf
.
auto_search_limit
=
-
1
;
gameConf
.
search_multiple_keywords
=
1
;
gameConf
.
chkIgnoreDeckChanges
=
0
;
gameConf
.
chkIgnoreDeckChanges
=
0
;
gameConf
.
defaultOT
=
1
;
gameConf
.
defaultOT
=
1
;
gameConf
.
enable_bot_mode
=
0
;
gameConf
.
enable_bot_mode
=
0
;
gameConf
.
quick_animation
=
0
;
gameConf
.
quick_animation
=
0
;
gameConf
.
auto_save_replay
=
0
;
gameConf
.
enable_sound
=
true
;
gameConf
.
enable_sound
=
true
;
gameConf
.
sound_volume
=
0.5
;
gameConf
.
sound_volume
=
0.5
;
gameConf
.
enable_music
=
true
;
gameConf
.
enable_music
=
true
;
...
@@ -1130,6 +1048,8 @@ void Game::LoadConfig() {
...
@@ -1130,6 +1048,8 @@ void Game::LoadConfig() {
gameConf
.
separate_clear_button
=
atoi
(
valbuf
);
gameConf
.
separate_clear_button
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"auto_search_limit"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"auto_search_limit"
))
{
gameConf
.
auto_search_limit
=
atoi
(
valbuf
);
gameConf
.
auto_search_limit
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"search_multiple_keywords"
))
{
gameConf
.
search_multiple_keywords
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"ignore_deck_changes"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"ignore_deck_changes"
))
{
gameConf
.
chkIgnoreDeckChanges
=
atoi
(
valbuf
);
gameConf
.
chkIgnoreDeckChanges
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"default_ot"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"default_ot"
))
{
...
@@ -1138,6 +1058,8 @@ void Game::LoadConfig() {
...
@@ -1138,6 +1058,8 @@ void Game::LoadConfig() {
gameConf
.
enable_bot_mode
=
atoi
(
valbuf
);
gameConf
.
enable_bot_mode
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"quick_animation"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"quick_animation"
))
{
gameConf
.
quick_animation
=
atoi
(
valbuf
);
gameConf
.
quick_animation
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"auto_save_replay"
))
{
gameConf
.
auto_save_replay
=
atoi
(
valbuf
);
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
}
else
if
(
!
strcmp
(
strbuf
,
"enable_sound"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"enable_sound"
))
{
gameConf
.
enable_sound
=
atoi
(
valbuf
)
>
0
;
gameConf
.
enable_sound
=
atoi
(
valbuf
)
>
0
;
...
@@ -1207,10 +1129,13 @@ void Game::SaveConfig() {
...
@@ -1207,10 +1129,13 @@ void Game::SaveConfig() {
fprintf
(
fp
,
"separate_clear_button = %d
\n
"
,
gameConf
.
separate_clear_button
);
fprintf
(
fp
,
"separate_clear_button = %d
\n
"
,
gameConf
.
separate_clear_button
);
fprintf
(
fp
,
"#auto_search_limit >= 0: Start search automatically when the user enters N chars
\n
"
);
fprintf
(
fp
,
"#auto_search_limit >= 0: Start search automatically when the user enters N chars
\n
"
);
fprintf
(
fp
,
"auto_search_limit = %d
\n
"
,
gameConf
.
auto_search_limit
);
fprintf
(
fp
,
"auto_search_limit = %d
\n
"
,
gameConf
.
auto_search_limit
);
fprintf
(
fp
,
"#search_multiple_keywords = 0: Disable. 1: Search mutiple keywords with separator
\"
\"
. 2: with separator
\"
+
\"\n
"
);
fprintf
(
fp
,
"search_multiple_keywords = %d
\n
"
,
gameConf
.
search_multiple_keywords
);
fprintf
(
fp
,
"ignore_deck_changes = %d
\n
"
,
(
chkIgnoreDeckChanges
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"ignore_deck_changes = %d
\n
"
,
(
chkIgnoreDeckChanges
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"default_ot = %d
\n
"
,
gameConf
.
defaultOT
);
fprintf
(
fp
,
"default_ot = %d
\n
"
,
gameConf
.
defaultOT
);
fprintf
(
fp
,
"enable_bot_mode = %d
\n
"
,
gameConf
.
enable_bot_mode
);
fprintf
(
fp
,
"enable_bot_mode = %d
\n
"
,
gameConf
.
enable_bot_mode
);
fprintf
(
fp
,
"quick_animation = %d
\n
"
,
gameConf
.
quick_animation
);
fprintf
(
fp
,
"quick_animation = %d
\n
"
,
gameConf
.
quick_animation
);
fprintf
(
fp
,
"auto_save_replay = %d
\n
"
,
(
chkAutoSaveReplay
->
isChecked
()
?
1
:
0
));
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
fprintf
(
fp
,
"enable_sound = %d
\n
"
,
(
chkEnableSound
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"enable_sound = %d
\n
"
,
(
chkEnableSound
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"enable_music = %d
\n
"
,
(
chkEnableMusic
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"enable_music = %d
\n
"
,
(
chkEnableMusic
->
isChecked
()
?
1
:
0
));
...
@@ -1310,7 +1235,7 @@ void Game::ClearCardInfo(int player) {
...
@@ -1310,7 +1235,7 @@ void Game::ClearCardInfo(int player) {
stText
->
setText
(
L""
);
stText
->
setText
(
L""
);
scrCardText
->
setVisible
(
false
);
scrCardText
->
setVisible
(
false
);
}
}
void
Game
::
AddChatMsg
(
wchar_t
*
msg
,
int
player
)
{
void
Game
::
AddChatMsg
(
const
wchar_t
*
msg
,
int
player
)
{
for
(
int
i
=
7
;
i
>
0
;
--
i
)
{
for
(
int
i
=
7
;
i
>
0
;
--
i
)
{
chatMsg
[
i
]
=
chatMsg
[
i
-
1
];
chatMsg
[
i
]
=
chatMsg
[
i
-
1
];
chatTiming
[
i
]
=
chatTiming
[
i
-
1
];
chatTiming
[
i
]
=
chatTiming
[
i
-
1
];
...
@@ -1361,72 +1286,28 @@ void Game::ClearChatMsg() {
...
@@ -1361,72 +1286,28 @@ void Game::ClearChatMsg() {
chatTiming
[
i
]
=
0
;
chatTiming
[
i
]
=
0
;
}
}
}
}
void
Game
::
AddDebugMsg
(
char
*
msg
)
void
Game
::
AddDebugMsg
(
const
char
*
msg
)
{
{
if
(
enable_log
&
0x1
)
{
if
(
enable_log
&
0x1
)
{
wchar_t
wbuf
[
1024
];
wchar_t
wbuf
[
1024
];
BufferIO
::
DecodeUTF8
(
msg
,
wbuf
);
BufferIO
::
DecodeUTF8
(
msg
,
wbuf
);
AddChatMsg
(
wbuf
,
9
);
AddChatMsg
(
wbuf
,
9
);
}
}
if
(
enable_log
&
0x2
)
{
if
(
enable_log
&
0x2
)
{
FILE
*
fp
=
fopen
(
"error.log"
,
"at"
);
char
msgbuf
[
1040
];
if
(
!
fp
)
sprintf
(
msgbuf
,
"[Script Error]: %s"
,
msg
);
return
;
ErrorLog
(
msgbuf
);
time_t
nowtime
=
time
(
NULL
);
struct
tm
*
localedtime
=
localtime
(
&
nowtime
);
char
timebuf
[
40
];
strftime
(
timebuf
,
40
,
"%Y-%m-%d %H:%M:%S"
,
localedtime
);
fprintf
(
fp
,
"[%s][Script Error]: %s
\n
"
,
timebuf
,
msg
);
fclose
(
fp
);
}
}
}
}
bool
Game
::
MakeDirectory
(
const
std
::
string
folder
)
{
void
Game
::
ErrorLog
(
const
char
*
msg
)
{
std
::
string
folder_builder
;
FILE
*
fp
=
fopen
(
"error.log"
,
"at"
);
std
::
string
sub
;
if
(
!
fp
)
sub
.
reserve
(
folder
.
size
());
return
;
for
(
auto
it
=
folder
.
begin
();
it
!=
folder
.
end
();
++
it
)
{
time_t
nowtime
=
time
(
NULL
);
const
char
c
=
*
it
;
tm
*
localedtime
=
localtime
(
&
nowtime
);
sub
.
push_back
(
c
);
char
timebuf
[
40
];
if
(
c
==
'/'
||
it
==
folder
.
end
()
-
1
)
{
strftime
(
timebuf
,
40
,
"%Y-%m-%d %H:%M:%S"
,
localedtime
);
folder_builder
.
append
(
sub
);
fprintf
(
fp
,
"[%s]%s
\n
"
,
timebuf
,
msg
);
if
(
access
(
folder_builder
.
c_str
(),
0
)
!=
0
)
fclose
(
fp
);
#ifdef _WIN32
if
(
mkdir
(
folder_builder
.
c_str
())
!=
0
)
#else
if
(
mkdir
(
folder_builder
.
c_str
(),
0777
)
!=
0
)
#endif
return
false
;
sub
.
clear
();
}
}
return
true
;
}
void
Game
::
initUtils
()
{
//user files
MakeDirectory
(
"replay"
);
//cards from extra pack
MakeDirectory
(
"expansions"
);
//files in ygopro-starter-pack
MakeDirectory
(
"deck"
);
MakeDirectory
(
"single"
);
//original files
MakeDirectory
(
"script"
);
MakeDirectory
(
"textures"
);
//sound
#ifdef YGOPRO_USE_IRRKLANG
MakeDirectory
(
"sound"
);
MakeDirectory
(
"sound/BGM"
);
MakeDirectory
(
"sound/BGM/advantage"
);
MakeDirectory
(
"sound/BGM/deck"
);
MakeDirectory
(
"sound/BGM/disadvantage"
);
MakeDirectory
(
"sound/BGM/duel"
);
MakeDirectory
(
"sound/BGM/lose"
);
MakeDirectory
(
"sound/BGM/menu"
);
MakeDirectory
(
"sound/BGM/win"
);
#endif
//pics
MakeDirectory
(
"pics"
);
MakeDirectory
(
"pics/field"
);
}
}
void
Game
::
ClearTextures
()
{
void
Game
::
ClearTextures
()
{
matManager
.
mCard
.
setTexture
(
0
,
0
);
matManager
.
mCard
.
setTexture
(
0
,
0
);
...
...
gframe/game.h
View file @
17cdeb8c
...
@@ -39,10 +39,12 @@ struct Config {
...
@@ -39,10 +39,12 @@ struct Config {
int
draw_field_spell
;
int
draw_field_spell
;
int
separate_clear_button
;
int
separate_clear_button
;
int
auto_search_limit
;
int
auto_search_limit
;
int
search_multiple_keywords
;
int
chkIgnoreDeckChanges
;
int
chkIgnoreDeckChanges
;
int
defaultOT
;
int
defaultOT
;
int
enable_bot_mode
;
int
enable_bot_mode
;
int
quick_animation
;
int
quick_animation
;
int
auto_save_replay
;
bool
enable_sound
;
bool
enable_sound
;
bool
enable_music
;
bool
enable_music
;
double
sound_volume
;
double
sound_volume
;
...
@@ -132,11 +134,10 @@ public:
...
@@ -132,11 +134,10 @@ public:
void
SaveConfig
();
void
SaveConfig
();
void
ShowCardInfo
(
int
code
);
void
ShowCardInfo
(
int
code
);
void
ClearCardInfo
(
int
player
=
0
);
void
ClearCardInfo
(
int
player
=
0
);
void
AddChatMsg
(
wchar_t
*
msg
,
int
player
);
void
AddChatMsg
(
const
wchar_t
*
msg
,
int
player
);
void
ClearChatMsg
();
void
ClearChatMsg
();
void
AddDebugMsg
(
char
*
msgbuf
);
void
AddDebugMsg
(
const
char
*
msgbuf
);
bool
MakeDirectory
(
const
std
::
string
folder
);
void
ErrorLog
(
const
char
*
msgbuf
);
void
initUtils
();
void
ClearTextures
();
void
ClearTextures
();
void
CloseDuelWindow
();
void
CloseDuelWindow
();
...
@@ -243,10 +244,12 @@ public:
...
@@ -243,10 +244,12 @@ public:
irr
::
gui
::
IGUICheckBox
*
chkAutoChain
;
irr
::
gui
::
IGUICheckBox
*
chkAutoChain
;
irr
::
gui
::
IGUICheckBox
*
chkWaitChain
;
irr
::
gui
::
IGUICheckBox
*
chkWaitChain
;
irr
::
gui
::
IGUICheckBox
*
chkQuickAnimation
;
irr
::
gui
::
IGUICheckBox
*
chkQuickAnimation
;
irr
::
gui
::
IGUICheckBox
*
chkAutoSaveReplay
;
irr
::
gui
::
IGUICheckBox
*
chkHideSetname
;
irr
::
gui
::
IGUICheckBox
*
chkHideSetname
;
irr
::
gui
::
IGUICheckBox
*
chkHideHintButton
;
irr
::
gui
::
IGUICheckBox
*
chkHideHintButton
;
irr
::
gui
::
IGUICheckBox
*
chkIgnoreDeckChanges
;
irr
::
gui
::
IGUICheckBox
*
chkIgnoreDeckChanges
;
irr
::
gui
::
IGUICheckBox
*
chkAutoSearch
;
irr
::
gui
::
IGUICheckBox
*
chkAutoSearch
;
irr
::
gui
::
IGUICheckBox
*
chkMultiKeywords
;
irr
::
gui
::
IGUICheckBox
*
chkEnableSound
;
irr
::
gui
::
IGUICheckBox
*
chkEnableSound
;
irr
::
gui
::
IGUICheckBox
*
chkEnableMusic
;
irr
::
gui
::
IGUICheckBox
*
chkEnableMusic
;
irr
::
gui
::
IGUIScrollBar
*
scrSoundVolume
;
irr
::
gui
::
IGUIScrollBar
*
scrSoundVolume
;
...
@@ -553,6 +556,7 @@ extern Game* mainGame;
...
@@ -553,6 +556,7 @@ extern Game* mainGame;
#define BUTTON_CARD_4 234
#define BUTTON_CARD_4 234
#define SCROLL_CARD_SELECT 235
#define SCROLL_CARD_SELECT 235
#define BUTTON_CARD_SEL_OK 236
#define BUTTON_CARD_SEL_OK 236
#define TEXT_CARD_LIST_TIP 237
#define BUTTON_CMD_ACTIVATE 240
#define BUTTON_CMD_ACTIVATE 240
#define BUTTON_CMD_SUMMON 241
#define BUTTON_CMD_SUMMON 241
#define BUTTON_CMD_SPSUMMON 242
#define BUTTON_CMD_SPSUMMON 242
...
@@ -623,6 +627,7 @@ extern Game* mainGame;
...
@@ -623,6 +627,7 @@ extern Game* mainGame;
#define BUTTON_LOAD_SINGLEPLAY 351
#define BUTTON_LOAD_SINGLEPLAY 351
#define BUTTON_CANCEL_SINGLEPLAY 352
#define BUTTON_CANCEL_SINGLEPLAY 352
#define CHECKBOX_AUTO_SEARCH 360
#define CHECKBOX_AUTO_SEARCH 360
#define CHECKBOX_MULTI_KEYWORDS 372
#define CHECKBOX_ENABLE_SOUND 361
#define CHECKBOX_ENABLE_SOUND 361
#define CHECKBOX_ENABLE_MUSIC 362
#define CHECKBOX_ENABLE_MUSIC 362
#define SCROLL_VOLUME 363
#define SCROLL_VOLUME 363
...
...
gframe/menu_handler.cpp
View file @
17cdeb8c
...
@@ -248,7 +248,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -248,7 +248,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
wchar_t
textBuffer
[
256
];
wchar_t
textBuffer
[
256
];
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
mainGame
->
lstReplayList
->
getListItem
(
sel
),
dataManager
.
GetSysString
(
1363
));
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
mainGame
->
lstReplayList
->
getListItem
(
sel
),
dataManager
.
GetSysString
(
1363
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
textBuffer
);
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
prev_operation
=
id
;
prev_operation
=
id
;
...
@@ -439,7 +439,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -439,7 +439,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
std
::
wstring
repinfo
;
std
::
wstring
repinfo
;
time_t
curtime
=
ReplayMode
::
cur_replay
.
pheader
.
seed
;
time_t
curtime
=
ReplayMode
::
cur_replay
.
pheader
.
seed
;
tm
*
st
=
localtime
(
&
curtime
);
tm
*
st
=
localtime
(
&
curtime
);
myswprintf
(
infobuf
,
L"%d/%d/%d %02d:%02d:%02d
\n
"
,
st
->
tm_year
+
1900
,
st
->
tm_mon
+
1
,
st
->
tm_mday
,
st
->
tm_hour
,
st
->
tm_min
,
st
->
tm_sec
);
wcsftime
(
infobuf
,
256
,
L"%Y/%m/%d %H:%M:%S
\n
"
,
st
);
repinfo
.
append
(
infobuf
);
repinfo
.
append
(
infobuf
);
wchar_t
namebuf
[
4
][
20
];
wchar_t
namebuf
[
4
][
20
];
ReplayMode
::
cur_replay
.
ReadName
(
namebuf
[
0
]);
ReplayMode
::
cur_replay
.
ReadName
(
namebuf
[
0
]);
...
@@ -454,7 +454,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -454,7 +454,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
myswprintf
(
infobuf
,
L"%ls
\n
===VS===
\n
%ls
\n
"
,
namebuf
[
0
],
namebuf
[
1
]);
myswprintf
(
infobuf
,
L"%ls
\n
===VS===
\n
%ls
\n
"
,
namebuf
[
0
],
namebuf
[
1
]);
repinfo
.
append
(
infobuf
);
repinfo
.
append
(
infobuf
);
mainGame
->
ebRepStartTurn
->
setText
(
L"1"
);
mainGame
->
ebRepStartTurn
->
setText
(
L"1"
);
mainGame
->
SetStaticText
(
mainGame
->
stReplayInfo
,
180
,
mainGame
->
guiFont
,
(
wchar_t
*
)
repinfo
.
c_str
());
mainGame
->
SetStaticText
(
mainGame
->
stReplayInfo
,
180
,
mainGame
->
guiFont
,
repinfo
.
c_str
());
break
;
break
;
}
}
case
LISTBOX_BOT_LIST
:
{
case
LISTBOX_BOT_LIST
:
{
...
...
gframe/myfilesystem.h
0 → 100644
View file @
17cdeb8c
#ifndef FILESYSTEM_H
#define FILESYSTEM_H
#include <string.h>
#include <functional>
#include "bufferio.h"
#ifdef _WIN32
#include <direct.h>
#include <sys/stat.h>
#else
#include <dirent.h>
#include <sys/stat.h>
#endif
#ifdef _WIN32
#include <Windows.h>
class
FileSystem
{
public:
static
bool
IsFileExists
(
const
wchar_t
*
wfile
)
{
struct
_stat
fileStat
;
return
(
_wstat
(
wfile
,
&
fileStat
)
==
0
)
&&
!
(
fileStat
.
st_mode
&
_S_IFDIR
);
}
static
bool
IsFileExists
(
const
char
*
file
)
{
wchar_t
wfile
[
1024
];
BufferIO
::
DecodeUTF8
(
file
,
wfile
);
return
IsFileExists
(
wfile
);
}
static
bool
IsDirExists
(
const
wchar_t
*
wdir
)
{
struct
_stat
fileStat
;
return
(
_wstat
(
wdir
,
&
fileStat
)
==
0
)
&&
(
fileStat
.
st_mode
&
_S_IFDIR
);
}
static
bool
IsDirExists
(
const
char
*
dir
)
{
wchar_t
wdir
[
1024
];
BufferIO
::
DecodeUTF8
(
dir
,
wdir
);
return
IsDirExists
(
wdir
);
}
static
bool
MakeDir
(
const
wchar_t
*
wdir
)
{
return
_wmkdir
(
wdir
)
==
0
;
}
static
bool
MakeDir
(
const
char
*
dir
)
{
wchar_t
wdir
[
1024
];
BufferIO
::
DecodeUTF8
(
dir
,
wdir
);
return
MakeDir
(
wdir
);
}
static
void
TraversalDir
(
const
wchar_t
*
wpath
,
const
std
::
function
<
void
(
const
wchar_t
*
,
bool
)
>&
cb
)
{
wchar_t
findstr
[
1024
];
wcscpy
(
findstr
,
wpath
);
wcscat
(
findstr
,
L"/*"
);
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
findstr
,
&
fdataw
);
if
(
fh
==
INVALID_HANDLE_VALUE
)
return
;
do
{
cb
(
fdataw
.
cFileName
,
(
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
));
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
}
static
void
TraversalDir
(
const
char
*
path
,
const
std
::
function
<
void
(
const
char
*
,
bool
)
>&
cb
)
{
wchar_t
wpath
[
1024
];
BufferIO
::
DecodeUTF8
(
path
,
wpath
);
TraversalDir
(
wpath
,
[
&
cb
](
const
wchar_t
*
wname
,
bool
isdir
)
{
char
name
[
1024
];
BufferIO
::
EncodeUTF8
(
wname
,
name
);
cb
(
name
,
isdir
);
});
}
};
#else
class
FileSystem
{
public:
static
bool
IsFileExists
(
const
char
*
file
)
{
struct
stat
fileStat
;
return
(
stat
(
file
,
&
fileStat
)
==
0
)
&&
!
S_ISDIR
(
fileStat
.
st_mode
);
}
static
bool
IsFileExists
(
const
wchar_t
*
wfile
)
{
char
file
[
1024
];
BufferIO
::
EncodeUTF8
(
wfile
,
file
);
return
IsFileExists
(
file
);
}
static
bool
IsDirExists
(
const
char
*
dir
)
{
struct
stat
fileStat
;
return
(
stat
(
dir
,
&
fileStat
)
==
0
)
&&
S_ISDIR
(
fileStat
.
st_mode
);
}
static
bool
IsDirExists
(
const
wchar_t
*
wdir
)
{
char
dir
[
1024
];
BufferIO
::
EncodeUTF8
(
wdir
,
dir
);
return
IsDirExists
(
dir
);
}
static
bool
MakeDir
(
const
char
*
dir
)
{
return
mkdir
(
dir
,
0775
)
==
0
;
}
static
bool
MakeDir
(
const
wchar_t
*
wdir
)
{
char
dir
[
1024
];
BufferIO
::
EncodeUTF8
(
wdir
,
dir
);
return
MakeDir
(
dir
);
}
static
void
TraversalDir
(
const
char
*
path
,
const
std
::
function
<
void
(
const
char
*
,
bool
)
>&
cb
)
{
DIR
*
dir
=
nullptr
;
struct
dirent
*
dirp
=
nullptr
;
if
((
dir
=
opendir
(
path
))
==
nullptr
)
return
;
struct
stat
fileStat
;
while
((
dirp
=
readdir
(
dir
))
!=
nullptr
)
{
char
fname
[
1024
];
strcpy
(
fname
,
path
);
strcat
(
fname
,
"/"
);
strcat
(
fname
,
dirp
->
d_name
);
stat
(
fname
,
&
fileStat
);
cb
(
dirp
->
d_name
,
S_ISDIR
(
fileStat
.
st_mode
));
}
closedir
(
dir
);
}
static
void
TraversalDir
(
const
wchar_t
*
wpath
,
const
std
::
function
<
void
(
const
wchar_t
*
,
bool
)
>&
cb
)
{
char
path
[
1024
];
BufferIO
::
EncodeUTF8
(
wpath
,
path
);
TraversalDir
(
path
,
[
&
cb
](
const
char
*
name
,
bool
isdir
)
{
wchar_t
wname
[
1024
];
BufferIO
::
DecodeUTF8
(
name
,
wname
);
cb
(
wname
,
isdir
);
});
}
};
#endif // _WIN32
#endif //FILESYSTEM_H
gframe/replay.cpp
View file @
17cdeb8c
...
@@ -17,6 +17,8 @@ Replay::~Replay() {
...
@@ -17,6 +17,8 @@ Replay::~Replay() {
delete
[]
comp_data
;
delete
[]
comp_data
;
}
}
void
Replay
::
BeginRecord
()
{
void
Replay
::
BeginRecord
()
{
if
(
!
FileSystem
::
IsDirExists
(
L"./replay"
)
&&
!
FileSystem
::
MakeDir
(
L"./replay"
))
return
;
#ifdef _WIN32
#ifdef _WIN32
if
(
is_recording
)
if
(
is_recording
)
CloseHandle
(
recording_fp
);
CloseHandle
(
recording_fp
);
...
@@ -123,6 +125,8 @@ void Replay::EndRecord() {
...
@@ -123,6 +125,8 @@ void Replay::EndRecord() {
is_recording
=
false
;
is_recording
=
false
;
}
}
void
Replay
::
SaveReplay
(
const
wchar_t
*
name
)
{
void
Replay
::
SaveReplay
(
const
wchar_t
*
name
)
{
if
(
!
FileSystem
::
IsDirExists
(
L"./replay"
)
&&
!
FileSystem
::
MakeDir
(
L"./replay"
))
return
;
wchar_t
fname
[
256
];
wchar_t
fname
[
256
];
myswprintf
(
fname
,
L"./replay/%ls.yrp"
,
name
);
myswprintf
(
fname
,
L"./replay/%ls.yrp"
,
name
);
#ifdef WIN32
#ifdef WIN32
...
...
gframe/single_duel.cpp
View file @
17cdeb8c
...
@@ -1487,18 +1487,17 @@ void SingleDuel::RefreshHand(int player, int flag, int use_cache) {
...
@@ -1487,18 +1487,17 @@ void SingleDuel::RefreshHand(int player, int flag, int use_cache) {
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
BufferIO
::
WriteInt8
(
qbuf
,
player
);
BufferIO
::
WriteInt8
(
qbuf
,
player
);
BufferIO
::
WriteInt8
(
qbuf
,
LOCATION_HAND
);
BufferIO
::
WriteInt8
(
qbuf
,
LOCATION_HAND
);
int
len
=
query_field_card
(
pduel
,
player
,
LOCATION_HAND
,
flag
|
QUERY_
IS_PUBLIC
,
(
unsigned
char
*
)
qbuf
,
use_cache
);
int
len
=
query_field_card
(
pduel
,
player
,
LOCATION_HAND
,
flag
|
QUERY_
POSITION
,
(
unsigned
char
*
)
qbuf
,
use_cache
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
int
qlen
=
0
;
int
qlen
=
0
;
while
(
qlen
<
len
)
{
while
(
qlen
<
len
)
{
int
slen
=
BufferIO
::
ReadInt32
(
qbuf
);
int
slen
=
BufferIO
::
ReadInt32
(
qbuf
);
int
qflag
=
*
(
int
*
)
qbuf
;
int
qflag
=
*
(
int
*
)
qbuf
;
int
pos
=
slen
-
8
;
int
offset
=
8
;
if
(
qflag
&
QUERY_LSCALE
)
if
(
!
(
qflag
&
QUERY_CODE
))
pos
-=
4
;
offset
-=
4
;
if
(
qflag
&
QUERY_RSCALE
)
unsigned
position
=
((
*
(
int
*
)(
qbuf
+
offset
))
>>
24
)
&
0xff
;
pos
-=
4
;
if
(
!
(
position
&
POS_FACEUP
))
if
(
!
qbuf
[
pos
])
memset
(
qbuf
,
0
,
slen
-
4
);
memset
(
qbuf
,
0
,
slen
-
4
);
qbuf
+=
slen
-
4
;
qbuf
+=
slen
-
4
;
qlen
+=
slen
;
qlen
+=
slen
;
...
...
gframe/single_mode.cpp
View file @
17cdeb8c
...
@@ -128,18 +128,25 @@ int SingleMode::SinglePlayThread(void* param) {
...
@@ -128,18 +128,25 @@ int SingleMode::SinglePlayThread(void* param) {
}
}
last_replay
.
EndRecord
();
last_replay
.
EndRecord
();
time_t
nowtime
=
time
(
NULL
);
time_t
nowtime
=
time
(
NULL
);
struct
tm
*
localedtime
=
localtime
(
&
nowtime
);
tm
*
localedtime
=
localtime
(
&
nowtime
);
char
timebuf
[
40
];
wchar_t
timetext
[
40
];
strftime
(
timebuf
,
40
,
"%Y-%m-%d %H-%M-%S"
,
localedtime
);
wcsftime
(
timetext
,
40
,
L"%Y-%m-%d %H-%M-%S"
,
localedtime
);
size_t
size
=
strlen
(
timebuf
)
+
1
;
wchar_t
timetext
[
80
];
mbstowcs
(
timetext
,
timebuf
,
size
);
mainGame
->
ebRSName
->
setText
(
timetext
);
mainGame
->
ebRSName
->
setText
(
timetext
);
mainGame
->
wReplaySave
->
setText
(
dataManager
.
GetSysString
(
1340
));
if
(
!
mainGame
->
chkAutoSaveReplay
->
isChecked
())
{
mainGame
->
PopupElement
(
mainGame
->
wReplaySave
);
mainGame
->
wReplaySave
->
setText
(
dataManager
.
GetSysString
(
1340
));
mainGame
->
gMutex
.
Unlock
();
mainGame
->
PopupElement
(
mainGame
->
wReplaySave
);
mainGame
->
replaySignal
.
Reset
();
mainGame
->
gMutex
.
Unlock
();
mainGame
->
replaySignal
.
Wait
();
mainGame
->
replaySignal
.
Reset
();
mainGame
->
replaySignal
.
Wait
();
}
else
{
mainGame
->
actionParam
=
1
;
wchar_t
msgbuf
[
256
];
myswprintf
(
msgbuf
,
dataManager
.
GetSysString
(
1367
),
timetext
);
mainGame
->
SetStaticText
(
mainGame
->
stACMessage
,
310
,
mainGame
->
guiFont
,
msgbuf
);
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
WaitFrameSignal
(
30
);
}
if
(
mainGame
->
actionParam
)
if
(
mainGame
->
actionParam
)
last_replay
.
SaveReplay
(
mainGame
->
ebRSName
->
getText
());
last_replay
.
SaveReplay
(
mainGame
->
ebRSName
->
getText
());
end_duel
(
pduel
);
end_duel
(
pduel
);
...
...
gframe/sound_manager.cpp
View file @
17cdeb8c
#include "sound_manager.h"
#include "sound_manager.h"
#ifndef _WIN32
#ifdef IRRKLANG_STATIC
#include <dirent.h>
#endif
#ifdef YGOPRO_USE_IRRKLANG
#include "../ikpmp3/ikpMP3.h"
#include "../ikpmp3/ikpMP3.h"
#endif
#endif
...
@@ -28,51 +25,23 @@ bool SoundManager::Init() {
...
@@ -28,51 +25,23 @@ bool SoundManager::Init() {
}
}
void
SoundManager
::
RefreshBGMList
()
{
void
SoundManager
::
RefreshBGMList
()
{
RefershBGMDir
(
L""
,
BGM_DUEL
);
RefershBGMDir
(
L""
,
BGM_DUEL
);
RefershBGMDir
(
L"duel
/
"
,
BGM_DUEL
);
RefershBGMDir
(
L"duel"
,
BGM_DUEL
);
RefershBGMDir
(
L"menu
/
"
,
BGM_MENU
);
RefershBGMDir
(
L"menu"
,
BGM_MENU
);
RefershBGMDir
(
L"deck
/
"
,
BGM_DECK
);
RefershBGMDir
(
L"deck"
,
BGM_DECK
);
RefershBGMDir
(
L"advantage
/
"
,
BGM_ADVANTAGE
);
RefershBGMDir
(
L"advantage"
,
BGM_ADVANTAGE
);
RefershBGMDir
(
L"disadvantage
/
"
,
BGM_DISADVANTAGE
);
RefershBGMDir
(
L"disadvantage"
,
BGM_DISADVANTAGE
);
RefershBGMDir
(
L"win
/
"
,
BGM_WIN
);
RefershBGMDir
(
L"win"
,
BGM_WIN
);
RefershBGMDir
(
L"lose
/
"
,
BGM_LOSE
);
RefershBGMDir
(
L"lose"
,
BGM_LOSE
);
}
}
void
SoundManager
::
RefershBGMDir
(
std
::
wstring
path
,
int
scene
)
{
void
SoundManager
::
RefershBGMDir
(
std
::
wstring
path
,
int
scene
)
{
#ifdef _WIN32
std
::
wstring
search
=
L"./sound/BGM/"
+
path
;
WIN32_FIND_DATAW
fdataw
;
FileSystem
::
TraversalDir
(
search
.
c_str
(),
[
this
,
&
path
,
scene
](
const
wchar_t
*
name
,
bool
isdir
)
{
std
::
wstring
search
=
L"./sound/BGM/"
+
path
+
L"*.*"
;
if
(
!
isdir
&&
wcsrchr
(
name
,
'.'
)
&&
(
!
mywcsncasecmp
(
wcsrchr
(
name
,
'.'
),
L".mp3"
,
4
)
||
!
mywcsncasecmp
(
wcsrchr
(
name
,
'.'
),
L".ogg"
,
4
)))
{
HANDLE
fh
=
FindFirstFileW
(
search
.
c_str
(),
&
fdataw
);
std
::
wstring
filename
=
path
+
L"/"
+
name
;
if
(
fh
==
INVALID_HANDLE_VALUE
)
BGMList
[
BGM_ALL
].
push_back
(
filename
);
return
;
BGMList
[
scene
].
push_back
(
filename
);
do
{
}
size_t
len
=
wcslen
(
fdataw
.
cFileName
);
});
if
((
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
||
len
<
5
||
!
(
_wcsicmp
(
fdataw
.
cFileName
+
len
-
4
,
L".mp3"
)
==
0
||
_wcsicmp
(
fdataw
.
cFileName
+
len
-
4
,
L".ogg"
)
==
0
))
continue
;
std
::
wstring
filename
=
path
+
(
std
::
wstring
)
fdataw
.
cFileName
;
BGMList
[
BGM_ALL
].
push_back
(
filename
);
BGMList
[
scene
].
push_back
(
filename
);
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
std
::
wstring
wsearchpath
=
L"./sound/BGM/"
+
path
;
char
searchpath
[
256
];
BufferIO
::
EncodeUTF8
(
wsearchpath
.
c_str
(),
searchpath
);
if
((
dir
=
opendir
(
searchpath
))
==
NULL
)
return
;
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
size_t
len
=
strlen
(
dirp
->
d_name
);
if
(
len
<
5
||
!
(
strcasecmp
(
dirp
->
d_name
+
len
-
4
,
".mp3"
)
==
0
||
strcasecmp
(
dirp
->
d_name
+
len
-
4
,
".ogg"
)))
continue
;
wchar_t
wname
[
256
];
BufferIO
::
DecodeUTF8
(
dirp
->
d_name
,
wname
);
std
::
wstring
filename
=
path
+
(
std
::
wstring
)
wname
;
BGMList
[
BGM_ALL
].
push_back
(
filename
);
BGMList
[
scene
].
push_back
(
filename
);
}
closedir
(
dir
);
#endif
}
}
void
SoundManager
::
PlaySoundEffect
(
int
sound
)
{
void
SoundManager
::
PlaySoundEffect
(
int
sound
)
{
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
...
...
gframe/tag_duel.cpp
View file @
17cdeb8c
...
@@ -1583,18 +1583,17 @@ void TagDuel::RefreshHand(int player, int flag, int use_cache) {
...
@@ -1583,18 +1583,17 @@ void TagDuel::RefreshHand(int player, int flag, int use_cache) {
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
BufferIO
::
WriteInt8
(
qbuf
,
MSG_UPDATE_DATA
);
BufferIO
::
WriteInt8
(
qbuf
,
player
);
BufferIO
::
WriteInt8
(
qbuf
,
player
);
BufferIO
::
WriteInt8
(
qbuf
,
LOCATION_HAND
);
BufferIO
::
WriteInt8
(
qbuf
,
LOCATION_HAND
);
int
len
=
query_field_card
(
pduel
,
player
,
LOCATION_HAND
,
flag
|
QUERY_
IS_PUBLIC
,
(
unsigned
char
*
)
qbuf
,
use_cache
);
int
len
=
query_field_card
(
pduel
,
player
,
LOCATION_HAND
,
flag
|
QUERY_
POSITION
,
(
unsigned
char
*
)
qbuf
,
use_cache
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
query_buffer
,
len
+
3
);
int
qlen
=
0
;
int
qlen
=
0
;
while
(
qlen
<
len
)
{
while
(
qlen
<
len
)
{
int
slen
=
BufferIO
::
ReadInt32
(
qbuf
);
int
slen
=
BufferIO
::
ReadInt32
(
qbuf
);
int
qflag
=
*
(
int
*
)
qbuf
;
int
qflag
=
*
(
int
*
)
qbuf
;
int
pos
=
slen
-
8
;
int
offset
=
8
;
if
(
qflag
&
QUERY_LSCALE
)
if
(
!
(
qflag
&
QUERY_CODE
))
pos
-=
4
;
offset
-=
4
;
if
(
qflag
&
QUERY_RSCALE
)
unsigned
position
=
((
*
(
int
*
)(
qbuf
+
offset
))
>>
24
)
&
0xff
;
pos
-=
4
;
if
(
!
(
position
&
POS_FACEUP
))
if
(
!
qbuf
[
pos
])
memset
(
qbuf
,
0
,
slen
-
4
);
memset
(
qbuf
,
0
,
slen
-
4
);
qbuf
+=
slen
-
4
;
qbuf
+=
slen
-
4
;
qlen
+=
slen
;
qlen
+=
slen
;
...
...
ocgcore
@
60d8b81d
Subproject commit
a7640393c52035d7321da3877622087d24686baf
Subproject commit
60d8b81d6d89c62e9d40d8bb8f6504f45121b053
script
@
87b2a039
Subproject commit
4abdd05e56bfb3a3c369f7f8bed8230f7e10e4c2
Subproject commit
87b2a039e3b02c8fad75aa53719095e60c866466
strings.conf
View file @
17cdeb8c
...
@@ -70,6 +70,13 @@
...
@@ -70,6 +70,13 @@
!
system
215
已选择数字:
!
system
215
已选择数字:
!
system
216
在连锁%
d
发动
!
system
216
在连锁%
d
发动
!
system
217
被连锁%
d
的[%
ls
]选择为对象
!
system
217
被连锁%
d
的[%
ls
]选择为对象
!
system
218
是否使用[%
ls
]的效果代替支付基本分?
!
system
219
是否使用[%
ls
]的效果代替取除超量素材?
!
system
220
是否使用[%
ls
]的效果代替取除指示物?
!
system
221
是否在[%
ls
]发动[%
ls
]的诱发效果?
!
system
222
是否要发动诱发效果?
!
system
223
稍后将询问其他可以发动的效果。
!
system
224
已用正规方法特殊召唤
!
system
500
请选择要解放的卡
!
system
500
请选择要解放的卡
!
system
501
请选择要丢弃的手卡
!
system
501
请选择要丢弃的手卡
!
system
502
请选择要破坏的卡
!
system
502
请选择要破坏的卡
...
@@ -386,11 +393,14 @@
...
@@ -386,11 +393,14 @@
!
system
1363
是否删除这个录像?
!
system
1363
是否删除这个录像?
!
system
1364
重命名录像
!
system
1364
重命名录像
!
system
1365
重命名失败,可能存在同名文件
!
system
1365
重命名失败,可能存在同名文件
!
system
1366
自动保存录像
!
system
1367
录像已自动保存为%
ls
.
yrp
!
system
1370
星数↑
!
system
1370
星数↑
!
system
1371
攻击↑
!
system
1371
攻击↑
!
system
1372
守备↑
!
system
1372
守备↑
!
system
1373
名称↓
!
system
1373
名称↓
!
system
1374
连接标记
!
system
1374
连接标记
!
system
1378
使用多个关键词搜索卡片
!
system
1380
人机模式
!
system
1380
人机模式
!
system
1381
残局模式
!
system
1381
残局模式
!
system
1382
人机信息:
!
system
1382
人机信息:
...
@@ -923,3 +933,4 @@
...
@@ -923,3 +933,4 @@
!
setname
0
x121
魔妖
!
setname
0
x121
魔妖
!
setname
0
x122
女武神
Valkyrie
!
setname
0
x122
女武神
Valkyrie
!
setname
0
x123
蔷薇龙 ローズ・ドラゴン
!
setname
0
x123
蔷薇龙 ローズ・ドラゴン
!
setname
0
x124
机械天使 機械天使
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