Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
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
fallenstardust
YGOMobile-Cn-Ko-En
Commits
4c8c139b
Commit
4c8c139b
authored
Dec 28, 2019
by
Unicorn369
Committed by
fallenstardust
Dec 31, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同曲不重放
parent
accd65f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
Classes/gframe/sound_manager.cpp
Classes/gframe/sound_manager.cpp
+8
-4
Classes/gframe/sound_manager.h
Classes/gframe/sound_manager.h
+1
-0
No files found.
Classes/gframe/sound_manager.cpp
View file @
4c8c139b
...
...
@@ -130,6 +130,7 @@ void SoundManager::PlayMusic(const std::string& song, bool loop) {
if
(
!
musicEnabled
)
return
;
StopBGM
();
if
(
bgm
)
bgmCurrent
=
bgm
->
play
(
song
,
loop
);
bgm_process
=
true
;
}
void
SoundManager
::
PlayBGM
(
BGM
scene
)
{
if
(
!
mainGame
->
chkMusicMode
->
isChecked
())
...
...
@@ -139,6 +140,7 @@ void SoundManager::PlayBGM(BGM scene) {
if
(
musicEnabled
&&
(
scene
!=
bgm_scene
||
!
bgm
->
exists
(
bgmCurrent
))
&&
bgm_process
&&
count
>
0
)
{
bgm_scene
=
scene
;
int
bgm
=
(
std
::
uniform_int_distribution
<>
(
0
,
count
-
1
))(
rnd
);
bgm_PlayingName
=
list
[
bgm
];
std
::
string
BGMName
=
"./sound/BGM/"
+
list
[
bgm
];
PlayMusic
(
BGMName
,
false
);
}
...
...
@@ -154,11 +156,11 @@ bool SoundManager::PlayChant(unsigned int code) {
if
(
dataManager
.
GetData
(
code
,
&
cd
)
&&
(
cd
.
alias
!=
0
))
code
=
cd
.
alias
;
if
(
ChantsList
.
count
(
code
))
{
if
(
ChantsList
.
count
(
code
)
&&
bgm_PlayingName
!=
ChantsList
[
code
]
)
{
if
(
bgm
)
{
bgm_process
=
false
;
bgm_PlayingName
=
ChantsList
[
code
];
PlayMusic
(
"./sound/chants/"
+
ChantsList
[
code
],
false
);
bgm_process
=
true
;
}
return
true
;
}
...
...
@@ -172,10 +174,12 @@ void SoundManager::PlayCustomSound(char* SoundName) {
void
SoundManager
::
PlayCustomBGM
(
char
*
BGMName
)
{
if
(
!
musicEnabled
||
!
mainGame
->
chkMusicMode
->
isChecked
())
return
;
if
(
access
(
BGMName
,
0
)
!=
0
)
return
;
if
(
bgm
)
{
std
::
string
CustomBGM
=
Utils
::
GetFileName
(
TEXT
(
BGMName
));
if
(
bgm
&&
bgm_PlayingName
!=
CustomBGM
)
{
bgm_process
=
false
;
bgm_PlayingName
=
CustomBGM
;
PlayMusic
(
BGMName
,
false
);
bgm_process
=
true
;
}
}
void
SoundManager
::
SetSoundVolume
(
double
volume
)
{
...
...
Classes/gframe/sound_manager.h
View file @
4c8c139b
...
...
@@ -69,6 +69,7 @@ public:
private:
std
::
vector
<
std
::
string
>
BGMList
[
9
];
std
::
map
<
unsigned
int
,
std
::
string
>
ChantsList
;
std
::
string
bgm_PlayingName
;
int
bgm_scene
=
-
1
;
bool
bgm_process
;
std
::
mt19937
rnd
;
...
...
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