Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
ygopro
Commits
fdab949e
Commit
fdab949e
authored
Dec 13, 2018
by
mercury233
Committed by
GitHub
Dec 13, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add switch for prefer expansion script (#2169)
parent
ca6f8e9c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
4 deletions
+29
-4
gframe/data_manager.cpp
gframe/data_manager.cpp
+13
-4
gframe/event_handler.cpp
gframe/event_handler.cpp
+5
-0
gframe/game.cpp
gframe/game.cpp
+7
-0
gframe/game.h
gframe/game.h
+3
-0
strings.conf
strings.conf
+1
-0
No files found.
gframe/data_manager.cpp
View file @
fdab949e
#include "data_manager.h"
#include "game.h"
#include <stdio.h>
namespace
ygo
{
...
...
@@ -311,12 +312,20 @@ int DataManager::CardReader(int code, void* pData) {
return
0
;
}
byte
*
DataManager
::
ScriptReaderEx
(
const
char
*
script_name
,
int
*
slen
)
{
char
exname
[
256
]
=
"./expansions"
;
strcat
(
exname
,
script_name
+
1
);
//default script name: ./script/c%d.lua
if
(
ScriptReader
(
exname
,
slen
))
// default script name: ./script/c%d.lua
char
first
[
256
];
char
second
[
256
];
if
(
mainGame
->
gameConf
.
prefer_expansion_script
)
{
sprintf
(
first
,
"expansions/%s"
,
script_name
+
2
);
sprintf
(
second
,
"%s"
,
script_name
+
2
);
}
else
{
sprintf
(
first
,
"%s"
,
script_name
+
2
);
sprintf
(
second
,
"expansions/%s"
,
script_name
+
2
);
}
if
(
ScriptReader
(
first
,
slen
))
return
scriptBuffer
;
else
return
ScriptReader
(
s
cript_name
,
slen
);
return
ScriptReader
(
s
econd
,
slen
);
}
byte
*
DataManager
::
ScriptReader
(
const
char
*
script_name
,
int
*
slen
)
{
FILE
*
fp
;
...
...
gframe/event_handler.cpp
View file @
fdab949e
...
...
@@ -1828,6 +1828,11 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return
true
;
break
;
}
case
CHECKBOX_PREFER_EXPANSION
:
{
mainGame
->
gameConf
.
prefer_expansion_script
=
mainGame
->
chkPreferExpansionScript
->
isChecked
()
?
1
:
0
;
return
true
;
break
;
}
}
break
;
}
...
...
gframe/game.cpp
View file @
fdab949e
...
...
@@ -294,6 +294,9 @@ bool Game::Initialize() {
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
;
chkPreferExpansionScript
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
posX
,
posY
,
posX
+
260
,
posY
+
25
),
tabSystem
,
CHECKBOX_PREFER_EXPANSION
,
dataManager
.
GetSysString
(
1379
));
chkPreferExpansionScript
->
setChecked
(
gameConf
.
prefer_expansion_script
!=
0
);
posY
+=
30
;
chkEnableSound
=
env
->
addCheckBox
(
gameConf
.
enable_sound
,
rect
<
s32
>
(
posX
,
posY
,
posX
+
120
,
posY
+
25
),
tabSystem
,
-
1
,
dataManager
.
GetSysString
(
1279
));
chkEnableSound
->
setChecked
(
gameConf
.
enable_sound
);
scrSoundVolume
=
env
->
addScrollBar
(
true
,
rect
<
s32
>
(
posX
+
126
,
posY
+
4
,
posX
+
260
,
posY
+
21
),
tabSystem
,
SCROLL_VOLUME
);
...
...
@@ -981,6 +984,7 @@ void Game::LoadConfig() {
gameConf
.
enable_bot_mode
=
0
;
gameConf
.
quick_animation
=
0
;
gameConf
.
auto_save_replay
=
0
;
gameConf
.
prefer_expansion_script
=
0
;
gameConf
.
enable_sound
=
true
;
gameConf
.
sound_volume
=
0.5
;
gameConf
.
enable_music
=
true
;
...
...
@@ -1054,6 +1058,8 @@ void Game::LoadConfig() {
gameConf
.
quick_animation
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"auto_save_replay"
))
{
gameConf
.
auto_save_replay
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"prefer_expansion_script"
))
{
gameConf
.
prefer_expansion_script
=
atoi
(
valbuf
);
#ifdef YGOPRO_USE_IRRKLANG
}
else
if
(
!
strcmp
(
strbuf
,
"enable_sound"
))
{
gameConf
.
enable_sound
=
atoi
(
valbuf
)
>
0
;
...
...
@@ -1130,6 +1136,7 @@ void Game::SaveConfig() {
fprintf
(
fp
,
"enable_bot_mode = %d
\n
"
,
gameConf
.
enable_bot_mode
);
fprintf
(
fp
,
"quick_animation = %d
\n
"
,
gameConf
.
quick_animation
);
fprintf
(
fp
,
"auto_save_replay = %d
\n
"
,
(
chkAutoSaveReplay
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"prefer_expansion_script = %d
\n
"
,
gameConf
.
prefer_expansion_script
);
#ifdef YGOPRO_USE_IRRKLANG
fprintf
(
fp
,
"enable_sound = %d
\n
"
,
(
chkEnableSound
->
isChecked
()
?
1
:
0
));
fprintf
(
fp
,
"enable_music = %d
\n
"
,
(
chkEnableMusic
->
isChecked
()
?
1
:
0
));
...
...
gframe/game.h
View file @
fdab949e
...
...
@@ -45,6 +45,7 @@ struct Config {
int
enable_bot_mode
;
int
quick_animation
;
int
auto_save_replay
;
int
prefer_expansion_script
;
bool
enable_sound
;
bool
enable_music
;
double
sound_volume
;
...
...
@@ -248,6 +249,7 @@ public:
irr
::
gui
::
IGUICheckBox
*
chkIgnoreDeckChanges
;
irr
::
gui
::
IGUICheckBox
*
chkAutoSearch
;
irr
::
gui
::
IGUICheckBox
*
chkMultiKeywords
;
irr
::
gui
::
IGUICheckBox
*
chkPreferExpansionScript
;
irr
::
gui
::
IGUICheckBox
*
chkEnableSound
;
irr
::
gui
::
IGUICheckBox
*
chkEnableMusic
;
irr
::
gui
::
IGUIScrollBar
*
scrSoundVolume
;
...
...
@@ -626,6 +628,7 @@ extern Game* mainGame;
#define BUTTON_CANCEL_SINGLEPLAY 352
#define CHECKBOX_AUTO_SEARCH 360
#define CHECKBOX_MULTI_KEYWORDS 372
#define CHECKBOX_PREFER_EXPANSION 373
#define CHECKBOX_ENABLE_SOUND 361
#define CHECKBOX_ENABLE_MUSIC 362
#define SCROLL_VOLUME 363
...
...
strings.conf
View file @
fdab949e
...
...
@@ -399,6 +399,7 @@
!
system
1373
名称↓
!
system
1374
连接标记
!
system
1378
使用多个关键词搜索卡片
!
system
1379
启用扩展卡包调试模式
!
system
1380
人机模式
!
system
1381
残局模式
!
system
1382
人机信息:
...
...
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