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
95217ec7
Commit
95217ec7
authored
Dec 15, 2017
by
mercury233
Committed by
nanahira
Dec 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge_sound
parent
96f5a368
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
402 additions
and
351 deletions
+402
-351
gframe/client_field.cpp
gframe/client_field.cpp
+0
-2
gframe/config.h
gframe/config.h
+0
-6
gframe/deck_con.cpp
gframe/deck_con.cpp
+8
-11
gframe/drawing.cpp
gframe/drawing.cpp
+2
-0
gframe/duelclient.cpp
gframe/duelclient.cpp
+31
-43
gframe/event_handler.cpp
gframe/event_handler.cpp
+28
-29
gframe/game.cpp
gframe/game.cpp
+24
-240
gframe/game.h
gframe/game.h
+0
-15
gframe/menu_handler.cpp
gframe/menu_handler.cpp
+3
-2
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+0
-1
gframe/single_mode.cpp
gframe/single_mode.cpp
+0
-2
gframe/sound_manager.cpp
gframe/sound_manager.cpp
+264
-0
gframe/sound_manager.h
gframe/sound_manager.h
+42
-0
No files found.
gframe/client_field.cpp
View file @
95217ec7
...
@@ -1038,7 +1038,6 @@ bool ClientField::ShowSelectSum(bool panelmode) {
...
@@ -1038,7 +1038,6 @@ bool ClientField::ShowSelectSum(bool panelmode) {
BufferIO
::
CopyWStrRef
(
dataManager
.
GetSysString
(
210
),
pwbuf
,
256
);
BufferIO
::
CopyWStrRef
(
dataManager
.
GetSysString
(
210
),
pwbuf
,
256
);
mainGame
->
stQMessage
->
setText
(
wbuf
);
mainGame
->
stQMessage
->
setText
(
wbuf
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PlaySoundEffect
(
SOUND_QUESTION
);
}
}
}
else
{
}
else
{
select_ready
=
false
;
select_ready
=
false
;
...
@@ -1060,7 +1059,6 @@ bool ClientField::ShowSelectSum(bool panelmode) {
...
@@ -1060,7 +1059,6 @@ bool ClientField::ShowSelectSum(bool panelmode) {
BufferIO
::
CopyWStrRef
(
dataManager
.
GetSysString
(
210
),
pwbuf
,
256
);
BufferIO
::
CopyWStrRef
(
dataManager
.
GetSysString
(
210
),
pwbuf
,
256
);
mainGame
->
stQMessage
->
setText
(
wbuf
);
mainGame
->
stQMessage
->
setText
(
wbuf
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PlaySoundEffect
(
SOUND_QUESTION
);
}
}
}
else
}
else
select_ready
=
false
;
select_ready
=
false
;
...
...
gframe/config.h
View file @
95217ec7
...
@@ -48,12 +48,6 @@ inline int _wtoi(const wchar_t * s) {
...
@@ -48,12 +48,6 @@ inline int _wtoi(const wchar_t * s) {
#endif
#endif
#include <irrlicht.h>
#include <irrlicht.h>
#ifdef YGOPRO_USE_IRRKLANG
#include <irrKlang.h>
#ifdef YGOPRO_USE_IKPMP3
#include "../ikpMP3/ikpMP3.h"
#endif
#endif
#ifdef __APPLE__
#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <OpenGL/glu.h>
...
...
gframe/deck_con.cpp
View file @
95217ec7
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include "data_manager.h"
#include "data_manager.h"
#include "deck_manager.h"
#include "deck_manager.h"
#include "image_manager.h"
#include "image_manager.h"
#include "sound_manager.h"
#include "game.h"
#include "game.h"
#include "duelclient.h"
#include "duelclient.h"
#include <algorithm>
#include <algorithm>
...
@@ -121,13 +122,12 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -121,13 +122,12 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
break
;
switch
(
event
.
GUIEvent
.
EventType
)
{
switch
(
event
.
GUIEvent
.
EventType
)
{
case
irr
:
:
gui
::
EGET_BUTTON_CLICKED
:
{
case
irr
:
:
gui
::
EGET_BUTTON_CLICKED
:
{
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
switch
(
id
)
{
switch
(
id
)
{
case
BUTTON_CLEAR_DECK
:
{
case
BUTTON_CLEAR_DECK
:
{
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetSysString
(
1339
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetSysString
(
1339
));
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PlaySoundEffect
(
SOUND_QUESTION
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
prev_operation
=
id
;
prev_operation
=
id
;
break
;
break
;
...
@@ -184,7 +184,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -184,7 +184,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
mainGame
->
cbDBDecks
->
getItem
(
sel
),
dataManager
.
GetSysString
(
1337
));
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
mainGame
->
cbDBDecks
->
getItem
(
sel
),
dataManager
.
GetSysString
(
1337
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
textBuffer
);
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PlaySoundEffect
(
SOUND_QUESTION
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
prev_operation
=
id
;
prev_operation
=
id
;
break
;
break
;
...
@@ -194,7 +193,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -194,7 +193,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetSysString
(
1356
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetSysString
(
1356
));
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PlaySoundEffect
(
SOUND_QUESTION
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
prev_operation
=
id
;
prev_operation
=
id
;
break
;
break
;
...
@@ -358,7 +356,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -358,7 +356,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetSysString
(
1356
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetSysString
(
1356
));
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PlaySoundEffect
(
SOUND_QUESTION
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
prev_operation
=
id
;
prev_operation
=
id
;
break
;
break
;
...
@@ -516,7 +513,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -516,7 +513,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
is_starting_dragging
=
false
;
is_starting_dragging
=
false
;
if
(
!
is_draging
)
if
(
!
is_draging
)
break
;
break
;
mainGame
->
PlaySoundEffect
(
SOUND_CARD_DROP
);
soundManager
.
PlaySoundEffect
(
SOUND_CARD_DROP
);
bool
pushed
=
false
;
bool
pushed
=
false
;
if
(
hovered_pos
==
1
)
if
(
hovered_pos
==
1
)
pushed
=
push_main
(
draging_pointer
,
hovered_seq
);
pushed
=
push_main
(
draging_pointer
,
hovered_seq
);
...
@@ -546,7 +543,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -546,7 +543,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
auto
pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
auto
pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
if
(
pointer
==
dataManager
.
_datas
.
end
())
if
(
pointer
==
dataManager
.
_datas
.
end
())
break
;
break
;
mainGame
->
PlaySoundEffect
(
SOUND_CARD_DROP
);
soundManager
.
PlaySoundEffect
(
SOUND_CARD_DROP
);
if
(
hovered_pos
==
1
)
{
if
(
hovered_pos
==
1
)
{
if
(
push_side
(
pointer
))
if
(
push_side
(
pointer
))
pop_main
(
hovered_seq
);
pop_main
(
hovered_seq
);
...
@@ -564,7 +561,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -564,7 +561,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if
(
!
is_draging
)
{
if
(
!
is_draging
)
{
if
(
hovered_pos
==
0
||
hovered_seq
==
-
1
)
if
(
hovered_pos
==
0
||
hovered_seq
==
-
1
)
break
;
break
;
mainGame
->
PlaySoundEffect
(
SOUND_CARD_DROP
);
soundManager
.
PlaySoundEffect
(
SOUND_CARD_DROP
);
if
(
hovered_pos
==
1
)
{
if
(
hovered_pos
==
1
)
{
pop_main
(
hovered_seq
);
pop_main
(
hovered_seq
);
}
else
if
(
hovered_pos
==
2
)
{
}
else
if
(
hovered_pos
==
2
)
{
...
@@ -581,7 +578,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -581,7 +578,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
push_side
(
pointer
);
push_side
(
pointer
);
}
}
}
else
{
}
else
{
mainGame
->
PlaySoundEffect
(
SOUND_CARD_PICK
);
soundManager
.
PlaySoundEffect
(
SOUND_CARD_PICK
);
if
(
click_pos
==
1
)
{
if
(
click_pos
==
1
)
{
push_side
(
draging_pointer
);
push_side
(
draging_pointer
);
}
else
if
(
click_pos
==
2
)
{
}
else
if
(
click_pos
==
2
)
{
...
@@ -608,7 +605,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -608,7 +605,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
auto
pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
auto
pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
if
(
!
check_limit
(
pointer
))
if
(
!
check_limit
(
pointer
))
break
;
break
;
mainGame
->
PlaySoundEffect
(
SOUND_CARD_PICK
);
soundManager
.
PlaySoundEffect
(
SOUND_CARD_PICK
);
if
(
hovered_pos
==
1
)
{
if
(
hovered_pos
==
1
)
{
if
(
!
push_main
(
pointer
))
if
(
!
push_main
(
pointer
))
push_side
(
pointer
);
push_side
(
pointer
);
...
@@ -627,7 +624,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
...
@@ -627,7 +624,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
case
irr
:
:
EMIE_MOUSE_MOVED
:
{
case
irr
:
:
EMIE_MOUSE_MOVED
:
{
if
(
is_starting_dragging
)
{
if
(
is_starting_dragging
)
{
is_draging
=
true
;
is_draging
=
true
;
mainGame
->
PlaySoundEffect
(
SOUND_CARD_PICK
);
soundManager
.
PlaySoundEffect
(
SOUND_CARD_PICK
);
if
(
hovered_pos
==
1
)
if
(
hovered_pos
==
1
)
pop_main
(
hovered_seq
);
pop_main
(
hovered_seq
);
else
if
(
hovered_pos
==
2
)
else
if
(
hovered_pos
==
2
)
...
...
gframe/drawing.cpp
View file @
95217ec7
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#include "materials.h"
#include "materials.h"
#include "image_manager.h"
#include "image_manager.h"
#include "deck_manager.h"
#include "deck_manager.h"
#include "sound_manager.h"
#include "duelclient.h"
#include "duelclient.h"
#include "../ocgcore/field.h"
#include "../ocgcore/field.h"
...
@@ -1008,6 +1009,7 @@ void Game::HideElement(irr::gui::IGUIElement * win, bool set_action) {
...
@@ -1008,6 +1009,7 @@ void Game::HideElement(irr::gui::IGUIElement * win, bool set_action) {
fadingList
.
push_back
(
fu
);
fadingList
.
push_back
(
fu
);
}
}
void
Game
::
PopupElement
(
irr
::
gui
::
IGUIElement
*
element
,
int
hideframe
)
{
void
Game
::
PopupElement
(
irr
::
gui
::
IGUIElement
*
element
,
int
hideframe
)
{
soundManager
.
PlayDialogSound
(
element
);
element
->
getParent
()
->
bringToFront
(
element
);
element
->
getParent
()
->
bringToFront
(
element
);
if
(
!
mainGame
->
is_building
)
if
(
!
mainGame
->
is_building
)
dField
.
panel
=
element
;
dField
.
panel
=
element
;
...
...
gframe/duelclient.cpp
View file @
95217ec7
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#include "client_card.h"
#include "client_card.h"
#include "materials.h"
#include "materials.h"
#include "image_manager.h"
#include "image_manager.h"
#include "sound_manager.h"
#include "single_mode.h"
#include "single_mode.h"
#include "../ocgcore/field.h"
#include "../ocgcore/field.h"
#include "../ocgcore/duel.h"
#include "../ocgcore/duel.h"
...
@@ -656,7 +657,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
...
@@ -656,7 +657,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
btnCancelOrFinish
->
setVisible
(
false
);
mainGame
->
btnCancelOrFinish
->
setVisible
(
false
);
mainGame
->
stMessage
->
setText
(
dataManager
.
GetSysString
(
1500
));
mainGame
->
stMessage
->
setText
(
dataManager
.
GetSysString
(
1500
));
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Wait
();
mainGame
->
actionSignal
.
Wait
();
...
@@ -704,7 +704,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
...
@@ -704,7 +704,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mbstowcs
(
timetext
,
timebuf
,
size
);
mbstowcs
(
timetext
,
timebuf
,
size
);
mainGame
->
ebRSName
->
setText
(
timetext
);
mainGame
->
ebRSName
->
setText
(
timetext
);
mainGame
->
PopupElement
(
mainGame
->
wReplaySave
);
mainGame
->
PopupElement
(
mainGame
->
wReplaySave
);
mainGame
->
PlaySoundEffect
(
SOUND_QUESTION
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
mainGame
->
replaySignal
.
Reset
();
mainGame
->
replaySignal
.
Reset
();
mainGame
->
replaySignal
.
Wait
();
mainGame
->
replaySignal
.
Wait
();
...
@@ -771,7 +770,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
...
@@ -771,7 +770,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break
;
break
;
}
}
case
STOC_HS_PLAYER_ENTER
:
{
case
STOC_HS_PLAYER_ENTER
:
{
mainGame
->
PlaySoundEffect
(
SOUND_PLAYER_ENTER
);
soundManager
.
PlaySoundEffect
(
SOUND_PLAYER_ENTER
);
STOC_HS_PlayerEnter
*
pkt
=
(
STOC_HS_PlayerEnter
*
)
pdata
;
STOC_HS_PlayerEnter
*
pkt
=
(
STOC_HS_PlayerEnter
*
)
pdata
;
if
(
pkt
->
pos
>
3
)
if
(
pkt
->
pos
>
3
)
break
;
break
;
...
@@ -806,7 +805,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
...
@@ -806,7 +805,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break
;
break
;
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
if
(
state
<
8
)
{
if
(
state
<
8
)
{
mainGame
->
PlaySoundEffect
(
SOUND_PLAYER_ENTER
);
soundManager
.
PlaySoundEffect
(
SOUND_PLAYER_ENTER
);
wchar_t
*
prename
=
(
wchar_t
*
)
mainGame
->
stHostPrepDuelist
[
pos
]
->
getText
();
wchar_t
*
prename
=
(
wchar_t
*
)
mainGame
->
stHostPrepDuelist
[
pos
]
->
getText
();
mainGame
->
stHostPrepDuelist
[
state
]
->
setText
(
prename
);
mainGame
->
stHostPrepDuelist
[
state
]
->
setText
(
prename
);
mainGame
->
stHostPrepDuelist
[
pos
]
->
setText
(
L""
);
mainGame
->
stHostPrepDuelist
[
pos
]
->
setText
(
L""
);
...
@@ -891,7 +890,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -891,7 +890,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
stMessage
->
setText
(
L"Error occurs."
);
mainGame
->
stMessage
->
setText
(
L"Error occurs."
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Wait
();
mainGame
->
actionSignal
.
Wait
();
...
@@ -933,7 +931,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -933,7 +931,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
stMessage
->
setText
(
dataManager
.
GetDesc
(
data
));
mainGame
->
stMessage
->
setText
(
dataManager
.
GetDesc
(
data
));
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Wait
();
mainGame
->
actionSignal
.
Wait
();
...
@@ -1317,7 +1314,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -1317,7 +1314,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
textBuffer
);
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PlaySoundEffect
(
SOUND_QUESTION
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
return
false
;
return
false
;
}
}
...
@@ -1328,7 +1324,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -1328,7 +1324,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetDesc
(
desc
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
dataManager
.
GetDesc
(
desc
));
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PlaySoundEffect
(
SOUND_QUESTION
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
return
false
;
return
false
;
}
}
...
@@ -1352,7 +1347,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -1352,7 +1347,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
select_hint
=
0
;
select_hint
=
0
;
mainGame
->
wOptions
->
setText
(
textBuffer
);
mainGame
->
wOptions
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wOptions
);
mainGame
->
PopupElement
(
mainGame
->
wOptions
);
mainGame
->
PlaySoundEffect
(
SOUND_QUESTION
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
return
false
;
return
false
;
}
}
...
@@ -1497,7 +1491,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -1497,7 +1491,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
event_string
,
dataManager
.
GetSysString
(
203
));
myswprintf
(
textBuffer
,
L"%ls
\n
%ls"
,
event_string
,
dataManager
.
GetSysString
(
203
));
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
textBuffer
);
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
310
,
mainGame
->
textFont
,
(
wchar_t
*
)
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PlaySoundEffect
(
SOUND_QUESTION
);
}
}
}
}
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
...
@@ -1793,7 +1786,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -1793,7 +1786,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
}
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
return
true
;
mainGame
->
PlaySoundEffect
(
SOUND_REVEAL
);
soundManager
.
PlaySoundEffect
(
SOUND_REVEAL
);
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
207
),
count
);
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
207
),
count
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
logParam
.
push_back
(
0
);
mainGame
->
logParam
.
push_back
(
0
);
...
@@ -1829,7 +1822,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -1829,7 +1822,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pbuf
+=
count
*
7
;
pbuf
+=
count
*
7
;
return
true
;
return
true
;
}
}
mainGame
->
PlaySoundEffect
(
SOUND_REVEAL
);
soundManager
.
PlaySoundEffect
(
SOUND_REVEAL
);
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
208
),
count
);
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
208
),
count
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
logParam
.
push_back
(
0
);
mainGame
->
logParam
.
push_back
(
0
);
...
@@ -1938,7 +1931,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -1938,7 +1931,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
dField
.
deck
[
player
][
i
]
->
is_reversed
=
false
;
mainGame
->
dField
.
deck
[
player
][
i
]
->
is_reversed
=
false
;
}
}
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
PlaySoundEffect
(
SOUND_SHUFFLE
);
soundManager
.
PlaySoundEffect
(
SOUND_SHUFFLE
);
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
for
(
auto
cit
=
mainGame
->
dField
.
deck
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
deck
[
player
].
end
();
++
cit
)
{
for
(
auto
cit
=
mainGame
->
dField
.
deck
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
deck
[
player
].
end
();
++
cit
)
{
(
*
cit
)
->
dPos
=
irr
::
core
::
vector3df
(
rand
()
*
0.4
f
/
RAND_MAX
-
0.2
f
,
0
,
0
);
(
*
cit
)
->
dPos
=
irr
::
core
::
vector3df
(
rand
()
*
0.4
f
/
RAND_MAX
-
0.2
f
,
0
,
0
);
...
@@ -1964,7 +1957,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -1964,7 +1957,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int
count
=
BufferIO
::
ReadInt8
(
pbuf
);
int
count
=
BufferIO
::
ReadInt8
(
pbuf
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
count
>
1
)
if
(
count
>
1
)
mainGame
->
PlaySoundEffect
(
SOUND_SHUFFLE
);
soundManager
.
PlaySoundEffect
(
SOUND_SHUFFLE
);
mainGame
->
WaitFrameSignal
(
5
);
mainGame
->
WaitFrameSignal
(
5
);
if
(
player
==
1
&&
!
mainGame
->
dInfo
.
isReplay
&&
!
mainGame
->
dInfo
.
isSingleMode
)
{
if
(
player
==
1
&&
!
mainGame
->
dInfo
.
isReplay
&&
!
mainGame
->
dInfo
.
isSingleMode
)
{
bool
flip
=
false
;
bool
flip
=
false
;
...
@@ -2108,7 +2101,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2108,7 +2101,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
}
}
}
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
PlaySoundEffect
(
SOUND_SHUFFLE
);
soundManager
.
PlaySoundEffect
(
SOUND_SHUFFLE
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
mainGame
->
dField
.
MoveCard
(
mc
[
i
],
10
);
mainGame
->
dField
.
MoveCard
(
mc
[
i
],
10
);
for
(
cit
=
mc
[
i
]
->
overlayed
.
begin
();
cit
!=
mc
[
i
]
->
overlayed
.
end
();
++
cit
)
for
(
cit
=
mc
[
i
]
->
overlayed
.
begin
();
cit
!=
mc
[
i
]
->
overlayed
.
end
();
++
cit
)
...
@@ -2145,7 +2138,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2145,7 +2138,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
dInfo
.
tag_player
[
1
]
=
!
mainGame
->
dInfo
.
tag_player
[
1
];
mainGame
->
dInfo
.
tag_player
[
1
]
=
!
mainGame
->
dInfo
.
tag_player
[
1
];
}
}
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
PlaySoundEffect
(
SOUND_NEXT_TURN
);
soundManager
.
PlaySoundEffect
(
SOUND_NEXT_TURN
);
mainGame
->
showcardcode
=
10
;
mainGame
->
showcardcode
=
10
;
mainGame
->
showcarddif
=
30
;
mainGame
->
showcarddif
=
30
;
mainGame
->
showcardp
=
0
;
mainGame
->
showcardp
=
0
;
...
@@ -2193,7 +2186,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2193,7 +2186,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
btnPhaseStatus
->
setPressed
(
true
);
mainGame
->
btnPhaseStatus
->
setPressed
(
true
);
mainGame
->
btnPhaseStatus
->
setVisible
(
true
);
mainGame
->
btnPhaseStatus
->
setVisible
(
true
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
PlaySoundEffect
(
SOUND_PHASE
);
soundManager
.
PlaySoundEffect
(
SOUND_PHASE
);
mainGame
->
showcard
=
101
;
mainGame
->
showcard
=
101
;
mainGame
->
WaitFrameSignal
(
40
);
mainGame
->
WaitFrameSignal
(
40
);
mainGame
->
showcard
=
0
;
mainGame
->
showcard
=
0
;
...
@@ -2213,9 +2206,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2213,9 +2206,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int
reason
=
BufferIO
::
ReadInt32
(
pbuf
);
int
reason
=
BufferIO
::
ReadInt32
(
pbuf
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
cl
&
LOCATION_REMOVED
&&
pl
!=
cl
)
if
(
cl
&
LOCATION_REMOVED
&&
pl
!=
cl
)
mainGame
->
PlaySoundEffect
(
SOUND_BANISHED
);
soundManager
.
PlaySoundEffect
(
SOUND_BANISHED
);
else
if
(
reason
&
REASON_DESTROY
&&
pl
!=
cl
)
else
if
(
reason
&
REASON_DESTROY
&&
pl
!=
cl
)
mainGame
->
PlaySoundEffect
(
SOUND_DESTROYED
);
soundManager
.
PlaySoundEffect
(
SOUND_DESTROYED
);
}
}
if
(
pl
==
0
)
{
if
(
pl
==
0
)
{
ClientCard
*
pcard
=
new
ClientCard
();
ClientCard
*
pcard
=
new
ClientCard
();
...
@@ -2438,7 +2431,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2438,7 +2431,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
/*int cs = */
BufferIO
::
ReadInt8
(
pbuf
);
/*int cs = */
BufferIO
::
ReadInt8
(
pbuf
);
/*int cp = */
BufferIO
::
ReadInt8
(
pbuf
);
/*int cp = */
BufferIO
::
ReadInt8
(
pbuf
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
mainGame
->
PlaySoundEffect
(
SOUND_SET
);
soundManager
.
PlaySoundEffect
(
SOUND_SET
);
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1601
));
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1601
));
return
true
;
return
true
;
}
}
...
@@ -2492,7 +2485,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2492,7 +2485,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
/*int cs = */
BufferIO
::
ReadInt8
(
pbuf
);
/*int cs = */
BufferIO
::
ReadInt8
(
pbuf
);
/*int cp = */
BufferIO
::
ReadInt8
(
pbuf
);
/*int cp = */
BufferIO
::
ReadInt8
(
pbuf
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
PlaySoundEffect
(
SOUND_SUMMON
);
soundManager
.
PlaySoundEffect
(
SOUND_SUMMON
);
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1603
),
dataManager
.
GetName
(
code
));
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1603
),
dataManager
.
GetName
(
code
));
mainGame
->
showcardcode
=
code
;
mainGame
->
showcardcode
=
code
;
mainGame
->
showcarddif
=
0
;
mainGame
->
showcarddif
=
0
;
...
@@ -2517,9 +2510,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2517,9 +2510,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
CardData
cd
;
CardData
cd
;
if
(
dataManager
.
GetData
(
code
,
&
cd
)
&&
(
cd
.
type
&
TYPE_TOKEN
))
if
(
dataManager
.
GetData
(
code
,
&
cd
)
&&
(
cd
.
type
&
TYPE_TOKEN
))
mainGame
->
PlaySoundEffect
(
SOUND_TOKEN
);
soundManager
.
PlaySoundEffect
(
SOUND_TOKEN
);
else
else
mainGame
->
PlaySoundEffect
(
SOUND_SPECIAL_SUMMON
);
soundManager
.
PlaySoundEffect
(
SOUND_SPECIAL_SUMMON
);
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1605
),
dataManager
.
GetName
(
code
));
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1605
),
dataManager
.
GetName
(
code
));
mainGame
->
showcardcode
=
code
;
mainGame
->
showcardcode
=
code
;
mainGame
->
showcarddif
=
1
;
mainGame
->
showcarddif
=
1
;
...
@@ -2544,7 +2537,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2544,7 +2537,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard
->
SetCode
(
code
);
pcard
->
SetCode
(
code
);
pcard
->
position
=
cp
;
pcard
->
position
=
cp
;
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
PlaySoundEffect
(
SOUND_FILP
);
soundManager
.
PlaySoundEffect
(
SOUND_FILP
);
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1607
),
dataManager
.
GetName
(
code
));
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1607
),
dataManager
.
GetName
(
code
));
mainGame
->
dField
.
MoveCard
(
pcard
,
10
);
mainGame
->
dField
.
MoveCard
(
pcard
,
10
);
mainGame
->
WaitFrameSignal
(
11
);
mainGame
->
WaitFrameSignal
(
11
);
...
@@ -2575,7 +2568,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2575,7 +2568,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
/*int ct = */
BufferIO
::
ReadInt8
(
pbuf
);
/*int ct = */
BufferIO
::
ReadInt8
(
pbuf
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
return
true
;
mainGame
->
PlaySoundEffect
(
SOUND_ACTIVATE
);
soundManager
.
PlaySoundEffect
(
SOUND_ACTIVATE
);
ClientCard
*
pcard
=
mainGame
->
dField
.
GetCard
(
pcc
,
pcl
,
pcs
,
subs
);
ClientCard
*
pcard
=
mainGame
->
dField
.
GetCard
(
pcc
,
pcl
,
pcs
,
subs
);
if
(
pcard
->
code
!=
code
)
{
if
(
pcard
->
code
!=
code
)
{
pcard
->
code
=
code
;
pcard
->
code
=
code
;
...
@@ -2677,7 +2670,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2677,7 +2670,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pbuf
+=
count
*
4
;
pbuf
+=
count
*
4
;
return
true
;
return
true
;
}
}
mainGame
->
PlaySoundEffect
(
SOUND_DICE
);
soundManager
.
PlaySoundEffect
(
SOUND_DICE
);
ClientCard
*
pcards
[
10
];
ClientCard
*
pcards
[
10
];
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
...
@@ -2696,7 +2689,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2696,7 +2689,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
return
true
;
}
}
case
MSG_BECOME_TARGET
:
{
case
MSG_BECOME_TARGET
:
{
//
mainGame->
PlaySoundEffect(SOUND_TARGET);
//
soundManager.
PlaySoundEffect(SOUND_TARGET);
int
count
=
BufferIO
::
ReadInt8
(
pbuf
);
int
count
=
BufferIO
::
ReadInt8
(
pbuf
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
{
pbuf
+=
count
*
4
;
pbuf
+=
count
*
4
;
...
@@ -2744,7 +2737,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2744,7 +2737,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
}
}
else
{
}
else
{
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
mainGame
->
PlaySoundEffect
(
SOUND_DRAW
);
soundManager
.
PlaySoundEffect
(
SOUND_DRAW
);
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
pcard
=
mainGame
->
dField
.
GetCard
(
player
,
LOCATION_DECK
,
mainGame
->
dField
.
deck
[
player
].
size
()
-
1
);
pcard
=
mainGame
->
dField
.
GetCard
(
player
,
LOCATION_DECK
,
mainGame
->
dField
.
deck
[
player
].
size
()
-
1
);
mainGame
->
dField
.
deck
[
player
].
erase
(
mainGame
->
dField
.
deck
[
player
].
end
()
-
1
);
mainGame
->
dField
.
deck
[
player
].
erase
(
mainGame
->
dField
.
deck
[
player
].
end
()
-
1
);
...
@@ -2771,7 +2764,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2771,7 +2764,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
return
true
;
return
true
;
}
}
mainGame
->
PlaySoundEffect
(
SOUND_DAMAGE
);
soundManager
.
PlaySoundEffect
(
SOUND_DAMAGE
);
mainGame
->
lpd
=
(
mainGame
->
dInfo
.
lp
[
player
]
-
final
)
/
10
;
mainGame
->
lpd
=
(
mainGame
->
dInfo
.
lp
[
player
]
-
final
)
/
10
;
if
(
player
==
0
)
if
(
player
==
0
)
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1613
),
val
);
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1613
),
val
);
...
@@ -2800,7 +2793,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2800,7 +2793,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
return
true
;
return
true
;
}
}
mainGame
->
PlaySoundEffect
(
SOUND_RECOVER
);
soundManager
.
PlaySoundEffect
(
SOUND_RECOVER
);
mainGame
->
lpd
=
(
mainGame
->
dInfo
.
lp
[
player
]
-
final
)
/
10
;
mainGame
->
lpd
=
(
mainGame
->
dInfo
.
lp
[
player
]
-
final
)
/
10
;
if
(
player
==
0
)
if
(
player
==
0
)
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1615
),
val
);
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1615
),
val
);
...
@@ -2837,7 +2830,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2837,7 +2830,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pc1
->
equipTarget
=
pc2
;
pc1
->
equipTarget
=
pc2
;
pc2
->
equipped
.
insert
(
pc1
);
pc2
->
equipped
.
insert
(
pc1
);
}
else
{
}
else
{
mainGame
->
PlaySoundEffect
(
SOUND_EQUIP
);
soundManager
.
PlaySoundEffect
(
SOUND_EQUIP
);
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
if
(
pc1
->
equipTarget
)
{
if
(
pc1
->
equipTarget
)
{
pc1
->
is_showequip
=
false
;
pc1
->
is_showequip
=
false
;
...
@@ -2956,7 +2949,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2956,7 +2949,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
myswprintf
(
mainGame
->
dInfo
.
strLP
[
player
],
L"%d"
,
mainGame
->
dInfo
.
lp
[
player
]);
return
true
;
return
true
;
}
}
mainGame
->
PlaySoundEffect
(
SOUND_DAMAGE
);
soundManager
.
PlaySoundEffect
(
SOUND_DAMAGE
);
mainGame
->
lpd
=
(
mainGame
->
dInfo
.
lp
[
player
]
-
final
)
/
10
;
mainGame
->
lpd
=
(
mainGame
->
dInfo
.
lp
[
player
]
-
final
)
/
10
;
mainGame
->
lpccolor
=
0xff0000ff
;
mainGame
->
lpccolor
=
0xff0000ff
;
mainGame
->
lpplayer
=
player
;
mainGame
->
lpplayer
=
player
;
...
@@ -2984,7 +2977,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -2984,7 +2977,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
else
pc
->
counters
[
type
]
=
count
;
else
pc
->
counters
[
type
]
=
count
;
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
return
true
;
mainGame
->
PlaySoundEffect
(
SOUND_COUNTER_ADD
);
soundManager
.
PlaySoundEffect
(
SOUND_COUNTER_ADD
);
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
1617
),
dataManager
.
GetName
(
pc
->
code
),
count
,
dataManager
.
GetCounterName
(
type
));
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
1617
),
dataManager
.
GetName
(
pc
->
code
),
count
,
dataManager
.
GetCounterName
(
type
));
pc
->
is_highlighting
=
true
;
pc
->
is_highlighting
=
true
;
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
...
@@ -3007,7 +3000,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -3007,7 +3000,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pc
->
counters
.
erase
(
type
);
pc
->
counters
.
erase
(
type
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
return
true
;
mainGame
->
PlaySoundEffect
(
SOUND_COUNTER_REMOVE
);
soundManager
.
PlaySoundEffect
(
SOUND_COUNTER_REMOVE
);
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
1618
),
dataManager
.
GetName
(
pc
->
code
),
count
,
dataManager
.
GetCounterName
(
type
));
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
1618
),
dataManager
.
GetName
(
pc
->
code
),
count
,
dataManager
.
GetCounterName
(
type
));
pc
->
is_highlighting
=
true
;
pc
->
is_highlighting
=
true
;
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
...
@@ -3032,7 +3025,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -3032,7 +3025,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
return
true
;
float
sy
;
float
sy
;
if
(
ld
!=
0
)
{
if
(
ld
!=
0
)
{
mainGame
->
PlaySoundEffect
(
SOUND_ATTACK
);
soundManager
.
PlaySoundEffect
(
SOUND_ATTACK
);
mainGame
->
dField
.
attack_target
=
mainGame
->
dField
.
GetCard
(
cd
,
ld
,
sd
);
mainGame
->
dField
.
attack_target
=
mainGame
->
dField
.
GetCard
(
cd
,
ld
,
sd
);
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1619
),
dataManager
.
GetName
(
mainGame
->
dField
.
attacker
->
code
),
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1619
),
dataManager
.
GetName
(
mainGame
->
dField
.
attacker
->
code
),
dataManager
.
GetName
(
mainGame
->
dField
.
attack_target
->
code
));
dataManager
.
GetName
(
mainGame
->
dField
.
attack_target
->
code
));
...
@@ -3047,7 +3040,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -3047,7 +3040,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
else
else
mainGame
->
atk_r
=
vector3df
(
0
,
0
,
3.1415926
-
atan
((
xd
-
xa
)
/
(
yd
-
ya
)));
mainGame
->
atk_r
=
vector3df
(
0
,
0
,
3.1415926
-
atan
((
xd
-
xa
)
/
(
yd
-
ya
)));
}
else
{
}
else
{
mainGame
->
PlaySoundEffect
(
SOUND_DIRECT_ATTACK
);
soundManager
.
PlaySoundEffect
(
SOUND_DIRECT_ATTACK
);
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1620
),
dataManager
.
GetName
(
mainGame
->
dField
.
attacker
->
code
));
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1620
),
dataManager
.
GetName
(
mainGame
->
dField
.
attacker
->
code
));
float
xa
=
mainGame
->
dField
.
attacker
->
curPos
.
X
;
float
xa
=
mainGame
->
dField
.
attacker
->
curPos
.
X
;
float
ya
=
mainGame
->
dField
.
attacker
->
curPos
.
Y
;
float
ya
=
mainGame
->
dField
.
attacker
->
curPos
.
Y
;
...
@@ -3142,7 +3135,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -3142,7 +3135,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
*
pwbuf
=
0
;
*
pwbuf
=
0
;
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
return
true
;
mainGame
->
PlaySoundEffect
(
SOUND_COIN
);
soundManager
.
PlaySoundEffect
(
SOUND_COIN
);
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
logParam
.
push_back
(
0
);
mainGame
->
logParam
.
push_back
(
0
);
...
@@ -3166,7 +3159,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -3166,7 +3159,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
*
pwbuf
=
0
;
*
pwbuf
=
0
;
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
return
true
;
mainGame
->
PlaySoundEffect
(
SOUND_DICE
);
soundManager
.
PlaySoundEffect
(
SOUND_DICE
);
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
lstLog
->
addItem
(
textBuffer
);
mainGame
->
logParam
.
push_back
(
0
);
mainGame
->
logParam
.
push_back
(
0
);
...
@@ -3219,7 +3212,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -3219,7 +3212,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
wANRace
->
setText
(
textBuffer
);
mainGame
->
wANRace
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wANRace
);
mainGame
->
PopupElement
(
mainGame
->
wANRace
);
mainGame
->
PlaySoundEffect
(
SOUND_QUESTION
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
return
false
;
return
false
;
}
}
...
@@ -3240,7 +3232,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -3240,7 +3232,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
wANAttribute
->
setText
(
textBuffer
);
mainGame
->
wANAttribute
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wANAttribute
);
mainGame
->
PopupElement
(
mainGame
->
wANAttribute
);
mainGame
->
PlaySoundEffect
(
SOUND_QUESTION
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
return
false
;
return
false
;
}
}
...
@@ -3257,7 +3248,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -3257,7 +3248,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
wANCard
->
setText
(
textBuffer
);
mainGame
->
wANCard
->
setText
(
textBuffer
);
mainGame
->
dField
.
UpdateDeclarableCode
(
true
);
mainGame
->
dField
.
UpdateDeclarableCode
(
true
);
mainGame
->
PopupElement
(
mainGame
->
wANCard
);
mainGame
->
PopupElement
(
mainGame
->
wANCard
);
mainGame
->
PlaySoundEffect
(
SOUND_QUESTION
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
return
false
;
return
false
;
}
}
...
@@ -3278,7 +3268,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -3278,7 +3268,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
select_hint
=
0
;
select_hint
=
0
;
mainGame
->
wANNumber
->
setText
(
textBuffer
);
mainGame
->
wANNumber
->
setText
(
textBuffer
);
mainGame
->
PopupElement
(
mainGame
->
wANNumber
);
mainGame
->
PopupElement
(
mainGame
->
wANNumber
);
mainGame
->
PlaySoundEffect
(
SOUND_QUESTION
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
return
false
;
return
false
;
}
}
...
@@ -3298,7 +3287,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -3298,7 +3287,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
wANCard
->
setText
(
textBuffer
);
mainGame
->
wANCard
->
setText
(
textBuffer
);
mainGame
->
dField
.
UpdateDeclarableCode
(
true
);
mainGame
->
dField
.
UpdateDeclarableCode
(
true
);
mainGame
->
PopupElement
(
mainGame
->
wANCard
);
mainGame
->
PopupElement
(
mainGame
->
wANCard
);
mainGame
->
PlaySoundEffect
(
SOUND_QUESTION
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
return
false
;
return
false
;
}
}
...
...
gframe/event_handler.cpp
View file @
95217ec7
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#include "duelclient.h"
#include "duelclient.h"
#include "data_manager.h"
#include "data_manager.h"
#include "image_manager.h"
#include "image_manager.h"
#include "sound_manager.h"
#include "replay_mode.h"
#include "replay_mode.h"
#include "single_mode.h"
#include "single_mode.h"
#include "materials.h"
#include "materials.h"
...
@@ -40,7 +41,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -40,7 +41,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
}
case
BUTTON_FIRST
:
case
BUTTON_FIRST
:
case
BUTTON_SECOND
:
{
case
BUTTON_SECOND
:
{
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
mainGame
->
HideElement
(
mainGame
->
wFTSelect
);
mainGame
->
HideElement
(
mainGame
->
wFTSelect
);
CTOS_TPResult
cstr
;
CTOS_TPResult
cstr
;
cstr
.
res
=
BUTTON_SECOND
-
id
;
cstr
.
res
=
BUTTON_SECOND
-
id
;
...
@@ -50,7 +51,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -50,7 +51,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case
BUTTON_REPLAY_START
:
{
case
BUTTON_REPLAY_START
:
{
if
(
!
mainGame
->
dInfo
.
isReplay
)
if
(
!
mainGame
->
dInfo
.
isReplay
)
break
;
break
;
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
mainGame
->
btnReplayStart
->
setVisible
(
false
);
mainGame
->
btnReplayStart
->
setVisible
(
false
);
mainGame
->
btnReplayPause
->
setVisible
(
true
);
mainGame
->
btnReplayPause
->
setVisible
(
true
);
mainGame
->
btnReplayStep
->
setVisible
(
false
);
mainGame
->
btnReplayStep
->
setVisible
(
false
);
...
@@ -61,7 +62,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -61,7 +62,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case
BUTTON_REPLAY_PAUSE
:
{
case
BUTTON_REPLAY_PAUSE
:
{
if
(
!
mainGame
->
dInfo
.
isReplay
)
if
(
!
mainGame
->
dInfo
.
isReplay
)
break
;
break
;
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
mainGame
->
btnReplayStart
->
setVisible
(
true
);
mainGame
->
btnReplayStart
->
setVisible
(
true
);
mainGame
->
btnReplayPause
->
setVisible
(
false
);
mainGame
->
btnReplayPause
->
setVisible
(
false
);
mainGame
->
btnReplayStep
->
setVisible
(
true
);
mainGame
->
btnReplayStep
->
setVisible
(
true
);
...
@@ -72,19 +73,19 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -72,19 +73,19 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case
BUTTON_REPLAY_STEP
:
{
case
BUTTON_REPLAY_STEP
:
{
if
(
!
mainGame
->
dInfo
.
isReplay
)
if
(
!
mainGame
->
dInfo
.
isReplay
)
break
;
break
;
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
ReplayMode
::
Pause
(
false
,
true
);
ReplayMode
::
Pause
(
false
,
true
);
break
;
break
;
}
}
case
BUTTON_REPLAY_EXIT
:
{
case
BUTTON_REPLAY_EXIT
:
{
if
(
!
mainGame
->
dInfo
.
isReplay
)
if
(
!
mainGame
->
dInfo
.
isReplay
)
break
;
break
;
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
ReplayMode
::
StopReplay
();
ReplayMode
::
StopReplay
();
break
;
break
;
}
}
case
BUTTON_REPLAY_SWAP
:
{
case
BUTTON_REPLAY_SWAP
:
{
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
if
(
mainGame
->
dInfo
.
isReplay
)
if
(
mainGame
->
dInfo
.
isReplay
)
ReplayMode
::
SwapField
();
ReplayMode
::
SwapField
();
else
if
(
mainGame
->
dInfo
.
player_type
==
7
)
else
if
(
mainGame
->
dInfo
.
player_type
==
7
)
...
@@ -94,28 +95,28 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -94,28 +95,28 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case
BUTTON_REPLAY_UNDO
:
{
case
BUTTON_REPLAY_UNDO
:
{
if
(
!
mainGame
->
dInfo
.
isReplay
)
if
(
!
mainGame
->
dInfo
.
isReplay
)
break
;
break
;
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
ReplayMode
::
Undo
();
ReplayMode
::
Undo
();
break
;
break
;
}
}
case
BUTTON_REPLAY_SAVE
:
{
case
BUTTON_REPLAY_SAVE
:
{
if
(
mainGame
->
ebRSName
->
getText
()[
0
]
==
0
)
if
(
mainGame
->
ebRSName
->
getText
()[
0
]
==
0
)
break
;
break
;
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
mainGame
->
actionParam
=
1
;
mainGame
->
actionParam
=
1
;
mainGame
->
HideElement
(
mainGame
->
wReplaySave
);
mainGame
->
HideElement
(
mainGame
->
wReplaySave
);
mainGame
->
replaySignal
.
Set
();
mainGame
->
replaySignal
.
Set
();
break
;
break
;
}
}
case
BUTTON_REPLAY_CANCEL
:
{
case
BUTTON_REPLAY_CANCEL
:
{
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
mainGame
->
actionParam
=
0
;
mainGame
->
actionParam
=
0
;
mainGame
->
HideElement
(
mainGame
->
wReplaySave
);
mainGame
->
HideElement
(
mainGame
->
wReplaySave
);
mainGame
->
replaySignal
.
Set
();
mainGame
->
replaySignal
.
Set
();
break
;
break
;
}
}
case
BUTTON_LEAVE_GAME
:
{
case
BUTTON_LEAVE_GAME
:
{
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
if
(
mainGame
->
dInfo
.
isSingleMode
)
{
if
(
mainGame
->
dInfo
.
isSingleMode
)
{
mainGame
->
singleSignal
.
SetNoWait
(
true
);
mainGame
->
singleSignal
.
SetNoWait
(
true
);
SingleMode
::
StopPlay
(
false
);
SingleMode
::
StopPlay
(
false
);
...
@@ -148,7 +149,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -148,7 +149,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
BUTTON_CHAIN_IGNORE
:
{
case
BUTTON_CHAIN_IGNORE
:
{
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
mainGame
->
ignore_chain
=
mainGame
->
btnChainIgnore
->
isPressed
();
mainGame
->
ignore_chain
=
mainGame
->
btnChainIgnore
->
isPressed
();
mainGame
->
always_chain
=
false
;
mainGame
->
always_chain
=
false
;
mainGame
->
chain_when_avail
=
false
;
mainGame
->
chain_when_avail
=
false
;
...
@@ -156,7 +157,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -156,7 +157,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
BUTTON_CHAIN_ALWAYS
:
{
case
BUTTON_CHAIN_ALWAYS
:
{
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
mainGame
->
always_chain
=
mainGame
->
btnChainAlways
->
isPressed
();
mainGame
->
always_chain
=
mainGame
->
btnChainAlways
->
isPressed
();
mainGame
->
ignore_chain
=
false
;
mainGame
->
ignore_chain
=
false
;
mainGame
->
chain_when_avail
=
false
;
mainGame
->
chain_when_avail
=
false
;
...
@@ -164,7 +165,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -164,7 +165,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
BUTTON_CHAIN_WHENAVAIL
:
{
case
BUTTON_CHAIN_WHENAVAIL
:
{
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
mainGame
->
chain_when_avail
=
mainGame
->
btnChainWhenAvail
->
isPressed
();
mainGame
->
chain_when_avail
=
mainGame
->
btnChainWhenAvail
->
isPressed
();
mainGame
->
always_chain
=
false
;
mainGame
->
always_chain
=
false
;
mainGame
->
ignore_chain
=
false
;
mainGame
->
ignore_chain
=
false
;
...
@@ -172,7 +173,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -172,7 +173,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
BUTTON_CANCEL_OR_FINISH
:
{
case
BUTTON_CANCEL_OR_FINISH
:
{
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
switch
(
mainGame
->
dInfo
.
curMsg
)
{
switch
(
mainGame
->
dInfo
.
curMsg
)
{
case
MSG_WAITING
:
{
case
MSG_WAITING
:
{
if
(
mainGame
->
wCardSelect
->
isVisible
())
{
if
(
mainGame
->
wCardSelect
->
isVisible
())
{
...
@@ -282,7 +283,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -282,7 +283,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
}
else
{
else
{
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PlaySoundEffect
(
SOUND_QUESTION
);
ShowCancelOrFinishButton
(
0
);
ShowCancelOrFinishButton
(
0
);
}
}
if
(
mainGame
->
wOptions
->
isVisible
())
{
if
(
mainGame
->
wOptions
->
isVisible
())
{
...
@@ -304,13 +304,13 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -304,13 +304,13 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
BUTTON_MSG_OK
:
{
case
BUTTON_MSG_OK
:
{
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
mainGame
->
HideElement
(
mainGame
->
wMessage
);
mainGame
->
HideElement
(
mainGame
->
wMessage
);
mainGame
->
actionSignal
.
Set
();
mainGame
->
actionSignal
.
Set
();
break
;
break
;
}
}
case
BUTTON_YES
:
{
case
BUTTON_YES
:
{
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
switch
(
mainGame
->
dInfo
.
curMsg
)
{
switch
(
mainGame
->
dInfo
.
curMsg
)
{
case
MSG_SELECT_YESNO
:
case
MSG_SELECT_YESNO
:
case
MSG_SELECT_EFFECTYN
:
{
case
MSG_SELECT_EFFECTYN
:
{
...
@@ -344,7 +344,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -344,7 +344,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
BUTTON_NO
:
{
case
BUTTON_NO
:
{
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
switch
(
mainGame
->
dInfo
.
curMsg
)
{
switch
(
mainGame
->
dInfo
.
curMsg
)
{
case
MSG_SELECT_YESNO
:
case
MSG_SELECT_YESNO
:
case
MSG_SELECT_EFFECTYN
:
{
case
MSG_SELECT_EFFECTYN
:
{
...
@@ -397,7 +397,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -397,7 +397,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
BUTTON_OPTION_PREV
:
{
case
BUTTON_OPTION_PREV
:
{
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
selected_option
--
;
selected_option
--
;
mainGame
->
btnOptionn
->
setVisible
(
true
);
mainGame
->
btnOptionn
->
setVisible
(
true
);
if
(
selected_option
==
0
)
if
(
selected_option
==
0
)
...
@@ -406,7 +406,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -406,7 +406,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
BUTTON_OPTION_NEXT
:
{
case
BUTTON_OPTION_NEXT
:
{
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
selected_option
++
;
selected_option
++
;
mainGame
->
btnOptionp
->
setVisible
(
true
);
mainGame
->
btnOptionp
->
setVisible
(
true
);
if
(
selected_option
==
select_options
.
size
()
-
1
)
if
(
selected_option
==
select_options
.
size
()
-
1
)
...
@@ -415,7 +415,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -415,7 +415,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
BUTTON_OPTION_OK
:
{
case
BUTTON_OPTION_OK
:
{
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
if
(
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_OPTION
)
{
if
(
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_OPTION
)
{
DuelClient
::
SetResponseI
(
selected_option
);
DuelClient
::
SetResponseI
(
selected_option
);
}
else
{
}
else
{
...
@@ -433,13 +433,13 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -433,13 +433,13 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
break
;
}
}
case
BUTTON_ANNUMBER_OK
:
{
case
BUTTON_ANNUMBER_OK
:
{
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
DuelClient
::
SetResponseI
(
mainGame
->
cbANNumber
->
getSelected
());
DuelClient
::
SetResponseI
(
mainGame
->
cbANNumber
->
getSelected
());
mainGame
->
HideElement
(
mainGame
->
wANNumber
,
true
);
mainGame
->
HideElement
(
mainGame
->
wANNumber
,
true
);
break
;
break
;
}
}
case
BUTTON_ANCARD_OK
:
{
case
BUTTON_ANCARD_OK
:
{
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
int
sel
=
mainGame
->
lstANCard
->
getSelected
();
int
sel
=
mainGame
->
lstANCard
->
getSelected
();
if
(
sel
==
-
1
)
if
(
sel
==
-
1
)
break
;
break
;
...
@@ -1456,7 +1456,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -1456,7 +1456,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
BufferIO
::
CopyWStrRef
(
dataManager
.
GetSysString
(
210
),
pwbuf
,
256
);
BufferIO
::
CopyWStrRef
(
dataManager
.
GetSysString
(
210
),
pwbuf
,
256
);
mainGame
->
stQMessage
->
setText
(
wbuf
);
mainGame
->
stQMessage
->
setText
(
wbuf
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PlaySoundEffect
(
SOUND_QUESTION
);
}
}
}
}
}
else
{
}
else
{
...
@@ -1632,7 +1631,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -1632,7 +1631,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame
->
HideElement
(
mainGame
->
wQuery
,
true
);
mainGame
->
HideElement
(
mainGame
->
wQuery
,
true
);
}
else
{
}
else
{
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
mainGame
->
PlaySoundEffect
(
SOUND_QUESTION
);
ShowCancelOrFinishButton
(
0
);
ShowCancelOrFinishButton
(
0
);
}
}
if
(
mainGame
->
wOptions
->
isVisible
())
{
if
(
mainGame
->
wOptions
->
isVisible
())
{
...
@@ -1985,7 +1983,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
...
@@ -1985,7 +1983,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
case
irr
:
:
gui
::
EGET_BUTTON_CLICKED
:
{
case
irr
:
:
gui
::
EGET_BUTTON_CLICKED
:
{
switch
(
id
)
{
switch
(
id
)
{
case
BUTTON_CLEAR_LOG
:
{
case
BUTTON_CLEAR_LOG
:
{
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
mainGame
->
lstLog
->
clear
();
mainGame
->
lstLog
->
clear
();
mainGame
->
logParam
.
clear
();
mainGame
->
logParam
.
clear
();
return
true
;
return
true
;
...
@@ -2004,7 +2002,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
...
@@ -2004,7 +2002,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
#ifdef YGOPRO_USE_IRRKLANG
#ifdef YGOPRO_USE_IRRKLANG
case
CHECKBOX_ENABLE_MUSIC
:
{
case
CHECKBOX_ENABLE_MUSIC
:
{
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
mainGame
->
engineMusic
->
stopAllSounds
();
soundManager
.
StopBGM
();
return
true
;
return
true
;
break
;
break
;
}
}
...
@@ -2050,8 +2048,9 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
...
@@ -2050,8 +2048,9 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
case
SCROLL_VOLUME
:
{
case
SCROLL_VOLUME
:
{
mainGame
->
gameConf
.
sound_volume
=
(
double
)
mainGame
->
scrSoundVolume
->
getPos
()
/
100
;
mainGame
->
gameConf
.
sound_volume
=
(
double
)
mainGame
->
scrSoundVolume
->
getPos
()
/
100
;
mainGame
->
gameConf
.
music_volume
=
(
double
)
mainGame
->
scrMusicVolume
->
getPos
()
/
100
;
mainGame
->
gameConf
.
music_volume
=
(
double
)
mainGame
->
scrMusicVolume
->
getPos
()
/
100
;
mainGame
->
engineSound
->
setSoundVolume
(
mainGame
->
gameConf
.
sound_volume
);
soundManager
.
SetSoundVolume
(
mainGame
->
gameConf
.
sound_volume
);
mainGame
->
engineMusic
->
setSoundVolume
(
mainGame
->
gameConf
.
music_volume
);
soundManager
.
SetMusicVolume
(
mainGame
->
gameConf
.
music_volume
);
return
true
;
break
;
break
;
}
}
#endif
#endif
...
...
gframe/game.cpp
View file @
95217ec7
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include "image_manager.h"
#include "image_manager.h"
#include "data_manager.h"
#include "data_manager.h"
#include "deck_manager.h"
#include "deck_manager.h"
#include "sound_manager.h"
#include "replay.h"
#include "replay.h"
#include "materials.h"
#include "materials.h"
#include "duelclient.h"
#include "duelclient.h"
...
@@ -44,7 +45,6 @@ bool Game::Initialize() {
...
@@ -44,7 +45,6 @@ bool Game::Initialize() {
ignore_chain
=
false
;
ignore_chain
=
false
;
chain_when_avail
=
false
;
chain_when_avail
=
false
;
is_building
=
false
;
is_building
=
false
;
bgm_scene
=
-
1
;
memset
(
&
dInfo
,
0
,
sizeof
(
DuelInfo
));
memset
(
&
dInfo
,
0
,
sizeof
(
DuelInfo
));
memset
(
chatTiming
,
0
,
sizeof
(
chatTiming
));
memset
(
chatTiming
,
0
,
sizeof
(
chatTiming
));
deckManager
.
LoadLFList
();
deckManager
.
LoadLFList
();
...
@@ -655,32 +655,26 @@ bool Game::Initialize() {
...
@@ -655,32 +655,26 @@ bool Game::Initialize() {
stTip
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
stTip
->
setTextAlignment
(
irr
::
gui
::
EGUIA_CENTER
,
irr
::
gui
::
EGUIA_CENTER
);
stTip
->
setVisible
(
false
);
stTip
->
setVisible
(
false
);
device
->
setEventReceiver
(
&
menuHandler
);
device
->
setEventReceiver
(
&
menuHandler
);
RefreshBGMList
();
LoadConfig
();
LoadConfig
();
env
->
getSkin
()
->
setFont
(
guiFont
);
if
(
!
soundManager
.
Init
())
{
env
->
setFocus
(
wMainMenu
);
for
(
u32
i
=
0
;
i
<
EGDC_COUNT
;
++
i
)
{
SColor
col
=
env
->
getSkin
()
->
getColor
((
EGUI_DEFAULT_COLOR
)
i
);
col
.
setAlpha
(
224
);
env
->
getSkin
()
->
setColor
((
EGUI_DEFAULT_COLOR
)
i
,
col
);
}
#ifdef YGOPRO_USE_IRRKLANG
engineSound
=
irrklang
::
createIrrKlangDevice
();
engineMusic
=
irrklang
::
createIrrKlangDevice
();
if
(
!
engineSound
||
!
engineMusic
)
{
chkEnableSound
->
setChecked
(
false
);
chkEnableSound
->
setChecked
(
false
);
chkEnableSound
->
setEnabled
(
false
);
chkEnableSound
->
setEnabled
(
false
);
chkEnableSound
->
setVisible
(
false
);
chkEnableMusic
->
setChecked
(
false
);
chkEnableMusic
->
setChecked
(
false
);
chkEnableMusic
->
setEnabled
(
false
);
chkEnableMusic
->
setEnabled
(
false
);
chkEnableMusic
->
setVisible
(
false
);
scrSoundVolume
->
setVisible
(
false
);
scrMusicVolume
->
setVisible
(
false
);
chkMusicMode
->
setEnabled
(
false
);
chkMusicMode
->
setEnabled
(
false
);
chkMusicMode
->
setVisible
(
false
);
}
}
#ifdef YGOPRO_USE_IKPMP3
env
->
getSkin
()
->
setFont
(
guiFont
);
else
{
env
->
setFocus
(
wMainMenu
);
irrklang
::
ikpMP3Init
(
engineSound
);
for
(
u32
i
=
0
;
i
<
EGDC_COUNT
;
++
i
)
{
irrklang
::
ikpMP3Init
(
engineMusic
);
SColor
col
=
env
->
getSkin
()
->
getColor
((
EGUI_DEFAULT_COLOR
)
i
);
col
.
setAlpha
(
224
);
env
->
getSkin
()
->
setColor
((
EGUI_DEFAULT_COLOR
)
i
,
col
);
}
}
#endif
#endif
hideChat
=
false
;
hideChat
=
false
;
hideChatTimer
=
0
;
hideChatTimer
=
0
;
return
true
;
return
true
;
...
@@ -711,15 +705,15 @@ void Game::MainLoop() {
...
@@ -711,15 +705,15 @@ void Game::MainLoop() {
gMutex
.
Lock
();
gMutex
.
Lock
();
if
(
dInfo
.
isStarted
)
{
if
(
dInfo
.
isStarted
)
{
if
(
mainGame
->
dInfo
.
isFinished
&&
mainGame
->
showcardcode
==
1
)
if
(
mainGame
->
dInfo
.
isFinished
&&
mainGame
->
showcardcode
==
1
)
PlayBGM
(
BGM_WIN
);
soundManager
.
PlayBGM
(
BGM_WIN
);
else
if
(
mainGame
->
dInfo
.
isFinished
&&
(
mainGame
->
showcardcode
==
2
||
mainGame
->
showcardcode
==
3
))
else
if
(
mainGame
->
dInfo
.
isFinished
&&
(
mainGame
->
showcardcode
==
2
||
mainGame
->
showcardcode
==
3
))
PlayBGM
(
BGM_LOSE
);
soundManager
.
PlayBGM
(
BGM_LOSE
);
else
if
(
mainGame
->
dInfo
.
lp
[
0
]
>
0
&&
mainGame
->
dInfo
.
lp
[
0
]
<=
mainGame
->
dInfo
.
lp
[
1
]
/
2
)
else
if
(
mainGame
->
dInfo
.
lp
[
0
]
>
0
&&
mainGame
->
dInfo
.
lp
[
0
]
<=
mainGame
->
dInfo
.
lp
[
1
]
/
2
)
PlayBGM
(
BGM_DISADVANTAGE
);
soundManager
.
PlayBGM
(
BGM_DISADVANTAGE
);
else
if
(
mainGame
->
dInfo
.
lp
[
0
]
>
0
&&
mainGame
->
dInfo
.
lp
[
0
]
>=
mainGame
->
dInfo
.
lp
[
1
]
*
2
)
else
if
(
mainGame
->
dInfo
.
lp
[
0
]
>
0
&&
mainGame
->
dInfo
.
lp
[
0
]
>=
mainGame
->
dInfo
.
lp
[
1
]
*
2
)
PlayBGM
(
BGM_ADVANTAGE
);
soundManager
.
PlayBGM
(
BGM_ADVANTAGE
);
else
else
PlayBGM
(
BGM_DUEL
);
soundManager
.
PlayBGM
(
BGM_DUEL
);
DrawBackImage
(
imageManager
.
tBackGround
);
DrawBackImage
(
imageManager
.
tBackGround
);
DrawBackGround
();
DrawBackGround
();
DrawCards
();
DrawCards
();
...
@@ -728,11 +722,11 @@ void Game::MainLoop() {
...
@@ -728,11 +722,11 @@ void Game::MainLoop() {
driver
->
setMaterial
(
irr
::
video
::
IdentityMaterial
);
driver
->
setMaterial
(
irr
::
video
::
IdentityMaterial
);
driver
->
clearZBuffer
();
driver
->
clearZBuffer
();
}
else
if
(
is_building
)
{
}
else
if
(
is_building
)
{
PlayBGM
(
BGM_DECK
);
soundManager
.
PlayBGM
(
BGM_DECK
);
DrawBackImage
(
imageManager
.
tBackGround_deck
);
DrawBackImage
(
imageManager
.
tBackGround_deck
);
DrawDeckBd
();
DrawDeckBd
();
}
else
{
}
else
{
PlayBGM
(
BGM_MENU
);
soundManager
.
PlayBGM
(
BGM_MENU
);
DrawBackImage
(
imageManager
.
tBackGround_menu
);
DrawBackImage
(
imageManager
.
tBackGround_menu
);
}
}
DrawGUI
();
DrawGUI
();
...
@@ -789,10 +783,6 @@ void Game::MainLoop() {
...
@@ -789,10 +783,6 @@ void Game::MainLoop() {
usleep
(
500000
);
usleep
(
500000
);
#endif
#endif
SaveConfig
();
SaveConfig
();
#ifdef YGOPRO_USE_IRRKLANG
if
(
engineMusic
)
engineMusic
->
drop
();
#endif
// device->drop();
// device->drop();
}
}
void
Game
::
BuildProjectionMatrix
(
irr
::
core
::
matrix4
&
mProjection
,
f32
left
,
f32
right
,
f32
bottom
,
f32
top
,
f32
znear
,
f32
zfar
)
{
void
Game
::
BuildProjectionMatrix
(
irr
::
core
::
matrix4
&
mProjection
,
f32
left
,
f32
right
,
f32
bottom
,
f32
top
,
f32
znear
,
f32
zfar
)
{
...
@@ -980,49 +970,6 @@ void Game::RefreshSingleplay() {
...
@@ -980,49 +970,6 @@ void Game::RefreshSingleplay() {
closedir
(
dir
);
closedir
(
dir
);
#endif
#endif
}
}
void
Game
::
RefreshBGMList
()
{
RefershBGMDir
(
L""
,
BGM_DUEL
);
RefershBGMDir
(
L"duel/"
,
BGM_DUEL
);
RefershBGMDir
(
L"menu/"
,
BGM_MENU
);
RefershBGMDir
(
L"deck/"
,
BGM_DECK
);
RefershBGMDir
(
L"advantage/"
,
BGM_ADVANTAGE
);
RefershBGMDir
(
L"disadvantage/"
,
BGM_DISADVANTAGE
);
RefershBGMDir
(
L"win/"
,
BGM_WIN
);
RefershBGMDir
(
L"lose/"
,
BGM_LOSE
);
}
void
Game
::
RefershBGMDir
(
std
::
wstring
path
,
int
scene
)
{
#ifdef YGOPRO_USE_IRRKLANG
#ifdef _WIN32
WIN32_FIND_DATAW
fdataw
;
std
::
wstring
search
=
L"./sound/BGM/"
+
path
+
L"*.mp3"
;
HANDLE
fh
=
FindFirstFileW
(
search
.
c_str
(),
&
fdataw
);
if
(
fh
==
INVALID_HANDLE_VALUE
)
return
;
do
{
if
(
!
(
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
{
std
::
wstring
filename
=
path
+
(
std
::
wstring
)
fdataw
.
cFileName
;
BGMList
[
BGM_ALL
].
push_back
(
filename
);
BGMList
[
scene
].
push_back
(
filename
);
}
}
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
[
BGM_ALL
].
push_back
(
wname
);
}
closedir
(
dir
);
#endif
#endif
}
void
Game
::
RefreshBot
()
{
void
Game
::
RefreshBot
()
{
if
(
!
gameConf
.
enable_bot_mode
)
if
(
!
gameConf
.
enable_bot_mode
)
return
;
return
;
...
@@ -1256,169 +1203,6 @@ void Game::SaveConfig() {
...
@@ -1256,169 +1203,6 @@ void Game::SaveConfig() {
fprintf
(
fp
,
"enable_bot_mode = %d
\n
"
,
gameConf
.
enable_bot_mode
);
fprintf
(
fp
,
"enable_bot_mode = %d
\n
"
,
gameConf
.
enable_bot_mode
);
fclose
(
fp
);
fclose
(
fp
);
}
}
void
Game
::
PlaySoundEffect
(
int
sound
)
{
#ifdef YGOPRO_USE_IRRKLANG
if
(
!
mainGame
->
chkEnableSound
->
isChecked
())
return
;
switch
(
sound
)
{
case
SOUND_SUMMON
:
{
engineSound
->
play2D
(
"./sound/summon.wav"
);
break
;
}
case
SOUND_SPECIAL_SUMMON
:
{
engineSound
->
play2D
(
"./sound/specialsummon.wav"
);
break
;
}
case
SOUND_ACTIVATE
:
{
engineSound
->
play2D
(
"./sound/activate.wav"
);
break
;
}
case
SOUND_SET
:
{
engineSound
->
play2D
(
"./sound/set.wav"
);
break
;
}
case
SOUND_FILP
:
{
engineSound
->
play2D
(
"./sound/flip.wav"
);
break
;
}
case
SOUND_REVEAL
:
{
engineSound
->
play2D
(
"./sound/reveal.wav"
);
break
;
}
case
SOUND_EQUIP
:
{
engineSound
->
play2D
(
"./sound/equip.wav"
);
break
;
}
case
SOUND_DESTROYED
:
{
engineSound
->
play2D
(
"./sound/destroyed.wav"
);
break
;
}
case
SOUND_BANISHED
:
{
engineSound
->
play2D
(
"./sound/banished.wav"
);
break
;
}
case
SOUND_TOKEN
:
{
engineSound
->
play2D
(
"./sound/token.wav"
);
break
;
}
case
SOUND_ATTACK
:
{
engineSound
->
play2D
(
"./sound/attack.wav"
);
break
;
}
case
SOUND_DIRECT_ATTACK
:
{
engineSound
->
play2D
(
"./sound/directattack.wav"
);
break
;
}
case
SOUND_DRAW
:
{
engineSound
->
play2D
(
"./sound/draw.wav"
);
break
;
}
case
SOUND_SHUFFLE
:
{
engineSound
->
play2D
(
"./sound/shuffle.wav"
);
break
;
}
case
SOUND_DAMAGE
:
{
engineSound
->
play2D
(
"./sound/damage.wav"
);
break
;
}
case
SOUND_RECOVER
:
{
engineSound
->
play2D
(
"./sound/gainlp.wav"
);
break
;
}
case
SOUND_COUNTER_ADD
:
{
engineSound
->
play2D
(
"./sound/addcounter.wav"
);
break
;
}
case
SOUND_COUNTER_REMOVE
:
{
engineSound
->
play2D
(
"./sound/removecounter.wav"
);
break
;
}
case
SOUND_COIN
:
{
engineSound
->
play2D
(
"./sound/coinflip.wav"
);
break
;
}
case
SOUND_DICE
:
{
engineSound
->
play2D
(
"./sound/diceroll.wav"
);
break
;
}
case
SOUND_NEXT_TURN
:
{
engineSound
->
play2D
(
"./sound/nextturn.wav"
);
break
;
}
case
SOUND_PHASE
:
{
engineSound
->
play2D
(
"./sound/phase.wav"
);
break
;
}
case
SOUND_MENU
:
{
engineSound
->
play2D
(
"./sound/menu.wav"
);
break
;
}
case
SOUND_BUTTON
:
{
engineSound
->
play2D
(
"./sound/button.wav"
);
break
;
}
case
SOUND_INFO
:
{
engineSound
->
play2D
(
"./sound/info.wav"
);
break
;
}
case
SOUND_QUESTION
:
{
engineSound
->
play2D
(
"./sound/question.wav"
);
break
;
}
case
SOUND_CARD_PICK
:
{
engineSound
->
play2D
(
"./sound/cardpick.wav"
);
break
;
}
case
SOUND_CARD_DROP
:
{
engineSound
->
play2D
(
"./sound/carddrop.wav"
);
break
;
}
case
SOUND_PLAYER_ENTER
:
{
engineSound
->
play2D
(
"./sound/playerenter.wav"
);
break
;
}
case
SOUND_CHAT
:
{
engineSound
->
play2D
(
"./sound/chatmessage.wav"
);
break
;
}
default:
break
;
}
engineSound
->
setSoundVolume
(
gameConf
.
sound_volume
);
#endif
}
void
Game
::
PlayMusic
(
char
*
song
,
bool
loop
)
{
#ifdef YGOPRO_USE_IRRKLANG
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
return
;
if
(
!
engineMusic
->
isCurrentlyPlaying
(
song
))
{
engineMusic
->
stopAllSounds
();
soundBGM
=
engineMusic
->
play2D
(
song
,
loop
,
false
,
true
);
engineMusic
->
setSoundVolume
(
gameConf
.
music_volume
);
}
#endif
}
void
Game
::
PlayBGM
(
int
scene
)
{
#ifdef YGOPRO_USE_IRRKLANG
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
return
;
if
(
!
mainGame
->
chkMusicMode
->
isChecked
())
scene
=
BGM_ALL
;
char
BGMName
[
1024
];
if
(
scene
!=
bgm_scene
||
(
soundBGM
&&
soundBGM
->
isFinished
()))
{
int
count
=
BGMList
[
scene
].
size
();
if
(
count
<=
0
)
return
;
bgm_scene
=
scene
;
int
bgm
=
rand
()
%
count
;
auto
name
=
BGMList
[
scene
][
bgm
].
c_str
();
wchar_t
fname
[
1024
];
myswprintf
(
fname
,
L"./sound/BGM/%ls"
,
name
);
BufferIO
::
EncodeUTF8
(
fname
,
BGMName
);
PlayMusic
(
BGMName
,
false
);
}
#endif
}
void
Game
::
ShowCardInfo
(
int
code
)
{
void
Game
::
ShowCardInfo
(
int
code
)
{
CardData
cd
;
CardData
cd
;
wchar_t
formatBuffer
[
256
];
wchar_t
formatBuffer
[
256
];
...
@@ -1519,17 +1303,17 @@ void Game::AddChatMsg(wchar_t* msg, int player) {
...
@@ -1519,17 +1303,17 @@ void Game::AddChatMsg(wchar_t* msg, int player) {
chatMsg
[
0
].
append
(
L": "
);
chatMsg
[
0
].
append
(
L": "
);
break
;
break
;
case
1
:
//from client
case
1
:
//from client
mainGame
->
PlaySoundEffect
(
SOUND_CHAT
);
soundManager
.
PlaySoundEffect
(
SOUND_CHAT
);
chatMsg
[
0
].
append
(
dInfo
.
clientname
);
chatMsg
[
0
].
append
(
dInfo
.
clientname
);
chatMsg
[
0
].
append
(
L": "
);
chatMsg
[
0
].
append
(
L": "
);
break
;
break
;
case
2
:
//host tag
case
2
:
//host tag
mainGame
->
PlaySoundEffect
(
SOUND_CHAT
);
soundManager
.
PlaySoundEffect
(
SOUND_CHAT
);
chatMsg
[
0
].
append
(
dInfo
.
hostname_tag
);
chatMsg
[
0
].
append
(
dInfo
.
hostname_tag
);
chatMsg
[
0
].
append
(
L": "
);
chatMsg
[
0
].
append
(
L": "
);
break
;
break
;
case
3
:
//client tag
case
3
:
//client tag
mainGame
->
PlaySoundEffect
(
SOUND_CHAT
);
soundManager
.
PlaySoundEffect
(
SOUND_CHAT
);
chatMsg
[
0
].
append
(
dInfo
.
clientname_tag
);
chatMsg
[
0
].
append
(
dInfo
.
clientname_tag
);
chatMsg
[
0
].
append
(
L": "
);
chatMsg
[
0
].
append
(
L": "
);
break
;
break
;
...
@@ -1538,7 +1322,7 @@ void Game::AddChatMsg(wchar_t* msg, int player) {
...
@@ -1538,7 +1322,7 @@ void Game::AddChatMsg(wchar_t* msg, int player) {
chatMsg
[
0
].
append
(
L": "
);
chatMsg
[
0
].
append
(
L": "
);
break
;
break
;
case
8
:
//system custom message, no prefix.
case
8
:
//system custom message, no prefix.
mainGame
->
PlaySoundEffect
(
SOUND_CHAT
);
soundManager
.
PlaySoundEffect
(
SOUND_CHAT
);
chatMsg
[
0
].
append
(
L"[System]: "
);
chatMsg
[
0
].
append
(
L"[System]: "
);
break
;
break
;
case
9
:
//error message
case
9
:
//error message
...
...
gframe/game.h
View file @
95217ec7
...
@@ -107,8 +107,6 @@ public:
...
@@ -107,8 +107,6 @@ public:
void
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshDeck
(
irr
::
gui
::
IGUIComboBox
*
cbDeck
);
void
RefreshReplay
();
void
RefreshReplay
();
void
RefreshSingleplay
();
void
RefreshSingleplay
();
void
RefreshBGMList
();
void
RefershBGMDir
(
std
::
wstring
path
,
int
scene
);
void
RefreshBot
();
void
RefreshBot
();
void
DrawSelectionLine
(
irr
::
video
::
S3DVertex
*
vec
,
bool
strip
,
int
width
,
float
*
cv
);
void
DrawSelectionLine
(
irr
::
video
::
S3DVertex
*
vec
,
bool
strip
,
int
width
,
float
*
cv
);
void
DrawBackGround
();
void
DrawBackGround
();
...
@@ -134,9 +132,6 @@ public:
...
@@ -134,9 +132,6 @@ public:
void
AddDebugMsg
(
char
*
msgbuf
);
void
AddDebugMsg
(
char
*
msgbuf
);
void
ClearTextures
();
void
ClearTextures
();
void
CloseDuelWindow
();
void
CloseDuelWindow
();
void
PlaySoundEffect
(
int
sound
);
void
PlayMusic
(
char
*
song
,
bool
loop
);
void
PlayBGM
(
int
scene
);
int
LocalPlayer
(
int
player
);
int
LocalPlayer
(
int
player
);
const
wchar_t
*
LocalName
(
int
local_player
);
const
wchar_t
*
LocalName
(
int
local_player
);
...
@@ -163,7 +158,6 @@ public:
...
@@ -163,7 +158,6 @@ public:
std
::
list
<
FadingUnit
>
fadingList
;
std
::
list
<
FadingUnit
>
fadingList
;
std
::
vector
<
int
>
logParam
;
std
::
vector
<
int
>
logParam
;
std
::
wstring
chatMsg
[
8
];
std
::
wstring
chatMsg
[
8
];
std
::
vector
<
std
::
wstring
>
BGMList
[
8
];
std
::
vector
<
BotInfo
>
botInfo
;
std
::
vector
<
BotInfo
>
botInfo
;
int
hideChatTimer
;
int
hideChatTimer
;
...
@@ -196,8 +190,6 @@ public:
...
@@ -196,8 +190,6 @@ public:
bool
is_building
;
bool
is_building
;
bool
is_siding
;
bool
is_siding
;
int
bgm_scene
;
ClientField
dField
;
ClientField
dField
;
DeckBuilder
deckBuilder
;
DeckBuilder
deckBuilder
;
MenuHandler
menuHandler
;
MenuHandler
menuHandler
;
...
@@ -468,13 +460,6 @@ public:
...
@@ -468,13 +460,6 @@ public:
irr
::
gui
::
IGUIButton
*
btnChainWhenAvail
;
irr
::
gui
::
IGUIButton
*
btnChainWhenAvail
;
//cancel or finish
//cancel or finish
irr
::
gui
::
IGUIButton
*
btnCancelOrFinish
;
irr
::
gui
::
IGUIButton
*
btnCancelOrFinish
;
//soundEngine
#ifdef YGOPRO_USE_IRRKLANG
irrklang
::
ISoundEngine
*
engineSound
;
irrklang
::
ISoundEngine
*
engineMusic
;
irrklang
::
ISound
*
soundBGM
;
#endif
};
};
extern
Game
*
mainGame
;
extern
Game
*
mainGame
;
...
...
gframe/menu_handler.cpp
View file @
95217ec7
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#include "replay_mode.h"
#include "replay_mode.h"
#include "single_mode.h"
#include "single_mode.h"
#include "image_manager.h"
#include "image_manager.h"
#include "sound_manager.h"
#include "game.h"
#include "game.h"
namespace
ygo
{
namespace
ygo
{
...
@@ -33,9 +34,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
...
@@ -33,9 +34,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
switch
(
event
.
GUIEvent
.
EventType
)
{
switch
(
event
.
GUIEvent
.
EventType
)
{
case
irr
:
:
gui
::
EGET_BUTTON_CLICKED
:
{
case
irr
:
:
gui
::
EGET_BUTTON_CLICKED
:
{
if
(
id
<
110
)
if
(
id
<
110
)
mainGame
->
PlaySoundEffect
(
SOUND_MENU
);
soundManager
.
PlaySoundEffect
(
SOUND_MENU
);
else
else
mainGame
->
PlaySoundEffect
(
SOUND_BUTTON
);
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
switch
(
id
)
{
switch
(
id
)
{
case
BUTTON_MODE_EXIT
:
{
case
BUTTON_MODE_EXIT
:
{
mainGame
->
device
->
closeDevice
();
mainGame
->
device
->
closeDevice
();
...
...
gframe/replay_mode.cpp
View file @
95217ec7
...
@@ -313,7 +313,6 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
...
@@ -313,7 +313,6 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
stMessage
->
setText
(
L"Error occurs."
);
mainGame
->
stMessage
->
setText
(
L"Error occurs."
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Wait
();
mainGame
->
actionSignal
.
Wait
();
...
...
gframe/single_mode.cpp
View file @
95217ec7
...
@@ -179,7 +179,6 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
...
@@ -179,7 +179,6 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
stMessage
->
setText
(
L"Error occurs."
);
mainGame
->
stMessage
->
setText
(
L"Error occurs."
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Wait
();
mainGame
->
actionSignal
.
Wait
();
...
@@ -786,7 +785,6 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
...
@@ -786,7 +785,6 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
mainGame
->
gMutex
.
Lock
();
mainGame
->
gMutex
.
Lock
();
mainGame
->
SetStaticText
(
mainGame
->
stMessage
,
310
,
mainGame
->
textFont
,
msg
);
mainGame
->
SetStaticText
(
mainGame
->
stMessage
,
310
,
mainGame
->
textFont
,
msg
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
PopupElement
(
mainGame
->
wMessage
);
mainGame
->
PlaySoundEffect
(
SOUND_INFO
);
mainGame
->
gMutex
.
Unlock
();
mainGame
->
gMutex
.
Unlock
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Reset
();
mainGame
->
actionSignal
.
Wait
();
mainGame
->
actionSignal
.
Wait
();
...
...
gframe/sound_manager.cpp
0 → 100644
View file @
95217ec7
#include "sound_manager.h"
namespace
ygo
{
SoundManager
soundManager
;
bool
SoundManager
::
Init
()
{
#ifdef YGOPRO_USE_IRRKLANG
bgm_scene
=
-
1
;
RefreshBGMList
();
engineSound
=
irrklang
::
createIrrKlangDevice
();
engineMusic
=
irrklang
::
createIrrKlangDevice
();
if
(
!
engineSound
||
!
engineMusic
)
{
return
false
;
}
else
{
#ifdef IRRKLANG_STATIC
irrklang
::
ikpMP3Init
(
engineSound
);
irrklang
::
ikpMP3Init
(
engineMusic
);
#endif
return
true
;
}
#endif // YGOPRO_USE_IRRKLANG
// TODO: Implement other sound engines
return
false
;
}
void
SoundManager
::
RefreshBGMList
()
{
RefershBGMDir
(
L""
,
BGM_DUEL
);
RefershBGMDir
(
L"duel/"
,
BGM_DUEL
);
RefershBGMDir
(
L"menu/"
,
BGM_MENU
);
RefershBGMDir
(
L"deck/"
,
BGM_DECK
);
RefershBGMDir
(
L"advantage/"
,
BGM_ADVANTAGE
);
RefershBGMDir
(
L"disadvantage/"
,
BGM_DISADVANTAGE
);
RefershBGMDir
(
L"win/"
,
BGM_WIN
);
RefershBGMDir
(
L"lose/"
,
BGM_LOSE
);
}
void
SoundManager
::
RefershBGMDir
(
std
::
wstring
path
,
int
scene
)
{
#ifdef _WIN32
WIN32_FIND_DATAW
fdataw
;
std
::
wstring
search
=
L"./sound/BGM/"
+
path
+
L"*.mp3"
;
HANDLE
fh
=
FindFirstFileW
(
search
.
c_str
(),
&
fdataw
);
if
(
fh
==
INVALID_HANDLE_VALUE
)
return
;
do
{
if
(
!
(
fdataw
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
{
std
::
wstring
filename
=
path
+
(
std
::
wstring
)
fdataw
.
cFileName
;
BGMList
[
BGM_ALL
].
push_back
(
filename
);
BGMList
[
scene
].
push_back
(
filename
);
}
}
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
[
BGM_ALL
].
push_back
(
wname
);
}
closedir
(
dir
);
#endif
}
void
SoundManager
::
PlaySoundEffect
(
int
sound
)
{
#ifdef YGOPRO_USE_IRRKLANG
if
(
!
mainGame
->
chkEnableSound
->
isChecked
())
return
;
switch
(
sound
)
{
case
SOUND_SUMMON
:
{
engineSound
->
play2D
(
"./sound/summon.wav"
);
break
;
}
case
SOUND_SPECIAL_SUMMON
:
{
engineSound
->
play2D
(
"./sound/specialsummon.wav"
);
break
;
}
case
SOUND_ACTIVATE
:
{
engineSound
->
play2D
(
"./sound/activate.wav"
);
break
;
}
case
SOUND_SET
:
{
engineSound
->
play2D
(
"./sound/set.wav"
);
break
;
}
case
SOUND_FILP
:
{
engineSound
->
play2D
(
"./sound/flip.wav"
);
break
;
}
case
SOUND_REVEAL
:
{
engineSound
->
play2D
(
"./sound/reveal.wav"
);
break
;
}
case
SOUND_EQUIP
:
{
engineSound
->
play2D
(
"./sound/equip.wav"
);
break
;
}
case
SOUND_DESTROYED
:
{
engineSound
->
play2D
(
"./sound/destroyed.wav"
);
break
;
}
case
SOUND_BANISHED
:
{
engineSound
->
play2D
(
"./sound/banished.wav"
);
break
;
}
case
SOUND_TOKEN
:
{
engineSound
->
play2D
(
"./sound/token.wav"
);
break
;
}
case
SOUND_ATTACK
:
{
engineSound
->
play2D
(
"./sound/attack.wav"
);
break
;
}
case
SOUND_DIRECT_ATTACK
:
{
engineSound
->
play2D
(
"./sound/directattack.wav"
);
break
;
}
case
SOUND_DRAW
:
{
engineSound
->
play2D
(
"./sound/draw.wav"
);
break
;
}
case
SOUND_SHUFFLE
:
{
engineSound
->
play2D
(
"./sound/shuffle.wav"
);
break
;
}
case
SOUND_DAMAGE
:
{
engineSound
->
play2D
(
"./sound/damage.wav"
);
break
;
}
case
SOUND_RECOVER
:
{
engineSound
->
play2D
(
"./sound/gainlp.wav"
);
break
;
}
case
SOUND_COUNTER_ADD
:
{
engineSound
->
play2D
(
"./sound/addcounter.wav"
);
break
;
}
case
SOUND_COUNTER_REMOVE
:
{
engineSound
->
play2D
(
"./sound/removecounter.wav"
);
break
;
}
case
SOUND_COIN
:
{
engineSound
->
play2D
(
"./sound/coinflip.wav"
);
break
;
}
case
SOUND_DICE
:
{
engineSound
->
play2D
(
"./sound/diceroll.wav"
);
break
;
}
case
SOUND_NEXT_TURN
:
{
engineSound
->
play2D
(
"./sound/nextturn.wav"
);
break
;
}
case
SOUND_PHASE
:
{
engineSound
->
play2D
(
"./sound/phase.wav"
);
break
;
}
case
SOUND_MENU
:
{
engineSound
->
play2D
(
"./sound/menu.wav"
);
break
;
}
case
SOUND_BUTTON
:
{
engineSound
->
play2D
(
"./sound/button.wav"
);
break
;
}
case
SOUND_INFO
:
{
engineSound
->
play2D
(
"./sound/info.wav"
);
break
;
}
case
SOUND_QUESTION
:
{
engineSound
->
play2D
(
"./sound/question.wav"
);
break
;
}
case
SOUND_CARD_PICK
:
{
engineSound
->
play2D
(
"./sound/cardpick.wav"
);
break
;
}
case
SOUND_CARD_DROP
:
{
engineSound
->
play2D
(
"./sound/carddrop.wav"
);
break
;
}
case
SOUND_PLAYER_ENTER
:
{
engineSound
->
play2D
(
"./sound/playerenter.wav"
);
break
;
}
case
SOUND_CHAT
:
{
engineSound
->
play2D
(
"./sound/chatmessage.wav"
);
break
;
}
default:
break
;
}
engineSound
->
setSoundVolume
(
mainGame
->
gameConf
.
sound_volume
);
#endif
}
void
SoundManager
::
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
)
{
if
(
element
==
mainGame
->
wMessage
)
{
PlaySoundEffect
(
SOUND_INFO
);
}
else
if
(
element
==
mainGame
->
wQuery
)
{
PlaySoundEffect
(
SOUND_QUESTION
);
}
else
if
(
element
==
mainGame
->
wOptions
)
{
PlaySoundEffect
(
SOUND_QUESTION
);
}
else
if
(
element
==
mainGame
->
wANAttribute
)
{
PlaySoundEffect
(
SOUND_QUESTION
);
}
else
if
(
element
==
mainGame
->
wANCard
)
{
PlaySoundEffect
(
SOUND_QUESTION
);
}
else
if
(
element
==
mainGame
->
wANNumber
)
{
PlaySoundEffect
(
SOUND_QUESTION
);
}
else
if
(
element
==
mainGame
->
wANRace
)
{
PlaySoundEffect
(
SOUND_QUESTION
);
}
else
if
(
element
==
mainGame
->
wReplaySave
)
{
PlaySoundEffect
(
SOUND_QUESTION
);
}
}
void
SoundManager
::
PlayMusic
(
char
*
song
,
bool
loop
)
{
#ifdef YGOPRO_USE_IRRKLANG
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
return
;
if
(
!
engineMusic
->
isCurrentlyPlaying
(
song
))
{
engineMusic
->
stopAllSounds
();
soundBGM
=
engineMusic
->
play2D
(
song
,
loop
,
false
,
true
);
engineMusic
->
setSoundVolume
(
mainGame
->
gameConf
.
music_volume
);
}
#endif
}
void
SoundManager
::
PlayBGM
(
int
scene
)
{
#ifdef YGOPRO_USE_IRRKLANG
if
(
!
mainGame
->
chkEnableMusic
->
isChecked
())
return
;
if
(
!
mainGame
->
chkMusicMode
->
isChecked
())
scene
=
BGM_ALL
;
char
BGMName
[
1024
];
if
(
scene
!=
bgm_scene
||
(
soundBGM
&&
soundBGM
->
isFinished
()))
{
int
count
=
BGMList
[
scene
].
size
();
if
(
count
<=
0
)
return
;
bgm_scene
=
scene
;
int
bgm
=
rand
()
%
count
;
auto
name
=
BGMList
[
scene
][
bgm
].
c_str
();
wchar_t
fname
[
1024
];
myswprintf
(
fname
,
L"./sound/BGM/%ls"
,
name
);
BufferIO
::
EncodeUTF8
(
fname
,
BGMName
);
PlayMusic
(
BGMName
,
false
);
}
#endif
}
void
SoundManager
::
StopBGM
()
{
#ifdef YGOPRO_USE_IRRKLANG
engineMusic
->
stopAllSounds
();
#endif
}
void
SoundManager
::
SetSoundVolume
(
double
volume
)
{
#ifdef YGOPRO_USE_IRRKLANG
engineSound
->
setSoundVolume
(
volume
);
#endif
}
void
SoundManager
::
SetMusicVolume
(
double
volume
)
{
#ifdef YGOPRO_USE_IRRKLANG
engineMusic
->
setSoundVolume
(
volume
);
#endif
}
}
gframe/sound_manager.h
0 → 100644
View file @
95217ec7
#ifndef SOUNDMANAGER_H
#define SOUNDMANAGER_H
#include "config.h"
#include "game.h"
#ifdef YGOPRO_USE_IRRKLANG
#include <irrKlang.h>
#ifdef IRRKLANG_STATIC
#include "../ikpmp3/ikpMP3.h"
#endif
#endif
namespace
ygo
{
class
SoundManager
{
private:
std
::
vector
<
std
::
wstring
>
BGMList
[
8
];
int
bgm_scene
;
#ifdef YGOPRO_USE_IRRKLANG
irrklang
::
ISoundEngine
*
engineSound
;
irrklang
::
ISoundEngine
*
engineMusic
;
irrklang
::
ISound
*
soundBGM
;
#endif
void
RefershBGMDir
(
std
::
wstring
path
,
int
scene
);
public:
bool
Init
();
void
RefreshBGMList
();
void
PlaySoundEffect
(
int
sound
);
void
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
);
void
PlayMusic
(
char
*
song
,
bool
loop
);
void
PlayBGM
(
int
scene
);
void
StopBGM
();
void
SetSoundVolume
(
double
volume
);
void
SetMusicVolume
(
double
volume
);
};
extern
SoundManager
soundManager
;
}
#endif //SOUNDMANAGER_H
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