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
1
Merge Requests
1
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
49669fb4
Commit
49669fb4
authored
Jun 28, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'sound' of
https://github.com/DailyShana/ygopro
into master
parents
de985735
a22e3b9e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
205 additions
and
4 deletions
+205
-4
gframe/config.h
gframe/config.h
+1
-0
gframe/deck_con.cpp
gframe/deck_con.cpp
+7
-0
gframe/duelclient.cpp
gframe/duelclient.cpp
+23
-1
gframe/event_handler.cpp
gframe/event_handler.cpp
+12
-0
gframe/game.cpp
gframe/game.cpp
+127
-1
gframe/game.h
gframe/game.h
+22
-0
gframe/premake4.lua
gframe/premake4.lua
+3
-2
strings.conf
strings.conf
+2
-0
system.conf
system.conf
+8
-0
No files found.
gframe/config.h
View file @
49669fb4
...
...
@@ -47,6 +47,7 @@ inline int _wtoi(const wchar_t * s) {
#endif
#include <irrlicht.h>
#include <irrKlang.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "CGUITTFont.h"
...
...
gframe/deck_con.cpp
View file @
49669fb4
...
...
@@ -459,6 +459,13 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
}
}
}
case
irr
:
:
gui
::
EGET_CHECKBOX_CHANGED
:
{
case
CHECKBOX_ENABLE_MUSIC
:
{
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
mainGame
->
engineMusic
->
stopAllSounds
();
break
;
}
}
default:
break
;
}
break
;
...
...
gframe/duelclient.cpp
View file @
49669fb4
...
...
@@ -626,6 +626,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break
;
}
case
STOC_HS_PLAYER_ENTER
:
{
mainGame
->
PlaySoundEffect
(
"./sound/playerenter.wav"
);
STOC_HS_PlayerEnter
*
pkt
=
(
STOC_HS_PlayerEnter
*
)
pdata
;
if
(
pkt
->
pos
>
3
)
break
;
...
...
@@ -660,6 +661,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break
;
mainGame
->
gMutex
.
Lock
();
if
(
state
<
8
)
{
mainGame
->
PlaySoundEffect
(
"./sound/playerenter.wav"
);
wchar_t
*
prename
=
(
wchar_t
*
)
mainGame
->
stHostPrepDuelist
[
pos
]
->
getText
();
mainGame
->
stHostPrepDuelist
[
state
]
->
setText
(
prename
);
mainGame
->
stHostPrepDuelist
[
pos
]
->
setText
(
L""
);
...
...
@@ -1710,6 +1712,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_SHUFFLE_DECK
:
{
mainGame
->
PlaySoundEffect
(
"./sound/shuffle.wav"
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
if
(
mainGame
->
dField
.
deck
[
player
].
size
()
<
2
)
return
true
;
...
...
@@ -1904,6 +1907,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_NEW_TURN
:
{
mainGame
->
PlaySoundEffect
(
"./sound/nextturn.wav"
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
mainGame
->
dInfo
.
turn
++
;
if
(
!
mainGame
->
dInfo
.
isTag
&&
!
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
player_type
<
7
)
{
...
...
@@ -1940,6 +1944,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_NEW_PHASE
:
{
mainGame
->
PlaySoundEffect
(
"./sound/phase.wav"
);
unsigned
short
phase
=
BufferIO
::
ReadInt16
(
pbuf
);
mainGame
->
btnPhaseStatus
->
setVisible
(
false
);
mainGame
->
btnBP
->
setVisible
(
false
);
...
...
@@ -1993,7 +1998,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int
cl
=
BufferIO
::
ReadUInt8
(
pbuf
);
int
cs
=
BufferIO
::
ReadInt8
(
pbuf
);
int
cp
=
BufferIO
::
ReadInt8
(
pbuf
);
/*int reason = */
BufferIO
::
ReadInt32
(
pbuf
);
int
reason
=
BufferIO
::
ReadInt32
(
pbuf
);
if
(
reason
&
REASON_DESTROY
&&
pl
!=
cl
)
mainGame
->
PlaySoundEffect
(
"./sound/destroyed.wav"
);
if
(
pl
==
0
)
{
ClientCard
*
pcard
=
new
ClientCard
();
pcard
->
position
=
cp
;
...
...
@@ -2209,6 +2216,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_SET
:
{
mainGame
->
PlaySoundEffect
(
"./sound/set.wav"
);
/*int code = */
BufferIO
::
ReadInt32
(
pbuf
);
/*int cc = mainGame->LocalPlayer*/
(
BufferIO
::
ReadInt8
(
pbuf
));
/*int cl = */
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -2261,6 +2269,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_SUMMONING
:
{
mainGame
->
PlaySoundEffect
(
"./sound/summon.wav"
);
unsigned
int
code
=
(
unsigned
int
)
BufferIO
::
ReadInt32
(
pbuf
);
/*int cc = */
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
/*int cl = */
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -2283,6 +2292,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_SPSUMMONING
:
{
mainGame
->
PlaySoundEffect
(
"./sound/specialsummon.wav"
);
unsigned
int
code
=
(
unsigned
int
)
BufferIO
::
ReadInt32
(
pbuf
);
/*int cc = */
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
/*int cl = */
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -2304,6 +2314,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_FLIPSUMMONING
:
{
mainGame
->
PlaySoundEffect
(
"./sound/flip.wav"
);
unsigned
int
code
=
(
unsigned
int
)
BufferIO
::
ReadInt32
(
pbuf
);
int
cc
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
cl
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -2331,6 +2342,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_CHAINING
:
{
mainGame
->
PlaySoundEffect
(
"./sound/activate.wav"
);
unsigned
int
code
=
(
unsigned
int
)
BufferIO
::
ReadInt32
(
pbuf
);
int
pcc
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
pcl
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -2504,6 +2516,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
}
else
{
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
mainGame
->
PlaySoundEffect
(
"./sound/draw.wav"
);
mainGame
->
gMutex
.
Lock
();
pcard
=
mainGame
->
dField
.
GetCard
(
player
,
LOCATION_DECK
,
mainGame
->
dField
.
deck
[
player
].
size
()
-
1
);
mainGame
->
dField
.
deck
[
player
].
erase
(
mainGame
->
dField
.
deck
[
player
].
end
()
-
1
);
...
...
@@ -2520,6 +2533,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_DAMAGE
:
{
mainGame
->
PlaySoundEffect
(
"./sound/damage.wav"
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
val
=
BufferIO
::
ReadInt32
(
pbuf
);
int
final
=
mainGame
->
dInfo
.
lp
[
player
]
-
val
;
...
...
@@ -2550,6 +2564,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_RECOVER
:
{
mainGame
->
PlaySoundEffect
(
"./sound/gainlp.wav"
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
val
=
BufferIO
::
ReadInt32
(
pbuf
);
int
final
=
mainGame
->
dInfo
.
lp
[
player
]
+
val
;
...
...
@@ -2578,6 +2593,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_EQUIP
:
{
mainGame
->
PlaySoundEffect
(
"./sound/equip.wav"
);
int
c1
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
l1
=
BufferIO
::
ReadInt8
(
pbuf
);
int
s1
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -2702,6 +2718,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
break
;
}
case
MSG_PAY_LPCOST
:
{
mainGame
->
PlaySoundEffect
(
"./sound/damage.wav"
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
cost
=
BufferIO
::
ReadInt32
(
pbuf
);
int
final
=
mainGame
->
dInfo
.
lp
[
player
]
-
cost
;
...
...
@@ -2728,6 +2745,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_ADD_COUNTER
:
{
mainGame
->
PlaySoundEffect
(
"./sound/addcounter.wav"
);
int
type
=
BufferIO
::
ReadInt16
(
pbuf
);
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
l
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -2750,6 +2768,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_REMOVE_COUNTER
:
{
mainGame
->
PlaySoundEffect
(
"./sound/removecounter.wav"
);
int
type
=
BufferIO
::
ReadInt16
(
pbuf
);
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
l
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -2772,6 +2791,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_ATTACK
:
{
mainGame
->
PlaySoundEffect
(
"./sound/attack.wav"
);
int
ca
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
la
=
BufferIO
::
ReadInt8
(
pbuf
);
int
sa
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -2880,6 +2900,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_TOSS_COIN
:
{
mainGame
->
PlaySoundEffect
(
"./sound/coinflip.wav"
);
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
count
=
BufferIO
::
ReadInt8
(
pbuf
);
wchar_t
*
pwbuf
=
textBuffer
;
...
...
@@ -2903,6 +2924,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_TOSS_DICE
:
{
mainGame
->
PlaySoundEffect
(
"./sound/diceroll.wav"
);
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
count
=
BufferIO
::
ReadInt8
(
pbuf
);
wchar_t
*
pwbuf
=
textBuffer
;
...
...
gframe/event_handler.cpp
View file @
49669fb4
...
...
@@ -888,6 +888,11 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
break
;
}
case
CHECKBOX_ENABLE_MUSIC
:
{
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
mainGame
->
engineMusic
->
stopAllSounds
();
break
;
}
}
break
;
}
...
...
@@ -2005,6 +2010,13 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return
true
;
break
;
}
case
SCROLL_VOLUME
:
{
mainGame
->
gameConf
.
soundvolume
=
(
double
)
mainGame
->
srcSoundVolume
->
getPos
()
/
100
;
mainGame
->
gameConf
.
musicvolume
=
(
double
)
mainGame
->
srcMusicVolume
->
getPos
()
/
100
;
mainGame
->
engineSound
->
setSoundVolume
(
mainGame
->
gameConf
.
soundvolume
);
mainGame
->
engineMusic
->
setSoundVolume
(
mainGame
->
gameConf
.
musicvolume
);
break
;
}
}
break
;
}
...
...
gframe/game.cpp
View file @
49669fb4
...
...
@@ -274,6 +274,24 @@ bool Game::Initialize() {
posY
+=
30
;
chkAutoSearch
=
env
->
addCheckBox
(
false
,
rect
<
s32
>
(
posX
,
posY
,
posX
+
225
,
posY
+
25
),
tabSystem
,
CHECKBOX_AUTO_SEARCH
,
dataManager
.
GetSysString
(
1358
));
chkAutoSearch
->
setChecked
(
gameConf
.
auto_search_limit
>=
0
);
posY
+=
30
;
chkEnableSound
=
env
->
addCheckBox
(
gameConf
.
enablesound
,
rect
<
s32
>
(
posX
,
posY
,
posX
+
100
,
posY
+
25
),
tabSystem
,
-
1
,
dataManager
.
GetSysString
(
1380
));
chkEnableSound
->
setChecked
(
gameConf
.
enablesound
);
srcSoundVolume
=
env
->
addScrollBar
(
true
,
rect
<
s32
>
(
posX
+
105
,
posY
,
posX
+
260
,
posY
+
25
),
tabSystem
,
SCROLL_VOLUME
);
srcSoundVolume
->
setMax
(
100
);
srcSoundVolume
->
setMin
(
0
);
srcSoundVolume
->
setPos
(
gameConf
.
soundvolume
*
100
);
srcSoundVolume
->
setLargeStep
(
1
);
srcSoundVolume
->
setSmallStep
(
1
);
posY
+=
30
;
chkEnableMusic
=
env
->
addCheckBox
(
gameConf
.
enablemusic
,
rect
<
s32
>
(
posX
,
posY
,
posX
+
100
,
posY
+
25
),
tabSystem
,
CHECKBOX_ENABLE_MUSIC
,
dataManager
.
GetSysString
(
1381
));
chkEnableMusic
->
setChecked
(
gameConf
.
enablemusic
);
srcMusicVolume
=
env
->
addScrollBar
(
true
,
rect
<
s32
>
(
posX
+
105
,
posY
,
posX
+
260
,
posY
+
25
),
tabSystem
,
SCROLL_VOLUME
);
srcMusicVolume
->
setMax
(
100
);
srcMusicVolume
->
setMin
(
0
);
srcMusicVolume
->
setPos
(
gameConf
.
musicvolume
*
100
);
srcMusicVolume
->
setLargeStep
(
1
);
srcMusicVolume
->
setSmallStep
(
1
);
//
wHand
=
env
->
addWindow
(
rect
<
s32
>
(
500
,
450
,
825
,
605
),
false
,
L""
);
wHand
->
getCloseButton
()
->
setVisible
(
false
);
...
...
@@ -603,6 +621,7 @@ bool Game::Initialize() {
stTip
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
stTip
->
setVisible
(
false
);
device
->
setEventReceiver
(
&
menuHandler
);
RefreshBGMList
();
LoadConfig
();
env
->
getSkin
()
->
setFont
(
guiFont
);
env
->
setFocus
(
wMainMenu
);
...
...
@@ -611,6 +630,8 @@ bool Game::Initialize() {
col
.
setAlpha
(
224
);
env
->
getSkin
()
->
setColor
((
EGUI_DEFAULT_COLOR
)
i
,
col
);
}
engineSound
=
irrklang
::
createIrrKlangDevice
();
engineMusic
=
irrklang
::
createIrrKlangDevice
();
hideChat
=
false
;
hideChatTimer
=
0
;
return
true
;
...
...
@@ -642,6 +663,16 @@ void Game::MainLoop() {
driver
->
draw2DImage
(
imageManager
.
tBackGround
,
recti
(
0
,
0
,
1024
,
640
),
recti
(
0
,
0
,
imageManager
.
tBackGround
->
getOriginalSize
().
Width
,
imageManager
.
tBackGround
->
getOriginalSize
().
Height
));
gMutex
.
Lock
();
if
(
dInfo
.
isStarted
)
{
if
(
mainGame
->
showcardcode
==
1
||
mainGame
->
showcardcode
==
3
)
PlayMusic
(
"./sound/duelwin.mp3"
,
true
);
else
if
(
mainGame
->
showcardcode
==
2
)
PlayMusic
(
"./sound/duellose.mp3"
,
true
);
else
if
(
mainGame
->
dInfo
.
lp
[
0
]
>
0
&&
mainGame
->
dInfo
.
lp
[
LocalPlayer
(
0
)]
<=
mainGame
->
dInfo
.
lp
[
LocalPlayer
(
1
)]
/
2
)
PlayMusic
(
"./sound/song-disadvantage.mp3"
,
true
);
else
if
(
mainGame
->
dInfo
.
lp
[
0
]
>
0
&&
mainGame
->
dInfo
.
lp
[
LocalPlayer
(
0
)]
>=
mainGame
->
dInfo
.
lp
[
LocalPlayer
(
1
)]
*
2
)
PlayMusic
(
"./sound/song-advantage.mp3"
,
true
);
else
PlayBGM
();
DrawBackGround
();
DrawCards
();
DrawMisc
();
...
...
@@ -652,9 +683,11 @@ void Game::MainLoop() {
if
(
imageManager
.
tBackGround_deck
)
driver
->
draw2DImage
(
imageManager
.
tBackGround_deck
,
recti
(
0
,
0
,
1024
,
640
),
recti
(
0
,
0
,
imageManager
.
tBackGround
->
getOriginalSize
().
Width
,
imageManager
.
tBackGround
->
getOriginalSize
().
Height
));
DrawDeckBd
();
PlayMusic
(
"./sound/deck.mp3"
,
true
);
}
else
{
if
(
imageManager
.
tBackGround_menu
)
driver
->
draw2DImage
(
imageManager
.
tBackGround_menu
,
recti
(
0
,
0
,
1024
,
640
),
recti
(
0
,
0
,
imageManager
.
tBackGround
->
getOriginalSize
().
Width
,
imageManager
.
tBackGround
->
getOriginalSize
().
Height
));
PlayMusic
(
"./sound/menu.mp3"
,
true
);
}
DrawGUI
();
DrawSpec
();
...
...
@@ -705,6 +738,7 @@ void Game::MainLoop() {
usleep
(
500000
);
#endif
SaveConfig
();
engineMusic
->
drop
();
// device->drop();
}
void
Game
::
BuildProjectionMatrix
(
irr
::
core
::
matrix4
&
mProjection
,
f32
left
,
f32
right
,
f32
bottom
,
f32
top
,
f32
znear
,
f32
zfar
)
{
...
...
@@ -897,6 +931,33 @@ void Game::RefreshSingleplay() {
closedir
(
dir
);
#endif
}
void
Game
::
RefreshBGMList
()
{
#ifdef _WIN32
WIN32_FIND_DATAW
fdataw
;
HANDLE
fh
=
FindFirstFileW
(
L"./sound/BGM/*.mp3"
,
&
fdataw
);
if
(
fh
==
INVALID_HANDLE_VALUE
)
return
;
do
{
if
(
!
(
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
BGMList
.
push_back
(
fdataw
.
cFileName
);
}
while
(
FindNextFileW
(
fh
,
&
fdataw
));
FindClose
(
fh
);
#else
DIR
*
dir
;
struct
dirent
*
dirp
;
if
((
dir
=
opendir
(
"./sound/BGM/*.mp3"
))
==
NULL
)
return
;
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
size_t
len
=
strlen
(
dirp
->
d_name
);
if
(
len
<
5
||
strcasecmp
(
dirp
->
d_name
+
len
-
4
,
".mp3"
)
!=
0
)
continue
;
wchar_t
wname
[
256
];
BufferIO
::
DecodeUTF8
(
dirp
->
d_name
,
wname
);
BGMList
.
push_back
(
fdataw
.
cFileName
);
}
closedir
(
dir
);
#endif
}
void
Game
::
LoadConfig
()
{
FILE
*
fp
=
fopen
(
"system.conf"
,
"r"
);
if
(
!
fp
)
...
...
@@ -931,6 +992,11 @@ void Game::LoadConfig() {
gameConf
.
separate_clear_button
=
1
;
gameConf
.
auto_search_limit
=
-
1
;
gameConf
.
chkIgnoreDeckChanges
=
0
;
gameConf
.
enablesound
=
true
;
gameConf
.
soundvolume
=
1.0
;
gameConf
.
enablemusic
=
true
;
gameConf
.
musicvolume
=
1.0
;
gameConf
.
BGM_index
=
-
1
;
fseek
(
fp
,
0
,
SEEK_END
);
int
fsize
=
ftell
(
fp
);
fseek
(
fp
,
0
,
SEEK_SET
);
...
...
@@ -991,6 +1057,14 @@ void Game::LoadConfig() {
gameConf
.
auto_search_limit
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"ignore_deck_changes"
))
{
gameConf
.
chkIgnoreDeckChanges
=
atoi
(
valbuf
);
}
else
if
(
!
strcmp
(
strbuf
,
"enable_sound"
))
{
gameConf
.
enablesound
=
atoi
(
valbuf
)
>
0
;
}
else
if
(
!
strcmp
(
strbuf
,
"soundvolume"
))
{
gameConf
.
soundvolume
=
atof
(
valbuf
)
/
100
;
}
else
if
(
!
strcmp
(
strbuf
,
"enable_music"
))
{
gameConf
.
enablemusic
=
atoi
(
valbuf
)
>
0
;
}
else
if
(
!
strcmp
(
strbuf
,
"musicvolume"
))
{
gameConf
.
musicvolume
=
atof
(
valbuf
)
/
100
;
}
else
{
// options allowing multiple words
sscanf
(
linebuf
,
"%s = %240[^
\n
]"
,
strbuf
,
valbuf
);
...
...
@@ -1048,8 +1122,56 @@ void Game::SaveConfig() {
fprintf
(
fp
,
"#auto_search_limit >= 0: Start search automatically when the user enters N chars
\n
"
);
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
,
"enable_sound = %d
\n
"
,
((
mainGame
->
chkEnableSound
->
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
"
);
int
vol
=
gameConf
.
soundvolume
*
100
;
if
(
vol
<
0
)
vol
=
0
;
else
if
(
vol
>
100
)
vol
=
100
;
fprintf
(
fp
,
"soundvolume = %d
\n
"
,
vol
);
vol
=
gameConf
.
musicvolume
*
100
;
if
(
vol
<
0
)
vol
=
0
;
else
if
(
vol
>
100
)
vol
=
100
;
fprintf
(
fp
,
"musicvolume = %d
\n
"
,
vol
);
fprintf
(
fp
,
"#playing the music corresponding to the sequence(start from 0) under folder /BGM
\n
#-1 means playing one of them randomly
\n
"
);
fprintf
(
fp
,
"BGM_index = %d
\n
"
,
gameConf
.
BGM_index
);
fclose
(
fp
);
}
void
Game
::
PlaySoundEffect
(
char
*
sound
)
{
if
(
mainGame
->
chkEnableSound
->
isChecked
())
{
engineSound
->
play2D
(
sound
);
engineSound
->
setSoundVolume
(
gameConf
.
soundvolume
);
}
}
void
Game
::
PlayMusic
(
char
*
song
,
bool
loop
)
{
if
(
mainGame
->
chkEnableMusic
->
isChecked
())
{
if
(
!
engineMusic
->
isCurrentlyPlaying
(
song
))
{
engineMusic
->
stopAllSounds
();
engineMusic
->
play2D
(
song
,
loop
);
engineMusic
->
setSoundVolume
(
gameConf
.
musicvolume
);
}
}
}
void
Game
::
PlayBGM
()
{
if
(
mainGame
->
chkEnableMusic
->
isChecked
())
{
static
bool
is_playing
=
false
;
static
char
strBuffer
[
1024
];
if
(
is_playing
&&
!
engineMusic
->
isCurrentlyPlaying
(
strBuffer
))
is_playing
=
false
;
if
(
!
is_playing
)
{
int
count
=
BGMList
.
size
();
int
bgm
=
(
gameConf
.
BGM_index
>=
0
)
?
gameConf
.
BGM_index
:
rand
()
%
count
;
auto
name
=
BGMList
[
bgm
].
c_str
();
wchar_t
fname
[
256
];
myswprintf
(
fname
,
L"./sound/BGM/%ls"
,
name
);
BufferIO
::
EncodeUTF8
(
fname
,
strBuffer
);
}
if
(
!
engineMusic
->
isCurrentlyPlaying
(
strBuffer
))
{
engineMusic
->
stopAllSounds
();
engineMusic
->
play2D
(
strBuffer
,
true
);
engineMusic
->
setSoundVolume
(
gameConf
.
musicvolume
);
is_playing
=
true
;
}
}
}
void
Game
::
ShowCardInfo
(
int
code
)
{
CardData
cd
;
wchar_t
formatBuffer
[
256
];
...
...
@@ -1062,7 +1184,7 @@ void Game::ShowCardInfo(int code) {
else
myswprintf
(
formatBuffer
,
L"%ls[%08d]"
,
dataManager
.
GetName
(
code
),
code
);
stName
->
setText
(
formatBuffer
);
int
offset
=
0
;
if
(
!
mainGame
->
chkHideSetname
->
isChecked
()
)
{
if
(
!
gameConf
.
chkHideSetname
)
{
unsigned
long
long
sc
=
cd
.
setcode
;
if
(
cd
.
alias
)
{
auto
aptr
=
dataManager
.
_datas
.
find
(
cd
.
alias
);
...
...
@@ -1141,14 +1263,17 @@ void Game::AddChatMsg(wchar_t* msg, int player) {
chatMsg
[
0
].
append
(
L": "
);
break
;
case
1
:
//from client
mainGame
->
PlaySoundEffect
(
"./sound/chatmessage.wav"
);
chatMsg
[
0
].
append
(
dInfo
.
clientname
);
chatMsg
[
0
].
append
(
L": "
);
break
;
case
2
:
//host tag
mainGame
->
PlaySoundEffect
(
"./sound/chatmessage.wav"
);
chatMsg
[
0
].
append
(
dInfo
.
hostname_tag
);
chatMsg
[
0
].
append
(
L": "
);
break
;
case
3
:
//client tag
mainGame
->
PlaySoundEffect
(
"./sound/chatmessage.wav"
);
chatMsg
[
0
].
append
(
dInfo
.
clientname_tag
);
chatMsg
[
0
].
append
(
L": "
);
break
;
...
...
@@ -1157,6 +1282,7 @@ void Game::AddChatMsg(wchar_t* msg, int player) {
chatMsg
[
0
].
append
(
L": "
);
break
;
case
8
:
//system custom message, no prefix.
mainGame
->
PlaySoundEffect
(
"./sound/chatmessage.wav"
);
chatMsg
[
0
].
append
(
L"[System]: "
);
break
;
case
9
:
//error message
...
...
gframe/game.h
View file @
49669fb4
...
...
@@ -39,6 +39,11 @@ struct Config {
int
separate_clear_button
;
int
auto_search_limit
;
int
chkIgnoreDeckChanges
;
bool
enablesound
;
bool
enablemusic
;
double
soundvolume
;
double
musicvolume
;
int
BGM_index
;
};
struct
DuelInfo
{
...
...
@@ -90,6 +95,7 @@ public:
void
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshReplay
();
void
RefreshSingleplay
();
void
RefreshBGMList
();
void
DrawSelectionLine
(
irr
::
video
::
S3DVertex
*
vec
,
bool
strip
,
int
width
,
float
*
cv
);
void
DrawBackGround
();
void
DrawLinkedZones
(
ClientCard
*
pcard
);
...
...
@@ -113,6 +119,9 @@ public:
void
AddDebugMsg
(
char
*
msgbuf
);
void
ClearTextures
();
void
CloseDuelWindow
();
void
PlaySoundEffect
(
char
*
sound
);
void
PlayMusic
(
char
*
song
,
bool
loop
);
void
PlayBGM
();
int
LocalPlayer
(
int
player
);
const
wchar_t
*
LocalName
(
int
local_player
);
...
...
@@ -139,6 +148,7 @@ public:
std
::
list
<
FadingUnit
>
fadingList
;
std
::
vector
<
int
>
logParam
;
std
::
wstring
chatMsg
[
8
];
std
::
vector
<
std
::
wstring
>
BGMList
;
int
hideChatTimer
;
bool
hideChat
;
...
...
@@ -213,9 +223,13 @@ public:
irr
::
gui
::
IGUICheckBox
*
chkHideHintButton
;
irr
::
gui
::
IGUICheckBox
*
chkIgnoreDeckChanges
;
irr
::
gui
::
IGUICheckBox
*
chkAutoSearch
;
irr
::
gui
::
IGUICheckBox
*
chkEnableSound
;
irr
::
gui
::
IGUICheckBox
*
chkEnableMusic
;
irr
::
gui
::
IGUIListBox
*
lstLog
;
irr
::
gui
::
IGUIButton
*
btnClearLog
;
irr
::
gui
::
IGUIButton
*
btnSaveLog
;
irr
::
gui
::
IGUIScrollBar
*
srcSoundVolume
;
irr
::
gui
::
IGUIScrollBar
*
srcMusicVolume
;
//main menu
irr
::
gui
::
IGUIWindow
*
wMainMenu
;
irr
::
gui
::
IGUIButton
*
btnLanMode
;
...
...
@@ -420,6 +434,10 @@ public:
irr
::
gui
::
IGUIButton
*
btnChainWhenAvail
;
//cancel or finish
irr
::
gui
::
IGUIButton
*
btnCancelOrFinish
;
//soundEngine
irrklang
::
ISoundEngine
*
engineSound
;
irrklang
::
ISoundEngine
*
engineMusic
;
};
extern
Game
*
mainGame
;
...
...
@@ -552,6 +570,10 @@ extern Game* mainGame;
#define BUTTON_LOAD_SINGLEPLAY 351
#define BUTTON_CANCEL_SINGLEPLAY 352
#define CHECKBOX_AUTO_SEARCH 360
#define CHECKBOX_ENABLE_SOUND 361
#define CHECKBOX_ENABLE_MUSIC 362
#define SCROLL_VOLUME 363
#define COMBOBOX_SORTTYPE 370
#define BUTTON_MARKS_FILTER 380
...
...
gframe/premake4.lua
View file @
49669fb4
...
...
@@ -6,12 +6,13 @@ project "ygopro"
files
{
"**.cpp"
,
"**.cc"
,
"**.c"
,
"**.h"
}
excludes
"lzma/**"
includedirs
{
"../ocgcore"
}
links
{
"ocgcore"
,
"clzma"
,
"Irrlicht"
,
"freetype"
,
"sqlite3"
,
"lua"
,
"event"
}
links
{
"ocgcore"
,
"clzma"
,
"Irrlicht"
,
"freetype"
,
"sqlite3"
,
"lua"
,
"event"
,
"irrKlang"
}
configuration
"windows"
files
"ygopro.rc"
excludes
"CGUIButton.cpp"
includedirs
{
"../irrlicht/include"
,
"../freetype/include"
,
"../event/include"
,
"../sqlite3"
}
includedirs
{
"../irrlicht/include"
,
"../freetype/include"
,
"../event/include"
,
"../sqlite3"
,
"../irrklang/include"
}
libdirs
{
"../irrklang/lib/Win32-visualStudio"
}
links
{
"opengl32"
,
"ws2_32"
,
"winmm"
,
"gdi32"
,
"kernel32"
,
"user32"
,
"imm32"
}
configuration
{
"windows"
,
"not vs*"
}
includedirs
{
"/mingw/include/irrlicht"
,
"/mingw/include/freetype2"
}
...
...
strings.conf
View file @
49669fb4
...
...
@@ -366,6 +366,8 @@
!
system
1372
守备↑
!
system
1373
名称↓
!
system
1374
连接标记
!
system
1380
开启音效
!
system
1381
开启音乐
!
system
1390
等待行动中...
!
system
1391
等待行动中....
!
system
1392
等待行动中.....
...
...
system.conf
View file @
49669fb4
...
...
@@ -27,3 +27,11 @@ separate_clear_button = 1
#auto_search_limit >= 0: Start search automatically when the user enters N chars.
auto_search_limit
= -
1
prompt_to_discard_deck_changes
=
1
enable_sound
=
1
enable_music
=
1
#Volume of sound and music, between 0 and 100
soundvolume
=
50
musicvolume
=
50
#playing the music corresponding to the sequence(start from 0) under folder /BGM
#-1 means playing one of them randomly
BGM_index
= -
1
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