Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
REIKAI
ygopro
Commits
d2696454
Commit
d2696454
authored
Dec 25, 2017
by
mercury233
Committed by
GitHub
Dec 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add bot mode (#2059)
parent
11695627
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
251 additions
and
34 deletions
+251
-34
gframe/config.h
gframe/config.h
+1
-0
gframe/duelclient.cpp
gframe/duelclient.cpp
+71
-21
gframe/event_handler.cpp
gframe/event_handler.cpp
+6
-1
gframe/game.cpp
gframe/game.cpp
+67
-6
gframe/game.h
gframe/game.h
+23
-1
gframe/gframe.cpp
gframe/gframe.cpp
+2
-1
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+72
-1
strings.conf
strings.conf
+9
-3
No files found.
gframe/config.h
View file @
d2696454
...
@@ -76,5 +76,6 @@ extern int enable_log;
...
@@ -76,5 +76,6 @@ extern int enable_log;
extern
bool
exit_on_return
;
extern
bool
exit_on_return
;
extern
bool
open_file
;
extern
bool
open_file
;
extern
wchar_t
open_file_name
[
256
];
extern
wchar_t
open_file_name
[
256
];
extern
bool
bot_mode
;
#endif
#endif
gframe/duelclient.cpp
View file @
d2696454
...
@@ -69,8 +69,12 @@ void DuelClient::ConnectTimeout(evutil_socket_t fd, short events, void* arg) {
...
@@ -69,8 +69,12 @@ void DuelClient::ConnectTimeout(evutil_socket_t fd, short events, void* arg) {
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnStartBot
->
setEnabled
(
true
);
mainGame
->
btnBotCancel
->
setEnabled
(
true
);
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
if
(
!
mainGame
->
wLanWindow
->
isVisible
())
if
(
bot_mode
&&
!
mainGame
->
wSinglePlay
->
isVisible
())
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
else
if
(
!
bot_mode
&&
!
mainGame
->
wLanWindow
->
isVisible
())
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1400
));
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1400
));
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
...
@@ -110,18 +114,34 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
...
@@ -110,18 +114,34 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
SendPacketToServer
(
CTOS_PLAYER_INFO
,
cspi
);
SendPacketToServer
(
CTOS_PLAYER_INFO
,
cspi
);
if
(
create_game
)
{
if
(
create_game
)
{
CTOS_CreateGame
cscg
;
CTOS_CreateGame
cscg
;
BufferIO
::
CopyWStr
(
mainGame
->
ebServerName
->
getText
(),
cscg
.
name
,
20
);
if
(
bot_mode
)
{
BufferIO
::
CopyWStr
(
mainGame
->
ebServerPass
->
getText
(),
cscg
.
pass
,
20
);
BufferIO
::
CopyWStr
(
L"Bot Game"
,
cscg
.
name
,
20
);
cscg
.
info
.
rule
=
mainGame
->
cbRule
->
getSelected
();
BufferIO
::
CopyWStr
(
L""
,
cscg
.
pass
,
20
);
cscg
.
info
.
mode
=
mainGame
->
cbMatchMode
->
getSelected
();
cscg
.
info
.
rule
=
2
;
cscg
.
info
.
start_hand
=
_wtoi
(
mainGame
->
ebStartHand
->
getText
());
cscg
.
info
.
mode
=
0
;
cscg
.
info
.
start_lp
=
_wtoi
(
mainGame
->
ebStartLP
->
getText
());
cscg
.
info
.
start_hand
=
5
;
cscg
.
info
.
draw_count
=
_wtoi
(
mainGame
->
ebDrawCount
->
getText
());
cscg
.
info
.
start_lp
=
8000
;
cscg
.
info
.
time_limit
=
_wtoi
(
mainGame
->
ebTimeLimit
->
getText
());
cscg
.
info
.
draw_count
=
1
;
cscg
.
info
.
lflist
=
mainGame
->
cbLFlist
->
getItemData
(
mainGame
->
cbLFlist
->
getSelected
());
cscg
.
info
.
time_limit
=
0
;
cscg
.
info
.
duel_rule
=
mainGame
->
cbDuelRule
->
getSelected
()
+
1
;
cscg
.
info
.
lflist
=
0
;
cscg
.
info
.
no_check_deck
=
mainGame
->
chkNoCheckDeck
->
isChecked
();
cscg
.
info
.
duel_rule
=
mainGame
->
chkBotOldRule
->
isChecked
()
?
DEFAULT_DUEL_RULE
-
1
:
DEFAULT_DUEL_RULE
;
cscg
.
info
.
no_shuffle_deck
=
mainGame
->
chkNoShuffleDeck
->
isChecked
();
cscg
.
info
.
no_check_deck
=
mainGame
->
chkBotNoCheckDeck
->
isChecked
();
cscg
.
info
.
no_shuffle_deck
=
mainGame
->
chkBotNoShuffleDeck
->
isChecked
();
}
else
{
BufferIO
::
CopyWStr
(
mainGame
->
ebServerName
->
getText
(),
cscg
.
name
,
20
);
BufferIO
::
CopyWStr
(
mainGame
->
ebServerPass
->
getText
(),
cscg
.
pass
,
20
);
cscg
.
info
.
rule
=
mainGame
->
cbRule
->
getSelected
();
cscg
.
info
.
mode
=
mainGame
->
cbMatchMode
->
getSelected
();
cscg
.
info
.
start_hand
=
_wtoi
(
mainGame
->
ebStartHand
->
getText
());
cscg
.
info
.
start_lp
=
_wtoi
(
mainGame
->
ebStartLP
->
getText
());
cscg
.
info
.
draw_count
=
_wtoi
(
mainGame
->
ebDrawCount
->
getText
());
cscg
.
info
.
time_limit
=
_wtoi
(
mainGame
->
ebTimeLimit
->
getText
());
cscg
.
info
.
lflist
=
mainGame
->
cbLFlist
->
getItemData
(
mainGame
->
cbLFlist
->
getSelected
());
cscg
.
info
.
duel_rule
=
mainGame
->
cbDuelRule
->
getSelected
()
+
1
;
cscg
.
info
.
no_check_deck
=
mainGame
->
chkNoCheckDeck
->
isChecked
();
cscg
.
info
.
no_shuffle_deck
=
mainGame
->
chkNoShuffleDeck
->
isChecked
();
}
SendPacketToServer
(
CTOS_CREATE_GAME
,
cscg
);
SendPacketToServer
(
CTOS_CREATE_GAME
,
cscg
);
}
else
{
}
else
{
CTOS_JoinGame
csjg
;
CTOS_JoinGame
csjg
;
...
@@ -139,8 +159,12 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
...
@@ -139,8 +159,12 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnStartBot
->
setEnabled
(
true
);
mainGame
->
btnBotCancel
->
setEnabled
(
true
);
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
if
(
!
mainGame
->
wLanWindow
->
isVisible
())
if
(
bot_mode
&&
!
mainGame
->
wSinglePlay
->
isVisible
())
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
else
if
(
!
bot_mode
&&
!
mainGame
->
wLanWindow
->
isVisible
())
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1400
));
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1400
));
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
...
@@ -149,9 +173,14 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
...
@@ -149,9 +173,14 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnStartBot
->
setEnabled
(
true
);
mainGame
->
btnBotCancel
->
setEnabled
(
true
);
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
HideElement
(
mainGame
->
wHostPrepare
);
mainGame
->
HideElement
(
mainGame
->
wHostPrepare
);
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
if
(
bot_mode
)
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
else
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
mainGame
->
wChat
->
setVisible
(
false
);
mainGame
->
wChat
->
setVisible
(
false
);
if
(
events
&
BEV_EVENT_EOF
)
if
(
events
&
BEV_EVENT_EOF
)
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1401
));
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1401
));
...
@@ -163,6 +192,8 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
...
@@ -163,6 +192,8 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnStartBot
->
setEnabled
(
true
);
mainGame
->
btnBotCancel
->
setEnabled
(
true
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
mainGame
->
closeDoneSignal
.
Reset
();
mainGame
->
closeDoneSignal
.
Reset
();
mainGame
->
closeSignal
.
Set
();
mainGame
->
closeSignal
.
Set
();
...
@@ -171,7 +202,10 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
...
@@ -171,7 +202,10 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
dInfo
.
isStarted
=
false
;
mainGame
->
is_building
=
false
;
mainGame
->
is_building
=
false
;
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
if
(
bot_mode
)
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
else
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
}
}
}
}
...
@@ -203,6 +237,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
...
@@ -203,6 +237,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnStartBot
->
setEnabled
(
true
);
mainGame
->
btnBotCancel
->
setEnabled
(
true
);
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
if
(
pkt
->
code
==
0
)
if
(
pkt
->
code
==
0
)
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1403
));
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1403
));
...
@@ -276,6 +312,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
...
@@ -276,6 +312,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnStartBot
->
setEnabled
(
true
);
mainGame
->
btnBotCancel
->
setEnabled
(
true
);
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
wchar_t
msgbuf
[
256
];
wchar_t
msgbuf
[
256
];
myswprintf
(
msgbuf
,
dataManager
.
GetSysString
(
1411
),
pkt
->
code
>>
12
,
(
pkt
->
code
>>
4
)
&
0xff
,
pkt
->
code
&
0xf
);
myswprintf
(
msgbuf
,
dataManager
.
GetSysString
(
1411
),
pkt
->
code
>>
12
,
(
pkt
->
code
>>
4
)
&
0xff
,
pkt
->
code
&
0xf
);
...
@@ -425,8 +463,10 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
...
@@ -425,8 +463,10 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
cbDeckSelect
->
setEnabled
(
true
);
mainGame
->
cbDeckSelect
->
setEnabled
(
true
);
if
(
mainGame
->
wCreateHost
->
isVisible
())
if
(
mainGame
->
wCreateHost
->
isVisible
())
mainGame
->
HideElement
(
mainGame
->
wCreateHost
);
mainGame
->
HideElement
(
mainGame
->
wCreateHost
);
else
if
(
mainGame
->
wLanWindow
->
isVisible
())
else
if
(
mainGame
->
wLanWindow
->
isVisible
())
mainGame
->
HideElement
(
mainGame
->
wLanWindow
);
mainGame
->
HideElement
(
mainGame
->
wLanWindow
);
else
if
(
mainGame
->
wSinglePlay
->
isVisible
())
mainGame
->
HideElement
(
mainGame
->
wSinglePlay
);
mainGame
->
ShowElement
(
mainGame
->
wHostPrepare
);
mainGame
->
ShowElement
(
mainGame
->
wHostPrepare
);
mainGame
->
wChat
->
setVisible
(
true
);
mainGame
->
wChat
->
setVisible
(
true
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
...
@@ -600,9 +640,14 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
...
@@ -600,9 +640,14 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnStartBot
->
setEnabled
(
true
);
mainGame
->
btnBotCancel
->
setEnabled
(
true
);
mainGame
->
stTip
->
setVisible
(
false
);
mainGame
->
stTip
->
setVisible
(
false
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
if
(
bot_mode
)
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
else
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
event_base_loopbreak
(
client_base
);
event_base_loopbreak
(
client_base
);
if
(
exit_on_return
)
if
(
exit_on_return
)
...
@@ -823,9 +868,14 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -823,9 +868,14 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnStartBot
->
setEnabled
(
true
);
mainGame
->
btnBotCancel
->
setEnabled
(
true
);
mainGame
->
stTip
->
setVisible
(
false
);
mainGame
->
stTip
->
setVisible
(
false
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
device
->
setEventReceiver
(
&
mainGame
->
menuHandler
);
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
if
(
bot_mode
)
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
else
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
event_base_loopbreak
(
client_base
);
event_base_loopbreak
(
client_base
);
if
(
exit_on_return
)
if
(
exit_on_return
)
...
@@ -3680,8 +3730,8 @@ void DuelClient::BroadcastReply(evutil_socket_t fd, short events, void * arg) {
...
@@ -3680,8 +3730,8 @@ void DuelClient::BroadcastReply(evutil_socket_t fd, short events, void * arg) {
if
(
pHP
->
host
.
draw_count
==
1
&&
pHP
->
host
.
start_hand
==
5
&&
pHP
->
host
.
start_lp
==
8000
if
(
pHP
->
host
.
draw_count
==
1
&&
pHP
->
host
.
start_hand
==
5
&&
pHP
->
host
.
start_lp
==
8000
&&
!
pHP
->
host
.
no_check_deck
&&
!
pHP
->
host
.
no_shuffle_deck
&&
!
pHP
->
host
.
no_check_deck
&&
!
pHP
->
host
.
no_shuffle_deck
&&
pHP
->
host
.
duel_rule
==
DEFAULT_DUEL_RULE
)
&&
pHP
->
host
.
duel_rule
==
DEFAULT_DUEL_RULE
)
hoststr
.
append
(
dataManager
.
GetSysString
(
12
80
));
hoststr
.
append
(
dataManager
.
GetSysString
(
12
47
));
else
hoststr
.
append
(
dataManager
.
GetSysString
(
12
81
));
else
hoststr
.
append
(
dataManager
.
GetSysString
(
12
48
));
hoststr
.
append
(
L"]"
);
hoststr
.
append
(
L"]"
);
wchar_t
gamename
[
20
];
wchar_t
gamename
[
20
];
BufferIO
::
CopyWStr
(
pHP
->
name
,
gamename
,
20
);
BufferIO
::
CopyWStr
(
pHP
->
name
,
gamename
,
20
);
...
...
gframe/event_handler.cpp
View file @
d2696454
...
@@ -125,7 +125,12 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -125,7 +125,12 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
mainGame
->
btnStartBot
->
setEnabled
(
true
);
mainGame
->
btnBotCancel
->
setEnabled
(
true
);
if
(
bot_mode
)
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
else
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
}
else
{
}
else
{
DuelClient
::
SendPacketToServer
(
CTOS_SURRENDER
);
DuelClient
::
SendPacketToServer
(
CTOS_SURRENDER
);
}
}
...
...
gframe/game.cpp
View file @
d2696454
...
@@ -88,7 +88,7 @@ bool Game::Initialize() {
...
@@ -88,7 +88,7 @@ bool Game::Initialize() {
wMainMenu
=
env
->
addWindow
(
rect
<
s32
>
(
370
,
200
,
650
,
415
),
false
,
strbuf
);
wMainMenu
=
env
->
addWindow
(
rect
<
s32
>
(
370
,
200
,
650
,
415
),
false
,
strbuf
);
wMainMenu
->
getCloseButton
()
->
setVisible
(
false
);
wMainMenu
->
getCloseButton
()
->
setVisible
(
false
);
btnLanMode
=
env
->
addButton
(
rect
<
s32
>
(
10
,
30
,
270
,
60
),
wMainMenu
,
BUTTON_LAN_MODE
,
dataManager
.
GetSysString
(
1200
));
btnLanMode
=
env
->
addButton
(
rect
<
s32
>
(
10
,
30
,
270
,
60
),
wMainMenu
,
BUTTON_LAN_MODE
,
dataManager
.
GetSysString
(
1200
));
btnS
erver
Mode
=
env
->
addButton
(
rect
<
s32
>
(
10
,
65
,
270
,
95
),
wMainMenu
,
BUTTON_SINGLE_MODE
,
dataManager
.
GetSysString
(
1201
));
btnS
ingle
Mode
=
env
->
addButton
(
rect
<
s32
>
(
10
,
65
,
270
,
95
),
wMainMenu
,
BUTTON_SINGLE_MODE
,
dataManager
.
GetSysString
(
1201
));
btnReplayMode
=
env
->
addButton
(
rect
<
s32
>
(
10
,
100
,
270
,
130
),
wMainMenu
,
BUTTON_REPLAY_MODE
,
dataManager
.
GetSysString
(
1202
));
btnReplayMode
=
env
->
addButton
(
rect
<
s32
>
(
10
,
100
,
270
,
130
),
wMainMenu
,
BUTTON_REPLAY_MODE
,
dataManager
.
GetSysString
(
1202
));
// btnTestMode = env->addButton(rect<s32>(10, 135, 270, 165), wMainMenu, BUTTON_TEST_MODE, dataManager.GetSysString(1203));
// btnTestMode = env->addButton(rect<s32>(10, 135, 270, 165), wMainMenu, BUTTON_TEST_MODE, dataManager.GetSysString(1203));
btnDeckEdit
=
env
->
addButton
(
rect
<
s32
>
(
10
,
135
,
270
,
165
),
wMainMenu
,
BUTTON_DECK_EDIT
,
dataManager
.
GetSysString
(
1204
));
btnDeckEdit
=
env
->
addButton
(
rect
<
s32
>
(
10
,
135
,
270
,
165
),
wMainMenu
,
BUTTON_DECK_EDIT
,
dataManager
.
GetSysString
(
1204
));
...
@@ -555,12 +555,27 @@ bool Game::Initialize() {
...
@@ -555,12 +555,27 @@ bool Game::Initialize() {
wSinglePlay
=
env
->
addWindow
(
rect
<
s32
>
(
220
,
100
,
800
,
520
),
false
,
dataManager
.
GetSysString
(
1201
));
wSinglePlay
=
env
->
addWindow
(
rect
<
s32
>
(
220
,
100
,
800
,
520
),
false
,
dataManager
.
GetSysString
(
1201
));
wSinglePlay
->
getCloseButton
()
->
setVisible
(
false
);
wSinglePlay
->
getCloseButton
()
->
setVisible
(
false
);
wSinglePlay
->
setVisible
(
false
);
wSinglePlay
->
setVisible
(
false
);
lstSinglePlayList
=
env
->
addListBox
(
rect
<
s32
>
(
10
,
30
,
350
,
400
),
wSinglePlay
,
LISTBOX_SINGLEPLAY_LIST
,
true
);
irr
::
gui
::
IGUITabControl
*
wSingle
=
env
->
addTabControl
(
rect
<
s32
>
(
0
,
20
,
579
,
419
),
wSinglePlay
,
true
);
if
(
gameConf
.
enable_bot_mode
)
{
irr
::
gui
::
IGUITab
*
tabBot
=
wSingle
->
addTab
(
dataManager
.
GetSysString
(
1380
));
lstBotList
=
env
->
addListBox
(
rect
<
s32
>
(
10
,
10
,
350
,
350
),
tabBot
,
LISTBOX_BOT_LIST
,
true
);
lstBotList
->
setItemHeight
(
18
);
btnStartBot
=
env
->
addButton
(
rect
<
s32
>
(
459
,
301
,
569
,
326
),
tabBot
,
BUTTON_BOT_START
,
dataManager
.
GetSysString
(
1211
));
btnBotCancel
=
env
->
addButton
(
rect
<
s32
>
(
459
,
331
,
569
,
356
),
tabBot
,
BUTTON_CANCEL_SINGLEPLAY
,
dataManager
.
GetSysString
(
1210
));
env
->
addStaticText
(
dataManager
.
GetSysString
(
1382
),
rect
<
s32
>
(
360
,
10
,
550
,
30
),
false
,
true
,
tabBot
);
stBotInfo
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
360
,
40
,
560
,
160
),
false
,
true
,
tabBot
);
chkBotOldRule
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
360
,
170
,
560
,
190
),
tabBot
,
CHECKBOX_BOT_OLD_RULE
,
dataManager
.
GetSysString
(
1383
));
chkBotHand
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
360
,
200
,
560
,
220
),
tabBot
,
-
1
,
dataManager
.
GetSysString
(
1384
));
chkBotNoCheckDeck
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
360
,
230
,
560
,
250
),
tabBot
,
-
1
,
dataManager
.
GetSysString
(
1229
));
chkBotNoShuffleDeck
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
360
,
260
,
560
,
280
),
tabBot
,
-
1
,
dataManager
.
GetSysString
(
1230
));
}
irr
::
gui
::
IGUITab
*
tabSingle
=
wSingle
->
addTab
(
dataManager
.
GetSysString
(
1381
));
lstSinglePlayList
=
env
->
addListBox
(
rect
<
s32
>
(
10
,
10
,
350
,
350
),
tabSingle
,
LISTBOX_SINGLEPLAY_LIST
,
true
);
lstSinglePlayList
->
setItemHeight
(
18
);
lstSinglePlayList
->
setItemHeight
(
18
);
btnLoadSinglePlay
=
env
->
addButton
(
rect
<
s32
>
(
4
60
,
355
,
570
,
380
),
wSinglePlay
,
BUTTON_LOAD_SINGLEPLAY
,
dataManager
.
GetSysString
(
1211
));
btnLoadSinglePlay
=
env
->
addButton
(
rect
<
s32
>
(
4
59
,
301
,
569
,
326
),
tabSingle
,
BUTTON_LOAD_SINGLEPLAY
,
dataManager
.
GetSysString
(
1211
));
btnSinglePlayCancel
=
env
->
addButton
(
rect
<
s32
>
(
4
60
,
385
,
570
,
410
),
wSinglePlay
,
BUTTON_CANCEL_SINGLEPLAY
,
dataManager
.
GetSysString
(
1210
));
btnSinglePlayCancel
=
env
->
addButton
(
rect
<
s32
>
(
4
59
,
331
,
569
,
356
),
tabSingle
,
BUTTON_CANCEL_SINGLEPLAY
,
dataManager
.
GetSysString
(
1210
));
env
->
addStaticText
(
dataManager
.
GetSysString
(
1352
),
rect
<
s32
>
(
360
,
30
,
570
,
50
),
false
,
true
,
wSinglePlay
);
env
->
addStaticText
(
dataManager
.
GetSysString
(
1352
),
rect
<
s32
>
(
360
,
10
,
550
,
30
),
false
,
true
,
tabSingle
);
stSinglePlayInfo
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
360
,
60
,
570
,
350
),
false
,
true
,
wSinglePlay
);
stSinglePlayInfo
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
360
,
40
,
550
,
280
),
false
,
true
,
tabSingle
);
//replay save
//replay save
wReplaySave
=
env
->
addWindow
(
rect
<
s32
>
(
510
,
200
,
820
,
320
),
false
,
dataManager
.
GetSysString
(
1340
));
wReplaySave
=
env
->
addWindow
(
rect
<
s32
>
(
510
,
200
,
820
,
320
),
false
,
dataManager
.
GetSysString
(
1340
));
wReplaySave
->
getCloseButton
()
->
setVisible
(
false
);
wReplaySave
->
getCloseButton
()
->
setVisible
(
false
);
...
@@ -900,6 +915,46 @@ void Game::RefreshSingleplay() {
...
@@ -900,6 +915,46 @@ void Game::RefreshSingleplay() {
closedir
(
dir
);
closedir
(
dir
);
#endif
#endif
}
}
void
Game
::
RefreshBot
()
{
if
(
!
gameConf
.
enable_bot_mode
)
return
;
botInfo
.
clear
();
FILE
*
fp
=
fopen
(
"bot.conf"
,
"r"
);
char
linebuf
[
256
];
char
strbuf
[
256
];
if
(
fp
)
{
while
(
fgets
(
linebuf
,
256
,
fp
))
{
if
(
linebuf
[
0
]
==
'#'
)
continue
;
if
(
linebuf
[
0
]
==
'!'
)
{
BotInfo
newinfo
;
sscanf
(
linebuf
,
"!%240[^
\n
]"
,
strbuf
);
BufferIO
::
DecodeUTF8
(
strbuf
,
newinfo
.
name
);
fgets
(
linebuf
,
256
,
fp
);
sscanf
(
linebuf
,
"%240[^
\n
]"
,
strbuf
);
BufferIO
::
DecodeUTF8
(
strbuf
,
newinfo
.
command
);
fgets
(
linebuf
,
256
,
fp
);
sscanf
(
linebuf
,
"%240[^
\n
]"
,
strbuf
);
BufferIO
::
DecodeUTF8
(
strbuf
,
newinfo
.
desc
);
fgets
(
linebuf
,
256
,
fp
);
newinfo
.
support_master_rule_3
=
!!
strstr
(
linebuf
,
"SUPPORT_MASTER_RULE_3"
);
newinfo
.
support_new_master_rule
=
!!
strstr
(
linebuf
,
"SUPPORT_NEW_MASTER_RULE"
);
if
((
chkBotOldRule
->
isChecked
()
&&
newinfo
.
support_master_rule_3
)
||
(
!
chkBotOldRule
->
isChecked
()
&&
newinfo
.
support_new_master_rule
))
botInfo
.
push_back
(
newinfo
);
continue
;
}
}
fclose
(
fp
);
}
lstBotList
->
clear
();
stBotInfo
->
setText
(
L""
);
for
(
unsigned
int
i
=
0
;
i
<
botInfo
.
size
();
++
i
)
{
lstBotList
->
addItem
(
botInfo
[
i
].
name
);
}
if
(
botInfo
.
size
()
==
0
)
SetStaticText
(
stBotInfo
,
200
,
guiFont
,
dataManager
.
GetSysString
(
1385
));
}
void
Game
::
LoadConfig
()
{
void
Game
::
LoadConfig
()
{
FILE
*
fp
=
fopen
(
"system.conf"
,
"r"
);
FILE
*
fp
=
fopen
(
"system.conf"
,
"r"
);
if
(
!
fp
)
if
(
!
fp
)
...
@@ -937,6 +992,7 @@ void Game::LoadConfig() {
...
@@ -937,6 +992,7 @@ void Game::LoadConfig() {
gameConf
.
auto_search_limit
=
-
1
;
gameConf
.
auto_search_limit
=
-
1
;
gameConf
.
chkIgnoreDeckChanges
=
0
;
gameConf
.
chkIgnoreDeckChanges
=
0
;
gameConf
.
defaultOT
=
1
;
gameConf
.
defaultOT
=
1
;
gameConf
.
enable_bot_mode
=
0
;
while
(
fgets
(
linebuf
,
256
,
fp
))
{
while
(
fgets
(
linebuf
,
256
,
fp
))
{
sscanf
(
linebuf
,
"%s = %s"
,
strbuf
,
valbuf
);
sscanf
(
linebuf
,
"%s = %s"
,
strbuf
,
valbuf
);
if
(
!
strcmp
(
strbuf
,
"antialias"
))
{
if
(
!
strcmp
(
strbuf
,
"antialias"
))
{
...
@@ -997,6 +1053,10 @@ void Game::LoadConfig() {
...
@@ -997,6 +1053,10 @@ void Game::LoadConfig() {
gameConf
.
chkIgnoreDeckChanges
=
atoi
(
valbuf
);
gameConf
.
chkIgnoreDeckChanges
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"default_ot"
))
{
}
else
if
(
!
strcmp
(
strbuf
,
"default_ot"
))
{
gameConf
.
defaultOT
=
atoi
(
valbuf
);
gameConf
.
defaultOT
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"enable_bot_mode"
))
{
#ifdef _WIN32
gameConf
.
enable_bot_mode
=
atoi
(
valbuf
);
#endif
}
else
{
}
else
{
// options allowing multiple words
// options allowing multiple words
sscanf
(
linebuf
,
"%s = %240[^
\n
]"
,
strbuf
,
valbuf
);
sscanf
(
linebuf
,
"%s = %240[^
\n
]"
,
strbuf
,
valbuf
);
...
@@ -1056,6 +1116,7 @@ void Game::SaveConfig() {
...
@@ -1056,6 +1116,7 @@ void Game::SaveConfig() {
fprintf
(
fp
,
"auto_search_limit = %d
\n
"
,
gameConf
.
auto_search_limit
);
fprintf
(
fp
,
"auto_search_limit = %d
\n
"
,
gameConf
.
auto_search_limit
);
fprintf
(
fp
,
"ignore_deck_changes = %d
\n
"
,
((
mainGame
->
chkIgnoreDeckChanges
->
isChecked
())
?
1
:
0
));
fprintf
(
fp
,
"ignore_deck_changes = %d
\n
"
,
((
mainGame
->
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
);
fclose
(
fp
);
fclose
(
fp
);
}
}
void
Game
::
ShowCardInfo
(
int
code
)
{
void
Game
::
ShowCardInfo
(
int
code
)
{
...
...
gframe/game.h
View file @
d2696454
...
@@ -41,6 +41,7 @@ struct Config {
...
@@ -41,6 +41,7 @@ struct Config {
int
auto_search_limit
;
int
auto_search_limit
;
int
chkIgnoreDeckChanges
;
int
chkIgnoreDeckChanges
;
int
defaultOT
;
int
defaultOT
;
int
enable_bot_mode
;
};
};
struct
DuelInfo
{
struct
DuelInfo
{
...
@@ -68,6 +69,14 @@ struct DuelInfo {
...
@@ -68,6 +69,14 @@ struct DuelInfo {
unsigned
short
time_left
[
2
];
unsigned
short
time_left
[
2
];
};
};
struct
BotInfo
{
wchar_t
name
[
256
];
wchar_t
command
[
256
];
wchar_t
desc
[
256
];
bool
support_master_rule_3
;
bool
support_new_master_rule
;
};
struct
FadingUnit
{
struct
FadingUnit
{
bool
signalAction
;
bool
signalAction
;
bool
isFadein
;
bool
isFadein
;
...
@@ -92,6 +101,7 @@ public:
...
@@ -92,6 +101,7 @@ public:
void
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshReplay
();
void
RefreshReplay
();
void
RefreshSingleplay
();
void
RefreshSingleplay
();
void
RefreshBot
();
void
DrawSelectionLine
(
irr
::
video
::
S3DVertex
*
vec
,
bool
strip
,
int
width
,
float
*
cv
);
void
DrawSelectionLine
(
irr
::
video
::
S3DVertex
*
vec
,
bool
strip
,
int
width
,
float
*
cv
);
void
DrawBackGround
();
void
DrawBackGround
();
void
DrawLinkedZones
(
ClientCard
*
pcard
);
void
DrawLinkedZones
(
ClientCard
*
pcard
);
...
@@ -142,6 +152,7 @@ public:
...
@@ -142,6 +152,7 @@ public:
std
::
list
<
FadingUnit
>
fadingList
;
std
::
list
<
FadingUnit
>
fadingList
;
std
::
vector
<
int
>
logParam
;
std
::
vector
<
int
>
logParam
;
std
::
wstring
chatMsg
[
8
];
std
::
wstring
chatMsg
[
8
];
std
::
vector
<
BotInfo
>
botInfo
;
int
hideChatTimer
;
int
hideChatTimer
;
bool
hideChat
;
bool
hideChat
;
...
@@ -222,7 +233,7 @@ public:
...
@@ -222,7 +233,7 @@ public:
//main menu
//main menu
irr
::
gui
::
IGUIWindow
*
wMainMenu
;
irr
::
gui
::
IGUIWindow
*
wMainMenu
;
irr
::
gui
::
IGUIButton
*
btnLanMode
;
irr
::
gui
::
IGUIButton
*
btnLanMode
;
irr
::
gui
::
IGUIButton
*
btnS
erver
Mode
;
irr
::
gui
::
IGUIButton
*
btnS
ingle
Mode
;
irr
::
gui
::
IGUIButton
*
btnReplayMode
;
irr
::
gui
::
IGUIButton
*
btnReplayMode
;
irr
::
gui
::
IGUIButton
*
btnTestMode
;
irr
::
gui
::
IGUIButton
*
btnTestMode
;
irr
::
gui
::
IGUIButton
*
btnDeckEdit
;
irr
::
gui
::
IGUIButton
*
btnDeckEdit
;
...
@@ -277,6 +288,14 @@ public:
...
@@ -277,6 +288,14 @@ public:
irr
::
gui
::
IGUIEditBox
*
ebRepStartTurn
;
irr
::
gui
::
IGUIEditBox
*
ebRepStartTurn
;
//single play
//single play
irr
::
gui
::
IGUIWindow
*
wSinglePlay
;
irr
::
gui
::
IGUIWindow
*
wSinglePlay
;
irr
::
gui
::
IGUIListBox
*
lstBotList
;
irr
::
gui
::
IGUIStaticText
*
stBotInfo
;
irr
::
gui
::
IGUIButton
*
btnStartBot
;
irr
::
gui
::
IGUIButton
*
btnBotCancel
;
irr
::
gui
::
IGUICheckBox
*
chkBotOldRule
;
irr
::
gui
::
IGUICheckBox
*
chkBotHand
;
irr
::
gui
::
IGUICheckBox
*
chkBotNoCheckDeck
;
irr
::
gui
::
IGUICheckBox
*
chkBotNoShuffleDeck
;
irr
::
gui
::
IGUIListBox
*
lstSinglePlayList
;
irr
::
gui
::
IGUIListBox
*
lstSinglePlayList
;
irr
::
gui
::
IGUIStaticText
*
stSinglePlayInfo
;
irr
::
gui
::
IGUIStaticText
*
stSinglePlayInfo
;
irr
::
gui
::
IGUIButton
*
btnLoadSinglePlay
;
irr
::
gui
::
IGUIButton
*
btnLoadSinglePlay
;
...
@@ -565,6 +584,9 @@ extern Game* mainGame;
...
@@ -565,6 +584,9 @@ extern Game* mainGame;
#define BUTTON_REPLAY_SWAP 325
#define BUTTON_REPLAY_SWAP 325
#define BUTTON_REPLAY_SAVE 330
#define BUTTON_REPLAY_SAVE 330
#define BUTTON_REPLAY_CANCEL 331
#define BUTTON_REPLAY_CANCEL 331
#define BUTTON_BOT_START 340
#define LISTBOX_BOT_LIST 341
#define CHECKBOX_BOT_OLD_RULE 342
#define LISTBOX_SINGLEPLAY_LIST 350
#define LISTBOX_SINGLEPLAY_LIST 350
#define BUTTON_LOAD_SINGLEPLAY 351
#define BUTTON_LOAD_SINGLEPLAY 351
#define BUTTON_CANCEL_SINGLEPLAY 352
#define BUTTON_CANCEL_SINGLEPLAY 352
...
...
gframe/gframe.cpp
View file @
d2696454
...
@@ -10,6 +10,7 @@ int enable_log = 0;
...
@@ -10,6 +10,7 @@ int enable_log = 0;
bool
exit_on_return
=
false
;
bool
exit_on_return
=
false
;
bool
open_file
=
false
;
bool
open_file
=
false
;
wchar_t
open_file_name
[
256
]
=
L""
;
wchar_t
open_file_name
[
256
]
=
L""
;
bool
bot_mode
=
false
;
void
GetParameter
(
char
*
param
,
const
char
*
arg
)
{
void
GetParameter
(
char
*
param
,
const
char
*
arg
)
{
#ifdef _WIN32
#ifdef _WIN32
...
@@ -151,7 +152,7 @@ int main(int argc, char* argv[]) {
...
@@ -151,7 +152,7 @@ int main(int argc, char* argv[]) {
open_file
=
true
;
open_file
=
true
;
GetParameterW
(
open_file_name
,
&
argv
[
i
+
1
][
0
]);
GetParameterW
(
open_file_name
,
&
argv
[
i
+
1
][
0
]);
}
}
ClickButton
(
ygo
::
mainGame
->
btnS
erver
Mode
);
ClickButton
(
ygo
::
mainGame
->
btnS
ingle
Mode
);
if
(
open_file
)
if
(
open_file
)
ClickButton
(
ygo
::
mainGame
->
btnLoadSinglePlay
);
ClickButton
(
ygo
::
mainGame
->
btnLoadSinglePlay
);
break
;
break
;
...
...
gframe/menu_handler.cpp
View file @
d2696454
...
@@ -46,6 +46,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -46,6 +46,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
BUTTON_JOIN_HOST
:
{
case
BUTTON_JOIN_HOST
:
{
bot_mode
=
false
;
char
ip
[
20
];
char
ip
[
20
];
const
wchar_t
*
pstr
=
mainGame
->
ebJoinHost
->
getText
();
const
wchar_t
*
pstr
=
mainGame
->
ebJoinHost
->
getText
();
BufferIO
::
CopyWStr
(
pstr
,
ip
,
16
);
BufferIO
::
CopyWStr
(
pstr
,
ip
,
16
);
...
@@ -103,6 +104,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -103,6 +104,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
BUTTON_HOST_CONFIRM
:
{
case
BUTTON_HOST_CONFIRM
:
{
bot_mode
=
false
;
BufferIO
::
CopyWStr
(
mainGame
->
ebServerName
->
getText
(),
mainGame
->
gameConf
.
gamename
,
20
);
BufferIO
::
CopyWStr
(
mainGame
->
ebServerName
->
getText
(),
mainGame
->
gameConf
.
gamename
,
20
);
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
break
;
break
;
...
@@ -167,8 +169,13 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -167,8 +169,13 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
mainGame
->
btnStartBot
->
setEnabled
(
true
);
mainGame
->
btnBotCancel
->
setEnabled
(
true
);
mainGame
->
HideElement
(
mainGame
->
wHostPrepare
);
mainGame
->
HideElement
(
mainGame
->
wHostPrepare
);
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
if
(
bot_mode
)
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
else
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
mainGame
->
wChat
->
setVisible
(
false
);
mainGame
->
wChat
->
setVisible
(
false
);
if
(
exit_on_return
)
if
(
exit_on_return
)
mainGame
->
device
->
closeDevice
();
mainGame
->
device
->
closeDevice
();
...
@@ -185,6 +192,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -185,6 +192,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
HideElement
(
mainGame
->
wMainMenu
);
mainGame
->
HideElement
(
mainGame
->
wMainMenu
);
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
mainGame
->
RefreshSingleplay
();
mainGame
->
RefreshSingleplay
();
mainGame
->
RefreshBot
();
break
;
break
;
}
}
case
BUTTON_LOAD_REPLAY
:
{
case
BUTTON_LOAD_REPLAY
:
{
...
@@ -227,6 +235,58 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -227,6 +235,58 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
ShowElement
(
mainGame
->
wMainMenu
);
mainGame
->
ShowElement
(
mainGame
->
wMainMenu
);
break
;
break
;
}
}
case
BUTTON_BOT_START
:
{
int
sel
=
mainGame
->
lstBotList
->
getSelected
();
if
(
sel
==
-
1
)
break
;
bot_mode
=
true
;
#ifdef _WIN32
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
break
;
if
(
!
DuelClient
::
StartClient
(
0x7f000001
,
mainGame
->
gameConf
.
serverport
))
{
NetServer
::
StopServer
();
break
;
}
STARTUPINFO
si
;
PROCESS_INFORMATION
pi
;
ZeroMemory
(
&
si
,
sizeof
(
si
));
si
.
cb
=
sizeof
(
si
);
ZeroMemory
(
&
pi
,
sizeof
(
pi
));
wchar_t
*
cmd
=
new
wchar_t
[
MAX_PATH
];
int
flag
=
0
;
flag
+=
(
mainGame
->
chkBotHand
->
isChecked
()
?
0x1
:
0
);
myswprintf
(
cmd
,
L"Bot.exe
\"
%ls
\"
%d %d"
,
mainGame
->
botInfo
[
sel
].
command
,
flag
,
mainGame
->
gameConf
.
serverport
);
if
(
!
CreateProcessW
(
NULL
,
cmd
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
si
,
&
pi
))
{
NetServer
::
StopServer
();
break
;
}
#else
if
(
fork
()
==
0
)
{
usleep
(
100000
);
char
arg1
[
512
];
BufferIO
::
EncodeUTF8
(
mainGame
->
botInfo
[
sel
].
command
,
arg1
);
int
flag
=
0
;
flag
+=
(
mainGame
->
chkBotHand
->
isChecked
()
?
0x1
:
0
);
char
arg2
[
8
];
sprintf
(
arg2
,
"%d"
,
flag
);
char
arg3
[
8
];
sprintf
(
arg3
,
"%d"
,
mainGame
->
gameConf
.
serverport
);
execl
(
"./bot"
,
"bot"
,
arg1
,
arg2
,
arg3
,
NULL
);
exit
(
0
);
}
else
{
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
break
;
if
(
!
DuelClient
::
StartClient
(
0x7f000001
,
mainGame
->
gameConf
.
serverport
))
{
NetServer
::
StopServer
();
break
;
}
}
#endif
mainGame
->
btnStartBot
->
setEnabled
(
false
);
mainGame
->
btnBotCancel
->
setEnabled
(
false
);
break
;
}
case
BUTTON_LOAD_SINGLEPLAY
:
{
case
BUTTON_LOAD_SINGLEPLAY
:
{
if
(
!
open_file
&&
mainGame
->
lstSinglePlayList
->
getSelected
()
==
-
1
)
if
(
!
open_file
&&
mainGame
->
lstSinglePlayList
->
getSelected
()
==
-
1
)
break
;
break
;
...
@@ -317,6 +377,13 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -317,6 +377,13 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
SetStaticText
(
mainGame
->
stReplayInfo
,
180
,
mainGame
->
guiFont
,
(
wchar_t
*
)
repinfo
.
c_str
());
mainGame
->
SetStaticText
(
mainGame
->
stReplayInfo
,
180
,
mainGame
->
guiFont
,
(
wchar_t
*
)
repinfo
.
c_str
());
break
;
break
;
}
}
case
LISTBOX_BOT_LIST
:
{
int
sel
=
mainGame
->
lstBotList
->
getSelected
();
if
(
sel
==
-
1
)
break
;
mainGame
->
SetStaticText
(
mainGame
->
stBotInfo
,
200
,
mainGame
->
guiFont
,
mainGame
->
botInfo
[
sel
].
desc
);
break
;
}
}
}
break
;
break
;
}
}
...
@@ -341,6 +408,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -341,6 +408,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
}
break
;
break
;
}
}
case
CHECKBOX_BOT_OLD_RULE
:
{
mainGame
->
RefreshBot
();
break
;
}
}
}
break
;
break
;
}
}
...
...
strings.conf
View file @
d2696454
...
@@ -241,7 +241,7 @@
...
@@ -241,7 +241,7 @@
!
system
1163
灵摆召唤
!
system
1163
灵摆召唤
#menu
#menu
!
system
1200
联机模式
!
system
1200
联机模式
!
system
1201
残局
模式
!
system
1201
单人
模式
!
system
1202
观看录像
!
system
1202
观看录像
!
system
1203
N/A
!
system
1203
N/A
!
system
1204
编辑卡组
!
system
1204
编辑卡组
...
@@ -280,6 +280,8 @@
...
@@ -280,6 +280,8 @@
!
system
1244
单局模式
!
system
1244
单局模式
!
system
1245
比赛模式
!
system
1245
比赛模式
!
system
1246
TAG
!
system
1246
TAG
!
system
1247
标准对战
!
system
1248
自定义
!
system
1250
决斗准备
!
system
1250
决斗准备
!
system
1251
→决斗者
!
system
1251
→决斗者
!
system
1252
→观战
!
system
1252
→观战
...
@@ -299,8 +301,6 @@
...
@@ -299,8 +301,6 @@
!
system
1276
自动排列连锁顺序
!
system
1276
自动排列连锁顺序
!
system
1277
没有可连锁的卡时延迟回应
!
system
1277
没有可连锁的卡时延迟回应
!
system
1278
自动选择魔陷卡片位置
!
system
1278
自动选择魔陷卡片位置
!
system
1280
标准对战
!
system
1281
自定义
!
system
1290
忽略对方发言
!
system
1290
忽略对方发言
!
system
1291
忽略观战者发言
!
system
1291
忽略观战者发言
!
system
1292
忽略时点
!
system
1292
忽略时点
...
@@ -373,6 +373,12 @@
...
@@ -373,6 +373,12 @@
!
system
1372
守备↑
!
system
1372
守备↑
!
system
1373
名称↓
!
system
1373
名称↓
!
system
1374
连接标记
!
system
1374
连接标记
!
system
1380
人机模式
!
system
1381
残局模式
!
system
1382
人机信息:
!
system
1383
使用旧规则(大师规则3)
!
system
1384
电脑锁定出剪刀
!
system
1385
列表为空,可能未安装合适的人机
!
system
1390
等待行动中...
!
system
1390
等待行动中...
!
system
1391
等待行动中....
!
system
1391
等待行动中....
!
system
1392
等待行动中.....
!
system
1392
等待行动中.....
...
...
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