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
66ba4158
Commit
66ba4158
authored
Nov 27, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ai' into test
parents
fca1f736
e9b63c2d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
17 deletions
+30
-17
gframe/game.cpp
gframe/game.cpp
+26
-15
gframe/game.h
gframe/game.h
+4
-2
No files found.
gframe/game.cpp
View file @
66ba4158
...
@@ -597,17 +597,19 @@ bool Game::Initialize() {
...
@@ -597,17 +597,19 @@ bool Game::Initialize() {
wSinglePlay->getCloseButton()->setVisible(false);
wSinglePlay->getCloseButton()->setVisible(false);
wSinglePlay->setVisible(false);
wSinglePlay->setVisible(false);
irr::gui::IGUITabControl* wSingle = env->addTabControl(rect<s32>(0, 20, 579, 419), wSinglePlay, true);
irr::gui::IGUITabControl* wSingle = env->addTabControl(rect<s32>(0, 20, 579, 419), wSinglePlay, true);
irr::gui::IGUITab* tabBot = wSingle->addTab(dataManager.GetSysString(1380));
if(gameConf.enable_bot_mode) {
lstBotList = env->addListBox(rect<s32>(10, 10, 350, 350), tabBot, LISTBOX_BOT_LIST, true);
irr::gui::IGUITab* tabBot = wSingle->addTab(dataManager.GetSysString(1380));
lstBotList->setItemHeight(18);
lstBotList = env->addListBox(rect<s32>(10, 10, 350, 350), tabBot, LISTBOX_BOT_LIST, true);
btnStartBot = env->addButton(rect<s32>(459, 301, 569, 326), tabBot, BUTTON_BOT_START, dataManager.GetSysString(1211));
lstBotList->setItemHeight(18);
btnBotCancel = env->addButton(rect<s32>(459, 331, 569, 356), tabBot, BUTTON_CANCEL_SINGLEPLAY, dataManager.GetSysString(1210));
btnStartBot = env->addButton(rect<s32>(459, 301, 569, 326), tabBot, BUTTON_BOT_START, dataManager.GetSysString(1211));
env->addStaticText(dataManager.GetSysString(1382), rect<s32>(360, 10, 550, 30), false, true, tabBot);
btnBotCancel = env->addButton(rect<s32>(459, 331, 569, 356), tabBot, BUTTON_CANCEL_SINGLEPLAY, dataManager.GetSysString(1210));
stBotInfo = env->addStaticText(L"", rect<s32>(360, 40, 560, 160), false, true, tabBot);
env->addStaticText(dataManager.GetSysString(1382), rect<s32>(360, 10, 550, 30), false, true, tabBot);
chkBotOldRule = env->addCheckBox(false, rect<s32>(360, 170, 560, 190), tabBot, CHECKBOX_BOT_OLD_RULE, dataManager.GetSysString(1383));
stBotInfo = env->addStaticText(L"", rect<s32>(360, 40, 560, 160), false, true, tabBot);
chkBotHand = env->addCheckBox(false, rect<s32>(360, 200, 560, 220), tabBot, -1, dataManager.GetSysString(1384));
chkBotOldRule = env->addCheckBox(false, rect<s32>(360, 170, 560, 190), tabBot, CHECKBOX_BOT_OLD_RULE, dataManager.GetSysString(1383));
chkBotNoCheckDeck = env->addCheckBox(false, rect<s32>(360, 230, 560, 250), tabBot, -1, dataManager.GetSysString(1229));
chkBotHand = env->addCheckBox(false, rect<s32>(360, 200, 560, 220), tabBot, -1, dataManager.GetSysString(1384));
chkBotNoShuffleDeck = env->addCheckBox(false, rect<s32>(360, 260, 560, 280), tabBot, -1, dataManager.GetSysString(1230));
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));
irr::gui::IGUITab* tabSingle = wSingle->addTab(dataManager.GetSysString(1381));
lstSinglePlayList = env->addListBox(rect<s32>(10, 10, 350, 350), tabSingle, LISTBOX_SINGLEPLAY_LIST, true);
lstSinglePlayList = env->addListBox(rect<s32>(10, 10, 350, 350), tabSingle, LISTBOX_SINGLEPLAY_LIST, true);
lstSinglePlayList->setItemHeight(18);
lstSinglePlayList->setItemHeight(18);
...
@@ -1026,6 +1028,8 @@ void Game::RefershBGMDir(std::wstring path, int scene) {
...
@@ -1026,6 +1028,8 @@ void Game::RefershBGMDir(std::wstring path, int scene) {
#endif
#endif
}
}
void Game::RefreshBot() {
void Game::RefreshBot() {
if(!gameConf.enable_bot_mode)
return;
botInfo.clear();
botInfo.clear();
FILE* fp = fopen("bot.conf", "r");
FILE* fp = fopen("bot.conf", "r");
char linebuf[256];
char linebuf[256];
...
@@ -1045,9 +1049,10 @@ void Game::RefreshBot() {
...
@@ -1045,9 +1049,10 @@ void Game::RefreshBot() {
sscanf(linebuf, "%240[^\n]", strbuf);
sscanf(linebuf, "%240[^\n]", strbuf);
BufferIO::DecodeUTF8(strbuf, newinfo.desc);
BufferIO::DecodeUTF8(strbuf, newinfo.desc);
fgets(linebuf, 256, fp);
fgets(linebuf, 256, fp);
sscanf(linebuf, "%d", &newinfo.flag);
newinfo.support_master_rule_3 = !!strstr(linebuf, "SUPPORT_MASTER_RULE_3");
if((chkBotOldRule->isChecked() && (newinfo.flag & 0x1))
newinfo.support_new_master_rule = !!strstr(linebuf, "SUPPORT_NEW_MASTER_RULE");
|| (!chkBotOldRule->isChecked() && (newinfo.flag & 0x2)))
if((chkBotOldRule->isChecked() && newinfo.support_master_rule_3)
|| (!chkBotOldRule->isChecked() && newinfo.support_new_master_rule))
botInfo.push_back(newinfo);
botInfo.push_back(newinfo);
continue;
continue;
}
}
...
@@ -1060,7 +1065,7 @@ void Game::RefreshBot() {
...
@@ -1060,7 +1065,7 @@ void Game::RefreshBot() {
lstBotList->addItem(botInfo[i].name);
lstBotList->addItem(botInfo[i].name);
}
}
if(botInfo.size() == 0)
if(botInfo.size() == 0)
stBotInfo->setText(
dataManager.GetSysString(1385));
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");
...
@@ -1099,6 +1104,7 @@ void Game::LoadConfig() {
...
@@ -1099,6 +1104,7 @@ void Game::LoadConfig() {
gameConf.auto_search_limit = 0;
gameConf.auto_search_limit = 0;
gameConf.chkIgnoreDeckChanges = 0;
gameConf.chkIgnoreDeckChanges = 0;
gameConf.defaultOT = 1;
gameConf.defaultOT = 1;
gameConf.enable_bot_mode = 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;
...
@@ -1164,6 +1170,10 @@ void Game::LoadConfig() {
...
@@ -1164,6 +1170,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 if(!strcmp(strbuf, "enable_sound")) {
} else if(!strcmp(strbuf, "enable_sound")) {
gameConf.enable_sound = atoi(valbuf) > 0;
gameConf.enable_sound = atoi(valbuf) > 0;
} else if(!strcmp(strbuf, "sound_volume")) {
} else if(!strcmp(strbuf, "sound_volume")) {
...
@@ -1233,6 +1243,7 @@ void Game::SaveConfig() {
...
@@ -1233,6 +1243,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);
fprintf(fp, "enable_sound = %d\n", ((mainGame->chkEnableSound->isChecked()) ? 1 : 0));
fprintf(fp, "enable_sound = %d\n", ((mainGame->chkEnableSound->isChecked()) ? 1 : 0));
fprintf(fp, "enable_music = %d\n", ((mainGame->chkEnableMusic->isChecked()) ? 1 : 0));
fprintf(fp, "enable_music = %d\n", ((mainGame->chkEnableMusic->isChecked()) ? 1 : 0));
fprintf(fp, "#Volume of sound and music, between 0 and 100\n");
fprintf(fp, "#Volume of sound and music, between 0 and 100\n");
...
...
gframe/game.h
View file @
66ba4158
...
@@ -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
;
bool
enable_sound
;
bool
enable_sound
;
bool
enable_music
;
bool
enable_music
;
double
sound_volume
;
double
sound_volume
;
...
@@ -75,10 +76,11 @@ struct DuelInfo {
...
@@ -75,10 +76,11 @@ struct DuelInfo {
};
};
struct
BotInfo
{
struct
BotInfo
{
wchar_t
name
[
32
];
wchar_t
name
[
256
];
wchar_t
command
[
256
];
wchar_t
command
[
256
];
wchar_t
desc
[
256
];
wchar_t
desc
[
256
];
int
flag
;
bool
support_master_rule_3
;
bool
support_new_master_rule
;
};
};
struct
FadingUnit
{
struct
FadingUnit
{
...
...
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