Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro-2pick
Commits
f4441b65
Commit
f4441b65
authored
Nov 21, 2017
by
mercury233
Committed by
nanahira
Nov 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mg1
parent
deb51558
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
6 deletions
+66
-6
gframe/game.cpp
gframe/game.cpp
+39
-3
gframe/game.h
gframe/game.h
+11
-1
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+16
-2
No files found.
gframe/game.cpp
View file @
f4441b65
...
...
@@ -581,16 +581,16 @@ bool Game::Initialize() {
wSinglePlay
->
setVisible
(
false
);
irr
::
gui
::
IGUITabControl
*
wSingle
=
env
->
addTabControl
(
rect
<
s32
>
(
0
,
20
,
579
,
419
),
wSinglePlay
,
true
);
irr
::
gui
::
IGUITab
*
tabBot
=
wSingle
->
addTab
(
dataManager
.
GetSysString
(
1380
));
lstBotList
=
env
->
addListBox
(
rect
<
s32
>
(
10
,
10
,
350
,
350
),
tabBot
,
LISTBOX_SINGLEPLAY_LIST
,
true
);
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
,
5
5
0
,
160
),
false
,
true
,
tabBot
);
stBotInfo
=
env
->
addStaticText
(
L""
,
rect
<
s32
>
(
360
,
40
,
5
6
0
,
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
);
...
...
@@ -1006,6 +1006,42 @@ void Game::RefershBGMDir(std::wstring path, int scene) {
}
closedir
(
dir
);
#endif
void
Game
::
RefreshBot
()
{
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
,
"!%s[^
\n
]"
,
strbuf
);
BufferIO
::
DecodeUTF8
(
strbuf
,
newinfo
.
internalname
);
fgets
(
linebuf
,
256
,
fp
);
sscanf
(
linebuf
,
"%s[^
\n
]"
,
strbuf
);
BufferIO
::
DecodeUTF8
(
strbuf
,
newinfo
.
name
);
fgets
(
linebuf
,
256
,
fp
);
sscanf
(
linebuf
,
"%s[^
\n
]"
,
strbuf
);
BufferIO
::
DecodeUTF8
(
strbuf
,
newinfo
.
desc
);
fgets
(
linebuf
,
256
,
fp
);
sscanf
(
linebuf
,
"%d"
,
&
newinfo
.
flag
);
if
((
chkBotOldRule
->
isChecked
()
&&
(
newinfo
.
flag
&
0x1
))
||
(
!
chkBotOldRule
->
isChecked
()
&&
(
newinfo
.
flag
&
0x2
)))
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
)
stBotInfo
->
setText
(
dataManager
.
GetSysString
(
1385
));
}
void
Game
::
LoadConfig
()
{
FILE
*
fp
=
fopen
(
"system.conf"
,
"r"
);
...
...
gframe/game.h
View file @
f4441b65
...
...
@@ -74,6 +74,13 @@ struct DuelInfo {
unsigned
short
time_left
[
2
];
};
struct
BotInfo
{
wchar_t
internalname
[
32
];
wchar_t
name
[
32
];
wchar_t
desc
[
32
];
int
flag
;
};
struct
FadingUnit
{
bool
signalAction
;
bool
isFadein
;
...
...
@@ -100,6 +107,7 @@ public:
void
RefreshSingleplay
();
void
RefreshBGMList
();
void
RefershBGMDir
(
std
::
wstring
path
,
int
scene
);
void
RefreshBot
();
void
DrawSelectionLine
(
irr
::
video
::
S3DVertex
*
vec
,
bool
strip
,
int
width
,
float
*
cv
);
void
DrawBackGround
();
void
DrawLinkedZones
(
ClientCard
*
pcard
);
...
...
@@ -154,6 +162,7 @@ public:
std
::
vector
<
int
>
logParam
;
std
::
wstring
chatMsg
[
8
];
std
::
vector
<
std
::
wstring
>
BGMList
[
8
];
std
::
vector
<
BotInfo
>
botInfo
;
int
hideChatTimer
;
bool
hideChat
;
...
...
@@ -598,7 +607,8 @@ extern Game* mainGame;
#define BUTTON_REPLAY_SAVE 330
#define BUTTON_REPLAY_CANCEL 331
#define BUTTON_BOT_START 340
#define CHECKBOX_BOT_OLD_RULE 341
#define LISTBOX_BOT_LIST 341
#define CHECKBOX_BOT_OLD_RULE 342
#define LISTBOX_SINGLEPLAY_LIST 350
#define BUTTON_LOAD_SINGLEPLAY 351
#define BUTTON_CANCEL_SINGLEPLAY 352
...
...
gframe/menu_handler.cpp
View file @
f4441b65
...
...
@@ -196,6 +196,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
HideElement
(
mainGame
->
wMainMenu
);
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
mainGame
->
RefreshSingleplay
();
mainGame
->
RefreshBot
();
break
;
}
case
BUTTON_LOAD_REPLAY
:
{
...
...
@@ -239,6 +240,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_BOT_START
:
{
int
sel
=
mainGame
->
lstBotList
->
getSelected
();
if
(
sel
==
-
1
)
break
;
bot_mode
=
true
;
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
break
;
...
...
@@ -253,7 +257,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
si
.
cb
=
sizeof
(
si
);
ZeroMemory
(
&
pi
,
sizeof
(
pi
));
LPTSTR
cmd
=
new
TCHAR
[
MAX_PATH
];
myswprintf
(
cmd
,
L"Bot.exe %
s"
,
L"1"
);
myswprintf
(
cmd
,
L"Bot.exe %
d
\"
%s
\"
"
,
(
mainGame
->
chkBotHand
->
isChecked
()
?
1
:
0
),
mainGame
->
botInfo
[
sel
].
internalname
);
if
(
!
CreateProcess
(
NULL
,
cmd
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
si
,
&
pi
))
{
NetServer
::
StopServer
();
...
...
@@ -263,7 +267,6 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
btnStartBot
->
setEnabled
(
false
);
mainGame
->
btnBotCancel
->
setEnabled
(
false
);
break
;
}
case
BUTTON_LOAD_SINGLEPLAY
:
{
if
(
!
open_file
&&
mainGame
->
lstSinglePlayList
->
getSelected
()
==
-
1
)
...
...
@@ -355,6 +358,13 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame
->
SetStaticText
(
mainGame
->
stReplayInfo
,
180
,
mainGame
->
guiFont
,
(
wchar_t
*
)
repinfo
.
c_str
());
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
;
}
...
...
@@ -379,6 +389,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
break
;
}
case
CHECKBOX_BOT_OLD_RULE
:
{
mainGame
->
RefreshBot
();
break
;
}
}
break
;
}
...
...
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